(function(n,t){function r(n){this.page=n.CurrentPage||this.defaults.page;this.size=n.PageSize||this.defaults.size;this.isSortingOptionInURL=n.IsSortingOptionInURL||this.defaults.isSortingOptionInURL;this.sortingOption=n.SortingOption||this.defaults.sortingOption;n&&(this.sizeID=n.DealerCode+"_search_pagesize",this.sortingID=n.DealerCode+"_search_sortingoption",n.Mode===1&&(this.sizeID+="_vast",this.sortingID+="_vast"),this.IsComvoy=n.IsNationalMarketplace);this.UI={$paginationContainer:$(".pagination-bottom-container")}}var i=t.utilities;t.Pagination=r;r.prototype={defaults:{page:1,size:10,sortingOption:4,isSortingOptionInURL:!1},update:function(n,t,r,u){var f=n,e=t,o=r,s=u;i.isInteger(n)||(f=this.defaults.page);i.isInteger(t)||(e=this.defaults.size);i.isInteger(r)||(o=this.defaults.sortingOption);u||(s=this.defaults.isSortingOptionInURL);this.page=Math.abs(f);this.size=Math.abs(e);this.sortingOption=Math.abs(o);this.isSortingOptionInURL=s;this.sizeID&&$.cookie(this.sizeID,this.size);$.cookie(this.sortingID,this.sortingOption)},rebindEventListeners:function(t,i){function u(n){return $(n).closest("[data-root=pagination-bottom]").length>0}var r=this,h=t.find(".pagination__list .pagination__list-item:not(.pagination__list-item--arrow)"),f,e,o,s;h.off("click").on("click",function(n){n.preventDefault();var t=$(n.currentTarget),f=t.data();r.changePage(parseInt(f.value,10),u(n.currentTarget),i)});f=t.find(".mobile-choose-page__input");f.off("change").on("change",function(n){n.preventDefault();var t=$(this).val();r.changePage(parseInt(t,10),u(n.currentTarget),i)});e=t.find(".pagination__list-item--arrow");e.off("click").on("click",function(n){n.preventDefault();var t=$(n.currentTarget).hasClass("pagination__list-item--next");t?r.update(r.page+1,r.size,r.sortingOption,r.isSortingOptionInURL):r.update(r.page-1,r.size,r.sortingOption,r.isSortingOptionInURL);u(n.currentTarget)&&r.scrollToTopAfterRender(i);i.execute(!0)});o=t.find(".items-per-page__input");o.off("change").on("change",function(){var t=$(this).val();r.update(1,parseInt(t,10),r.sortingOption,r.isSortingOptionInURL);i.execute(!0);n.visor.fire(n.visor.Events.VSP_CHANGE_ITEMS_PER_PAGE,{data:t})});s=t.find(".sorting-options__input");s.off("change").on("change",function(){var t=$(this);r.update(1,r.size,parseInt(t.val(),10),!0);i.execute(!0);n.visor.fire(n.visor.Events.VSP_CHANGE_SORT,{data:t.children(":selected").text()})})},scrollToTopAfterRender:function(n){n.once("render",function(){n.scrollToTop()})},changePage:function(n,t,i){this.update(n,this.size,this.sortingOption,this.isSortingOptionInURL);t&&this.scrollToTopAfterRender(i);i.execute(!0)}}})(window.wts,window.wts.modules),function(n,t){function f(n,t,i){e.call(this);this.geolocationInput=t;var u=Object.assign({miles:r},i);this.state={query:u.query||"",miles:u.miles,prevQuery:u.query||""};this.UI={$root:n,$form:n.find("form"),$input:n.find(".vehicle-search__input"),$action:n.find(".vehicle-search__action"),$icon:n.find(".vehicle-search__action .fa"),$miles:n.find("[name='Miles']")};this.geolocationInput.location.hasLocation()?this.UI.$miles.prop("disabled",!1):this.UI.$miles.prop("disabled",!0);this.addEventListeners()}var e=t.EventEmitter;t.VehicleSearcher=f;var i={SEARCH:["search","searchMiles"]},r=1e4,o="vehicle-search--flash",u={SEARCH:"fa-search",SEARCHING:"fa-spinner",SPIN_ANIMATION:"fa-pulse"};f.Events=i;f.prototype=Object.assign({},e.prototype,{addEventListeners:function(){function u(n,i){return t.UserLocation.toHumanReadable(n)!==t.UserLocation.toHumanReadable(i)}var i=this;this.UI.$form.on("submit",function(n){n.preventDefault();i.search()});this.UI.$input.on("change input",function(){var n=$(this).val();i.set({query:n})});this.UI.$miles.on("change",function(n){var u=$(n.currentTarget).val(),t=parseInt(u,10);isNaN(t)&&(t=r);i.set({miles:t});i.searchMiles()});this.geolocationInput.location.on(t.UserLocation.Events.VALUE,function(){i.UI.$miles.prop("disabled",!1);i.flash().then(()=>{var t=i.geolocationInput.location.get()||{},r=i.geolocationInput.state.previousLocation||{};u(t,r)&&(i.geolocationInput.state.previousLocation=t,i.search(),n.visor.fire(n.visor.Events.TRUCK_SEARCH_ZIPCODE_CHANGE,{type:"tool",location:"filter-search-box",description:"zipcode-submit"}))})});this.geolocationInput.location.on(t.UserLocation.Events.CLEAR,function(){i.UI.$miles.prop("disabled",!0);i.flash()})},set:function(n){this.state=Object.assign(this.state,n);this.render()},render:function(){this.UI.$input.val(this.state.query);this.UI.$miles.val(this.state.miles)},get:function(){var t=n.user.location.get();return Object.assign({location:t},this.state)},disable:function(n){this.UI.$root.toggleClass("disabled",n);this.UI.$action.prop("disabled",n);this.geolocationInput.disable(n)},flash:function(){var n=$.Deferred(),t;return this.UI.$action.toggleClass(o,!0),t=this,window.setTimeout(function(){t.UI.$action.toggleClass(o,!1);n.resolve()},300),n},isSearching:function(n){this.UI.$icon.toggleClass(u.SEARCH,!n);this.UI.$icon.toggleClass(u.SEARCHING,n);this.UI.$icon.toggleClass(u.SPIN_ANIMATION,n)},search:function(){var n=this;this.isSearching(!0);this.geolocationInput.promise().then(function(){var t=n.get();(t.query==""||t.query==null)&&(t.prevQuery=t.query);n.trigger(i.SEARCH[0],t);n.set({prevQuery:t.query})})},searchMiles:function(){var n=this;this.isSearching(!0);this.geolocationInput.promise().then(function(){var t=n.get();n.trigger(i.SEARCH[1],t)})},clear:function(){this.set({miles:r,query:""})}})}(window.wts,window.wts.modules),function(n,t){function r(n,t){this.initialDealer=t||null;this.truckSearcher=n;this.siteType=n.state.SiteType;this.mode=n.state.Mode;this.dealers=[];this.searchedDealerNumericID=n.state.SearchedDealerNumericID;this.needsList=!0;this.latitude=null;this.longitude=null;this.UI={$dealerSelect:$("select[name='dealer']")};i.bindAll(this);this.addEventListeners();this.initialRender()}var i=t.utilities;t.DealerSearch=r;r.prototype={update:function(n){this.UI.$dealerSelect.val(n).trigger("change",[""])},addEventListeners:function(){var t=this;if(this.UI.$dealerSelect.length>0){this.UI.$dealerSelect.on("change keyup",function(i,r){var e=parseInt(t.UI.$dealerSelect.val())||0,u=t.UI.$dealerSelect.find(":selected").attr("data-id"),o=t.UI.$dealerSelect.find(":selected").attr("data-code"),f=r!==null&&typeof r!="undefined";(typeof u=="undefined"||u==="")&&(u=null);f||n.visor.fire(n.visor.Events.TRUCK_SEARCH_EVENT_CONDITIONAL,{eventName:"Click Value",value:`Dealer Code: ${o}`});t.truckSearcher.setState({SearchedDealerNumericID:e,SearchedDealerID:u},!f)});this.rebindDealerSelectOpening();this.truckSearcher.on("pillter:removed",function(n){var i=n.data||{};i.key==="Dealership"&&t.update(null)});this.truckSearcher.on("facet:cleared",function(){t.update(null)});this.truckSearcher.on("before:update",function(n){var i=n.data.State;t.searchedDealerNumericID=i.SearchedDealerNumericID||0;(t.latitude!==i.Latitude||t.longitude!==i.Longitude)&&(t.needsList=!0)});this.truckSearcher.on("render",function(){t.render()})}},rebindDealerSelectOpening:function(){var n=this;this.UI.$dealerSelect.off("select2-opening").on("select2-opening",function(t){var r,u;if(n.needsList){t.preventDefault();t.stopPropagation();var f=n.UI.$dealerSelect.siblings(".dealer-select"),i=f.find(".select2-chosen"),e=i.text();i.text("Fetching dealers...");i.addClass("loading");r=n.truckSearcher.state;u={SiteType:n.siteType,Mode:n.mode,Latitude:r.Latitude,Longitude:r.Longitude};$.post("/api/GetDealershipFilterDealers",u).always(function(){i.text(e);i.removeClass("loading")}).then(function(t){n.dealers=t.Payload;n.latitude=r.Latitude;n.longitude=r.Longitude;n.needsList=!1;n.render();n.UI.$dealerSelect.off("select2-opening");n.UI.$dealerSelect.select2("open");n.rebindDealerSelectOpening()})}})},initialRender:function(){var n=this.initialDealer,t=null;t=n===null?"<option value='0' selected='selected'>ALL<\/option>":this.createDealerOption(n,"selected='selected'");this.UI.$dealerSelect.length>0&&(this.UI.$dealerSelect.select2({width:"100%",containerCssClass:"wts-select2",dropdownCssClass:"wts-select2-dropdown"}),this.UI.$dealerSelect.append(t));this.update(this.searchedDealerNumericID)},render:function(){var t,i,n,r;if(this.UI.$dealerSelect.find("option").remove(),t=this.searchedDealerNumericID===0?"selected='selected'":"",i="",i+="<option data-id='' value='0' "+t+">ALL<\/option>",this.needsList===!0&&this.searchedDealerNumericID>0&&this.initialDealer!==null)n=this.initialDealer,t=this.searchedDealerNumericID===n.DealerNumericID?"selected='selected' ":" ",i+=this.createDealerOption(n,t);else for(n=null,r=0;r<this.dealers.length;++r)n=this.dealers[r],t=this.searchedDealerNumericID===n.DealerNumericID?"selected='selected' ":" ",i+=this.createDealerOption(n,t);this.UI.$dealerSelect.append(i);this.update(this.searchedDealerNumericID)},createDealerOption:function(n,t){var r="",u=i.encodeHTML(n.Description),f=n.City?" - "+n.City+", "+n.State:"";return r=n.Miles===null||typeof n.Miles=="undefined"?u+f:u+f+" ("+n.Miles+" miles)",`<option data-code="${n.Code}" data-id='${n.ID}' value='${n.DealerNumericID}' ${t} ${n.Disabled}>${r}</option>`}}}(window.wts,window.wts.modules),function(n,t){function i(n,t){this.TruckSearcher=n;this.Vocations=t;this.SearchedVocationDescription=n.state.VocationDescription;this.FacetsCleared=!1;this.UI={$vocationSelect:$("select[name='vocation']")};var i=this;["render"].forEach(function(n){typeof i[n]=="function"&&(i[n]=i[n].bind(i))});this.render();this.rebindEventListeners()}t.VocationSearch=i;i.prototype={update:function(n){this.UI.$vocationSelect.val(n).trigger("change",[""])},rebindEventListeners:function(){var t=this;if(this.UI.$vocationSelect.length>0){this.TruckSearcher.on("pillter:removed",function(n){var i=n.data||{};i.key==="vocation"&&t.update(null)});this.TruckSearcher.on("facet:cleared",function(){var n=(t.UI.$vocationSelect.val()||"")!=="";n&&(t.FacetsCleared=!0,t.update(null))});this.UI.$vocationSelect.on("change keyup",function(){var r=t.UI.$vocationSelect.val()||"",i,u,f,e;if(t.TruckSearcher.localState.isFrozen)return t.TruckSearcher.setState({VocationDescription:r}),$.Deferred().reject();i="";t.FacetsCleared?(u=$(location).attr("pathname").split("/")[1],f=$(location).attr("origin"),i=`${f}/${u}`):i=$(location).attr("href");e=JSON.stringify({CurrentURL:i,NewVocationDescription:r});n.visor.fire(n.visor.Events.VOCATION_SEARCH_CONDITIONAL,{value:r});$.ajax({url:"/ChangeVocations",contentType:"application/json",type:"POST",data:e,success:function(n){window.location.href=n}});t.FacetsCleared=!1})}},render:function(){var r,t,n,i;for(this.UI.$vocationSelect.find("option").remove(),r=this.SearchedVocationDescription===""?"selected='selected'":"",t="",t+="<option value='' "+r+">ALL<\/option>",n="",i=0;i<this.Vocations.length;++i)n=this.Vocations[i],r=this.SearchedVocationDescription===n?"selected='selected' ":" ",t+="<option value='"+n+"' >"+n+"<\/option>";this.UI.$vocationSelect.append(t);this.update(this.SearchedVocationDescription)}}}(window.wts,window.wts.modules),function(n,t){function r(n,t,r){var u=t||null;this.truckSearcher=n;this.isVisible=r;this.dealers=[];this.searchedMemberNumericID=n.state.SearchedMemberNumericID;this.needsList=!0;this.searchedDealerNumericID=n.state.SearchedDealerNumericID;this.UI={$dealerLocationSelect:$("select[name='dealerlocation']"),$dealerLocationContainer:$("div[name='dealerlocation--container']")};i.bindAll(this);this.addEventListeners();this.initialRender(u)}var i=t.utilities;t.DealerLocationSearch=r;r.prototype={update:function(n){this.UI.$dealerLocationSelect.val(n).trigger("change",[""])},addEventListeners:function(){var t=this;if(this.UI.$dealerLocationSelect.length>0){this.UI.$dealerLocationSelect.on("change keyup",function(i,r){var f=parseInt(t.UI.$dealerLocationSelect.val())||0,e=t.UI.$dealerLocationSelect.find(":selected").attr("data-code"),u=r!==null&&typeof r!="undefined";u||n.visor.fire(n.visor.Events.TRUCK_SEARCH_EVENT_CONDITIONAL,{eventName:"Click Value",value:`Dealer Code: ${e}`});t.truckSearcher.setState({SearchedMemberNumericID:f},!u)});this.rebindDealerLocationSelectOpening();this.truckSearcher.on("pillter:removed",function(n){var i=n.data||{};i.key==="DealershipLocation"&&t.update(null)});this.truckSearcher.on("facet:cleared",function(){t.update(null)});this.truckSearcher.on("before:update",function(n){t.searchedMemberNumericID=parseInt(n.data.State.SearchedMemberNumericID)||0;(+t.searchedDealerNumericID!=+n.data.State.SearchedDealerNumericID||t.isVisible!==n.data.ShowComvoyByDealershipLocationFilter)&&(t.needsList=!0);t.isVisible=n.data.ShowComvoyByDealershipLocationFilter});this.truckSearcher.on("render",function(){t.render()})}},rebindDealerLocationSelectOpening:function(){var n=this;this.UI.$dealerLocationSelect.off("select2-opening").on("select2-opening",function(t){var r;if(n.needsList){t.preventDefault();t.stopPropagation();var u=n.UI.$dealerLocationSelect.siblings(".dealer-select"),i=u.find(".select2-chosen"),f=i.text();i.text("Fetching dealers...");i.addClass("loading");r=n.truckSearcher.state;$.post("/api/GetDealershipMemberFilterDealers/"+r.SearchedDealerNumericID).always(function(){i.text(f);i.removeClass("loading")}).then(function(t){n.dealers=t.Payload;n.render();n.searchedDealerNumericID=r.SearchedDealerNumericID||0;n.needsList=!1;n.UI.$dealerLocationSelect.off("select2-opening");n.UI.$dealerLocationSelect.select2("open");n.rebindDealerLocationSelectOpening()})}})},initialRender:function(n){var t=null;t=n===null?"<option value='0' selected='selected'>ALL<\/option>":this.createDealerOption(n,"selected='selected'");this.UI.$dealerLocationSelect.append(t);this.update(this.searchedMemberNumericID)},render:function(){var n,t,i,r;if(this.UI.$dealerLocationSelect.find("option").remove(),this.isVisible)this.UI.$dealerLocationContainer.show();else{this.UI.$dealerLocationContainer.hide();return}for(n=this.searchedMemberNumericID===0?"selected='selected'":"",t="",t+="<option value='0' "+n+">ALL<\/option>",i=null,r=0;r<this.dealers.length;++r)i=this.dealers[r],n=this.searchedMemberNumericID===i.DealerNumericID?"selected='selected' ":" ",t+=this.createDealerOption(i,n);this.UI.$dealerLocationSelect.append(t);this.update(this.searchedMemberNumericID)},createDealerOption:function(n,t){var r=i.encodeHTML(n.Description),u=n.City?" - "+n.City+", "+n.State:"",f=r+u;return`<option data-code="${n.Code}" value='${n.DealerNumericID}' ${t} ${n.Disabled}>${f}</option>`}}}(window.wts,window.wts.modules),function(n,t){"use strict";function i(){this.progress=0;this.UI={$container:$(".ajax-loading"),$progress:$(".ajax-loading .ajax-loading__progress")};this.reset=!1;var n=this;["update","toPercent","render","done"].forEach(function(t){n[t]=n[t].bind(n)});this.options={duration:600}}t.AjaxLoadingBar=i;i.prototype={update:function(n){return this.progress=Math.min(1,Math.max(0,n)),this.render(),this},toPercent:function(){return this.progress*100+"%"},render:function(){return this.UI.$progress.animate({width:this.toPercent()},this.options),this},done:function(n){if(!this.reset){this.reset=!0;var t=this,i=this.UI.$progress;i.css("opacity",1).animate({opacity:0},{duration:200}).promise().then(function(){t.progress=0;i.css({width:"0%",opacity:1});t.reset=!1;typeof n=="function"&&n()})}return this},updateAndExecute:function(n,t){requestAnimationFrame(()=>{this.update(n),setTimeout(()=>{t()},0)})},updateAndExecuteAsync:function(n,t){return new Promise(i=>{requestAnimationFrame(()=>{this.update(n),setTimeout(()=>{t().then(i)},0)})})}}}(window.wts,window.wts.modules),function(n,t){"use strict";function i(n,t){this.truckSearch=t||null;this.getNoResultsForm=$.Deferred();this.photoGallery=new r($("#photo-gallery-modal"));this.UI={$root:n,$noResults:n.find(".no-results"),$alternatNoResultsUI:n.find(".alternate-no-results-ui"),$bodyTypeLinksUI:n.find(".body-type-links-ui"),$noResultsCustomLinkUI:n.find(".no-results-custon-link-ui"),$normalNoResultsContent:n.find(".no-results-content"),scenarios:{$clearBodyTypes:n.find(".truck-search-scenario__WouldHaveFoundAnExactResultWithoutBodyTypeSelected"),$clearBodyTypesAction:n.find(".truck-search-scenario__WouldHaveFoundAnExactResultWithoutBodyTypeSelected a"),$viewBodyType:n.find(".truck-search-scenario__NoResultsWithBodyTypeAndOtherFilters"),$viewBodyTypeList:n.find(".no-results__BodyTypeList"),$expandSearchRadius:n.find(".truck-search-scenario__ExpandSearchRadius"),$expandSearchRadiusMiles:n.find(".truck-search-scenario__ExpandSearchRadius--miles"),$expandSearchRadiusZipCode:n.find(".truck-search-scenario__ExpandSearchRadius--zip-code"),$expandSearchRadiusSeeResults:n.find(".truck-search-scenario__ExpandSearchRadius--see-results"),$noResultTitle:n.find(".no-results__title"),$noResultSubTitle:n.find(".no-results__subtitle")}};this.state={hasNoResultsRegion:this.UI.$noResults.length>0,isViewingNoResults:!1,removeSubmitListener:null};this.ImageRequests=Object.create(null);["update","addEventListeners","rebindEventListeners"].forEach(function(n){this[n]=this[n].bind(this)},this);this.addEventListeners(n)}var r=t.PhotoGallery,u=t.utilities,f=t.getClientData;t.ContactForm;t.FormValidator;t.TruckListings=i;i.prototype={setupNoResultsForm:function(t){var i=this.getNoResultsForm||$.Deferred();return this.getNoResultsForm.state()==="resolved"?i:(n.forms.loadFormDependencies().then(function(r){var u=r.ContactForm,e=r.FormValidator,o=f("#page-context-data").isBuyerMessageRequiredOnNonVehicleLeadForms,s={showValidFeedback:!1,showInvalidFeedback:!0,formControls:Object.assign(n.forms.getCommonValidation(t),{SelectedVehicleModel:{element:t.find("[name=SelectedVehicleModel]").get(0),rules:["required"]},Message:{element:t.find("[name=Message]").get(0),rules:o?["required"]:[]}})},h=new e(s),c=t.find("form"),l=new u(c,n.sender,h);return i.resolve(l)}),i)},update:function(n){var t=n.SearchResultsCount!==0;t?this.truckSearch.trigger("has-results"):this.truckSearch.trigger("no-results");this.state.hasNoResultsRegion&&this.toggleNoResultsRegion(!t,n)},toggleNoResultsRegion:function(t,i){var r=this,u=$.Deferred(),f=this.setupNoResultsForm(this.UI.$noResults).then(function(n){return n.removeEventListeners(),n.unbindUser(),r.state.removeSubmitListener!==null&&r.state.removeSubmitListener(),$.Deferred().resolve(n)});if(t){if(f.then(function(t){var u=n.user.get();t.setupRecaptcha("no-results-recaptcha");t.addEventListeners();t.bindUser(n.user);t.setFormData({Message:i.NoResultsMessage,PhoneToCall:u?u.MobilePhone:null});t.clearValidationMessages();n.modules.LocalDealershipCookieCreator.addEventListeners();r.state.removeSubmitListener=t.onSubmit(function(){var u=t.getFormData(),i,r;n.user.saveToCookie();i=n.sender.toPayload();r=Object.assign({},i,u,{FromNoResults:!0,DealerRequestType:n.modules.MessageSender.DEALER_REQUEST_TYPE.RegularDealerRequest});n.sender.send(r).then(function(){t.setFormData({Message:""})})})}),this.UI.scenarios.$viewBodyType.addClass("hide"),this.UI.$bodyTypeLinksUI.addClass("hide"),this.UI.$noResults.removeClass("hide fade-out-transition"),i.State.Scenarios.WouldHaveFoundAnExactResultWithoutBodyTypeSelected?(this.UI.scenarios.$clearBodyTypes.find(".truck-search__search-text").text(i.State.Search),this.UI.scenarios.$clearBodyTypes.removeClass("hide")):this.UI.scenarios.$clearBodyTypes.addClass("hide"),i.State.Scenarios.ExpandSearchRadius){this.UI.scenarios.$expandSearchRadiusMiles.val(i.State.Miles);this.UI.scenarios.$expandSearchRadiusZipCode.html(i.State.ZipCode);this.UI.scenarios.$expandSearchRadiusSeeResults.off("click").on("click",function(){var n=r.UI.scenarios.$expandSearchRadiusMiles.val();r.truckSearch.setState(Object.assign({Miles:n}),!0)});this.UI.scenarios.$expandSearchRadius.removeClass("hide")}else this.UI.scenarios.$expandSearchRadius.addClass("hide");this.fetchNoResultsContent(i).then(u.resolve)}else this.UI.$noResults.addClass("hide"),this.setupNoResultsForm(this.UI.$noResults).then(function(n){r.state.removeSubmitListener&&(r.state.removeSubmitListener(),r.state.removeSubmitListener=null);n.removeEventListeners();n.unbindUser();u.resolve()});return u},addEventListeners:function(t){var i=this,r=function(t){var r=i.getTruckListing(t),u=r.attr("data-truck-id");return r.length>0&&r[0].nodeName!=="ARTICLE"&&(r=$(`article[data-truck-id='${u}']`)),window.truckSearchInventoryID=u,n.sender.setInventory(u),n.visor.fire(n.visor.Events.OPEN_VEHICLE_INQUIRY_FORM,{inventoryID:u}),i.truckSearch.trigger("vehicle:action",t),r};n.callToAction.on(n.callToAction.DEFAULT_PREPARE_EVENT,function(n){var u=n.data,t=r(u),f=t.attr("data-truck-id");i.actions.interested.call(i,t,f)});if(n.dealerContactAction)n.dealerContactAction.on(n.dealerContactAction.DEFAULT_PREPARE_EVENT,function(n){var t=n.data;r(t)});i.UI.scenarios.$clearBodyTypesAction.off("click").on("click",function(){i.actions.clearBodyTypes.call(i)});t.find("[data-tooltip]").length!==0&&t.foundation("tooltip","reflow");$(".clear-filters").off("click").on("click",function(){i.handleClearFilters()})},rebindEventListeners:function(t){var i=this,r,u,f,e,o;i.ImageRequests={};r=$(".im-interested__action");u=this.UI.$root.find(".im-interested__disclaimer");n.callToAction.rebindUI(r,u);n.dealerContactAction&&(f=$(".dealer-contact__action"),e=this.UI.$root.find(".dealer-contact__disclaimer"),n.dealerContactAction.rebindUI(f,e));o=t.find(".truck-listings .truck-listings__item .truck-actions__view-at-dealership");o.off("click").on("click",function(n){i.truckSearch.trigger("vehicle:navigate",n.currentTarget)});t.find("[data-view-vdp]").off("click").click(function(t){var r=$(t.currentTarget),u=r.closest(".truck").attr("data-truck-id")||null;i.truckSearch.trigger("vehicle:navigate",t.currentTarget);n.visor.fire(n.visor.Events.CLICK_VEHICLE_LISTING_TITLE,u)});t.find("[data-view-details]").off("click").on("click",function(t){var r=$(t.currentTarget).closest(".truck").attr("data-truck-id");i.truckSearch.trigger("vehicle:navigate",t.currentTarget);n.visor.fire(n.visor.Events.CLICK_VEHICLE_LISTING_SEE_DETAILS,r)});t.find(".truck-image").off("click").click(function(t){var r=$(t.currentTarget),u=r.closest(".truck").attr("data-truck-id")||null,f=r.closest(".truck-image").index(),e=f===0;i.truckSearch.trigger("vehicle:navigate",t.currentTarget);n.visor.fire(n.visor.Events.CLICK_VEHICLE_LISTING_PHOTO,{inventoryID:u,isChassisPhoto:e})});t.find(".truck-image__see-more").off("click").click(function(t){t.preventDefault();t.stopPropagation();var r=$(t.currentTarget),u=r.closest(".truck").attr("data-truck-id")||null,f=r.closest(".truck-image").index();i.photoGallery.loadPhotos(u,f).always(function(){i.truckSearch.trigger("vehicle:image",t.currentTarget)});const e=r.parents("article").first().attr("data-truck-id");n.visor.fire(n.visor.Events.SEE_MORE_INTERACTION_CLICK,{truckID:e,type:"cta",pageName:"shop:search-new-inventory",location:"select-vehicle",description:"see-all-photos-<vehicleModel>",inventoryID:u})});t.find("[data-tooltip]").length!==0&&t.foundation("tooltip","reflow");$(".clear-filters").off("click").on("click",function(){i.handleClearFilters()})},count:function(){return this.UI.$root.find(".truck").length},hasTrucks:function(){return this.count()>0},handleClearFilters:function(){var n=this.truckSearch.hasVocationPillter();this.truckSearch.clearFacets(!0);n||this.truckSearch.execute()},fetchNoResultsContent:function(n){var t=this,i=t.truckSearch.settings.customPayload(t.truckSearch.prepareStatePayload()),r=n.State.Scenarios.NoResultsWithBodyTypeAndOtherFilters;return $.post("/api/NoResults/Content",i).then(function(n){var i=n.Payload,y=i.IsVehicleAcquisitionSearchTool,c,h,e,o,u,a,v;if(r){if(i.AlternateNoResultsUI_Enable){if(t.UI.scenarios.$viewBodyType.removeClass("hide"),t.UI.$alternatNoResultsUI.removeClass("hide"),i.AlternateNoResultsUI_ShowCustomLink&&!i.AlternateNoResultsUI_CustomLinkTextExists&&!i.AlternateNoResultsUI_CustomLinkURLExists&&(t.UI.$noResultsCustomLinkUI.removeClass("hide"),c=$.cookie("LastSearchURL"),h=c.split("?"),h.length>1)){for(var l=h[1].split("&"),f=null,s=0,s=0;s<l.length;s++)f=l[s].split("="),f[0]==="dealer"?e=f[0]+"="+f[1]:f[0]==="pro"&&(o=f[0]+"="+f[1]);u=$("a.no-results-custon-link-ui").attr("href");typeof e!="undefined"&&typeof o!="undefined"?(u=u+"/vehicles/?"+e+"&"+o,$("a.no-results-custon-link-ui").attr("href",u)):typeof e!="undefined"?(u=u+"/vehicles/?"+e,$("a.no-results-custon-link-ui").attr("href",u)):typeof o!="undefined"&&(u=u+"/vehicles/?"+o,$("a.no-results-custon-link-ui").attr("href",u))}}else t.UI.$normalNoResultsContent.removeClass("hide");(i.EnableNoResultsBodyTypeLinks&&i.ClearFilterLinks.length>0||i.ClearFilterLinks.length>0&&y)&&(t.UI.scenarios.$viewBodyType.removeClass("hide"),t.UI.$bodyTypeLinksUI.removeClass("hide"));i.ClearFilterLinks.length!=0||i.AlternateNoResultsUI_Enable||(t.UI.scenarios.$viewBodyType.addClass("hide"),t.UI.$bodyTypeLinksUI.addClass("hide"));i.ClearFilterLinks.length===1?(a="<li><a class='no-results-body-type-link truck-pro-button has-icon clear-filters'><i class='fa fa-search'><\/i>New Search<\/a><\/li>",t.UI.scenarios.$viewBodyTypeList.html(a),t.UI.scenarios.$noResultTitle.text("We couldn't find any vehicles that matched your search."),t.UI.scenarios.$noResultSubTitle.addClass("hide"),t.rebindEventListeners(t.UI.$root)):i.ClearFilterLinks.length>1?(v=i.ClearFilterLinks.reduce(function(n,i){return n+("<li><a href='"+i.Link+"' class='no-results-body-type-link truck-pro-button has-icon'><i class='fa fa-search'><\/i>"+`${t.truckSearch.state.IsNationalMarketplace?"View All ":""}`+i.Text+"<\/a><\/li>")},""),t.UI.scenarios.$viewBodyTypeList.html(v)):t.UI.$bodyTypeLinksUI.addClass("hide")}})},getTruckListing:function(n){return $(n).closest(".truck-listings__item")},actions:{clearBodyTypes:function(){this.truckSearch&&(this.truckSearch.clearFacetValues("BodyType"),this.truckSearch.execute())},interested:function(i,r){var e=u.getTruckTitleAndPhoto(i);n.modals.imInterestedModal.once(t.Modal.Events.LOADED,function(){n.callToAction.renderVehicle(e.title,e.image,e.truckID)});var o=$("#imInterestedModal"),f=i.find(".truck-actions__interested"),s=o.find("#call-us-now-footer-wrapper"),h=o.find(".phone-link");typeof f.attr("data-hide-phone")=="undefined"?(s.show(),typeof f.attr("data-phone-tel")!="undefined"&&h.attr("href","tel:"+f.attr("data-phone-tel")).text(f.attr("data-phone-display"))):s.hide();window.wts.logActivity("TruckSearch_TellMeMore",r)}}}}(window.wts,window.wts.modules),function(n,t){function r(n){u.call(this);this.isOpen=!1;this.state={hasChanged:!1};this.UI={$root:n,$modal:n,$toggle:$(".facets-modal__toggle-modal").not(".facets-modal .facets-modal__toggle-modal"),$toggleModal:$(".facets-modal__header .facets-modal__title-button .fa-close"),$header:n.find(".facets-modal__header"),$footer:n.find(".facets-modal__footer"),$content:n.find(".facets-modal__content"),$execute:n.find(".facets-modal__execute"),$executeText:n.find(".facets-modal__execute-text"),$filterColumn:$(".truck-search-filter-column")}}var u=t.EventEmitter;t.FacetsModal=r;var i={OPEN:"facet-modal:open",CLOSE:"facet-modal:close",OPENING:"facet-modal:opening",CLOSING:"facet-modal:closing",SEARCH:"facet-modal:search"},f="facets-modal--open",s="facets-modal--changed",e="no-scroll",o="truck-search-filter-column__facets-modal--open";r.Events=i;r.prototype=Object.assign({},u.prototype,{getRoot:function(){return this.UI.$root},addEventListeners:function(){var n=this;this.UI.$toggle.off("click").click(function(){n.toggle()});this.UI.$toggleModal.off("click").click(function(){n.toggle()});this.UI.$execute.off("click").click(function(){n.search()})},disable:function(n){this.UI.$execute.prop("disabled",n);this.UI.$toggle.prop("disabled",n);this.UI.$toggleModal.prop("disabled",n);this.UI.$content.toggleClass("disabled",this.isOpen?n:!1);this.UI.$executeText.text(n?"Loading...":"See Results")},changed:function(n){this.state.hasChanged=n;this.getRoot().toggleClass(s,n)},toggle:function(n){var t=typeof n=="undefined"?!this.isOpen:n;return t?this.open():this.close()},open:function(){var n=this,t=$.Deferred(),r=n.UI.$modal.parent();t.then(function(){r.off("animationend");n.isOpen=!0;n.trigger(i.OPEN)});this.trigger(i.OPENING);this.UI.$modal.toggleClass(f,!0);this.UI.$filterColumn.toggleClass(o,!0);r.on("animationend",function(i){n.UI.$modal.is(i.target)&&t.resolve()});return $(document.body).toggleClass(e,!0),t},close:function(){var n=this;return this.trigger(i.CLOSING),this.UI.$modal.toggleClass(f,!1),this.UI.$filterColumn.toggleClass(o,!1),$(document.body).toggleClass(e,!1),$.Deferred().resolve().then(function(){n.isOpen=!1;n.trigger(i.CLOSE)})},search:function(){this.trigger(i.SEARCH)}})}(window.wts,window.wts.modules),function(n,t){"use strict";function r(n){this.clear();this.dictionary=n||this.dictionary||Object.create(null);this.set=this.set.bind(this);this.get=this.get.bind(this);this.clear=this.clear.bind(this);this.length=0}function u(n){return function(t){return t===null||typeof t=="undefined"||t+""!==t?null:n.apply(this,arguments)}}function f(n){return JSON.stringify(n,null,0)}function e(n){try{return JSON.parse(n)}catch(t){return null}}t.HistoryDictionary=r;var i=u;r.prototype={set:i(function(n,t){return this.dictionary[n]=f(t),this.length+=1,n}),get:i(function(n){var t=this.dictionary[n];return e(t)}),clear:function(){this.dictionary=Object.create(null);this.length=0}}}(window.wts,window.wts.modules),function(n,t){"use strict";function w(n){$('[data-facet="radio"]').each(function(t){var i=$(t.currentTarget);n!==i.data("value")?i.attr("aria-checked","false").removeClass("checked active"):i.attr("aria-checked","true").removeClass("unchecked").addClass("checked active")})}function e(n,t,r,f){var s=this,e=r.State||null,h,w,b,k;this.settings=Object.assign({},this.options,f||{});o.call(this);this.$root=n;this.UI={root:{$dealerDetail:n.find("[data-root='dealer-detail']"),$bodyManufacturerDetail:n.find("[data-root='body-manufacturer-detail']"),$facets:n.find("[data-root='facets']"),$paginationTop:n.find("[data-root='pagination-top']"),$paginationBottom:n.find("[data-root='pagination-bottom']"),$truckListing:n.find("[data-root='truck-listings']"),$truckSearchScenarios:n.find("[data-root='truck-search-scenarios']"),$pillters:n.find("[data-root='pillters']"),$cvsPanel:n.find(".ezorder-container"),$redirectMessageContainer:n.find(".redirect-message-container"),$breadcrumbs:n.find("[data-root='breadcrumbs']")},carousel:{$root:t,$items:null},script:{$vspStructuredDataSection:$("#vsp-structured-data-section")},collapsibleSections:Object.create(null)};this.FacetKeyMap=r.FacetKeyMap;this.RenderedViewKeyMap=r.RenderedViewKeyMap;this.CarouselFilterMap=r.CarouselFilterMap;t==null||t.length===0||t.hasClass("disabled")||(h=t.data("owl.carousel"),h?(h.options.margin=20,h.refresh()):console.error("Truck Search vocational carousel instance not found. Insure the carousel is initialized."),s.UI.carousel.$items=t.find("a[data-item]"),s.addCarouselListeners());this.busyTimeout=null;this._jqXHR=null;this.isUpdatePending=!1;this.loading=new a;this.truckListings=new v(n,this);this.pagination=new y(e);this.history=new p;this.facetsModal=new u(n.find(".facets-modal"));this.facetRangeComboboxDebouncedSearch=i.debounce(this.interruptableComboboxSearch,2e3);this.facetRangeInputDebouncedSearch=i.debounce(this.interruptableInputSearch,2e3);this.$currentRangeInput=null,function(){var n=s.UI.root;for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&n[t].addClass("ajax-content")}();this.state=Object.create(null);this.localState={isFrozen:this.facetsModal.isOpen,frozenTransition:null};this.truckSearchMetaData=Object.create(null);i.bindAll(this,this,["facetRangeComboboxDebouncedSearch","facetRangeInputDebouncedSearch",]);$.ajaxPrefilter(function(n,t,i){n.url==="/Search2"&&(s._jqXHR=i)});this.addEventListeners();this.settings.useHistoryAPI&&(this.settings.useHistoryAPI=l);this.settings.deferRender||(this.rebindEventListeners(),this.settings.useHistoryAPI&&(w=window.location.href,c.IsNationalMarketplace&&r.BookmarkUrl&&(b=r.BookmarkUrl.split("//"),b[0]=window.location.protocol,w=b.join("//")),r.Rendered=this.getRootNodeHTML(),k=this.history.set(w,r),window.history.replaceState({key:k},$("title").text(),w)));e&&(this.state=e,this.truckSearchMetaData=e.MetaData,this.pagination.update(e.CurrentPage,e.PageSize,e.SortingOption,e.IsSortingOptionInURL,e.TotalResults),this.expandActiveSections(),this.updateAllRangeFilterData(),this.toggleCVSPanel());this.trigger("ready");window.dispatchEvent(new CustomEvent("trucksearch:ready",{detail:this}));r&&r.State&&r.State.TotalResults===0&&this.truckListings.UI.$noResults.is(":visible")&&this.truckListings.update(r);$.cookie("TruckNotFound")&&(s.UI.root.$redirectMessageContainer[0].innerHTML="The listing you were trying to view has sold. Shop for similar listings below:",s.UI.root.$redirectMessageContainer.show(),$.cookie("TruckNotFound","",{expires:-1,path:"/"}));this.scrollData=null}var o=t.EventEmitter,i=t.utilities,l=!!window.history.pushState,a=t.AjaxLoadingBar,v=t.TruckListings,y=t.Pagination,p=t.HistoryDictionary,u=t.FacetsModal,s=t.getClientData,h=s("#page-context-data"),c=s("#site-data"),r,f;t.TruckSearch=e;r={SYMBOLS:i.FORBIDDEN_SYMBOLS,MESSAGE:"The following special characters are not allowed: [ ] { } < > ! \\ ? * ^ ; = ~ |",MAX_LENGTH:100,MAX_LENGTH_MESSAGE:"Search text must not exceed 100 characters"};f=h.stateAbbreviations;e.prototype=Object.assign(e.prototype,{options:{url:"/Search2",customPayload:i.identity,useHistoryAPI:!0,deferRender:!1},debug:function(){console.warn("Debugging mode enabled. Refresh the page to reset.");var t=this,n=decodeURIComponent;return this.on("before:render",function(){var i=t.state.AzureQueryLog[0]||null,r,u;i&&(r=n(n(i)),u=r.split("&").join("\n\t &"),console.groupCollapsed("Log "+t.state.Transitions),console.log("\n\t %c"+n(n(u)),"color: #26a"),console.groupEnd("Log "+t.state.Transitions))})},interruptableComboboxSearch:function(){var n=this.UI.root.$facets.find(".facet-range__dropdown[style='display: block;']");return n.length===0?this.execute():$.Deferred().reject()},interruptableInputSearch:function(){if(this.$currentRangeInput){this.setFacetRangeValue(this.$currentRangeInput);const n=this.checkFacetRangeValue(this.$currentRangeInput);if(n)return this.executeRangeSearchEvent(this.$currentRangeInput),this.$currentRangeInput=null,this.execute()}return $.Deferred().reject()},execute:function(n){if(this.localState.isFrozen)return $.Deferred().reject();var i=this;return this.loading.updateAndExecuteAsync(.25,()=>{this.state.CurrentPage=n?this.pagination.page:1;this.state.PageSize=this.pagination.size;this.state.SortingOption=this.pagination.sortingOption;this.state.IsSortingOptionInURL=this.pagination.isSortingOptionInURL;this.trigger("before:search");this.isUpdatePending=!1;this._jqXHR&&(this._jqXHR.abort(499),this._jqXHR=null,this.trigger("search:cancelled"));var r=this.prepareStatePayload(),u=this.settings.customPayload(r),f=$.post(this.settings.url,u).always(function(){i.trigger("search");i._jqXHR=null;$(".redirect-message-container").length>0&&$(".redirect-message-container")[0].offsetParent!==null&&i.UI.root.$redirectMessageContainer.hide();t.AscTracking.resetItems()}).then(function(n){return i._jqXHR=null,i.loading.update(.8),n.event=null,i.update(n,!1)}).fail(function(n){n&&(n.statusText==="499"||n.statusText==="abort")||(i.loading.update(0).done(),n&&n.responseText&&toastr.error(n.responseText),i.trigger("search:failed"))});return this.trigger("searching"),f})},search:function(n,t){n=n||"";t=t||null;var i=n.length>0,u=i&&n.match(r.SYMBOLS)!==null;return u?(window.toastr.error(r.MESSAGE),this.trigger("search:invalid"),$.Deferred().reject()):n.length>r.MAX_LENGTH?(window.toastr.error(r.MAX_LENGTH_MESSAGE),this.trigger("search:invalid"),$.Deferred().reject()):(this.state.Search!==null&&this.state.Search.length>0&&this.updateActiveFilters("Search",this.state.Search,!1),t!==null&&this.setMiles(t),this.setSearch(n,i),i&&this.updateActiveFilters("Search",n,!0),this.setAllCarouselItemActiveState(),this.state.IsVinSearch?this.executeVinSearchEvent(this.state.Search):this.executeConditionalSearchEvent("Text Search",this.state.Search,"tool","filter-search-box","search-submit"),this.execute())},prepareStatePayload:function(){var n,t,i;this.state.AzureQueryLog=[];this.state.MetaData=Object.create(null);this.state&&this.state.URLRoute&&(this.state.URLRoute.URLRoutingFAQs=null);n=JSON.stringify(this.state,null,0);for(t in this.FacetKeyMap)Object.prototype.hasOwnProperty.call(this.FacetKeyMap,t)&&(i=RegExp('\\"'+t+'\\":',"g"),n=n.replace(i,'"'+this.FacetKeyMap[t]+'":'));return{State:n.toString()}},executeVinSearchEvent:function(t){t&&(window.trackSearchEvent("VIN Search",t),n.visor.fire(n.visor.Events.TRUCK_SEARCH_EVENT_VIN,{vin:t,type:"tool",location:"filter-search-box",description:"search-submit"}))},executeConditionalSearchEvent:function(t,i,r,u,f){t&&i&&n.visor.fire(n.visor.Events.TRUCK_SEARCH_EVENT_CONDITIONAL,{eventName:t,value:i,type:r,location:u,description:f})},addEventListeners:function(){var t=this;this.on("no-results",function(){n.visor.fire(n.visor.Events.TRUCK_SEARCH_EVENT_NO_RESULTS,{noResultsEventLabel:window.location})});this.on("state:changed",function(){t.facetsModal.changed(!0)});this.on("render",function(){t.facetsModal.changed(!0)});this.on("update",function(){t.facetsModal.changed(!1)});this.on("facet:cleared",function(){if(t.facetsModal.isOpen){t.facetsModal.disable(!0);t.once("rebind",function(){t.facetsModal.disable(!1)});t.execute()}});this.facetsModal.on(u.Events.OPENING,function(){t.facetsModal.changed(!1)});this.facetsModal.on(u.Events.SEARCH,function(){t.facetsModal.close();window.scrollTo(0,0)});this.on("before:search",function(){t.facetsModal.disable(!0)});this.on("rebind",function(){t.facetsModal.disable(!1)});if(this.settings.useHistoryAPI)$(window).on("popstate",function(n){var i=n.originalEvent.state||{},r=i.key||null;window.location.href.indexOf("#")>-1||t.revertState(r)});this.toggleClearFacetsButton();this.facetsModal.addEventListeners()},updateRangeFilterData:function(n,t){if(n!=="FinalPrice"){let r=this.state.RangeFilters[n].RangeStart||null,u=this.state.RangeFilters[n].RangeEnd||null;r=r===null?1:+r;u=u===null?Number.MAX_VALUE:+u;let f="",e="";const i=['<li><a href="javascript:void(0);" class="range-option">','<li><a href="javascript:void(0);" class="range-option selected">',"<\/a><\/li>",];this.state.Facets[n].Children.forEach(function(n){var t=+n.Value,o="";t<=u&&(o=t===r?i[1]:i[0],f+=o+t+i[2]);t>=r&&(o=t===u?i[1]:i[0],e+=o+t+i[2])});const o=t.find(".facet-range__dropdown[name='min'] ul");o.empty();o.append(f);const s=t.find(".facet-range__dropdown[name='max'] ul");s.empty();s.append(e)}},addCarouselListeners:function(){var n=this;this.UI.carousel.$items.off("click").on("click",function(t){var u=$(t.currentTarget),e=u.find(".item"),r=u.data("item"),f=n.CarouselFilterMap.Filters[r],i=n.isCarouselItemActive(r);Object.keys(f).forEach(function(t){var r=f[t],u;t==="Search"?(u=r[0],n.setSearch(i?"":u),n.updateActiveFilters(t,u,!i)):n.checkIsRangeFilter(t)?(r.forEach(function(r){var u=r.split(":"),f=u[0],e=i?null:u[1];n.updateStateRangeFilters(t,f,e);n.updateActiveRangeFilters(t)}),n.updateAllRangeFilterData()):r.forEach(function(r){var u=n.updateFacet(t,r,!i);u!==null&&(u.IsActive&&n.executeConditionalSearchEvent("Click "+t,u.Text,"filter","main-filter-carousel",u.Text.replace(/\s+/g,"-").toLowerCase()),n.updateActiveFilters(t,r,u.IsActive))})});n.setAllCarouselItemActiveState();n.syncCarouselDisplay(r,e.hasClass("selected"));n.execute()})},syncCarouselDisplay:function(n,t){var i=this.UI.carousel.$root.find("[data-item='"+n+"']");i.find(".item").toggleClass("selected",t)},updateFacet:function(n,t,i){var e=this,o=""+n,f=""+t,s=typeof i!="undefined"&&i!==null,r=null,u;return this.state.Facets[o].Children.forEach(function(n){if(n.Key==="Condition"){n.IsActive=!1;n.Value===f&&(n.IsActive=!0);n.IsActive&&(r=n);return}n.Value===f&&(r=n,n.IsActive=s?i:!n.IsActive)}),this.renderFacet(r),u=Object.keys(this.state.Facets).map(function(n){return e.state.Facets[n]}).find(function(n){return(n.Children[0]||{}).IsStatic}),u&&u.Children.forEach(function(n){n.IsStatic=!1}),r&&this.state.Facets[n].Children.forEach(function(n){n.IsStatic=!0}),this.trigger("facet:changed",r),this.setState({Facets:this.state.Facets}),r},renderFacet:function(n){if(n){var t=this.findFacet(n.Key,n.Value);t!==null&&(n.IsActive?(t.hasClass("unchecked")&&t.removeClass("unchecked"),t.hasClass("checked")||t.addClass("checked active").attr("aria-checked","true")):t.removeClass("checked active").attr("aria-checked","false").addClass("unchecked"))}},getRemovablePillters:function(){return this.UI.root.$pillters.find(".pillter--removable")},executeRangeSearch:function(n){this.executeRangeSearchEvent(n);this.facetRangeComboboxDebouncedSearch()},executeRangeSearchEvent:function(t){var u=t.parents(".facet-range").data("key"),f=t.parents(".facet-range").data("gaKey");const i=[this.state.RangeFilters[u].RangeStart,this.state.RangeFilters[u].RangeEnd,];let r="";i[0]!==null&&(r+=`${f} Min: ${i[0]}`);i[1]!==null&&(r+=`${r.length>0?" ":""}${f} Max: ${i[1]}`);n.visor.fire(n.visor.Events.TRUCK_SEARCH_EVENT_CONDITIONAL,{eventName:"Click Value",value:r})},updateAllRangeFilterData:function(){var n=this;this.UI.root.$facets.find(".facet-range").each(function(t,i){var r=$(i),u=r.data("key");n.updateRangeFilterData(u,r)})},updateDealerInfoAndManufacturerHeaders:function(n){if(c.IsNationalMarketplace){const t=$('.comvoy-inline-headers [data-root="dealer-detail--inline"]'),i=$('.comvoy-inline-headers [data-root="body-manufacturer-detail"]'),u=$(".comvoy-inline-headers"),r=new URLSearchParams(window.location.search).has("pro")&&$(".comvoy-header-container--top").is(":visible");r?$(".search-v2-content").addClass("has-pro-header"):$(".search-v2-content").removeClass("has-pro-header");const f=n.Rendered.DealerHeaderHTML&&n.Rendered.ManufacturerHeaderHTML&&r===!1;f?u.addClass("comvoy-inline-headers--multiple"):u.removeClass("comvoy-inline-headers--multiple");n.Rendered.DealerHeaderHTML&&t.length>0&&r===!1?t.each(function(){$(this).css("display","");$(this).html(n.Rendered.DealerHeaderHTML);$(this).removeClass("comvoy-header-container--no-content")}):t.each(function(){$(this).css("display","");$(this).html(null);$(this).addClass("comvoy-header-container--no-content")});n.Rendered.ManufacturerHeaderHTML&&i.length>0?i.each(function(){$(this).css("display","");$(this).html(n.Rendered.ManufacturerHeaderHTML);$(this).removeClass("comvoy-header-container--no-content")}):i.each(function(){$(this).css("display","");$(this).html(null);$(this).addClass("comvoy-header-container--no-content")})}},rebindRangeFacetEventListeners:function(){var n=this,t=this.UI.root.$facets,i=t.find(".facet-range__control.combobox"),u=i.find(".facet-range__input"),f=t.find(".facet-range__control:not(.combobox) .facet-range__input"),e=t.find(".facet-range__slider"),r;i.off("mousedown").on("mousedown",function(t){var f=$(t.currentTarget),e,o;t.preventDefault();t.stopPropagation();var i=f.find(".facet-range__input"),u=$(t.target),r=null;u.hasClass("range-option")?(r=u.text(),i.val(r),e=n.setFacetRangeValue(i),n.hideFacetRangeDropdown(i),e&&n.executeRangeSearch(i)):u.hasClass("facet-range__dropdown")||(o=f.find(".facet-range__dropdown"),o.toggle(),r=i.val(),i.val("").val(r));i.focus()});f.off("keypress").on("keypress",function(t){const i=$(t.currentTarget);if(n.$currentRangeInput=i,n.$currentRangeInput.parents(".facet-range").data().gaKey=="Price")return t.charCode>=48&&t.charCode<=57;if(n.facetRangeInputDebouncedSearch(),t.key==="Enter"){const t=n.setFacetRangeValue(i),r=n.checkFacetRangeValue(i);r?t&&n.facetRangeInputDebouncedSearch():n.facetRangeInputDebouncedSearch.cancel()}}).off("blur").on("blur",function(t){const i=$(t.currentTarget),r=n.setFacetRangeValue(i),u=n.checkFacetRangeValue(i);u?r&&n.facetRangeInputDebouncedSearch():n.facetRangeInputDebouncedSearch.cancel()}).off("focus").on("focus",function(t){const i=$(t.currentTarget);n.$currentRangeInput=i;n.$currentRangeInput.parents(".facet-range").data().gaKey=="DaysOnLot"&&n.clearFacetValues("TruckProOnly");n.facetRangeInputDebouncedSearch.cancel()}).on("keydown",function(t){const i=$(t.currentTarget);if(t.key==="Escape"){const t=i.parents(".facet-range").data("key"),r=i.data("filter"),u=n.state.RangeFilters[t][r];i.val(u);n.facetRangeInputDebouncedSearch.cancel()}});u.off("keyup keydown").on("keyup",function(t){var i=$(t.currentTarget),r,h,c,f,u,e,o;n.facetRangeComboboxDebouncedSearch();r=null;switch(t.key){case"Enter":n.setFacetRangeValue(i);n.hideFacetRangeDropdown(i);n.executeRangeSearch(i);break;case"Escape":h=i.parents(".facet-range").data("key");c=i.data("filter");r=n.state.RangeFilters[h][c];i.val(r);n.hideFacetRangeDropdown(i);break;case"ArrowUp":case"ArrowDown":if(f=i.siblings(".facet-range__dropdown"),u=f.find("a.selected"),f.css("display")==="none"&&(u.length>0&&u.addClass("selected-current"),f.show()),e=f.find("a"),e.length===0)return;if(u.length===0)o=$(e[0]),o.addClass("selected"),r=o.text(),i.val(r);else{var l=u.parent(),a=t.keyCode===38?l.prev():l.next(),s=a.find("a");s.length>0&&(s.addClass("selected"),u.removeClass("selected"),r=s.text(),i.val(r))}}}).on("keydown",function(t){var i=$(t.currentTarget),r;t.key==="Tab"&&(r=n.setFacetRangeValue(i),n.hideFacetRangeDropdown(i),r&&n.executeRangeSearch(i))}).off("blur").on("blur",function(t){var i=$(t.currentTarget),r=n.setFacetRangeValue(i);n.hideFacetRangeDropdown(i);r&&n.executeRangeSearch(i)});r=i.find(".facet-range__dropdown");r.on("mouseover",function(n){var i=$(n.currentTarget),t=i.find(".selected");t.removeClass("selected");t.addClass("selected-current")});e.each(function(){var t=$(this).ionRangeSlider({onFinish:function(t){var i=$(t.input),r=i.parent(".facet-range--slider"),u=r.find(".facet-range__input--min"),f=r.find(".facet-range__input--max"),s=i.data("from"),h=i.data("to"),e,o;u.val(s);f.val(h);e=n.setFacetRangeValue(u);o=n.setFacetRangeValue(f);(e||o)&&n.executeRangeSearch(i)}})})},rebindEventListeners:function(){var t=this,i=this.UI.root.$facets,r;i.find(".facet").off("click").on("click",function(r){var o=$(r.currentTarget),a;if(!o.hasClass("facet--link")&&!o.hasClass("facet--vast-inventory")){r.preventDefault();var c=o.data(),e=c.key,v=c.gaKey,u=c.value,s=v+": "+u,l=o.hasClass("checked"),y=l?"checked":"";e==="Condition"?s=u==="New"?"New":u==="Used"?"Used":"New and Used":e==="State"?(a=Object.keys(f).find(n=>f[n]===u),s=e+": "+a):e==="ListingCategoryDesc"?s=`${u} Inventory`:e==="MyPoolUnits"&&u==="ShowOnlyPoolAssignedUnits"?s="MyPoolUnits: Assigned Vehicles":e==="MyPoolUnits"&&u==="ShowOnlyDealerReservedUnits"&&(s="MyPoolUnits: Requested Orders");t.loading.updateAndExecute(.15,()=>{if(h.isVast&&!l?n.visor.fire(n.visor.Events.CLICK_TRUCK_SEARCH_FACETS_VAST,{keyValue:s}):window.trackConditionalSearchEvent("Click Value",s,y),c.key==="Condition")i.find('.facet[data-key="Condition"]').removeClass("checked active"),w(u),t.updateFacet(e,u);else{var r=t.updateFacet(e,u);t.scrollData=r.IsActive?{key:e,value:u}:null;t.updateCarousel(e,u,r.IsActive)}o.is(".my-inventory-checkbox")?o.hasClass("checked")&&t.clearFacetValues("TruckProOnly"):o.is(".shared-inventory-checkbox")&&o.hasClass("checked")&&t.clearFacetValues("TruckProOnlyShareable");t.execute()})}});this.rebindRangeFacetEventListeners();r=i.find(".collapsible .collapsible__title");r.off("click").on("click",function(i){var o=$(i.currentTarget),s=o.siblings(".collapsible__content"),h=o.closest(".collapsible"),r;s.slideToggle(120,function(){h.toggleClass("collapsed")});r=o.data("collapsible-key");t.state.Facets[r]?t.state.Facets[r].Collapsed=!t.state.Facets[r].Collapsed:t.UI.collapsibleSections[r]=!t.UI.collapsibleSections[r];var u="func",f="filter-bar",e=$(i.currentTarget).html().toLowerCase();r=="section__chassis"?t.UI.collapsibleSections[r]?n.visor.fire(n.visor.Events.VSP_FACETGROUP_CHASSIS_CLOSE_EVENT,{label:"Close Chassis Options",type:u,location:f,description:`${e}-close`,currentTarget:i.currentTarget}):n.visor.fire(n.visor.Events.VSP_FACETGROUP_CHASSIS_OPEN_EVENT,{label:"Open Chassis Options",type:u,location:f,description:`${e}-open`,currentTarget:i.currentTarget}):r=="State"?t.state.Facets[r].Collapsed?n.visor.fire(n.visor.Events.VSP_FACETGROUP_STATE_CLOSE_EVENT,{label:"Close State Options",type:u,location:f,description:`${e}-close`,currentTarget:i.currentTarget}):n.visor.fire(n.visor.Events.VSP_FACETGROUP_STATE_OPEN_EVENT,{label:"Open State Options",type:u,location:f,description:`${e}-open`,currentTarget:i.currentTarget}):r=="ListingCategoryDesc"?t.state.Facets[r].Collapsed?n.visor.fire(n.visor.Events.VSP_FACETGROUP_STATE_CLOSE_EVENT,{label:"Close Inventory Type Options",type:u,location:f,description:`${e}-close`,currentTarget:i.currentTarget}):n.visor.fire(n.visor.Events.VSP_FACETGROUP_STATE_OPEN_EVENT,{label:"Open Inventory Type Options",type:u,location:f,description:`${e}-open`,currentTarget:i.currentTarget}):r=="section__body"?t.UI.collapsibleSections[r]?n.visor.fire(n.visor.Events.VSP_FACETGROUP_BODY_CLOSE_EVENT,{label:"Close Body Options",type:u,location:f,description:`${e}-close`,currentTarget:i.currentTarget}):n.visor.fire(n.visor.Events.VSP_FACETGROUP_BODY_OPEN_EVENT,{label:"Open Body Options",type:u,location:f,description:`${e}-open`,currentTarget:i.currentTarget}):r=="section__partner-options"?t.UI.collapsibleSections[r]?n.visor.fire(n.visor.Events.VAST_VSP_FACETGROUP_PARTNER_CLOSE_EVENT,{label:"Close Partner Options"}):n.visor.fire(n.visor.Events.VAST_VSP_FACETGROUP_PARTNER_OPEN_EVENT,{label:"Open Partner Options"}):r=="section__trailer"?t.UI.collapsibleSections[r]?n.visor.fire(n.visor.Events.VSP_FACETGROUP_TRAILER_CLOSE_EVENT,{label:"Close Trailer Options"}):n.visor.fire(n.visor.Events.VSP_FACETGROUP_TRAILER_OPEN_EVENT,{label:"Open Trailer Options"}):r=="AddOns"?t.state.Facets[r].Collapsed?n.visor.fire(n.visor.Events.VSP_FACETGROUP_ADDONS_CLOSE_EVENT,{label:"Close AddOns Options",type:u,location:f,description:`${e}-close`,currentTarget:i.currentTarget}):n.visor.fire(n.visor.Events.VSP_FACETGROUP_ADDONS_OPEN_EVENT,{label:"Open AddOns Options",type:u,location:f,description:`${e}-open`,currentTarget:i.currentTarget}):r=="Price"?t.state.Facets[r].Collapsed?n.visor.fire(n.visor.Events.VSP_FACETGROUP_PRICE_CLOSE_EVENT,{label:"Close Price Options",type:u,location:f,description:`${e}-close`,currentTarget:i.currentTarget}):n.visor.fire(n.visor.Events.VSP_FACETGROUP_PRICE_OPEN_EVENT,{label:"Open Price Options",type:u,location:f,description:`${e}-open`,currentTarget:i.currentTarget}):r=="section__progressive-base"?t.UI.collapsibleSections[r]?n.visor.fire(n.visor.Events.VSP_FACETGROUP_PROGRESSIVE_CLOSE_EVENT,{label:"Close Progressive Options",type:u,location:f,description:`${e}-close`,currentTarget:i.currentTarget}):n.visor.fire(n.visor.Events.VSP_FACETGROUP_PROGRESSIVE_OPEN_EVENT,{label:"Open Progressive Options",type:u,location:f,description:`${e}-open`,currentTarget:i.currentTarget}):(r!=undefined||r!="")&&(t.state.Facets[r].Collapsed?n.visor.fire(n.visor.Events.VSP_FACET_CLOSE_EVENT,{label:`Close ${r} Options`,type:u,location:f,description:`${e}-close`,currentTarget:i.currentTarget}):n.visor.fire(n.visor.Events.VSP_FACET_OPEN_EVENT,{label:`Open ${r} Options`,type:u,location:f,description:`${e}-open`,currentTarget:i.currentTarget}))});t.getRemovablePillters().off("click").on("click",function(n){var r=$(n.currentTarget),i=r.data(),u,f;if(t.isUpdatePending=!0,u=t.checkIsRangeFilter(i.key),i.key==="searched-text")t.clearSearchText(i.text),t.trigger("pillter:removed",i);else if(i.key==="Dealership"||i.key==="DealershipLocation")t.trigger("pillter:removed",i);else if(i.key==="VINSearch")t.setState({IsVinSearch:!1,Search:""});else if(i.key==="Locations")t.setState({ShowOnlyOnlotInventory:!1}),t.setState({ShowOnlyInTransitInventory:!1}),t.setState({ShowOnlyBeingBuiltInventory:!1});else if(i.key==="Condition")f=t.helper.getTruckSearchNewUsedDefault(t.state),t.updateFacet("Condition",f),t.trigger("pillter:removed",i);else if(u)t.clearRangeFilter(i.key,i.value),t.updateActiveRangeFilters(i.key),t.setAllCarouselItemActiveState();else{if(i.key==="vocation"){t.triggerVocationClear();r.remove();return}var e=i.key,o=i.value,s=t.updateFacet(e,o);t.updateCarousel(e,o,s.IsActive)}t.helper.fireAdobeEvent(i.value,n.currentTarget);r.remove();t.execute()});$(".clear-filters").off("click").on("click",function(){var n=t.hasVocationPillter();t.clearFacets(!0);n&&t.execute()});$(".exit-debug-mode").off("click").on("click",function(){window.location.search=""});i.find("[data-tooltip]").length!==0&&($(document).find("[role='tooltip']").hide(),i.foundation("tooltip","reflow"));t.pagination.rebindEventListeners(t.UI.root.$paginationTop,t);t.pagination.rebindEventListeners(t.UI.root.$paginationBottom,t);t.truckListings.rebindEventListeners(t.UI.root.$truckListing,t)},update:function(n,t){var r,i;if(this.isFresh(n))this.$root.removeClass("loading-content").find(".main-content__support-link").removeClass("active"),this.busyTimeout!==null&&(window.clearTimeout(this.busyTimeout),this.busyTimeout=null);else return this.trigger("fast-forward"),r=this.state.Transitions-n.State.Transitions,r>1&&(i=this,this.$root.addClass("loading-content"),this.busyTimeout===null&&(this.busyTimeout=window.setTimeout(function(){i.$root.find(".main-content__support-link").addClass("active");i.busyTimeout=null},17))),$.Deferred().reject();return this.trigger("before:update",n),this.updateState(n,t),this.trigger("before:render"),this.render(n),this.updateFacetScrollableView(),this.trigger("render"),this.loading.update(1).done(),this.truckListings.update(n),this.updateAllRangeFilterData(),this.updateDealerInfoAndManufacturerHeaders(n),this.updateBreadcrumbsLdJson(),this.rebindEventListeners(),this.trigger("rebind"),$.Deferred().resolve(n)},isFresh:function(n){return n.State.Transitions-1===this.state.Transitions},freeze:function(n){this.localState.isFrozen=n;var t=!1;return n?this.localState.frozenTransition=this.state.Transitions:(t=this.localState.frozenTransition!==this.state.Transitions,this.localState.frozenTransition=null),t},setState:function(n,t){var r=[],u={},i,f;for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r.push(i),u[i]=this.state[i],this.state[i]=n[i]);this.state.Transitions+=1;f={state:this.state,previous:u,keys:r};this.trigger("state:changed",f);!this.isUpdatePending&&t&&this.execute()},updateState:function(n,t){var i=this.state=n.State,r,u,f;this.pagination.update(i.CurrentPage,i.PageSize,i.SortingOption,i.IsSortingOptionInURL,i.TotalResults);this.trigger("update",i);this.updateCanonicalURL(n);this.settings.useHistoryAPI&&(t?this.updateCarouselForPopState():(r=n.BookmarkUrl.split("//"),r[0]=window.location.protocol,u=r.join("//"),f=this.history.set(u,n),window.history.pushState({key:f},n.PageTitle,u)))},updateCanonicalURL:function(n){var r=$("link[rel='canonical']").attr("href",n.CanonicalUrl),t=$("link[rel='prev']"),i=$("link[rel='next']");n.PrevRelLink?t.length?t.attr("href",n.PrevRelLink):r.after($("<link>",{rel:"prev",href:n.PrevRelLink})):t.remove();n.NextRelLink?i.length?i.attr("href",n.NextRelLink):r.after($("<link>",{rel:"next",href:n.NextRelLink})):i.remove()},revertState:function(n){if(n===null){this.$root.addClass("loading-content");window.location.reload();return}var t=this.history.get(n);if(!t){this.$root.addClass("loading-content");window.location.reload();return}t.State.Transitions=this.state.Transitions+1;this.update(t,!0)},updateStateRangeFilters:function(n,t,r){var f=null,u,e;return!i.isNullOrUndefined(r)&&r.length>0&&(f=+r),u=this.state.RangeFilters,e=u[n][t]!==f,e&&(u[n][t]=f,n!=="FinalPrice"&&this.state.Facets[n].Children.forEach(function(n){n.IsStatic=!0}),this.setState({RangeFilters:u})),e},updateActiveFilters:function(n,t,i){if(!this.helper.isCarouselFilterMapUndefinedOrNull(this.CarouselFilterMap)){var u=this,r=""+t;Object.keys(this.CarouselFilterMap.Filters).forEach(function(t){var s=u.CarouselFilterMap.Filters[t],h=u.CarouselFilterMap.ActiveFilters[t],o=s[n]||null,f,e;o!==null&&o.indexOf(r)>-1&&(f=h[n],e=f.indexOf(r),i?e<0&&f.push(r):e>-1&&f.splice(e,1))})}},updateActiveRangeFilters:function(n){if(!this.helper.isCarouselFilterMapUndefinedOrNull(this.CarouselFilterMap)){var r=this,t=this.state.RangeFilters[n].RangeStart,i=this.state.RangeFilters[n].RangeEnd;Object.keys(this.CarouselFilterMap.Filters).forEach(function(u){var h=r.CarouselFilterMap.Filters[u],c=r.CarouselFilterMap.ActiveFilters[u],f=0,e=0,s=h[n]||null,o;s!==null&&(s.forEach(function(n){var t=n.split(":"),r=t[0],i=+t[1];r==="RangeStart"?f=i:e=i}),o=[],f>0&&e>0?(f<=t&&t<=e&&o.push("RangeStart:"+f),f<=i&&i<=e&&o.push("RangeEnd:"+e)):f>0&&e===0?f<=t&&o.push("RangeStart:"+f):f===0&&e>0&&e<=i&&o.push("RangeEnd:"+e),c[n]=o)})}},setFacetRangeValue:function(n){var i=n.parents(".facet-range"),t=i.data("key"),u=n.data("filter"),r=this.updateStateRangeFilters(t,u,n.val());return r&&(this.updateRangeFilterData(t,i),this.updateActiveRangeFilters(t),this.setAllCarouselItemActiveState()),r},checkFacetRangeValue:function(n){const e=n.parents(".facet-range"),i=e.data("key"),s=e.find(".facet-range__input").map(function(){return $(this).attr("data-filter")});let t=!0,f=!1;const r=this.state.RangeFilters[i][s[0]],u=this.state.RangeFilters[i][s[1]];let o=!1;if(r!==null&&u!==null&&(t=r<=u,f=r<0||u<0),e.toggleClass("invalid",!t||f),i==="FinalPrice"||i==="DaysOnLot"){(r!==null||u!==null)&&t&&(t=r%1==0&&u%1==0,o=!t,f=r<0||u<0);const n=i==="FinalPrice"?"price":"days-on-lot";this.UI.root.$facets.find(`.${n}-facet--invalid-negative`).toggle(f);o?(this.UI.root.$facets.find(`.${n}-facet--invalid-number`).toggle(!t),this.UI.root.$facets.find(`.${n}-facet--invalid-range`).toggle(t)):(this.UI.root.$facets.find(`.${n}-facet--invalid-range`).toggle(!t),this.UI.root.$facets.find(`.${n}-facet--invalid-number`).toggle(o))}else i==="Mileage"&&this.UI.root.$facets.find(".mileage-facet--invalid").toggle(!t);return t&&!f},hideFacetRangeDropdown:function(n){var t=n.siblings(".facet-range__dropdown");t.hide();var r=n.parents(".facet-range"),u=r.data("key"),f=n.data("filter"),e=+this.state.RangeFilters[u][f],i=t.find("li a");i.removeClass("selected");i.each(function(n,t){var i=$(t),r=+i.text();r===e&&i.addClass("selected")})},render:function(t){var r=this.maxifyRenderedView(t.Rendered.DealerDetailHeaderView),u=this.maxifyRenderedView(t.Rendered.BodyManufacturerHeaderView),i,f,e;this.UI.root.$bodyManufacturerDetail.html(u).toggle(u!==null);this.UI.root.$dealerDetail.html(r).toggle(r!==null);this.UI.root.$pillters.html(this.maxifyRenderedView(t.Rendered.PilltersView));this.UI.root.$truckListing.html(this.maxifyRenderedView(t.Rendered.InventoryListView));this.UI.root.$truckSearchScenarios.html(this.maxifyRenderedView(t.Rendered.TruckSearchScenariosView));this.UI.root.$paginationTop.html(this.maxifyRenderedView(t.Rendered.PaginationTopView));this.UI.root.$paginationBottom.html(this.maxifyRenderedView(t.Rendered.PaginationBottomView));this.UI.root.$facets.html(this.maxifyRenderedView(t.Rendered.SearchFacetsView));this.UI.script.$vspStructuredDataSection.html(this.maxifyRenderedView(t.Rendered.VSPStructuredDataView));this.UI.root.$breadcrumbs.html(this.maxifyRenderedView(t.Rendered.BreadcrumbsHTML));this.toggleCVSPanel();this.toggleClearFacetsButton();for(i in this.UI.collapsibleSections)this.UI.collapsibleSections[i]&&this.UI.root.$facets.find("[data-collapsible-key='"+i+"']").closest(".collapsible").addClass("collapsed");$("title").html(t.PageTitle);$('meta[property="og:title"]').attr("content",t.PageTitle);$('meta[name="description"]').attr("content",t.PageDescription);$('meta[property="og:description"]').attr("content",t.PageDescription);this.updateCanonicalURL(t);f=t.State.TotalResults?" ("+t.State.TotalResults+")":"";$(".facets-modal__execute-results-count").html(f);e=t.State.ActiveFiltersCount?" ("+t.State.ActiveFiltersCount+")":"";$(".facets-modal__applied-filters").html(e);window.analyticsLabels=t.AnalyticsLabels;window.analyticsDimensions=t.AnalyticsDimensions;this.logSearchedPageView();n.visor.fire(n.visor.Events.VSP_SEARCH_COMPLETE,{viewModel:t})},logSearchedPageView:function(){var n,t,i,r;if(typeof _gaPropertyList!="undefined")for(n=0;n<window._gaPropertyList.length;n++)t=window.location.pathname+window.location.search,window.gtag!=="undefined"?(i=window._gaPropertyList[n],i.startsWith("UA")&&gtag("event","page_view",{page_title:$("title").html(),page_path:t,send_to:i})):window.ga!=="undefined"&&(r="wts"+n.toString(),window.ga(r+".set",{page:t,title:$("title").html()}),window.ga(r+".send","pageview"))},maxifyRenderedView:function(n){var t,i,r;if(n===null||typeof n=="undefined")return null;t=n;for(i in this.RenderedViewKeyMap)Object.prototype.hasOwnProperty.call(this.RenderedViewKeyMap,i)&&(r=RegExp(this.RenderedViewKeyMap[i],"g"),t=t.replace(r,i));return t},toggleCVSPanel:function(){var n=this.state.CurrentPage*this.state.PageSize>=this.state.TotalResults;this.UI.root.$cvsPanel.toggle(n)},toggleClearFacetsButton:function(){var n=this.$root.find(".facet-filters__clear"),t=this.getRemovablePillters().length>0;n.toggleClass("active",t)},hasVocationPillter:function(){return this.UI.root.$pillters.find(".pillter--removable[data-key='vocation']").length>0},triggerVocationClear:function(){this.trigger("pillter:removed",{key:"vocation"})},clearFacets:function(t){var i=this,r,u,f;this.UI.carousel.$items!==null&&(r=this.CarouselFilterMap.ActiveFilters,this.UI.carousel.$items.find(".selected").removeClass("selected"),Object.keys(r).forEach(function(n){var t=r[n];Object.keys(t).forEach(function(n){t[n]=[]},this)},this));u=this.$root.find(".facet-filters__clear");u.removeClass("active");i.UI.root.$facets.find(".checked").removeClass("checked active").attr("aria-checked","false").addClass("unchecked");$(".clear-filters--pillter-control").remove();i.getRemovablePillters().remove();i.truckListings.UI.$noResults.addClass("fade-out-transition");for(f in this.state.Facets)Object.prototype.hasOwnProperty.call(this.state.Facets,f)&&this.clearFacetValues(f);this.clearSearchText();this.clearRangeFilters();t&&n.visor.fire(n.visor.Events.TRUCK_SEARCH_CLEAR_FILTERS,{type:"tool",location:"filter-bar",description:"clear-search-filters",currentTarget:u[0]});this.isUpdatePending=!0;this.trigger("facet:cleared");this.isUpdatePending=!1},clearFacetValues:function(n){var t=this,i=this.state.Facets[n],r;n==="Condition"?(r=this.helper.getTruckSearchNewUsedDefault(this.state),i.Children.forEach(function(n){n.IsActive=n.Value===r;t.renderFacet(n)})):n==="TruckProOnlyShareable"?i.Children.forEach(function(n){n.IsActive&&(n.IsActive=!1,t.renderFacet(n));$("[data-key='DaysOnLot'] .facet-range__input").val("");t.clearRangeFilter("DaysOnLot")}):i.Children.forEach(function(n){n.IsActive&&(n.IsActive=!1,t.renderFacet(n))})},clearSearchText:function(n){this.setState({IsVinSearch:!1,Search:""});this.updateActiveFilters("Search",n,!1);this.setAllCarouselItemActiveState();this.UI.root.$pillters.find("[data-key='search-text']").remove()},clearRangeFilters:function(){var n=this;Object.keys(this.truckSearchMetaData.RangeFacets).forEach(function(t){n.clearRangeFilter(t)})},clearRangeFilter:function(n,t){var i=this.state.RangeFilters;t?i[n][t]=null:(i[n].RangeEnd=null,i[n].RangeStart=null);this.setState({RangeFilters:i})},checkIsRangeFilter:function(n){var t=Object.keys(this.truckSearchMetaData.RangeFacets).find(function(t){return t===n})||null;return t!==null},findFacet:function(n,t){return n&&t?this.UI.root.$facets.find(".facet").filter(function(r,u){var f=$(u).data();return!i.isNullOrUndefined(f.key)&&!i.isNullOrUndefined(f.value)?f.key===n&&f.value.toString()===t.toString():!1}):null},updateCarousel:function(n,t,i){this.UI.carousel.$items!==null&&(this.updateActiveFilters(n,t,i),this.setAllCarouselItemActiveState())},updateCarouselForPopState:function(){if(!this.helper.isCarouselFilterMapUndefinedOrNull(this.CarouselFilterMap)){var n=this;Object.keys(this.CarouselFilterMap.Filters).forEach(function(t){var i=n.CarouselFilterMap.Filters[t];Object.keys(i).forEach(function(t){i[t].forEach(function(i){var u=n.state.Facets[t],r=u.Children.find(function(n){return n.Value===i}),f=r?r.IsActive:!1;n.updateCarousel(t,i,f)})})})}},setAllCarouselItemActiveState:function(){if(!this.helper.isCarouselFilterMapUndefinedOrNull(this.CarouselFilterMap)){var n=this;Object.keys(this.CarouselFilterMap.Filters).forEach(function(t){n.setCarouselItemActiveState(t)})}},setCarouselItemActiveState:function(n){if(this.UI.carousel.$items!==null){var t=this.UI.carousel.$items.filter("[data-item='"+n+"']").find(".item"),i=this.isCarouselItemActive(n);i?t.addClass("selected"):t.removeClass("selected")}},isCarouselItemActive:function(n){if(this.helper.isCarouselFilterMapUndefinedOrNull(this.CarouselFilterMap))return!1;var i=this.CarouselFilterMap.Filters[n],r=this.CarouselFilterMap.ActiveFilters[n],t=!0;return Object.keys(i).forEach(function(n){var u=i[n],f=r[n];if(u.length!==f.length){t=!1;return}u.forEach(function(n){t=t&&f.indexOf(n)>-1})}),t},expandActiveSections:function(){var f=this.UI.root.$facets,t=this.state.Facets,i,n,r,u;if(window.matchMedia("(min-width: 48rem)").matches)for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n=t[i],r=n.Children.find(function(n){return n.IsActive}),r&&(n.Collapsed=!1,u=f.find("[data-collapsible-key='"+n.Key+"']").closest(".collapsible"),u.removeClass("collapsed")))},scrollToTop:function(){var n=this.UI.root.$pillters.get(1);n&&n.scrollIntoView({behavior:"smooth"})},getRootNodeHTML:function(){function n(n){return typeof n=="undefined"?null:n.replace("\n","").replace("\r","").replace("\t","")}return{DealerDetailHeaderView:n(this.UI.root.$dealerDetail.html()),BodyManufacturerHeaderView:n(this.UI.root.$bodyManufacturerDetail.html()),PilltersView:n(this.UI.root.$pillters.html()),PaginationTopView:n(this.UI.root.$paginationTop.html()),PaginationBottomView:n(this.UI.root.$paginationBottom.html()),InventoryListView:n(this.UI.root.$truckListing.html()),TruckSearchScenariosView:n(this.UI.root.$truckSearchScenarios.html()),SearchFacetsView:n(this.UI.root.$facets.html()),CVShowroomPanelView:n(this.UI.root.$cvsPanel.html()),BreadcrumbsHTML:n(this.UI.root.$breadcrumbs.html())}},setSearch:function(n,t){var i=this.helper.isVIN(n),r=n;i&&(r=n.toUpperCase());this.setState({IsVinSearch:i,Search:r});t&&this.state.Facets.Condition.IsDisplayed&&this.updateFacet("Condition","All")},setMiles:function(n){var t=n.toString();this.setState({Miles:`${t}`})},setLocation:function(n){var t=null,i=null,r=null,u=this.state.City,f=this.state.State;n!==null&&n.IsValid&&(t=`${n.Lat}`,i=`${n.Long}`,r=`${n.ZipCode}`,u=n.City,f=n.State);this.setState({Latitude:t,Longitude:i,ZipCode:r,City:u,State:f})},updateFacetScrollableView:function(){if(this.scrollData!=null){var n=this.scrollData,t=this.findFacet(n.key,n.value);t.length&&(t[0].parentElement.scrollIntoView({behavior:"instant",block:"center"}),window.innerWidth>640&&window.scrollTo(window.scrollX,window.scrollY));this.scrollData=null}},updateBreadcrumbsLdJson:function(){var n=this.UI.root.$breadcrumbs.first("nav.breadcrumbs");if(n){const i=Array.from(n.find("a")),r=i.map(function(n,t){return{"@type":"ListItem",position:t+1,name:n.name?n.name.trim():"",item:n.tagName&&n.tagName.toLowerCase()==="a"?n.href:window.location.href}}),u={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:r},t=$("#breadcrumbs-ldjson");t&&t.remove();const f=$("<script>",{type:"application/ld+json",id:"breadcrumbs-ldjson",text:JSON.stringify(u,null,2)});$("head").append(f)}},helper:{isVIN:function(n){return n.length===17&&n.indexOf(" ")===-1&&n.match("^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$")!==null},getTruckSearchNewUsedDefault:function(n){var i=n.TruckSearchNewUsedDefault,t=null;switch(i){case 0:t="New";break;case 1:t="Used";break;default:t="All"}return t},isCarouselFilterMapUndefinedOrNull:function(n){return typeof n=="undefined"||n===null},fireAdobeEvent:function(n,t){var i={type:"tool",page:"shop:search-new-inventory",location:"topnav",description:n,currentTarget:t};window.wts.visor.fire(window.wts.visor.Events.INTERACTION_CLICK,i)}}},o.prototype)}(window.wts,window.wts.modules);wts.registerBundle("truck-search")