@searchstax-inc/searchstudio-ux-js 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/@searchstax-inc/searchstudio-ux-js.cjs +9 -7
- package/dist/@searchstax-inc/searchstudio-ux-js.iife.js +9 -7
- package/dist/@searchstax-inc/searchstudio-ux-js.mjs +26 -24
- package/dist/styles/mainTheme.css +3 -2
- package/dist/styles/scss/mainTheme.scss +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -444,12 +444,14 @@ searchstax.addSearchFeedbackWidget("search-feedback-container", {
|
|
|
444
444
|
template: `
|
|
445
445
|
{{#searchExecuted}}
|
|
446
446
|
<div class="searchstax-feedback-container">
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
447
|
+
{{#if totalResults}}
|
|
448
|
+
Showing <b>{{startResultIndex}} - {{endResultIndex}}</b> of <b>{{totalResults}}</b> results {{#searchTerm}} for "<b>{{searchTerm}}</b>" {{/searchTerm}}
|
|
449
|
+
<div class="searchstax-feedback-container-suggested">
|
|
450
|
+
{{#autoCorrectedQuery}}
|
|
451
|
+
Search instead for <a href="#" class="searchstax-feedback-original-query">{{originalQuery}}</a>
|
|
452
|
+
{{/autoCorrectedQuery}}
|
|
453
|
+
</div>
|
|
454
|
+
{{/if}}
|
|
453
455
|
</div>
|
|
454
456
|
{{/searchExecuted}}
|
|
455
457
|
`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _=Object.defineProperty;var z=(o,e,t)=>e in o?_(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var n=(o,e,t)=>(z(o,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var x=(o=>(o[o.mustache=0]="mustache",o[o.vue=1]="vue",o[o.react=2]="react",o[o.angular=3]="angular",o))(x||{});class J{constructor(e){n(this,"dataLayer");this.dataLayer=e}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.recordsPerPageValue)||0}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 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 searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}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(s=>{const i=s.name,c=s.value,l=e.find(h=>h.name===i);if(l){const h=l.values.find(u=>u.type==="range"?!1:u.type==="checkbox"?'"'+u.value+'"'===c:!1);if(h)return h}return null}).filter(s=>s!==null):[]}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,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,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}}get trackingData(){var e,t,a,r;return{searchTerm:this.dataLayer.searchTerm!=="undefined"?this.dataLayer.searchTerm:"",trackApiKey:((e=this.dataLayer.searchstaxConfig)==null?void 0:e.trackApiKey)??"",session:this.dataLayer.sessionId,language:this.dataLayer.language,recordsPerPage:((t=this.dataLayer.searchResultsMetadata)==null?void 0:t.recordsPerPageValue)??0,totalResults:((a=this.dataLayer.searchResultsMetadata)==null?void 0:a.totalResultsValue)??0,currentPage:this.dataLayer.currentPage,latencyVal:((r=this.dataLayer.searchResultsMetadata)==null?void 0:r.latency)??0}}}class F{static deepEqual(e,t){const a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(const s of a){const i=e[s],c=t[s],l=this.isObject(i)&&this.isObject(c);if(l&&!this.deepEqual(i,c)||!l&&i!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class L{constructor(e){n(this,"value");n(this,"observers",[]);this.value=e,this.observers=[]}subscribe(e){this.observers.push(e),e(this.value)}unsubscribe(e){const t=this.observers.indexOf(e);t!==-1&&this.observers.splice(t,1)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){this.observers.forEach(e=>e(this.value))}}class E{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 X{constructor(e){n(this,"$searchTermChange",new L(""));n(this,"$loadingChange",new L(!1));n(this,"$searchResults",new L(null));n(this,"$searchResultsMetadata",new L(null));n(this,"$searchAutosuggest",new L(null));n(this,"$searchFacets",new L(null));n(this,"$searchFacetsCached",new L(null));n(this,"$searchstaxConfig",new L(null));n(this,"$autosuggestResults",new L(null));n(this,"$searchObject",new L({query:"",page:99999999,order:"",facets:[],additionalProps:[]}));n(this,"$searchRelatedSearches",new L(null));n(this,"$searchInputConfig",new L(null));n(this,"$searchExternalPromotions",new L(null));n(this,"$facetsTemplateData",new L(null));n(this,"$selectedFacetsTemplateData",new L(null));n(this,"$paginationData",new L(null));n(this,"$searchFeedbackData",new L(null));n(this,"$searchSortingData",new L(null));n(this,"$searchRelatedSearchesData",new L(null));n(this,"$searchExternalPromotionsData",new L(null));n(this,"$language",new L("en"));n(this,"currentPageValue",1);n(this,"renderingEngineValue",x.mustache);n(this,"parsedData",new J(this));n(this,"sessionId");n(this,"autoCorrect",!0);n(this,"forceNotCorrect",!1);this.sessionId=e}setSearchTerm(e){this.$searchTermChange.setValue(E.removeXSSRiskyTags(e))}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){F.deepEqual(e,this.searchResults??[""])||this.$searchResults.setValue(e)}setSearchResultsMetadata(e){F.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var a,r;let t=e;(r=(a=this.searchstaxConfig)==null?void 0:a.hooks)!=null&&r.beforeSearch&&t&&(t=this.searchstaxConfig.hooks.beforeSearch(t)),t&&(!F.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){F.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){F.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){F.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){F.deepEqual(e,this.searchExternalPromotions??[])||this.$searchExternalPromotions.setValue(e)}setLanguage(e){this.$language.setValue(e)}setSearchstaxConfig(e){this.$searchstaxConfig.setValue(e)}setSearchInputConfig(e){this.$searchInputConfig.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)}setSearchFeedbackData(e){this.$searchFeedbackData.setValue(e)}setSearchSortingData(e){this.$searchSortingData.setValue(e)}setRelatedSearchesData(e){this.$searchRelatedSearchesData.setValue(e)}setExternalPromotionsData(e){this.$searchExternalPromotionsData.setValue(e)}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 searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.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.currentPageValue}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 searchInputConfig(){return this.$searchInputConfig.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()}}class O{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"")-1,r=parseInt(e.responseHeader.params.rows);return e.response.docs.forEach((s,i)=>{const c={custom:null,uniqueId:this.getValueByKey(e.responseHeader.params.uniqueId,s,e)??"",position:a*r+1+i,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",s,e):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",s,e):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",s,e):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",s,e):null,promoted:s["[elevated]"]?s["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",s,e):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",s,e):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",s,e):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",s,e):null,unmappedFields:this.getUnmappedFields(s,e),allFields:this.getAllFields(s,e)};t.push(c)}),t}static extractFacets(e){const t=[];for(const a of e.metadata.facets){let r={values:[]};if(r.name=a.name,r.label=a.label,a.name in e.facet_counts.facet_fields){const s=e.facet_counts.facet_fields[a.name];for(let i=0;i<s.length;i+=2){const c={};c.value=s[i],c.parentName=r.name,c.count=s[i+1],c.type="checkbox",r.values.push(c)}}r.values.length>0&&t.push(r)}return t}static extractSearchResultsMetadata(e){var a,r,s,i;let t="";return t=((i=(s=(r=(a=e==null?void 0:e.spellcheck)==null?void 0:a.suggestions)==null?void 0:r[0])==null?void 0:s.suggestion)==null?void 0:i[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)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const r in a){const s=a[r],i={};i.cDocId=this.getDataForAnalytics(s.uniqueId),s.title&&(i.cDocTitle=this.getDataForAnalytics(s.title)),i.position=s.position,t.push(i)}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){const a=t.metadata.results.filter(s=>s.result_card==="").map(s=>s.name),r=[];for(const s of Object.keys(e))if(a.indexOf(s)!==-1){const i=Array.isArray(e[s])?e[s].join(", "):e[s];r.push({key:s,value:i,isImage:this.checkIfImage(e[s])})}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(s=>s.name),r=[];for(const s of Object.keys(e))a.indexOf(s)!==-1&&r.push({key:s,value:e[s],isImage:this.checkIfImage(e[s])});return r}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a){const r=a.metadata.results.find(i=>i.result_card===e);if(r===void 0)return null;const s=t[r.name];return s===void 0?null:typeof s=="string"?s:Array.isArray(s)?s.join(", "):null}}class W{constructor(e){n(this,"routeName","searchstax");n(this,"ignoredKeys",[]);n(this,"queryStringHelper");n(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new G(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let a=document.title;this.titleParser&&(a=this.titleParser(e)),document.title=a,window.location.href!==t&&window.history.pushState({},a,t)}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams(window.location.href)?window.location.href.split("?")[0]+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):window.location.href+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={};if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),e.page&&(t[this.routeName+"[page]"]=e.page+""),e.order&&(t[this.routeName+"[order]"]=e.order),e.facets)for(const a in e.facets){const r=e.facets[a].type+":"+encodeURIComponent(e.facets[a].name)+":"+encodeURIComponent(e.facets[a].value);t[this.routeName+`[facets][${a}]`]=r}if(this.queryStringHelper.urlHasQueryParams(window.location.href)){const a=this.queryStringHelper.urlToParams(window.location.href);for(const r in a)r.startsWith(this.routeName)&&delete a[r];return{...a,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const a in e)a.startsWith(this.routeName)||(t[a]=e[a]);return t}extractArrayOfFacetsFromQueryParameters(e){var a,r,s;const t=[];for(const i in e)if(i.startsWith(this.routeName+"[facets]")){const c=E.removeXSSRiskyTags((a=e[i].split(":"))==null?void 0:a[0]),l=E.removeXSSRiskyTags(decodeURIComponent((r=e[i].split(":"))==null?void 0:r[1])),h=E.removeXSSRiskyTags(decodeURIComponent((s=e[i].split(":"))==null?void 0:s[2]));t.push({type:c,name:l,value:h})}return t}urlToSearchObject(e){const t=this.queryStringHelper.urlToParams(e);return{query:E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName+"[query]"]))||"",page:E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName+"[page]"]))?parseInt(t[this.routeName+"[page]"]):1,order:E.removeXSSRiskyTags(t[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(t)||[]}}}class G{constructor(e){n(this,"routeName","");n(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(r=>{const s=a[r];return Array.isArray(s)?s.map(i=>`${r}=${i}`).join("&"):`${r}=${s}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],r={};return Object.keys(e).forEach(s=>{a.includes(s)||e[s]!==""&&(r[s]=e[s])}),r}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(r=>{const[s,i]=r.split("=");t[s]=i}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}class Y{constructor(e,t){n(this,"cachedQuery","");n(this,"url","");n(this,"relatedSearches","");n(this,"suggester","");n(this,"authHeader");n(this,"authHeaderRelated");n(this,"trackApiKey","");n(this,"session","");n(this,"searchAuthType");n(this,"searchAuth","");n(this,"controllerSearch");n(this,"signalSearch");n(this,"controllerSuggest");n(this,"signalSuggest");n(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");const a=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`;this.authHeader.append("Authorization",a),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(r){const s=r.name+':"'+r.value+'"';a=a.concat("fq="+decodeURIComponent(s).replace(" "," "))});else{const r={};e.forEach(function(s){const i=s.name+":"+s.value,c=decodeURIComponent(i).replace(" "," ").split(":");r[c[0]]?r[c[0]].push(c[1]):r[c[0]]=[c[1]]});for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)){const i=r[s],c=s;let l="";for(const h of i)l+=` ${c}:"${h}"`;a=a.concat("fq="+l.trim())}}return a.length?"&"+a.join("&"):""}getRelatedSearches(e,t,a,r){const s=new Headers;s.append("Accept","application/json"),s.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:s,credentials:"same-origin"}).then(i=>i.json()).then(i=>{r(i)})}cacheFacets(){this.dataLayer.searchObject.query!==this.cachedQuery&&(this.cachedQuery=this.dataLayer.searchObject.query,this.search({query:this.dataLayer.searchObject.query??"*",page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps},this.cacheFacetsCallback.bind(this)))}cacheFacetsCallback(e){let t=O.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,r=!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 s=new Proxy(new URLSearchParams(window.location.search),{get:(u,g)=>u.get(g)??""}),i=s.languageVariant?"&fq=_language:"+s.languageVariant:"",c=e.order?`&sort=${e.order}`:"",l=this.url+"?q="+encodeURIComponent(e.query.trim())+"&start="+(e.page-1)+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(u=>u.type==="or"||u.type==="showUnavailable"),!0)+this.generateFacetQuery(e.facets.filter(u=>u.type==="and"||u.type==="tabs"),!1)+c+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!r}&language=`+this.dataLayer.language+i,h={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete h.signal,fetch(l,h).then(u=>u.json()).then(u=>{this.dataLayer.setLoading(!1),t(u)}).catch(()=>{this.dataLayer.setLoading(!1)})}}suggest(e,t,a){this.controllerSuggest&&this.controllerSuggest.abort(),this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const r=this.suggester+"?q="+e.trim()+this.toQueryString(a)+"&language="+this.dataLayer.language;fetch(r,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(s=>s.json()).then(s=>{t(s)}).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("&")}}class Z{static getOrSetCookie(e){let t=this.getCookie(e);return t==null&&(t=this.makeid(25),this.setCookie(e,t,{secure:!0,"max-age":3600})),t}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let s=0;s<e;s++)t+=a.charAt(Math.floor(Math.random()*r));return t}static getCookie(e){const t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,a){const r={path:"/",...a};a.expires instanceof Date&&(r.expires=a.expires.toUTCString());let s=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const i in r){s+="; "+i;const c=r[i];c!==!0&&(s+="="+c)}document.cookie=s}}class H{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.title,position:e.result.position,language:e.language};setTimeout(()=>{this.msq.push(["trackClick",t])},0)}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,impressions:e.impressions};setTimeout(()=>{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:e.currentPage,shownHits:e.recordsPerPage,totalHits:e.totalResults,language:e.language};setTimeout(()=>{this.msq.push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,latency:e.latencyVal,language:e.language,impressions:e.impressions};setTimeout(()=>{this.msq.push(["trackRelatedSearch",t])},0)}}n(H,"msq",window._msq||[]);/*!
|
|
1
|
+
"use strict";var _=Object.defineProperty;var z=(o,e,t)=>e in o?_(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var n=(o,e,t)=>(z(o,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var x=(o=>(o[o.mustache=0]="mustache",o[o.vue=1]="vue",o[o.react=2]="react",o[o.angular=3]="angular",o))(x||{});class J{constructor(e){n(this,"dataLayer");this.dataLayer=e}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.recordsPerPageValue)||0}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 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 searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}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(s=>{const i=s.name,c=s.value,l=e.find(h=>h.name===i);if(l){const h=l.values.find(u=>u.type==="range"?!1:u.type==="checkbox"?'"'+u.value+'"'===c:!1);if(h)return h}return null}).filter(s=>s!==null):[]}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,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,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}}get trackingData(){var e,t,a,r;return{searchTerm:this.dataLayer.searchTerm!=="undefined"?this.dataLayer.searchTerm:"",trackApiKey:((e=this.dataLayer.searchstaxConfig)==null?void 0:e.trackApiKey)??"",session:this.dataLayer.sessionId,language:this.dataLayer.language,recordsPerPage:((t=this.dataLayer.searchResultsMetadata)==null?void 0:t.recordsPerPageValue)??0,totalResults:((a=this.dataLayer.searchResultsMetadata)==null?void 0:a.totalResultsValue)??0,currentPage:this.dataLayer.currentPage,latencyVal:((r=this.dataLayer.searchResultsMetadata)==null?void 0:r.latency)??0}}}class F{static deepEqual(e,t){const a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(const s of a){const i=e[s],c=t[s],l=this.isObject(i)&&this.isObject(c);if(l&&!this.deepEqual(i,c)||!l&&i!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class L{constructor(e){n(this,"value");n(this,"observers",[]);this.value=e,this.observers=[]}subscribe(e){this.observers.push(e),e(this.value)}unsubscribe(e){const t=this.observers.indexOf(e);t!==-1&&this.observers.splice(t,1)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){this.observers.forEach(e=>e(this.value))}}class E{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 X{constructor(e){n(this,"$searchTermChange",new L(""));n(this,"$loadingChange",new L(!1));n(this,"$searchResults",new L(null));n(this,"$searchResultsMetadata",new L(null));n(this,"$searchAutosuggest",new L(null));n(this,"$searchFacets",new L(null));n(this,"$searchFacetsCached",new L(null));n(this,"$searchstaxConfig",new L(null));n(this,"$autosuggestResults",new L(null));n(this,"$searchObject",new L({query:"",page:99999999,order:"",facets:[],additionalProps:[]}));n(this,"$searchRelatedSearches",new L(null));n(this,"$searchInputConfig",new L(null));n(this,"$searchExternalPromotions",new L(null));n(this,"$facetsTemplateData",new L(null));n(this,"$selectedFacetsTemplateData",new L(null));n(this,"$paginationData",new L(null));n(this,"$searchFeedbackData",new L(null));n(this,"$searchSortingData",new L(null));n(this,"$searchRelatedSearchesData",new L(null));n(this,"$searchExternalPromotionsData",new L(null));n(this,"$language",new L("en"));n(this,"currentPageValue",1);n(this,"renderingEngineValue",x.mustache);n(this,"parsedData",new J(this));n(this,"sessionId");n(this,"autoCorrect",!0);n(this,"forceNotCorrect",!1);this.sessionId=e}setSearchTerm(e){this.$searchTermChange.setValue(E.removeXSSRiskyTags(e))}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){F.deepEqual(e,this.searchResults??[""])||this.$searchResults.setValue(e)}setSearchResultsMetadata(e){F.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var a,r;let t=e;(r=(a=this.searchstaxConfig)==null?void 0:a.hooks)!=null&&r.beforeSearch&&t&&(t=this.searchstaxConfig.hooks.beforeSearch(t)),t&&(!F.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){F.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){F.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){F.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){F.deepEqual(e,this.searchExternalPromotions??[])||this.$searchExternalPromotions.setValue(e)}setLanguage(e){this.$language.setValue(e)}setSearchstaxConfig(e){this.$searchstaxConfig.setValue(e)}setSearchInputConfig(e){this.$searchInputConfig.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)}setSearchFeedbackData(e){this.$searchFeedbackData.setValue(e)}setSearchSortingData(e){this.$searchSortingData.setValue(e)}setRelatedSearchesData(e){this.$searchRelatedSearchesData.setValue(e)}setExternalPromotionsData(e){this.$searchExternalPromotionsData.setValue(e)}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 searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.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.currentPageValue}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 searchInputConfig(){return this.$searchInputConfig.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()}}class O{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"")-1,r=parseInt(e.responseHeader.params.rows);return e.response.docs.forEach((s,i)=>{const c={custom:null,uniqueId:this.getValueByKey(e.responseHeader.params.uniqueId,s,e)??"",position:a*r+1+i,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",s,e):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",s,e):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",s,e):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",s,e):null,promoted:s["[elevated]"]?s["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",s,e):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",s,e):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",s,e):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",s,e):null,unmappedFields:this.getUnmappedFields(s,e),allFields:this.getAllFields(s,e)};t.push(c)}),t}static extractFacets(e){const t=[];for(const a of e.metadata.facets){let r={values:[]};if(r.name=a.name,r.label=a.label,a.name in e.facet_counts.facet_fields){const s=e.facet_counts.facet_fields[a.name];for(let i=0;i<s.length;i+=2){const c={};c.value=s[i],c.parentName=r.name,c.count=s[i+1],c.type="checkbox",r.values.push(c)}}r.values.length>0&&t.push(r)}return t}static extractSearchResultsMetadata(e){var a,r,s,i;let t="";return t=((i=(s=(r=(a=e==null?void 0:e.spellcheck)==null?void 0:a.suggestions)==null?void 0:r[0])==null?void 0:s.suggestion)==null?void 0:i[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)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const r in a){const s=a[r],i={};i.cDocId=this.getDataForAnalytics(s.uniqueId),s.title&&(i.cDocTitle=this.getDataForAnalytics(s.title)),i.position=s.position,t.push(i)}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){const a=t.metadata.results.filter(s=>s.result_card==="").map(s=>s.name),r=[];for(const s of Object.keys(e))if(a.indexOf(s)!==-1){const i=Array.isArray(e[s])?e[s].join(", "):e[s];r.push({key:s,value:i,isImage:this.checkIfImage(e[s])})}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(s=>s.name),r=[];for(const s of Object.keys(e))a.indexOf(s)!==-1&&r.push({key:s,value:e[s],isImage:this.checkIfImage(e[s])});return r}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a){const r=a.metadata.results.find(i=>i.result_card===e);if(r===void 0)return null;const s=t[r.name];return s===void 0?null:typeof s=="string"?s:Array.isArray(s)?s.join(", "):null}}class W{constructor(e){n(this,"routeName","searchstax");n(this,"ignoredKeys",[]);n(this,"queryStringHelper");n(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new G(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let a=document.title;this.titleParser&&(a=this.titleParser(e)),document.title=a,window.location.href!==t&&window.history.pushState({},a,t)}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams(window.location.href)?window.location.href.split("?")[0]+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):window.location.href+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={},a=e.page||1;if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),t[this.routeName+"[page]"]=a+"",e.order&&(t[this.routeName+"[order]"]=e.order),e.facets)for(const r in e.facets){const s=e.facets[r].type+":"+encodeURIComponent(e.facets[r].name)+":"+encodeURIComponent(e.facets[r].value);t[this.routeName+`[facets][${r}]`]=s}if(this.queryStringHelper.urlHasQueryParams(window.location.href)){const r=this.queryStringHelper.urlToParams(window.location.href);for(const s in r)s.startsWith(this.routeName)&&delete r[s];return{...r,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const a in e)a.startsWith(this.routeName)||(t[a]=e[a]);return t}extractArrayOfFacetsFromQueryParameters(e){var a,r,s;const t=[];for(const i in e)if(i.startsWith(this.routeName+"[facets]")){const c=E.removeXSSRiskyTags((a=e[i].split(":"))==null?void 0:a[0]),l=E.removeXSSRiskyTags(decodeURIComponent((r=e[i].split(":"))==null?void 0:r[1])),h=E.removeXSSRiskyTags(decodeURIComponent((s=e[i].split(":"))==null?void 0:s[2]));t.push({type:c,name:l,value:h})}return t}urlToSearchObject(e){const t=this.queryStringHelper.urlToParams(e),a=E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName+"[page]"])),r=parseInt(a),s=isNaN(r)?1:r;return{query:E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName+"[query]"]))||"",page:s,order:E.removeXSSRiskyTags(t[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(t)||[]}}}class G{constructor(e){n(this,"routeName","");n(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(r=>{const s=a[r];return Array.isArray(s)?s.map(i=>`${r}=${i}`).join("&"):`${r}=${s}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],r={};return Object.keys(e).forEach(s=>{a.includes(s)||e[s]!==""&&(r[s]=e[s])}),r}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(r=>{const[s,i]=r.split("=");t[s]=i}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}class Y{constructor(e,t){n(this,"cachedQuery","");n(this,"url","");n(this,"relatedSearches","");n(this,"suggester","");n(this,"authHeader");n(this,"authHeaderRelated");n(this,"trackApiKey","");n(this,"session","");n(this,"searchAuthType");n(this,"searchAuth","");n(this,"controllerSearch");n(this,"signalSearch");n(this,"controllerSuggest");n(this,"signalSuggest");n(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");const a=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`;this.authHeader.append("Authorization",a),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(r){const s=r.name+':"'+r.value+'"';a=a.concat("fq="+decodeURIComponent(s).replace(" "," "))});else{const r={};e.forEach(function(s){const i=s.name+":"+s.value,c=decodeURIComponent(i).replace(" "," ").split(":");r[c[0]]?r[c[0]].push(c[1]):r[c[0]]=[c[1]]});for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)){const i=r[s],c=s;let l="";for(const h of i)l+=` ${c}:"${h}"`;a=a.concat("fq="+l.trim())}}return a.length?"&"+a.join("&"):""}getRelatedSearches(e,t,a,r){const s=new Headers;s.append("Accept","application/json"),s.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:s,credentials:"same-origin"}).then(i=>i.json()).then(i=>{r(i)})}cacheFacets(){this.dataLayer.searchObject.query!==this.cachedQuery&&(this.cachedQuery=this.dataLayer.searchObject.query,this.search({query:this.dataLayer.searchObject.query??"*",page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps},this.cacheFacetsCallback.bind(this)))}cacheFacetsCallback(e){let t=O.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,r=!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 s=new Proxy(new URLSearchParams(window.location.search),{get:(u,g)=>u.get(g)??""}),i=s.languageVariant?"&fq=_language:"+s.languageVariant:"",c=e.order?`&sort=${e.order}`:"",l=this.url+"?q="+encodeURIComponent(e.query.trim())+"&start="+(e.page-1)+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(u=>u.type==="or"||u.type==="showUnavailable"),!0)+this.generateFacetQuery(e.facets.filter(u=>u.type==="and"||u.type==="tabs"),!1)+c+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!r}&language=`+this.dataLayer.language+i,h={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete h.signal,fetch(l,h).then(u=>u.json()).then(u=>{this.dataLayer.setLoading(!1),t(u)}).catch(()=>{this.dataLayer.setLoading(!1)})}}suggest(e,t,a){this.controllerSuggest&&this.controllerSuggest.abort(),this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const r=this.suggester+"?q="+e.trim()+this.toQueryString(a)+"&language="+this.dataLayer.language;fetch(r,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(s=>s.json()).then(s=>{t(s)}).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("&")}}class Z{static getOrSetCookie(e){let t=this.getCookie(e);return t==null&&(t=this.makeid(25),this.setCookie(e,t,{secure:!0,"max-age":3600})),t}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let s=0;s<e;s++)t+=a.charAt(Math.floor(Math.random()*r));return t}static getCookie(e){const t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,a){const r={path:"/",...a};a.expires instanceof Date&&(r.expires=a.expires.toUTCString());let s=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const i in r){s+="; "+i;const c=r[i];c!==!0&&(s+="="+c)}document.cookie=s}}class H{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.title,position:e.result.position,language:e.language};setTimeout(()=>{this.msq.push(["trackClick",t])},0)}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,impressions:e.impressions};setTimeout(()=>{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:e.currentPage,shownHits:e.recordsPerPage,totalHits:e.totalResults,language:e.language};setTimeout(()=>{this.msq.push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,latency:e.latencyVal,language:e.language,impressions:e.impressions};setTimeout(()=>{this.msq.push(["trackRelatedSearch",t])},0)}}n(H,"msq",window._msq||[]);/*!
|
|
2
2
|
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
3
3
|
* http://github.com/janl/mustache.js
|
|
4
4
|
*/var ee=Object.prototype.toString,D=Array.isArray||function(e){return ee.call(e)==="[object Array]"};function U(o){return typeof o=="function"}function te(o){return D(o)?"array":typeof o}function N(o){return o.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function K(o,e){return o!=null&&typeof o=="object"&&e in o}function ae(o,e){return o!=null&&typeof o!="object"&&o.hasOwnProperty&&o.hasOwnProperty(e)}var se=RegExp.prototype.test;function re(o,e){return se.call(o,e)}var ie=/\S/;function ne(o){return!re(ie,o)}var ce={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function le(o){return String(o).replace(/[&<>"'`=\/]/g,function(t){return ce[t]})}var oe=/\s*/,he=/\s+/,Q=/\s*=/,ue=/\s*\}/,de=/#|\^|\/|>|\{|&|=|!/;function ge(o,e){if(!o)return[];var t=!1,a=[],r=[],s=[],i=!1,c=!1,l="",h=0;function u(){if(i&&!c)for(;s.length;)delete r[s.pop()];else s=[];i=!1,c=!1}var g,p,y;function b(P){if(typeof P=="string"&&(P=P.split(he,2)),!D(P)||P.length!==2)throw new Error("Invalid tags: "+P);g=new RegExp(N(P[0])+"\\s*"),p=new RegExp("\\s*"+N(P[1])),y=new RegExp("\\s*"+N("}"+P[1]))}b(e||m.tags);for(var f=new V(o),C,S,v,R,I,T;!f.eos();){if(C=f.pos,v=f.scanUntil(g),v)for(var w=0,j=v.length;w<j;++w)R=v.charAt(w),ne(R)?(s.push(r.length),l+=R):(c=!0,t=!0,l+=" "),r.push(["text",R,C,C+1]),C+=1,R===`
|
|
@@ -118,12 +118,14 @@
|
|
|
118
118
|
`,relatedSearchContainerClass:"searchstax-related-search-item"}},ve={main:{template:`
|
|
119
119
|
{{#searchExecuted}}
|
|
120
120
|
<div class="searchstax-feedback-container">
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
{{#if totalResults}}
|
|
122
|
+
Showing <b>{{startResultIndex}} - {{endResultIndex}}</b> of <b>{{totalResults}}</b> results {{#searchTerm}} for "<b>{{searchTerm}}</b>" {{/searchTerm}}
|
|
123
|
+
<div class="searchstax-feedback-container-suggested">
|
|
124
|
+
{{#autoCorrectedQuery}}
|
|
125
|
+
Search instead for <a href="#" class="searchstax-feedback-original-query">{{originalQuery}}</a>
|
|
126
|
+
{{/autoCorrectedQuery}}
|
|
127
|
+
</div>
|
|
128
|
+
{{/if}}
|
|
127
129
|
</div>
|
|
128
130
|
{{/searchExecuted}}
|
|
129
131
|
`,originalQueryClass:"searchstax-feedback-original-query"}},Le={mainTemplate:{template:`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Me=Object.defineProperty;var De=(w,C,M)=>C in w?Me(w,C,{enumerable:!0,configurable:!0,writable:!0,value:M}):w[C]=M;var n=(w,C,M)=>(De(w,typeof C!="symbol"?C+"":C,M),M);(function(w){"use strict";var C=(o=>(o[o.mustache=0]="mustache",o[o.vue=1]="vue",o[o.react=2]="react",o[o.angular=3]="angular",o))(C||{});class M{constructor(e){n(this,"dataLayer");this.dataLayer=e}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.recordsPerPageValue)||0}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 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 searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}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(s=>{const i=s.name,c=s.value,l=e.find(h=>h.name===i);if(l){const h=l.values.find(u=>u.type==="range"?!1:u.type==="checkbox"?'"'+u.value+'"'===c:!1);if(h)return h}return null}).filter(s=>s!==null):[]}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,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,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}}get trackingData(){var e,t,a,r;return{searchTerm:this.dataLayer.searchTerm!=="undefined"?this.dataLayer.searchTerm:"",trackApiKey:((e=this.dataLayer.searchstaxConfig)==null?void 0:e.trackApiKey)??"",session:this.dataLayer.sessionId,language:this.dataLayer.language,recordsPerPage:((t=this.dataLayer.searchResultsMetadata)==null?void 0:t.recordsPerPageValue)??0,totalResults:((a=this.dataLayer.searchResultsMetadata)==null?void 0:a.totalResultsValue)??0,currentPage:this.dataLayer.currentPage,latencyVal:((r=this.dataLayer.searchResultsMetadata)==null?void 0:r.latency)??0}}}class F{static deepEqual(e,t){const a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(const s of a){const i=e[s],c=t[s],l=this.isObject(i)&&this.isObject(c);if(l&&!this.deepEqual(i,c)||!l&&i!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class L{constructor(e){n(this,"value");n(this,"observers",[]);this.value=e,this.observers=[]}subscribe(e){this.observers.push(e),e(this.value)}unsubscribe(e){const t=this.observers.indexOf(e);t!==-1&&this.observers.splice(t,1)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){this.observers.forEach(e=>e(this.value))}}class E{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 J{constructor(e){n(this,"$searchTermChange",new L(""));n(this,"$loadingChange",new L(!1));n(this,"$searchResults",new L(null));n(this,"$searchResultsMetadata",new L(null));n(this,"$searchAutosuggest",new L(null));n(this,"$searchFacets",new L(null));n(this,"$searchFacetsCached",new L(null));n(this,"$searchstaxConfig",new L(null));n(this,"$autosuggestResults",new L(null));n(this,"$searchObject",new L({query:"",page:99999999,order:"",facets:[],additionalProps:[]}));n(this,"$searchRelatedSearches",new L(null));n(this,"$searchInputConfig",new L(null));n(this,"$searchExternalPromotions",new L(null));n(this,"$facetsTemplateData",new L(null));n(this,"$selectedFacetsTemplateData",new L(null));n(this,"$paginationData",new L(null));n(this,"$searchFeedbackData",new L(null));n(this,"$searchSortingData",new L(null));n(this,"$searchRelatedSearchesData",new L(null));n(this,"$searchExternalPromotionsData",new L(null));n(this,"$language",new L("en"));n(this,"currentPageValue",1);n(this,"renderingEngineValue",C.mustache);n(this,"parsedData",new M(this));n(this,"sessionId");n(this,"autoCorrect",!0);n(this,"forceNotCorrect",!1);this.sessionId=e}setSearchTerm(e){this.$searchTermChange.setValue(E.removeXSSRiskyTags(e))}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){F.deepEqual(e,this.searchResults??[""])||this.$searchResults.setValue(e)}setSearchResultsMetadata(e){F.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var a,r;let t=e;(r=(a=this.searchstaxConfig)==null?void 0:a.hooks)!=null&&r.beforeSearch&&t&&(t=this.searchstaxConfig.hooks.beforeSearch(t)),t&&(!F.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){F.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){F.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){F.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){F.deepEqual(e,this.searchExternalPromotions??[])||this.$searchExternalPromotions.setValue(e)}setLanguage(e){this.$language.setValue(e)}setSearchstaxConfig(e){this.$searchstaxConfig.setValue(e)}setSearchInputConfig(e){this.$searchInputConfig.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)}setSearchFeedbackData(e){this.$searchFeedbackData.setValue(e)}setSearchSortingData(e){this.$searchSortingData.setValue(e)}setRelatedSearchesData(e){this.$searchRelatedSearchesData.setValue(e)}setExternalPromotionsData(e){this.$searchExternalPromotionsData.setValue(e)}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 searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.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.currentPageValue}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 searchInputConfig(){return this.$searchInputConfig.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()}}class O{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"")-1,r=parseInt(e.responseHeader.params.rows);return e.response.docs.forEach((s,i)=>{const c={custom:null,uniqueId:this.getValueByKey(e.responseHeader.params.uniqueId,s,e)??"",position:a*r+1+i,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",s,e):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",s,e):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",s,e):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",s,e):null,promoted:s["[elevated]"]?s["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",s,e):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",s,e):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",s,e):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",s,e):null,unmappedFields:this.getUnmappedFields(s,e),allFields:this.getAllFields(s,e)};t.push(c)}),t}static extractFacets(e){const t=[];for(const a of e.metadata.facets){let r={values:[]};if(r.name=a.name,r.label=a.label,a.name in e.facet_counts.facet_fields){const s=e.facet_counts.facet_fields[a.name];for(let i=0;i<s.length;i+=2){const c={};c.value=s[i],c.parentName=r.name,c.count=s[i+1],c.type="checkbox",r.values.push(c)}}r.values.length>0&&t.push(r)}return t}static extractSearchResultsMetadata(e){var a,r,s,i;let t="";return t=((i=(s=(r=(a=e==null?void 0:e.spellcheck)==null?void 0:a.suggestions)==null?void 0:r[0])==null?void 0:s.suggestion)==null?void 0:i[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)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const r in a){const s=a[r],i={};i.cDocId=this.getDataForAnalytics(s.uniqueId),s.title&&(i.cDocTitle=this.getDataForAnalytics(s.title)),i.position=s.position,t.push(i)}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){const a=t.metadata.results.filter(s=>s.result_card==="").map(s=>s.name),r=[];for(const s of Object.keys(e))if(a.indexOf(s)!==-1){const i=Array.isArray(e[s])?e[s].join(", "):e[s];r.push({key:s,value:i,isImage:this.checkIfImage(e[s])})}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(s=>s.name),r=[];for(const s of Object.keys(e))a.indexOf(s)!==-1&&r.push({key:s,value:e[s],isImage:this.checkIfImage(e[s])});return r}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a){const r=a.metadata.results.find(i=>i.result_card===e);if(r===void 0)return null;const s=t[r.name];return s===void 0?null:typeof s=="string"?s:Array.isArray(s)?s.join(", "):null}}class Q{constructor(e){n(this,"routeName","searchstax");n(this,"ignoredKeys",[]);n(this,"queryStringHelper");n(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new X(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let a=document.title;this.titleParser&&(a=this.titleParser(e)),document.title=a,window.location.href!==t&&window.history.pushState({},a,t)}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams(window.location.href)?window.location.href.split("?")[0]+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):window.location.href+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={};if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),e.page&&(t[this.routeName+"[page]"]=e.page+""),e.order&&(t[this.routeName+"[order]"]=e.order),e.facets)for(const a in e.facets){const r=e.facets[a].type+":"+encodeURIComponent(e.facets[a].name)+":"+encodeURIComponent(e.facets[a].value);t[this.routeName+`[facets][${a}]`]=r}if(this.queryStringHelper.urlHasQueryParams(window.location.href)){const a=this.queryStringHelper.urlToParams(window.location.href);for(const r in a)r.startsWith(this.routeName)&&delete a[r];return{...a,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const a in e)a.startsWith(this.routeName)||(t[a]=e[a]);return t}extractArrayOfFacetsFromQueryParameters(e){var a,r,s;const t=[];for(const i in e)if(i.startsWith(this.routeName+"[facets]")){const c=E.removeXSSRiskyTags((a=e[i].split(":"))==null?void 0:a[0]),l=E.removeXSSRiskyTags(decodeURIComponent((r=e[i].split(":"))==null?void 0:r[1])),h=E.removeXSSRiskyTags(decodeURIComponent((s=e[i].split(":"))==null?void 0:s[2]));t.push({type:c,name:l,value:h})}return t}urlToSearchObject(e){const t=this.queryStringHelper.urlToParams(e);return{query:E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName+"[query]"]))||"",page:E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName+"[page]"]))?parseInt(t[this.routeName+"[page]"]):1,order:E.removeXSSRiskyTags(t[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(t)||[]}}}class X{constructor(e){n(this,"routeName","");n(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(r=>{const s=a[r];return Array.isArray(s)?s.map(i=>`${r}=${i}`).join("&"):`${r}=${s}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],r={};return Object.keys(e).forEach(s=>{a.includes(s)||e[s]!==""&&(r[s]=e[s])}),r}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(r=>{const[s,i]=r.split("=");t[s]=i}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}class G{constructor(e,t){n(this,"cachedQuery","");n(this,"url","");n(this,"relatedSearches","");n(this,"suggester","");n(this,"authHeader");n(this,"authHeaderRelated");n(this,"trackApiKey","");n(this,"session","");n(this,"searchAuthType");n(this,"searchAuth","");n(this,"controllerSearch");n(this,"signalSearch");n(this,"controllerSuggest");n(this,"signalSuggest");n(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");const a=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`;this.authHeader.append("Authorization",a),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(r){const s=r.name+':"'+r.value+'"';a=a.concat("fq="+decodeURIComponent(s).replace(" "," "))});else{const r={};e.forEach(function(s){const i=s.name+":"+s.value,c=decodeURIComponent(i).replace(" "," ").split(":");r[c[0]]?r[c[0]].push(c[1]):r[c[0]]=[c[1]]});for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)){const i=r[s],c=s;let l="";for(const h of i)l+=` ${c}:"${h}"`;a=a.concat("fq="+l.trim())}}return a.length?"&"+a.join("&"):""}getRelatedSearches(e,t,a,r){const s=new Headers;s.append("Accept","application/json"),s.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:s,credentials:"same-origin"}).then(i=>i.json()).then(i=>{r(i)})}cacheFacets(){this.dataLayer.searchObject.query!==this.cachedQuery&&(this.cachedQuery=this.dataLayer.searchObject.query,this.search({query:this.dataLayer.searchObject.query??"*",page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps},this.cacheFacetsCallback.bind(this)))}cacheFacetsCallback(e){let t=O.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,r=!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 s=new Proxy(new URLSearchParams(window.location.search),{get:(u,g)=>u.get(g)??""}),i=s.languageVariant?"&fq=_language:"+s.languageVariant:"",c=e.order?`&sort=${e.order}`:"",l=this.url+"?q="+encodeURIComponent(e.query.trim())+"&start="+(e.page-1)+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(u=>u.type==="or"||u.type==="showUnavailable"),!0)+this.generateFacetQuery(e.facets.filter(u=>u.type==="and"||u.type==="tabs"),!1)+c+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!r}&language=`+this.dataLayer.language+i,h={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete h.signal,fetch(l,h).then(u=>u.json()).then(u=>{this.dataLayer.setLoading(!1),t(u)}).catch(()=>{this.dataLayer.setLoading(!1)})}}suggest(e,t,a){this.controllerSuggest&&this.controllerSuggest.abort(),this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const r=this.suggester+"?q="+e.trim()+this.toQueryString(a)+"&language="+this.dataLayer.language;fetch(r,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(s=>s.json()).then(s=>{t(s)}).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("&")}}class Y{static getOrSetCookie(e){let t=this.getCookie(e);return t==null&&(t=this.makeid(25),this.setCookie(e,t,{secure:!0,"max-age":3600})),t}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let s=0;s<e;s++)t+=a.charAt(Math.floor(Math.random()*r));return t}static getCookie(e){const t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,a){const r={path:"/",...a};a.expires instanceof Date&&(r.expires=a.expires.toUTCString());let s=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const i in r){s+="; "+i;const c=r[i];c!==!0&&(s+="="+c)}document.cookie=s}}class H{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.title,position:e.result.position,language:e.language};setTimeout(()=>{this.msq.push(["trackClick",t])},0)}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,impressions:e.impressions};setTimeout(()=>{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:e.currentPage,shownHits:e.recordsPerPage,totalHits:e.totalResults,language:e.language};setTimeout(()=>{this.msq.push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,latency:e.latencyVal,language:e.language,impressions:e.impressions};setTimeout(()=>{this.msq.push(["trackRelatedSearch",t])},0)}}n(H,"msq",window._msq||[]);/*!
|
|
1
|
+
var Me=Object.defineProperty;var De=(w,C,M)=>C in w?Me(w,C,{enumerable:!0,configurable:!0,writable:!0,value:M}):w[C]=M;var n=(w,C,M)=>(De(w,typeof C!="symbol"?C+"":C,M),M);(function(w){"use strict";var C=(o=>(o[o.mustache=0]="mustache",o[o.vue=1]="vue",o[o.react=2]="react",o[o.angular=3]="angular",o))(C||{});class M{constructor(e){n(this,"dataLayer");this.dataLayer=e}get currentPage(){var e;return(e=this.dataLayer.searchObject)==null?void 0:e.page}get totalResults(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.totalResultsValue)||0}get resultsPerPage(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.recordsPerPageValue)||0}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 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 searchTerm(){var e,t;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||((t=this.dataLayer.searchObject)==null?void 0:t.query)||""}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(s=>{const i=s.name,c=s.value,l=e.find(h=>h.name===i);if(l){const h=l.values.find(u=>u.type==="range"?!1:u.type==="checkbox"?'"'+u.value+'"'===c:!1);if(h)return h}return null}).filter(s=>s!==null):[]}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,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,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}}get trackingData(){var e,t,a,r;return{searchTerm:this.dataLayer.searchTerm!=="undefined"?this.dataLayer.searchTerm:"",trackApiKey:((e=this.dataLayer.searchstaxConfig)==null?void 0:e.trackApiKey)??"",session:this.dataLayer.sessionId,language:this.dataLayer.language,recordsPerPage:((t=this.dataLayer.searchResultsMetadata)==null?void 0:t.recordsPerPageValue)??0,totalResults:((a=this.dataLayer.searchResultsMetadata)==null?void 0:a.totalResultsValue)??0,currentPage:this.dataLayer.currentPage,latencyVal:((r=this.dataLayer.searchResultsMetadata)==null?void 0:r.latency)??0}}}class F{static deepEqual(e,t){const a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(const s of a){const i=e[s],c=t[s],l=this.isObject(i)&&this.isObject(c);if(l&&!this.deepEqual(i,c)||!l&&i!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class L{constructor(e){n(this,"value");n(this,"observers",[]);this.value=e,this.observers=[]}subscribe(e){this.observers.push(e),e(this.value)}unsubscribe(e){const t=this.observers.indexOf(e);t!==-1&&this.observers.splice(t,1)}setValue(e){this.value=e,this.notify()}getValue(){return this.value}notify(){this.observers.forEach(e=>e(this.value))}}class E{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 J{constructor(e){n(this,"$searchTermChange",new L(""));n(this,"$loadingChange",new L(!1));n(this,"$searchResults",new L(null));n(this,"$searchResultsMetadata",new L(null));n(this,"$searchAutosuggest",new L(null));n(this,"$searchFacets",new L(null));n(this,"$searchFacetsCached",new L(null));n(this,"$searchstaxConfig",new L(null));n(this,"$autosuggestResults",new L(null));n(this,"$searchObject",new L({query:"",page:99999999,order:"",facets:[],additionalProps:[]}));n(this,"$searchRelatedSearches",new L(null));n(this,"$searchInputConfig",new L(null));n(this,"$searchExternalPromotions",new L(null));n(this,"$facetsTemplateData",new L(null));n(this,"$selectedFacetsTemplateData",new L(null));n(this,"$paginationData",new L(null));n(this,"$searchFeedbackData",new L(null));n(this,"$searchSortingData",new L(null));n(this,"$searchRelatedSearchesData",new L(null));n(this,"$searchExternalPromotionsData",new L(null));n(this,"$language",new L("en"));n(this,"currentPageValue",1);n(this,"renderingEngineValue",C.mustache);n(this,"parsedData",new M(this));n(this,"sessionId");n(this,"autoCorrect",!0);n(this,"forceNotCorrect",!1);this.sessionId=e}setSearchTerm(e){this.$searchTermChange.setValue(E.removeXSSRiskyTags(e))}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){F.deepEqual(e,this.searchResults??[""])||this.$searchResults.setValue(e)}setSearchResultsMetadata(e){F.deepEqual(e,this.searchResultsMetadata??{})||this.$searchResultsMetadata.setValue(e)}setSearchAutosuggest(e){this.$searchAutosuggest.setValue(e)}setSearchObject(e){var a,r;let t=e;(r=(a=this.searchstaxConfig)==null?void 0:a.hooks)!=null&&r.beforeSearch&&t&&(t=this.searchstaxConfig.hooks.beforeSearch(t)),t&&(!F.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){F.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){F.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){F.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){F.deepEqual(e,this.searchExternalPromotions??[])||this.$searchExternalPromotions.setValue(e)}setLanguage(e){this.$language.setValue(e)}setSearchstaxConfig(e){this.$searchstaxConfig.setValue(e)}setSearchInputConfig(e){this.$searchInputConfig.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)}setSearchFeedbackData(e){this.$searchFeedbackData.setValue(e)}setSearchSortingData(e){this.$searchSortingData.setValue(e)}setRelatedSearchesData(e){this.$searchRelatedSearchesData.setValue(e)}setExternalPromotionsData(e){this.$searchExternalPromotionsData.setValue(e)}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 searchResults(){return this.$searchResults.getValue()?JSON.parse(JSON.stringify(this.$searchResults.getValue())):null}get searchTerm(){return this.$searchTermChange.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.currentPageValue}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 searchInputConfig(){return this.$searchInputConfig.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()}}class O{static combineResultsWithMetadata(e){const t=[],a=parseInt(e.response.start+"")-1,r=parseInt(e.responseHeader.params.rows);return e.response.docs.forEach((s,i)=>{const c={custom:null,uniqueId:this.getValueByKey(e.responseHeader.params.uniqueId,s,e)??"",position:a*r+1+i,ribbon:this.doesMapExist("ribbon",e)?this.getValueByKey("ribbon",s,e):null,paths:this.doesMapExist("paths",e)?this.getValueByKey("paths",s,e):null,url:this.doesMapExist("url",e)?this.getValueByKey("url",s,e):null,title:this.doesMapExist("title",e)?this.getValueByKey("title",s,e):null,promoted:s["[elevated]"]?s["[elevated]"]:!1,thumbnail:this.doesMapExist("thumbnail",e)?this.getValueByKey("thumbnail",s,e):null,date:this.doesMapExist("date",e)?this.getValueByKey("date",s,e):null,snippet:this.doesMapExist("snippet",e)?this.getValueByKey("snippet",s,e):null,description:this.doesMapExist("description",e)?this.getValueByKey("description",s,e):null,unmappedFields:this.getUnmappedFields(s,e),allFields:this.getAllFields(s,e)};t.push(c)}),t}static extractFacets(e){const t=[];for(const a of e.metadata.facets){let r={values:[]};if(r.name=a.name,r.label=a.label,a.name in e.facet_counts.facet_fields){const s=e.facet_counts.facet_fields[a.name];for(let i=0;i<s.length;i+=2){const c={};c.value=s[i],c.parentName=r.name,c.count=s[i+1],c.type="checkbox",r.values.push(c)}}r.values.length>0&&t.push(r)}return t}static extractSearchResultsMetadata(e){var a,r,s,i;let t="";return t=((i=(s=(r=(a=e==null?void 0:e.spellcheck)==null?void 0:a.suggestions)==null?void 0:r[0])==null?void 0:s.suggestion)==null?void 0:i[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)}}static getImpressions(e){const t=[],a=this.combineResultsWithMetadata(e);for(const r in a){const s=a[r],i={};i.cDocId=this.getDataForAnalytics(s.uniqueId),s.title&&(i.cDocTitle=this.getDataForAnalytics(s.title)),i.position=s.position,t.push(i)}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){const a=t.metadata.results.filter(s=>s.result_card==="").map(s=>s.name),r=[];for(const s of Object.keys(e))if(a.indexOf(s)!==-1){const i=Array.isArray(e[s])?e[s].join(", "):e[s];r.push({key:s,value:i,isImage:this.checkIfImage(e[s])})}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(s=>s.name),r=[];for(const s of Object.keys(e))a.indexOf(s)!==-1&&r.push({key:s,value:e[s],isImage:this.checkIfImage(e[s])});return r}static doesMapExist(e,t){return t.metadata.results.find(a=>a.result_card===e)!==void 0}static getValueByKey(e,t,a){const r=a.metadata.results.find(i=>i.result_card===e);if(r===void 0)return null;const s=t[r.name];return s===void 0?null:typeof s=="string"?s:Array.isArray(s)?s.join(", "):null}}class Q{constructor(e){n(this,"routeName","searchstax");n(this,"ignoredKeys",[]);n(this,"queryStringHelper");n(this,"titleParser");e.routeName&&(this.routeName=e.routeName),e.ignoredKeys&&(this.ignoredKeys=e.ignoredKeys),e.title&&(this.titleParser=e.title),this.queryStringHelper=new X(this.routeName)}updateUrl(e){const t=this.searchObjectToUrl(e);let a=document.title;this.titleParser&&(a=this.titleParser(e)),document.title=a,window.location.href!==t&&window.history.pushState({},a,t)}searchObjectToUrl(e){return this.queryStringHelper.urlHasQueryParams(window.location.href)?window.location.href.split("?")[0]+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys}):window.location.href+"?"+this.queryStringHelper.stringify(this.searchObjectToParams(e),{ignoredKeys:this.ignoredKeys})}searchObjectToParams(e){const t={},a=e.page||1;if(e.query&&(t[this.routeName+"[query]"]=encodeURIComponent(e.query)),t[this.routeName+"[page]"]=a+"",e.order&&(t[this.routeName+"[order]"]=e.order),e.facets)for(const r in e.facets){const s=e.facets[r].type+":"+encodeURIComponent(e.facets[r].name)+":"+encodeURIComponent(e.facets[r].value);t[this.routeName+`[facets][${r}]`]=s}if(this.queryStringHelper.urlHasQueryParams(window.location.href)){const r=this.queryStringHelper.urlToParams(window.location.href);for(const s in r)s.startsWith(this.routeName)&&delete r[s];return{...r,...t}}else return t}extractParamsThatDoNotStartWithRouteName(e){const t={};for(const a in e)a.startsWith(this.routeName)||(t[a]=e[a]);return t}extractArrayOfFacetsFromQueryParameters(e){var a,r,s;const t=[];for(const i in e)if(i.startsWith(this.routeName+"[facets]")){const c=E.removeXSSRiskyTags((a=e[i].split(":"))==null?void 0:a[0]),l=E.removeXSSRiskyTags(decodeURIComponent((r=e[i].split(":"))==null?void 0:r[1])),h=E.removeXSSRiskyTags(decodeURIComponent((s=e[i].split(":"))==null?void 0:s[2]));t.push({type:c,name:l,value:h})}return t}urlToSearchObject(e){const t=this.queryStringHelper.urlToParams(e),a=E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName+"[page]"])),r=parseInt(a),s=isNaN(r)?1:r;return{query:E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName+"[query]"]))||"",page:s,order:E.removeXSSRiskyTags(t[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(t)||[]}}}class X{constructor(e){n(this,"routeName","");n(this,"stringify",(e,t)=>{const a=this.filterOutIgnoredKeys(e,t.ignoredKeys);return Object.keys(a).map(r=>{const s=a[r];return Array.isArray(s)?s.map(i=>`${r}=${i}`).join("&"):`${r}=${s}`}).join("&")});this.routeName=e}filterOutIgnoredKeys(e,t){const a=t||[],r={};return Object.keys(e).forEach(s=>{a.includes(s)||e[s]!==""&&(r[s]=e[s])}),r}urlToParams(e){const t={},a=e.split("?")[1];return a&&a.split("&").forEach(r=>{const[s,i]=r.split("=");t[s]=i}),t}doesParamContainRouteName(e){return e.indexOf(this.routeName)!==-1}urlHasQueryParams(e){return e.indexOf("?")!==-1}}class G{constructor(e,t){n(this,"cachedQuery","");n(this,"url","");n(this,"relatedSearches","");n(this,"suggester","");n(this,"authHeader");n(this,"authHeaderRelated");n(this,"trackApiKey","");n(this,"session","");n(this,"searchAuthType");n(this,"searchAuth","");n(this,"controllerSearch");n(this,"signalSearch");n(this,"controllerSuggest");n(this,"signalSuggest");n(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");const a=this.searchAuthType==="token"?`Token ${e.searchAuth}`:`Basic ${e.searchAuth}`;this.authHeader.append("Authorization",a),this.authHeaderRelated=new Headers,this.authHeaderRelated.append("Accept","application/json"),this.authHeaderRelated.append("Authorization",e.searchAuth)}generateFacetQuery(e,t){let a=[];if(!t)e.forEach(function(r){const s=r.name+':"'+r.value+'"';a=a.concat("fq="+decodeURIComponent(s).replace(" "," "))});else{const r={};e.forEach(function(s){const i=s.name+":"+s.value,c=decodeURIComponent(i).replace(" "," ").split(":");r[c[0]]?r[c[0]].push(c[1]):r[c[0]]=[c[1]]});for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)){const i=r[s],c=s;let l="";for(const h of i)l+=` ${c}:"${h}"`;a=a.concat("fq="+l.trim())}}return a.length?"&"+a.join("&"):""}getRelatedSearches(e,t,a,r){const s=new Headers;s.append("Accept","application/json"),s.append("Authorization",a),fetch(t+"?search="+encodeURIComponent(e.query)+"&language="+this.dataLayer.language,{method:"GET",headers:s,credentials:"same-origin"}).then(i=>i.json()).then(i=>{r(i)})}cacheFacets(){this.dataLayer.searchObject.query!==this.cachedQuery&&(this.cachedQuery=this.dataLayer.searchObject.query,this.search({query:this.dataLayer.searchObject.query??"*",page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps},this.cacheFacetsCallback.bind(this)))}cacheFacetsCallback(e){let t=O.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,r=!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 s=new Proxy(new URLSearchParams(window.location.search),{get:(u,g)=>u.get(g)??""}),i=s.languageVariant?"&fq=_language:"+s.languageVariant:"",c=e.order?`&sort=${e.order}`:"",l=this.url+"?q="+encodeURIComponent(e.query.trim())+"&start="+(e.page-1)+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(u=>u.type==="or"||u.type==="showUnavailable"),!0)+this.generateFacetQuery(e.facets.filter(u=>u.type==="and"||u.type==="tabs"),!1)+c+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!r}&language=`+this.dataLayer.language+i,h={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete h.signal,fetch(l,h).then(u=>u.json()).then(u=>{this.dataLayer.setLoading(!1),t(u)}).catch(()=>{this.dataLayer.setLoading(!1)})}}suggest(e,t,a){this.controllerSuggest&&this.controllerSuggest.abort(),this.controllerSuggest=new AbortController,this.signalSuggest=this.controllerSuggest.signal;const r=this.suggester+"?q="+e.trim()+this.toQueryString(a)+"&language="+this.dataLayer.language;fetch(r,{method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSuggest}).then(s=>s.json()).then(s=>{t(s)}).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("&")}}class Y{static getOrSetCookie(e){let t=this.getCookie(e);return t==null&&(t=this.makeid(25),this.setCookie(e,t,{secure:!0,"max-age":3600})),t}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let s=0;s<e;s++)t+=a.charAt(Math.floor(Math.random()*r));return t}static getCookie(e){const t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0}static setCookie(e,t,a){const r={path:"/",...a};a.expires instanceof Date&&(r.expires=a.expires.toUTCString());let s=encodeURIComponent(e)+"="+encodeURIComponent(t);for(const i in r){s+="; "+i;const c=r[i];c!==!0&&(s+="="+c)}document.cookie=s}}class H{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.title,position:e.result.position,language:e.language};setTimeout(()=>{this.msq.push(["trackClick",t])},0)}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,impressions:e.impressions};setTimeout(()=>{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:e.currentPage,shownHits:e.recordsPerPage,totalHits:e.totalResults,language:e.language};setTimeout(()=>{this.msq.push(["trackRelatedSearchClick",t])},0)}static trackRelatedSearches(e){const t={session:e.session,key:e.trackApiKey,query:e.searchTerm,shownHits:e.recordsPerPage,latency:e.latencyVal,language:e.language,impressions:e.impressions};setTimeout(()=>{this.msq.push(["trackRelatedSearch",t])},0)}}n(H,"msq",window._msq||[]);/*!
|
|
2
2
|
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
3
3
|
* http://github.com/janl/mustache.js
|
|
4
4
|
*/var Z=Object.prototype.toString,A=Array.isArray||function(e){return Z.call(e)==="[object Array]"};function U(o){return typeof o=="function"}function ee(o){return A(o)?"array":typeof o}function W(o){return o.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function _(o,e){return o!=null&&typeof o=="object"&&e in o}function te(o,e){return o!=null&&typeof o!="object"&&o.hasOwnProperty&&o.hasOwnProperty(e)}var ae=RegExp.prototype.test;function se(o,e){return ae.call(o,e)}var re=/\S/;function ie(o){return!se(re,o)}var ne={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function ce(o){return String(o).replace(/[&<>"'`=\/]/g,function(t){return ne[t]})}var le=/\s*/,oe=/\s+/,z=/\s*=/,he=/\s*\}/,ue=/#|\^|\/|>|\{|&|=|!/;function de(o,e){if(!o)return[];var t=!1,a=[],r=[],s=[],i=!1,c=!1,l="",h=0;function u(){if(i&&!c)for(;s.length;)delete r[s.pop()];else s=[];i=!1,c=!1}var g,p,y;function T(P){if(typeof P=="string"&&(P=P.split(oe,2)),!A(P)||P.length!==2)throw new Error("Invalid tags: "+P);g=new RegExp(W(P[0])+"\\s*"),p=new RegExp("\\s*"+W(P[1])),y=new RegExp("\\s*"+W("}"+P[1]))}T(e||f.tags);for(var m=new $(o),S,v,b,R,I,x;!m.eos();){if(S=m.pos,b=m.scanUntil(g),b)for(var D=0,N=b.length;D<N;++D)R=b.charAt(D),ie(R)?(s.push(r.length),l+=R):(c=!0,t=!0,l+=" "),r.push(["text",R,S,S+1]),S+=1,R===`
|
|
@@ -118,12 +118,14 @@ var Me=Object.defineProperty;var De=(w,C,M)=>C in w?Me(w,C,{enumerable:!0,config
|
|
|
118
118
|
`,relatedSearchContainerClass:"searchstax-related-search-item"}},Se={main:{template:`
|
|
119
119
|
{{#searchExecuted}}
|
|
120
120
|
<div class="searchstax-feedback-container">
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
{{#if totalResults}}
|
|
122
|
+
Showing <b>{{startResultIndex}} - {{endResultIndex}}</b> of <b>{{totalResults}}</b> results {{#searchTerm}} for "<b>{{searchTerm}}</b>" {{/searchTerm}}
|
|
123
|
+
<div class="searchstax-feedback-container-suggested">
|
|
124
|
+
{{#autoCorrectedQuery}}
|
|
125
|
+
Search instead for <a href="#" class="searchstax-feedback-original-query">{{originalQuery}}</a>
|
|
126
|
+
{{/autoCorrectedQuery}}
|
|
127
|
+
</div>
|
|
128
|
+
{{/if}}
|
|
127
129
|
</div>
|
|
128
130
|
{{/searchExecuted}}
|
|
129
131
|
`,originalQueryClass:"searchstax-feedback-original-query"}},ve={mainTemplate:{template:`
|
|
@@ -462,17 +462,17 @@ class W {
|
|
|
462
462
|
return this.queryStringHelper.urlHasQueryParams(window.location.href) ? window.location.href.split("?")[0] + "?" + this.queryStringHelper.stringify(this.searchObjectToParams(e), { ignoredKeys: this.ignoredKeys }) : window.location.href + "?" + this.queryStringHelper.stringify(this.searchObjectToParams(e), { ignoredKeys: this.ignoredKeys });
|
|
463
463
|
}
|
|
464
464
|
searchObjectToParams(e) {
|
|
465
|
-
const t = {};
|
|
466
|
-
if (e.query && (t[this.routeName + "[query]"] = encodeURIComponent(e.query)),
|
|
467
|
-
for (const
|
|
468
|
-
const
|
|
469
|
-
t[this.routeName + `[facets][${
|
|
465
|
+
const t = {}, a = e.page || 1;
|
|
466
|
+
if (e.query && (t[this.routeName + "[query]"] = encodeURIComponent(e.query)), t[this.routeName + "[page]"] = a + "", e.order && (t[this.routeName + "[order]"] = e.order), e.facets)
|
|
467
|
+
for (const r in e.facets) {
|
|
468
|
+
const s = e.facets[r].type + ":" + encodeURIComponent(e.facets[r].name) + ":" + encodeURIComponent(e.facets[r].value);
|
|
469
|
+
t[this.routeName + `[facets][${r}]`] = s;
|
|
470
470
|
}
|
|
471
471
|
if (this.queryStringHelper.urlHasQueryParams(window.location.href)) {
|
|
472
|
-
const
|
|
473
|
-
for (const
|
|
474
|
-
|
|
475
|
-
return { ...
|
|
472
|
+
const r = this.queryStringHelper.urlToParams(window.location.href);
|
|
473
|
+
for (const s in r)
|
|
474
|
+
s.startsWith(this.routeName) && delete r[s];
|
|
475
|
+
return { ...r, ...t };
|
|
476
476
|
} else
|
|
477
477
|
return t;
|
|
478
478
|
}
|
|
@@ -493,10 +493,10 @@ class W {
|
|
|
493
493
|
return t;
|
|
494
494
|
}
|
|
495
495
|
urlToSearchObject(e) {
|
|
496
|
-
const t = this.queryStringHelper.urlToParams(e);
|
|
496
|
+
const t = this.queryStringHelper.urlToParams(e), a = E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName + "[page]"])), r = parseInt(a), s = isNaN(r) ? 1 : r;
|
|
497
497
|
return {
|
|
498
498
|
query: E.removeXSSRiskyTags(decodeURIComponent(t[this.routeName + "[query]"])) || "",
|
|
499
|
-
page:
|
|
499
|
+
page: s,
|
|
500
500
|
order: E.removeXSSRiskyTags(t[this.routeName + "[order]"]) || "",
|
|
501
501
|
facets: this.extractArrayOfFacetsFromQueryParameters(t) || []
|
|
502
502
|
};
|
|
@@ -830,7 +830,7 @@ function ge(o, e) {
|
|
|
830
830
|
b(e || m.tags);
|
|
831
831
|
for (var f = new V(o), C, S, v, R, I, T; !f.eos(); ) {
|
|
832
832
|
if (C = f.pos, v = f.scanUntil(g), v)
|
|
833
|
-
for (var w = 0,
|
|
833
|
+
for (var w = 0, j = v.length; w < j; ++w)
|
|
834
834
|
R = v.charAt(w), ne(R) ? (s.push(r.length), l += R) : (c = !0, t = !0, l += " "), r.push(["text", R, C, C + 1]), C += 1, R === `
|
|
835
835
|
` && (u(), l = "", h = 0, t = !1);
|
|
836
836
|
if (!f.scan(g))
|
|
@@ -1243,12 +1243,14 @@ const me = {
|
|
|
1243
1243
|
template: `
|
|
1244
1244
|
{{#searchExecuted}}
|
|
1245
1245
|
<div class="searchstax-feedback-container">
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1246
|
+
{{#if totalResults}}
|
|
1247
|
+
Showing <b>{{startResultIndex}} - {{endResultIndex}}</b> of <b>{{totalResults}}</b> results {{#searchTerm}} for "<b>{{searchTerm}}</b>" {{/searchTerm}}
|
|
1248
|
+
<div class="searchstax-feedback-container-suggested">
|
|
1249
|
+
{{#autoCorrectedQuery}}
|
|
1250
|
+
Search instead for <a href="#" class="searchstax-feedback-original-query">{{originalQuery}}</a>
|
|
1251
|
+
{{/autoCorrectedQuery}}
|
|
1252
|
+
</div>
|
|
1253
|
+
{{/if}}
|
|
1252
1254
|
</div>
|
|
1253
1255
|
{{/searchExecuted}}
|
|
1254
1256
|
`,
|
|
@@ -1714,21 +1716,21 @@ class ke {
|
|
|
1714
1716
|
const q = T.querySelector("." + A);
|
|
1715
1717
|
q && q.addEventListener("click", this.closeOverlay.bind(this));
|
|
1716
1718
|
}
|
|
1717
|
-
const
|
|
1719
|
+
const j = T.querySelector(
|
|
1718
1720
|
"." + (((b = (y = (p = this.config) == null ? void 0 : p.templates) == null ? void 0 : y.mainTemplateMobile) == null ? void 0 : b.filterByContainerClass) || d.facets.mainTemplateMobile.filterByContainerClass)
|
|
1719
1721
|
);
|
|
1720
|
-
|
|
1722
|
+
j && this.createFilterByComponent(j);
|
|
1721
1723
|
const P = T.querySelector(
|
|
1722
1724
|
"." + (((S = (C = (f = this.config) == null ? void 0 : f.templates) == null ? void 0 : C.mainTemplateMobile) == null ? void 0 : S.selectedFacetsContainerClass) || d.facets.mainTemplateMobile.selectedFacetsContainerClass)
|
|
1723
1725
|
);
|
|
1724
1726
|
P && (this.createSelectedFacetsComponents(P), this.createClearFacetsComponents(P));
|
|
1725
|
-
const
|
|
1727
|
+
const B = T.querySelector(
|
|
1726
1728
|
"." + (((I = (R = (v = this.config) == null ? void 0 : v.templates) == null ? void 0 : R.mainTemplateMobile) == null ? void 0 : I.facetsContainerClass) || d.facets.mainTemplateMobile.facetsContainerClass)
|
|
1727
1729
|
);
|
|
1728
|
-
if (
|
|
1729
|
-
|
|
1730
|
+
if (B) {
|
|
1731
|
+
B.innerHTML = "";
|
|
1730
1732
|
for (const A of e.facets)
|
|
1731
|
-
this.createFacetItem(A,
|
|
1733
|
+
this.createFacetItem(A, B, !0);
|
|
1732
1734
|
}
|
|
1733
1735
|
}
|
|
1734
1736
|
}
|
|
@@ -488,8 +488,9 @@
|
|
|
488
488
|
padding-right: 0px; }
|
|
489
489
|
.searchstax-page-layout-container .searchstax-page-layout-facet-result-container .searchstax-page-layout-result-container {
|
|
490
490
|
width: 100%; }
|
|
491
|
-
.searchstax-page-layout-container .search-
|
|
492
|
-
|
|
491
|
+
.searchstax-page-layout-container .search-details-container {
|
|
492
|
+
flex-direction: column;
|
|
493
|
+
gap: 10px; } }
|
|
493
494
|
|
|
494
495
|
@media (min-width: 767px) {
|
|
495
496
|
.searchstax-page-layout-container .searchstax-page-layout-facet-result-container {
|