@searchstax-inc/searchstudio-ux-vue 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 +2 -0
- package/dist/@searchstax-inc/components/templates/SearchstaxInputWidgetTemplate.vue.d.ts +19 -1
- package/dist/@searchstax-inc/searchstudio-ux-vue.cjs +75 -72
- package/dist/@searchstax-inc/searchstudio-ux-vue.iife.js +75 -72
- package/dist/@searchstax-inc/searchstudio-ux-vue.mjs +2275 -1990
- package/dist/@searchstax-inc/stores/searchstaxStore.d.ts +421 -1298
- package/package.json +2 -3
|
@@ -1,72 +1,73 @@
|
|
|
1
|
-
var
|
|
2
|
-
]`).replace("lheading",
|
|
3
|
-
`).map(
|
|
4
|
-
`)}var
|
|
5
|
-
`)}}}fences(
|
|
6
|
-
`)}}blockquote(
|
|
1
|
+
var nl=Object.defineProperty;var rl=(te,i,z)=>i in te?nl(te,i,{enumerable:!0,configurable:!0,writable:!0,value:z}):te[i]=z;var u=(te,i,z)=>(rl(te,typeof i!="symbol"?i+"":i,z),z);(function(te,i){var ba;"use strict";var z=(n=>(n[n.mustache=0]="mustache",n[n.vue=1]="vue",n[n.react=2]="react",n[n.angular=3]="angular",n))(z||{});function Wt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oe=Wt();function Va(n){Oe=n}var it={exec:()=>null};function B(n,e=""){let t=typeof n=="string"?n:n.source;const a={replace:(s,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(ce.caret,"$1"),t=t.replace(s,o),a},getRegex:()=>new RegExp(t,e)};return a}var ce={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:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},rn=/^(?:[ \t]*(?:\n|$))+/,on=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,cn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ot=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ln=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Qt=/(?:[*+-]|\d{1,9}[.)])/,za=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,qa=B(za).replace(/bull/g,Qt).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(),hn=B(za).replace(/bull/g,Qt).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(),Ht=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,dn=/^[^\n]+/,Ut=/(?!\s*\])(?:\\.|[^\[\]\\])+/,un=B(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ut).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pn=B(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Qt).getRegex(),St="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",Yt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gn=B("^ {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",Yt).replace("tag",St).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Wa=B(Ht).replace("hr",ot).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",St).getRegex(),mn=B(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Wa).getRegex(),_t={blockquote:mn,code:on,def:un,fences:cn,heading:ln,hr:ot,html:gn,lheading:qa,list:pn,newline:rn,paragraph:Wa,table:it,text:dn},Qa=B("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ot).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",St).getRegex(),fn={..._t,lheading:hn,table:Qa,paragraph:B(Ht).replace("hr",ot).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Qa).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",St).getRegex()},yn={..._t,html:B(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Yt).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:it,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:B(Ht).replace("hr",ot).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",qa).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ln=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ha=/^( {2,}|\\)\n(?!\s*$)/,bn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Tt=/[\p{P}\p{S}]/u,Jt=/[\s\p{P}\p{S}]/u,Ua=/[^\s\p{P}\p{S}]/u,Cn=B(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Jt).getRegex(),Ya=/(?!~)[\p{P}\p{S}]/u,kn=/(?!~)[\s\p{P}\p{S}]/u,xn=/(?:[^\s\p{P}\p{S}]|~)/u,Mn=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,_a=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Sn=B(_a,"u").replace(/punct/g,Tt).getRegex(),Tn=B(_a,"u").replace(/punct/g,Ya).getRegex(),Ja="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",En=B(Ja,"gu").replace(/notPunctSpace/g,Ua).replace(/punctSpace/g,Jt).replace(/punct/g,Tt).getRegex(),Dn=B(Ja,"gu").replace(/notPunctSpace/g,xn).replace(/punctSpace/g,kn).replace(/punct/g,Ya).getRegex(),An=B("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ua).replace(/punctSpace/g,Jt).replace(/punct/g,Tt).getRegex(),In=B(/\\(punct)/,"gu").replace(/punct/g,Tt).getRegex(),vn=B(/^<(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(),jn=B(Yt).replace("(?:-->|$)","-->").getRegex(),Nn=B("^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",jn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Et=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Rn=B(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Et).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ga=B(/^!?\[(label)\]\[(ref)\]/).replace("label",Et).replace("ref",Ut).getRegex(),Ka=B(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ut).getRegex(),On=B("reflink|nolink(?!\\()","g").replace("reflink",Ga).replace("nolink",Ka).getRegex(),Gt={_backpedal:it,anyPunctuation:In,autolink:vn,blockSkip:Mn,br:Ha,code:wn,del:it,emStrongLDelim:Sn,emStrongRDelimAst:En,emStrongRDelimUnd:An,escape:Ln,link:Rn,nolink:Ka,punctuation:Cn,reflink:Ga,reflinkSearch:On,tag:Nn,text:bn,url:it},Pn={...Gt,link:B(/^!?\[(label)\]\((.*?)\)/).replace("label",Et).getRegex(),reflink:B(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Et).getRegex()},Kt={...Gt,emStrongRDelimAst:Dn,emStrongLDelim:Tn,url:B(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Fn={...Kt,br:B(Ha).replace("{2,}","*").getRegex(),text:B(Kt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Dt={normal:_t,gfm:fn,pedantic:yn},ct={normal:Gt,gfm:Kt,breaks:Fn,pedantic:Pn},$n={"&":"&","<":"<",">":">",'"':""","'":"'"},Za=n=>$n[n];function we(n,e){if(e){if(ce.escapeTest.test(n))return n.replace(ce.escapeReplace,Za)}else if(ce.escapeTestNoEncode.test(n))return n.replace(ce.escapeReplaceNoEncode,Za);return n}function Xa(n){try{n=encodeURI(n).replace(ce.percentDecode,"%")}catch{return null}return n}function es(n,e){var r;const t=n.replace(ce.findPipe,(o,c,l)=>{let d=!1,p=c;for(;--p>=0&&l[p]==="\\";)d=!d;return d?"|":" |"}),a=t.split(ce.splitPipe);let s=0;if(a[0].trim()||a.shift(),a.length>0&&!((r=a.at(-1))!=null&&r.trim())&&a.pop(),e)if(a.length>e)a.splice(e);else for(;a.length<e;)a.push("");for(;s<a.length;s++)a[s]=a[s].trim().replace(ce.slashPipe,"|");return a}function lt(n,e,t){const a=n.length;if(a===0)return"";let s=0;for(;s<a&&n.charAt(a-s-1)===e;)s++;return n.slice(0,a-s)}function Bn(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let a=0;a<n.length;a++)if(n[a]==="\\")a++;else if(n[a]===e[0])t++;else if(n[a]===e[1]&&(t--,t<0))return a;return t>0?-2:-1}function ts(n,e,t,a,s){const r=e.href,o=e.title||null,c=n[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;const l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:r,title:o,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,l}function Vn(n,e,t){const a=n.match(t.other.indentCodeCompensation);if(a===null)return e;const s=a[1];return e.split(`
|
|
3
|
+
`).map(r=>{const o=r.match(t.other.beginningSpace);if(o===null)return r;const[c]=o;return c.length>=s.length?r.slice(s.length):r}).join(`
|
|
4
|
+
`)}var At=class{constructor(n){u(this,"options");u(this,"rules");u(this,"lexer");this.options=n||Oe}space(n){const e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){const e=this.rules.block.code.exec(n);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:lt(t,`
|
|
5
|
+
`)}}}fences(n){const e=this.rules.block.fences.exec(n);if(e){const t=e[0],a=Vn(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(n){const e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const a=lt(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(n){const e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:lt(e[0],`
|
|
6
|
+
`)}}blockquote(n){const e=this.rules.block.blockquote.exec(n);if(e){let t=lt(e[0],`
|
|
7
7
|
`).split(`
|
|
8
|
-
`),a="",s="";const
|
|
9
|
-
`),
|
|
8
|
+
`),a="",s="";const r=[];for(;t.length>0;){let o=!1;const c=[];let l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))c.push(t[l]),o=!0;else if(!o)c.push(t[l]);else break;t=t.slice(l);const d=c.join(`
|
|
9
|
+
`),p=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
10
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
11
|
-
${
|
|
12
|
-
${
|
|
11
|
+
${d}`:d,s=s?`${s}
|
|
12
|
+
${p}`:p;const g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=g,t.length===0)break;const m=r.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){const C=m,x=C.raw+`
|
|
13
13
|
`+t.join(`
|
|
14
|
-
`),b=this.blockquote(
|
|
14
|
+
`),b=this.blockquote(x);r[r.length-1]=b,a=a.substring(0,a.length-C.raw.length)+b.raw,s=s.substring(0,s.length-C.text.length)+b.text;break}else if((m==null?void 0:m.type)==="list"){const C=m,x=C.raw+`
|
|
15
15
|
`+t.join(`
|
|
16
|
-
`),b=this.list(
|
|
17
|
-
`);continue}}return{type:"blockquote",raw:a,tokens:
|
|
18
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,
|
|
19
|
-
`,1)[0],
|
|
20
|
-
`,
|
|
21
|
-
`,1)[0];let
|
|
22
|
-
`+
|
|
23
|
-
`+
|
|
24
|
-
`,
|
|
25
|
-
`):[],
|
|
26
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(
|
|
27
|
-
`),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 s,
|
|
28
|
-
`:t.push(c);continue}if(c=this.tokenizer.code(e)){e=e.substring(c.raw.length);const
|
|
29
|
-
`+c.raw,
|
|
30
|
-
`+c.text,this.inlineQueue.at(-1).src=
|
|
31
|
-
`+c.raw,
|
|
32
|
-
`+c.raw,this.inlineQueue.at(-1).src=
|
|
33
|
-
`+c.raw,
|
|
34
|
-
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
35
|
-
`+c.raw,
|
|
36
|
-
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
37
|
-
`;return a?'<pre><code class="language-'+
|
|
38
|
-
`:"<pre><code>"+(t?s:
|
|
39
|
-
`}blockquote({tokens:
|
|
40
|
-
${this.parser.parse(
|
|
41
|
-
`}html({text:
|
|
42
|
-
`}hr(
|
|
43
|
-
`}list(
|
|
16
|
+
`),b=this.list(x);r[r.length-1]=b,a=a.substring(0,a.length-m.raw.length)+b.raw,s=s.substring(0,s.length-C.raw.length)+b.raw,t=x.substring(r.at(-1).raw.length).split(`
|
|
17
|
+
`);continue}}return{type:"blockquote",raw:a,tokens:r,text:s}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim();const a=t.length>1,s={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 r=this.rules.other.listItemRegex(t);let o=!1;for(;n;){let l=!1,d="",p="";if(!(e=r.exec(n))||this.rules.block.hr.test(n))break;d=e[0],n=n.substring(d.length);let g=e[2].split(`
|
|
18
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,A=>" ".repeat(3*A.length)),m=n.split(`
|
|
19
|
+
`,1)[0],C=!g.trim(),x=0;if(this.options.pedantic?(x=2,p=g.trimStart()):C?x=e[1].length+1:(x=e[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,p=g.slice(x),x+=e[1].length),C&&this.rules.other.blankLine.test(m)&&(d+=m+`
|
|
20
|
+
`,n=n.substring(m.length+1),l=!0),!l){const A=this.rules.other.nextBulletRegex(x),N=this.rules.other.hrRegex(x),R=this.rules.other.fencesBeginRegex(x),I=this.rules.other.headingBeginRegex(x),y=this.rules.other.htmlBeginRegex(x);for(;n;){const L=n.split(`
|
|
21
|
+
`,1)[0];let D;if(m=L,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),D=m):D=m.replace(this.rules.other.tabCharGlobal," "),R.test(m)||I.test(m)||y.test(m)||A.test(m)||N.test(m))break;if(D.search(this.rules.other.nonSpaceChar)>=x||!m.trim())p+=`
|
|
22
|
+
`+D.slice(x);else{if(C||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||R.test(g)||I.test(g)||N.test(g))break;p+=`
|
|
23
|
+
`+m}!C&&!m.trim()&&(C=!0),d+=L+`
|
|
24
|
+
`,n=n.substring(L.length+1),g=D.slice(x)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0));let b=null,k;this.options.gfm&&(b=this.rules.other.listIsTask.exec(p),b&&(k=b[0]!=="[ ] ",p=p.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:d,task:!!b,checked:k,loose:!1,text:p,tokens:[]}),s.raw+=d}const c=s.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const d=s.items[l].tokens.filter(g=>g.type==="space"),p=d.length>0&&d.some(g=>this.rules.other.anyLine.test(g.raw));s.loose=p}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(n){const e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){const e=this.rules.block.def.exec(n);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"):"",s=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:s}}}table(n){var o;const e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const t=es(e[1]),a=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
25
|
+
`):[],r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===a.length){for(const c of a)this.rules.other.tableAlignRight.test(c)?r.align.push("right"):this.rules.other.tableAlignCenter.test(c)?r.align.push("center"):this.rules.other.tableAlignLeft.test(c)?r.align.push("left"):r.align.push(null);for(let c=0;c<t.length;c++)r.header.push({text:t[c],tokens:this.lexer.inline(t[c]),header:!0,align:r.align[c]});for(const c of s)r.rows.push(es(c,r.header.length).map((l,d)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[d]})));return r}}lheading(n){const e=this.rules.block.lheading.exec(n);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(n){const e=this.rules.block.paragraph.exec(n);if(e){const t=e[1].charAt(e[1].length-1)===`
|
|
26
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){const e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){const e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){const e=this.rules.inline.tag.exec(n);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(n){const e=this.rules.inline.link.exec(n);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 r=lt(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{const r=Bn(e[2],"()");if(r===-2)return;if(r>-1){const o=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let a=e[2],s="";if(this.options.pedantic){const r=this.rules.other.pedanticHrefTitle.exec(a);r&&(a=r[1],s=r[3])}else s=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)),ts(e,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[a.toLowerCase()];if(!s){const r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return ts(t,s,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let a=this.rules.inline.emStrongLDelim.exec(n);if(!(!a||a[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[2])||!t||this.rules.inline.punctuation.exec(t))){const s=[...a[0]].length-1;let r,o,c=s,l=0;const d=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,e=e.slice(-1*n.length+s);(a=d.exec(e))!=null;){if(r=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!r)continue;if(o=[...r].length,a[3]||a[4]){c+=o;continue}else if((a[5]||a[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+l);const p=[...a[0]][0].length,g=n.slice(0,s+a.index+p+o);if(Math.min(s,o)%2){const C=g.slice(1,-1);return{type:"em",raw:g,text:C,tokens:this.lexer.inlineTokens(C)}}const m=g.slice(2,-2);return{type:"strong",raw:g,text:m,tokens:this.lexer.inlineTokens(m)}}}}codespan(n){const e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return a&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){const e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){const e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){const e=this.rules.inline.autolink.exec(n);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(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let a,s;if(e[2]==="@")a=e[0],s="mailto:"+a;else{let r;do r=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(r!==e[0]);a=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:a,href:s,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(n){const e=this.rules.inline.text.exec(n);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},Me=class $a{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||Oe,this.options.tokenizer=this.options.tokenizer||new At,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:ce,block:Dt.normal,inline:ct.normal};this.options.pedantic?(t.block=Dt.pedantic,t.inline=ct.pedantic):this.options.gfm&&(t.block=Dt.gfm,this.options.breaks?t.inline=ct.breaks:t.inline=ct.gfm),this.tokenizer.rules=t}static get rules(){return{block:Dt,inline:ct}}static lex(e,t){return new $a(t).lex(e)}static lexInline(e,t){return new $a(t).inlineTokens(e)}lex(e){e=e.replace(ce.carriageReturn,`
|
|
27
|
+
`),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 s,r,o;for(this.options.pedantic&&(e=e.replace(ce.tabCharGlobal," ").replace(ce.spaceLine,""));e;){let c;if((r=(s=this.options.extensions)==null?void 0:s.block)!=null&&r.some(d=>(c=d.call({lexer:this},e,t))?(e=e.substring(c.raw.length),t.push(c),!0):!1))continue;if(c=this.tokenizer.space(e)){e=e.substring(c.raw.length);const d=t.at(-1);c.raw.length===1&&d!==void 0?d.raw+=`
|
|
28
|
+
`:t.push(c);continue}if(c=this.tokenizer.code(e)){e=e.substring(c.raw.length);const d=t.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=`
|
|
29
|
+
`+c.raw,d.text+=`
|
|
30
|
+
`+c.text,this.inlineQueue.at(-1).src=d.text):t.push(c);continue}if(c=this.tokenizer.fences(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.heading(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.hr(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.blockquote(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.list(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.html(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.def(e)){e=e.substring(c.raw.length);const d=t.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=`
|
|
31
|
+
`+c.raw,d.text+=`
|
|
32
|
+
`+c.raw,this.inlineQueue.at(-1).src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.lheading(e)){e=e.substring(c.raw.length),t.push(c);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let d=1/0;const p=e.slice(1);let g;this.options.extensions.startBlock.forEach(m=>{g=m.call({lexer:this},p),typeof g=="number"&&g>=0&&(d=Math.min(d,g))}),d<1/0&&d>=0&&(l=e.substring(0,d+1))}if(this.state.top&&(c=this.tokenizer.paragraph(l))){const d=t.at(-1);a&&(d==null?void 0:d.type)==="paragraph"?(d.raw+=`
|
|
33
|
+
`+c.raw,d.text+=`
|
|
34
|
+
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):t.push(c),a=l.length!==e.length,e=e.substring(c.raw.length);continue}if(c=this.tokenizer.text(e)){e=e.substring(c.raw.length);const d=t.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=`
|
|
35
|
+
`+c.raw,d.text+=`
|
|
36
|
+
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):t.push(c);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,l,d;let a=e,s=null;if(this.tokens.links){const p=Object.keys(this.tokens.links);if(p.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)p.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,s.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let r=!1,o="";for(;e;){r||(o=""),r=!1;let p;if((l=(c=this.options.extensions)==null?void 0:c.inline)!=null&&l.some(m=>(p=m.call({lexer:this},e,t))?(e=e.substring(p.raw.length),t.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);const m=t.at(-1);p.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=p.raw,m.text+=p.text):t.push(p);continue}if(p=this.tokenizer.emStrong(e,a,o)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.del(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),t.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),t.push(p);continue}let g=e;if((d=this.options.extensions)!=null&&d.startInline){let m=1/0;const C=e.slice(1);let x;this.options.extensions.startInline.forEach(b=>{x=b.call({lexer:this},C),typeof x=="number"&&x>=0&&(m=Math.min(m,x))}),m<1/0&&m>=0&&(g=e.substring(0,m+1))}if(p=this.tokenizer.inlineText(g)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(o=p.raw.slice(-1)),r=!0;const m=t.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=p.raw,m.text+=p.text):t.push(p);continue}if(e){const m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return t}},It=class{constructor(n){u(this,"options");u(this,"parser");this.options=n||Oe}space(n){return""}code({text:n,lang:e,escaped:t}){var r;const a=(r=(e||"").match(ce.notSpaceStart))==null?void 0:r[0],s=n.replace(ce.endingNewline,"")+`
|
|
37
|
+
`;return a?'<pre><code class="language-'+we(a)+'">'+(t?s:we(s,!0))+`</code></pre>
|
|
38
|
+
`:"<pre><code>"+(t?s:we(s,!0))+`</code></pre>
|
|
39
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
40
|
+
${this.parser.parse(n)}</blockquote>
|
|
41
|
+
`}html({text:n}){return n}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
42
|
+
`}hr(n){return`<hr>
|
|
43
|
+
`}list(n){const e=n.ordered,t=n.start;let a="";for(let o=0;o<n.items.length;o++){const c=n.items[o];a+=this.listitem(c)}const s=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+s+r+`>
|
|
44
44
|
`+a+"</"+s+`>
|
|
45
|
-
`}listitem(
|
|
46
|
-
`}checkbox({checked:
|
|
47
|
-
`}table(
|
|
45
|
+
`}listitem(n){var t;let e="";if(n.task){const a=this.checkbox({checked:!!n.checked});n.loose?((t=n.tokens[0])==null?void 0:t.type)==="paragraph"?(n.tokens[0].text=a+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&n.tokens[0].tokens[0].type==="text"&&(n.tokens[0].tokens[0].text=a+" "+we(n.tokens[0].tokens[0].text),n.tokens[0].tokens[0].escaped=!0)):n.tokens.unshift({type:"text",raw:a+" ",text:a+" ",escaped:!0}):e+=a+" "}return e+=this.parser.parse(n.tokens,!!n.loose),`<li>${e}</li>
|
|
46
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
47
|
+
`}table(n){let e="",t="";for(let s=0;s<n.header.length;s++)t+=this.tablecell(n.header[s]);e+=this.tablerow({text:t});let a="";for(let s=0;s<n.rows.length;s++){const r=n.rows[s];t="";for(let o=0;o<r.length;o++)t+=this.tablecell(r[o]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
48
48
|
<thead>
|
|
49
49
|
`+e+`</thead>
|
|
50
50
|
`+a+`</table>
|
|
51
|
-
`}tablerow({text:
|
|
52
|
-
${
|
|
53
|
-
`}tablecell(
|
|
54
|
-
`}strong({tokens:
|
|
55
|
-
`+this.renderer.text(
|
|
56
|
-
Please report this to https://github.com/markedjs/marked.`,r){const a="<p>An error occurred:</p><pre>"+Le(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},Ie=new Tr;function P(r,e){return Ie.parse(r,e)}P.options=P.setOptions=function(r){return Ie.setOptions(r),P.defaults=Ie.defaults,Aa(P.defaults),P},P.getDefaults=Ft,P.defaults=Ae,P.use=function(...r){return Ie.use(...r),P.defaults=Ie.defaults,Aa(P.defaults),P},P.walkTokens=function(r,e){return Ie.walkTokens(r,e)},P.parseInline=Ie.parseInline,P.Parser=ke,P.parser=ke.parse,P.Renderer=xt,P.TextRenderer=Qt,P.Lexer=Ce,P.lexer=Ce.lex,P.Tokenizer=kt,P.Hooks=Mt,P.parse=P,P.options,P.setOptions,P.use,P.walkTokens,P.parseInline,ke.parse,Ce.lex;const{entries:_a,setPrototypeOf:Qa,isFrozen:Er,getPrototypeOf:Dr,getOwnPropertyDescriptor:Ar}=Object;let{freeze:ie,seal:ue,create:Fe}=Object,{apply:Ut,construct:Yt}=typeof Reflect<"u"&&Reflect;ie||(ie=function(r){return r}),ue||(ue=function(r){return r}),Ut||(Ut=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)}),Yt||(Yt=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 at=U(Array.prototype.forEach),Ir=U(Array.prototype.lastIndexOf),Ua=U(Array.prototype.pop),st=U(Array.prototype.push),vr=U(Array.prototype.splice),oe=Array.isArray,rt=U(String.prototype.toLowerCase),Jt=U(String.prototype.toString),Ya=U(String.prototype.match),$e=U(String.prototype.replace),Ja=U(String.prototype.indexOf),jr=U(String.prototype.trim),Nr=U(Number.prototype.toString),Rr=U(Boolean.prototype.toString),Ga=typeof BigInt>"u"?null:U(BigInt.prototype.toString),Ka=typeof Symbol>"u"?null:U(Symbol.prototype.toString),H=U(Object.prototype.hasOwnProperty),nt=U(Object.prototype.toString),ae=U(RegExp.prototype.test),St=Or(TypeError);function U(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 Ut(r,e,a)}}function Or(r){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return Yt(r,t)}}function v(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rt;if(Qa&&Qa(r,null),!oe(e))return r;let a=e.length;for(;a--;){let s=e[a];if(typeof s=="string"){const n=t(s);n!==s&&(Er(e)||(e[a]=n),s=n)}r[s]=!0}return r}function Pr(r){for(let e=0;e<r.length;e++)H(r,e)||(r[e]=null);return r}function he(r){const e=Fe(null);for(const[t,a]of _a(r))H(r,t)&&(oe(a)?e[t]=Pr(a):a&&typeof a=="object"&&a.constructor===Object?e[t]=he(a):e[t]=a);return e}function Fr(r){switch(typeof r){case"string":return r;case"number":return Nr(r);case"boolean":return Rr(r);case"bigint":return Ga?Ga(r):"0";case"symbol":return Ka?Ka(r):"Symbol()";case"undefined":return nt(r);case"function":case"object":{if(r===null)return nt(r);const e=r,t=Be(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:nt(a)}return nt(r)}default:return nt(r)}}function Be(r,e){for(;r!==null;){const a=Ar(r,e);if(a){if(a.get)return U(a.get);if(typeof a.value=="function")return U(a.value)}r=Dr(r)}function t(){return null}return t}function $r(r){try{return ae(r,""),!0}catch{return!1}}const Za=ie(["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"]),Gt=ie(["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"]),Kt=ie(["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"]),Br=ie(["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"]),Zt=ie(["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"]),Vr=ie(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Xa=ie(["#text"]),es=ie(["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"]),Xt=ie(["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"]),ts=ie(["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"]),Tt=ie(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zr=ue(/\{\{[\w\W]*|[\w\W]*\}\}/gm),qr=ue(/<%[\w\W]*|[\w\W]*%>/gm),Wr=ue(/\$\{[\w\W]*/gm),Hr=ue(/^data-[\-\w.\u00B7-\uFFFF]+$/),_r=ue(/^aria-[\-\w]+$/),as=ue(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Qr=ue(/^(?:\w+script|data):/i),Ur=ue(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ss=ue(/^html$/i),Yr=ue(/^[a-z][.\w]*(-[.\w]+)+$/i);var rs=Object.freeze({__proto__:null,ARIA_ATTR:_r,ATTR_WHITESPACE:Ur,CUSTOM_ELEMENT:Yr,DATA_ATTR:Hr,DOCTYPE_NAME:ss,ERB_EXPR:qr,IS_ALLOWED_URI:as,IS_SCRIPT_OR_DATA:Qr,MUSTACHE_EXPR:zr,TMPLIT_EXPR:Wr});const it={element:1,text:3,progressingInstruction:7,comment:8,document:9},Jr=function(){return typeof window>"u"?null:window},Gr=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}},ns=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function is(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Jr();const e=p=>is(p);if(e.version="3.4.2",e.removed=[],!r||!r.document||r.document.nodeType!==it.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const a=t,s=a.currentScript,{DocumentFragment:n,HTMLTemplateElement:o,Node:c,Element:l,NodeFilter:h,NamedNodeMap:u=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:y}=r,w=l.prototype,b=Be(w,"cloneNode"),C=Be(w,"remove"),f=Be(w,"nextSibling"),L=Be(w,"childNodes"),T=Be(w,"parentNode");if(typeof o=="function"){const p=t.createElement("template");p.content&&p.content.ownerDocument&&(t=p.content.ownerDocument)}let S,A="";const{implementation:j,createNodeIterator:V,createDocumentFragment:E,getElementsByTagName:z}=t,{importNode:_}=a;let B=ns();e.isSupported=typeof _a=="function"&&typeof T=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ge,ERB_EXPR:It,TMPLIT_EXPR:vt,DATA_ATTR:cc,ARIA_ATTR:lc,IS_SCRIPT_OR_DATA:hc,ATTR_WHITESPACE:Cs,CUSTOM_ELEMENT:dc}=rs;let{IS_ALLOWED_URI:ks}=rs,ee=null;const xs=v({},[...Za,...Gt,...Kt,...Zt,...Xa]);let se=null;const Ms=v({},[...es,...Xt,...ts,...Tt]);let Q=Object.seal(Fe(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}})),gt=null,jt=null;const Ee=Object.seal(Fe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ss=!0,ga=!0,Ts=!1,Es=!0,Ne=!1,mt=!0,Re=!1,ma=!1,fa=!1,Ye=!1,Nt=!1,Rt=!1,Ds=!0,As=!1;const Is="user-content-";let La=!0,ft=!1,Je={},ye=null;const ya=v({},["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 vs=null;const js=v({},["audio","video","img","source","image","track"]);let wa=null;const Ns=v({},["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",we="http://www.w3.org/1999/xhtml";let Ge=we,ba=!1,Ca=null;const uc=v({},[Ot,Pt,we],Jt);let ka=v({},["mi","mo","mn","ms","mtext"]),xa=v({},["annotation-xml"]);const pc=v({},["title","style","font","a","script"]);let Lt=null;const gc=["application/xhtml+xml","text/html"],mc="text/html";let K=null,Ke=null;const fc=t.createElement("form"),Rs=function(p){return p instanceof RegExp||p instanceof Function},Ma=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ke&&Ke===p)return;(!p||typeof p!="object")&&(p={}),p=he(p),Lt=gc.indexOf(p.PARSER_MEDIA_TYPE)===-1?mc:p.PARSER_MEDIA_TYPE,K=Lt==="application/xhtml+xml"?Jt:rt,ee=H(p,"ALLOWED_TAGS")&&oe(p.ALLOWED_TAGS)?v({},p.ALLOWED_TAGS,K):xs,se=H(p,"ALLOWED_ATTR")&&oe(p.ALLOWED_ATTR)?v({},p.ALLOWED_ATTR,K):Ms,Ca=H(p,"ALLOWED_NAMESPACES")&&oe(p.ALLOWED_NAMESPACES)?v({},p.ALLOWED_NAMESPACES,Jt):uc,wa=H(p,"ADD_URI_SAFE_ATTR")&&oe(p.ADD_URI_SAFE_ATTR)?v(he(Ns),p.ADD_URI_SAFE_ATTR,K):Ns,vs=H(p,"ADD_DATA_URI_TAGS")&&oe(p.ADD_DATA_URI_TAGS)?v(he(js),p.ADD_DATA_URI_TAGS,K):js,ye=H(p,"FORBID_CONTENTS")&&oe(p.FORBID_CONTENTS)?v({},p.FORBID_CONTENTS,K):ya,gt=H(p,"FORBID_TAGS")&&oe(p.FORBID_TAGS)?v({},p.FORBID_TAGS,K):he({}),jt=H(p,"FORBID_ATTR")&&oe(p.FORBID_ATTR)?v({},p.FORBID_ATTR,K):he({}),Je=H(p,"USE_PROFILES")?p.USE_PROFILES&&typeof p.USE_PROFILES=="object"?he(p.USE_PROFILES):p.USE_PROFILES:!1,Ss=p.ALLOW_ARIA_ATTR!==!1,ga=p.ALLOW_DATA_ATTR!==!1,Ts=p.ALLOW_UNKNOWN_PROTOCOLS||!1,Es=p.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=p.SAFE_FOR_TEMPLATES||!1,mt=p.SAFE_FOR_XML!==!1,Re=p.WHOLE_DOCUMENT||!1,Ye=p.RETURN_DOM||!1,Nt=p.RETURN_DOM_FRAGMENT||!1,Rt=p.RETURN_TRUSTED_TYPE||!1,fa=p.FORCE_BODY||!1,Ds=p.SANITIZE_DOM!==!1,As=p.SANITIZE_NAMED_PROPS||!1,La=p.KEEP_CONTENT!==!1,ft=p.IN_PLACE||!1,ks=$r(p.ALLOWED_URI_REGEXP)?p.ALLOWED_URI_REGEXP:as,Ge=typeof p.NAMESPACE=="string"?p.NAMESPACE:we,ka=H(p,"MATHML_TEXT_INTEGRATION_POINTS")&&p.MATHML_TEXT_INTEGRATION_POINTS&&typeof p.MATHML_TEXT_INTEGRATION_POINTS=="object"?he(p.MATHML_TEXT_INTEGRATION_POINTS):v({},["mi","mo","mn","ms","mtext"]),xa=H(p,"HTML_INTEGRATION_POINTS")&&p.HTML_INTEGRATION_POINTS&&typeof p.HTML_INTEGRATION_POINTS=="object"?he(p.HTML_INTEGRATION_POINTS):v({},["annotation-xml"]);const k=H(p,"CUSTOM_ELEMENT_HANDLING")&&p.CUSTOM_ELEMENT_HANDLING&&typeof p.CUSTOM_ELEMENT_HANDLING=="object"?he(p.CUSTOM_ELEMENT_HANDLING):Fe(null);if(Q=Fe(null),H(k,"tagNameCheck")&&Rs(k.tagNameCheck)&&(Q.tagNameCheck=k.tagNameCheck),H(k,"attributeNameCheck")&&Rs(k.attributeNameCheck)&&(Q.attributeNameCheck=k.attributeNameCheck),H(k,"allowCustomizedBuiltInElements")&&typeof k.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=k.allowCustomizedBuiltInElements),Ne&&(ga=!1),Nt&&(Ye=!0),Je&&(ee=v({},Xa),se=Fe(null),Je.html===!0&&(v(ee,Za),v(se,es)),Je.svg===!0&&(v(ee,Gt),v(se,Xt),v(se,Tt)),Je.svgFilters===!0&&(v(ee,Kt),v(se,Xt),v(se,Tt)),Je.mathMl===!0&&(v(ee,Zt),v(se,ts),v(se,Tt))),Ee.tagCheck=null,Ee.attributeCheck=null,H(p,"ADD_TAGS")&&(typeof p.ADD_TAGS=="function"?Ee.tagCheck=p.ADD_TAGS:oe(p.ADD_TAGS)&&(ee===xs&&(ee=he(ee)),v(ee,p.ADD_TAGS,K))),H(p,"ADD_ATTR")&&(typeof p.ADD_ATTR=="function"?Ee.attributeCheck=p.ADD_ATTR:oe(p.ADD_ATTR)&&(se===Ms&&(se=he(se)),v(se,p.ADD_ATTR,K))),H(p,"ADD_URI_SAFE_ATTR")&&oe(p.ADD_URI_SAFE_ATTR)&&v(wa,p.ADD_URI_SAFE_ATTR,K),H(p,"FORBID_CONTENTS")&&oe(p.FORBID_CONTENTS)&&(ye===ya&&(ye=he(ye)),v(ye,p.FORBID_CONTENTS,K)),H(p,"ADD_FORBID_CONTENTS")&&oe(p.ADD_FORBID_CONTENTS)&&(ye===ya&&(ye=he(ye)),v(ye,p.ADD_FORBID_CONTENTS,K)),La&&(ee["#text"]=!0),Re&&v(ee,["html","head","body"]),ee.table&&(v(ee,["tbody"]),delete gt.tbody),p.TRUSTED_TYPES_POLICY){if(typeof p.TRUSTED_TYPES_POLICY.createHTML!="function")throw St('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof p.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw St('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=p.TRUSTED_TYPES_POLICY,A=S.createHTML("")}else S===void 0&&(S=Gr(y,s)),S!==null&&typeof A=="string"&&(A=S.createHTML(""));ie&&ie(p),Ke=p},Os=v({},[...Gt,...Kt,...Br]),Ps=v({},[...Zt,...Vr]),Lc=function(p){let k=T(p);(!k||!k.tagName)&&(k={namespaceURI:Ge,tagName:"template"});const x=rt(p.tagName),F=rt(k.tagName);return Ca[p.namespaceURI]?p.namespaceURI===Pt?k.namespaceURI===we?x==="svg":k.namespaceURI===Ot?x==="svg"&&(F==="annotation-xml"||ka[F]):!!Os[x]:p.namespaceURI===Ot?k.namespaceURI===we?x==="math":k.namespaceURI===Pt?x==="math"&&xa[F]:!!Ps[x]:p.namespaceURI===we?k.namespaceURI===Pt&&!xa[F]||k.namespaceURI===Ot&&!ka[F]?!1:!Ps[x]&&(pc[x]||!Os[x]):!!(Lt==="application/xhtml+xml"&&Ca[p.namespaceURI]):!1},Oe=function(p){st(e.removed,{element:p});try{T(p).removeChild(p)}catch{C(p)}},Pe=function(p,k){try{st(e.removed,{attribute:k.getAttributeNode(p),from:k})}catch{st(e.removed,{attribute:null,from:k})}if(k.removeAttribute(p),p==="is")if(Ye||Nt)try{Oe(k)}catch{}else try{k.setAttribute(p,"")}catch{}},Fs=function(p){let k=null,x=null;if(fa)p="<remove></remove>"+p;else{const W=Ya(p,/^[\r\n\t ]+/);x=W&&W[0]}Lt==="application/xhtml+xml"&&Ge===we&&(p='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+p+"</body></html>");const F=S?S.createHTML(p):p;if(Ge===we)try{k=new g().parseFromString(F,Lt)}catch{}if(!k||!k.documentElement){k=j.createDocument(Ge,"template",null);try{k.documentElement.innerHTML=ba?A:F}catch{}}const re=k.body||k.documentElement;return p&&x&&re.insertBefore(t.createTextNode(x),re.childNodes[0]||null),Ge===we?z.call(k,Re?"html":"body")[0]:Re?k.documentElement:re},$s=function(p){return V.call(p.ownerDocument||p,p,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Sa=function(p){return p instanceof m&&(typeof p.nodeName!="string"||typeof p.textContent!="string"||typeof p.removeChild!="function"||!(p.attributes instanceof u)||typeof p.removeAttribute!="function"||typeof p.setAttribute!="function"||typeof p.namespaceURI!="string"||typeof p.insertBefore!="function"||typeof p.hasChildNodes!="function")},Ta=function(p){return typeof c=="function"&&p instanceof c};function Me(p,k,x){at(p,F=>{F.call(e,k,x,Ke)})}const Bs=function(p){let k=null;if(Me(B.beforeSanitizeElements,p,null),Sa(p))return Oe(p),!0;const x=K(p.nodeName);if(Me(B.uponSanitizeElement,p,{tagName:x,allowedTags:ee}),mt&&p.hasChildNodes()&&!Ta(p.firstElementChild)&&ae(/<[/\w!]/g,p.innerHTML)&&ae(/<[/\w!]/g,p.textContent)||mt&&p.namespaceURI===we&&x==="style"&&Ta(p.firstElementChild)||p.nodeType===it.progressingInstruction||mt&&p.nodeType===it.comment&&ae(/<[/\w]/g,p.data))return Oe(p),!0;if(gt[x]||!(Ee.tagCheck instanceof Function&&Ee.tagCheck(x))&&!ee[x]){if(!gt[x]&&zs(x)&&(Q.tagNameCheck instanceof RegExp&&ae(Q.tagNameCheck,x)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(x)))return!1;if(La&&!ye[x]){const F=T(p)||p.parentNode,re=L(p)||p.childNodes;if(re&&F){const W=re.length;for(let Se=W-1;Se>=0;--Se){const be=b(re[Se],!0);F.insertBefore(be,f(p))}}}return Oe(p),!0}return p instanceof l&&!Lc(p)||(x==="noscript"||x==="noembed"||x==="noframes")&&ae(/<\/no(script|embed|frames)/i,p.innerHTML)?(Oe(p),!0):(Ne&&p.nodeType===it.text&&(k=p.textContent,at([ge,It,vt],F=>{k=$e(k,F," ")}),p.textContent!==k&&(st(e.removed,{element:p.cloneNode()}),p.textContent=k)),Me(B.afterSanitizeElements,p,null),!1)},Vs=function(p,k,x){if(jt[k]||Ds&&(k==="id"||k==="name")&&(x in t||x in fc))return!1;const F=se[k]||Ee.attributeCheck instanceof Function&&Ee.attributeCheck(k,p);if(!(ga&&!jt[k]&&ae(cc,k))&&!(Ss&&ae(lc,k))){if(!F||jt[k]){if(!(zs(p)&&(Q.tagNameCheck instanceof RegExp&&ae(Q.tagNameCheck,p)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(p))&&(Q.attributeNameCheck instanceof RegExp&&ae(Q.attributeNameCheck,k)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(k,p))||k==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&ae(Q.tagNameCheck,x)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(x))))return!1}else if(!wa[k]&&!ae(ks,$e(x,Cs,""))&&!((k==="src"||k==="xlink:href"||k==="href")&&p!=="script"&&Ja(x,"data:")===0&&vs[p])&&!(Ts&&!ae(hc,$e(x,Cs,"")))&&x)return!1}return!0},yc=v({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zs=function(p){return!yc[rt(p)]&&ae(dc,p)},qs=function(p){Me(B.beforeSanitizeAttributes,p,null);const{attributes:k}=p;if(!k||Sa(p))return;const x={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:se,forceKeepAttr:void 0};let F=k.length;for(;F--;){const re=k[F],{name:W,namespaceURI:Se,value:be}=re,le=K(W),De=be;let te=W==="value"?De:jr(De);if(x.attrName=le,x.attrValue=te,x.keepAttr=!0,x.forceKeepAttr=void 0,Me(B.uponSanitizeAttribute,p,x),te=x.attrValue,As&&(le==="id"||le==="name")&&Ja(te,Is)!==0&&(Pe(W,p),te=Is+te),mt&&ae(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,te)){Pe(W,p);continue}if(le==="attributename"&&Ya(te,"href")){Pe(W,p);continue}if(x.forceKeepAttr)continue;if(!x.keepAttr){Pe(W,p);continue}if(!Es&&ae(/\/>/i,te)){Pe(W,p);continue}Ne&&at([ge,It,vt],wc=>{te=$e(te,wc," ")});const Hs=K(p.nodeName);if(!Vs(Hs,le,te)){Pe(W,p);continue}if(S&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!Se)switch(y.getAttributeType(Hs,le)){case"TrustedHTML":{te=S.createHTML(te);break}case"TrustedScriptURL":{te=S.createScriptURL(te);break}}if(te!==De)try{Se?p.setAttributeNS(Se,W,te):p.setAttribute(W,te),Sa(p)?Oe(p):Ua(e.removed)}catch{Pe(W,p)}}Me(B.afterSanitizeAttributes,p,null)},Ws=function(p){let k=null;const x=$s(p);for(Me(B.beforeSanitizeShadowDOM,p,null);k=x.nextNode();)Me(B.uponSanitizeShadowNode,k,null),Bs(k),qs(k),k.content instanceof n&&Ws(k.content);Me(B.afterSanitizeShadowDOM,p,null)};return e.sanitize=function(p){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=null,F=null,re=null,W=null;if(ba=!p,ba&&(p="<!-->"),typeof p!="string"&&!Ta(p)&&(p=Fr(p),typeof p!="string"))throw St("dirty is not a string, aborting");if(!e.isSupported)return p;if(ma||Ma(k),e.removed=[],typeof p=="string"&&(ft=!1),ft){const le=p.nodeName;if(typeof le=="string"){const De=K(le);if(!ee[De]||gt[De])throw St("root node is forbidden and cannot be sanitized in-place")}}else if(p instanceof c)x=Fs("<!---->"),F=x.ownerDocument.importNode(p,!0),F.nodeType===it.element&&F.nodeName==="BODY"||F.nodeName==="HTML"?x=F:x.appendChild(F);else{if(!Ye&&!Ne&&!Re&&p.indexOf("<")===-1)return S&&Rt?S.createHTML(p):p;if(x=Fs(p),!x)return Ye?null:Rt?A:""}x&&fa&&Oe(x.firstChild);const Se=$s(ft?p:x);for(;re=Se.nextNode();)Bs(re),qs(re),re.content instanceof n&&Ws(re.content);if(ft)return p;if(Ye){if(Ne){x.normalize();let le=x.innerHTML;at([ge,It,vt],De=>{le=$e(le,De," ")}),x.innerHTML=le}if(Nt)for(W=E.call(x.ownerDocument);x.firstChild;)W.appendChild(x.firstChild);else W=x;return(se.shadowroot||se.shadowrootmode)&&(W=_.call(a,W,!0)),W}let be=Re?x.outerHTML:x.innerHTML;return Re&&ee["!doctype"]&&x.ownerDocument&&x.ownerDocument.doctype&&x.ownerDocument.doctype.name&&ae(ss,x.ownerDocument.doctype.name)&&(be="<!DOCTYPE "+x.ownerDocument.doctype.name+`>
|
|
57
|
-
`+be),Ne&&at([ge,It,vt],le=>{be=$e(be,le," ")}),S&&Rt?S.createHTML(be):be},e.setConfig=function(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ma(p),ma=!0},e.clearConfig=function(){Ke=null,ma=!1},e.isValidAttribute=function(p,k,x){Ke||Ma({});const F=K(p),re=K(k);return Vs(F,re,x)},e.addHook=function(p,k){typeof k=="function"&&st(B[p],k)},e.removeHook=function(p,k){if(k!==void 0){const x=Ir(B[p],k);return x===-1?void 0:vr(B[p],x,1)[0]}return Ua(B[p])},e.removeHooks=function(p){B[p]=[]},e.removeAllHooks=function(){B=ns()},e}var os=is();class Kr{constructor(e){d(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 os.sanitize(P.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,c;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:(c=(o=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:o.filter)==null?void 0:c.enabled)??!1}get locationSearchDistanceValues(){var a,s,n,o,c,l,h,u,m;const e=((s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.filterValues)??((c=(o=(n=this.dataLayer.searchResultsMetadata)==null?void 0:n.location)==null?void 0:o.filter)==null?void 0:c.values),t=((h=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:h.filterUnit)??((m=(u=this.dataLayer.searchResultsMetadata)==null?void 0:u.location)==null?void 0:m.unit);return!e||e.length===0?[]:e.map(g=>({label:g==="any"?"Any Distance":g+" "+(t??""),value:g,isSelected:g===this.dataLayer.searchRadius})).sort((g,y)=>{const w=g.value==="any"?0:parseFloat(g.value),b=y.value==="any"?0:parseFloat(y.value);return w-b})}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 os.sanitize(P.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(c=>c.name===s);if(o){const c=o.values.find(l=>l.type==="range"?!1:l.type==="checkbox"?'"'+l.value+'"'===n:!1);if(c)return c}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 pe{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],c=t[n],l=this.isObject(o)&&this.isObject(c);if(l&&!this.deepEqual(o,c)||!l&&o!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class I{constructor(e){d(this,"value");d(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=c=>{c===t&&(e(c),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 ea{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 c=s[o];c!==!0&&(n+="="+c)}typeof document<"u"&&(document.cookie=n)}}class X{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 Zr{constructor(e,t){d(this,"$searchTermChange",new I(""));d(this,"$searchLocationChange",new I(""));d(this,"$searchLocationCoordinatesDecoded",new I(""));d(this,"$searchLatChange",new I(""));d(this,"$searchLongChange",new I(""));d(this,"$searchRadiusChange",new I(void 0));d(this,"$loadingChange",new I(!1));d(this,"$locationError",new I(!1));d(this,"$searchResults",new I(null));d(this,"$searchResultsMetadata",new I(null));d(this,"$searchAutosuggest",new I(null));d(this,"$searchFacets",new I(null));d(this,"$searchFacetsCached",new I(null));d(this,"$searchFacetsCachedTabs",new I(null));d(this,"$searchstaxConfig",new I(null));d(this,"$autosuggestResults",new I(null));d(this,"$itemsPerPage",new I(void 0));d(this,"$searchObject",new I({query:"",itemsPerPage:void 0,page:99999999,order:"",facets:[],additionalProps:[],location:{term:void 0,radius:void 0,lat:void 0,lon:void 0},model:""}));d(this,"$searchRelatedSearches",new I(null));d(this,"$searchInputConfig",new I(null));d(this,"$searchLocationConfig",new I(null));d(this,"$searchExternalPromotions",new I(null));d(this,"$facetsTemplateData",new I(null));d(this,"$selectedFacetsTemplateData",new I(null));d(this,"$paginationData",new I(null));d(this,"$answerData",new I(null));d(this,"$searchFeedbackData",new I(null));d(this,"$inputWidgetTemplateData",new I(null));d(this,"$locationWidgetTemplateData",new I(null));d(this,"$searchSortingData",new I(null));d(this,"$searchRelatedSearchesData",new I(null));d(this,"$searchExternalPromotionsData",new I(null));d(this,"$cookiesDisabled",new I(null));d(this,"$locationDecodingLoading",new I(!1));d(this,"$answer",new I(""));d(this,"$language",new I("en"));d(this,"$model",new I(""));d(this,"$answerLoading",new I(!1));d(this,"$locationEnabled",new I(null));d(this,"$answerError",new I(!1));d(this,"$answerErrorMessage",new I(""));d(this,"$isQuestion",new I(!1));d(this,"$inputTemplateRendered",new I(!1));d(this,"currentPageValue",1);d(this,"isAnswerWidgetCreatedValue",!1);d(this,"renderingEngineValue",$.mustache);d(this,"parsedData",new Kr(this));d(this,"sessionId");d(this,"sessionIdValue",null);d(this,"autoCorrect",!0);d(this,"forceNotCorrect",!1);d(this,"lastSearchValue","");d(this,"turnAIAnswerGenerationOn",!1);d(this,"questionURL","");d(this,"isInfiniteScroll",!1);d(this,"firstSearchHappened",!1);d(this,"facetsWereSet",!1);d(this,"answerWidgetShowMoreLimit",100);d(this,"searchHelper");d(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,ea.deleteCookie(this.sessionId),ea.deleteCookie("ms_visitorid")):this.sessionIdValue=ea.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(X.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(X.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,(!pe.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){pe.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&&(!pe.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,pe.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){pe.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchFacetsCachedTabs(e){pe.deepEqual(e,this.searchFacetsCachedTabs??[])||this.$searchFacetsCachedTabs.setValue(e)}setSearchRelatedSearches(e){pe.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){pe.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(X.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 ot{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((s,n)=>{var l;const o=s[e.responseHeader.params.uniqueId]??"",c={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:((l=e.metadata.locationSearch)==null?void 0:l.unit)??"",unmappedFields:this.getUnmappedFields(s,e,o),allFields:this.getAllFields(s,e)};t.push(c)}),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 c={};c.value=n[o],c.parentName=s.name,c.count=n[o+1],c.type="checkbox",s.values.push(c)}}s.values.length>0&&t.push(s)}return t}static extractSearchResultsMetadata(e){var n,o,c,l,h,u,m,g,y,w;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:((c=e.metadata.locationSearch.filter)==null?void 0:c.label)??"",defaultValue:((l=e.metadata.locationSearch.filter)==null?void 0:l.defaultValue)??""}}),(h=e.metadata.results.find(b=>b.result_card==="date"))==null||h.name,a.options=[],(u=e.metadata.sorts)==null?void 0:u.length){const b=e.metadata.sorts.map(C=>({value:C.label,key:C.name+" "+C.order}));a.options=[{key:"",value:"Relevance"},...b]}return t=((w=(y=(g=(m=e==null?void 0:e.spellcheck)==null?void 0:m.suggestions)==null?void 0:g[1])==null?void 0:y.suggestion)==null?void 0:w[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 c=Array.isArray(e[o])?this.getHighlightedResults(o,e[o].join(", "),a,t):this.getHighlightedResults(o,e[o]+"",a,t);n.push({key:o,value:c,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(l=>l.result_card===e);if(o===void 0)return null;const c=t[o.name];return c===void 0?null:typeof c=="string"?n?c:this.getHighlightedResults(o.name,c,s,a):typeof c=="number"?c:Array.isArray(c)?n?c.join(", "):this.getHighlightedResults(o.name,c.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 c=this.cleanValue(o);if(c!=="")return c}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class cs{constructor(e){d(this,"routeName","searchstax");d(this,"ignoredKeys",[]);d(this,"queryStringHelper");d(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new Xr(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 c=X.removeXSSRiskyTags((a=e[o].split(":"))==null?void 0:a[0]),l=X.removeXSSRiskyTags(decodeURIComponent((s=e[o].split(":"))==null?void 0:s[1])),h=X.removeXSSRiskyTags(decodeURIComponent((n=e[o].split(":"))==null?void 0:n[2]));t.push({type:c,name:l,value:h})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),s=X.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),n=parseInt(s),o=isNaN(n)?1:n;let c=parseInt(X.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return isNaN(c)&&(c=10),{query:X.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:o,itemsPerPage:t??c,order:X.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:X.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:X.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:X.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:X.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:X.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class Xr{constructor(e){d(this,"routeName","");d(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 Ve={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ls 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 hs=10,en=13,ve=32;function ta(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=ta,onError:t=ta,onRetry:a=ta,onComment:s}=r,n=[];let o=!0,c,l="",h=0,u;function m(f){if(o&&(o=!1,f.charCodeAt(0)===239&&f.charCodeAt(1)===187&&f.charCodeAt(2)===191&&(f=f.slice(3))),n.length===0){const S=g(f);S!==""&&n.push(S);return}if(f.indexOf(`
|
|
58
|
-
`)===-1&&f.indexOf("\r")===-1){n.push(f);return}n.push(f);const L=n.join("");n.length=0;const T=g(L);T!==""&&n.push(T)}function g(f){let L=0;if(f.indexOf("\r")===-1){let T=f.indexOf(`
|
|
59
|
-
|
|
60
|
-
`,L);
|
|
61
|
-
`,L);continue}
|
|
62
|
-
|
|
63
|
-
`,L)
|
|
64
|
-
`,L)
|
|
65
|
-
|
|
66
|
-
${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.test(L)?a(parseInt(L,10)):t(new ls(`Invalid \`retry\` value: "${L}"`,{type:"invalid-retry",value:L,line:T}));break;default:t(new ls(`Unknown field "${f.length>20?`${f.slice(0,20)}…`:f}"`,{type:"unknown-field",field:f,value:L,line:T}));break}}function b(){h>0&&e({id:c,event:u,data:l}),c=void 0,l="",h=0,u=void 0}function C(f={}){if(f.consume&&n.length>0){const L=n.join("");y(L,0,L.length)}o=!0,c=void 0,l="",h=0,u=void 0,n.length=0}return{feed:m,reset:C}}function ds(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 us(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 ps 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(gs(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(gs(this),t)}}function an(r){const e=globalThis.DOMException;return typeof e=="function"?new e(r,"SyntaxError"):new SyntaxError(r)}function aa(r){return r instanceof Error?"errors"in r&&Array.isArray(r.errors)?r.errors.map(aa).join(", "):"cause"in r&&r.cause instanceof Error?`${r}: ${aa(r.cause)}`:r.message:`${r}`}function gs(r){return{type:r.type,message:r.message,code:r.code,defaultPrevented:r.defaultPrevented,cancelable:r.cancelable,timeStamp:r.timeStamp}}var ms=r=>{throw TypeError(r)},sa=(r,e,t)=>e.has(r)||ms("Cannot "+t),N=(r,e,t)=>(sa(r,e,"read from private field"),t?t.call(r):e.get(r)),J=(r,e,t)=>e.has(r)?ms("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),q=(r,e,t,a)=>(sa(r,e,"write to private field"),e.set(r,t),t),xe=(r,e,t)=>(sa(r,e,"access private method"),t),de,je,ze,Et,Dt,ct,qe,lt,Te,We,He,_e,ht,me,ra,na,ia,fs,oa,ca,dt,la,ha;class At extends EventTarget{constructor(e,t){var a,s;super(),J(this,me),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,J(this,de),J(this,je),J(this,ze),J(this,Et),J(this,Dt),J(this,ct),J(this,qe),J(this,lt,null),J(this,Te),J(this,We),J(this,He,null),J(this,_e,null),J(this,ht,null),J(this,na,async n=>{var o;N(this,We).reset();const{body:c,redirected:l,status:h,headers:u}=n;if(h===204){xe(this,me,dt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?q(this,ze,new URL(n.url)):q(this,ze,void 0),h!==200){xe(this,me,dt).call(this,`Non-200 status code (${h})`,h);return}if(!(u.get("content-type")||"").startsWith("text/event-stream")){xe(this,me,dt).call(this,'Invalid content type, expected "text/event-stream"',h);return}if(N(this,de)===this.CLOSED)return;q(this,de,this.OPEN);const m=new Event("open");if((o=N(this,ht))==null||o.call(this,m),this.dispatchEvent(m),typeof c!="object"||!c||!("getReader"in c)){xe(this,me,dt).call(this,"Invalid response body, expected a web ReadableStream",h),this.close();return}const g=new TextDecoder,y=c.getReader();let w=!0;do{const{done:b,value:C}=await y.read();C&&N(this,We).feed(g.decode(C,{stream:!b})),b&&(w=!1,N(this,We).reset(),xe(this,me,la).call(this))}while(w)}),J(this,ia,n=>{q(this,Te,void 0),!(n.name==="AbortError"||n.type==="aborted")&&xe(this,me,la).call(this,aa(n))}),J(this,oa,n=>{typeof n.id=="string"&&q(this,lt,n.id);const o=new MessageEvent(n.event||"message",{data:n.data,origin:N(this,ze)?N(this,ze).origin:N(this,je).origin,lastEventId:n.id||""});N(this,_e)&&(!n.event||n.event==="message")&&N(this,_e).call(this,o),this.dispatchEvent(o)}),J(this,ca,n=>{q(this,ct,n)}),J(this,ha,()=>{q(this,qe,void 0),N(this,de)===this.CONNECTING&&xe(this,me,ra).call(this)});try{if(e instanceof URL)q(this,je,e);else if(typeof e=="string")q(this,je,new URL(e,sn()));else throw new Error("Invalid URL")}catch{throw an("An invalid or illegal string was specified")}q(this,We,tn({onEvent:N(this,oa),onRetry:N(this,ca)})),q(this,de,this.CONNECTING),q(this,ct,3e3),q(this,Dt,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),q(this,Et,(s=t==null?void 0:t.withCredentials)!=null?s:!1),xe(this,me,ra).call(this)}get readyState(){return N(this,de)}get url(){return N(this,je).href}get withCredentials(){return N(this,Et)}get onerror(){return N(this,He)}set onerror(e){q(this,He,e)}get onmessage(){return N(this,_e)}set onmessage(e){q(this,_e,e)}get onopen(){return N(this,ht)}set onopen(e){q(this,ht,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(){N(this,qe)&&clearTimeout(N(this,qe)),N(this,de)!==this.CLOSED&&(N(this,Te)&&N(this,Te).abort(),q(this,de,this.CLOSED),q(this,Te,void 0))}}de=new WeakMap,je=new WeakMap,ze=new WeakMap,Et=new WeakMap,Dt=new WeakMap,ct=new WeakMap,qe=new WeakMap,lt=new WeakMap,Te=new WeakMap,We=new WeakMap,He=new WeakMap,_e=new WeakMap,ht=new WeakMap,me=new WeakSet,ra=function(){q(this,de,this.CONNECTING),q(this,Te,new AbortController),N(this,Dt)(N(this,je),xe(this,me,fs).call(this)).then(N(this,na)).catch(N(this,ia))},na=new WeakMap,ia=new WeakMap,fs=function(){var r;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...N(this,lt)?{"Last-Event-ID":N(this,lt)}:void 0},cache:"no-store",signal:(r=N(this,Te))==null?void 0:r.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},oa=new WeakMap,ca=new WeakMap,dt=function(r,e){var t;N(this,de)!==this.CLOSED&&q(this,de,this.CLOSED);const a=new ps("error",{code:e,message:r});(t=N(this,He))==null||t.call(this,a),this.dispatchEvent(a)},la=function(r,e){var t;if(N(this,de)===this.CLOSED)return;q(this,de,this.CONNECTING);const a=new ps("error",{code:e,message:r});(t=N(this,He))==null||t.call(this,a),this.dispatchEvent(a),q(this,qe,setTimeout(N(this,ha),N(this,ct)))},ha=new WeakMap,At.CONNECTING=0,At.OPEN=1,At.CLOSED=2;function sn(){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 fe{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,c){JSON.stringify(o)===JSON.stringify(t)&&c?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,c){JSON.stringify(o)===JSON.stringify(t)&&c?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)}}d(fe,"subscribedToClickEvent",!1),d(fe,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class rn{constructor(e,t){d(this,"cachedQuery","");d(this,"cachedANDFacets","");d(this,"url","");d(this,"relatedSearches","");d(this,"suggester","");d(this,"authHeader");d(this,"authHeaderRelated");d(this,"trackApiKey","");d(this,"session","");d(this,"searchAuthType");d(this,"searchAuth","");d(this,"controllerSearch");d(this,"signalSearch");d(this,"controllerSuggest");d(this,"signalSuggest");d(this,"_authToken","");d(this,"resolveFn");d(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 c=o.name+":"+o.value,l=decodeURIComponent(c).replace(" "," ").split(":");s[l[0]]?s[l[0]].push(l[1]):s[l[0]]=[l[1]]});let n="";for(const o in s)if(Object.prototype.hasOwnProperty.call(s,o)){const c=s[o],l=o;for(const h of c)n+=n===""?` ${l}:"${h}"`:` OR ${l}:"${h}"`}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=ot.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),c={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete c.signal,fetch(o,c).then(l=>l.json()).then(l=>{this.dataLayer.setLoading(!1),t(l,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:(h,u)=>h.get(u)??""}),c=o.languageVariant?"&fq=_language:"+o.languageVariant:"",l=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)+s+n+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(l?`&model=${l}`:"")+"&language="+this.dataLayer.language+c}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.searchObject.page!==1)return;const a=new At(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===Ve.question||n.data===Ve.notQuestion){n.data===Ve.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(s.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),s.setAnswerData("");return}if(n.data===Ve.close){fe.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 c=o[1].split("})");if(c.length<2){t(n.data);return}const l=c[0],h=JSON.parse("{"+l+"}");this.dataLayer.answerWidgetShowMoreLimit=h.displayShowMoreAfter,h.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const u=c.slice(1).join("})");t(u)}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 nn=Object.prototype.toString,Qe=Array.isArray||function(r){return nn.call(r)==="[object Array]"};function da(r){return typeof r=="function"}function on(r){return Qe(r)?"array":typeof r}function ua(r){return r.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ls(r,e){return r!=null&&typeof r=="object"&&e in r}function cn(r,e){return r!=null&&typeof r!="object"&&r.hasOwnProperty&&r.hasOwnProperty(e)}var ln=RegExp.prototype.test;function hn(r,e){return ln.call(r,e)}var dn=/\S/;function un(r){return!hn(dn,r)}var pn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function gn(r){return String(r).replace(/[&<>"'`=\/]/g,function(e){return pn[e]})}var mn=/\s*/,fn=/\s+/,ys=/\s*=/,Ln=/\s*\}/,yn=/#|\^|\/|>|\{|&|=|!/;function wn(r,e){if(!r)return[];var t=!1,a=[],s=[],n=[],o=!1,c=!1,l="",h=0;function u(){if(o&&!c)for(;n.length;)delete s[n.pop()];else n=[];o=!1,c=!1}var m,g,y;function w(E){if(typeof E=="string"&&(E=E.split(fn,2)),!Qe(E)||E.length!==2)throw new Error("Invalid tags: "+E);m=new RegExp(ua(E[0])+"\\s*"),g=new RegExp("\\s*"+ua(E[1])),y=new RegExp("\\s*"+ua("}"+E[1]))}w(e||R.tags);for(var b=new ut(r),C,f,L,T,S,A;!b.eos();){if(C=b.pos,L=b.scanUntil(m),L)for(var j=0,V=L.length;j<V;++j)T=L.charAt(j),un(T)?(n.push(s.length),l+=T):(c=!0,t=!0,l+=" "),s.push(["text",T,C,C+1]),C+=1,T===`
|
|
67
|
-
`&&(u(),l="",h=0,t=!1);if(!b.scan(m))break;if(o=!0,f=b.scan(yn)||"name",b.scan(mn),f==="="?(L=b.scanUntil(ys),b.scan(ys),b.scanUntil(g)):f==="{"?(L=b.scanUntil(y),b.scan(Ln),b.scanUntil(g),f="&"):L=b.scanUntil(g),!b.scan(g))throw new Error("Unclosed tag at "+b.pos);if(f==">"?S=[f,L,C,b.pos,l,h,t]:S=[f,L,C,b.pos],h++,s.push(S),f==="#"||f==="^")a.push(S);else if(f==="/"){if(A=a.pop(),!A)throw new Error('Unopened section "'+L+'" at '+C);if(A[1]!==L)throw new Error('Unclosed section "'+A[1]+'" at '+C)}else f==="name"||f==="{"||f==="&"?c=!0:f==="="&&w(L)}if(u(),A=a.pop(),A)throw new Error('Unclosed section "'+A[1]+'" at '+b.pos);return Cn(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 Cn(r){for(var e=[],t=e,a=[],s,n,o=0,c=r.length;o<c;++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 ut(r){this.string=r,this.tail=r,this.pos=0}ut.prototype.eos=function(){return this.tail===""},ut.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},ut.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 Ue(r,e){this.view=r,this.cache={".":this.view},this.parent=e}Ue.prototype.push=function(r){return new Ue(r,this)},Ue.prototype.lookup=function(r){var e=this.cache,t;if(e.hasOwnProperty(r))t=e[r];else{for(var a=this,s,n,o,c=!1;a;){if(r.indexOf(".")>0)for(s=a.view,n=r.split("."),o=0;s!=null&&o<n.length;)o===n.length-1&&(c=Ls(s,n[o])||cn(s,n[o])),s=s[n[o++]];else s=a.view[r],c=Ls(a.view,r);if(c){t=s;break}a=a.parent}e[r]=t}return da(t)&&(t=t.call(this.view)),t};function ce(){this.templateCache={_cache:{},set:function(r,e){this._cache[r]=e},get:function(r){return this._cache[r]},clear:function(){this._cache={}}}}ce.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},ce.prototype.parse=function(r,e){var t=this.templateCache,a=r+":"+(e||R.tags).join(":"),s=typeof t<"u",n=s?t.get(a):void 0;return n==null&&(n=wn(r,e),s&&t.set(a,n)),n},ce.prototype.render=function(r,e,t,a){var s=this.getConfigTags(a),n=this.parse(r,s),o=e instanceof Ue?e:new Ue(e,void 0);return this.renderTokens(n,o,t,r,a)},ce.prototype.renderTokens=function(r,e,t,a,s){for(var n="",o,c,l,h=0,u=r.length;h<u;++h)l=void 0,o=r[h],c=o[0],c==="#"?l=this.renderSection(o,e,t,a,s):c==="^"?l=this.renderInverted(o,e,t,a,s):c===">"?l=this.renderPartial(o,e,t,s):c==="&"?l=this.unescapedValue(o,e):c==="name"?l=this.escapedValue(o,e,s):c==="text"&&(l=this.rawValue(o)),l!==void 0&&(n+=l);return n},ce.prototype.renderSection=function(r,e,t,a,s){var n=this,o="",c=e.lookup(r[1]);function l(m){return n.render(m,e,t,s)}if(c){if(Qe(c))for(var h=0,u=c.length;h<u;++h)o+=this.renderTokens(r[4],e.push(c[h]),t,a,s);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(r[4],e.push(c),t,a,s);else if(da(c)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,a.slice(r[3],r[5]),l),c!=null&&(o+=c)}else o+=this.renderTokens(r[4],e,t,a,s);return o}},ce.prototype.renderInverted=function(r,e,t,a,s){var n=e.lookup(r[1]);if(!n||Qe(n)&&n.length===0)return this.renderTokens(r[4],e,t,a,s)},ce.prototype.indentPartial=function(r,e,t){for(var a=e.replace(/[^ \t]/g,""),s=r.split(`
|
|
68
|
-
|
|
69
|
-
`)
|
|
51
|
+
`}tablerow({text:n}){return`<tr>
|
|
52
|
+
${n}</tr>
|
|
53
|
+
`}tablecell(n){const e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
54
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${we(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){const a=this.parser.parseInline(t),s=Xa(n);if(s===null)return a;n=s;let r='<a href="'+n+'"';return e&&(r+=' title="'+we(e)+'"'),r+=">"+a+"</a>",r}image({href:n,title:e,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const s=Xa(n);if(s===null)return we(t);n=s;let r=`<img src="${n}" alt="${t}"`;return e&&(r+=` title="${we(e)}"`),r+=">",r}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:we(n.text)}},Zt=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}},Se=class Ba{constructor(e){u(this,"options");u(this,"renderer");u(this,"textRenderer");this.options=e||Oe,this.options.renderer=this.options.renderer||new It,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Zt}static parse(e,t){return new Ba(t).parse(e)}static parseInline(e,t){return new Ba(t).parseInline(e)}parse(e,t=!0){var s,r;let a="";for(let o=0;o<e.length;o++){const c=e[o];if((r=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&r[c.type]){const d=c,p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(d.type)){a+=p||"";continue}}const l=c;switch(l.type){case"space":{a+=this.renderer.space(l);continue}case"hr":{a+=this.renderer.hr(l);continue}case"heading":{a+=this.renderer.heading(l);continue}case"code":{a+=this.renderer.code(l);continue}case"table":{a+=this.renderer.table(l);continue}case"blockquote":{a+=this.renderer.blockquote(l);continue}case"list":{a+=this.renderer.list(l);continue}case"html":{a+=this.renderer.html(l);continue}case"paragraph":{a+=this.renderer.paragraph(l);continue}case"text":{let d=l,p=this.renderer.text(d);for(;o+1<e.length&&e[o+1].type==="text";)d=e[++o],p+=`
|
|
55
|
+
`+this.renderer.text(d);t?a+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):a+=p;continue}default:{const d='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return a}parseInline(e,t=this.renderer){var s,r;let a="";for(let o=0;o<e.length;o++){const c=e[o];if((r=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&r[c.type]){const d=this.options.extensions.renderers[c.type].call({parser:this},c);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(c.type)){a+=d||"";continue}}const l=c;switch(l.type){case"escape":{a+=t.text(l);break}case"html":{a+=t.html(l);break}case"link":{a+=t.link(l);break}case"image":{a+=t.image(l);break}case"strong":{a+=t.strong(l);break}case"em":{a+=t.em(l);break}case"codespan":{a+=t.codespan(l);break}case"br":{a+=t.br(l);break}case"del":{a+=t.del(l);break}case"text":{a+=t.text(l);break}default:{const d='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return a}},vt=(ba=class{constructor(n){u(this,"options");u(this,"block");this.options=n||Oe}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}provideLexer(){return this.block?Me.lex:Me.lexInline}provideParser(){return this.block?Se.parse:Se.parseInline}},u(ba,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),ba),zn=class{constructor(...n){u(this,"defaults",Wt());u(this,"options",this.setOptions);u(this,"parse",this.parseMarkdown(!0));u(this,"parseInline",this.parseMarkdown(!1));u(this,"Parser",Se);u(this,"Renderer",It);u(this,"TextRenderer",Zt);u(this,"Lexer",Me);u(this,"Tokenizer",At);u(this,"Hooks",vt);this.use(...n)}walkTokens(n,e){var a,s;let t=[];for(const r of n)switch(t=t.concat(e.call(this,r)),r.type){case"table":{const o=r;for(const c of o.header)t=t.concat(this.walkTokens(c.tokens,e));for(const c of o.rows)for(const l of c)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{const o=r;t=t.concat(this.walkTokens(o.items,e));break}default:{const o=r;(s=(a=this.defaults.extensions)==null?void 0:a.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(c=>{const l=o[c].flat(1/0);t=t.concat(this.walkTokens(l,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{const a={...t};if(a.async=this.defaults.async||a.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const r=e.renderers[s.name];r?e.renderers[s.name]=function(...o){let c=s.renderer.apply(this,o);return c===!1&&(c=r.apply(this,o)),c}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=e[s.level];r?r.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),a.extensions=e),t.renderer){const s=this.defaults.renderer||new It(this.defaults);for(const r in t.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const o=r,c=t.renderer[o],l=s[o];s[o]=(...d)=>{let p=c.apply(s,d);return p===!1&&(p=l.apply(s,d)),p||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new At(this.defaults);for(const r in t.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const o=r,c=t.tokenizer[o],l=s[o];s[o]=(...d)=>{let p=c.apply(s,d);return p===!1&&(p=l.apply(s,d)),p}}a.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new vt;for(const r in t.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const o=r,c=t.hooks[o],l=s[o];vt.passThroughHooks.has(r)?s[o]=d=>{if(this.defaults.async)return Promise.resolve(c.call(s,d)).then(g=>l.call(s,g));const p=c.call(s,d);return l.call(s,p)}:s[o]=(...d)=>{let p=c.apply(s,d);return p===!1&&(p=l.apply(s,d)),p}}a.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,r=t.walkTokens;a.walkTokens=function(o){let c=[];return c.push(r.call(this,o)),s&&(c=c.concat(s.call(this,o))),c}}this.defaults={...this.defaults,...a}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return Me.lex(n,e??this.defaults)}parser(n,e){return Se.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{const a={...t},s={...this.defaults,...a},r=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&a.async===!1)return r(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 r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=n);const o=s.hooks?s.hooks.provideLexer():n?Me.lex:Me.lexInline,c=s.hooks?s.hooks.provideParser():n?Se.parse:Se.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(e):e).then(l=>o(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>c(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(r);try{s.hooks&&(e=s.hooks.preprocess(e));let l=o(e,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let d=c(l,s);return s.hooks&&(d=s.hooks.postprocess(d)),d}catch(l){return r(l)}}}onError(n,e){return t=>{if(t.message+=`
|
|
56
|
+
Please report this to https://github.com/markedjs/marked.`,n){const a="<p>An error occurred:</p><pre>"+we(t.message+"",!0)+"</pre>";return e?Promise.resolve(a):a}if(e)return Promise.reject(t);throw t}}},Pe=new zn;function V(n,e){return Pe.parse(n,e)}V.options=V.setOptions=function(n){return Pe.setOptions(n),V.defaults=Pe.defaults,Va(V.defaults),V},V.getDefaults=Wt,V.defaults=Oe,V.use=function(...n){return Pe.use(...n),V.defaults=Pe.defaults,Va(V.defaults),V},V.walkTokens=function(n,e){return Pe.walkTokens(n,e)},V.parseInline=Pe.parseInline,V.Parser=Se,V.parser=Se.parse,V.Renderer=It,V.TextRenderer=Zt,V.Lexer=Me,V.lexer=Me.lex,V.Tokenizer=At,V.Hooks=vt,V.parse=V,V.options,V.setOptions,V.use,V.walkTokens,V.parseInline,Se.parse,Me.lex;function as(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,a=Array(e);t<e;t++)a[t]=n[t];return a}function qn(n){if(Array.isArray(n))return n}function Wn(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var a,s,r,o,c=[],l=!0,d=!1;try{if(r=(t=t.call(n)).next,e!==0)for(;!(l=(a=r.call(t)).done)&&(c.push(a.value),c.length!==e);l=!0);}catch(p){d=!0,s=p}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(d)throw s}}return c}}function Qn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
57
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hn(n,e){return qn(n)||Wn(n,e)||Un(n,e)||Qn()}function Un(n,e){if(n){if(typeof n=="string")return as(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?as(n,e):void 0}}const ss=Object.entries,ns=Object.setPrototypeOf,Yn=Object.isFrozen,_n=Object.getPrototypeOf,Jn=Object.getOwnPropertyDescriptor;let re=Object.freeze,ie=Object.seal,Qe=Object.create,rs=typeof Reflect<"u"&&Reflect,Xt=rs.apply,ea=rs.construct;re||(re=function(n){return n}),ie||(ie=function(n){return n}),Xt||(Xt=function(n,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 n.apply(e,a)}),ea||(ea=function(n){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 n(...t)});const ht=K(Array.prototype.forEach),Gn=K(Array.prototype.lastIndexOf),is=K(Array.prototype.pop),He=K(Array.prototype.push),Kn=K(Array.prototype.splice),De=Array.isArray,dt=K(String.prototype.toLowerCase),ta=K(String.prototype.toString),os=K(String.prototype.match),ut=K(String.prototype.replace),cs=K(String.prototype.indexOf),Zn=K(String.prototype.trim),Xn=K(Number.prototype.toString),er=K(Boolean.prototype.toString),ls=typeof BigInt>"u"?null:K(BigInt.prototype.toString),hs=typeof Symbol>"u"?null:K(Symbol.prototype.toString),ae=K(Object.prototype.hasOwnProperty),pt=K(Object.prototype.toString),oe=K(RegExp.prototype.test),Fe=tr(TypeError);function K(n){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 Xt(n,e,a)}}function tr(n){return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];return ea(n,t)}}function F(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:dt;if(ns&&ns(n,null),!De(e))return n;let a=e.length;for(;a--;){let s=e[a];if(typeof s=="string"){const r=t(s);r!==s&&(Yn(e)||(e[a]=r),s=r)}n[s]=!0}return n}function ar(n){for(let e=0;e<n.length;e++)ae(n,e)||(n[e]=null);return n}function le(n){const e=Qe(null);for(const a of ss(n)){var t=Hn(a,2);const s=t[0],r=t[1];ae(n,s)&&(De(r)?e[s]=ar(r):r&&typeof r=="object"&&r.constructor===Object?e[s]=le(r):e[s]=r)}return e}function sr(n){switch(typeof n){case"string":return n;case"number":return Xn(n);case"boolean":return er(n);case"bigint":return ls?ls(n):"0";case"symbol":return hs?hs(n):"Symbol()";case"undefined":return pt(n);case"function":case"object":{if(n===null)return pt(n);const e=n,t=be(e,"toString");if(typeof t=="function"){const a=t(e);return typeof a=="string"?a:pt(a)}return pt(n)}default:return pt(n)}}function be(n,e){for(;n!==null;){const a=Jn(n,e);if(a){if(a.get)return K(a.get);if(typeof a.value=="function")return K(a.value)}n=_n(n)}function t(){return null}return t}function nr(n){try{return oe(n,""),!0}catch{return!1}}const ds=re(["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"]),aa=re(["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=re(["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"]),rr=re(["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"]),na=re(["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"]),ir=re(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),us=re(["#text"]),ps=re(["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"]),ra=re(["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"]),gs=re(["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=re(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),or=ie(/{{[\w\W]*|^[\w\W]*}}/g),cr=ie(/<%[\w\W]*|^[\w\W]*%>/g),lr=ie(/\${[\w\W]*/g),hr=ie(/^data-[\-\w.\u00B7-\uFFFF]+$/),dr=ie(/^aria-[\-\w]+$/),ms=ie(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ur=ie(/^(?:\w+script|data):/i),pr=ie(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gr=ie(/^html$/i),mr=ie(/^[a-z][.\w]*(-[.\w]+)+$/i),fs=ie(/<[/\w!]/g),fr=ie(/<[/\w]/g),yr=ie(/<\/no(script|embed|frames)/i),Lr=ie(/\/>/i),Ce={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},wr=function(){return typeof window>"u"?null:window},br=function(n,e){if(typeof n!="object"||typeof n.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 n.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},ys=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ae=function(n,e,t,a){return ae(n,e)&&De(n[e])?F(a.base?le(a.base):{},n[e],a.transform):t};function Ls(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wr();const e=h=>Ls(h);if(e.version="3.4.11",e.removed=[],!n||!n.document||n.document.nodeType!==Ce.document||!n.Element)return e.isSupported=!1,e;let t=n.document;const a=t,s=a.currentScript;n.DocumentFragment;const r=n.HTMLTemplateElement,o=n.Node,c=n.Element,l=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;const d=n.DOMParser,p=n.trustedTypes,g=c.prototype,m=be(g,"cloneNode"),C=be(g,"remove"),x=be(g,"nextSibling"),b=be(g,"childNodes"),k=be(g,"parentNode"),A=be(g,"shadowRoot"),N=be(g,"attributes"),R=o&&o.prototype?be(o.prototype,"nodeType"):null,I=o&&o.prototype?be(o.prototype,"nodeName"):null;if(typeof r=="function"){const h=t.createElement("template");h.content&&h.content.ownerDocument&&(t=h.content.ownerDocument)}let y,L="",D,M=!1,v=0;const H=function(){if(v>0)throw Fe('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.')},ne=function(h){H(),v++;try{return y.createHTML(h)}finally{v--}},ye=function(h){H(),v++;try{return y.createScriptURL(h)}finally{v--}},Ca=function(){return M||(D=br(p,s),M=!0),D},Le=t,et=Le.implementation,js=Le.createNodeIterator,jc=Le.createDocumentFragment,Nc=Le.getElementsByTagName,Rc=a.importNode;let G=ys();e.isSupported=typeof ss=="function"&&typeof k=="function"&&et&&et.createHTMLDocument!==void 0;const Oc=or,Pc=cr,Fc=lr,$c=hr,Bc=dr,Vc=ur,Ns=pr,zc=mr;let Rs=ms,U=null;const Os=F({},[...ds,...aa,...sa,...na,...us]);let Y=null;const Ps=F({},[...ps,...ra,...gs,...jt]);let _=Object.seal(Qe(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}})),Ct=null,Fs=null;const ve=Object.seal(Qe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $s=!0,ka=!0,Bs=!1,Vs=!0,je=!1,kt=!0,Ve=!1,xa=!1,Ma=null,Sa=null,Ta=!1,tt=!1,Pt=!1,Ft=!1,zs=!0,qs=!1;const Ws="user-content-";let Ea=!0,Da=!1,at={},ke=null;const Aa=F({},["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 Qs=null;const Hs=F({},["audio","video","img","source","image","track"]);let Ia=null;const Us=F({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",Bt="http://www.w3.org/2000/svg",xe="http://www.w3.org/1999/xhtml";let st=xe,va=!1,ja=null;const qc=F({},[$t,Bt,xe],ta),Ys=re(["mi","mo","mn","ms","mtext"]);let Na=F({},Ys);const _s=re(["annotation-xml"]);let Ra=F({},_s);const Wc=F({},["title","style","font","a","script"]);let xt=null;const Qc=["application/xhtml+xml","text/html"],Hc="text/html";let J=null,nt=null;const Uc=t.createElement("form"),Js=function(h){return h instanceof RegExp||h instanceof Function},Oa=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(nt&&nt===h)return;(!h||typeof h!="object")&&(h={}),h=le(h),xt=Qc.indexOf(h.PARSER_MEDIA_TYPE)===-1?Hc:h.PARSER_MEDIA_TYPE,J=xt==="application/xhtml+xml"?ta:dt,U=Ae(h,"ALLOWED_TAGS",Os,{transform:J}),Y=Ae(h,"ALLOWED_ATTR",Ps,{transform:J}),ja=Ae(h,"ALLOWED_NAMESPACES",qc,{transform:ta}),Ia=Ae(h,"ADD_URI_SAFE_ATTR",Us,{transform:J,base:Us}),Qs=Ae(h,"ADD_DATA_URI_TAGS",Hs,{transform:J,base:Hs}),ke=Ae(h,"FORBID_CONTENTS",Aa,{transform:J}),Ct=Ae(h,"FORBID_TAGS",le({}),{transform:J}),Fs=Ae(h,"FORBID_ATTR",le({}),{transform:J}),at=ae(h,"USE_PROFILES")?h.USE_PROFILES&&typeof h.USE_PROFILES=="object"?le(h.USE_PROFILES):h.USE_PROFILES:!1,$s=h.ALLOW_ARIA_ATTR!==!1,ka=h.ALLOW_DATA_ATTR!==!1,Bs=h.ALLOW_UNKNOWN_PROTOCOLS||!1,Vs=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=h.SAFE_FOR_TEMPLATES||!1,kt=h.SAFE_FOR_XML!==!1,Ve=h.WHOLE_DOCUMENT||!1,tt=h.RETURN_DOM||!1,Pt=h.RETURN_DOM_FRAGMENT||!1,Ft=h.RETURN_TRUSTED_TYPE||!1,Ta=h.FORCE_BODY||!1,zs=h.SANITIZE_DOM!==!1,qs=h.SANITIZE_NAMED_PROPS||!1,Ea=h.KEEP_CONTENT!==!1,Da=h.IN_PLACE||!1,Rs=nr(h.ALLOWED_URI_REGEXP)?h.ALLOWED_URI_REGEXP:ms,st=typeof h.NAMESPACE=="string"?h.NAMESPACE:xe,Na=ae(h,"MATHML_TEXT_INTEGRATION_POINTS")&&h.MATHML_TEXT_INTEGRATION_POINTS&&typeof h.MATHML_TEXT_INTEGRATION_POINTS=="object"?le(h.MATHML_TEXT_INTEGRATION_POINTS):F({},Ys),Ra=ae(h,"HTML_INTEGRATION_POINTS")&&h.HTML_INTEGRATION_POINTS&&typeof h.HTML_INTEGRATION_POINTS=="object"?le(h.HTML_INTEGRATION_POINTS):F({},_s);const f=ae(h,"CUSTOM_ELEMENT_HANDLING")&&h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING=="object"?le(h.CUSTOM_ELEMENT_HANDLING):Qe(null);if(_=Qe(null),ae(f,"tagNameCheck")&&Js(f.tagNameCheck)&&(_.tagNameCheck=f.tagNameCheck),ae(f,"attributeNameCheck")&&Js(f.attributeNameCheck)&&(_.attributeNameCheck=f.attributeNameCheck),ae(f,"allowCustomizedBuiltInElements")&&typeof f.allowCustomizedBuiltInElements=="boolean"&&(_.allowCustomizedBuiltInElements=f.allowCustomizedBuiltInElements),ie(_),je&&(ka=!1),Pt&&(tt=!0),at&&(U=F({},us),Y=Qe(null),at.html===!0&&(F(U,ds),F(Y,ps)),at.svg===!0&&(F(U,aa),F(Y,ra),F(Y,jt)),at.svgFilters===!0&&(F(U,sa),F(Y,ra),F(Y,jt)),at.mathMl===!0&&(F(U,na),F(Y,gs),F(Y,jt))),ve.tagCheck=null,ve.attributeCheck=null,ae(h,"ADD_TAGS")&&(typeof h.ADD_TAGS=="function"?ve.tagCheck=h.ADD_TAGS:De(h.ADD_TAGS)&&(U===Os&&(U=le(U)),F(U,h.ADD_TAGS,J))),ae(h,"ADD_ATTR")&&(typeof h.ADD_ATTR=="function"?ve.attributeCheck=h.ADD_ATTR:De(h.ADD_ATTR)&&(Y===Ps&&(Y=le(Y)),F(Y,h.ADD_ATTR,J))),ae(h,"ADD_URI_SAFE_ATTR")&&De(h.ADD_URI_SAFE_ATTR)&&F(Ia,h.ADD_URI_SAFE_ATTR,J),ae(h,"FORBID_CONTENTS")&&De(h.FORBID_CONTENTS)&&(ke===Aa&&(ke=le(ke)),F(ke,h.FORBID_CONTENTS,J)),ae(h,"ADD_FORBID_CONTENTS")&&De(h.ADD_FORBID_CONTENTS)&&(ke===Aa&&(ke=le(ke)),F(ke,h.ADD_FORBID_CONTENTS,J)),Ea&&(U["#text"]=!0),Ve&&F(U,["html","head","body"]),U.table&&(F(U,["tbody"]),delete Ct.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw Fe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Fe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const w=y;y=h.TRUSTED_TYPES_POLICY;try{L=ne("")}catch(T){throw y=w,T}}else h.TRUSTED_TYPES_POLICY===null?(y=void 0,L=""):(y===void 0&&(y=Ca()),y&&typeof L=="string"&&(L=ne("")));re&&re(h),nt=h},Gs=F({},[...aa,...sa,...rr]),Ks=F({},[...na,...ir]),Yc=function(h,f,w){return f.namespaceURI===xe?h==="svg":f.namespaceURI===$t?h==="svg"&&(w==="annotation-xml"||Na[w]):!!Gs[h]},_c=function(h,f,w){return f.namespaceURI===xe?h==="math":f.namespaceURI===Bt?h==="math"&&Ra[w]:!!Ks[h]},Jc=function(h,f,w){return f.namespaceURI===Bt&&!Ra[w]||f.namespaceURI===$t&&!Na[w]?!1:!Ks[h]&&(Wc[h]||!Gs[h])},Gc=function(h){let f=k(h);(!f||!f.tagName)&&(f={namespaceURI:st,tagName:"template"});const w=dt(h.tagName),T=dt(f.tagName);return ja[h.namespaceURI]?h.namespaceURI===Bt?Yc(w,f,T):h.namespaceURI===$t?_c(w,f,T):h.namespaceURI===xe?Jc(w,f,T):!!(xt==="application/xhtml+xml"&&ja[h.namespaceURI]):!1},ze=function(h){He(e.removed,{element:h});try{k(h).removeChild(h)}catch{if(C(h),!k(h))throw Fe("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Zs=function(h){const f=b(h);if(f){const T=[];ht(f,P=>{He(T,P)}),ht(T,P=>{try{C(P)}catch{}})}const w=N(h);if(w)for(let T=w.length-1;T>=0;--T){const P=w[T],q=P&&P.name;if(typeof q=="string")try{h.removeAttribute(q)}catch{}}},qe=function(h,f){try{He(e.removed,{attribute:f.getAttributeNode(h),from:f})}catch{He(e.removed,{attribute:null,from:f})}if(f.removeAttribute(h),h==="is")if(tt||Pt)try{ze(f)}catch{}else try{f.setAttribute(h,"")}catch{}},Kc=function(h){const f=N(h);if(f)for(let w=f.length-1;w>=0;--w){const T=f[w],P=T&&T.name;if(!(typeof P!="string"||Y[J(P)]))try{h.removeAttribute(P)}catch{}}},Zc=function(h){const f=[h];for(;f.length>0;){const w=f.pop();(R?R(w):w.nodeType)===Ce.element&&Kc(w);const T=b(w);if(T)for(let P=T.length-1;P>=0;--P)f.push(T[P])}},Xs=function(h){let f=null,w=null;if(Ta)h="<remove></remove>"+h;else{const q=os(h,/^[\r\n\t ]+/);w=q&&q[0]}xt==="application/xhtml+xml"&&st===xe&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const T=y?ne(h):h;if(st===xe)try{f=new d().parseFromString(T,xt)}catch{}if(!f||!f.documentElement){f=et.createDocument(st,"template",null);try{f.documentElement.innerHTML=va?L:T}catch{}}const P=f.body||f.documentElement;return h&&w&&P.insertBefore(t.createTextNode(w),P.childNodes[0]||null),st===xe?Nc.call(f,Ve?"html":"body")[0]:Ve?f.documentElement:P},en=function(h){return js.call(h.ownerDocument||h,h,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Vt=function(h){return h=ut(h,Oc," "),h=ut(h,Pc," "),h=ut(h,Fc," "),h},Pa=function(h){var f;h.normalize();const w=js.call(h.ownerDocument||h,h,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let T=w.nextNode();for(;T;)T.data=Vt(T.data),T=w.nextNode();const P=(f=h.querySelectorAll)===null||f===void 0?void 0:f.call(h,"template");P&&ht(P,q=>{rt(q.content)&&Pa(q.content)})},zt=function(h){const f=I?I(h):null;return typeof f!="string"||J(f)!=="form"?!1:typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||h.attributes!==N(h)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function"||h.nodeType!==R(h)||h.childNodes!==b(h)},rt=function(h){if(!R||typeof h!="object"||h===null)return!1;try{return R(h)===Ce.documentFragment}catch{return!1}},Mt=function(h){if(!R||typeof h!="object"||h===null)return!1;try{return typeof R(h)=="number"}catch{return!1}};function Ee(h,f,w){h.length!==0&&ht(h,T=>{T.call(e,f,w,nt)})}const Xc=function(h,f){return!!(kt&&h.hasChildNodes()&&!Mt(h.firstElementChild)&&oe(fs,h.textContent)&&oe(fs,h.innerHTML)||kt&&h.namespaceURI===xe&&f==="style"&&Mt(h.firstElementChild)||h.nodeType===Ce.processingInstruction||kt&&h.nodeType===Ce.comment&&oe(fr,h.data))},el=function(h,f){if(!Ct[f]&&sn(f)&&(_.tagNameCheck instanceof RegExp&&oe(_.tagNameCheck,f)||_.tagNameCheck instanceof Function&&_.tagNameCheck(f)))return!1;if(Ea&&!ke[f]){const w=k(h),T=b(h);if(T&&w){const P=T.length;for(let q=P-1;q>=0;--q){const W=Da?T[q]:m(T[q],!0);w.insertBefore(W,x(h))}}}return ze(h),!0},tn=function(h){if(Ee(G.beforeSanitizeElements,h,null),zt(h))return ze(h),!0;const f=J(I?I(h):h.nodeName);if(Ee(G.uponSanitizeElement,h,{tagName:f,allowedTags:U}),Xc(h,f))return ze(h),!0;if(Ct[f]||!(ve.tagCheck instanceof Function&&ve.tagCheck(f))&&!U[f])return el(h,f);if((R?R(h):h.nodeType)===Ce.element&&!Gc(h)||(f==="noscript"||f==="noembed"||f==="noframes")&&oe(yr,h.innerHTML))return ze(h),!0;if(je&&h.nodeType===Ce.text){const w=Vt(h.textContent);h.textContent!==w&&(He(e.removed,{element:h.cloneNode()}),h.textContent=w)}return Ee(G.afterSanitizeElements,h,null),!1},an=function(h,f,w){if(Fs[f]||zs&&(f==="id"||f==="name")&&(w in t||w in Uc))return!1;const T=Y[f]||ve.attributeCheck instanceof Function&&ve.attributeCheck(f,h);if(!(ka&&oe($c,f))&&!($s&&oe(Bc,f))){if(T){if(!Ia[f]&&!oe(Rs,ut(w,Ns,""))&&!((f==="src"||f==="xlink:href"||f==="href")&&h!=="script"&&cs(w,"data:")===0&&Qs[h])&&!(Bs&&!oe(Vc,ut(w,Ns,"")))&&w)return!1}else if(!(sn(h)&&(_.tagNameCheck instanceof RegExp&&oe(_.tagNameCheck,h)||_.tagNameCheck instanceof Function&&_.tagNameCheck(h))&&(_.attributeNameCheck instanceof RegExp&&oe(_.attributeNameCheck,f)||_.attributeNameCheck instanceof Function&&_.attributeNameCheck(f,h))||f==="is"&&_.allowCustomizedBuiltInElements&&(_.tagNameCheck instanceof RegExp&&oe(_.tagNameCheck,w)||_.tagNameCheck instanceof Function&&_.tagNameCheck(w))))return!1}return!0},tl=F({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),sn=function(h){return!tl[dt(h)]&&oe(zc,h)},al=function(h,f,w,T){if(y&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!w)switch(p.getAttributeType(h,f)){case"TrustedHTML":return ne(T);case"TrustedScriptURL":return ye(T)}return T},sl=function(h,f,w,T){try{w?h.setAttributeNS(w,f,T):h.setAttribute(f,T),zt(h)?ze(h):is(e.removed)}catch{qe(f,h)}},nn=function(h){Ee(G.beforeSanitizeAttributes,h,null);const f=h.attributes;if(!f||zt(h))return;const w={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let T=f.length;const P=J(h.nodeName);for(;T--;){const q=f[T],W=q.name,We=q.namespaceURI,Ne=q.value,pe=J(W),Re=Ne;let de=W==="value"?Re:Zn(Re);if(w.attrName=pe,w.attrValue=de,w.keepAttr=!0,w.forceKeepAttr=void 0,Ee(G.uponSanitizeAttribute,h,w),de=w.attrValue,qs&&(pe==="id"||pe==="name")&&cs(de,Ws)!==0&&(qe(W,h),de=Ws+de),kt&&oe(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,de)){qe(W,h);continue}if(pe==="attributename"&&os(de,"href")){qe(W,h);continue}if(!w.forceKeepAttr){if(!w.keepAttr){qe(W,h);continue}if(!Vs&&oe(Lr,de)){qe(W,h);continue}if(je&&(de=Vt(de)),!an(P,pe,de)){qe(W,h);continue}de=al(P,pe,We,de),de!==Re&&sl(h,W,We,de)}}Ee(G.afterSanitizeAttributes,h,null)},qt=function(h){let f=null;const w=en(h);for(Ee(G.beforeSanitizeShadowDOM,h,null);f=w.nextNode();)if(Ee(G.uponSanitizeShadowNode,f,null),tn(f),nn(f),rt(f.content)&&qt(f.content),(R?R(f):f.nodeType)===Ce.element){const T=A(f);rt(T)&&(Fa(T),qt(T))}Ee(G.afterSanitizeShadowDOM,h,null)},Fa=function(h){const f=[{node:h,shadow:null}];for(;f.length>0;){const w=f.pop();if(w.shadow){qt(w.shadow);continue}const T=w.node,P=(R?R(T):T.nodeType)===Ce.element,q=b(T);if(q)for(let W=q.length-1;W>=0;--W)f.push({node:q[W],shadow:null});if(P){const W=I?I(T):null;if(typeof W=="string"&&J(W)==="template"){const We=T.content;rt(We)&&f.push({node:We,shadow:null})}}if(P){const W=A(T);rt(W)&&f.push({node:null,shadow:W},{node:W,shadow:null})}}};return e.sanitize=function(h){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=null,T=null,P=null,q=null;if(va=!h,va&&(h="<!-->"),typeof h!="string"&&!Mt(h)&&(h=sr(h),typeof h!="string"))throw Fe("dirty is not a string, aborting");if(!e.isSupported)return h;xa?(U=Ma,Y=Sa):Oa(f),(G.uponSanitizeElement.length>0||G.uponSanitizeAttribute.length>0)&&(U=le(U)),G.uponSanitizeAttribute.length>0&&(Y=le(Y)),e.removed=[];const W=Da&&typeof h!="string"&&Mt(h);if(W){const pe=I?I(h):h.nodeName;if(typeof pe=="string"){const Re=J(pe);if(!U[Re]||Ct[Re])throw Fe("root node is forbidden and cannot be sanitized in-place")}if(zt(h))throw Fe("root node is clobbered and cannot be sanitized in-place");try{Fa(h)}catch(Re){throw Zs(h),Re}}else if(Mt(h))w=Xs("<!---->"),T=w.ownerDocument.importNode(h,!0),T.nodeType===Ce.element&&T.nodeName==="BODY"||T.nodeName==="HTML"?w=T:w.appendChild(T),Fa(T);else{if(!tt&&!je&&!Ve&&h.indexOf("<")===-1)return y&&Ft?ne(h):h;if(w=Xs(h),!w)return tt?null:Ft?L:""}w&&Ta&&ze(w.firstChild);const We=en(W?h:w);try{for(;P=We.nextNode();)tn(P),nn(P),rt(P.content)&&qt(P.content)}catch(pe){throw W&&Zs(h),pe}if(W)return ht(e.removed,pe=>{pe.element&&Zc(pe.element)}),je&&Pa(h),h;if(tt){if(je&&Pa(w),Pt)for(q=jc.call(w.ownerDocument);w.firstChild;)q.appendChild(w.firstChild);else q=w;return(Y.shadowroot||Y.shadowrootmode)&&(q=Rc.call(a,q,!0)),q}let Ne=Ve?w.outerHTML:w.innerHTML;return Ve&&U["!doctype"]&&w.ownerDocument&&w.ownerDocument.doctype&&w.ownerDocument.doctype.name&&oe(gr,w.ownerDocument.doctype.name)&&(Ne="<!DOCTYPE "+w.ownerDocument.doctype.name+`>
|
|
58
|
+
`+Ne),je&&(Ne=Vt(Ne)),y&&Ft?ne(Ne):Ne},e.setConfig=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Oa(h),xa=!0,Ma=U,Sa=Y},e.clearConfig=function(){nt=null,xa=!1,Ma=null,Sa=null,y=D,L=""},e.isValidAttribute=function(h,f,w){nt||Oa({});const T=J(h),P=J(f);return an(T,P,w)},e.addHook=function(h,f){typeof f=="function"&&ae(G,h)&&He(G[h],f)},e.removeHook=function(h,f){if(ae(G,h)){if(f!==void 0){const w=Gn(G[h],f);return w===-1?void 0:Kn(G[h],w,1)[0]}return is(G[h])}},e.removeHooks=function(h){ae(G,h)&&(G[h]=[])},e.removeAllHooks=function(){G=ys()},e}var ws=Ls();class Cr{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 ws.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,s,r,o,c;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:(c=(o=(r=this.dataLayer.searchResultsMetadata)==null?void 0:r.location)==null?void 0:o.filter)==null?void 0:c.enabled)??!1}get locationSearchDistanceValues(){var a,s,r,o,c,l,d,p,g;const e=((s=(a=this.dataLayer.searchLocationConfig)==null?void 0:a.locationValuesOverride)==null?void 0:s.filterValues)??((c=(o=(r=this.dataLayer.searchResultsMetadata)==null?void 0:r.location)==null?void 0:o.filter)==null?void 0:c.values),t=((d=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:d.filterUnit)??((g=(p=this.dataLayer.searchResultsMetadata)==null?void 0:p.location)==null?void 0:g.unit);return!e||e.length===0?[]:e.map(m=>({label:m==="any"?"Any Distance":m+" "+(t??""),value:m,isSelected:m===this.dataLayer.searchRadius})).sort((m,C)=>{const x=m.value==="any"?0:parseFloat(m.value),b=C.value==="any"?0:parseFloat(C.value);return x-b})}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 ws.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,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 ge{static deepEqual(e,t){const a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(const r of a){const o=e[r],c=t[r],l=this.isObject(o)&&this.isObject(c);if(l&&!this.deepEqual(o,c)||!l&&o!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class j{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),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=r=>{a++,e(r),a>=2&&this.unsubscribe(t)};this.subscribe(s,t)}subscribeUntil(e,t,a=6e3,s=!0){const r=Math.random().toString(36).substring(2,15),o=c=>{c===t&&(e(c),this.unsubscribe(r))};return this.value===t?(e(this.value),null):(this.subscribe(o,r),setTimeout(()=>{s&&this.observers[r]&&e(this.value),this.unsubscribe(r)},a),r)}subscribeUntilHasValue(e,t=6e3,a=!0){const s=Math.random().toString(36).substring(2,15),r=o=>{o!=null&&(e(o),this.unsubscribe(s))};return this.value!==null&&this.value!==void 0?(e(this.value),null):(this.subscribe(r,s),t>0&&setTimeout(()=>{a&&this.observers[s]&&e(this.value),this.unsubscribe(s)},t),r)}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 ia{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 r=0;r<e;r++)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 r=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const o in s){r+="; "+o;const c=s[o];c!==!0&&(r+="="+c)}typeof document<"u"&&(document.cookie=r)}}class se{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 kr{constructor(e,t){u(this,"$searchTermChange",new j(""));u(this,"$searchLocationChange",new j(""));u(this,"$searchLocationCoordinatesDecoded",new j(""));u(this,"$searchLatChange",new j(""));u(this,"$searchLongChange",new j(""));u(this,"$searchRadiusChange",new j(void 0));u(this,"$loadingChange",new j(!1));u(this,"$locationError",new j(!1));u(this,"$searchResults",new j(null));u(this,"$searchResultsMetadata",new j(null));u(this,"$searchAutosuggest",new j(null));u(this,"$searchFacets",new j(null));u(this,"$searchFacetsCachedand",new j(null));u(this,"$searchFacetsCachedor",new j(null));u(this,"$searchFacetsCachedtabs",new j(null));u(this,"$searchstaxConfig",new j(null));u(this,"$autosuggestResults",new j(null));u(this,"$itemsPerPage",new j(void 0));u(this,"$searchObject",new j({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 j(null));u(this,"$searchInputConfig",new j(null));u(this,"$searchLocationConfig",new j(null));u(this,"$searchExternalPromotions",new j(null));u(this,"$facetsTemplateData",new j(null));u(this,"$selectedFacetsTemplateData",new j(null));u(this,"$paginationData",new j(null));u(this,"$answerData",new j(null));u(this,"$searchFeedbackData",new j(null));u(this,"$inputWidgetTemplateData",new j(null));u(this,"$locationWidgetTemplateData",new j(null));u(this,"$searchSortingData",new j(null));u(this,"$searchRelatedSearchesData",new j(null));u(this,"$searchExternalPromotionsData",new j(null));u(this,"$cookiesDisabled",new j(null));u(this,"$locationDecodingLoading",new j(!1));u(this,"$answer",new j(""));u(this,"$language",new j("en"));u(this,"$model",new j(""));u(this,"$answerLoading",new j(!1));u(this,"$locationEnabled",new j(null));u(this,"$answerError",new j(!1));u(this,"$answerErrorMessage",new j(""));u(this,"$isQuestion",new j(!1));u(this,"$inputTemplateRendered",new j(!1));u(this,"currentPageValue",1);u(this,"isAnswerWidgetCreatedValue",!1);u(this,"renderingEngineValue",z.mustache);u(this,"parsedData",new Cr(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,ia.deleteCookie(this.sessionId),ia.deleteCookie("ms_visitorid")):this.sessionIdValue=ia.getOrSetCookie(this.sessionId,e)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(se.removeXSSRiskyTags(e))}setSearchLocation(e){this.$searchLocationChange.setValue(se.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,(!ge.deepEqual(e,this.searchResults??[""])||this.facetsWereSet)&&(this.facetsWereSet=!1,this.$searchResults.setValue(e))}setSearchResultsMetadata(e){ge.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&&(!ge.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,ge.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){ge.deepEqual(e,this.searchFacetsCachedand??[])||this.$searchFacetsCachedand.setValue(e)}setSearchFacetsCachedor(e){ge.deepEqual(e,this.searchFacetsCachedor??[])||this.$searchFacetsCachedor.setValue(e)}setSearchFacetsCachedtabs(e){ge.deepEqual(e,this.searchFacetsCachedtabs??[])||this.$searchFacetsCachedtabs.setValue(e)}setSearchRelatedSearches(e){ge.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){ge.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(se.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 gt{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"");return e.response.docs.forEach((s,r)=>{var l;const o=s[e.responseHeader.params.uniqueId]??"",c={custom:null,uniqueId:o,position:a+1+r,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:((l=e.metadata.locationSearch)==null?void 0:l.unit)??"",unmappedFields:this.getUnmappedFields(s,e,o),allFields:this.getAllFields(s,e)};t.push(c)}),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 r=e.facet_counts.facet_fields[a.name];for(let o=0;o<r.length;o+=2){const c={};c.value=r[o],c.parentName=s.name,c.count=r[o+1],c.type="checkbox",s.values.push(c)}}s.values.length>0&&t.push(s)}return t}static extractSearchResultsMetadata(e){var r,o,c,l,d,p,g,m,C,x;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:((r=e.metadata.locationSearch.filter)==null?void 0:r.enabled)??!1,values:((o=e.metadata.locationSearch.filter)==null?void 0:o.values)??[],label:((c=e.metadata.locationSearch.filter)==null?void 0:c.label)??"",defaultValue:((l=e.metadata.locationSearch.filter)==null?void 0:l.defaultValue)??""}}),(d=e.metadata.results.find(b=>b.result_card==="date"))==null||d.name,a.options=[],(p=e.metadata.sorts)==null?void 0:p.length){const b=e.metadata.sorts.map(k=>({value:k.label,key:k.name+" "+k.order}));a.options=[{key:"",value:"Relevance"},...b]}return t=((x=(C=(m=(g=e==null?void 0:e.spellcheck)==null?void 0:g.suggestions)==null?void 0:m[1])==null?void 0:C.suggestion)==null?void 0:x[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 r=a[s],o={};o.cDocId=this.getDataForAnalytics(r.uniqueId),r.title&&(o.cDocTitle=this.getDataForAnalytics(r.titleTracking)),o.position=r.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),r=[];for(const o of s)if(Object.keys(e).includes(o)){const c=Array.isArray(e[o])?this.getHighlightedResults(o,e[o].join(", "),a,t):this.getHighlightedResults(o,e[o]+"",a,t);r.push({key:o,value:c,isImage:this.checkIfImage(e[o])})}return r}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(r=>r.name),s=[];for(const r of Object.keys(e))a.indexOf(r)!==-1&&s.push({key:r,value:e[r],isImage:this.checkIfImage(e[r])});return s}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a,s,r=!1){const o=a.metadata.results.find(l=>l.result_card===e);if(o===void 0)return null;const c=t[o.name];return c===void 0?null:typeof c=="string"?r?c:this.getHighlightedResults(o.name,c,s,a):typeof c=="number"?c:Array.isArray(c)?r?c.join(", "):this.getHighlightedResults(o.name,c.join(", "),s,a):null}static getHighlightedResults(e,t,a,s){if(s.highlighting&&a in s.highlighting){let r=s.highlighting[a];if(r&&e in r){let o=r[e];const c=this.cleanValue(o);if(c!=="")return c}}return t}static cleanValue(e){return e===null?"":typeof e=="string"?e:Array.isArray(e)?e.join(" "):""}}class bs{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 xr(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 r=e.location[s];r&&(t[this.routeName+`[location][${s}]`]=r)}if(e.facets)for(const s in e.facets){const r=e.facets[s].type+":"+encodeURIComponent(e.facets[s].name)+":"+encodeURIComponent(e.facets[s].value);t[this.routeName+`[facets][${s}]`]=r}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 r in s)r.startsWith(this.routeName)&&delete s[r];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,r;const t=[];for(const o in e)if(o.startsWith(this.routeName+"[facets]")){const c=se.removeXSSRiskyTags((a=e[o].split(":"))==null?void 0:a[0]),l=se.removeXSSRiskyTags(decodeURIComponent((s=e[o].split(":"))==null?void 0:s[1])),d=se.removeXSSRiskyTags(decodeURIComponent((r=e[o].split(":"))==null?void 0:r[2]));t.push({type:c,name:l,value:d})}return t}urlToSearchObject(e,t){const a=this.queryStringHelper.urlToParams(e),s=se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[page]"])),r=parseInt(s),o=isNaN(r)?1:r;let c=parseInt(se.removeXSSRiskyTags(a[this.routeName+"[itemsPerPage]"]));return{query:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[query]"]))||"",page:o,itemsPerPage:t??c,order:se.removeXSSRiskyTags(a[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(a)||[],model:se.removeXSSRiskyTags(a[this.routeName+"[model]"])||"",location:{address:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][address]"]||"")),radius:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][radius]"]||"")),lat:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lat]"]||"")),lon:se.removeXSSRiskyTags(decodeURIComponent(a[this.routeName+"[location][lon]"]||""))}}}}class xr{constructor(e){u(this,"routeName","");u(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(s=>{const r=a[s];return Array.isArray(r)?r.map(o=>`${s}=${o}`).join("&"):`${s}=${r}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],s={};return Object.keys(e).forEach(r=>{a.includes(r)||e[r]!==""&&(s[r]=e[r])}),s}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(s=>{const[r,o]=s.split("=");t[r]=o}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}const Ue={question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class oa 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 Cs=10,Mr=13,$e=32;function ca(n){}function Sr(n){if(typeof n=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:e=ca,onError:t=ca,onRetry:a=ca,onComment:s,maxBufferSize:r}=n,o=[];let c=0,l=!0,d,p="",g=0,m,C=!1;function x(y){if(C)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),o.length===0){const M=k(y);M!==""&&(o.push(M),c=M.length),b();return}if(y.indexOf(`
|
|
59
|
+
`)===-1&&y.indexOf("\r")===-1){o.push(y),c+=y.length,b();return}o.push(y);const L=o.join("");o.length=0,c=0;const D=k(L);D!==""&&(o.push(D),c=D.length),b()}function b(){r!==void 0&&(c+p.length<=r||(C=!0,o.length=0,c=0,d=void 0,p="",g=0,m=void 0,t(new oa(`Buffered data exceeded max buffer size of ${r} characters`,{type:"max-buffer-size-exceeded"}))))}function k(y){let L=0;if(y.indexOf("\r")===-1){let D=y.indexOf(`
|
|
60
|
+
`,L);for(;D!==-1;){if(L===D){g>0&&e({id:d,event:m,data:p}),d=void 0,p="",g=0,m=void 0,L=D+1,D=y.indexOf(`
|
|
61
|
+
`,L);continue}const M=y.charCodeAt(L);if(ks(y,L,M)){const v=y.charCodeAt(L+5)===$e?L+6:L+5,H=y.slice(v,D);if(g===0&&y.charCodeAt(D+1)===Cs){e({id:d,event:m,data:H}),d=void 0,p="",m=void 0,L=D+2,D=y.indexOf(`
|
|
62
|
+
`,L);continue}p=g===0?H:`${p}
|
|
63
|
+
${H}`,g++}else xs(y,L,M)?m=y.slice(y.charCodeAt(L+6)===$e?L+7:L+6,D)||void 0:A(y,L,D);L=D+1,D=y.indexOf(`
|
|
64
|
+
`,L)}return y.slice(L)}for(;L<y.length;){const D=y.indexOf("\r",L),M=y.indexOf(`
|
|
65
|
+
`,L);let v=-1;if(D!==-1&&M!==-1?v=D<M?D:M:D!==-1?D===y.length-1?v=-1:v=D:M!==-1&&(v=M),v===-1)break;A(y,L,v),L=v+1,y.charCodeAt(L-1)===Mr&&y.charCodeAt(L)===Cs&&L++}return y.slice(L)}function A(y,L,D){if(L===D){R();return}const M=y.charCodeAt(L);if(ks(y,L,M)){const Le=y.charCodeAt(L+5)===$e?L+6:L+5,et=y.slice(Le,D);p=g===0?et:`${p}
|
|
66
|
+
${et}`,g++;return}if(xs(y,L,M)){m=y.slice(y.charCodeAt(L+6)===$e?L+7:L+6,D)||void 0;return}if(M===105&&y.charCodeAt(L+1)===100&&y.charCodeAt(L+2)===58){const Le=y.slice(y.charCodeAt(L+3)===$e?L+4:L+3,D);d=Le.includes("\0")?void 0:Le;return}if(M===58){if(s){const Le=y.slice(L,D);s(Le.slice(y.charCodeAt(L+1)===$e?2:1))}return}const v=y.slice(L,D),H=v.indexOf(":");if(H===-1){N(v,"",v);return}const ne=v.slice(0,H),ye=v.charCodeAt(H+1)===$e?2:1,Ca=v.slice(H+ye);N(ne,Ca,v)}function N(y,L,D){switch(y){case"event":m=L||void 0;break;case"data":p=g===0?L:`${p}
|
|
67
|
+
${L}`,g++;break;case"id":d=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.test(L)?a(parseInt(L,10)):t(new oa(`Invalid \`retry\` value: "${L}"`,{type:"invalid-retry",value:L,line:D}));break;default:t(new oa(`Unknown field "${y.length>20?`${y.slice(0,20)}…`:y}"`,{type:"unknown-field",field:y,value:L,line:D}));break}}function R(){g>0&&e({id:d,event:m,data:p}),d=void 0,p="",g=0,m=void 0}function I(y={}){if(y.consume&&o.length>0){const L=o.join("");A(L,0,L.length)}l=!0,d=void 0,p="",g=0,m=void 0,o.length=0,c=0,C=!1}return{feed:x,reset:I}}function ks(n,e,t){return t===100&&n.charCodeAt(e+1)===97&&n.charCodeAt(e+2)===116&&n.charCodeAt(e+3)===97&&n.charCodeAt(e+4)===58}function xs(n,e,t){return t===101&&n.charCodeAt(e+1)===118&&n.charCodeAt(e+2)===101&&n.charCodeAt(e+3)===110&&n.charCodeAt(e+4)===116&&n.charCodeAt(e+5)===58}class Ms 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(Ss(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(Ss(this),t)}}function Tr(n){const e=globalThis.DOMException;return typeof e=="function"?new e(n,"SyntaxError"):new SyntaxError(n)}function la(n){return n instanceof Error?"errors"in n&&Array.isArray(n.errors)?n.errors.map(la).join(", "):"cause"in n&&n.cause instanceof Error?`${n}: ${la(n.cause)}`:n.message:`${n}`}function Ss(n){return{type:n.type,message:n.message,code:n.code,defaultPrevented:n.defaultPrevented,cancelable:n.cancelable,timeStamp:n.timeStamp}}var Ts=n=>{throw TypeError(n)},ha=(n,e,t)=>e.has(n)||Ts("Cannot "+t),O=(n,e,t)=>(ha(n,e,"read from private field"),t?t.call(n):e.get(n)),X=(n,e,t)=>e.has(n)?Ts("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Q=(n,e,t,a)=>(ha(n,e,"write to private field"),e.set(n,t),t),Te=(n,e,t)=>(ha(n,e,"access private method"),t),ue,Be,Ye,Nt,Rt,mt,_e,ft,Ie,Je,Ge,Ke,yt,fe,da,ua,pa,Es,ga,ma,Lt,fa,ya;class Ot extends EventTarget{constructor(e,t){var a,s;super(),X(this,fe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,X(this,ue),X(this,Be),X(this,Ye),X(this,Nt),X(this,Rt),X(this,mt),X(this,_e),X(this,ft,null),X(this,Ie),X(this,Je),X(this,Ge,null),X(this,Ke,null),X(this,yt,null),X(this,ua,async r=>{var o;O(this,Je).reset();const{body:c,redirected:l,status:d,headers:p}=r;if(d===204){Te(this,fe,Lt).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?Q(this,Ye,new URL(r.url)):Q(this,Ye,void 0),d!==200){Te(this,fe,Lt).call(this,`Non-200 status code (${d})`,d);return}if(!(p.get("content-type")||"").startsWith("text/event-stream")){Te(this,fe,Lt).call(this,'Invalid content type, expected "text/event-stream"',d);return}if(O(this,ue)===this.CLOSED)return;Q(this,ue,this.OPEN);const g=new Event("open");if((o=O(this,yt))==null||o.call(this,g),this.dispatchEvent(g),typeof c!="object"||!c||!("getReader"in c)){Te(this,fe,Lt).call(this,"Invalid response body, expected a web ReadableStream",d),this.close();return}const m=new TextDecoder,C=c.getReader();let x=!0;do{const{done:b,value:k}=await C.read();k&&O(this,Je).feed(m.decode(k,{stream:!b})),b&&(x=!1,O(this,Je).reset(),Te(this,fe,fa).call(this))}while(x)}),X(this,pa,r=>{Q(this,Ie,void 0),!(r.name==="AbortError"||r.type==="aborted")&&Te(this,fe,fa).call(this,la(r))}),X(this,ga,r=>{typeof r.id=="string"&&Q(this,ft,r.id);const o=new MessageEvent(r.event||"message",{data:r.data,origin:O(this,Ye)?O(this,Ye).origin:O(this,Be).origin,lastEventId:r.id||""});O(this,Ke)&&(!r.event||r.event==="message")&&O(this,Ke).call(this,o),this.dispatchEvent(o)}),X(this,ma,r=>{Q(this,mt,r)}),X(this,ya,()=>{Q(this,_e,void 0),O(this,ue)===this.CONNECTING&&Te(this,fe,da).call(this)});try{if(e instanceof URL)Q(this,Be,e);else if(typeof e=="string")Q(this,Be,new URL(e,Er()));else throw new Error("Invalid URL")}catch{throw Tr("An invalid or illegal string was specified")}Q(this,Je,Sr({onEvent:O(this,ga),onRetry:O(this,ma)})),Q(this,ue,this.CONNECTING),Q(this,mt,3e3),Q(this,Rt,(a=t==null?void 0:t.fetch)!=null?a:globalThis.fetch),Q(this,Nt,(s=t==null?void 0:t.withCredentials)!=null?s:!1),Te(this,fe,da).call(this)}get readyState(){return O(this,ue)}get url(){return O(this,Be).href}get withCredentials(){return O(this,Nt)}get onerror(){return O(this,Ge)}set onerror(e){Q(this,Ge,e)}get onmessage(){return O(this,Ke)}set onmessage(e){Q(this,Ke,e)}get onopen(){return O(this,yt)}set onopen(e){Q(this,yt,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(){O(this,_e)&&clearTimeout(O(this,_e)),O(this,ue)!==this.CLOSED&&(O(this,Ie)&&O(this,Ie).abort(),Q(this,ue,this.CLOSED),Q(this,Ie,void 0))}}ue=new WeakMap,Be=new WeakMap,Ye=new WeakMap,Nt=new WeakMap,Rt=new WeakMap,mt=new WeakMap,_e=new WeakMap,ft=new WeakMap,Ie=new WeakMap,Je=new WeakMap,Ge=new WeakMap,Ke=new WeakMap,yt=new WeakMap,fe=new WeakSet,da=function(){Q(this,ue,this.CONNECTING),Q(this,Ie,new AbortController),O(this,Rt)(O(this,Be),Te(this,fe,Es).call(this)).then(O(this,ua)).catch(O(this,pa))},ua=new WeakMap,pa=new WeakMap,Es=function(){var n;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...O(this,ft)?{"Last-Event-ID":O(this,ft)}:void 0},cache:"no-store",signal:(n=O(this,Ie))==null?void 0:n.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},ga=new WeakMap,ma=new WeakMap,Lt=function(n,e){var t;O(this,ue)!==this.CLOSED&&Q(this,ue,this.CLOSED);const a=new Ms("error",{code:e,message:n});(t=O(this,Ge))==null||t.call(this,a),this.dispatchEvent(a)},fa=function(n,e){var t;if(O(this,ue)===this.CLOSED)return;Q(this,ue,this.CONNECTING);const a=new Ms("error",{code:e,message:n});(t=O(this,Ge))==null||t.call(this,a),this.dispatchEvent(a),Q(this,_e,setTimeout(O(this,ya),O(this,mt)))},ya=new WeakMap,Ot.CONNECTING=0,Ot.OPEN=1,Ot.CLOSED=2;function Er(){const n="document"in globalThis?globalThis.document:void 0;return n&&typeof n=="object"&&"baseURI"in n&&typeof n.baseURI=="string"?n.baseURI:void 0}class me{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 r=["trackClick",t];t.key?this.msq().push(r,(function(o,c){JSON.stringify(o)===JSON.stringify(t)&&c?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 r=["answerSourceClick",t];t.key?this.msq().push(r,(function(o,c){JSON.stringify(o)===JSON.stringify(t)&&c?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+"",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(me,"subscribedToClickEvent",!1),u(me,"msq",()=>typeof window<"u"&&(window!=null&&window._msq)?window==null?void 0:window._msq:[]);class Dr{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(s){const r=s.name+':"'+s.value+'"';a=a.concat("fq="+decodeURIComponent(r).replace(" "," "))});else{const s={};e.forEach(function(o){const c=o.name+":"+o.value,l=decodeURIComponent(c).replace(" "," ").split(":");s[l[0]]?s[l[0]].push(l[1]):s[l[0]]=[l[1]]});let r="";for(const o in s)if(Object.prototype.hasOwnProperty.call(s,o)){const c=s[o],l=o;for(const d of c)r+=r===""?` ${l}:"${d}"`:` OR ${l}:"${d}"`}a=a.concat("fq="+r.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 r=new Headers;r.append("Accept","application/json"),r.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:r,credentials:"same-origin"}).then(o=>o.json()).then(o=>{s(o)})}cacheFacets(e,t){return new Promise(a=>{var s,r;if(this.resolveFn=a,e==="or"||e==="showUnavailable"){const o=this.dataLayer.searchObject.facets.filter(c=>c.type==="tabs"||c.type==="and");if(this.cachedQueryOR===this.dataLayer.searchObject.query&&((s=this.dataLayer.searchObject.facets)==null?void 0:s.length)>0&&o.length===0){this.resolveFn();return}else this.cachedORFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(c=>c.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&&((r=this.dataLayer.searchObject.facets)==null?void 0:r.length)>0){this.resolveFn();return}else this.cachedTabsFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.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(o=>o.type==="and")),this.cachedORFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.type==="or"||o.type==="showUnavailable")),this.cachedTabsFacets=JSON.stringify(this.dataLayer.searchObject.facets.filter(o=>o.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(o=>o.type==="and"||o.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=gt.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,s=!1,r){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),c={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete c.signal,fetch(o,c).then(l=>l.json()).then(l=>{this.dataLayer.setLoading(!1),t(l,r)}).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 r=e.itemsPerPage!==void 0?`&rows=${e.itemsPerPage}`:"",o=new Proxy(new URLSearchParams((window==null?void 0:window.location.search)??""),{get:(d,p)=>d.get(p)??""}),c=o.languageVariant?"&fq=_language:"+o.languageVariant:"",l=e.model??this.dataLayer.model;return"?q="+encodeURIComponent(e.query.trim())+"&start="+a+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(d=>d.type==="or"||d.type==="showUnavailable"),!0)+this.generateLocationQuery(e.location)+this.generateFacetQuery(e.facets.filter(d=>d.type==="and"||d.type==="tabs"),!1)+s+r+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!t}`+(l?`&model=${l}`:"")+"&language="+this.dataLayer.language+c}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 s=new Ot(this.dataLayer.questionURL+this.generateQueryParams(this.dataLayer.searchObject),{fetch:(r,o)=>fetch(r,{...o,headers:{...o==null?void 0:o.headers,Authorization:this._authToken}})});return s.onmessage=r=>{if(r.data===Ue.question||r.data===Ue.notQuestion){r.data===Ue.question?(this.dataLayer.setAnswerLoading(!0),this.dataLayer.setIsQuestion(!0)):(a.setAnswerLoading(!1),this.dataLayer.setIsQuestion(!1)),a.setAnswerData("");return}if(r.data===Ue.close){me.trackAnswerData({...a.parsedData.trackingData,answer:a.$answer.getValue(),isQuestion:this.dataLayer.isQuestion,hasShowMore:this.dataLayer.parsedData.shouldShowAnswerLoadMore}),a.setAnswerLoading(!1),s.close();return}if(r.data.indexOf("[!CAUTION]")!==-1){a.setAnswerError(!0),a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),s.close();return}if(r.data.indexOf("[comment]: <> ({")!==-1)try{const o=r.data.split("[comment]: <> ({");if(o.length<2){t(r.data);return}const c=o[1].split("})");if(c.length<2){t(r.data);return}const l=c[0],d=JSON.parse("{"+l+"}");this.dataLayer.answerWidgetShowMoreLimit=d.displayShowMoreAfter,d.showMoreEnabled||(this.dataLayer.answerWidgetShowMoreLimit=1e17);const p=c.slice(1).join("})");t(p)}catch{t(r.data)}else t(r.data)},s.addEventListener("error",r=>{(r.code===401||r.code===500)&&(a.setAnswerErrorMessage("We're having trouble generating an answer. Please try again."),a.setAnswerError(!0))}),s.onerror=()=>{a.setAnswerLoading(!1),s.close()},s}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(r=>r.json()).then(r=>{t(r)}).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 Ar=Object.prototype.toString,Ze=Array.isArray||function(n){return Ar.call(n)==="[object Array]"};function La(n){return typeof n=="function"}function Ir(n){return Ze(n)?"array":typeof n}function wa(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ds(n,e){return n!=null&&typeof n=="object"&&e in n}function vr(n,e){return n!=null&&typeof n!="object"&&n.hasOwnProperty&&n.hasOwnProperty(e)}var jr=RegExp.prototype.test;function Nr(n,e){return jr.call(n,e)}var Rr=/\S/;function Or(n){return!Nr(Rr,n)}var Pr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Fr(n){return String(n).replace(/[&<>"'`=\/]/g,function(e){return Pr[e]})}var $r=/\s*/,Br=/\s+/,As=/\s*=/,Vr=/\s*\}/,zr=/#|\^|\/|>|\{|&|=|!/;function qr(n,e){if(!n)return[];var t=!1,a=[],s=[],r=[],o=!1,c=!1,l="",d=0;function p(){if(o&&!c)for(;r.length;)delete s[r.pop()];else r=[];o=!1,c=!1}var g,m,C;function x(M){if(typeof M=="string"&&(M=M.split(Br,2)),!Ze(M)||M.length!==2)throw new Error("Invalid tags: "+M);g=new RegExp(wa(M[0])+"\\s*"),m=new RegExp("\\s*"+wa(M[1])),C=new RegExp("\\s*"+wa("}"+M[1]))}x(e||$.tags);for(var b=new wt(n),k,A,N,R,I,y;!b.eos();){if(k=b.pos,N=b.scanUntil(g),N)for(var L=0,D=N.length;L<D;++L)R=N.charAt(L),Or(R)?(r.push(s.length),l+=R):(c=!0,t=!0,l+=" "),s.push(["text",R,k,k+1]),k+=1,R===`
|
|
68
|
+
`&&(p(),l="",d=0,t=!1);if(!b.scan(g))break;if(o=!0,A=b.scan(zr)||"name",b.scan($r),A==="="?(N=b.scanUntil(As),b.scan(As),b.scanUntil(m)):A==="{"?(N=b.scanUntil(C),b.scan(Vr),b.scanUntil(m),A="&"):N=b.scanUntil(m),!b.scan(m))throw new Error("Unclosed tag at "+b.pos);if(A==">"?I=[A,N,k,b.pos,l,d,t]:I=[A,N,k,b.pos],d++,s.push(I),A==="#"||A==="^")a.push(I);else if(A==="/"){if(y=a.pop(),!y)throw new Error('Unopened section "'+N+'" at '+k);if(y[1]!==N)throw new Error('Unclosed section "'+y[1]+'" at '+k)}else A==="name"||A==="{"||A==="&"?c=!0:A==="="&&x(N)}if(p(),y=a.pop(),y)throw new Error('Unclosed section "'+y[1]+'" at '+b.pos);return Qr(Wr(s))}function Wr(n){for(var e=[],t,a,s=0,r=n.length;s<r;++s)t=n[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 Qr(n){for(var e=[],t=e,a=[],s,r,o=0,c=n.length;o<c;++o)switch(s=n[o],s[0]){case"#":case"^":t.push(s),a.push(s),t=s[4]=[];break;case"/":r=a.pop(),r[5]=s[2],t=a.length>0?a[a.length-1][4]:e;break;default:t.push(s)}return e}function wt(n){this.string=n,this.tail=n,this.pos=0}wt.prototype.eos=function(){return this.tail===""},wt.prototype.scan=function(n){var e=this.tail.match(n);if(!e||e.index!==0)return"";var t=e[0];return this.tail=this.tail.substring(t.length),this.pos+=t.length,t},wt.prototype.scanUntil=function(n){var e=this.tail.search(n),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 Xe(n,e){this.view=n,this.cache={".":this.view},this.parent=e}Xe.prototype.push=function(n){return new Xe(n,this)},Xe.prototype.lookup=function(n){var e=this.cache,t;if(e.hasOwnProperty(n))t=e[n];else{for(var a=this,s,r,o,c=!1;a;){if(n.indexOf(".")>0)for(s=a.view,r=n.split("."),o=0;s!=null&&o<r.length;)o===r.length-1&&(c=Ds(s,r[o])||vr(s,r[o])),s=s[r[o++]];else s=a.view[n],c=Ds(a.view,n);if(c){t=s;break}a=a.parent}e[n]=t}return La(t)&&(t=t.call(this.view)),t};function he(){this.templateCache={_cache:{},set:function(n,e){this._cache[n]=e},get:function(n){return this._cache[n]},clear:function(){this._cache={}}}}he.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()},he.prototype.parse=function(n,e){var t=this.templateCache,a=n+":"+(e||$.tags).join(":"),s=typeof t<"u",r=s?t.get(a):void 0;return r==null&&(r=qr(n,e),s&&t.set(a,r)),r},he.prototype.render=function(n,e,t,a){var s=this.getConfigTags(a),r=this.parse(n,s),o=e instanceof Xe?e:new Xe(e,void 0);return this.renderTokens(r,o,t,n,a)},he.prototype.renderTokens=function(n,e,t,a,s){for(var r="",o,c,l,d=0,p=n.length;d<p;++d)l=void 0,o=n[d],c=o[0],c==="#"?l=this.renderSection(o,e,t,a,s):c==="^"?l=this.renderInverted(o,e,t,a,s):c===">"?l=this.renderPartial(o,e,t,s):c==="&"?l=this.unescapedValue(o,e):c==="name"?l=this.escapedValue(o,e,s):c==="text"&&(l=this.rawValue(o)),l!==void 0&&(r+=l);return r},he.prototype.renderSection=function(n,e,t,a,s){var r=this,o="",c=e.lookup(n[1]);function l(g){return r.render(g,e,t,s)}if(c){if(Ze(c))for(var d=0,p=c.length;d<p;++d)o+=this.renderTokens(n[4],e.push(c[d]),t,a,s);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")o+=this.renderTokens(n[4],e.push(c),t,a,s);else if(La(c)){if(typeof a!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(e.view,a.slice(n[3],n[5]),l),c!=null&&(o+=c)}else o+=this.renderTokens(n[4],e,t,a,s);return o}},he.prototype.renderInverted=function(n,e,t,a,s){var r=e.lookup(n[1]);if(!r||Ze(r)&&r.length===0)return this.renderTokens(n[4],e,t,a,s)},he.prototype.indentPartial=function(n,e,t){for(var a=e.replace(/[^ \t]/g,""),s=n.split(`
|
|
69
|
+
`),r=0;r<s.length;r++)s[r].length&&(r>0||!t)&&(s[r]=a+s[r]);return s.join(`
|
|
70
|
+
`)},he.prototype.renderPartial=function(n,e,t,a){if(t){var s=this.getConfigTags(a),r=La(t)?t(n[1]):t[n[1]];if(r!=null){var o=n[6],c=n[5],l=n[4],d=r;c==0&&l&&(d=this.indentPartial(r,l,o));var p=this.parse(d,s);return this.renderTokens(p,e,t,d,a)}}},he.prototype.unescapedValue=function(n,e){var t=e.lookup(n[1]);if(t!=null)return t},he.prototype.escapedValue=function(n,e,t){var a=this.getConfigEscape(t)||$.escape,s=e.lookup(n[1]);if(s!=null)return typeof s=="number"&&a===$.escape?String(s):a(s)},he.prototype.rawValue=function(n){return n[1]},he.prototype.getConfigTags=function(n){return Ze(n)?n:n&&typeof n=="object"?n.tags:void 0},he.prototype.getConfigEscape=function(n){if(n&&typeof n=="object"&&!Ze(n))return n.escape};var $={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(n){bt.templateCache=n},get templateCache(){return bt.templateCache}},bt=new he;$.clearCache=function(){return bt.clearCache()},$.parse=function(n,e){return bt.parse(n,e)},$.render=function(n,e,t,a){if(typeof n!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Ir(n)+'" was given as the first argument for mustache#render(template, view, partials)');return bt.render(n,e,t,a)},$.escape=Fr,$.Scanner=wt,$.Context=Xe,$.Writer=he;const Hr={main:{template:`
|
|
70
71
|
{{#shouldShowAnswer}}
|
|
71
72
|
<div class="searchstax-answer-wrap">
|
|
72
73
|
<div class="searchstax-answer-icon"></div>
|
|
@@ -103,7 +104,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
103
104
|
</div>
|
|
104
105
|
</div>
|
|
105
106
|
{{/shouldShowAnswer}}
|
|
106
|
-
`}},
|
|
107
|
+
`}},Ur={mainTemplate:{template:`
|
|
107
108
|
{{#hasExternalPromotions}}
|
|
108
109
|
<div class="searchstax-external-promotions-container" id="searchstax-external-promotions-container" data-test-id="searchstax-external-promotions-container">
|
|
109
110
|
External promotions go here
|
|
@@ -129,7 +130,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
129
130
|
</p>
|
|
130
131
|
{{/url}}
|
|
131
132
|
</div>
|
|
132
|
-
`}},
|
|
133
|
+
`}},Yr={mainTemplateDesktop:{template:`
|
|
133
134
|
{{#hasResultsOrExternalPromotions}}
|
|
134
135
|
<div class="searchstax-facets-container-desktop"></div>
|
|
135
136
|
{{/hasResultsOrExternalPromotions}}
|
|
@@ -187,7 +188,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
187
188
|
<div class="searchstax-facets-pill-label">{{value}} ({{count}})</div>
|
|
188
189
|
<div class="searchstax-facets-pill-icon-close"></div>
|
|
189
190
|
</div>
|
|
190
|
-
`,containerClass:"searchstax-facets-pill-facets"}},
|
|
191
|
+
`,containerClass:"searchstax-facets-pill-facets"}},_r={mainTemplate:{template:`
|
|
191
192
|
{{#results.length}}
|
|
192
193
|
<div class="searchstax-pagination-container" data-test-id="searchstax-pagination-container">
|
|
193
194
|
<div class="searchstax-pagination-content">
|
|
@@ -205,7 +206,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
205
206
|
<a class="searchstax-pagination-load-more" data-test-id="searchstax-pagination-load-more" tabindex="0">Show More</a>
|
|
206
207
|
{{/isLastPage}}
|
|
207
208
|
{{/results.length}}
|
|
208
|
-
`,loadMoreButtonClass:"searchstax-pagination-load-more"}},
|
|
209
|
+
`,loadMoreButtonClass:"searchstax-pagination-load-more"}},Jr={main:{template:`
|
|
209
210
|
{{#hasRelatedSearches}}
|
|
210
211
|
<div class="searchstax-related-searches-container" data-test-id="searchstax-related-searches-container" id="searchstax-related-searches-container">
|
|
211
212
|
Related searches: <span id="searchstax-related-searches"></span>
|
|
@@ -220,7 +221,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
220
221
|
<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">
|
|
221
222
|
{{ related_search }}{{^last}}<span>,</span>{{/last}}
|
|
222
223
|
</span>
|
|
223
|
-
`,relatedSearchContainerClass:"searchstax-related-search-item"}},
|
|
224
|
+
`,relatedSearchContainerClass:"searchstax-related-search-item"}},Gr={main:{template:`
|
|
224
225
|
{{#searchExecuted}}
|
|
225
226
|
<a href="#searchstax-search-results" data-test-id="searchstax-skip" class="searchstax-skip">Skip to results section</a>
|
|
226
227
|
<h4 class="searchstax-feedback-container" data-test-id="searchstax-feedback-container">
|
|
@@ -234,17 +235,19 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
234
235
|
{{/hasResults}}
|
|
235
236
|
</h4>
|
|
236
237
|
{{/searchExecuted}}
|
|
237
|
-
`,originalQueryClass:"searchstax-feedback-original-query"}},
|
|
238
|
+
`,originalQueryClass:"searchstax-feedback-original-query"}},Kr={mainTemplate:{template:`
|
|
238
239
|
<div class="searchstax-search-input-container searchstax-search-input-container-new {{#locationEnabled}}searchstax-alternative-render{{/locationEnabled}}">
|
|
239
240
|
<div class="searchstax-search-input-wrapper">
|
|
240
241
|
<input type="text" id="searchstax-search-input" class="searchstax-search-input" placeholder="SEARCH FOR..." aria-label="Search" />
|
|
242
|
+
<button id="searchstax-clear-input-action-button" class="searchstax-cross-icon hidden" aria-label="clear input" role="button"></button>
|
|
243
|
+
<span id="searchstax-separator-icon" class="searchstax-separator hidden"></span>
|
|
241
244
|
</div>
|
|
242
245
|
<div id="searchstax-location-container" class="searchstax-location-container"></div>
|
|
243
246
|
<button class="searchstax-spinner-icon" id="searchstax-search-input-action-button" aria-label="search" role="button"></button>
|
|
244
247
|
</div>
|
|
245
248
|
`,searchInputId:"searchstax-search-input"},autosuggestItemTemplate:{template:`
|
|
246
249
|
<div class="searchstax-autosuggest-item-term-container">{{{term}}}</div>
|
|
247
|
-
`}},
|
|
250
|
+
`}},Zr={mainTemplate:{template:`
|
|
248
251
|
<div class="searchstax-location-input-container" data-test-id="searchstax-location-input-container">
|
|
249
252
|
<div class="searchstax-location-input-wrapper">
|
|
250
253
|
<span class="searchstax-location-input-label">NEAR</span>
|
|
@@ -262,7 +265,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
262
265
|
{{/shouldShowLocationDistanceDropdown}}
|
|
263
266
|
</div>
|
|
264
267
|
</div>
|
|
265
|
-
`,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},
|
|
268
|
+
`,locationInputId:"searchstax-location-input",radiusInputId:"searchstax-location-radius-select",currentLocationActionButtonId:"searchstax-location-get-current-location"}},Xr={mainTemplate:{template:`
|
|
266
269
|
<section aria-label="search results container" tabindex="0">
|
|
267
270
|
<div class="searchstax-search-results-container" id="searchstax-search-results-container" data-test-id="searchstax-search-results-container">
|
|
268
271
|
<div class="searchstax-search-results" id="searchstax-search-results"></div>
|
|
@@ -334,7 +337,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
334
337
|
</ul>
|
|
335
338
|
</div>
|
|
336
339
|
{{/searchExecuted}}
|
|
337
|
-
`}},
|
|
340
|
+
`}},ei={main:{template:`
|
|
338
341
|
{{#searchExecuted}}
|
|
339
342
|
{{#hasResultsOrExternalPromotions}}
|
|
340
343
|
{{#sortOptions.length}}
|
|
@@ -351,7 +354,7 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
351
354
|
{{/sortOptions.length}}
|
|
352
355
|
{{/hasResultsOrExternalPromotions}}
|
|
353
356
|
{{/searchExecuted}}
|
|
354
|
-
`,selectId:"searchstax-search-order-select"}},
|
|
357
|
+
`,selectId:"searchstax-search-order-select"}},Z={mainTemplate:{template:`
|
|
355
358
|
<div class="sf-widget-container">
|
|
356
359
|
<div id="sf-widget" class="sf-main">
|
|
357
360
|
<a role="button" href="#" id="searchstax-open-feedback" class="sf-open-feedback" tabindex="0" aria-label="Open Search Feedback">[ - ] Search Feedback</a>
|
|
@@ -434,4 +437,4 @@ ${L}`,h++;break;case"id":c=L.includes("\0")?void 0:L;break;case"retry":/^\d+$/.t
|
|
|
434
437
|
|
|
435
438
|
</div>
|
|
436
439
|
</div>
|
|
437
|
-
`,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class D{}d(D,"answer",kn),d(D,"externalPromotions",xn),d(D,"facets",Mn),d(D,"pagination",Sn),d(D,"relatedSearches",Tn),d(D,"searchFeedback",En),d(D,"searchInput",Dn),d(D,"location",An),d(D,"searchResults",In),d(D,"sorting",vn),d(D,"feedback",Y);class jn{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"externalPromotionsContainerId");d(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)||D.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 c=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.externalPromotion)==null?void 0:n.template)||((o=D.externalPromotions.externalPromotion)==null?void 0:o.template);if(typeof document<"u"){const l=document==null?void 0:document.createElement("div");l.classList.add("searchstax-external-promotion"),l.addEventListener("click",h=>{this.trackClick(e,h)}),l.innerHTML=R.render(c,e),t.appendChild(l)}}}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=D.externalPromotions.mainTemplate)==null?void 0:o.template);if(this.dataLayer.renderingEngine===$.mustache){this.searchExternalPromotionsMainContainer.innerHTML=R.render(t,e);const c=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;c&&(c.innerHTML="");for(const l of e.externalPromotions)this.addExternalSearch(l)}}}class G{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 c=document.getElementById("searchAccessibilityContainer");c&&setTimeout(()=>{c.appendChild(o)},t??100)}}class Nn{constructor(e,t){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"routerHelper");d(this,"cachedPhrase","");d(this,"cachedANDFacets","");d(this,"isCached",!1);d(this,"overlayOpened",!1);d(this,"facetPaginationStep");d(this,"facetPaginationStepMobile");d(this,"searchFacetsMainContainer",null);d(this,"searchFacetsMobileContainer",null);d(this,"searchFacetsDesktopContainer",null);d(this,"facetLimits",{});d(this,"facetLimitsMobile",{});d(this,"deactivatedFacets",{});d(this,"focusedElement",null);d(this,"cachedData",null);d(this,"cacheFacets");d(this,"onFacetSelect",(e,t,a,s,n)=>{if(e.stopPropagation(),!t.disabled){const o=a.querySelector("input");let c=s?o.checked:!o.checked;n!==void 0&&(c=!n),o.checked=c;const l=this.dataLayer.searchObject;let h=[...l.facets];const u=this.extractFacetValue(t);c?h.find(m=>pe.deepEqual(m,u)?m:!1)||(this.config.facetingType==="tabs"&&(h=h.filter(m=>m.name!==u.name)),h.push(u)):h=h.filter(m=>!pe.deepEqual(m,u)),setTimeout(()=>{this.dataLayer.setSearchObject({...l,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)),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 c;const o=(c=this.dataLayer.searchFacets)==null?void 0:c.find(l=>l.name===n.name);return o?{...n,values:n.values.map(l=>{const h=o.values.find(u=>l.type==="range"?!1:l.type==="checkbox"?u.value===l.value:!1);return{...l,disabled:!h,isMobile:e}})}:{...n,values:n.values.map(l=>({...l,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,c,l,h,u,m,g,y,w,b,C,f,L,T;if(typeof document<"u"){const S=document==null?void 0:document.createElement("div");S.classList.add("searchstax-facet-container"),this.deactivatedFacets[e.name]||S.classList.add("active");const A=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemContainerTemplate)==null?void 0:o.template)||((c=D.facets.facetItemContainerTemplate)==null?void 0:c.template);S.innerHTML=R.render(A,e),t.appendChild(S);const j=S.querySelector("."+(((u=(h=(l=this.config)==null?void 0:l.templates)==null?void 0:h.facetItemContainerTemplate)==null?void 0:u.facetListTitleContainerClass)||((m=D.facets.facetItemContainerTemplate)==null?void 0:m.facetListTitleContainerClass)));j==null||j.addEventListener("click",()=>{S.classList.toggle("active");const E=S.classList.contains("active"),z=j.querySelector(".searchstax-facet-title");z&&z.setAttribute("aria-expanded",String(E))}),(b=j==null?void 0:j.querySelector("."+((w=(y=(g=this.config)==null?void 0:g.templates)==null?void 0:y.facetItemContainerTemplate)==null?void 0:w.facetListTitleContainerInner)))==null||b.addEventListener("keydown",E=>{if(E.code==="Enter"||E.code==="Space"){E.preventDefault(),S.classList.toggle("active");const z=S.classList.contains("active"),_=j.querySelector(".searchstax-facet-title");_&&_.setAttribute("aria-expanded",String(z))}});const V=S.querySelector("."+(((L=(f=(C=this.config)==null?void 0:C.templates)==null?void 0:f.facetItemContainerTemplate)==null?void 0:L.facetListContainerClass)||((T=D.facets.facetItemContainerTemplate)==null?void 0:T.facetListContainerClass)));V&&(e.values.forEach(E=>{this.createFacetListItem(E,V,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,V,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>pe.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var s,n,o,c,l,h,u,m,g,y,w,b;if(typeof document<"u"){const C=document==null?void 0:document.createElement("div");C.classList.add("searchstax-facet-value-container"),e.disabled&&C.classList.add("searchstax-facet-value-disabled");const f=this.isChecked(e),L=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.facetItemTemplate)==null?void 0:o.template)||((c=D.facets.facetItemTemplate)==null?void 0:c.template);C.innerHTML=R.render(L,{...e,isChecked:f});let T=(l=D.facets.facetItemTemplate)==null?void 0:l.checkTriggerClasses;T=((m=(u=(h=this.config)==null?void 0:h.templates)==null?void 0:u.facetItemTemplate)==null?void 0:m.checkTriggerClasses)||T,T.forEach(A=>{var j;(j=C.querySelector("."+A))==null||j.addEventListener("click",V=>{this.onFacetSelect(V,e,C)})});const S=C.querySelector("."+(((w=(y=(g=this.config)==null?void 0:g.templates)==null?void 0:y.facetItemTemplate)==null?void 0:w.inputCheckboxClass)||((b=D.facets.facetItemTemplate)==null?void 0:b.inputCheckboxClass)));S==null||S.addEventListener("click",A=>{this.onFacetSelect(A,e,C,!0)}),S&&(S==null||S.setAttribute("data-test-value",`${encodeURIComponent(a)}:"${encodeURIComponent(e.value)}"`)),t.appendChild(C)}}createHasMoreComponent(e,t,a){var s,n,o,c,l,h,u,m,g,y;if(typeof document<"u"){const w=document==null?void 0:document.createElement("div");w.classList.add("searchstax-facet-show-more-container");const b=((o=(n=(s=this.config)==null?void 0:s.templates)==null?void 0:n.showMoreButtonContainerTemplate)==null?void 0:o.template)||((c=D.facets.showMoreButtonContainerTemplate)==null?void 0:c.template);w.innerHTML=R.render(b,{...e,focusId:`moreLess${(h=(l=e==null?void 0:e.values)==null?void 0:l[0])==null?void 0:h.value}`});const C=w.querySelector("."+(((g=(m=(u=this.config)==null?void 0:u.templates)==null?void 0:m.showMoreButtonContainerTemplate)==null?void 0:g.showMoreButtonClass)||((y=D.facets.showMoreButtonContainerTemplate)==null?void 0:y.showMoreButtonClass)));C&&(this.attachOnclickToShowMore(e,C,a),t&&t.appendChild(C))}}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?(G.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),n[t.name]=n[t.name]+s):(G.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,c,l,h,u,m,g,y;if(e&&(!pe.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const w=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplateDesktop)==null?void 0:n.template)||((o=D.facets.mainTemplateDesktop)==null?void 0:o.template);if(this.dataLayer.renderingEngine===$.mustache&&this.searchFacetsMainContainer){const b=document.activeElement;b instanceof HTMLInputElement&&b.type==="checkbox"||b!=null&&b.classList.contains("searchstax-facet-show-more-button")||b!=null&&b.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=b:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=R.render(w,{...e});const C=(u=this.searchFacetsMainContainer)==null?void 0:u.querySelector("."+(((h=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplateDesktop)==null?void 0:h.facetsContainerClass)||D.facets.mainTemplateDesktop.facetsContainerClass));if(C){C.innerHTML="";for(const f of e.facets)this.createFacetItem(f,C);if(this.searchFacetsMainContainer){const f=this.searchFacetsMainContainer.querySelector("."+(((y=(g=(m=this.config)==null?void 0:m.templates)==null?void 0:g.mainTemplateDesktop)==null?void 0:y.selectedFacetsContainerClass)||D.facets.mainTemplateDesktop.selectedFacetsContainerClass));f&&(this.createSelectedFacetsComponents(f),this.createClearFacetsComponents(f))}if(this.focusedElement){if(this.focusedElement.classList.contains("searchstax-facet-show-more-button")||this.focusedElement.classList.contains("searchstax-facet-show-less-button")){const T=this.focusedElement.getAttribute("data-focus"),S=this.searchFacetsMainContainer.querySelector(`[data-focus="${T}"]`);S instanceof HTMLElement&&S.focus(),this.focusedElement=null;return}const f=this.focusedElement.getAttribute("data-test-value"),L=this.searchFacetsMainContainer.querySelector(`[data-test-value="${f}"]`);L instanceof HTMLInputElement&&L.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(b=>{b.setAttribute("aria-expanded",String(!0)),b.setAttribute("tabindex","0"),b.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 c=(a=this.needCache?this.dataLayer.searchFacetsCached:this.dataLayer.searchFacets)==null?void 0:a.find(l=>l.name===n);if(c){const l=c.values.find(h=>h.type==="range"?!1:h.type==="checkbox"?`"${h.value}"`==`"${o}"`:!1);l&&e.push(l)}}}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,c,l,h;if(typeof document<"u"){const u=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=D.facets.clearFacetsTemplate)==null?void 0:n.template),g=document==null?void 0:document.createElement("div");g.innerHTML=R.render(m,{shouldShow:u.facets.length>0});const y=g.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.clearFacetsTemplate)==null?void 0:l.containerClass)||((h=D.facets.clearFacetsTemplate)==null?void 0:h.containerClass)));y&&(y.addEventListener("click",()=>{this.removeSelectedFacets()}),y.addEventListener("keyup",w=>{(w.code==="Space"||w.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(y))}}createSelectedFacetsComponent(e,t){var a,s,n,o,c,l,h,u;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=D.facets.selectedFacetsTemplate)==null?void 0:o.template),g=document==null?void 0:document.createElement("div");g.innerHTML=R.render(m,t);const y=g.querySelector("."+(((h=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.selectedFacetsTemplate)==null?void 0:h.containerClass)||((u=D.facets.selectedFacetsTemplate)==null?void 0:u.containerClass)));y&&(y.addEventListener("click",()=>{this.unselectFacet(t)}),y.addEventListener("keyup",w=>{(w.code==="Space"||w.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(y))}}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,c,l,h;if(typeof document<"u"){const u=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.filterByTemplate)==null?void 0:s.template)||((n=D.facets.filterByTemplate)==null?void 0:n.template),m=document==null?void 0:document.createElement("div");m.innerHTML=R.render(u,{});const g=m.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.filterByTemplate)==null?void 0:l.containerClass)||((h=D.facets.filterByTemplate)==null?void 0:h.containerClass)));g&&(e.prepend(g),g.addEventListener("click",this.openOverlay.bind(this)),g.addEventListener("keyup",y=>{(y.code==="Space"||y.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;G.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;G.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,c,l,h,u,m,g,y,w,b,C,f,L,T,S;if(e&&typeof document<"u"){const A=document==null?void 0:document.createElement("div");A.classList.add("searchstax-facets-container-mobile");const j=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((n=D.facets.mainTemplateMobile)==null?void 0:n.template);if(this.dataLayer.renderingEngine===$.mustache){if(A.innerHTML=R.render(j,{...e,overlayOpened:this.overlayOpened}),(o=this.searchFacetsMainContainer)==null||o.appendChild(A),(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplateMobile)for(const _ of((m=(u=(h=this.config)==null?void 0:h.templates)==null?void 0:u.mainTemplateMobile)==null?void 0:m.closeOverlayTriggerClasses)||[]){const B=A.querySelector("."+_);B&&(B.addEventListener("click",this.closeOverlay.bind(this)),B.addEventListener("keyup",ge=>{(ge.code==="Space"||ge.code==="Enter")&&this.closeOverlay()}))}else for(const _ of D.facets.mainTemplateMobile.closeOverlayTriggerClasses){const B=A.querySelector("."+_);B&&(B.addEventListener("click",this.closeOverlay.bind(this)),B.addEventListener("keyup",ge=>{(ge.code==="Space"||ge.code==="Enter")&&this.closeOverlay()}))}const V=A.querySelector("."+(((w=(y=(g=this.config)==null?void 0:g.templates)==null?void 0:y.mainTemplateMobile)==null?void 0:w.filterByContainerClass)||D.facets.mainTemplateMobile.filterByContainerClass));V&&this.createFilterByComponent(V);const E=A.querySelector("."+(((f=(C=(b=this.config)==null?void 0:b.templates)==null?void 0:C.mainTemplateMobile)==null?void 0:f.selectedFacetsContainerClass)||D.facets.mainTemplateMobile.selectedFacetsContainerClass));E&&(this.createSelectedFacetsComponents(E),this.createClearFacetsComponents(E));const z=A.querySelector("."+(((S=(T=(L=this.config)==null?void 0:L.templates)==null?void 0:T.mainTemplateMobile)==null?void 0:S.facetsContainerClass)||D.facets.mainTemplateMobile.facetsContainerClass));if(z){z.innerHTML="";for(const _ of e.facets)this.createFacetItem(_,z,!0)}}}}}class Rn{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"previousButtonClass");d(this,"nextButtonClass");d(this,"loadMoreButtonClass");d(this,"routerHelper");d(this,"searchPaginationMainContainer",null);var t,a,s,n,o,c,l,h,u;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)??D.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((c=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.mainTemplate)==null?void 0:c.nextButtonClass)??D.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((u=(h=(l=this.config)==null?void 0:l.templates)==null?void 0:h.infiniteScrollTemplate)==null?void 0:u.loadMoreButtonClass)??D.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,c,l,h,u,m,g;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=((c=(o=(n=this.config)==null?void 0:n.templates)==null?void 0:o.mainTemplate)==null?void 0:c.template)||((l=D.pagination.mainTemplate)==null?void 0:l.template);this.dataLayer.isInfiniteScroll&&(t=((m=(u=(h=this.config)==null?void 0:h.templates)==null?void 0:u.infiniteScrollTemplate)==null?void 0:m.template)||((g=D.pagination.infiniteScrollTemplate)==null?void 0:g.template)),this.dataLayer.renderingEngine===$.mustache&&(this.searchPaginationMainContainer.innerHTML=R.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class On{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"relatedSearchesContainerClass");d(this,"searchRelatedSearchesMainContainer",null);d(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)||D.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,c;if(typeof document<"u"){const l=document==null?void 0:document.createElement("div"),h=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.relatedSearch)==null?void 0:n.template)||D.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===$.mustache){l.innerHTML=R.render(h,e);const u=l.querySelector("."+(((c=(o=this.config.templates)==null?void 0:o.relatedSearch)==null?void 0:c.relatedSearchContainerClass)||D.relatedSearches.relatedSearch.relatedSearchContainerClass));u&&(t.appendChild(u),u.addEventListener("click",()=>{this.executeSearch(e)}),u.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)||D.relatedSearches.main.template;if(this.dataLayer.renderingEngine===$.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=R.render(t,e);const c=(o=this.searchRelatedSearchesMainContainer)==null?void 0:o.querySelector(`.${this.relatedSearchesContainerClass}`);if(c)for(const l of e.relatedSearches)this.addRelatedSearchComponent(l,c)}}}class Pn{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"searchFeedbackMainContainer",null);d(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=D.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)||D.searchFeedback.main.template;this.dataLayer.renderingEngine===$.mustache&&(this.searchFeedbackMainContainer.innerHTML=R.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class Fn{constructor(e){d(this,"searchHelper");d(this,"dataLayer");d(this,"config");d(this,"suggestAfterMinChars");d(this,"containerId");d(this,"currentInputValue","");d(this,"autosuggestResults");d(this,"searchInput");d(this,"actionButton");d(this,"autosuggestContainer");d(this,"buttonState","search");d(this,"selectedAutosuggestItem",-1);d(this,"suggestTrigger");d(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)||D.searchInput.mainTemplate.template,c={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled};if(this.dataLayer.setInputWidgetTemplateData(c),this.dataLayer.renderingEngine===$.mustache){const u=R.render(o,c);n.innerHTML=u,this.dataLayer.setInputTemplateRendered(!0)}const l=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.searchInputId)||D.searchInput.mainTemplate.searchInputId,h=document==null?void 0:document.querySelector(`#${l}`);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===$.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)),G.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,G.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"),G.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)),G.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return X.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=D.searchInput.autosuggestItemTemplate)==null?void 0:o.template);return t.innerHTML=R.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?G.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):G.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 $n{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"linkClickCallback");d(this,"searchCallback");d(this,"containerId");d(this,"searchResultsMainContainer");d(this,"searchResultsContainer");d(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(()=>{G.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,c;const e=((n=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.noSearchResultTemplate)==null?void 0:n.template)||((o=D.searchResults.noSearchResultTemplate)==null?void 0:o.template),t=((c=this.dataLayer.searchResultsMetadata)==null?void 0:c.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===$.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=R.render(e,{spellingSuggestion:t,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),t&&this.searchResultsContainer){const l=this.searchResultsContainer.querySelector("a");l&&l.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.searchCallback(t)})}}renderResults(e){var t,a,s,n,o;if(this.dataLayer.renderingEngine===$.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)G.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{G.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const c=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((n=D.searchResults.searchResultTemplate)==null?void 0:n.template),l=e.map(h=>R.render(c,h));((o=this.config)==null?void 0:o.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=l.join(""):this.searchResultsContainer.innerHTML=l.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=D.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=D.searchResults.mainTemplate)==null?void 0:n.template);this.dataLayer.renderingEngine===$.mustache&&(this.searchResultsMainContainer.innerHTML=R.render(e,{}),setTimeout(()=>{var l,h,u,m,g,y,w;const o=(u=(h=(l=this.config)==null?void 0:l.templates)==null?void 0:h.mainTemplate)!=null&&u.searchResultsContainerId?(y=(g=(m=this.config)==null?void 0:m.templates)==null?void 0:g.mainTemplate)==null?void 0:y.searchResultsContainerId:(w=D.searchResults.mainTemplate)==null?void 0:w.searchResultsContainerId,c=document==null?void 0:document.getElementById(o);if(c)this.searchResultsContainer=c;else throw new Error(`Search Results Container with id ${o} not found`)},0))}}class Bn{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"selectId");d(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)||D.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)||D.sorting.main.template;if(this.dataLayer.renderingEngine===$.mustache){this.searchSortingMainContainer.innerHTML=R.render(t,e),this.markOptionSelected();const o=document==null?void 0:document.getElementById(this.selectId);o&&o.addEventListener("change",c=>{this.setOrderQuery(c.target.value)})}}}class Vn{constructor(e){d(this,"analyticsKey");d(this,"containerId");d(this,"mainContainer");d(this,"isLightweight");d(this,"emailOverride");d(this,"feedbackTextAreaOverride");d(this,"mainTemplateOverride");d(this,"lightweightTemplateOverride");d(this,"focusedElement",null);d(this,"focusTrapListener",null);d(this,"lastFocusedElementBeforeModal",null);d(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});d(this,"thumbsUpValue",10);d(this,"thumbsDownValue",1);d(this,"ratedQuestion","");d(this,"language","");d(this,"model","");d(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(){fe.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=Y==null?void 0:Y.mainTemplate)==null?void 0:s.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(n=Y.lightweightTemplate)==null?void 0:n.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=R.render(a,e),this.focusedElement&&this.mainContainer){const o=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),c=this.focusedElement.type==="radio"?"id":"class",l=this.mainContainer.querySelector(`[${c}="${o}"]`);(l instanceof HTMLInputElement||l instanceof HTMLButtonElement||l instanceof HTMLTextAreaElement||l instanceof HTMLAnchorElement)&&l.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=Y.mainTemplate)==null?void 0:t.modalContainerClass;return((a=this.mainContainer)==null?void 0:a.querySelector(`.${e}`))||null}attachLightweightEvents(){var n,o,c,l;const e=(n=Y.lightweightTemplate)==null?void 0:n.thumbsUpButtonClass,t=(o=Y.lightweightTemplate)==null?void 0:o.thumbsDownButtonClass,a=(c=this.mainContainer)==null?void 0:c.querySelector("."+e),s=(l=this.mainContainer)==null?void 0:l.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(u=>{u.isSelected=u.index===this.thumbsUpValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=h,this.submit())}),s&&s.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(u=>{u.isSelected=u.index===this.thumbsDownValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=h,this.submit())})}attachSubmitButtonEvents(){var a,s;const e=(a=Y.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=Y.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,G.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,G.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&&(fe.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(),G.setAccessibilityText("Feedback has been sent.",1e3),(s=this.mainContainer)!=null&&s.querySelector("."+((a=Y.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=Y.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,G.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=Y.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=Y.mainTemplate)==null?void 0:n.charactersRemainingContainerclass));s&&(s.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,s;const e=(a=Y.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 c=o.target.value;this.templateData.ratings.forEach(l=>{l.isSelected=l.index+""===c}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var a,s;const e=(a=Y.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=Y.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),G.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),G.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var c,l,h,u,m,g;const e=(c=Y.mainTemplate)==null?void 0:c.submitButtonClass,t=(l=this.mainContainer)==null?void 0:l.querySelector("."+e);t&&(t.disabled=!0);const a=(h=Y.mainTemplate)==null?void 0:h.checkmarkClass,s=(u=this.mainContainer)==null?void 0:u.querySelector("."+a);s&&s.classList.remove("hidden");const n=(m=Y.mainTemplate)==null?void 0:m.submitButtonTextClass,o=(g=this.mainContainer)==null?void 0:g.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 zn{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"answerContainer",null);d(this,"showMoreVisible",!1);d(this,"renderFeedbackWidget",!1);d(this,"clicked",!1);d(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 Vn({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");fe.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)||D.answer.main.template;this.dataLayer.renderingEngine===$.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=R.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 ws{constructor(e){d(this,"dataLayer");d(this,"config");d(this,"containerId");d(this,"currentSelectValue","");d(this,"locationInput");d(this,"radiusInput");d(this,"locationDecode");d(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,c,l;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 u=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||D.location.mainTemplate.template,m={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(m),this.dataLayer.renderingEngine===$.mustache){const g=R.render(u,m);h.innerHTML=g;const y=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||D.location.mainTemplate.locationInputId,w=document==null?void 0:document.querySelector(`#${y}`);if(w)this.locationInput=w,w.addEventListener("blur",this.blurEvent.bind(this)),w.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const b=((o=(n=this.config.templates)==null?void 0:n.mainTemplate)==null?void 0:o.radiusInputId)||D.location.mainTemplate.radiusInputId,C=document==null?void 0:document.querySelector(`#${b}`);C instanceof HTMLSelectElement&&(this.radiusInput=C,C.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const f=((l=(c=this.config.templates)==null?void 0:c.mainTemplate)==null?void 0:l.currentLocationActionButtonId)||D.location.mainTemplate.currentLocationActionButtonId,L=document==null?void 0:document.querySelector(`#${f}`);L&&L.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===$.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(c=>{this.setCurrentLocationFields(c.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 X.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===$.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 qn{constructor(e=$.mustache){d(this,"routerEnabled",!1);d(this,"cachedQuery","");d(this,"routerHelper");d(this,"searchHelper");d(this,"searchResultsConfig");d(this,"searchPaginationConfig");d(this,"searchFeedbackConfig");d(this,"searchSortingConfig");d(this,"searchFacetsConfig");d(this,"relatedSearchesConfig");d(this,"externalPromotionsConfig");d(this,"searchInputWidget");d(this,"searchLocationWidget");d(this,"searchResultsWidget");d(this,"searchFacetsWidget");d(this,"searchPaginationWidget");d(this,"searchFeedbackWidget");d(this,"searchSortingWidget");d(this,"relatedSearchesWidget");d(this,"externalPromotionsWidget");d(this,"answerWidget");d(this,"locationObserver",null);d(this,"dataLayer");d(this,"firstRequest",!0);d(this,"previousQuery","");d(this,"eventSource",null);d(this,"renderEngine",$.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=$.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,c,l,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)):(s=this.dataLayer.searchLocationConfig)!=null&&s.locationSearchEnabled&&!((n=this.dataLayer.searchLocationConfig)!=null&&n.locationValuesOverride)?this.getMetadata(a):(c=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)!=null&&c.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((h=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:h.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&fe.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){fe.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new Zr("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 rn({...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 cs(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 cs({})}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,c)=>({...o,position:c+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&&fe.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,c;const t=ot.extractSearchResultsMetadata(e),a=((n=(s=this.dataLayer.searchLocationConfig)==null?void 0:s.locationValuesOverride)==null?void 0:n.locationFilterDefaultValue)??((c=(o=t.location)==null?void 0:o.filter)==null?void 0:c.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=ot.combineResultsWithMetadata(e),a=ot.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!==Ve.question&&e!==Ve.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 Fn({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 ws({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 ws({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 zn({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new $n({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 Rn({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new Pn({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new Bn({containerId:e,config:t,dataLayer:this.dataLayer})}addRelatedSearchesWidget(e,t){this.relatedSearchesConfig=t,this.relatedSearchesWidget=new On({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 jn({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget=new Nn({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=X.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(c=>s?{key:c,value:s[c]}:{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&&fe.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=ot.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&&fe.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 M=i.reactive({searchstax:new qn("vue")}),Wn={key:0},Hn=i.defineComponent({__name:"SearchstaxWrapper",props:{language:{default:"en"},model:{},sessionId:{},searchURL:{},analyticsBaseUrl:{},analyticsSrc:{},suggesterURL:{},questionURL:{},trackApiKey:{},searchAuth:{},authType:{default:"basic"},autoCorrect:{type:Boolean,default:!0},router:{},beforeSearch:{},afterSearch:{},initialized:{}},emits:["initialized"],setup(r,{emit:e}){const t=r,a=e,s=i.ref(!1);return i.onMounted(()=>{const n={};t.beforeSearch&&(n.beforeSearch=t.beforeSearch),t.afterSearch&&(n.afterSearch=t.afterSearch),M.searchstax.initialize({language:t.language,model:t.model,searchURL:t.searchURL,suggesterURL:t.suggesterURL,trackApiKey:t.trackApiKey,searchAuth:t.searchAuth,authType:t.authType,autoCorrect:t.autoCorrect,router:t.router,hooks:n,analyticsBaseUrl:t.analyticsBaseUrl,analyticsSrc:t.analyticsSrc,sessionId:t.sessionId,questionURL:t.questionURL}),setTimeout(()=>{s.value=!0},10),a("initialized",M.searchstax)}),(n,o)=>s.value?(i.openBlock(),i.createElementBlock("div",Wn,[i.renderSlot(n.$slots,"default")])):i.createCommentVNode("",!0)}}),_n={class:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container"},Qn={class:"searchstax-location-input-wrapper"},Un={class:"searchstax-location-input-wrapper-inner"},Yn=["value"],Jn={key:0,class:"searchstax-location-input-label"},Gn=["value"],Kn=["value"],Zn=i.defineComponent({__name:"SearchstaxLocationWidgetTemplate",props:{locationData:{type:Object,required:!0},inputValue:{type:String,required:!0},selectValue:{type:String,required:!0},locationError:{type:Boolean,required:!0},inputChange:{type:Function,required:!0},radiusChange:{type:Function,required:!0},locationBlur:{type:Function,required:!0},getCurrentLocation:{type:Function,required:!0}},setup(r){return(e,t)=>(i.openBlock(),i.createElementBlock("div",_n,[i.createElementVNode("div",Qn,[t[4]||(t[4]=i.createElementVNode("span",{class:"searchstax-location-input-label"},"NEAR",-1)),i.createElementVNode("div",Un,[i.createElementVNode("input",{type:"text",id:"searchstax-location-input",class:i.normalizeClass(["searchstax-location-input",{"searchstax-input-location-error":r.locationError}]),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",onChange:t[0]||(t[0]=(...a)=>r.inputChange&&r.inputChange(...a)),value:r.inputValue,onBlur:t[1]||(t[1]=(...a)=>r.locationBlur&&r.locationBlur(...a))},null,42,Yn),i.createElementVNode("button",{onClick:t[2]||(t[2]=(...a)=>r.getCurrentLocation&&r.getCurrentLocation(...a)),class:"searchstax-get-current-location-button"}," Use my current location ")]),r.locationData.shouldShowLocationDistanceDropdown?(i.openBlock(),i.createElementBlock("span",Jn,"WITHIN")):i.createCommentVNode("",!0),r.locationData.shouldShowLocationDistanceDropdown?(i.openBlock(),i.createElementBlock("select",{key:1,id:"searchstax-location-radius-select",class:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:t[3]||(t[3]=(...a)=>r.radiusChange&&r.radiusChange(...a)),value:r.selectValue},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.locationData.locationSearchDistanceValues,a=>(i.openBlock(),i.createElementBlock("option",{value:a.value,key:a.value},i.toDisplayString(a.label),9,Kn))),128))],40,Gn)):i.createCommentVNode("",!0)])]))}}),Xn=["id"],bs=i.defineComponent({__name:"SearchstaxLocationWidget",props:{locationDecode:{type:Function},locationDecodeCoordinatesToAddress:{type:Function},locationSearchEnabled:{type:Boolean},locationValuesOverride:{}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=Math.random(),n=i.ref(""),o=i.ref(""),c=i.ref(!1),l=i.ref(!1),h=()=>{var C;(C=M.searchstax.searchLocationWidget)==null||C.triggerGeocoder(n.value)},u=C=>{var L;const f=C.target;o.value=f.value,(L=M.searchstax.searchLocationWidget)==null||L.setRadiusValue(o.value)},m=C=>{const f=C.target;n.value=f.value},g=()=>{var C;(C=M.searchstax.searchLocationWidget)==null||C.getCurrentLocation()},y=()=>{M.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(C=>{a.value=C}),M.searchstax.dataLayer.$searchObject.subscribe(C=>{n.value=C.location.address??"",o.value=C.location.radius||""}),M.searchstax.dataLayer.$locationError.subscribe(C=>{l.value=C}),M.searchstax.dataLayer.$searchLocationChange.subscribe(C=>{n.value=C}),M.searchstax.dataLayer.$searchRadiusChange.subscribe(C=>{o.value=String(C)})},w=()=>{!c.value&&M.searchstax.routerHelper&&(c.value=!0,M.searchstax.addSearchLocationWidget("searchstax-location-container"+s,{hooks:{locationDecode:e.locationDecode,locationDecodeCoordinatesToAddress:e.locationDecodeCoordinatesToAddress},locationSearchEnabled:e.locationSearchEnabled,locationValuesOverride:e.locationValuesOverride}))},b=i.computed(()=>!!t.location);return i.onMounted(()=>{if(M.searchstax)y(),w();else throw Error("Searchstax instance needs to be passed via props")}),(C,f)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-location-container"+i.unref(s),class:"searchstax-location-container"},[a.value&&!b.value?(i.openBlock(),i.createBlock(Zn,{key:0,locationData:a.value,inputValue:n.value,selectValue:o.value,locationError:l.value,inputChange:m,radiusChange:u,locationBlur:h,getCurrentLocation:g},null,8,["locationData","inputValue","selectValue","locationError"])):i.createCommentVNode("",!0),a.value&&b.value?i.renderSlot(C.$slots,"location",{key:1,locationData:a.value,locationError:l.value,radiusChange:u,locationBlur:h,selectValue:o.value,getCurrentLocation:g,inputValue:n.value,inputChange:m}):i.createCommentVNode("",!0)],8,Xn))}}),ei={class:"searchstax-search-input-wrapper"},ti=["innerHTML","onMouseover"],ai=i.defineComponent({__name:"SearchstaxInputWidgetTemplate",props:{suggestions:{type:Array,required:!0},onMouseLeave:{type:Function,required:!0},onMouseOver:{type:Function,required:!0},onMouseClick:{type:Function,required:!0}},setup(r){return(e,t)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",ei,[t[2]||(t[2]=i.createElementVNode("input",{type:"text",id:"searchstax-search-input",class:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["searchstax-autosuggest-container",{hidden:r.suggestions.length===0}]),onMouseleave:t[1]||(t[1]=(...a)=>r.onMouseLeave&&r.onMouseLeave(...a))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.suggestions,a=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-autosuggest-item",key:a.term},[i.createElementVNode("div",{class:"searchstax-autosuggest-item-term-container",innerHTML:a.term,tabindex:"0",onMouseover:s=>r.onMouseOver(a),onClick:t[0]||(t[0]=i.withModifiers(s=>r.onMouseClick(),["stop"]))},null,40,ti)]))),128))],34)]),i.createVNode(bs),t[3]||(t[3]=i.createElementVNode("button",{class:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search",role:"button"},null,-1))],64))}}),si={id:"searchstax-input-container"},ri=i.defineComponent({__name:"SearchstaxInputWidget",props:{afterAutosuggest:{type:Function},beforeAutosuggest:{type:Function},searchInputId:{},suggestAfterMinChars:{},locationDecode:{type:Function},locationDecodeCoordinatesToAddress:{type:Function}},setup(r){const e=r,t=i.useSlots(),a=i.ref([]),s=i.ref(null),n=()=>{M.searchstax.searchInputWidget.resetAutosuggestSelection(),M.searchstax.searchInputWidget.markActiveAutosuggestItem()},o=u=>{M.searchstax.searchInputWidget.onSuggestionEnter(u)},c=()=>{M.searchstax.searchInputWidget.suggestionChosen()},l=()=>{M.searchstax.dataLayer.$autosuggestResults.subscribe(u=>{a.value=(u==null?void 0:u.suggestions)??[]}),M.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(u=>{s.value=u})},h=i.computed(()=>!!t.input);return i.onMounted(()=>{if(M.searchstax){l();const u={};e.afterAutosuggest&&(u.afterAutosuggest=e.afterAutosuggest),e.beforeAutosuggest&&(u.beforeAutosuggest=e.beforeAutosuggest),M.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:e.suggestAfterMinChars,hooks:u,templates:{mainTemplate:{template:"",searchInputId:e.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");M.searchstax.dataLayer.setInputTemplateRendered(!0)}),(u,m)=>{var g;return i.openBlock(),i.createElementBlock("div",si,[i.createElementVNode("div",{class:i.normalizeClass(["searchstax-search-input-container searchstax-search-input-container-new",{"searchstax-alternative-render":(g=s.value)==null?void 0:g.locationEnabled}])},[h.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(ai,{key:0,suggestions:a.value,onMouseClick:c,onMouseOver:o,onMouseLeave:n},null,8,["suggestions"])),i.renderSlot(u.$slots,"input",{suggestions:a.value,onMouseClick:c,onMouseOver:o,onMouseLeave:n})],2)])}}}),ni={key:0,class:"searchstax-search-results"},ii=["href","data-searchstax-unique-result-id","onClick","onKeyup"],oi={key:0,class:"searchstax-search-result-promoted"},ci=["innerHTML"],li=["src"],hi={class:"searchstax-search-result-title-container"},di=["id","innerHTML"],ui=["innerHTML"],pi=["innerHTML"],gi={key:0,class:"searchstax-search-result-image-container"},mi=["src"],fi={key:1},Li=["innerHTML"],yi=i.defineComponent({__name:"SearchstaxResultWidgetDefaultTemplate",props:{searchResults:{type:Object,required:!0},resultClicked:{type:Function,required:!0}},setup(r){return(e,t)=>r.searchResults&&r.searchResults.length?(i.openBlock(),i.createElementBlock("div",ni,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.searchResults,a=>(i.openBlock(),i.createElementBlock("a",{key:a.uniqueId,href:a.url,"data-searchstax-unique-result-id":a.uniqueId,onClick:s=>r.resultClicked(a,s),onKeyup:[i.withKeys(s=>r.resultClicked(a,s),["enter"]),i.withKeys(s=>r.resultClicked(a,s),["space"])],"aria-labelledby":"title-{{searchResult.uniqueId}}",class:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabindex:"0"},[i.createElementVNode("div",{class:i.normalizeClass(["searchstax-search-result",{"has-thumbnail":a.thumbnail,promoted:a.promoted}])},[a.promoted?(i.openBlock(),i.createElementBlock("div",oi)):i.createCommentVNode("",!0),a.ribbon?(i.openBlock(),i.createElementBlock("div",{key:1,innerHTML:a.ribbon,class:"searchstax-search-result-ribbon"},null,8,ci)):i.createCommentVNode("",!0),a.thumbnail?(i.openBlock(),i.createElementBlock("img",{key:2,alt:"",src:a.thumbnail,class:"searchstax-thumbnail"},null,8,li)):i.createCommentVNode("",!0),i.createElementVNode("div",hi,[i.createElementVNode("span",{class:"searchstax-search-result-title",id:"title-"+a.uniqueId,innerHTML:a.title},null,8,di)]),a.paths?(i.openBlock(),i.createElementBlock("p",{key:3,innerHTML:a.paths,tabindex:"0",class:"searchstax-search-result-common"},null,8,ui)):i.createCommentVNode("",!0),a.description?(i.openBlock(),i.createElementBlock("p",{key:4,tabindex:"0",innerHTML:a.description,class:"searchstax-search-result-description searchstax-search-result-common"},null,8,pi)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.unmappedFields,s=>(i.openBlock(),i.createElementBlock("div",{key:s.key},[s.isImage&&typeof s.value=="string"?(i.openBlock(),i.createElementBlock("div",gi,[i.createElementVNode("img",{alt:"",src:s.value,class:"searchstax-result-image"},null,8,mi)])):(i.openBlock(),i.createElementBlock("div",fi,[i.createElementVNode("p",{tabindex:"0",class:"searchstax-search-result-common",innerHTML:s.value},null,8,Li)]))]))),128))],2)],40,ii))),128))])):i.createCommentVNode("",!0)}}),wi={key:0},bi={class:"searchstax-no-results"},Ci={key:0},ki=i.defineComponent({__name:"SearchstaxResultWidgetNoResultsTemplate",props:{searchResults:{type:Object,required:!0},resultClicked:{type:Function,required:!0},searchTerm:{type:String,required:!0},metadata:{type:Object,required:!1},store:{type:Object,required:!0},executeSearch:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s;return r.searchResults&&r.searchResults.length===0&&r.searchTerm!==""&&r.searchTerm!=="*"&&r.store.searchstax.dataLayer.parsedData.firstSearchHappened?(i.openBlock(),i.createElementBlock("div",wi,[i.createElementVNode("div",bi,[t[3]||(t[3]=i.createTextVNode(" Showing ",-1)),t[4]||(t[4]=i.createElementVNode("strong",null,"no results",-1)),t[5]||(t[5]=i.createTextVNode(" for ",-1)),i.createElementVNode("strong",null,'"'+i.toDisplayString(r.searchTerm)+'"',1),t[6]||(t[6]=i.createElementVNode("br",null,null,-1)),(a=r.metadata)!=null&&a.spellingSuggestion?(i.openBlock(),i.createElementBlock("span",Ci,[t[1]||(t[1]=i.createTextVNode("Did you mean ",-1)),i.createElementVNode("a",{href:"#",class:"searchstax-suggestion-term",onClick:t[0]||(t[0]=n=>{var o;return r.executeSearch((o=r.metadata)==null?void 0:o.spellingSuggestion,n)})},i.toDisplayString((s=r.metadata)==null?void 0:s.spellingSuggestion),1),t[2]||(t[2]=i.createTextVNode("?",-1))])):i.createCommentVNode("",!0)]),t[7]||(t[7]=i.createElementVNode("ul",null,[i.createElementVNode("li",null," Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need. ")],-1))])):i.createCommentVNode("",!0)}}}),xi={id:"searchstax-results-container"},Mi={"aria-label":"search results container",tabindex:"0"},Si={class:"searchstax-search-results-container",id:"searchstax-search-results-container"},Ti={id:"searchstax-result-container"},Ei={key:3},Di=i.defineComponent({__name:"SearchstaxResultWidget",props:{afterLinkClick:{type:Function},renderMethod:{},resultsPerPage:{}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=i.ref(null),n=i.ref(""),o=i.computed(()=>!!t.noResult),c=i.computed(()=>!!t.results),l=i.computed(()=>{const g={};return e.afterLinkClick&&(g.afterLinkClick=e.afterLinkClick),g}),h=(g,y)=>{y.preventDefault(),y.stopPropagation(),M.searchstax.executeLinkClick(g.uniqueId)},u=(g,y)=>{y.preventDefault(),M.searchstax.executeSearch(g)},m=()=>{M.searchstax.dataLayer.$searchResults.subscribe(g=>{var C;const y=a.value??[],w=g??[],b=e.renderMethod==="infiniteScroll"?[...y,...w]:g;((C=M.searchstax.dataLayer.$searchObject.value)==null?void 0:C.page)===1?a.value=g:a.value=b}),M.searchstax.dataLayer.$searchTermChange.subscribe(g=>{n.value=g}),M.searchstax.dataLayer.$searchResultsMetadata.subscribe(g=>{s.value=g})};return i.onMounted(()=>{if(M.searchstax)m(),M.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:e.renderMethod??"pagination",resultsPerPage:e.resultsPerPage,hooks:l.value});else throw Error("Searchstax instance needs to be passed via props")}),(g,y)=>(i.openBlock(),i.createElementBlock("div",xi,[i.createElementVNode("section",Mi,[i.createElementVNode("div",Si,[i.createElementVNode("div",Ti,[a.value&&a.value.length===0&&n.value!==""&&n.value!=="*"&&i.unref(M).searchstax.dataLayer.parsedData.firstSearchHappened&&!o.value?(i.openBlock(),i.createBlock(ki,{key:0,searchTerm:n.value,metadata:s.value,executeSearch:u,store:i.unref(M),searchResults:a.value,resultClicked:h},null,8,["searchTerm","metadata","store","searchResults"])):i.createCommentVNode("",!0),a.value&&a.value.length===0&&n.value!==""&&n.value!=="*"&&i.unref(M).searchstax.dataLayer.parsedData.firstSearchHappened&&o.value?i.renderSlot(g.$slots,"noResult",{key:1,searchTerm:n.value,metadata:s.value,executeSearch:u,store:i.unref(M),searchResults:a.value,resultClicked:h}):i.createCommentVNode("",!0),a.value&&a.value.length&&!c.value?(i.openBlock(),i.createBlock(yi,{key:2,searchResults:a.value,resultClicked:h},null,8,["searchResults"])):i.createCommentVNode("",!0),a.value&&a.value.length&&c.value?(i.openBlock(),i.createElementBlock("div",Ei,[i.renderSlot(g.$slots,"results",{searchResults:a.value,resultClicked:h})])):i.createCommentVNode("",!0)])])])]))}}),Ai={key:0,class:"searchstax-facets-container-desktop"},Ii=["onClick"],vi={class:"searchstax-facet-title"},ji={class:"searchstax-facet-values-container","aria-live":"polite"},Ni={class:"searchstax-facet-input"},Ri=["checked","disabled","aria-label","onClick"],Oi=["onClick"],Pi=["onClick"],Fi={key:0,class:"searchstax-facet-show-more-container"},$i=["onClick","onKeyup"],Bi={key:0,class:"searchstax-facet-show-less-button searchstax-facet-show-button"},Vi={key:1,class:"searchstax-facet-show-more-button searchstax-facet-show-button"},zi=i.defineComponent({__name:"SearchstaxFacetsWidgetDesktopTemplate",props:{facetsTemplateDataDesktop:{type:Object,required:!0},isNotDeactivated:{type:Function,required:!0},toggleFacetGroup:{type:Function,required:!0},isChecked:{type:Function,required:!0},selectFacet:{type:Function,required:!0},showMoreLessDesktop:{type:Function,required:!0},facetContainers:{type:Object,required:!0}},emits:["updateRefDesktop"],setup(r,{emit:e}){const t=r,a=e,s=(n,o)=>(a("updateRefDesktop",n,o),t.facetContainers);return(n,o)=>{var c;return(c=r.facetsTemplateDataDesktop)!=null&&c.hasResultsOrExternalPromotions?(i.openBlock(),i.createElementBlock("div",Ai,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.facetsTemplateDataDesktop.facets,l=>(i.openBlock(),i.createElementBlock("div",{key:l.name+"desktop",class:i.normalizeClass(["searchstax-facet-container",{active:r.isNotDeactivated(l.name)}])},[i.createElementVNode("div",null,[i.createElementVNode("div",{class:"searchstax-facet-title-container",onClick:h=>r.toggleFacetGroup(l.name)},[i.createElementVNode("div",vi,i.toDisplayString(l.label),1),o[0]||(o[0]=i.createElementVNode("div",{class:"searchstax-facet-title-arrow active"},null,-1))],8,Ii),i.createElementVNode("div",ji,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.values,h=>(i.openBlock(),i.createElementBlock("div",{key:h.value+h.parentName,class:i.normalizeClass(["searchstax-facet-value-container",{"searchstax-facet-value-disabled":h.disabled}]),ref_for:!0,ref:u=>s(u,h)},[i.createElementVNode("div",Ni,[i.createElementVNode("input",{type:"checkbox",class:"searchstax-facet-input-checkbox",checked:r.isChecked(h),disabled:h.disabled,"aria-label":h.value+" "+h.count,onClick:u=>r.selectFacet(h.value+"-desktop",u,h,!0)},null,8,Ri)]),i.createElementVNode("div",{class:"searchstax-facet-value-label",onClick:u=>r.selectFacet(h.value+"-desktop",u,h,!1)},i.toDisplayString(h.value),9,Oi),i.createElementVNode("div",{class:"searchstax-facet-value-count",onClick:u=>r.selectFacet(h.value+"-desktop",u,h,!1)}," ("+i.toDisplayString(h.count)+") ",9,Pi)],2))),128)),l.hasMoreFacets?(i.openBlock(),i.createElementBlock("div",Fi,[i.createElementVNode("div",{class:"searchstax-facet-show-more-container",onClick:h=>r.showMoreLessDesktop(h,l),onKeyup:[i.withKeys(h=>{h.preventDefault(),r.showMoreLessDesktop(h,l)},["space"]),i.withKeys(h=>r.showMoreLessDesktop(h,l),["enter"])],tabindex:"0",role:"button"},[l.showingAllFacets?(i.openBlock(),i.createElementBlock("div",Bi," less ")):(i.openBlock(),i.createElementBlock("div",Vi," more "))],40,$i)])):i.createCommentVNode("",!0)])])],2))),128))])):i.createCommentVNode("",!0)}}}),qi={key:0,class:"searchstax-facets-container-mobile"},Wi={class:"searchstax-facets-pills-container"},Hi={class:"searchstax-facets-pills-selected"},_i=["onClick"],Qi={class:"searchstax-facets-pill-label"},Ui={class:"searchstax-facets-mobile-overlay-header"},Yi={class:"searchstax-facets-container-mobile"},Ji=["onClick"],Gi={class:"searchstax-facet-title"},Ki={class:"searchstax-facet-values-container","aria-live":"polite"},Zi={class:"searchstax-facet-input"},Xi=["checked","disabled","aria-label","onClick"],eo=["onClick"],to=["onClick"],ao={key:0,class:"searchstax-facet-show-more-container"},so=["onClick","onKeyup"],ro={key:0,class:"searchstax-facet-show-less-button searchstax-facet-show-button"},no={key:1,class:"searchstax-facet-show-more-button searchstax-facet-show-button"},io=i.defineComponent({__name:"SearchstaxFacetsWidgetMobileTemplate",props:{facetsTemplateDataMobile:{type:Object,required:!0},isNotDeactivated:{type:Function,required:!0},toggleFacetGroup:{type:Function,required:!0},isChecked:{type:Function,required:!0},selectFacet:{type:Function,required:!0},showMoreLessDesktop:{type:Function,required:!0},showMoreLessMobile:{type:Function,required:!0},facetContainers:{type:Object,required:!0},openOverlay:{type:Function,required:!0},selectedFacetsCheckboxes:{type:Array,required:!0},unselectFacet:{type:Function,required:!0},unselectAll:{type:Function,required:!0},closeOverlay:{type:Function,required:!0}},emits:["updateRefMobile"],setup(r,{emit:e}){const t=r,a=e,s=(n,o)=>(a("updateRefMobile",n,o),t.facetContainers);return(n,o)=>{var c,l,h;return(c=r.facetsTemplateDataMobile)!=null&&c.hasResultsOrExternalPromotions?(i.openBlock(),i.createElementBlock("div",qi,[i.createElementVNode("div",Wi,[i.createElementVNode("div",{class:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:o[0]||(o[0]=(...u)=>r.openOverlay&&r.openOverlay(...u))},[...o[4]||(o[4]=[i.createElementVNode("div",{class:"searchstax-facets-pill-label"},"Filter By",-1)])]),i.createElementVNode("div",Hi,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.selectedFacetsCheckboxes,u=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-facets-pill searchstax-facets-pill-facets",key:u.value,onClick:m=>r.unselectFacet(u)},[i.createElementVNode("div",Qi,i.toDisplayString(u.value)+" ("+i.toDisplayString(u.count)+")",1),o[5]||(o[5]=i.createElementVNode("div",{class:"searchstax-facets-pill-icon-close"},null,-1))],8,_i))),128))]),r.selectedFacetsCheckboxes.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:o[1]||(o[1]=(...u)=>r.unselectAll&&r.unselectAll(...u))},[...o[6]||(o[6]=[i.createElementVNode("div",{class:"searchstax-facets-pill-label"},"Clear Filters",-1)])])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["searchstax-facets-mobile-overlay",{"searchstax-show":(l=r.facetsTemplateDataMobile)==null?void 0:l.overlayOpened}])},[i.createElementVNode("div",Ui,[o[7]||(o[7]=i.createElementVNode("div",{class:"searchstax-facets-mobile-overlay-header-title"},"Filter By",-1)),i.createElementVNode("div",{class:"searchstax-search-close",onClick:o[2]||(o[2]=(...u)=>r.closeOverlay&&r.closeOverlay(...u))})]),i.createElementVNode("div",Yi,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList((h=r.facetsTemplateDataMobile)==null?void 0:h.facets,u=>(i.openBlock(),i.createElementBlock("div",{key:u.name+"mobile",class:i.normalizeClass(["searchstax-facet-container",{active:r.isNotDeactivated(u.name)}])},[i.createElementVNode("div",null,[i.createElementVNode("div",{class:"searchstax-facet-title-container",onClick:m=>r.toggleFacetGroup(u.name)},[i.createElementVNode("div",Gi,i.toDisplayString(u.label),1),o[8]||(o[8]=i.createElementVNode("div",{class:"searchstax-facet-title-arrow active"},null,-1))],8,Ji),i.createElementVNode("div",Ki,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.values,m=>(i.openBlock(),i.createElementBlock("div",{key:m.value+m.parentName,class:i.normalizeClass(["searchstax-facet-value-container",{"searchstax-facet-value-disabled":m.disabled}]),ref_for:!0,ref:g=>{s(g,m)}},[i.createElementVNode("div",Zi,[i.createElementVNode("input",{type:"checkbox",class:"searchstax-facet-input-checkbox",checked:r.isChecked(m),disabled:m.disabled,"aria-label":m.value+" "+m.count,onClick:g=>r.selectFacet(m.value+"-mobile",g,m,!0)},null,8,Xi)]),i.createElementVNode("div",{class:"searchstax-facet-value-label",onClick:g=>r.selectFacet(m.value+"-mobile",g,m,!1)},i.toDisplayString(m.value),9,eo),i.createElementVNode("div",{class:"searchstax-facet-value-count",onClick:g=>r.selectFacet(m.value+"-mobile",g,m,!1)}," ("+i.toDisplayString(m.count)+") ",9,to)],2))),128)),u.hasMoreFacets?(i.openBlock(),i.createElementBlock("div",ao,[i.createElementVNode("div",{class:"searchstax-facet-show-more-container",onClick:m=>r.showMoreLessMobile(m,u),onKeyup:[i.withKeys(m=>r.showMoreLessMobile(m,u),["space"]),i.withKeys(m=>r.showMoreLessMobile(m,u),["enter"])],tabindex:"0"},[u.showingAllFacets?(i.openBlock(),i.createElementBlock("div",ro," less ")):(i.openBlock(),i.createElementBlock("div",no," more "))],40,so)])):i.createCommentVNode("",!0)])])],2))),128))]),i.createElementVNode("button",{class:"searchstax-facets-mobile-overlay-done",onClick:o[3]||(o[3]=(...u)=>r.closeOverlay&&r.closeOverlay(...u))},"Done")],2)])):i.createCommentVNode("",!0)}}}),oo=["id"],co={key:1},lo={key:3},ho=i.defineComponent({__name:"SearchstaxFacetsWidget",props:{facetingType:{},itemsPerPageDesktop:{},itemsPerPageMobile:{},specificFacets:{},beforeFacetsRender:{type:Function}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=i.ref(null),n=i.ref([]),o=i.ref([]),c=Math.random(),l=i.computed(()=>!!t.desktopFacets),h=i.computed(()=>!!t.mobileFacets),u=()=>{M.searchstax.dataLayer.$facetsTemplateData.subscribe(E=>{E!=null&&E.isMobile?s.value=E:a.value=E}),M.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(E=>{const z=E??[];o.value=z.filter(_=>_.type==="checkbox")})},m=E=>{M.searchstax.searchFacetsWidget.unselectFacet(E)},g=()=>{M.searchstax.searchFacetsWidget.removeSelectedFacets()},y=E=>!M.searchstax.searchFacetsWidget.deactivatedFacets[E],w=E=>{y(E)?M.searchstax.searchFacetsWidget.deactivatedFacets[E]=!0:M.searchstax.searchFacetsWidget.deactivatedFacets[E]=!1},b=E=>M.searchstax.searchFacetsWidget.isChecked(E),C=(E,z,_,B)=>{const ge=document.createElement("div");ge.innerHTML=n.value[E].outerHTML,M.searchstax.searchFacetsWidget.onFacetSelect(z,_,n.value[E],B)},f=(E,z)=>{M.searchstax.searchFacetsWidget.onShowMoreLessClick(E,z,!1)},L=(E,z)=>{M.searchstax.searchFacetsWidget.onShowMoreLessClick(E,z,!0)},T=()=>{M.searchstax.searchFacetsWidget.openOverlay()},S=()=>{M.searchstax.searchFacetsWidget.closeOverlay()},A=E=>{n.value[E.facetValue]=E.element},j=(E,z)=>(A({facetValue:z.value+"-desktop",element:E}),n.value),V=(E,z)=>(A({facetValue:z.value+"-mobile",element:E}),n.value);return i.onMounted(()=>{M.searchstax.addFacetsWidget("searchstax-facets-container"+c,{facetingType:e.facetingType,specificFacets:e.specificFacets,itemsPerPageDesktop:e.itemsPerPageDesktop,itemsPerPageMobile:e.itemsPerPageMobile,hooks:{beforeFacetsRender:e.beforeFacetsRender}}),u()}),(E,z)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-facets-container"+i.unref(c)},[l.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(zi,{key:0,facetsTemplateDataDesktop:a.value,isNotDeactivated:y,toggleFacetGroup:w,isChecked:b,selectFacet:C,showMoreLessDesktop:f,facetContainers:n.value,onUpdateRef:A,onUpdateRefDesktop:j},null,8,["facetsTemplateDataDesktop","facetContainers"])),l.value?(i.openBlock(),i.createElementBlock("div",co,[i.renderSlot(E.$slots,"desktopFacets",{facetsTemplateDataDesktop:a.value,isNotDeactivated:y,toggleFacetGroup:w,isChecked:b,selectFacet:C,showMoreLessDesktop:f,facetContainers:n.value,onUpdateRef:A,onUpdateRefDesktop:j})])):i.createCommentVNode("",!0),h.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(io,{key:2,facetsTemplateDataMobile:s.value,isNotDeactivated:y,toggleFacetGroup:w,isChecked:b,selectFacet:C,showMoreLessDesktop:f,showMoreLessMobile:L,facetContainers:n.value,openOverlay:T,selectedFacetsCheckboxes:o.value,unselectFacet:m,unselectAll:g,closeOverlay:S,onUpdateRef:A,onUpdateRefMobile:V},null,8,["facetsTemplateDataMobile","facetContainers","selectedFacetsCheckboxes"])),h.value?(i.openBlock(),i.createElementBlock("div",lo,[i.renderSlot(E.$slots,"mobileFacets",{facetsTemplateDataMobile:s.value,selectedFacetsCheckboxes:o.value,isNotDeactivated:y,toggleFacetGroup:w,isChecked:b,selectFacet:C,showMoreLessDesktop:f,facetContainers:n.value,openOverlay:T,unselectFacet:m,unselectAll:g,closeOverlay:S,onUpdateRef:A,onUpdateRefMobile:V})])):i.createCommentVNode("",!0)],8,oo))}}),uo={key:0,class:"searchstax-pagination-container"},po={class:"searchstax-pagination-content"},go=["disabled"],mo={class:"searchstax-pagination-details"},fo=["disabled"],Lo=i.defineComponent({__name:"SearchstaxPaginationWidgetDefaultTemplate",props:{paginationData:{type:Object,required:!0},nextPage:{type:Function,required:!0},previousPage:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s,n,o,c;return r.paginationData?(i.openBlock(),i.createElementBlock("div",uo,[i.createElementVNode("div",po,[i.createElementVNode("a",{class:i.normalizeClass(["searchstax-pagination-previous",r.paginationData.isFirstPage?"disabled":""]),disabled:(a=r.paginationData)==null?void 0:a.isFirstPage,onClick:t[0]||(t[0]=(...l)=>r.previousPage&&r.previousPage(...l)),onKeyup:[t[1]||(t[1]=i.withKeys((...l)=>r.previousPage&&r.previousPage(...l),["enter"])),t[2]||(t[2]=i.withKeys((...l)=>r.previousPage&&r.previousPage(...l),["space"]))],tabindex:"0",id:"searchstax-pagination-previous"}," < Previous ",42,go),i.createElementVNode("div",mo,i.toDisplayString((s=r.paginationData)==null?void 0:s.startResultIndex)+" - "+i.toDisplayString((n=r.paginationData)==null?void 0:n.endResultIndex)+" of "+i.toDisplayString((o=r.paginationData)==null?void 0:o.totalResults),1),i.createElementVNode("a",{class:i.normalizeClass(["searchstax-pagination-next",r.paginationData.isLastPage?"disabled":""]),disabled:(c=r.paginationData)==null?void 0:c.isLastPage,tabindex:"0",onClick:t[3]||(t[3]=(...l)=>r.nextPage&&r.nextPage(...l)),onKeyup:[t[4]||(t[4]=i.withKeys((...l)=>r.nextPage&&r.nextPage(...l),["enter"])),t[5]||(t[5]=i.withKeys((...l)=>r.nextPage&&r.nextPage(...l),["space"]))],id:"searchstax-pagination-next"},"Next >",42,fo)])])):i.createCommentVNode("",!0)}}}),yo={className:"searchstax-pagination-container"},wo=i.defineComponent({__name:"SearchstaxPaginationWidgetInfiniteScrollTemplate",props:{nextPage:{type:Function,required:!0}},setup(r){return(e,t)=>(i.openBlock(),i.createElementBlock("div",yo,[i.createElementVNode("a",{class:"searchstax-pagination-load-more",tabindex:"0",onClick:t[0]||(t[0]=(...a)=>r.nextPage&&r.nextPage(...a)),onKeyup:[t[1]||(t[1]=i.withKeys((...a)=>r.nextPage&&r.nextPage(...a),["enter"])),t[2]||(t[2]=i.withKeys((...a)=>r.nextPage&&r.nextPage(...a),["space"]))]},"Load More",32)]))}}),bo=["id"],Co={key:1},ko={key:3},xo=i.defineComponent({__name:"SearchstaxPaginationWidget",setup(r){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=i.ref(!1),n=m=>{M.searchstax.searchPaginationWidget.nextPage(m)},o=m=>{M.searchstax.searchPaginationWidget.previousPage(m)},c=()=>{M.searchstax.dataLayer.$searchObject.subscribe(()=>{l()}),M.searchstax.dataLayer.$paginationData.subscribe(m=>{t.value=m})},l=()=>{!s.value&&M.searchstax.routerHelper&&(s.value=!0,M.searchstax.addPaginationWidget("searchstax-pagination-container"+a,{}))},h=i.computed(()=>!!e.pagination),u=i.computed(()=>!!e.infiniteScroll);return i.onMounted(()=>{if(M.searchstax)c(),l();else throw Error("Searchstax instance needs to be passed via props")}),(m,g)=>{var y,w,b,C,f,L,T,S,A,j,V,E;return i.openBlock(),i.createElementBlock("div",{id:"searchstax-pagination-container"+i.unref(a)},[t.value&&!((y=t.value)!=null&&y.isInfiniteScroll)&&((w=t.value)==null?void 0:w.totalResults)!==0&&!h.value?(i.openBlock(),i.createBlock(Lo,{key:0,paginationData:t.value,nextPage:n,previousPage:o},null,8,["paginationData"])):i.createCommentVNode("",!0),h.value&&((b=t.value)==null?void 0:b.totalResults)!==0&&!((C=t.value)!=null&&C.isInfiniteScroll)?(i.openBlock(),i.createElementBlock("div",Co,[i.renderSlot(m.$slots,"pagination",{paginationData:t.value,nextPage:n,previousPage:o})])):i.createCommentVNode("",!0),t.value&&((f=t.value)!=null&&f.isInfiniteScroll)&&!((L=t.value)!=null&&L.isLastPage)&&((T=t.value)!=null&&T.hasResults)&&((S=t.value)==null?void 0:S.totalResults)!==0&&!u.value?(i.openBlock(),i.createBlock(wo,{key:2,nextPage:n})):i.createCommentVNode("",!0),u.value&&!((A=t.value)!=null&&A.isLastPage)&&((j=t.value)!=null&&j.hasResults)&&((V=t.value)==null?void 0:V.totalResults)!==0&&((E=t.value)!=null&&E.isInfiniteScroll)?(i.openBlock(),i.createElementBlock("div",ko,[i.renderSlot(m.$slots,"infiniteScroll",{paginationData:t.value,nextPage:n})])):i.createCommentVNode("",!0)],8,bo)}}}),Mo={key:0,class:"searchstax-feedback-container"},So={key:0},To={class:"searchstax-feedback-container-suggested"},Eo={key:0},Do=["aria-label"],Ao=i.defineComponent({__name:"SearchstaxSearchFeedbackWidgetTemplate",props:{searchFeedbackData:{type:Object,required:!0},onOriginalQueryClick:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s;return r.searchFeedbackData&&((a=r.searchFeedbackData)!=null&&a.searchExecuted)&&((s=r.searchFeedbackData)!=null&&s.totalResults)?(i.openBlock(),i.createElementBlock("h2",Mo,[t[4]||(t[4]=i.createTextVNode(" Showing ",-1)),i.createElementVNode("b",null,i.toDisplayString(r.searchFeedbackData.startResultIndex)+" - "+i.toDisplayString(r.searchFeedbackData.endResultIndex),1),t[5]||(t[5]=i.createTextVNode(" of ",-1)),i.createElementVNode("b",null,i.toDisplayString(r.searchFeedbackData.totalResults),1),t[6]||(t[6]=i.createTextVNode(" results ",-1)),r.searchFeedbackData.searchTerm?(i.openBlock(),i.createElementBlock("span",So,[t[1]||(t[1]=i.createTextVNode('for "',-1)),i.createElementVNode("b",null,i.toDisplayString(r.searchFeedbackData.searchTerm),1),t[2]||(t[2]=i.createTextVNode('" ',-1))])):i.createCommentVNode("",!0),i.createElementVNode("div",To,[r.searchFeedbackData.autoCorrectedQuery?(i.openBlock(),i.createElementBlock("div",Eo,[t[3]||(t[3]=i.createTextVNode(" Search instead for ",-1)),i.createElementVNode("a",{href:"#",onClick:t[0]||(t[0]=i.withModifiers(n=>r.onOriginalQueryClick(n),["prevent"])),class:"searchstax-feedback-original-query","aria-label":"Search instead for "+r.searchFeedbackData.originalQuery},i.toDisplayString(r.searchFeedbackData.originalQuery),9,Do)])):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)}}}),Io=["id"],vo=i.defineComponent({__name:"SearchstaxSearchFeedbackWidget",setup(r){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=c=>{M.searchstax.searchFeedbackWidget.onOriginalQueryClick(c)},n=()=>{M.searchstax.dataLayer.$searchFeedbackData.subscribe(c=>{t.value=c})},o=i.computed(()=>!!e.searchFeedback);return i.onMounted(()=>{if(M.searchstax)n(),M.searchstax.addSearchFeedbackWidget("search-feedback-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>{var h;return i.openBlock(),i.createElementBlock("div",{class:"search-feedback-container",id:"search-feedback-container"+i.unref(a)},[t.value&&t.value.searchExecuted&&!o.value&&((h=t.value)!=null&&h.totalResults)?(i.openBlock(),i.createBlock(Ao,{key:0,searchFeedbackData:t.value,onOriginalQueryClick:s},null,8,["searchFeedbackData"])):i.createCommentVNode("",!0),i.renderSlot(c.$slots,"searchFeedback",{searchFeedbackData:t.value,onOriginalQueryClick:s})],8,Io)}}}),jo={key:0,class:"searchstax-sorting-container"},No=["value"],Ro=["value"],Oo=i.defineComponent({__name:"SearchstaxSortingWidgetTemplate",props:{sortingData:{type:Object,required:!0},selectedSorting:{type:String,required:!0},orderChange:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s;return r.sortingData&&((a=r.sortingData)!=null&&a.searchExecuted)&&((s=r.sortingData)!=null&&s.hasResultsOrExternalPromotions)&&r.sortingData.sortOptions.length>0?(i.openBlock(),i.createElementBlock("div",jo,[t[1]||(t[1]=i.createElementVNode("label",{class:"searchstax-sorting-label",for:"searchstax-search-order-select"},"Sort By",-1)),i.createElementVNode("select",{id:"searchstax-search-order-select",class:"searchstax-search-order-select",value:r.selectedSorting,onChange:t[0]||(t[0]=n=>r.orderChange(n))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.sortingData.sortOptions,n=>(i.openBlock(),i.createElementBlock("option",{key:n.key,value:n.key},i.toDisplayString(n.value),9,Ro))),128))],40,No)])):i.createCommentVNode("",!0)}}}),Po=["id"],Fo=i.defineComponent({__name:"SearchstaxSortingWidget",setup(r){const e=i.useSlots(),t=i.ref(null),a=i.ref(""),s=Math.random(),n=l=>{M.searchstax.searchSortingWidget.setOrderQuery(l.target.value)},o=()=>{M.searchstax.dataLayer.$searchSortingData.subscribe(l=>{t.value=l}),M.searchstax.dataLayer.$searchObject.subscribe(l=>{a.value=decodeURIComponent(l.order)})},c=i.computed(()=>!!e.sorting);return i.onMounted(()=>{if(M.searchstax)o(),M.searchstax.addSearchSortingWidget("search-sorting-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")}),(l,h)=>{var u,m;return i.openBlock(),i.createElementBlock("div",{id:"search-sorting-container"+i.unref(s)},[t.value&&((u=t.value)!=null&&u.searchExecuted)&&((m=t.value)!=null&&m.hasResultsOrExternalPromotions)&&!c.value?(i.openBlock(),i.createBlock(Oo,{key:0,sortingData:t.value,selectedSorting:a.value,orderChange:n},null,8,["sortingData","selectedSorting"])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"sorting",{sortingData:t.value,orderChange:n,selectedSorting:a.value})],8,Po)}}}),$o={key:0,class:"searchstax-external-promotions-container",id:"searchstax-external-promotions-container"},Bo=["onClick"],Vo={class:"searchstax-search-result-title-container"},zo={class:"searchstax-search-result-title"},qo={key:1,class:"searchstax-search-result-description searchstax-search-result-common"},Wo={key:2,class:"searchstax-search-result-description searchstax-search-result-common"},Ho=i.defineComponent({__name:"SearchstaxExternalPromotionsWidgetTemplate",props:{externalPromotionsData:{type:Object,required:!0},trackClick:{type:Function,required:!1}},setup(r){return(e,t)=>{var a,s;return r.externalPromotionsData&&((a=r.externalPromotionsData)!=null&&a.searchExecuted)&&((s=r.externalPromotionsData)!=null&&s.hasExternalPromotions)?(i.openBlock(),i.createElementBlock("div",$o,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.externalPromotionsData.externalPromotions,n=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-external-promotion searchstax-search-result",key:n.id},[t[0]||(t[0]=i.createElementVNode("div",{class:"icon-elevated"},null,-1)),n.url?(i.openBlock(),i.createElementBlock("a",{key:0,href:"{{externalPromotion.url}}",onClick:o=>r.trackClick(n,o),class:"searchstax-result-item-link"},null,8,Bo)):i.createCommentVNode("",!0),i.createElementVNode("div",Vo,[i.createElementVNode("span",zo,i.toDisplayString(n.name),1)]),n.description?(i.openBlock(),i.createElementBlock("p",qo,i.toDisplayString(n.description),1)):i.createCommentVNode("",!0),n.url?(i.openBlock(),i.createElementBlock("p",Wo,i.toDisplayString(n.url),1)):i.createCommentVNode("",!0)]))),128))])):i.createCommentVNode("",!0)}}}),_o=["id"],Qo=i.defineComponent({__name:"SearchstaxExternalPromotionsWidget",setup(r){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=()=>{M.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(c=>{t.value=c})},n=(c,l)=>{M.searchstax.externalPromotionsWidget.trackClick(c,l)},o=i.computed(()=>!!e.externalPromotions);return i.onMounted(()=>{if(M.searchstax)s(),M.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-external-promotions-layout-container"+i.unref(a)},[o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Ho,{key:0,externalPromotionsData:t.value,trackClick:n},null,8,["externalPromotionsData"])),i.renderSlot(c.$slots,"externalPromotions",{externalPromotionsData:t.value,trackClick:n})],8,_o))}}),Uo={key:0,class:"searchstax-related-searches-container",id:"searchstax-related-searches-container"},Yo={key:0,class:"searchstax-related-search"},Jo=["onClick","onKeyup","aria-label"],Go={key:0},Ko=i.defineComponent({__name:"SearchstaxRelatedSearchesWidgetTemplate",props:{relatedData:{type:Object,required:!0},executeSearch:{type:Function,required:!0}},setup(r){return(e,t)=>{var a,s;return r.relatedData&&((a=r.relatedData)!=null&&a.searchExecuted)&&((s=r.relatedData)!=null&&s.hasRelatedSearches)?(i.openBlock(),i.createElementBlock("div",Uo,[t[0]||(t[0]=i.createTextVNode(" Related searches: ",-1)),t[1]||(t[1]=i.createElementVNode("span",{id:"searchstax-related-searches"},null,-1)),r.relatedData.relatedSearches?(i.openBlock(),i.createElementBlock("span",Yo,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.relatedData.relatedSearches,n=>(i.openBlock(),i.createElementBlock("span",{key:n.related_search,onClick:o=>r.executeSearch(n),onKeyup:[i.withKeys(o=>r.executeSearch(n),["enter"]),i.withKeys(o=>r.executeSearch(n),["space"])],tabindex:"0",class:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+n.related_search},[i.createTextVNode(i.toDisplayString(n.related_search),1),n.last?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",Go,","))],40,Jo))),128))])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)}}}),Zo=i.defineComponent({__name:"SearchstaxRelatedSearchesWidget",props:{relatedSearchesURL:{},relatedSearchesAPIKey:{}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=c=>{M.searchstax.relatedSearchesWidget.executeSearch(c)},n=()=>{M.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(c=>{a.value=c})},o=i.computed(()=>!!t.related);return i.onMounted(()=>{if(M.searchstax)n(),M.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container",{relatedSearchesURL:e.relatedSearchesURL,relatedSearchesAPIKey:e.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>{var h,u;return i.openBlock(),i.createElementBlock(i.Fragment,null,[a.value&&((h=a.value)!=null&&h.searchExecuted)&&((u=a.value)!=null&&u.hasRelatedSearches)&&!o.value?(i.openBlock(),i.createBlock(Ko,{key:0,relatedData:a.value,executeSearch:s},null,8,["relatedData"])):i.createCommentVNode("",!0),i.renderSlot(c.$slots,"related",{relatedData:a.value,executeSearch:s})],64)}}}),Xo={key:0},ec={class:"searchstax-answer-wrap"},tc=["innerHTML"],ac=["innerHTML"],sc={key:1,class:"searchstax-answer-loading"},rc={key:0,class:"searchstax-answer-load-more-button-container"},nc=i.defineComponent({__name:"SearchstaxAnswerWidgetTemplate",props:{answerData:{type:Object,required:!0},showMore:{type:Function,required:!1}},setup(r){return(e,t)=>{var a;return r.answerData&&((a=r.answerData)!=null&&a.searchExecuted)&&r.answerData.shouldShowAnswer?(i.openBlock(),i.createElementBlock("div",Xo,[i.createElementVNode("div",ec,[t[2]||(t[2]=i.createElementVNode("div",{class:"searchstax-answer-icon"},null,-1)),i.createElementVNode("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"searchstax-answer-container":!0,"searchstax-answer-show-more":r.answerData.showMoreButtonVisible})},[t[1]||(t[1]=i.createElementVNode("div",{class:"searchstax-answer-title"},"Smart Answers",-1)),r.answerData.shouldShowAnswerError?(i.openBlock(),i.createElementBlock("div",{key:0,class:"searchstax-answer-error",innerHTML:r.answerData.answerErrorMessage},null,8,tc)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"searchstax-answer-description",innerHTML:r.answerData.fullAnswerFormatted},null,8,ac),r.answerData.answerLoading?(i.openBlock(),i.createElementBlock("div",sc)):i.createCommentVNode("",!0)],2),r.answerData.showMoreButtonVisible?(i.openBlock(),i.createElementBlock("div",rc,[i.createElementVNode("button",{class:"searchstax-answer-load-more-button",onClick:t[0]||(t[0]=(...s)=>r.showMore&&r.showMore(...s))},"Show More")])):i.createCommentVNode("",!0)]),t[3]||(t[3]=i.createElementVNode("div",{class:"searchstax-answer-footer"},[i.createElementVNode("div",{id:"feedbackWidgetContainer"}),i.createElementVNode("div",{class:"searchstax-lightweight-widget-separator-inline"}),i.createElementVNode("p",{class:"searchstax-disclaimer"},"Generative AI is Experimental")],-1))])])):i.createCommentVNode("",!0)}}}),ic=["id"],oc=i.defineComponent({__name:"SearchstaxAnswerWidget",props:{showMoreAfterWordCount:{},feedbackwidget:{},testString:{}},setup(r){const e=r,t=i.useSlots(),a=i.ref(null),s=Math.random(),n=()=>{M.searchstax.dataLayer.$answerData.subscribe(l=>{a.value=l})},o=l=>{var h;M.searchstax&&((h=M.searchstax.answerWidget)==null||h.showMore(l))},c=i.computed(()=>!!t.answer);return i.onMounted(()=>{if(M.searchstax)n(),M.searchstax.addAnswerWidget("searchstax-answer-container"+s,{showMoreAfterWordCount:e.showMoreAfterWordCount,feedbackwidget:e.feedbackwidget,testString:e.testString});else throw Error("Searchstax instance needs to be passed via props")}),(l,h)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-answer-container"+i.unref(s)},[!c.value&&a.value?(i.openBlock(),i.createBlock(nc,{key:0,answerData:a.value,showMore:o},null,8,["answerData"])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"answer",{answerData:a.value,showMore:o})],8,ic))}});Z.SearchstaxAnswerWidget=oc,Z.SearchstaxExternalPromotionsWidget=Qo,Z.SearchstaxFacetsWidget=ho,Z.SearchstaxInputWidget=ri,Z.SearchstaxLocationWidget=bs,Z.SearchstaxPaginationWidget=xo,Z.SearchstaxRelatedSearchesWidget=Zo,Z.SearchstaxResultWidget=Di,Z.SearchstaxSearchFeedbackWidget=vo,Z.SearchstaxSortingWidget=Fo,Z.SearchstaxWrapper=Hn,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})})(this["@searchstaxInc/searchstudioUxVue"]=this["@searchstaxInc/searchstudioUxVue"]||{},vue);
|
|
440
|
+
`,thumbsUpButtonClass:"searchstax-lightweight-widget-thumbs-up",thumbsDownButtonClass:"searchstax-lightweight-widget-thumbs-down"}};class E{}u(E,"answer",Hr),u(E,"externalPromotions",Ur),u(E,"facets",Yr),u(E,"pagination",_r),u(E,"relatedSearches",Jr),u(E,"searchFeedback",Gr),u(E,"searchInput",Kr),u(E,"location",Zr),u(E,"searchResults",Xr),u(E,"sorting",ei),u(E,"feedback",Z);class ti{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)||E.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,r,o;const t=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;if(t){const c=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.externalPromotion)==null?void 0:r.template)||((o=E.externalPromotions.externalPromotion)==null?void 0:o.template);if(typeof document<"u"){const l=document==null?void 0:document.createElement("div");l.classList.add("searchstax-external-promotion"),l.addEventListener("click",d=>{this.trackClick(e,d)}),l.innerHTML=$.render(c,e),t.appendChild(l)}}}trackClick(e,t){t.stopPropagation(),t.preventDefault(),window==null||window.open(e.url,"_blank")}renderMainTemplate(e){var a,s,r,o;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplate)==null?void 0:r.template)||((o=E.externalPromotions.mainTemplate)==null?void 0:o.template);if(this.dataLayer.renderingEngine===z.mustache){this.searchExternalPromotionsMainContainer.innerHTML=$.render(t,e);const c=typeof document<"u"?document==null?void 0:document.getElementById(this.externalPromotionsContainerId):null;c&&(c.innerHTML="");for(const l of e.externalPromotions)this.addExternalSearch(l)}}}class ee{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",r=document.getElementById(s);r&&r.remove();const o=document.createElement("span");o.setAttribute("id",s),o.innerHTML=e;const c=document.getElementById("searchAccessibilityContainer");c&&setTimeout(()=>{c.appendChild(o)},t??100)}}class ai{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,s,r)=>{if(e.stopPropagation(),!t.disabled){const o=a.querySelector("input");let c=s?o.checked:!o.checked;r!==void 0&&(c=!r),o.checked=c;const l=this.dataLayer.searchObject;let d=[...l.facets];const p=this.extractFacetValue(t);c?d.find(g=>ge.deepEqual(g,p)?g:!1)||(this.config.facetingType==="tabs"&&(d=d.filter(g=>g.name!==p.name)),d.push(p)):d=d.filter(g=>!ge.deepEqual(g,p)),setTimeout(()=>{this.dataLayer.setSearchObject({...l,facets:d,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,s=t?this.facetLimits:this.facetLimitsMobile;return e.forEach(r=>{s[r.name]||(s[r.name]=a)}),e.map(r=>({...r,values:r.values.slice(0,s[r.name]),showingAllFacets:r.values.length<=s[r.name],hasMoreFacets:r.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(r=>{var c;const o=(c=this.dataLayer.searchFacets)==null?void 0:c.find(l=>l.name===r.name);return o?{...r,values:r.values.map(l=>{const d=o.values.find(p=>l.type==="range"?!1:l.type==="checkbox"?p.value===l.value:!1);return{...l,disabled:!d,isMobile:e}})}:{...r,values:r.values.map(l=>({...l,disabled:!0})),isMobile:e}}))),this.config.specificFacets&&(a=a.filter(r=>{var o;return(o=this.config.specificFacets)==null?void 0:o.includes(r.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,r,o,c,l,d,p,g,m,C,x,b,k,A,N,R;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=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.facetItemContainerTemplate)==null?void 0:o.template)||((c=E.facets.facetItemContainerTemplate)==null?void 0:c.template);I.innerHTML=$.render(y,e),t.appendChild(I);const L=I.querySelector("."+(((p=(d=(l=this.config)==null?void 0:l.templates)==null?void 0:d.facetItemContainerTemplate)==null?void 0:p.facetListTitleContainerClass)||((g=E.facets.facetItemContainerTemplate)==null?void 0:g.facetListTitleContainerClass)));L==null||L.addEventListener("click",()=>{I.classList.toggle("active");const M=I.classList.contains("active"),v=L.querySelector(".searchstax-facet-title");v&&v.setAttribute("aria-expanded",String(M))}),(b=L==null?void 0:L.querySelector("."+((x=(C=(m=this.config)==null?void 0:m.templates)==null?void 0:C.facetItemContainerTemplate)==null?void 0:x.facetListTitleContainerInner)))==null||b.addEventListener("keydown",M=>{if(M.code==="Enter"||M.code==="Space"){M.preventDefault(),I.classList.toggle("active");const v=I.classList.contains("active"),H=L.querySelector(".searchstax-facet-title");H&&H.setAttribute("aria-expanded",String(v))}});const D=I.querySelector("."+(((N=(A=(k=this.config)==null?void 0:k.templates)==null?void 0:A.facetItemContainerTemplate)==null?void 0:N.facetListContainerClass)||((R=E.facets.facetItemContainerTemplate)==null?void 0:R.facetListContainerClass)));D&&(e.values.forEach(M=>{this.createFacetListItem(M,D,e.name)}),e.hasMoreFacets&&this.createHasMoreComponent(e,D,a))}}isChecked(e){var t;return!!((t=this.dataLayer.searchObject.facets)!=null&&t.find(a=>ge.deepEqual(a,this.extractFacetValue(e))))}createFacetListItem(e,t,a){var s,r,o,c,l,d,p,g,m,C,x,b;if(typeof document<"u"){const k=document==null?void 0:document.createElement("div");k.classList.add("searchstax-facet-value-container"),e.disabled&&k.classList.add("searchstax-facet-value-disabled");const A=this.isChecked(e),N=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.facetItemTemplate)==null?void 0:o.template)||((c=E.facets.facetItemTemplate)==null?void 0:c.template);k.innerHTML=$.render(N,{...e,isChecked:A});let R=(l=E.facets.facetItemTemplate)==null?void 0:l.checkTriggerClasses;R=((g=(p=(d=this.config)==null?void 0:d.templates)==null?void 0:p.facetItemTemplate)==null?void 0:g.checkTriggerClasses)||R,R.forEach(y=>{var L;(L=k.querySelector("."+y))==null||L.addEventListener("click",D=>{this.onFacetSelect(D,e,k)})});const I=k.querySelector("."+(((x=(C=(m=this.config)==null?void 0:m.templates)==null?void 0:C.facetItemTemplate)==null?void 0:x.inputCheckboxClass)||((b=E.facets.facetItemTemplate)==null?void 0:b.inputCheckboxClass)));I==null||I.addEventListener("click",y=>{this.onFacetSelect(y,e,k,!0)}),I&&(I==null||I.setAttribute("data-test-value",`${encodeURIComponent(a)}:"${encodeURIComponent(e.value)}"`)),t.appendChild(k)}}createHasMoreComponent(e,t,a){var s,r,o,c,l,d,p,g,m,C;if(typeof document<"u"){const x=document==null?void 0:document.createElement("div");x.classList.add("searchstax-facet-show-more-container");const b=((o=(r=(s=this.config)==null?void 0:s.templates)==null?void 0:r.showMoreButtonContainerTemplate)==null?void 0:o.template)||((c=E.facets.showMoreButtonContainerTemplate)==null?void 0:c.template);x.innerHTML=$.render(b,{...e,focusId:`moreLess${(d=(l=e==null?void 0:e.values)==null?void 0:l[0])==null?void 0:d.value}`});const k=x.querySelector("."+(((m=(g=(p=this.config)==null?void 0:p.templates)==null?void 0:g.showMoreButtonContainerTemplate)==null?void 0:m.showMoreButtonClass)||((C=E.facets.showMoreButtonContainerTemplate)==null?void 0:C.showMoreButtonClass)));k&&(this.attachOnclickToShowMore(e,k,a),t&&t.appendChild(k))}}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,r=a?this.facetLimits:this.facetLimitsMobile;r[t.name]===void 0?r[t.name]=s*2:r[t.name]<=t.values.length?(ee.setAccessibilityText(`More Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),r[t.name]=r[t.name]+s):(ee.setAccessibilityText(`Less Facets shown for ${t.label}`,0,`moreLess${new Date().getTime()}`),r[t.name]=s),this.generateTemplateData(a),this.renderMainTemplate(this.generateTemplateData())}renderMainTemplate(e,t){var a,s,r,o,c,l,d,p,g,m,C;if(e&&(!ge.deepEqual(this.cachedData??{},e)||t)){this.cachedData=e;const x=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.mainTemplateDesktop)==null?void 0:r.template)||((o=E.facets.mainTemplateDesktop)==null?void 0:o.template);if(this.dataLayer.renderingEngine===z.mustache&&this.searchFacetsMainContainer){const b=document.activeElement;b instanceof HTMLInputElement&&b.type==="checkbox"||b!=null&&b.classList.contains("searchstax-facet-show-more-button")||b!=null&&b.classList.contains("searchstax-facet-show-less-button")?this.focusedElement=b:this.focusedElement=null,this.searchFacetsMainContainer.innerHTML=$.render(x,{...e});const k=(p=this.searchFacetsMainContainer)==null?void 0:p.querySelector("."+(((d=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplateDesktop)==null?void 0:d.facetsContainerClass)||E.facets.mainTemplateDesktop.facetsContainerClass));if(k){k.innerHTML="";for(const A of e.facets)this.createFacetItem(A,k);if(this.searchFacetsMainContainer){const A=this.searchFacetsMainContainer.querySelector("."+(((C=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.mainTemplateDesktop)==null?void 0:C.selectedFacetsContainerClass)||E.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 R=this.focusedElement.getAttribute("data-focus"),I=this.searchFacetsMainContainer.querySelector(`[data-focus="${R}"]`);I instanceof HTMLElement&&I.focus(),this.focusedElement=null;return}const A=this.focusedElement.getAttribute("data-test-value"),N=this.searchFacetsMainContainer.querySelector(`[data-test-value="${A}"]`);N instanceof HTMLInputElement&&N.focus(),this.focusedElement=null}}}setTimeout(()=>{document.querySelectorAll(".searchstax-facet-title").forEach(b=>{b.setAttribute("aria-expanded",String(!0)),b.setAttribute("tabindex","0"),b.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 s of t){const r=decodeURIComponent(s.name),o=decodeURIComponent(s.value);if(this.dataLayer.searchFacets){const c=(a=this.componentFacets)==null?void 0:a.find(l=>l.name===r);if(c){const l=c.values.find(d=>d.type==="range"?!1:d.type==="checkbox"?`"${d.value}"`==`"${o}"`:!1);l&&e.push(l)}}}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,r,o,c,l,d;if(typeof document<"u"){const p=this.dataLayer.searchObject,g=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.clearFacetsTemplate)==null?void 0:s.template)||((r=E.facets.clearFacetsTemplate)==null?void 0:r.template),m=document==null?void 0:document.createElement("div");m.innerHTML=$.render(g,{shouldShow:p.facets.length>0});const C=m.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.clearFacetsTemplate)==null?void 0:l.containerClass)||((d=E.facets.clearFacetsTemplate)==null?void 0:d.containerClass)));C&&(C.addEventListener("click",()=>{this.removeSelectedFacets()}),C.addEventListener("keyup",x=>{(x.code==="Space"||x.code==="Enter")&&this.removeSelectedFacets()}),e.appendChild(C))}}createSelectedFacetsComponent(e,t){var a,s,r,o,c,l,d,p;if(typeof document<"u"){const g=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.selectedFacetsTemplate)==null?void 0:r.template)||((o=E.facets.selectedFacetsTemplate)==null?void 0:o.template),m=document==null?void 0:document.createElement("div");m.innerHTML=$.render(g,t);const C=m.querySelector("."+(((d=(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.selectedFacetsTemplate)==null?void 0:d.containerClass)||((p=E.facets.selectedFacetsTemplate)==null?void 0:p.containerClass)));C&&(C.addEventListener("click",()=>{this.unselectFacet(t)}),C.addEventListener("keyup",x=>{(x.code==="Space"||x.code==="Enter")&&this.unselectFacet(t)}),e.appendChild(C))}}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,r,o,c,l,d;if(typeof document<"u"){const p=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.filterByTemplate)==null?void 0:s.template)||((r=E.facets.filterByTemplate)==null?void 0:r.template),g=document==null?void 0:document.createElement("div");g.innerHTML=$.render(p,{});const m=g.querySelector("."+(((l=(c=(o=this.config)==null?void 0:o.templates)==null?void 0:c.filterByTemplate)==null?void 0:l.containerClass)||((d=E.facets.filterByTemplate)==null?void 0:d.containerClass)));m&&(e.prepend(m),m.addEventListener("click",this.openOverlay.bind(this)),m.addEventListener("keyup",C=>{(C.code==="Space"||C.code==="Enter")&&this.openOverlay()}))}}openOverlay(){var e;ee.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;ee.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,r,o,c,l,d,p,g,m,C,x,b,k,A,N,R,I;if(e&&typeof document<"u"){const y=document==null?void 0:document.createElement("div");y.classList.add("searchstax-facets-container-mobile");const L=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplateMobile)==null?void 0:s.template)||((r=E.facets.mainTemplateMobile)==null?void 0:r.template);if(this.dataLayer.renderingEngine===z.mustache){if(y.innerHTML=$.render(L,{...e,overlayOpened:this.overlayOpened}),(o=this.searchFacetsMainContainer)==null||o.appendChild(y),(l=(c=this.config)==null?void 0:c.templates)==null?void 0:l.mainTemplateMobile)for(const H of((g=(p=(d=this.config)==null?void 0:d.templates)==null?void 0:p.mainTemplateMobile)==null?void 0:g.closeOverlayTriggerClasses)||[]){const ne=y.querySelector("."+H);ne&&(ne.addEventListener("click",this.closeOverlay.bind(this)),ne.addEventListener("keyup",ye=>{(ye.code==="Space"||ye.code==="Enter")&&this.closeOverlay()}))}else for(const H of E.facets.mainTemplateMobile.closeOverlayTriggerClasses){const ne=y.querySelector("."+H);ne&&(ne.addEventListener("click",this.closeOverlay.bind(this)),ne.addEventListener("keyup",ye=>{(ye.code==="Space"||ye.code==="Enter")&&this.closeOverlay()}))}const D=y.querySelector("."+(((x=(C=(m=this.config)==null?void 0:m.templates)==null?void 0:C.mainTemplateMobile)==null?void 0:x.filterByContainerClass)||E.facets.mainTemplateMobile.filterByContainerClass));D&&this.createFilterByComponent(D);const M=y.querySelector("."+(((A=(k=(b=this.config)==null?void 0:b.templates)==null?void 0:k.mainTemplateMobile)==null?void 0:A.selectedFacetsContainerClass)||E.facets.mainTemplateMobile.selectedFacetsContainerClass));M&&(this.createSelectedFacetsComponents(M),this.createClearFacetsComponents(M));const v=y.querySelector("."+(((I=(R=(N=this.config)==null?void 0:N.templates)==null?void 0:R.mainTemplateMobile)==null?void 0:I.facetsContainerClass)||E.facets.mainTemplateMobile.facetsContainerClass));if(v){v.innerHTML="";for(const H of e.facets)this.createFacetItem(H,v,!0)}}}}}class si{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,s,r,o,c,l,d,p;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)??E.pagination.mainTemplate.previousButtonClass,this.nextButtonClass=((c=(o=(r=this.config)==null?void 0:r.templates)==null?void 0:o.mainTemplate)==null?void 0:c.nextButtonClass)??E.pagination.mainTemplate.nextButtonClass,this.loadMoreButtonClass=((p=(d=(l=this.config)==null?void 0:l.templates)==null?void 0:d.infiniteScrollTemplate)==null?void 0:p.loadMoreButtonClass)??E.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,r;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:(r=this.routerHelper)==null?void 0:r.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 r=s.querySelector('[tabindex="0"]');r instanceof HTMLElement&&r.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,r,o,c,l,d,p,g,m;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=((c=(o=(r=this.config)==null?void 0:r.templates)==null?void 0:o.mainTemplate)==null?void 0:c.template)||((l=E.pagination.mainTemplate)==null?void 0:l.template);this.dataLayer.isInfiniteScroll&&(t=((g=(p=(d=this.config)==null?void 0:d.templates)==null?void 0:p.infiniteScrollTemplate)==null?void 0:g.template)||((m=E.pagination.infiniteScrollTemplate)==null?void 0:m.template)),this.dataLayer.renderingEngine===z.mustache&&(this.searchPaginationMainContainer.innerHTML=$.render(t,e),setTimeout(()=>{this.overridePaginationEvents()},0))}}class ni{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)||E.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,r,o,c;if(typeof document<"u"){const l=document==null?void 0:document.createElement("div"),d=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.relatedSearch)==null?void 0:r.template)||E.relatedSearches.relatedSearch.template;if(this.dataLayer.renderingEngine===z.mustache){l.innerHTML=$.render(d,e);const p=l.querySelector("."+(((c=(o=this.config.templates)==null?void 0:o.relatedSearch)==null?void 0:c.relatedSearchContainerClass)||E.relatedSearches.relatedSearch.relatedSearchContainerClass));p&&(t.appendChild(p),p.addEventListener("click",()=>{this.executeSearch(e)}),p.addEventListener("keyup",g=>{(g.code==="Space"||g.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,r,o;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:r.template)||E.relatedSearches.main.template;if(this.dataLayer.renderingEngine===z.mustache&&this.searchRelatedSearchesMainContainer){this.searchRelatedSearchesMainContainer.innerHTML="",this.searchRelatedSearchesMainContainer.innerHTML=$.render(t,e);const c=(o=this.searchRelatedSearchesMainContainer)==null?void 0:o.querySelector(`.${this.relatedSearchesContainerClass}`);if(c)for(const l of e.relatedSearches)this.addRelatedSearchComponent(l,c)}}}class ri{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,s,r,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)||((r=E.searchFeedback.main)==null?void 0:r.originalQueryClass)));e&&e.addEventListener("click",this.onOriginalQueryClick.bind(this))}renderMainTemplate(e){var a,s,r;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:r.template)||E.searchFeedback.main.template;this.dataLayer.renderingEngine===z.mustache&&(this.searchFeedbackMainContainer.innerHTML=$.render(t,e),setTimeout(()=>{this.attachClick()},0))}}class ii{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,s;if(typeof document<"u"){const r=document==null?void 0:document.getElementById(this.containerId);if(!r)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)||E.searchInput.mainTemplate.template,c={...this.dataLayer.parsedData.data,locationEnabled:!!this.dataLayer.locationEnabled,hasInputValue:!1};if(this.dataLayer.setInputWidgetTemplateData(c),this.dataLayer.renderingEngine===z.mustache){const p=$.render(o,c);r.innerHTML=p,this.dataLayer.setInputTemplateRendered(!0)}const l=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.searchInputId)||E.searchInput.mainTemplate.searchInputId,d=document==null?void 0:document.querySelector(`#${l}`);if(d)this.searchInput=d,d.addEventListener("keyup",this.inputKeyupEvent.bind(this)),d.addEventListener("blur",this.hideAutosuggest.bind(this)),d.addEventListener("paste",this.inputPasteEvent.bind(this));else throw new Error("Input not found")}}createAutosuggestContainer(){var e;this.dataLayer.renderingEngine===z.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 s,r,o,c;const t=e.length>0;t?((s=this.clearButton)==null||s.classList.remove("hidden"),(r=this.separatorIcon)==null||r.classList.remove("hidden")):((o=this.clearButton)==null||o.classList.add("hidden"),(c=this.separatorIcon)==null||c.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)),ee.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,ee.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"),ee.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)),ee.setAccessibilityText("No Suggestion selected")},200)}cleanSuggestionTerm(e){return se.removeXSSRiskyTags(e.replace(/(<([^>]+)>)/gi,"")).trim()}autosuggestItemClicked(e){this.searchInput.value=this.cleanSuggestionTerm(e.term??""),this.executeSearch(this.cleanSuggestionTerm(e.term))}createAutosuggestItem(e){var s,r,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=((r=(s=this.config.templates)==null?void 0:s.autosuggestItemTemplate)==null?void 0:r.template)||((o=E.searchInput.autosuggestItemTemplate)==null?void 0:o.template);return t.innerHTML=$.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 r=a[s];r.numFound?ee.setAccessibilityText("Suggestions are available. Use up and down arrows to navigate while focusing input. Use Escape key to escape out of the suggestions",2e3):ee.setAccessibilityText("",0),this.autosuggestResults=r,this.dataLayer.setAutosuggestResults(r),r.numFound>0?r.suggestions.forEach(o=>{this.autosuggestContainer&&typeof document<"u"&&this.autosuggestContainer.appendChild(this.createAutosuggestItem(o))}):this.autosuggestContainer&&this.autosuggestContainer.classList.add("hidden")}}}}class oi{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(()=>{ee.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,r,o,c;const e=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.noSearchResultTemplate)==null?void 0:r.template)||((o=E.searchResults.noSearchResultTemplate)==null?void 0:o.template),t=((c=this.dataLayer.searchResultsMetadata)==null?void 0:c.spellingSuggestion)??"";if(this.dataLayer.renderingEngine===z.mustache&&this.searchResultsContainer&&(this.searchResultsContainer.innerHTML=$.render(e,{spellingSuggestion:t,...this.dataLayer.parsedData.data,searchCallback:this.searchCallback.bind(this)})),t&&this.searchResultsContainer){const l=this.searchResultsContainer.querySelector("a");l&&l.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),this.searchCallback(t)})}}renderResults(e){var t,a,s,r,o;if(this.dataLayer.renderingEngine===z.mustache&&this.searchResultsContainer)if(this.removeLinkClickEvents(),e.length===0)ee.setAccessibilityText("Search has no results"),this.renderNoResultsTemplate();else{ee.setAccessibilityText(`Showing ${this.dataLayer.parsedData.startResultIndex} through ${this.dataLayer.parsedData.endResultIndex} results from ${this.dataLayer.parsedData.totalResults}. Press tab to navigate through results`);const c=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.searchResultTemplate)==null?void 0:s.template)||((r=E.searchResults.searchResultTemplate)==null?void 0:r.template),l=e.map(d=>$.render(c,d));((o=this.config)==null?void 0:o.renderMethod)==="infiniteScroll"&&this.dataLayer.searchObject.page>1?this.searchResultsContainer.innerHTML+=l.join(""):this.searchResultsContainer.innerHTML=l.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=E.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,r;const e=((s=(a=(t=this.config)==null?void 0:t.templates)==null?void 0:a.mainTemplate)==null?void 0:s.template)||((r=E.searchResults.mainTemplate)==null?void 0:r.template);this.dataLayer.renderingEngine===z.mustache&&(this.searchResultsMainContainer.innerHTML=$.render(e,{}),setTimeout(()=>{var l,d,p,g,m,C,x;const o=(p=(d=(l=this.config)==null?void 0:l.templates)==null?void 0:d.mainTemplate)!=null&&p.searchResultsContainerId?(C=(m=(g=this.config)==null?void 0:g.templates)==null?void 0:m.mainTemplate)==null?void 0:C.searchResultsContainerId:(x=E.searchResults.mainTemplate)==null?void 0:x.searchResultsContainerId,c=document==null?void 0:document.getElementById(o);if(c)this.searchResultsContainer=c;else throw new Error(`Search Results Container with id ${o} not found`)},0))}}class ci{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)||E.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,r;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:r.template)||E.sorting.main.template;if(this.dataLayer.renderingEngine===z.mustache){this.searchSortingMainContainer.innerHTML=$.render(t,e),this.markOptionSelected();const o=document==null?void 0:document.getElementById(this.selectId);o&&o.addEventListener("change",c=>{this.setOrderQuery(c.target.value)})}}}class li{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(){me.attachAnalyticsScript(this.analyticsSrc),this.renderMainTemplate(this.generateTemplateData())}generateTemplateData(){return this.templateData}renderMainTemplate(e){var s,r;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=Z==null?void 0:Z.mainTemplate)==null?void 0:s.template;if(this.mainTemplateOverride&&(a=this.mainTemplateOverride),this.isLightweight&&(a=(r=Z.lightweightTemplate)==null?void 0:r.template,this.lightweightTemplateOverride&&(a=this.lightweightTemplateOverride)),this.mainContainer.innerHTML=$.render(a,e),this.focusedElement&&this.mainContainer){const o=this.focusedElement.type==="radio"?this.focusedElement.getAttribute("id"):this.focusedElement.getAttribute("class"),c=this.focusedElement.type==="radio"?"id":"class",l=this.mainContainer.querySelector(`[${c}="${o}"]`);(l instanceof HTMLInputElement||l instanceof HTMLButtonElement||l instanceof HTMLTextAreaElement||l instanceof HTMLAnchorElement)&&l.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],r=a[a.length-1];e.key==="Tab"&&(e.shiftKey?(document.activeElement===s||!t.contains(document.activeElement))&&(e.preventDefault(),r==null||r.focus()):(document.activeElement===r||!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=Z.mainTemplate)==null?void 0:t.modalContainerClass;return((a=this.mainContainer)==null?void 0:a.querySelector(`.${e}`))||null}attachLightweightEvents(){var r,o,c,l;const e=(r=Z.lightweightTemplate)==null?void 0:r.thumbsUpButtonClass,t=(o=Z.lightweightTemplate)==null?void 0:o.thumbsDownButtonClass,a=(c=this.mainContainer)==null?void 0:c.querySelector("."+e),s=(l=this.mainContainer)==null?void 0:l.querySelector("."+t);a&&a.addEventListener("click",()=>{const d=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[this.templateData.ratings.length-1].isSelected&&this.ratedQuestion===d||(this.templateData.thumbsUpActive=!0,this.templateData.thumbsDownActive=!1,this.templateData.ratings.forEach(p=>{p.isSelected=p.index===this.thumbsUpValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=d,this.submit())}),s&&s.addEventListener("click",()=>{const d=this.feedbackTextAreaOverride&&this.isLightweight?this.feedbackTextAreaOverride():this.templateData.feedbackTextArea;this.templateData.ratings[0].isSelected&&this.ratedQuestion===d||(this.templateData.thumbsUpActive=!1,this.templateData.thumbsDownActive=!0,this.templateData.ratings.forEach(p=>{p.isSelected=p.index===this.thumbsDownValue}),this.renderMainTemplate(this.generateTemplateData()),this.ratedQuestion=d,this.submit())})}attachSubmitButtonEvents(){var a,s;const e=(a=Z.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=Z.mainTemplate)==null?void 0:t.emailInputId));this.validateEmail(e.value)?this.templateData.errors.email=!1:(this.templateData.errors.email=!0,ee.setAccessibilityText("Please enter a valid email address.")),this.templateData.ratings.some(s=>s.isSelected)?this.templateData.errors.rating=!1:(this.templateData.errors.rating=!0,ee.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(r=>r.isSelected))==null?void 0:t.index;e!==void 0&&(me.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(),ee.setAccessibilityText("Feedback has been sent.",1e3),(s=this.mainContainer)!=null&&s.querySelector("."+((a=Z.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=Z.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,ee.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=Z.mainTemplate)==null?void 0:t.feedbackTextAreaId));e&&e.addEventListener("input",()=>{var r,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("."+((r=Z.mainTemplate)==null?void 0:r.charactersRemainingContainerclass));s&&(s.innerText=this.templateData.charactersLeft+"")})}attachRatingEvents(){var a,s;const e=(a=Z.mainTemplate)==null?void 0:a.ratingInputclass,t=(s=this.mainContainer)==null?void 0:s.querySelectorAll("."+e);t&&t.forEach(r=>{r.addEventListener("click",o=>{const c=o.target.value;this.templateData.ratings.forEach(l=>{l.isSelected=l.index+""===c}),this.templateData.errors.rating=!1,this.renderMainTemplate(this.generateTemplateData())})})}attachOpenModalEvent(){var a,s;const e=(a=Z.mainTemplate)==null?void 0:a.openModalButtonClass,t=(s=this.mainContainer)==null?void 0:s.querySelector("."+e);t&&t.addEventListener("click",r=>{r.preventDefault(),this.toggleModal()})}toggleModal(){this.templateData.feedbackOpen?this.closeFeedbackModal():this.openFeedbackModal()}closeModalEvent(){var a,s;const e=(a=Z.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),ee.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),ee.setAccessibilityText("Feedback form closed",1e3)}showCheckmarkAnimation(){var c,l,d,p,g,m;const e=(c=Z.mainTemplate)==null?void 0:c.submitButtonClass,t=(l=this.mainContainer)==null?void 0:l.querySelector("."+e);t&&(t.disabled=!0);const a=(d=Z.mainTemplate)==null?void 0:d.checkmarkClass,s=(p=this.mainContainer)==null?void 0:p.querySelector("."+a);s&&s.classList.remove("hidden");const r=(g=Z.mainTemplate)==null?void 0:g.submitButtonTextClass,o=(m=this.mainContainer)==null?void 0:m.querySelector("."+r);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 hi{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,s,r;this.renderFeedbackWidget&&document.getElementById("feedbackWidgetContainer")&&!this.dataLayer.answerLoading&&new li({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:(r=this.config.feedbackwidget)==null?void 0:r.lightweightTemplateOverride})}showMore(e){e.preventDefault(),this.clicked=!0,this.showMoreVisible=!1,me.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");me.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,r;const t=((r=(s=(a=this.config)==null?void 0:a.templates)==null?void 0:s.main)==null?void 0:r.template)||E.answer.main.template;this.dataLayer.renderingEngine===z.mustache?(!this.renderedWithShowMore||!e.answerLoading||this.clicked)&&(e.showMoreButtonVisible&&(this.renderedWithShowMore=!0),this.answerContainer.innerHTML=$.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 Is{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,s,r,o,c,l;if(typeof document<"u"){const d=document==null?void 0:document.getElementById(this.containerId);if(!d)throw new Error("Search input container not found");const p=((t=(e=this.config.templates)==null?void 0:e.mainTemplate)==null?void 0:t.template)||E.location.mainTemplate.template,g={...this.dataLayer.parsedData.data};if(this.dataLayer.setLocationWidgetTemplateData(g),this.dataLayer.renderingEngine===z.mustache){const m=$.render(p,g);d.innerHTML=m;const C=((s=(a=this.config.templates)==null?void 0:a.mainTemplate)==null?void 0:s.locationInputId)||E.location.mainTemplate.locationInputId,x=document==null?void 0:document.querySelector(`#${C}`);if(x)this.locationInput=x,x.addEventListener("blur",this.blurEvent.bind(this)),x.addEventListener("focus",this.focusEvent.bind(this));else throw new Error("Input not found");const b=((o=(r=this.config.templates)==null?void 0:r.mainTemplate)==null?void 0:o.radiusInputId)||E.location.mainTemplate.radiusInputId,k=document==null?void 0:document.querySelector(`#${b}`);k instanceof HTMLSelectElement&&(this.radiusInput=k,k.addEventListener("change",this.radiusSelectChangeEvent.bind(this)));const A=((l=(c=this.config.templates)==null?void 0:c.mainTemplate)==null?void 0:l.currentLocationActionButtonId)||E.location.mainTemplate.currentLocationActionButtonId,N=document==null?void 0:document.querySelector(`#${A}`);N&&N.addEventListener("click",this.getCurrentLocation.bind(this))}}}setCurrentLocationFields(e){this.dataLayer.setLocationCoordinatesDecoded(e),this.dataLayer.setSearchLocation(this.dataLayer.searchLocationCoordinatesDecoded),this.dataLayer.renderingEngine===z.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,r=Math.floor(parseFloat(a)*100)/100;this.dataLayer.setSearchLat(s+""),this.dataLayer.setSearchLong(r+"");const o=this.locationDecodeCoordinatesToAddress;o?o(s+"",r+"").then(c=>{this.setCurrentLocationFields(c.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 se.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===z.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=z.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",z.mustache);e&&(this.renderEngine=e)}setRenderingEngine(e=z.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,r,o,c,l,d;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&&!((r=this.dataLayer.searchLocationConfig)!=null&&r.locationValuesOverride)?this.getMetadata(a):(c=(o=this.dataLayer.searchLocationConfig)==null?void 0:o.locationValuesOverride)!=null&&c.locationFilterDefaultValue&&this.dataLayer.setSearchRadius((d=(l=this.dataLayer.searchLocationConfig)==null?void 0:l.locationValuesOverride)==null?void 0:d.locationFilterDefaultValue),this.previousQuery=a.query})},10),this.dataLayer.$searchResults.subscribe(a=>{a&&this.dataLayer.searchResultsMetadata&&!this.dataLayer.cookiesDisabled&&me.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){me.attachAnalyticsScript(e)}initialize(e){var t,a;if(this.dataLayer=new kr("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 Dr({...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 bs(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 bs({})}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 s,r;const t=(((s=e.response)==null?void 0:s.docs)??[]).map((o,c)=>({...o,position:c+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&&me.trackRelatedSearches({...this.dataLayer.parsedData.trackingData,impressions:a,totalRelatredSearches:((r=this.dataLayer.searchRelatedSearches)==null?void 0:r.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,r,o,c;const t=gt.extractSearchResultsMetadata(e),a=((r=(s=this.dataLayer.searchLocationConfig)==null?void 0:s.locationValuesOverride)==null?void 0:r.locationFilterDefaultValue)??((c=(o=t.location)==null?void 0:o.filter)==null?void 0:c.defaultValue);!this.dataLayer.searchRadius&&a&&this.dataLayer.setSearchRadius(a),this.dataLayer.setSearchResultsMetadata(t)}parseSearchResultsResponse(e){var s,r,o;if(this.handleRouter(),!e)return;this.dataLayer.setItemsPerPage(parseInt(e.responseHeader.params.rows)),this.dataLayer.setModel(e.responseHeader.params.model);let t=gt.combineResultsWithMetadata(e),a=gt.extractFacets(e);if(this.dataLayer.setSearchFacets(a),(r=(s=this.dataLayer.searchstaxConfig)==null?void 0:s.hooks)!=null&&r.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 c=[];if(this.searchFacetsWidget.forEach(l=>{l.config.facetingType&&c.push(l.config.facetingType)}),!this.dataLayer.searchObject.facets.some(l=>l.type==="or")){const l=c.indexOf("or");l!==-1&&c.splice(l,1)}this.dataLayer.searchObject.facets.length>0&&((o=this.searchHelper)==null||o.cacheFacets(void 0,c))}this.firstRequest=!1}parseAnswerResultsResponse(e){this.handleRouter(),e!==Ue.question&&e!==Ue.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,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 ii({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 Is({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 Is({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 hi({containerId:e,config:t,dataLayer:this.dataLayer})}addSearchResultsWidget(e,t){this.searchResultsConfig||(this.searchResultsConfig=t,this.searchResultsWidget=new oi({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 si({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper})}addSearchFeedbackWidget(e,t){this.searchFeedbackConfig=t,this.searchFeedbackWidget=new ri({containerId:e,config:t,dataLayer:this.dataLayer,searchTrigger:this.executeSearch.bind(this)})}addSearchSortingWidget(e,t){this.searchSortingConfig=t,this.searchSortingWidget=new ci({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 ti({containerId:e,config:t,dataLayer:this.dataLayer})}addFacetsWidget(e,t){this.searchFacetsConfig=t,this.searchFacetsWidget.push(new ai({containerId:e,config:t,dataLayer:this.dataLayer,routerHelper:this.routerHelper},this.cacheFacets.bind(this)))}executeSearch(e,t){const a={...this.dataLayer.searchObject};a.query=se.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 r,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=(r=this.routerHelper)==null?void 0:r.searchObjectToParams(a);s&&(s=(o=this.routerHelper)==null?void 0:o.extractParamsThatDoNotStartWithRouteName(s)),s&&(a.additionalProps=Object.keys(s).map(c=>s?{key:c,value:s[c]}:{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&&me.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=gt.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&&me.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=i.reactive({searchstax:new di("vue")}),ui={key:0},pi=i.defineComponent({__name:"SearchstaxWrapper",props:{language:{default:"en"},model:{},sessionId:{},searchURL:{},analyticsBaseUrl:{},analyticsSrc:{},suggesterURL:{},questionURL:{},trackApiKey:{},searchAuth:{},authType:{default:"basic"},autoCorrect:{type:Boolean,default:!0},router:{},beforeSearch:{},afterSearch:{},initialized:{}},emits:["initialized"],setup(n,{emit:e}){const t=n,a=e,s=i.ref(!1);return i.onMounted(()=>{const r={};t.beforeSearch&&(r.beforeSearch=t.beforeSearch),t.afterSearch&&(r.afterSearch=t.afterSearch),S.searchstax.initialize({language:t.language,model:t.model,searchURL:t.searchURL,suggesterURL:t.suggesterURL,trackApiKey:t.trackApiKey,searchAuth:t.searchAuth,authType:t.authType,autoCorrect:t.autoCorrect,router:t.router,hooks:r,analyticsBaseUrl:t.analyticsBaseUrl,analyticsSrc:t.analyticsSrc,sessionId:t.sessionId,questionURL:t.questionURL}),setTimeout(()=>{s.value=!0},10),a("initialized",S.searchstax)}),(r,o)=>s.value?(i.openBlock(),i.createElementBlock("div",ui,[i.renderSlot(r.$slots,"default")])):i.createCommentVNode("",!0)}}),gi={class:"searchstax-location-input-container","data-test-id":"searchstax-location-input-container"},mi={class:"searchstax-location-input-wrapper"},fi={class:"searchstax-location-input-wrapper-inner"},yi=["value"],Li={key:0,class:"searchstax-location-input-label"},wi=["value"],bi=["value"],Ci=i.defineComponent({__name:"SearchstaxLocationWidgetTemplate",props:{locationData:{type:Object,required:!0},inputValue:{type:String,required:!0},selectValue:{type:String,required:!0},locationError:{type:Boolean,required:!0},inputChange:{type:Function,required:!0},radiusChange:{type:Function,required:!0},locationBlur:{type:Function,required:!0},getCurrentLocation:{type:Function,required:!0}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",gi,[i.createElementVNode("div",mi,[t[4]||(t[4]=i.createElementVNode("span",{class:"searchstax-location-input-label"},"NEAR",-1)),i.createElementVNode("div",fi,[i.createElementVNode("input",{type:"text",id:"searchstax-location-input",class:i.normalizeClass(["searchstax-location-input",{"searchstax-input-location-error":n.locationError}]),placeholder:"Zip, Postal Code or City...","aria-label":"Search Location Input","data-test-id":"searchstax-location-input",onChange:t[0]||(t[0]=(...a)=>n.inputChange&&n.inputChange(...a)),value:n.inputValue,onBlur:t[1]||(t[1]=(...a)=>n.locationBlur&&n.locationBlur(...a))},null,42,yi),i.createElementVNode("button",{onClick:t[2]||(t[2]=(...a)=>n.getCurrentLocation&&n.getCurrentLocation(...a)),class:"searchstax-get-current-location-button"}," Use my current location ")]),n.locationData.shouldShowLocationDistanceDropdown?(i.openBlock(),i.createElementBlock("span",Li,"WITHIN")):i.createCommentVNode("",!0),n.locationData.shouldShowLocationDistanceDropdown?(i.openBlock(),i.createElementBlock("select",{key:1,id:"searchstax-location-radius-select",class:"searchstax-location-radius-select","aria-label":"Search Location Radius Select","data-test-id":"searchstax-location-radius-select",onChange:t[3]||(t[3]=(...a)=>n.radiusChange&&n.radiusChange(...a)),value:n.selectValue},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.locationData.locationSearchDistanceValues,a=>(i.openBlock(),i.createElementBlock("option",{value:a.value,key:a.value},i.toDisplayString(a.label),9,bi))),128))],40,wi)):i.createCommentVNode("",!0)])]))}}),ki=["id"],vs=i.defineComponent({__name:"SearchstaxLocationWidget",props:{locationDecode:{type:Function},locationDecodeCoordinatesToAddress:{type:Function},locationSearchEnabled:{type:Boolean},locationValuesOverride:{}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=Math.random(),r=i.ref(""),o=i.ref(""),c=i.ref(!1),l=i.ref(!1),d=()=>{var k;(k=S.searchstax.searchLocationWidget)==null||k.triggerGeocoder(r.value)},p=k=>{var N;const A=k.target;o.value=A.value,(N=S.searchstax.searchLocationWidget)==null||N.setRadiusValue(o.value)},g=k=>{const A=k.target;r.value=A.value},m=()=>{var k;(k=S.searchstax.searchLocationWidget)==null||k.getCurrentLocation()},C=()=>{S.searchstax.dataLayer.$locationWidgetTemplateData.subscribe(k=>{a.value=k}),S.searchstax.dataLayer.$searchObject.subscribe(k=>{r.value=k.location.address??"",o.value=k.location.radius||""}),S.searchstax.dataLayer.$locationError.subscribe(k=>{l.value=k}),S.searchstax.dataLayer.$searchLocationChange.subscribe(k=>{r.value=k}),S.searchstax.dataLayer.$searchRadiusChange.subscribe(k=>{o.value=String(k)})},x=()=>{!c.value&&S.searchstax.routerHelper&&(c.value=!0,S.searchstax.addSearchLocationWidget("searchstax-location-container"+s,{hooks:{locationDecode:e.locationDecode,locationDecodeCoordinatesToAddress:e.locationDecodeCoordinatesToAddress},locationSearchEnabled:e.locationSearchEnabled,locationValuesOverride:e.locationValuesOverride}))},b=i.computed(()=>!!t.location);return i.onMounted(()=>{if(S.searchstax)C(),x();else throw Error("Searchstax instance needs to be passed via props")}),(k,A)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-location-container"+i.unref(s),class:"searchstax-location-container"},[a.value&&!b.value?(i.openBlock(),i.createBlock(Ci,{key:0,locationData:a.value,inputValue:r.value,selectValue:o.value,locationError:l.value,inputChange:g,radiusChange:p,locationBlur:d,getCurrentLocation:m},null,8,["locationData","inputValue","selectValue","locationError"])):i.createCommentVNode("",!0),a.value&&b.value?i.renderSlot(k.$slots,"location",{key:1,locationData:a.value,locationError:l.value,radiusChange:p,locationBlur:d,selectValue:o.value,getCurrentLocation:m,inputValue:r.value,inputChange:g}):i.createCommentVNode("",!0)],8,ki))}}),xi={class:"searchstax-search-input-wrapper"},Mi={key:1,id:"searchstax-separator-icon",class:"searchstax-separator"},Si=["innerHTML","onMouseover"],Ti=i.defineComponent({__name:"SearchstaxInputWidgetTemplate",props:{suggestions:{type:Array,required:!0},onMouseLeave:{type:Function,required:!0},onMouseOver:{type:Function,required:!0},onMouseClick:{type:Function,required:!0},onClearClick:{type:Function,required:!1},hasInputValue:{type:Boolean,required:!1}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",xi,[t[4]||(t[4]=i.createElementVNode("input",{type:"text",id:"searchstax-search-input",class:"searchstax-search-input",placeholder:"SEARCH FOR...","aria-label":"search"},null,-1)),n.hasInputValue?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:t[0]||(t[0]=(...a)=>n.onClearClick&&n.onClearClick(...a)),onKeyup:t[1]||(t[1]=i.withKeys((...a)=>n.onClearClick&&n.onClearClick(...a),["enter"])),id:"searchstax-clear-input-action-button",class:"searchstax-cross-icon","aria-label":"clear input",role:"button"},null,32)):i.createCommentVNode("",!0),n.hasInputValue?(i.openBlock(),i.createElementBlock("span",Mi)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["searchstax-autosuggest-container",{hidden:n.suggestions.length===0}]),onMouseleave:t[3]||(t[3]=(...a)=>n.onMouseLeave&&n.onMouseLeave(...a))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.suggestions,a=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-autosuggest-item",key:a.term},[i.createElementVNode("div",{class:"searchstax-autosuggest-item-term-container",innerHTML:a.term,tabindex:"0",onMouseover:s=>n.onMouseOver(a),onClick:t[2]||(t[2]=i.withModifiers(s=>n.onMouseClick(),["stop"]))},null,40,Si)]))),128))],34)]),i.createVNode(vs),t[5]||(t[5]=i.createElementVNode("button",{class:"searchstax-spinner-icon",id:"searchstax-search-input-action-button","aria-label":"search",role:"button"},null,-1))],64))}}),Ei={id:"searchstax-input-container"},Di=i.defineComponent({__name:"SearchstaxInputWidget",props:{afterAutosuggest:{type:Function},beforeAutosuggest:{type:Function},searchInputId:{},suggestAfterMinChars:{},locationDecode:{type:Function},locationDecodeCoordinatesToAddress:{type:Function}},setup(n){const e=n,t=i.useSlots(),a=i.ref([]),s=i.ref(null),r=()=>{S.searchstax.searchInputWidget.resetAutosuggestSelection(),S.searchstax.searchInputWidget.markActiveAutosuggestItem()},o=g=>{S.searchstax.searchInputWidget.onSuggestionEnter(g)},c=()=>{S.searchstax.searchInputWidget.suggestionChosen()},l=()=>{S.searchstax.searchInputWidget.clearInput()},d=()=>{S.searchstax.dataLayer.$autosuggestResults.subscribe(g=>{a.value=(g==null?void 0:g.suggestions)??[]}),S.searchstax.dataLayer.$inputWidgetTemplateData.subscribe(g=>{s.value=g})},p=i.computed(()=>!!t.input);return i.onMounted(()=>{if(S.searchstax){d();const g={};e.afterAutosuggest&&(g.afterAutosuggest=e.afterAutosuggest),e.beforeAutosuggest&&(g.beforeAutosuggest=e.beforeAutosuggest),S.searchstax.addSearchInputWidget("searchstax-input-container",{suggestAfterMinChars:e.suggestAfterMinChars,hooks:g,templates:{mainTemplate:{template:"",searchInputId:e.searchInputId??"searchstax-search-input"}}})}else throw Error("Searchstax instance needs to be passed via props");S.searchstax.dataLayer.setInputTemplateRendered(!0)}),(g,m)=>{var C,x,b;return i.openBlock(),i.createElementBlock("div",Ei,[i.createElementVNode("div",{class:i.normalizeClass(["searchstax-search-input-container searchstax-search-input-container-new",{"searchstax-alternative-render":(C=s.value)==null?void 0:C.locationEnabled}])},[p.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Ti,{key:0,suggestions:a.value,onMouseClick:c,onMouseOver:o,onMouseLeave:r,onClearClick:l,hasInputValue:((x=s.value)==null?void 0:x.hasInputValue)??!1},null,8,["suggestions","hasInputValue"])),i.renderSlot(g.$slots,"input",{suggestions:a.value,onMouseClick:c,onMouseOver:o,onMouseLeave:r,onClearClick:l,hasInputValue:((b=s.value)==null?void 0:b.hasInputValue)??!1})],2)])}}}),Ai={key:0,class:"searchstax-search-results"},Ii=["href","data-searchstax-unique-result-id","onClick","onKeyup"],vi={key:0,class:"searchstax-search-result-promoted"},ji=["innerHTML"],Ni=["src"],Ri={class:"searchstax-search-result-title-container"},Oi=["id","innerHTML"],Pi=["innerHTML"],Fi=["innerHTML"],$i={key:0,class:"searchstax-search-result-image-container"},Bi=["src"],Vi={key:1},zi=["innerHTML"],qi=i.defineComponent({__name:"SearchstaxResultWidgetDefaultTemplate",props:{searchResults:{type:Object,required:!0},resultClicked:{type:Function,required:!0}},setup(n){return(e,t)=>n.searchResults&&n.searchResults.length?(i.openBlock(),i.createElementBlock("div",Ai,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.searchResults,a=>(i.openBlock(),i.createElementBlock("a",{key:a.uniqueId,href:a.url,"data-searchstax-unique-result-id":a.uniqueId,onClick:s=>n.resultClicked(a,s),onKeyup:[i.withKeys(s=>n.resultClicked(a,s),["enter"]),i.withKeys(s=>n.resultClicked(a,s),["space"])],"aria-labelledby":"title-{{searchResult.uniqueId}}",class:"searchstax-result-item-link searchstax-result-item-link-wrapping",tabindex:"0"},[i.createElementVNode("div",{class:i.normalizeClass(["searchstax-search-result",{"has-thumbnail":a.thumbnail,promoted:a.promoted}])},[a.promoted?(i.openBlock(),i.createElementBlock("div",vi)):i.createCommentVNode("",!0),a.ribbon?(i.openBlock(),i.createElementBlock("div",{key:1,innerHTML:a.ribbon,class:"searchstax-search-result-ribbon"},null,8,ji)):i.createCommentVNode("",!0),a.thumbnail?(i.openBlock(),i.createElementBlock("img",{key:2,alt:"",src:a.thumbnail,class:"searchstax-thumbnail"},null,8,Ni)):i.createCommentVNode("",!0),i.createElementVNode("div",Ri,[i.createElementVNode("span",{class:"searchstax-search-result-title",id:"title-"+a.uniqueId,innerHTML:a.title},null,8,Oi)]),a.paths?(i.openBlock(),i.createElementBlock("p",{key:3,innerHTML:a.paths,tabindex:"0",class:"searchstax-search-result-common"},null,8,Pi)):i.createCommentVNode("",!0),a.description?(i.openBlock(),i.createElementBlock("p",{key:4,tabindex:"0",innerHTML:a.description,class:"searchstax-search-result-description searchstax-search-result-common"},null,8,Fi)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.unmappedFields,s=>(i.openBlock(),i.createElementBlock("div",{key:s.key},[s.isImage&&typeof s.value=="string"?(i.openBlock(),i.createElementBlock("div",$i,[i.createElementVNode("img",{alt:"",src:s.value,class:"searchstax-result-image"},null,8,Bi)])):(i.openBlock(),i.createElementBlock("div",Vi,[i.createElementVNode("p",{tabindex:"0",class:"searchstax-search-result-common",innerHTML:s.value},null,8,zi)]))]))),128))],2)],40,Ii))),128))])):i.createCommentVNode("",!0)}}),Wi={key:0},Qi={class:"searchstax-no-results"},Hi={key:0},Ui=i.defineComponent({__name:"SearchstaxResultWidgetNoResultsTemplate",props:{searchResults:{type:Object,required:!0},resultClicked:{type:Function,required:!0},searchTerm:{type:String,required:!0},metadata:{type:Object,required:!1},store:{type:Object,required:!0},executeSearch:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s;return n.searchResults&&n.searchResults.length===0&&n.searchTerm!==""&&n.searchTerm!=="*"&&n.store.searchstax.dataLayer.parsedData.firstSearchHappened?(i.openBlock(),i.createElementBlock("div",Wi,[i.createElementVNode("div",Qi,[t[3]||(t[3]=i.createTextVNode(" Showing ",-1)),t[4]||(t[4]=i.createElementVNode("strong",null,"no results",-1)),t[5]||(t[5]=i.createTextVNode(" for ",-1)),i.createElementVNode("strong",null,'"'+i.toDisplayString(n.searchTerm)+'"',1),t[6]||(t[6]=i.createElementVNode("br",null,null,-1)),(a=n.metadata)!=null&&a.spellingSuggestion?(i.openBlock(),i.createElementBlock("span",Hi,[t[1]||(t[1]=i.createTextVNode("Did you mean ",-1)),i.createElementVNode("a",{href:"#",class:"searchstax-suggestion-term",onClick:t[0]||(t[0]=r=>{var o;return n.executeSearch((o=n.metadata)==null?void 0:o.spellingSuggestion,r)})},i.toDisplayString((s=n.metadata)==null?void 0:s.spellingSuggestion),1),t[2]||(t[2]=i.createTextVNode("?",-1))])):i.createCommentVNode("",!0)]),t[7]||(t[7]=i.createElementVNode("ul",null,[i.createElementVNode("li",null," Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need. ")],-1))])):i.createCommentVNode("",!0)}}}),Yi={id:"searchstax-results-container"},_i={"aria-label":"search results container",tabindex:"0"},Ji={class:"searchstax-search-results-container",id:"searchstax-search-results-container"},Gi={id:"searchstax-result-container"},Ki={key:3},Zi=i.defineComponent({__name:"SearchstaxResultWidget",props:{afterLinkClick:{type:Function},renderMethod:{},resultsPerPage:{}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=i.ref(null),r=i.ref(""),o=i.computed(()=>!!t.noResult),c=i.computed(()=>!!t.results),l=i.computed(()=>{const m={};return e.afterLinkClick&&(m.afterLinkClick=e.afterLinkClick),m}),d=(m,C)=>{C.preventDefault(),C.stopPropagation(),S.searchstax.executeLinkClick(m.uniqueId)},p=(m,C)=>{C.preventDefault(),S.searchstax.executeSearch(m)},g=()=>{S.searchstax.dataLayer.$searchResults.subscribe(m=>{var k;const C=a.value??[],x=m??[],b=e.renderMethod==="infiniteScroll"?[...C,...x]:m;((k=S.searchstax.dataLayer.$searchObject.value)==null?void 0:k.page)===1?a.value=m:a.value=b}),S.searchstax.dataLayer.$searchTermChange.subscribe(m=>{r.value=m}),S.searchstax.dataLayer.$searchResultsMetadata.subscribe(m=>{s.value=m})};return i.onMounted(()=>{if(S.searchstax)g(),S.searchstax.addSearchResultsWidget("searchstax-results-container",{templates:{},renderMethod:e.renderMethod??"pagination",resultsPerPage:e.resultsPerPage,hooks:l.value});else throw Error("Searchstax instance needs to be passed via props")}),(m,C)=>(i.openBlock(),i.createElementBlock("div",Yi,[i.createElementVNode("section",_i,[i.createElementVNode("div",Ji,[i.createElementVNode("div",Gi,[a.value&&a.value.length===0&&r.value!==""&&r.value!=="*"&&i.unref(S).searchstax.dataLayer.parsedData.firstSearchHappened&&!o.value?(i.openBlock(),i.createBlock(Ui,{key:0,searchTerm:r.value,metadata:s.value,executeSearch:p,store:i.unref(S),searchResults:a.value,resultClicked:d},null,8,["searchTerm","metadata","store","searchResults"])):i.createCommentVNode("",!0),a.value&&a.value.length===0&&r.value!==""&&r.value!=="*"&&i.unref(S).searchstax.dataLayer.parsedData.firstSearchHappened&&o.value?i.renderSlot(m.$slots,"noResult",{key:1,searchTerm:r.value,metadata:s.value,executeSearch:p,store:i.unref(S),searchResults:a.value,resultClicked:d}):i.createCommentVNode("",!0),a.value&&a.value.length&&!c.value?(i.openBlock(),i.createBlock(qi,{key:2,searchResults:a.value,resultClicked:d},null,8,["searchResults"])):i.createCommentVNode("",!0),a.value&&a.value.length&&c.value?(i.openBlock(),i.createElementBlock("div",Ki,[i.renderSlot(m.$slots,"results",{searchResults:a.value,resultClicked:d})])):i.createCommentVNode("",!0)])])])]))}}),Xi={key:0,class:"searchstax-facets-container-desktop"},eo=["onClick"],to={class:"searchstax-facet-title"},ao={class:"searchstax-facet-values-container","aria-live":"polite"},so={class:"searchstax-facet-input"},no=["checked","disabled","aria-label","onClick"],ro=["onClick"],io=["onClick"],oo={key:0,class:"searchstax-facet-show-more-container"},co=["onClick","onKeyup"],lo={key:0,class:"searchstax-facet-show-less-button searchstax-facet-show-button"},ho={key:1,class:"searchstax-facet-show-more-button searchstax-facet-show-button"},uo=i.defineComponent({__name:"SearchstaxFacetsWidgetDesktopTemplate",props:{facetsTemplateDataDesktop:{type:Object,required:!0},isNotDeactivated:{type:Function,required:!0},toggleFacetGroup:{type:Function,required:!0},isChecked:{type:Function,required:!0},selectFacet:{type:Function,required:!0},showMoreLessDesktop:{type:Function,required:!0},facetContainers:{type:Object,required:!0}},emits:["updateRefDesktop"],setup(n,{emit:e}){const t=n,a=e,s=(r,o)=>(a("updateRefDesktop",r,o),t.facetContainers);return(r,o)=>{var c;return(c=n.facetsTemplateDataDesktop)!=null&&c.hasResultsOrExternalPromotions?(i.openBlock(),i.createElementBlock("div",Xi,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.facetsTemplateDataDesktop.facets,l=>(i.openBlock(),i.createElementBlock("div",{key:l.name+"desktop",class:i.normalizeClass(["searchstax-facet-container",{active:n.isNotDeactivated(l.name)}])},[i.createElementVNode("div",null,[i.createElementVNode("div",{class:"searchstax-facet-title-container",onClick:d=>n.toggleFacetGroup(l.name)},[i.createElementVNode("div",to,i.toDisplayString(l.label),1),o[0]||(o[0]=i.createElementVNode("div",{class:"searchstax-facet-title-arrow active"},null,-1))],8,eo),i.createElementVNode("div",ao,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.values,d=>(i.openBlock(),i.createElementBlock("div",{key:d.value+d.parentName,class:i.normalizeClass(["searchstax-facet-value-container",{"searchstax-facet-value-disabled":d.disabled}]),ref_for:!0,ref:p=>s(p,d)},[i.createElementVNode("div",so,[i.createElementVNode("input",{type:"checkbox",class:"searchstax-facet-input-checkbox",checked:n.isChecked(d),disabled:d.disabled,"aria-label":d.value+" "+d.count,onClick:p=>n.selectFacet(d.value+"-desktop",p,d,!0)},null,8,no)]),i.createElementVNode("div",{class:"searchstax-facet-value-label",onClick:p=>n.selectFacet(d.value+"-desktop",p,d,!1)},i.toDisplayString(d.value),9,ro),i.createElementVNode("div",{class:"searchstax-facet-value-count",onClick:p=>n.selectFacet(d.value+"-desktop",p,d,!1)}," ("+i.toDisplayString(d.count)+") ",9,io)],2))),128)),l.hasMoreFacets?(i.openBlock(),i.createElementBlock("div",oo,[i.createElementVNode("div",{class:"searchstax-facet-show-more-container",onClick:d=>n.showMoreLessDesktop(d,l),onKeyup:[i.withKeys(d=>{d.preventDefault(),n.showMoreLessDesktop(d,l)},["space"]),i.withKeys(d=>n.showMoreLessDesktop(d,l),["enter"])],tabindex:"0",role:"button"},[l.showingAllFacets?(i.openBlock(),i.createElementBlock("div",lo," less ")):(i.openBlock(),i.createElementBlock("div",ho," more "))],40,co)])):i.createCommentVNode("",!0)])])],2))),128))])):i.createCommentVNode("",!0)}}}),po={key:0,class:"searchstax-facets-container-mobile"},go={class:"searchstax-facets-pills-container"},mo={class:"searchstax-facets-pills-selected"},fo=["onClick"],yo={class:"searchstax-facets-pill-label"},Lo={class:"searchstax-facets-mobile-overlay-header"},wo={class:"searchstax-facets-container-mobile"},bo=["onClick"],Co={class:"searchstax-facet-title"},ko={class:"searchstax-facet-values-container","aria-live":"polite"},xo={class:"searchstax-facet-input"},Mo=["checked","disabled","aria-label","onClick"],So=["onClick"],To=["onClick"],Eo={key:0,class:"searchstax-facet-show-more-container"},Do=["onClick","onKeyup"],Ao={key:0,class:"searchstax-facet-show-less-button searchstax-facet-show-button"},Io={key:1,class:"searchstax-facet-show-more-button searchstax-facet-show-button"},vo=i.defineComponent({__name:"SearchstaxFacetsWidgetMobileTemplate",props:{facetsTemplateDataMobile:{type:Object,required:!0},isNotDeactivated:{type:Function,required:!0},toggleFacetGroup:{type:Function,required:!0},isChecked:{type:Function,required:!0},selectFacet:{type:Function,required:!0},showMoreLessDesktop:{type:Function,required:!0},showMoreLessMobile:{type:Function,required:!0},facetContainers:{type:Object,required:!0},openOverlay:{type:Function,required:!0},selectedFacetsCheckboxes:{type:Array,required:!0},unselectFacet:{type:Function,required:!0},unselectAll:{type:Function,required:!0},closeOverlay:{type:Function,required:!0}},emits:["updateRefMobile"],setup(n,{emit:e}){const t=n,a=e,s=(r,o)=>(a("updateRefMobile",r,o),t.facetContainers);return(r,o)=>{var c,l,d;return(c=n.facetsTemplateDataMobile)!=null&&c.hasResultsOrExternalPromotions?(i.openBlock(),i.createElementBlock("div",po,[i.createElementVNode("div",go,[i.createElementVNode("div",{class:"searchstax-facets-pill searchstax-facets-pill-filter-by",onClick:o[0]||(o[0]=(...p)=>n.openOverlay&&n.openOverlay(...p))},[...o[4]||(o[4]=[i.createElementVNode("div",{class:"searchstax-facets-pill-label"},"Filter By",-1)])]),i.createElementVNode("div",mo,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.selectedFacetsCheckboxes,p=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-facets-pill searchstax-facets-pill-facets",key:p.value,onClick:g=>n.unselectFacet(p)},[i.createElementVNode("div",yo,i.toDisplayString(p.value)+" ("+i.toDisplayString(p.count)+")",1),o[5]||(o[5]=i.createElementVNode("div",{class:"searchstax-facets-pill-icon-close"},null,-1))],8,fo))),128))]),n.selectedFacetsCheckboxes.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:"searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all",onClick:o[1]||(o[1]=(...p)=>n.unselectAll&&n.unselectAll(...p))},[...o[6]||(o[6]=[i.createElementVNode("div",{class:"searchstax-facets-pill-label"},"Clear Filters",-1)])])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["searchstax-facets-mobile-overlay",{"searchstax-show":(l=n.facetsTemplateDataMobile)==null?void 0:l.overlayOpened}])},[i.createElementVNode("div",Lo,[o[7]||(o[7]=i.createElementVNode("div",{class:"searchstax-facets-mobile-overlay-header-title"},"Filter By",-1)),i.createElementVNode("div",{class:"searchstax-search-close",onClick:o[2]||(o[2]=(...p)=>n.closeOverlay&&n.closeOverlay(...p))})]),i.createElementVNode("div",wo,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList((d=n.facetsTemplateDataMobile)==null?void 0:d.facets,p=>(i.openBlock(),i.createElementBlock("div",{key:p.name+"mobile",class:i.normalizeClass(["searchstax-facet-container",{active:n.isNotDeactivated(p.name)}])},[i.createElementVNode("div",null,[i.createElementVNode("div",{class:"searchstax-facet-title-container",onClick:g=>n.toggleFacetGroup(p.name)},[i.createElementVNode("div",Co,i.toDisplayString(p.label),1),o[8]||(o[8]=i.createElementVNode("div",{class:"searchstax-facet-title-arrow active"},null,-1))],8,bo),i.createElementVNode("div",ko,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.values,g=>(i.openBlock(),i.createElementBlock("div",{key:g.value+g.parentName,class:i.normalizeClass(["searchstax-facet-value-container",{"searchstax-facet-value-disabled":g.disabled}]),ref_for:!0,ref:m=>{s(m,g)}},[i.createElementVNode("div",xo,[i.createElementVNode("input",{type:"checkbox",class:"searchstax-facet-input-checkbox",checked:n.isChecked(g),disabled:g.disabled,"aria-label":g.value+" "+g.count,onClick:m=>n.selectFacet(g.value+"-mobile",m,g,!0)},null,8,Mo)]),i.createElementVNode("div",{class:"searchstax-facet-value-label",onClick:m=>n.selectFacet(g.value+"-mobile",m,g,!1)},i.toDisplayString(g.value),9,So),i.createElementVNode("div",{class:"searchstax-facet-value-count",onClick:m=>n.selectFacet(g.value+"-mobile",m,g,!1)}," ("+i.toDisplayString(g.count)+") ",9,To)],2))),128)),p.hasMoreFacets?(i.openBlock(),i.createElementBlock("div",Eo,[i.createElementVNode("div",{class:"searchstax-facet-show-more-container",onClick:g=>n.showMoreLessMobile(g,p),onKeyup:[i.withKeys(g=>n.showMoreLessMobile(g,p),["space"]),i.withKeys(g=>n.showMoreLessMobile(g,p),["enter"])],tabindex:"0"},[p.showingAllFacets?(i.openBlock(),i.createElementBlock("div",Ao," less ")):(i.openBlock(),i.createElementBlock("div",Io," more "))],40,Do)])):i.createCommentVNode("",!0)])])],2))),128))]),i.createElementVNode("button",{class:"searchstax-facets-mobile-overlay-done",onClick:o[3]||(o[3]=(...p)=>n.closeOverlay&&n.closeOverlay(...p))},"Done")],2)])):i.createCommentVNode("",!0)}}}),jo=["id"],No={key:1},Ro={key:3},Oo=i.defineComponent({__name:"SearchstaxFacetsWidget",props:{facetingType:{},itemsPerPageDesktop:{},itemsPerPageMobile:{},specificFacets:{},beforeFacetsRender:{type:Function}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=i.ref(null),r=i.ref([]),o=i.ref([]),c=Math.random(),l=i.computed(()=>!!t.desktopFacets),d=i.computed(()=>!!t.mobileFacets),p=()=>{S.searchstax.dataLayer.$facetsTemplateData.subscribe(M=>{M!=null&&M.isMobile?s.value=M:a.value=M}),S.searchstax.dataLayer.$selectedFacetsTemplateData.subscribe(M=>{const v=M??[];o.value=v.filter(H=>H.type==="checkbox")})},g=M=>{S.searchstax.searchFacetsWidget[0].unselectFacet(M)},m=()=>{S.searchstax.searchFacetsWidget[0].removeSelectedFacets()},C=M=>!S.searchstax.searchFacetsWidget[0].deactivatedFacets[M],x=M=>{C(M)?S.searchstax.searchFacetsWidget[0].deactivatedFacets[M]=!0:S.searchstax.searchFacetsWidget[0].deactivatedFacets[M]=!1},b=M=>S.searchstax.searchFacetsWidget[0].isChecked(M),k=(M,v,H,ne)=>{const ye=document.createElement("div");ye.innerHTML=r.value[M].outerHTML,S.searchstax.searchFacetsWidget[0].onFacetSelect(v,H,r.value[M],ne)},A=(M,v)=>{S.searchstax.searchFacetsWidget[0].onShowMoreLessClick(M,v,!1)},N=(M,v)=>{S.searchstax.searchFacetsWidget[0].onShowMoreLessClick(M,v,!0)},R=()=>{S.searchstax.searchFacetsWidget[0].openOverlay()},I=()=>{S.searchstax.searchFacetsWidget[0].closeOverlay()},y=M=>{r.value[M.facetValue]=M.element},L=(M,v)=>(y({facetValue:v.value+"-desktop",element:M}),r.value),D=(M,v)=>(y({facetValue:v.value+"-mobile",element:M}),r.value);return i.onMounted(()=>{S.searchstax.addFacetsWidget("searchstax-facets-container"+c,{facetingType:e.facetingType,specificFacets:e.specificFacets,itemsPerPageDesktop:e.itemsPerPageDesktop,itemsPerPageMobile:e.itemsPerPageMobile,hooks:{beforeFacetsRender:e.beforeFacetsRender}}),p()}),(M,v)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-facets-container"+i.unref(c)},[l.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(uo,{key:0,facetsTemplateDataDesktop:a.value,isNotDeactivated:C,toggleFacetGroup:x,isChecked:b,selectFacet:k,showMoreLessDesktop:A,facetContainers:r.value,onUpdateRef:y,onUpdateRefDesktop:L},null,8,["facetsTemplateDataDesktop","facetContainers"])),l.value?(i.openBlock(),i.createElementBlock("div",No,[i.renderSlot(M.$slots,"desktopFacets",{facetsTemplateDataDesktop:a.value,isNotDeactivated:C,toggleFacetGroup:x,isChecked:b,selectFacet:k,showMoreLessDesktop:A,facetContainers:r.value,onUpdateRef:y,onUpdateRefDesktop:L})])):i.createCommentVNode("",!0),d.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(vo,{key:2,facetsTemplateDataMobile:s.value,isNotDeactivated:C,toggleFacetGroup:x,isChecked:b,selectFacet:k,showMoreLessDesktop:A,showMoreLessMobile:N,facetContainers:r.value,openOverlay:R,selectedFacetsCheckboxes:o.value,unselectFacet:g,unselectAll:m,closeOverlay:I,onUpdateRef:y,onUpdateRefMobile:D},null,8,["facetsTemplateDataMobile","facetContainers","selectedFacetsCheckboxes"])),d.value?(i.openBlock(),i.createElementBlock("div",Ro,[i.renderSlot(M.$slots,"mobileFacets",{facetsTemplateDataMobile:s.value,selectedFacetsCheckboxes:o.value,isNotDeactivated:C,toggleFacetGroup:x,isChecked:b,selectFacet:k,showMoreLessDesktop:A,facetContainers:r.value,openOverlay:R,unselectFacet:g,unselectAll:m,closeOverlay:I,onUpdateRef:y,onUpdateRefMobile:D})])):i.createCommentVNode("",!0)],8,jo))}}),Po={key:0,class:"searchstax-pagination-container"},Fo={class:"searchstax-pagination-content"},$o=["disabled"],Bo={class:"searchstax-pagination-details"},Vo=["disabled"],zo=i.defineComponent({__name:"SearchstaxPaginationWidgetDefaultTemplate",props:{paginationData:{type:Object,required:!0},nextPage:{type:Function,required:!0},previousPage:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s,r,o,c;return n.paginationData?(i.openBlock(),i.createElementBlock("div",Po,[i.createElementVNode("div",Fo,[i.createElementVNode("a",{class:i.normalizeClass(["searchstax-pagination-previous",n.paginationData.isFirstPage?"disabled":""]),disabled:(a=n.paginationData)==null?void 0:a.isFirstPage,onClick:t[0]||(t[0]=(...l)=>n.previousPage&&n.previousPage(...l)),onKeyup:[t[1]||(t[1]=i.withKeys((...l)=>n.previousPage&&n.previousPage(...l),["enter"])),t[2]||(t[2]=i.withKeys((...l)=>n.previousPage&&n.previousPage(...l),["space"]))],tabindex:"0",id:"searchstax-pagination-previous"}," < Previous ",42,$o),i.createElementVNode("div",Bo,i.toDisplayString((s=n.paginationData)==null?void 0:s.startResultIndex)+" - "+i.toDisplayString((r=n.paginationData)==null?void 0:r.endResultIndex)+" of "+i.toDisplayString((o=n.paginationData)==null?void 0:o.totalResults),1),i.createElementVNode("a",{class:i.normalizeClass(["searchstax-pagination-next",n.paginationData.isLastPage?"disabled":""]),disabled:(c=n.paginationData)==null?void 0:c.isLastPage,tabindex:"0",onClick:t[3]||(t[3]=(...l)=>n.nextPage&&n.nextPage(...l)),onKeyup:[t[4]||(t[4]=i.withKeys((...l)=>n.nextPage&&n.nextPage(...l),["enter"])),t[5]||(t[5]=i.withKeys((...l)=>n.nextPage&&n.nextPage(...l),["space"]))],id:"searchstax-pagination-next"},"Next >",42,Vo)])])):i.createCommentVNode("",!0)}}}),qo={className:"searchstax-pagination-container"},Wo=i.defineComponent({__name:"SearchstaxPaginationWidgetInfiniteScrollTemplate",props:{nextPage:{type:Function,required:!0}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",qo,[i.createElementVNode("a",{class:"searchstax-pagination-load-more",tabindex:"0",onClick:t[0]||(t[0]=(...a)=>n.nextPage&&n.nextPage(...a)),onKeyup:[t[1]||(t[1]=i.withKeys((...a)=>n.nextPage&&n.nextPage(...a),["enter"])),t[2]||(t[2]=i.withKeys((...a)=>n.nextPage&&n.nextPage(...a),["space"]))]},"Load More",32)]))}}),Qo=["id"],Ho={key:1},Uo={key:3},Yo=i.defineComponent({__name:"SearchstaxPaginationWidget",setup(n){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=i.ref(!1),r=g=>{S.searchstax.searchPaginationWidget.nextPage(g)},o=g=>{S.searchstax.searchPaginationWidget.previousPage(g)},c=()=>{S.searchstax.dataLayer.$searchObject.subscribe(()=>{l()}),S.searchstax.dataLayer.$paginationData.subscribe(g=>{t.value=g})},l=()=>{!s.value&&S.searchstax.routerHelper&&(s.value=!0,S.searchstax.addPaginationWidget("searchstax-pagination-container"+a,{}))},d=i.computed(()=>!!e.pagination),p=i.computed(()=>!!e.infiniteScroll);return i.onMounted(()=>{if(S.searchstax)c(),l();else throw Error("Searchstax instance needs to be passed via props")}),(g,m)=>{var C,x,b,k,A,N,R,I,y,L,D,M;return i.openBlock(),i.createElementBlock("div",{id:"searchstax-pagination-container"+i.unref(a)},[t.value&&!((C=t.value)!=null&&C.isInfiniteScroll)&&((x=t.value)==null?void 0:x.totalResults)!==0&&!d.value?(i.openBlock(),i.createBlock(zo,{key:0,paginationData:t.value,nextPage:r,previousPage:o},null,8,["paginationData"])):i.createCommentVNode("",!0),d.value&&((b=t.value)==null?void 0:b.totalResults)!==0&&!((k=t.value)!=null&&k.isInfiniteScroll)?(i.openBlock(),i.createElementBlock("div",Ho,[i.renderSlot(g.$slots,"pagination",{paginationData:t.value,nextPage:r,previousPage:o})])):i.createCommentVNode("",!0),t.value&&((A=t.value)!=null&&A.isInfiniteScroll)&&!((N=t.value)!=null&&N.isLastPage)&&((R=t.value)!=null&&R.hasResults)&&((I=t.value)==null?void 0:I.totalResults)!==0&&!p.value?(i.openBlock(),i.createBlock(Wo,{key:2,nextPage:r})):i.createCommentVNode("",!0),p.value&&!((y=t.value)!=null&&y.isLastPage)&&((L=t.value)!=null&&L.hasResults)&&((D=t.value)==null?void 0:D.totalResults)!==0&&((M=t.value)!=null&&M.isInfiniteScroll)?(i.openBlock(),i.createElementBlock("div",Uo,[i.renderSlot(g.$slots,"infiniteScroll",{paginationData:t.value,nextPage:r})])):i.createCommentVNode("",!0)],8,Qo)}}}),_o={key:0,class:"searchstax-feedback-container"},Jo={key:0},Go={class:"searchstax-feedback-container-suggested"},Ko={key:0},Zo=["aria-label"],Xo=i.defineComponent({__name:"SearchstaxSearchFeedbackWidgetTemplate",props:{searchFeedbackData:{type:Object,required:!0},onOriginalQueryClick:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s;return n.searchFeedbackData&&((a=n.searchFeedbackData)!=null&&a.searchExecuted)&&((s=n.searchFeedbackData)!=null&&s.totalResults)?(i.openBlock(),i.createElementBlock("h2",_o,[t[4]||(t[4]=i.createTextVNode(" Showing ",-1)),i.createElementVNode("b",null,i.toDisplayString(n.searchFeedbackData.startResultIndex)+" - "+i.toDisplayString(n.searchFeedbackData.endResultIndex),1),t[5]||(t[5]=i.createTextVNode(" of ",-1)),i.createElementVNode("b",null,i.toDisplayString(n.searchFeedbackData.totalResults),1),t[6]||(t[6]=i.createTextVNode(" results ",-1)),n.searchFeedbackData.searchTerm?(i.openBlock(),i.createElementBlock("span",Jo,[t[1]||(t[1]=i.createTextVNode('for "',-1)),i.createElementVNode("b",null,i.toDisplayString(n.searchFeedbackData.searchTerm),1),t[2]||(t[2]=i.createTextVNode('" ',-1))])):i.createCommentVNode("",!0),i.createElementVNode("div",Go,[n.searchFeedbackData.autoCorrectedQuery?(i.openBlock(),i.createElementBlock("div",Ko,[t[3]||(t[3]=i.createTextVNode(" Search instead for ",-1)),i.createElementVNode("a",{href:"#",onClick:t[0]||(t[0]=i.withModifiers(r=>n.onOriginalQueryClick(r),["prevent"])),class:"searchstax-feedback-original-query","aria-label":"Search instead for "+n.searchFeedbackData.originalQuery},i.toDisplayString(n.searchFeedbackData.originalQuery),9,Zo)])):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)}}}),ec=["id"],tc=i.defineComponent({__name:"SearchstaxSearchFeedbackWidget",setup(n){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=c=>{S.searchstax.searchFeedbackWidget.onOriginalQueryClick(c)},r=()=>{S.searchstax.dataLayer.$searchFeedbackData.subscribe(c=>{t.value=c})},o=i.computed(()=>!!e.searchFeedback);return i.onMounted(()=>{if(S.searchstax)r(),S.searchstax.addSearchFeedbackWidget("search-feedback-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>{var d;return i.openBlock(),i.createElementBlock("div",{class:"search-feedback-container",id:"search-feedback-container"+i.unref(a)},[t.value&&t.value.searchExecuted&&!o.value&&((d=t.value)!=null&&d.totalResults)?(i.openBlock(),i.createBlock(Xo,{key:0,searchFeedbackData:t.value,onOriginalQueryClick:s},null,8,["searchFeedbackData"])):i.createCommentVNode("",!0),i.renderSlot(c.$slots,"searchFeedback",{searchFeedbackData:t.value,onOriginalQueryClick:s})],8,ec)}}}),ac={key:0,class:"searchstax-sorting-container"},sc=["value"],nc=["value"],rc=i.defineComponent({__name:"SearchstaxSortingWidgetTemplate",props:{sortingData:{type:Object,required:!0},selectedSorting:{type:String,required:!0},orderChange:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s;return n.sortingData&&((a=n.sortingData)!=null&&a.searchExecuted)&&((s=n.sortingData)!=null&&s.hasResultsOrExternalPromotions)&&n.sortingData.sortOptions.length>0?(i.openBlock(),i.createElementBlock("div",ac,[t[1]||(t[1]=i.createElementVNode("label",{class:"searchstax-sorting-label",for:"searchstax-search-order-select"},"Sort By",-1)),i.createElementVNode("select",{id:"searchstax-search-order-select",class:"searchstax-search-order-select",value:n.selectedSorting,onChange:t[0]||(t[0]=r=>n.orderChange(r))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.sortingData.sortOptions,r=>(i.openBlock(),i.createElementBlock("option",{key:r.key,value:r.key},i.toDisplayString(r.value),9,nc))),128))],40,sc)])):i.createCommentVNode("",!0)}}}),ic=["id"],oc=i.defineComponent({__name:"SearchstaxSortingWidget",setup(n){const e=i.useSlots(),t=i.ref(null),a=i.ref(""),s=Math.random(),r=l=>{S.searchstax.searchSortingWidget.setOrderQuery(l.target.value)},o=()=>{S.searchstax.dataLayer.$searchSortingData.subscribe(l=>{t.value=l}),S.searchstax.dataLayer.$searchObject.subscribe(l=>{a.value=decodeURIComponent(l.order)})},c=i.computed(()=>!!e.sorting);return i.onMounted(()=>{if(S.searchstax)o(),S.searchstax.addSearchSortingWidget("search-sorting-container"+s,{});else throw Error("Searchstax instance needs to be passed via props")}),(l,d)=>{var p,g;return i.openBlock(),i.createElementBlock("div",{id:"search-sorting-container"+i.unref(s)},[t.value&&((p=t.value)!=null&&p.searchExecuted)&&((g=t.value)!=null&&g.hasResultsOrExternalPromotions)&&!c.value?(i.openBlock(),i.createBlock(rc,{key:0,sortingData:t.value,selectedSorting:a.value,orderChange:r},null,8,["sortingData","selectedSorting"])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"sorting",{sortingData:t.value,orderChange:r,selectedSorting:a.value})],8,ic)}}}),cc={key:0,class:"searchstax-external-promotions-container",id:"searchstax-external-promotions-container"},lc=["onClick"],hc={class:"searchstax-search-result-title-container"},dc={class:"searchstax-search-result-title"},uc={key:1,class:"searchstax-search-result-description searchstax-search-result-common"},pc={key:2,class:"searchstax-search-result-description searchstax-search-result-common"},gc=i.defineComponent({__name:"SearchstaxExternalPromotionsWidgetTemplate",props:{externalPromotionsData:{type:Object,required:!0},trackClick:{type:Function,required:!1}},setup(n){return(e,t)=>{var a,s;return n.externalPromotionsData&&((a=n.externalPromotionsData)!=null&&a.searchExecuted)&&((s=n.externalPromotionsData)!=null&&s.hasExternalPromotions)?(i.openBlock(),i.createElementBlock("div",cc,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.externalPromotionsData.externalPromotions,r=>(i.openBlock(),i.createElementBlock("div",{class:"searchstax-external-promotion searchstax-search-result",key:r.id},[t[0]||(t[0]=i.createElementVNode("div",{class:"icon-elevated"},null,-1)),r.url?(i.openBlock(),i.createElementBlock("a",{key:0,href:"{{externalPromotion.url}}",onClick:o=>n.trackClick(r,o),class:"searchstax-result-item-link"},null,8,lc)):i.createCommentVNode("",!0),i.createElementVNode("div",hc,[i.createElementVNode("span",dc,i.toDisplayString(r.name),1)]),r.description?(i.openBlock(),i.createElementBlock("p",uc,i.toDisplayString(r.description),1)):i.createCommentVNode("",!0),r.url?(i.openBlock(),i.createElementBlock("p",pc,i.toDisplayString(r.url),1)):i.createCommentVNode("",!0)]))),128))])):i.createCommentVNode("",!0)}}}),mc=["id"],fc=i.defineComponent({__name:"SearchstaxExternalPromotionsWidget",setup(n){const e=i.useSlots(),t=i.ref(null),a=Math.random(),s=()=>{S.searchstax.dataLayer.$searchExternalPromotionsData.subscribe(c=>{t.value=c})},r=(c,l)=>{S.searchstax.externalPromotionsWidget.trackClick(c,l)},o=i.computed(()=>!!e.externalPromotions);return i.onMounted(()=>{if(S.searchstax)s(),S.searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container"+a,{});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-external-promotions-layout-container"+i.unref(a)},[o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(gc,{key:0,externalPromotionsData:t.value,trackClick:r},null,8,["externalPromotionsData"])),i.renderSlot(c.$slots,"externalPromotions",{externalPromotionsData:t.value,trackClick:r})],8,mc))}}),yc={key:0,class:"searchstax-related-searches-container",id:"searchstax-related-searches-container"},Lc={key:0,class:"searchstax-related-search"},wc=["onClick","onKeyup","aria-label"],bc={key:0},Cc=i.defineComponent({__name:"SearchstaxRelatedSearchesWidgetTemplate",props:{relatedData:{type:Object,required:!0},executeSearch:{type:Function,required:!0}},setup(n){return(e,t)=>{var a,s;return n.relatedData&&((a=n.relatedData)!=null&&a.searchExecuted)&&((s=n.relatedData)!=null&&s.hasRelatedSearches)?(i.openBlock(),i.createElementBlock("div",yc,[t[0]||(t[0]=i.createTextVNode(" Related searches: ",-1)),t[1]||(t[1]=i.createElementVNode("span",{id:"searchstax-related-searches"},null,-1)),n.relatedData.relatedSearches?(i.openBlock(),i.createElementBlock("span",Lc,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.relatedData.relatedSearches,r=>(i.openBlock(),i.createElementBlock("span",{key:r.related_search,onClick:o=>n.executeSearch(r),onKeyup:[i.withKeys(o=>n.executeSearch(r),["enter"]),i.withKeys(o=>n.executeSearch(r),["space"])],tabindex:"0",class:"searchstax-related-search searchstax-related-search-item","aria-label":"Related search: "+r.related_search},[i.createTextVNode(i.toDisplayString(r.related_search),1),r.last?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",bc,","))],40,wc))),128))])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)}}}),kc=i.defineComponent({__name:"SearchstaxRelatedSearchesWidget",props:{relatedSearchesURL:{},relatedSearchesAPIKey:{}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=c=>{S.searchstax.relatedSearchesWidget.executeSearch(c)},r=()=>{S.searchstax.dataLayer.$searchRelatedSearchesData.subscribe(c=>{a.value=c})},o=i.computed(()=>!!t.related);return i.onMounted(()=>{if(S.searchstax)r(),S.searchstax.addRelatedSearchesWidget("searchstax-related-searches-container",{relatedSearchesURL:e.relatedSearchesURL,relatedSearchesAPIKey:e.relatedSearchesAPIKey});else throw Error("Searchstax instance needs to be passed via props")}),(c,l)=>{var d,p;return i.openBlock(),i.createElementBlock(i.Fragment,null,[a.value&&((d=a.value)!=null&&d.searchExecuted)&&((p=a.value)!=null&&p.hasRelatedSearches)&&!o.value?(i.openBlock(),i.createBlock(Cc,{key:0,relatedData:a.value,executeSearch:s},null,8,["relatedData"])):i.createCommentVNode("",!0),i.renderSlot(c.$slots,"related",{relatedData:a.value,executeSearch:s})],64)}}}),xc={key:0},Mc={class:"searchstax-answer-wrap"},Sc=["innerHTML"],Tc=["innerHTML"],Ec={key:1,class:"searchstax-answer-loading"},Dc={key:0,class:"searchstax-answer-load-more-button-container"},Ac=i.defineComponent({__name:"SearchstaxAnswerWidgetTemplate",props:{answerData:{type:Object,required:!0},showMore:{type:Function,required:!1}},setup(n){return(e,t)=>{var a;return n.answerData&&((a=n.answerData)!=null&&a.searchExecuted)&&n.answerData.shouldShowAnswer?(i.openBlock(),i.createElementBlock("div",xc,[i.createElementVNode("div",Mc,[t[2]||(t[2]=i.createElementVNode("div",{class:"searchstax-answer-icon"},null,-1)),i.createElementVNode("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"searchstax-answer-container":!0,"searchstax-answer-show-more":n.answerData.showMoreButtonVisible})},[t[1]||(t[1]=i.createElementVNode("div",{class:"searchstax-answer-title"},"Smart Answers",-1)),n.answerData.shouldShowAnswerError?(i.openBlock(),i.createElementBlock("div",{key:0,class:"searchstax-answer-error",innerHTML:n.answerData.answerErrorMessage},null,8,Sc)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"searchstax-answer-description",innerHTML:n.answerData.fullAnswerFormatted},null,8,Tc),n.answerData.answerLoading?(i.openBlock(),i.createElementBlock("div",Ec)):i.createCommentVNode("",!0)],2),n.answerData.showMoreButtonVisible?(i.openBlock(),i.createElementBlock("div",Dc,[i.createElementVNode("button",{class:"searchstax-answer-load-more-button",onClick:t[0]||(t[0]=(...s)=>n.showMore&&n.showMore(...s))},"Show More")])):i.createCommentVNode("",!0)]),t[3]||(t[3]=i.createElementVNode("div",{class:"searchstax-answer-footer"},[i.createElementVNode("div",{id:"feedbackWidgetContainer"}),i.createElementVNode("div",{class:"searchstax-lightweight-widget-separator-inline"}),i.createElementVNode("p",{class:"searchstax-disclaimer"},"Generative AI is Experimental")],-1))])])):i.createCommentVNode("",!0)}}}),Ic=["id"],vc=i.defineComponent({__name:"SearchstaxAnswerWidget",props:{showMoreAfterWordCount:{},feedbackwidget:{},testString:{}},setup(n){const e=n,t=i.useSlots(),a=i.ref(null),s=Math.random(),r=()=>{S.searchstax.dataLayer.$answerData.subscribe(l=>{a.value=l})},o=l=>{var d;S.searchstax&&((d=S.searchstax.answerWidget)==null||d.showMore(l))},c=i.computed(()=>!!t.answer);return i.onMounted(()=>{if(S.searchstax)r(),S.searchstax.addAnswerWidget("searchstax-answer-container"+s,{showMoreAfterWordCount:e.showMoreAfterWordCount,feedbackwidget:e.feedbackwidget,testString:e.testString});else throw Error("Searchstax instance needs to be passed via props")}),(l,d)=>(i.openBlock(),i.createElementBlock("div",{id:"searchstax-answer-container"+i.unref(s)},[!c.value&&a.value?(i.openBlock(),i.createBlock(Ac,{key:0,answerData:a.value,showMore:o},null,8,["answerData"])):i.createCommentVNode("",!0),i.renderSlot(l.$slots,"answer",{answerData:a.value,showMore:o})],8,Ic))}});te.SearchstaxAnswerWidget=vc,te.SearchstaxExternalPromotionsWidget=fc,te.SearchstaxFacetsWidget=Oo,te.SearchstaxInputWidget=Di,te.SearchstaxLocationWidget=vs,te.SearchstaxPaginationWidget=Yo,te.SearchstaxRelatedSearchesWidget=kc,te.SearchstaxResultWidget=Zi,te.SearchstaxSearchFeedbackWidget=tc,te.SearchstaxSortingWidget=oc,te.SearchstaxWrapper=pi,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})})(this["@searchstaxInc/searchstudioUxVue"]=this["@searchstaxInc/searchstudioUxVue"]||{},vue);
|