var CoveoSearch,CoveoQuerySuggest,Header;(function(n){var t;(function(t){var r=Components.Cookies.CookieService,u=Components.CookieCompliance.CookieCategory,f=function(){function t(n){this._initSettings=n;this._isContextual=!1;this._originContext="Search";this._language=Components.Utils.requestLanguage;this._device=i.getDeviceName();this._mobile=i.isMobileDevice();this._postSearchEvent=this.createPostEventMethod("/rest/ua/v15/analytics/search");this._postClickEvent=this.createPostEventMethod("/rest/ua/v15/analytics/click");this._postCustomEvent=this.createPostEventMethod("/rest/ua/v15/analytics/custom")}return t.prototype.getEndpointUrl=function(n){var i=this._initSettings.baseUrl+n+"?org="+this._initSettings.organizationId,t=r.getCookie("searchVisitorId");return t!=null&&t.length>0&&(i+="&visitor="+t),i},t.prototype.logSearchEvent=function(n,t,i,r){r===void 0&&(r={});var u=this.buildSearchEvent(n,t,i,r);return this._postSearchEvent(u)},t.prototype.logClickEvent=function(n,t,i,r,u){u===void 0&&(u={});var f=this.buildClickEvent(n,t,i,r,u);return this._postClickEvent(f)},t.prototype.logCustomEvent=function(n,t,i){i===void 0&&(i={});var r=this.buildCustomEvent(n,t,i);return this._postCustomEvent(r)},t.prototype.createPostEventMethod=function(t){var i=this;return function(r){var u=$.Deferred();return n.CoveoAuthentication.getCurrentSearchToken().done(function(n){$.ajax({method:"POST",url:i.getEndpointUrl(t),contentType:"application/json; charset=utf-8",crossDomain:!0,dataType:"json",headers:{Authorization:"Bearer "+n},data:JSON.stringify(r)}).done(function(n){i.handleSuccessResult(n);u.resolve(!0)}).fail(function(n){i.handleFailedResult(n);u.reject()})}).fail(function(n){console.error("failed to get token",n)}),u.promise()}},t.prototype.buildAnalyticsEvent=function(n,t){return{actionCause:n.name,actionType:n.type,username:null,userDisplayName:this._initSettings.userName,anonymous:this._initSettings.isAnonymous,device:this._device,mobile:this._mobile,language:this._language,responseTime:undefined,originLevel1:this._initSettings.searchHub,originLevel2:undefined,originLevel3:document.referrer,originContext:this._originContext,customData:Object.keys(t).length>0?t:undefined,userAgent:navigator.userAgent}},t.prototype.buildSearchEvent=function(n,t,i,r){return $.extend({},this.buildAnalyticsEvent(n,r),{searchQueryUid:i.searchUid,queryPipeline:i.pipeline,splitTestRunName:undefined,splitTestRunVersion:undefined,queryText:t.q,advancedQuery:undefined,numberOfResults:i.totalResults,resultsPerPage:i.pageSize,originLevel2:t.c!=null?t.c:"all",responseTime:i.duration,pageNumber:i.pageIndex,didYouMean:!0,facets:undefined,contextual:this._isContextual})},t.prototype.buildClickEvent=function(n,t,i,r,u){return $.extend({},this.buildAnalyticsEvent(n,u),{searchQueryUid:i.searchUid,queryPipeline:i.pipeline,splitTestRunName:undefined,splitTestRunVersion:undefined,documentUri:r.sysUri,documentUriHash:r.sysUriHash,documentUrl:r.url,documentTitle:r.sysTitle,documentCategory:undefined,originLevel2:t.c!=null?t.c:"all",collectionName:r.sysCollection,sourceName:r.sourceName,documentPosition:r.index+1,responseTime:0,viewMethod:n.name,rankingModifier:r.rankingModifier})},t.prototype.buildCustomEvent=function(n,t,i){return $.extend({},this.buildAnalyticsEvent(n,i),{eventType:n.type,eventValue:n.name,originLevel2:t.c!=null?t.c:"all",responseTime:0})},t.prototype.handleSuccessResult=function(n){r.setCookie("searchVisitorId",n.visitorId,1,u.Performance)},t.prototype.handleFailedResult=function(t){var i=t.responseJSON;(i.type==="InvalidToken"||i.type==="ImpersonateUnauthorized")&&n.CoveoAuthentication.clear()},t}(),i;t.CoveoAnalyticsServiceClient=f;i=function(){function n(){}return n.getDeviceName=function(n){return(n===void 0&&(n=navigator.userAgent),n.match(/Edge/i))?"Edge":n.match(/Opera Mini/i)?"Opera Mini":n.match(/Android/i)?"Android":n.match(/BlackBerry/i)?"BlackBerry":n.match(/iPhone/i)?"iPhone":n.match(/iPad/i)?"iPad":n.match(/iPod/i)?"iPod":n.match(/Chrome/i)?"Chrome":n.match(/MSIE/i)||n.match(/Trident/i)?"IE":n.match(/Opera/i)?"Opera":n.match(/Firefox/i)?"Firefox":n.match(/Safari/i)?"Safari":"Others"},n.isAndroid=function(){return n.getDeviceName()==="Android"},n.isIos=function(){var t=n.getDeviceName();return t==="iPhone"||t==="iPad"||t==="iPod"},n.isMobileDevice=function(){return this.mobile},n.mobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n}();t.DeviceUtils=i;t.actionCauses={searchboxSubmit:{name:"searchboxSubmit",type:"search box"},interfaceChange:{name:"interfaceChange",type:"interface"},didyoumeanClick:{name:"didyoumeanClick",type:"misc"},documentOpen:{name:"documentOpen",type:"document"},pagerNumber:{name:"pagerNumber",type:"getMoreResults"},pagerNext:{name:"pagerNext",type:"getMoreResults"},pagerPrevious:{name:"pagerPrevious",type:"getMoreResults"},interfaceLoad:{name:"interfaceLoad",type:"interface"}}})(t=n.CoveoAnalytics||(n.CoveoAnalytics={}))})(CoveoSearch||(CoveoSearch={})),function(n){var t;(function(n){var i=Components.LocalStorage,t=Components.Utils;n.getCurrentSearchToken=i.createCachedDataSource({cacheKey:"searchToken."+t.userId,expiresAfter:480},function(n){var i="";$.ajax({method:"POST",url:t.getActionUrl("GetSearchToken","CoveoSearch"),data:{excludeOptionsOrModules:!1}}).done(function(t){try{i=t;n.resolve(i)}catch(r){n.reject(i)}}).fail(function(){n.reject(i)})});n.clear=function(){return i.remove("searchToken."+t.userId)}})(t=n.CoveoAuthentication||(n.CoveoAuthentication={}))}(CoveoSearch||(CoveoSearch={})),function(n){var t;(function(t){var u=Components.Utils,i=Components.Logger,f=function(){function n(n,t){var i=new r(t),u;ko.applyBindings(i,n[0]);window.addEventListener("popstate",function(n){var t=n.state;console.info("popstate"+t);t==null||typeof t=="object"&&(console.info(t),i.fromJs(t),i.startSearch(!0,!1,null))});u=new Swiper(".swiper-container",{slidesPerView:"auto",spaceBetween:30,freeMode:!0})}return n}(),r;t.Component=f;r=function(){function t(t){var r=this;this.isEmptySearch=ko.observable(!0);this.searchText=ko.observable("");this.searchBoxFocus=ko.observable(!0);this.isLoading=ko.observable(!0);this.searchCategory=ko.observable("");this.pageIndex=ko.observable(0);this.results=ko.observable(null);this.typeAheadInitialized=!1;this.searchResults=ko.computed(function(){return r.results()!=null?r.results().results:[]});this.correction=ko.computed(function(){return r.results()!=null?r.results().queryCorrection:null});this.totalResults=ko.computed(function(){return r.results()!=null?r.results().totalResults:0});this.totalResultsSummary=ko.computed(function(){return r.results()!=null?r.results().totalResultsSummary:""});this.totalPages=ko.computed(function(){return r.results()!=null?r.results().totalPages:0});this.hasCorrection=ko.computed(function(){return r.correction()!=null});this.queryCorrectionHtml=ko.computed(function(){return r.correction()!=null?r.correction().queryHighlighted:""});this.initTypeAhead=function(){r.typeAheadInitialized=!0;r.coveoQS.initTypeAhead().done(function(){r.searchBoxFocus(!1);r.searchBoxFocus(!0)}).fail(function(){i.error("An exception occurred while initializing the mobile coveosearchbox QuerySuggest typeahead.")});r.bindTypeAheadEvents()};this.bindTypeAheadEvents=function(){var n=jQuery.Event("keypress");n.ctrlKey=!1;n.which=13;r.searchBoxInputElement.on("typeahead:select typeahead:autocomplete",function(){r.searchBoxInputElement.trigger(n)})};this.clearSearchText=function(){r.searchText("");r.initTypeAhead()};this.onResultClicked=function(t){return r.analytics.logClickEvent(n.CoveoAnalytics.actionCauses.documentOpen,r.query,r.results(),t),!0};this.onExtraLinkClicked=function(t){return r.analytics.logClickEvent(n.CoveoAnalytics.actionCauses.documentOpen,r.query,r.results(),t.owner),!0};this.loadFromBrowserHistory=function(n){n.q!==undefined&&(console.info(n.q),r.searchText(n.q))};this.persistInBrowserHistory=function(n,t){t===void 0&&(t=!1);t?history.replaceState(n,""):history.pushState(n,"","?"+$.param(n))};this.searchBoxOnkeyPressed=function(n,t){return t.which===13?(r.searchBoxEnterKeyPressed(),!1):!0};this.searchBoxEnterKeyPressed=function(){r.pageIndex(0);r.startSearch(!1,!0,n.CoveoAnalytics.actionCauses.searchboxSubmit);r.coveoQS.initTypeAhead(r.searchText()).done(function(){}).fail(function(){i.error("An exception occurred while initializing the mobile coveosearchbox QuerySuggest typeahead.")})};this.searchButtonOnClick=function(){return r.pageIndex(0),r.startSearch(!1,!0,n.CoveoAnalytics.actionCauses.searchboxSubmit),r.searchBoxFocus(!1),r.searchBoxFocus(!0),!1};this.startSearch=function(n,t,i,u){(u===void 0&&(u={}),/googlebot/i.test(navigator.userAgent))||(r.isLoading(!0),r.isEmptySearch(r.searchText().trim()==""),t&&(r.persistInBrowserHistory(r.toJs(),n),n||r.updateSingInLink(r.toJs())),r.searchText().trim()!==""?(r.query=r.toJs(),r.loadSearchResults(r.query).done(function(n){n.results.forEach(function(n){return n.extralinks.forEach(function(t){return t.owner=n})});r.results(n);r.pageIndex(n.pageIndex);r.trackSearch(r.query,n);i!=null&&r.analytics.logSearchEvent(i,r.query,n,u)}).fail(function(){r.results(null);r.pageIndex(0)}).always(function(){r.isLoading(!1)})):(r.results(null),r.pageIndex(0),r.isLoading(!1)))};this.toJs=function(){var n={q:r.searchText().trim()};return r.searchCategory().trim()!==""&&(n.c=r.searchCategory().trim()),r.pageIndex()!==0&&(n.page=r.pageIndex()),n};this.fromJs=function(n){n.q!=undefined?r.searchText(n.q):r.searchText("");n.c!=undefined?(r.searchCategory(n.c),r.coveoQS.cat=n.c):r.searchCategory("");n.page!=undefined?r.pageIndex(n.page):r.pageIndex(0)};this.loadSearchResults=function(t){var i=$.Deferred();return n.CoveoAuthentication.getCurrentSearchToken().done(function(f){$.ajax({method:"POST",url:u.getActionUrl("Search","CoveoSearch",{token:f,configId:r.params.configId}),contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(t)}).done(function(n){try{i.resolve(n)}catch(t){i.reject()}}).fail(function(){i.reject();n.CoveoAuthentication.clear()})}).fail(function(){i.reject()}),i.promise()};this.trackSearch=function(n,t){if(dataLayer!=null&&n!=null&&t!=null)try{dataLayer.push({event:"CoveoSearch",data:{q:n.q,c:n.c!=undefined?n.c:"",page:n.page!=undefined?n.page:0,totalResults:t.totalResults}})}catch(i){}};this.params=t;this.coveoQS=new CoveoQuerySuggest.CoveoQuerySuggest({inputElement:$(t.searchBoxInputSelector),searchResultsPageUrl:t.searchResultsPageUrl,cat:this.searchCategory(),handleTypeAheadEvents:!1});this.fromJs(t.query);this.initializeAnalyticsClient(t.analyticsSettings);this.startSearch(!0,!0,n.CoveoAnalytics.actionCauses.interfaceLoad);this.searchBoxInputElement=$(t.searchBoxInputSelector);$(this.searchBoxInputElement).on("input",function(){r.typeAheadInitialized||r.initTypeAhead()})}return t.prototype.setCategory=function(t){return this.coveoQS.cat=t,this.coveoQS.initTypeAhead(this.searchText()).done(function(){}).fail(function(){i.error("An exception occurred while initializing the mobile coveosearchbox QuerySuggest typeahead.")}),this.searchCategory(t),this.pageIndex(0),this.startSearch(!1,!0,n.CoveoAnalytics.actionCauses.interfaceChange,{interfaceChangeTo:t!=null?t:"all"}),!1},t.prototype.setPage=function(t,i){if(t>=0){this.pageIndex(t);this.startSearch(!1,!0,null);var r=null;switch(i){case"next":r=n.CoveoAnalytics.actionCauses.pagerNext;break;case"previous":r=n.CoveoAnalytics.actionCauses.pagerPrevious;break;case"number":r=n.CoveoAnalytics.actionCauses.pagerNumber}this.analytics.logCustomEvent(r,this.query,{pagerNumber:t.toString()})}return!1},t.prototype.applyCorrection=function(){return this.correction()!=null&&(this.searchText(this.correction().query),this.startSearch(!1,!0,n.CoveoAnalytics.actionCauses.didyoumeanClick)),!1},t.prototype.initializeAnalyticsClient=function(t){this.analytics=new n.CoveoAnalytics.CoveoAnalyticsServiceClient(t)},t.prototype.updateSingInLink=function(n){var t=$("[data-selector='link-sign-in']"),i;t.length&&(i="/SignIn?returnUrl="+encodeURIComponent("/search?"+$.param(n)),t.attr("href",i))},t}()})(t=n.CoveoSearchResults||(n.CoveoSearchResults={}))}(CoveoSearch||(CoveoSearch={})),function(n){var t=CoveoSearch.CoveoAuthentication,i=Components.Utils,r=function(){function n(n){this.inputElement=n.inputElement;this.searchResultsPage=n.searchResultsPageUrl;this.cat=n.cat;this.handleTypeAheadEvents=n.handleTypeAheadEvents}return n.prototype.initTypeAhead=function(n){var t=this,i;return n===void 0&&(n=""),i=$.Deferred(),this.doInitialize(n).done(function(){if(t.handleTypeAheadEvents){t.inputElement.on("typeahead:select",function(n,i){t.onTypeAheadSelected(n,i)});t.inputElement.on("typeahead:autocomplete",function(n,i){t.onTypeAheadSelected(n,i)})}i.resolve()}).fail(function(){i.reject()}),i.promise()},n.prototype.redirectToSearchResultsPage=function(){var n;n=this.searchResultsPage.indexOf("?")!==-1?this.searchResultsPage+"&q="+encodeURIComponent(this.inputElement.val()):this.searchResultsPage+"?q="+encodeURIComponent(this.inputElement.val());this.cat!==undefined&&this.cat!==null&&this.cat!==""&&(n+="&c="+encodeURIComponent(this.cat));window.location.href=n},n.prototype.doInitialize=function(n){var u=this,r;n===void 0&&(n="");r=$.Deferred();try{this.inputElement.typeahead("destroy");t.getCurrentSearchToken().done(function(t){var f=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.whitespace,queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:i.getActionUrl("QuerySuggest","CoveoQuerySuggest"),prepare:function(n,i){return i.url+="?q="+encodeURIComponent(u.inputElement.val())+"&token="+encodeURIComponent(t),i},transform:function(n){return n.suggestions}}});u.inputElement.typeahead({hint:!0,minLength:2,highlight:!1},{name:"coveoSuggestions",source:f,displayKey:"suggestionText",limit:Number.MAX_VALUE,templates:{suggestion:function(n){var t=n.suggestionHighlight.replace(/\[/g,"<strong>").replace(/\]/g,"<\/strong>").replace(/\{/g,"").replace(/\}/g,"").replace(/\(/g,"<i>").replace(/\)/g,"<\/i>");return"<div>"+t+"<\/div>"}}});n!==undefined&&n!==null&&n!==""&&u.inputElement.typeahead("val",n);r.resolve()}).fail(function(){r.reject()})}catch(f){r.reject()}return r.promise()},n.prototype.onTypeAheadSelected=function(n){n.preventDefault();this.redirectToSearchResultsPage()},n}();n.CoveoQuerySuggest=r}(CoveoQuerySuggest||(CoveoQuerySuggest={})),function(n){var t=Components.Logger,i=function(){function n(n,t){var i=this;this.jqueryElement=n;this.parm=t;this.$searchTextBox=jQuery("[data-selector='site-search-box']",this.jqueryElement);this.$mobileOverLay=jQuery("#mobile-search-overlay",this.jqueryElement);this.$mobileSearchTextBox=jQuery("[data-selector='mobile-searchbox']",this.jqueryElement);this.$mobileSearchNavButton=jQuery("#mobile-search-navbutton",this.jqueryElement);this.$languageSelector=jQuery("[data-selector='language-selector']",this.jqueryElement);this.$countrySelector=jQuery("[data-selector='country-selector']",this.jqueryElement);this.$busyIndicator=jQuery("[data-selector='busy-indicator']",this.jqueryElement);this.coveoQS=new CoveoQuerySuggest.CoveoQuerySuggest({inputElement:this.$searchTextBox,searchResultsPageUrl:this.parm.searchResultsPageUrl,cat:"",handleTypeAheadEvents:!0});this.mobileCoveoQS=new CoveoQuerySuggest.CoveoQuerySuggest({inputElement:this.$mobileSearchTextBox,searchResultsPageUrl:this.parm.searchResultsPageUrl,cat:"",handleTypeAheadEvents:!0});jQuery(this.jqueryElement).on("click","[data-selector='site-search-button']",function(n){return i.onSiteSearchButtonClicked(n)});jQuery(this.jqueryElement).on("click","[data-selector='mobile-searchbtn']",function(n){return i.onMobileSearchButtonClicked(n)});jQuery(this.jqueryElement).on("click","[data-selector='mobile-searchcancelbtn']",function(n){return i.onMobileCancelButtonClicked(n)});jQuery(this.jqueryElement).on("click","#mobile-search-navbutton",function(){i.$mobileOverLay.show()});jQuery(this.jqueryElement).on("keypress","[data-selector='site-search-box']",function(n){return i.onSiteSearchBoxKeyPress(n)});jQuery(this.jqueryElement).on("keypress","[data-selector='mobile-searchbox']",function(n){return i.onMobileSearchBoxKeyPress(n)});jQuery(this.jqueryElement).on("show.bs.collapse","#country-language-selector",function(n){return i.onCountryLanguageSelectorShow(n)});jQuery(this.jqueryElement).on("click","[data-selector='save-button']",function(n){return i.onSaveButtonClicked(n)});this.initializeTypeAhead()}return n.prototype.onSiteSearchButtonClicked=function(){this.coveoQS.redirectToSearchResultsPage()},n.prototype.onMobileSearchButtonClicked=function(){this.mobileCoveoQS.redirectToSearchResultsPage()},n.prototype.onMobileCancelButtonClicked=function(){this.$searchTextBox.val("");this.$mobileOverLay.hide()},n.prototype.onSiteSearchBoxKeyPress=function(n){n.keyCode===13&&this.coveoQS.redirectToSearchResultsPage()},n.prototype.onMobileSearchBoxKeyPress=function(n){n.keyCode===13&&this.mobileCoveoQS.redirectToSearchResultsPage()},n.prototype.onCountryLanguageSelectorShow=function(){var n=this;this.countriesLoaded||(this.applyLoadingIndicator(this.$countrySelector,!0),$.ajax({type:"GET",url:this.parm.getCountriesUrl,dataType:"json"}).done(function(t){n.$countrySelector.empty();t.forEach(function(t){var i=jQuery("<option><\/option>");i.text(t.countryName);i.val(t.countryCode);t.countryCode.toUpperCase()===n.parm.countryCode.toUpperCase()&&i.attr("selected","selected");n.$countrySelector.append(i)});n.countriesLoaded=!0}).fail(function(){console.error("Error occured when getting countries.")}).always(function(){n.applyLoadingIndicator(n.$countrySelector,!1)}))},n.prototype.onSaveButtonClicked=function(){var n=this,t=this.$languageSelector.val(),i=this.$countrySelector.val();this.$busyIndicator.show();jQuery.ajax({type:"POST",url:this.parm.saveCultureUrl,data:{languageCode:t,countryCode:i,returnUrl:window.location.href}}).done(function(n){n&&n.RedirectUrl&&(window.location.href=n.RedirectUrl)}).always(function(){n.$busyIndicator.hide()})},n.prototype.applyLoadingIndicator=function(n,t){n.css("background-image",t?"url('/design/images/loading.gif')":"");n.css("background-repeat","no-repeat");n.css("padding-left",t?"20px":"")},n.prototype.initializeTypeAhead=function(){var n=this;this.coveoQS.initTypeAhead().done(function(){var i=$(n.$searchTextBox).closest("div.twitter-typeahead");$(i).find(".tt-menu").css("z-index","200");$(n.$searchTextBox).prop("name")==="site-search-query"?($(i).find(".tt-menu").css("top","30px"),$(n.$searchTextBox).data("ismvc")?$(i).css("display",""):(i=$(n.$searchTextBox).closest("div.twitter-typeahead"),$(i).css("display","inline-block"),$(i).css("position","relative"),$(i).css("width","auto"),$(i).css("float","left"))):$(n.$searchTextBox).hasClass("search-results-input")&&$(i).css("display","block");n.mobileCoveoQS.initTypeAhead().done(function(){}).fail(function(){t.error("An exception occurred while initializing the mobile searchbox QuerySuggest typeahead.")})}).fail(function(){t.error("An exception occurred while initializing the searchbox QuerySuggest typeahead.")})},n}();n.Header=i}(Header||(Header={}))