@searchstax-inc/searchstudio-ux-js 0.5.20 → 0.5.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var J=Object.defineProperty;var X=(l,e,t)=>e in l?J(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var n=(l,e,t)=>(X(l,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var x=(l=>(l[l.mustache=0]="mustache",l[l.vue=1]="vue",l[l.react=2]="react",l[l.angular=3]="angular",l))(x||{});class G{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(){return this.dataLayer.searchObject.itemsPerPage||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 percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswer(){return this.isFirstPage&&this.dataLayer.getAnswerData!==""&&this.dataLayer.searchObject.query!=="*"&&this.dataLayer.searchObject.facets.length===0}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 searchingEverything(){return this.searchTerm==="*"}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}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,o=e.find(h=>h.name===i);if(o){const h=o.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,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded}}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 w{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],o=this.isObject(i)&&this.isObject(c);if(o&&!this.deepEqual(i,c)||!o&&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 U{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 deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let 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 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 Y{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:"",itemsPerPage:null,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,"$cookiesDisabled",new L(null));n(this,"$answer",new L(""));n(this,"$language",new L("en"));n(this,"currentPageValue",1);n(this,"isAnswerWidgetCreatedValue",!1);n(this,"renderingEngineValue",x.mustache);n(this,"parsedData",new G(this));n(this,"sessionId");n(this,"autoCorrect",!0);n(this,"forceNotCorrect",!1);n(this,"lastSearchValue","");n(this,"turnAIAnswerGenerationOn",!1);n(this,"isInfiniteScroll",!1);this.sessionId=e,this.cookieHandlingCallback(),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback()})}cookieHandlingCallback(){this.cookiesDisabled?(U.deleteCookie(this.sessionId),U.deleteCookie("ms_visitorid")):U.getOrSetCookie(this.sessionId)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(E.removeXSSRiskyTags(e))}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setIsAnswerWidgetCreated(e){this.isAnswerWidgetCreatedValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){w.deepEqual(e,this.searchResults??[""])||this.$searchResults.setValue(e)}setSearchResultsMetadata(e){w.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&&(!w.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){w.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){w.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){w.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){w.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)}setCookiesDisabled(e){this.$cookiesDisabled.setValue(e)}setAnswerData(e){this.$answer.setValue(e)}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCached(){return this.$searchFacetsCached.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCached.getValue())):null}get 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 isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}}class ${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 K{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 Z(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)),e.page&&(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]),o=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:o,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,itemsPerPage:void 0,order:E.removeXSSRiskyTags(t[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(t)||[]}}}class Z{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}}const M={questionURL:"http://smartsearch-dev.searchstax.co/completion/?q=",question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ee{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 o="";for(const h of i)o+=` ${c}:"${h}"`;a=a.concat("fq="+o.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??"*",itemsPerPage:10,page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps},this.cacheFacetsCallback.bind(this),!0))}cacheFacetsCallback(e){let t=$.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,r=!1){if(e.query&&e.query!=="undefined"&&e.itemsPerPage!==void 0){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:(g,y)=>g.get(y)??""}),i=s.languageVariant?"&fq=_language:"+s.languageVariant:"";let c=e.itemsPerPage,o=e.itemsPerPage*(e.page-1),h=e.order?`&sort=${e.order}`:"";const u=this.url+"?q="+encodeURIComponent(e.query.trim())+"&start="+o+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(g=>g.type==="or"||g.type==="showUnavailable"),!0)+this.generateFacetQuery(e.facets.filter(g=>g.type==="and"||g.type==="tabs"),!1)+h+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!r}&rows=${c}&language=`+this.dataLayer.language+i,p={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete p.signal,fetch(u,p).then(g=>g.json()).then(g=>{this.dataLayer.setLoading(!1),t(g)}).catch(()=>{this.dataLayer.setLoading(!1)})}}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.lastSearchValue===e||this.dataLayer.searchObject.facets.length>0||this.dataLayer.searchObject.page!==1)return;const a=new EventSource(M.questionURL+e),r=this.dataLayer;a.onmessage=function(s){if(s.data===M.question||s.data===M.notQuestion){r.setAnswerData("");return}if(s.data===M.close){a.close();return}t(s.data)},a.onerror=function(s){console.log(s),a.close()}}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 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(()=>{t.key&&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(()=>{t.key&&this.msq.push(["trackSearch",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(()=>{t.key&&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(()=>{t.key&&this.msq.push(["trackRelatedSearch",t])},0)}}n(H,"msq",window._msq||[]);/*!
|
|
1
|
+
"use strict";var J=Object.defineProperty;var X=(l,e,t)=>e in l?J(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var n=(l,e,t)=>(X(l,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var x=(l=>(l[l.mustache=0]="mustache",l[l.vue=1]="vue",l[l.react=2]="react",l[l.angular=3]="angular",l))(x||{});class G{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(){return this.dataLayer.searchObject.itemsPerPage||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 percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswer(){return this.isFirstPage&&this.dataLayer.getAnswerData!==""&&this.dataLayer.searchObject.query!=="*"&&this.dataLayer.searchObject.facets.length===0}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 searchingEverything(){return this.searchTerm==="*"}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}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,o=e.find(h=>h.name===i);if(o){const h=o.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,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded}}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 w{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],o=this.isObject(i)&&this.isObject(c);if(o&&!this.deepEqual(i,c)||!o&&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 U{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 deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let 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 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 Y{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:"",itemsPerPage:null,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,"$cookiesDisabled",new L(null));n(this,"$answer",new L(""));n(this,"$language",new L("en"));n(this,"currentPageValue",1);n(this,"isAnswerWidgetCreatedValue",!1);n(this,"renderingEngineValue",x.mustache);n(this,"parsedData",new G(this));n(this,"sessionId");n(this,"autoCorrect",!0);n(this,"forceNotCorrect",!1);n(this,"lastSearchValue","");n(this,"turnAIAnswerGenerationOn",!1);n(this,"isInfiniteScroll",!1);this.sessionId=e,this.cookieHandlingCallback(),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback()})}cookieHandlingCallback(){this.cookiesDisabled?(U.deleteCookie(this.sessionId),U.deleteCookie("ms_visitorid")):U.getOrSetCookie(this.sessionId)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(E.removeXSSRiskyTags(e))}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setIsAnswerWidgetCreated(e){this.isAnswerWidgetCreatedValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){w.deepEqual(e,this.searchResults??[""])||this.$searchResults.setValue(e)}setSearchResultsMetadata(e){w.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&&(!w.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){w.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){w.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){w.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){w.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)}setCookiesDisabled(e){this.$cookiesDisabled.setValue(e)}setAnswerData(e){this.$answer.setValue(e)}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCached(){return this.$searchFacetsCached.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCached.getValue())):null}get 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 isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}}class ${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 o={custom:null,uniqueId:s[e.responseHeader.params.uniqueId]??"",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(o)}),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 K{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 Z(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)),e.page&&(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]),o=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:o,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,itemsPerPage:void 0,order:E.removeXSSRiskyTags(t[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(t)||[]}}}class Z{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}}const M={questionURL:"http://smartsearch-dev.searchstax.co/completion/?q=",question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class ee{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 o="";for(const h of i)o+=` ${c}:"${h}"`;a=a.concat("fq="+o.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??"*",itemsPerPage:10,page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps},this.cacheFacetsCallback.bind(this),!0))}cacheFacetsCallback(e){let t=$.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,r=!1){if(e.query&&e.query!=="undefined"&&e.itemsPerPage!==void 0){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:(g,y)=>g.get(y)??""}),i=s.languageVariant?"&fq=_language:"+s.languageVariant:"";let c=e.itemsPerPage,o=e.itemsPerPage*(e.page-1),h=e.order?`&sort=${e.order}`:"";const u=this.url+"?q="+encodeURIComponent(e.query.trim())+"&start="+o+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(g=>g.type==="or"||g.type==="showUnavailable"),!0)+this.generateFacetQuery(e.facets.filter(g=>g.type==="and"||g.type==="tabs"),!1)+h+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!r}&rows=${c}&language=`+this.dataLayer.language+i,p={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete p.signal,fetch(u,p).then(g=>g.json()).then(g=>{this.dataLayer.setLoading(!1),t(g)}).catch(()=>{this.dataLayer.setLoading(!1)})}}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.lastSearchValue===e||this.dataLayer.searchObject.facets.length>0||this.dataLayer.searchObject.page!==1)return;const a=new EventSource(M.questionURL+e),r=this.dataLayer;a.onmessage=function(s){if(s.data===M.question||s.data===M.notQuestion){r.setAnswerData("");return}if(s.data===M.close){a.close();return}t(s.data)},a.onerror=function(s){console.log(s),a.close()}}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 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(()=>{t.key&&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(()=>{t.key&&this.msq.push(["trackSearch",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(()=>{t.key&&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(()=>{t.key&&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 te=Object.prototype.toString,D=Array.isArray||function(e){return te.call(e)==="[object Array]"};function Q(l){return typeof l=="function"}function ae(l){return D(l)?"array":typeof l}function W(l){return l.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function _(l,e){return l!=null&&typeof l=="object"&&e in l}function se(l,e){return l!=null&&typeof l!="object"&&l.hasOwnProperty&&l.hasOwnProperty(e)}var re=RegExp.prototype.test;function ie(l,e){return re.call(l,e)}var ne=/\S/;function ce(l){return!ie(ne,l)}var oe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function le(l){return String(l).replace(/[&<>"'`=\/]/g,function(t){return oe[t]})}var he=/\s*/,ue=/\s+/,z=/\s*=/,de=/\s*\}/,ge=/#|\^|\/|>|\{|&|=|!/;function pe(l,e){if(!l)return[];var t=!1,a=[],r=[],s=[],i=!1,c=!1,o="",h=0;function u(){if(i&&!c)for(;s.length;)delete r[s.pop()];else s=[];i=!1,c=!1}var p,g,y;function b(P){if(typeof P=="string"&&(P=P.split(ue,2)),!D(P)||P.length!==2)throw new Error("Invalid tags: "+P);p=new RegExp(W(P[0])+"\\s*"),g=new RegExp("\\s*"+W(P[1])),y=new RegExp("\\s*"+W("}"+P[1]))}b(e||f.tags);for(var m=new j(l),C,S,v,R,I,T;!m.eos();){if(C=m.pos,v=m.scanUntil(p),v)for(var F=0,B=v.length;F<B;++F)R=v.charAt(F),ce(R)?(s.push(r.length),o+=R):(c=!0,t=!0,o+=" "),r.push(["text",R,C,C+1]),C+=1,R===`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Oe=Object.defineProperty;var qe=(F,C,M)=>C in F?Oe(F,C,{enumerable:!0,configurable:!0,writable:!0,value:M}):F[C]=M;var n=(F,C,M)=>(qe(F,typeof C!="symbol"?C+"":C,M),M);(function(F){"use strict";var C=(l=>(l[l.mustache=0]="mustache",l[l.vue=1]="vue",l[l.react=2]="react",l[l.angular=3]="angular",l))(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(){return this.dataLayer.searchObject.itemsPerPage||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 percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswer(){return this.isFirstPage&&this.dataLayer.getAnswerData!==""&&this.dataLayer.searchObject.query!=="*"&&this.dataLayer.searchObject.facets.length===0}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 searchingEverything(){return this.searchTerm==="*"}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}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,o=e.find(h=>h.name===i);if(o){const h=o.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,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded}}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 w{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],o=this.isObject(i)&&this.isObject(c);if(o&&!this.deepEqual(i,c)||!o&&i!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class S{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 W{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 deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let 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 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 G{constructor(e){n(this,"$searchTermChange",new S(""));n(this,"$loadingChange",new S(!1));n(this,"$searchResults",new S(null));n(this,"$searchResultsMetadata",new S(null));n(this,"$searchAutosuggest",new S(null));n(this,"$searchFacets",new S(null));n(this,"$searchFacetsCached",new S(null));n(this,"$searchstaxConfig",new S(null));n(this,"$autosuggestResults",new S(null));n(this,"$searchObject",new S({query:"",itemsPerPage:null,page:99999999,order:"",facets:[],additionalProps:[]}));n(this,"$searchRelatedSearches",new S(null));n(this,"$searchInputConfig",new S(null));n(this,"$searchExternalPromotions",new S(null));n(this,"$facetsTemplateData",new S(null));n(this,"$selectedFacetsTemplateData",new S(null));n(this,"$paginationData",new S(null));n(this,"$searchFeedbackData",new S(null));n(this,"$searchSortingData",new S(null));n(this,"$searchRelatedSearchesData",new S(null));n(this,"$searchExternalPromotionsData",new S(null));n(this,"$cookiesDisabled",new S(null));n(this,"$answer",new S(""));n(this,"$language",new S("en"));n(this,"currentPageValue",1);n(this,"isAnswerWidgetCreatedValue",!1);n(this,"renderingEngineValue",C.mustache);n(this,"parsedData",new M(this));n(this,"sessionId");n(this,"autoCorrect",!0);n(this,"forceNotCorrect",!1);n(this,"lastSearchValue","");n(this,"turnAIAnswerGenerationOn",!1);n(this,"isInfiniteScroll",!1);this.sessionId=e,this.cookieHandlingCallback(),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback()})}cookieHandlingCallback(){this.cookiesDisabled?(W.deleteCookie(this.sessionId),W.deleteCookie("ms_visitorid")):W.getOrSetCookie(this.sessionId)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(E.removeXSSRiskyTags(e))}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setIsAnswerWidgetCreated(e){this.isAnswerWidgetCreatedValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){w.deepEqual(e,this.searchResults??[""])||this.$searchResults.setValue(e)}setSearchResultsMetadata(e){w.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&&(!w.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){w.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){w.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){w.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){w.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)}setCookiesDisabled(e){this.$cookiesDisabled.setValue(e)}setAnswerData(e){this.$answer.setValue(e)}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCached(){return this.$searchFacetsCached.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCached.getValue())):null}get 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 isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}}class ${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 z{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 Y(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)),e.page&&(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]),o=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:o,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,itemsPerPage:void 0,order:E.removeXSSRiskyTags(t[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(t)||[]}}}class Y{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}}const D={questionURL:"http://smartsearch-dev.searchstax.co/completion/?q=",question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class Z{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 o="";for(const h of i)o+=` ${c}:"${h}"`;a=a.concat("fq="+o.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??"*",itemsPerPage:10,page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps},this.cacheFacetsCallback.bind(this),!0))}cacheFacetsCallback(e){let t=$.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,r=!1){if(e.query&&e.query!=="undefined"&&e.itemsPerPage!==void 0){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:(g,y)=>g.get(y)??""}),i=s.languageVariant?"&fq=_language:"+s.languageVariant:"";let c=e.itemsPerPage,o=e.itemsPerPage*(e.page-1),h=e.order?`&sort=${e.order}`:"";const u=this.url+"?q="+encodeURIComponent(e.query.trim())+"&start="+o+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(g=>g.type==="or"||g.type==="showUnavailable"),!0)+this.generateFacetQuery(e.facets.filter(g=>g.type==="and"||g.type==="tabs"),!1)+h+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!r}&rows=${c}&language=`+this.dataLayer.language+i,p={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete p.signal,fetch(u,p).then(g=>g.json()).then(g=>{this.dataLayer.setLoading(!1),t(g)}).catch(()=>{this.dataLayer.setLoading(!1)})}}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.lastSearchValue===e||this.dataLayer.searchObject.facets.length>0||this.dataLayer.searchObject.page!==1)return;const a=new EventSource(D.questionURL+e),r=this.dataLayer;a.onmessage=function(s){if(s.data===D.question||s.data===D.notQuestion){r.setAnswerData("");return}if(s.data===D.close){a.close();return}t(s.data)},a.onerror=function(s){console.log(s),a.close()}}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 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(()=>{t.key&&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(()=>{t.key&&this.msq.push(["trackSearch",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(()=>{t.key&&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(()=>{t.key&&this.msq.push(["trackRelatedSearch",t])},0)}}n(H,"msq",window._msq||[]);/*!
|
|
1
|
+
var Oe=Object.defineProperty;var qe=(F,C,M)=>C in F?Oe(F,C,{enumerable:!0,configurable:!0,writable:!0,value:M}):F[C]=M;var n=(F,C,M)=>(qe(F,typeof C!="symbol"?C+"":C,M),M);(function(F){"use strict";var C=(l=>(l[l.mustache=0]="mustache",l[l.vue=1]="vue",l[l.react=2]="react",l[l.angular=3]="angular",l))(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(){return this.dataLayer.searchObject.itemsPerPage||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 percentageOfResultsLoaded(){return this.endResultIndex/this.totalResults*100}get results(){return this.dataLayer.searchResults??[]}get autoCorrectedQuery(){var e;return((e=this.dataLayer.searchResultsMetadata)==null?void 0:e.autoCorrectedQuery)||""}get originalQuery(){var e;return((e=this.dataLayer.searchObject)==null?void 0:e.query)||""}get getAnswerData(){return this.dataLayer.getAnswerData||""}get shouldShowAnswer(){return this.isFirstPage&&this.dataLayer.getAnswerData!==""&&this.dataLayer.searchObject.query!=="*"&&this.dataLayer.searchObject.facets.length===0}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 searchingEverything(){return this.searchTerm==="*"}get isInfiniteScroll(){return this.dataLayer.isInfiniteScroll??!1}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,o=e.find(h=>h.name===i);if(o){const h=o.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,searchingEverything:this.searchingEverything,relatedSearches:this.relatedSearches,hasRelatedSearches:this.relatedSearches.length>0,externalPromotions:this.externalPromotions,hasExternalPromotions:this.externalPromotions.length>0,hasResults:this.results.length>0,hasResultsOrExternalPromotions:this.results.length>0||this.externalPromotions.length>0,answer:this.getAnswerData,shouldShowAnswer:this.shouldShowAnswer,isInfiniteScroll:this.isInfiniteScroll,percentageOfResultsLoaded:this.percentageOfResultsLoaded}}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 w{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],o=this.isObject(i)&&this.isObject(c);if(o&&!this.deepEqual(i,c)||!o&&i!==c)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}}class S{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 W{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 deleteCookie(e){this.getCookie(e)&&this.setCookie(e,"",{secure:!0,"max-age":-1})}static makeid(e){let t="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=a.length;for(let 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 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 G{constructor(e){n(this,"$searchTermChange",new S(""));n(this,"$loadingChange",new S(!1));n(this,"$searchResults",new S(null));n(this,"$searchResultsMetadata",new S(null));n(this,"$searchAutosuggest",new S(null));n(this,"$searchFacets",new S(null));n(this,"$searchFacetsCached",new S(null));n(this,"$searchstaxConfig",new S(null));n(this,"$autosuggestResults",new S(null));n(this,"$searchObject",new S({query:"",itemsPerPage:null,page:99999999,order:"",facets:[],additionalProps:[]}));n(this,"$searchRelatedSearches",new S(null));n(this,"$searchInputConfig",new S(null));n(this,"$searchExternalPromotions",new S(null));n(this,"$facetsTemplateData",new S(null));n(this,"$selectedFacetsTemplateData",new S(null));n(this,"$paginationData",new S(null));n(this,"$searchFeedbackData",new S(null));n(this,"$searchSortingData",new S(null));n(this,"$searchRelatedSearchesData",new S(null));n(this,"$searchExternalPromotionsData",new S(null));n(this,"$cookiesDisabled",new S(null));n(this,"$answer",new S(""));n(this,"$language",new S("en"));n(this,"currentPageValue",1);n(this,"isAnswerWidgetCreatedValue",!1);n(this,"renderingEngineValue",C.mustache);n(this,"parsedData",new M(this));n(this,"sessionId");n(this,"autoCorrect",!0);n(this,"forceNotCorrect",!1);n(this,"lastSearchValue","");n(this,"turnAIAnswerGenerationOn",!1);n(this,"isInfiniteScroll",!1);this.sessionId=e,this.cookieHandlingCallback(),this.$cookiesDisabled.subscribe(()=>{this.cookieHandlingCallback()})}cookieHandlingCallback(){this.cookiesDisabled?(W.deleteCookie(this.sessionId),W.deleteCookie("ms_visitorid")):W.getOrSetCookie(this.sessionId)}setIsInfiniteScroll(e){this.isInfiniteScroll=e}setSearchTerm(e){this.$searchTermChange.setValue(E.removeXSSRiskyTags(e))}setRenderingEngine(e){this.renderingEngineValue=e}setCurrentPage(e){this.currentPageValue=e}setIsAnswerWidgetCreated(e){this.isAnswerWidgetCreatedValue=e}setLoading(e){this.$loadingChange.setValue(e)}setSearchResults(e){w.deepEqual(e,this.searchResults??[""])||this.$searchResults.setValue(e)}setSearchResultsMetadata(e){w.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&&(!w.deepEqual(t,this.searchObject??{})||this.forceNotCorrect)&&this.$searchObject.setValue(t)}setSearchFacets(e){w.deepEqual(e,this.searchFacets??[])||this.$searchFacets.setValue(e)}setSearchFacetsCached(e){w.deepEqual(e,this.searchFacetsCached??[])||this.$searchFacetsCached.setValue(e)}setSearchRelatedSearches(e){w.deepEqual(e,this.searchRelatedSearches??[])||this.$searchRelatedSearches.setValue(e)}setSearchExternalPromotions(e){w.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)}setCookiesDisabled(e){this.$cookiesDisabled.setValue(e)}setAnswerData(e){this.$answer.setValue(e)}get getAnswerData(){return this.$answer.getValue()}get searchstaxConfig(){return this.$searchstaxConfig.getValue()}get searchFacets(){return this.$searchFacets.getValue()?JSON.parse(JSON.stringify(this.$searchFacets.getValue())):null}get searchFacetsCached(){return this.$searchFacetsCached.getValue()?JSON.parse(JSON.stringify(this.$searchFacetsCached.getValue())):null}get 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 isAnswerWidgetCreated(){return this.isAnswerWidgetCreatedValue}get renderingEngine(){return this.renderingEngineValue}get searchObject(){return JSON.parse(JSON.stringify(this.$searchObject.getValue()))}get searchRelatedSearches(){return this.$searchRelatedSearches.getValue()?JSON.parse(JSON.stringify(this.$searchRelatedSearches.getValue())):null}get searchExternalPromotions(){return this.$searchExternalPromotions.getValue()?JSON.parse(JSON.stringify(this.$searchExternalPromotions.getValue())):null}get language(){return this.$language.getValue()}get searchInputConfig(){return this.$searchInputConfig.getValue()}get answerConfig(){return this.$answer.getValue()}get autosuggestResults(){return this.$autosuggestResults.getValue()}get facetsTemplateData(){return this.$facetsTemplateData.getValue()}get selectedFacetsTemplateData(){return this.$selectedFacetsTemplateData.getValue()}get paginationData(){return this.$paginationData.getValue()}get searchFeedbackData(){return this.$searchFeedbackData.getValue()}get searchSortingData(){return this.$searchSortingData.getValue()}get searchRelatedSearchesData(){return this.$searchRelatedSearchesData.getValue()}get searchExternalPromotionsData(){return this.$searchExternalPromotionsData.getValue()}get cookiesDisabled(){return(this.$cookiesDisabled.getValue()??!1)||!navigator.cookieEnabled}}class ${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 o={custom:null,uniqueId:s[e.responseHeader.params.uniqueId]??"",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(o)}),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 z{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 Y(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)),e.page&&(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]),o=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:o,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,itemsPerPage:void 0,order:E.removeXSSRiskyTags(t[this.routeName+"[order]"])||"",facets:this.extractArrayOfFacetsFromQueryParameters(t)||[]}}}class Y{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}}const D={questionURL:"http://smartsearch-dev.searchstax.co/completion/?q=",question:"I_AM_A_QUESTION",notQuestion:"I_AM_NOT_A_QUESTION",close:"CLOSE"};class Z{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 o="";for(const h of i)o+=` ${c}:"${h}"`;a=a.concat("fq="+o.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??"*",itemsPerPage:10,page:1,order:"",facets:[],additionalProps:this.dataLayer.searchObject.additionalProps},this.cacheFacetsCallback.bind(this),!0))}cacheFacetsCallback(e){let t=$.extractFacets(e);this.dataLayer.setSearchFacetsCached(t)}search(e,t,a=!1,r=!1){if(e.query&&e.query!=="undefined"&&e.itemsPerPage!==void 0){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:(g,y)=>g.get(y)??""}),i=s.languageVariant?"&fq=_language:"+s.languageVariant:"";let c=e.itemsPerPage,o=e.itemsPerPage*(e.page-1),h=e.order?`&sort=${e.order}`:"";const u=this.url+"?q="+encodeURIComponent(e.query.trim())+"&start="+o+this.toQueryString(e.additionalProps??[])+this.generateFacetQuery(e.facets.filter(g=>g.type==="or"||g.type==="showUnavailable"),!0)+this.generateFacetQuery(e.facets.filter(g=>g.type==="and"||g.type==="tabs"),!1)+h+`&spellcheck.correct=${this.dataLayer.autoCorrect&&!r}&rows=${c}&language=`+this.dataLayer.language+i,p={method:"GET",headers:this.authHeader,credentials:"same-origin",signal:this.signalSearch};a&&delete p.signal,fetch(u,p).then(g=>g.json()).then(g=>{this.dataLayer.setLoading(!1),t(g)}).catch(()=>{this.dataLayer.setLoading(!1)})}}startSSE(e,t){if(!this.dataLayer.turnAIAnswerGenerationOn||e==="*"||this.dataLayer.lastSearchValue===e||this.dataLayer.searchObject.facets.length>0||this.dataLayer.searchObject.page!==1)return;const a=new EventSource(D.questionURL+e),r=this.dataLayer;a.onmessage=function(s){if(s.data===D.question||s.data===D.notQuestion){r.setAnswerData("");return}if(s.data===D.close){a.close();return}t(s.data)},a.onerror=function(s){console.log(s),a.close()}}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 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(()=>{t.key&&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(()=>{t.key&&this.msq.push(["trackSearch",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(()=>{t.key&&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(()=>{t.key&&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,O=Array.isArray||function(e){return ee.call(e)==="[object Array]"};function Q(l){return typeof l=="function"}function te(l){return O(l)?"array":typeof l}function K(l){return l.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function J(l,e){return l!=null&&typeof l=="object"&&e in l}function ae(l,e){return l!=null&&typeof l!="object"&&l.hasOwnProperty&&l.hasOwnProperty(e)}var se=RegExp.prototype.test;function re(l,e){return se.call(l,e)}var ie=/\S/;function ne(l){return!re(ie,l)}var ce={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function oe(l){return String(l).replace(/[&<>"'`=\/]/g,function(t){return ce[t]})}var le=/\s*/,he=/\s+/,X=/\s*=/,ue=/\s*\}/,de=/#|\^|\/|>|\{|&|=|!/;function ge(l,e){if(!l)return[];var t=!1,a=[],r=[],s=[],i=!1,c=!1,o="",h=0;function u(){if(i&&!c)for(;s.length;)delete r[s.pop()];else s=[];i=!1,c=!1}var p,g,y;function T(P){if(typeof P=="string"&&(P=P.split(he,2)),!O(P)||P.length!==2)throw new Error("Invalid tags: "+P);p=new RegExp(K(P[0])+"\\s*"),g=new RegExp("\\s*"+K(P[1])),y=new RegExp("\\s*"+K("}"+P[1]))}T(e||f.tags);for(var m=new V(l),L,v,b,R,I,x;!m.eos();){if(L=m.pos,b=m.scanUntil(p),b)for(var A=0,U=b.length;A<U;++A)R=b.charAt(A),ne(R)?(s.push(r.length),o+=R):(c=!0,t=!0,o+=" "),r.push(["text",R,L,L+1]),L+=1,R===`
|
|
@@ -436,13 +436,9 @@ class $ {
|
|
|
436
436
|
static combineResultsWithMetadata(e) {
|
|
437
437
|
const t = [], a = parseInt(e.response.start + "") - 1, r = parseInt(e.responseHeader.params.rows);
|
|
438
438
|
return e.response.docs.forEach((s, i) => {
|
|
439
|
-
const
|
|
439
|
+
const o = {
|
|
440
440
|
custom: null,
|
|
441
|
-
uniqueId:
|
|
442
|
-
e.responseHeader.params.uniqueId,
|
|
443
|
-
s,
|
|
444
|
-
e
|
|
445
|
-
) ?? "",
|
|
441
|
+
uniqueId: s[e.responseHeader.params.uniqueId] ?? "",
|
|
446
442
|
position: a * r + 1 + i,
|
|
447
443
|
ribbon: this.doesMapExist("ribbon", e) ? this.getValueByKey("ribbon", s, e) : null,
|
|
448
444
|
paths: this.doesMapExist("paths", e) ? this.getValueByKey("paths", s, e) : null,
|
|
@@ -456,7 +452,7 @@ class $ {
|
|
|
456
452
|
unmappedFields: this.getUnmappedFields(s, e),
|
|
457
453
|
allFields: this.getAllFields(s, e)
|
|
458
454
|
};
|
|
459
|
-
t.push(
|
|
455
|
+
t.push(o);
|
|
460
456
|
}), t;
|
|
461
457
|
}
|
|
462
458
|
static extractFacets(e) {
|
|
@@ -918,9 +914,9 @@ function pe(l, e) {
|
|
|
918
914
|
p = new RegExp(W(P[0]) + "\\s*"), g = new RegExp("\\s*" + W(P[1])), y = new RegExp("\\s*" + W("}" + P[1]));
|
|
919
915
|
}
|
|
920
916
|
b(e || f.tags);
|
|
921
|
-
for (var m = new
|
|
917
|
+
for (var m = new j(l), C, S, v, R, I, T; !m.eos(); ) {
|
|
922
918
|
if (C = m.pos, v = m.scanUntil(p), v)
|
|
923
|
-
for (var F = 0,
|
|
919
|
+
for (var F = 0, B = v.length; F < B; ++F)
|
|
924
920
|
R = v.charAt(F), ce(R) ? (s.push(r.length), o += R) : (c = !0, t = !0, o += " "), r.push(["text", R, C, C + 1]), C += 1, R === `
|
|
925
921
|
` && (u(), o = "", h = 0, t = !1);
|
|
926
922
|
if (!m.scan(p))
|
|
@@ -961,20 +957,20 @@ function me(l) {
|
|
|
961
957
|
}
|
|
962
958
|
return e;
|
|
963
959
|
}
|
|
964
|
-
function
|
|
960
|
+
function j(l) {
|
|
965
961
|
this.string = l, this.tail = l, this.pos = 0;
|
|
966
962
|
}
|
|
967
|
-
|
|
963
|
+
j.prototype.eos = function() {
|
|
968
964
|
return this.tail === "";
|
|
969
965
|
};
|
|
970
|
-
|
|
966
|
+
j.prototype.scan = function(e) {
|
|
971
967
|
var t = this.tail.match(e);
|
|
972
968
|
if (!t || t.index !== 0)
|
|
973
969
|
return "";
|
|
974
970
|
var a = t[0];
|
|
975
971
|
return this.tail = this.tail.substring(a.length), this.pos += a.length, a;
|
|
976
972
|
};
|
|
977
|
-
|
|
973
|
+
j.prototype.scanUntil = function(e) {
|
|
978
974
|
var t = this.tail.search(e), a;
|
|
979
975
|
switch (t) {
|
|
980
976
|
case -1:
|
|
@@ -1146,7 +1142,7 @@ f.render = function(e, t, a, r) {
|
|
|
1146
1142
|
return V.render(e, t, a, r);
|
|
1147
1143
|
};
|
|
1148
1144
|
f.escape = le;
|
|
1149
|
-
f.Scanner =
|
|
1145
|
+
f.Scanner = j;
|
|
1150
1146
|
f.Context = A;
|
|
1151
1147
|
f.Writer = k;
|
|
1152
1148
|
const ye = {
|
|
@@ -1831,10 +1827,10 @@ class Ie {
|
|
|
1831
1827
|
const q = T.querySelector("." + O);
|
|
1832
1828
|
q && q.addEventListener("click", this.closeOverlay.bind(this));
|
|
1833
1829
|
}
|
|
1834
|
-
const
|
|
1830
|
+
const B = T.querySelector(
|
|
1835
1831
|
"." + (((b = (y = (g = this.config) == null ? void 0 : g.templates) == null ? void 0 : y.mainTemplateMobile) == null ? void 0 : b.filterByContainerClass) || d.facets.mainTemplateMobile.filterByContainerClass)
|
|
1836
1832
|
);
|
|
1837
|
-
|
|
1833
|
+
B && this.createFilterByComponent(B);
|
|
1838
1834
|
const P = T.querySelector(
|
|
1839
1835
|
"." + (((S = (C = (m = this.config) == null ? void 0 : m.templates) == null ? void 0 : C.mainTemplateMobile) == null ? void 0 : S.selectedFacetsContainerClass) || d.facets.mainTemplateMobile.selectedFacetsContainerClass)
|
|
1840
1836
|
);
|