(function($){window.ps=window.ps||{};ps.currentBreakpoint=null;ps.navBreakpoint=!1;ps.breakpoints={xl:1600,lg:1200,md:750,sm:360,nav:1240};enquire.register('screen and (min-width: '+ps.breakpoints.xl+'px)',{match:function(){ps.currentBreakpoint='xl'}}).register('screen and (min-width: '+ps.breakpoints.lg+'px) and (max-width: '+(ps.breakpoints.xl-1)+'px)',{match:function(){ps.currentBreakpoint='lg'}}).register('screen and (min-width: '+ps.breakpoints.md+'px) and (max-width: '+(ps.breakpoints.lg-1)+'px)',{match:function(){ps.currentBreakpoint='md'}}).register('screen and (max-width: '+(ps.breakpoints.md-1)+'px)',{match:function(){ps.currentBreakpoint='sm'}}).register('screen and (max-width: '+(ps.breakpoints.nav-1)+'px)',{match:function(){ps.navBreakpoint=!0},unmatch:function(){ps.navBreakpoint=!1}});$(document).on('keyup','textarea',function(){while($(this).outerHeight()<this.scrollHeight+parseFloat($(this).css('borderTopWidth'))+parseFloat($(this).css('borderBottomWidth'))){$(this).height($(this).height()+1)}});function showDataLabel(e){if(typeof e==='object'){e.stopPropagation()}
$(this).closest('[data-label]').toggleClass('j-label',!$(this).val()=='')}
$.fn.showDataLabels=function(){return $(this).each(showDataLabel)};$('[data-label] input, [data-label] textarea, [data-label] select').showDataLabels();$(document).on('keyup','[data-label] input, [data-label] textarea',$.debounce(showDataLabel,100));$(document).on('change','[data-label] select',$.debounce(showDataLabel,100));$('.j-inc, .j-dec').on('click',function(){var $input=$(this).parent().find('input');var oldValue=$input.val();var newVal=0;if(button.hasClass('j-inc')){newVal=parseFloat(oldValue)+1}else{newVal=oldValue>0?parseFloat(oldValue)-1:0}
$input.val(newVal)});var go_pickers={};$('.s-input-date-picker').each(function(li_index){var lo_input=$(this).find('input:first');var lo_field=$(this).get(0);var lo_picker=new Pikaday({field:lo_field,input:lo_input,format:'D MMM YYYY',onSelect:function(){this._o.input.val(this.getDate().toLocaleDateString())}});$(this).data('picker-index',li_index);go_pickers[li_index]=lo_picker;$(this).on('click',function(){var li_thisindex=$(this).data('picker-index');var lo_thispicker=go_pickers[li_thisindex];if(typeof lo_thispicker=='object'){lo_thispicker.show()}})});function preventTransitionOnResize(){var $body=$('body');var timeoutId=null;$body.addClass('is-resizing');clearTimeout(timeoutId);timeoutId=setTimeout(function(){$body.removeClass('is-resizing')},1000)}
$(window).on('resize',preventTransitionOnResize);var textareaLimit={getCharLimit:function(){var charsLimit=$(this).attr('maxlength');var charsCurrent=$(this).val().length;return charsCurrent+' / '+charsLimit},updateCharLimit:function(){$(this).next().html(textareaLimit.getCharLimit.apply(this))},init:function(){return'<div class="s-textarea__limit">'+textareaLimit.getCharLimit.apply(this)+'</div>'}};$('.j-textarea').after(textareaLimit.init).on('keyup',$.throttle(textareaLimit.updateCharLimit,100));$(document).on('click','.j-popup-example',function(){$.popup.open({class:'popup-example',url:'/popup-example'})});$(document).on('click','.j-slide-in-example',function(){$.slideIn.open({class:'slide-in-example',url:'/slide-in-example'})});$(document).on('click','.j-laybuy-popup',function(){$.popup.open({class:'popup-laybuy',url:'/popup-laybuy'})});$(document).on('click','.j-afterpay-popup',function(){$.popup.open({class:'popup-afterpay',url:'/popup-afterpay'})});$(document).on('click','.j-loading-popup',function(){$.popup.open({class:'popup-loader',url:'/popup-loader'})});$(document).on('click','.j-login-slide-in',function(e){e.preventDefault();var gaData={eventCategory:'Home Page',eventAction:'Login',eventLabel:'Homepage',};$(document).trigger('psevent',['loginViaHeader',gaData]);$.slideIn.open({url:'/slide-in-login',class:'slide-in-login'})});if(window.validPopupHash){var popupDisplayedCookie=validPopupHash+'PopupDisplayed';var hasPopupDisplayed=$.getCookie(popupDisplayedCookie);if(hasPopupDisplayed===''){$.setCookie(popupDisplayedCookie,1,30);triggerWelcomePopup()}
function triggerWelcomePopup(){setTimeout(function(){$.popup.open({url:'/popup-welcome',class:'popup-welcome ps-popup--bottom',curtain:!1})},1000)}}
$(document).on('submit','.j-welcome-form',function(e){e.preventDefault();$('.s-error,.s-success').addClass('is-hidden');grecaptcha.ready(function(){grecaptcha.execute(reCAPTCHA_site_key,{action:'submit'}).then(function(token){$('[name=g-recaptcha-response]').val(token);var formData=$(e.target).serializeArray();$.ajax({url:'/api/popup-welcome/submit',type:'post',data:formData,}).done(function(response){if(!response.success){if(response.message){var errors=response.message;if(Object.keys(errors).length){for(var key in errors){$('.s-error--'+key).text(errors[key]).removeClass('is-hidden')}}
if(response.message.email){$('.j-form-error').text(response.message.email).removeClass('is-hidden')}}
grecaptcha.reset();return}
var successMessageEl=$('.j-form-success');successMessageEl.text(response.message.success);successMessageEl.removeClass('is-hidden');var gaData={eventCategory:'Email Signup',eventAction:'Sign Up',eventLabel:'Welcome Pop Up',};$(document).trigger('psevent',['welcomeSignUp',gaData]);setTimeout(function(){successMessageEl.addClass('is-hidden');e.target.reset()},3000)})})})});if($('#v-site-header').length){new Vue({el:'#v-site-header',name:'Header',store:peppercheckout.cart.$store,data:function(){return{searchActive:!1,searchTransitionActive:!1}},methods:{showSearch:function(){this.searchActive=!0},hideSearch:function(){this.searchActive=!1},onSearchTransition:function(){$('body').toggleClass('has-search-active');this.searchTransitionActive=!this.searchTransitionActive;if(!this.searchActive){this.$nextTick(nav.reInit)}}},mounted:function(){GlobalEventBus.$on('search:show',this.showSearch);GlobalEventBus.$on('search:hide',this.hideSearch)}})}
if($('#v-cart').length){new Vue({el:'#v-cart',name:'Cart',store:peppercheckout.cart.$store})}
$(document).on('click','.co-cart .s-dropdown-styled',function(){$('.co-cart j-dropdown-styled').not(this).find('ul').slideUp();$(this).find('ul').slideToggle();$(this).toggleClass('is-active')});var promoStrip={$wrap:$('.j-promo-strip'),$slider:$('.j-promo-strip-slider'),$close:$('.j-promo-strip-close'),close:function(){promoStrip.$wrap.remove()},init:function(){if(promoStrip.$slider.length){promoStrip.$slider.slick({arrows:!1,autoplay:!0,autoplaySpeed:6000})}
setTimeout(function(){promoStrip.$wrap.removeClass('is-invisible')},300);promoStrip.$close.on('click',promoStrip.close)}};promoStrip.init();var nav={$siteHeader:$('.j-site-header'),$primaryNav:$('.j-primary-nav'),$subnavShow:$('.j-show-sub-nav'),$subnavHide:$('.j-hide-sub-nav'),$toggle:$('.j-toggle-nav'),$toggleOverlay:$('.j-toggle-overlay'),offset:$('.j-pre-header').outerHeight()||0,height:$('.j-site-header').outerHeight(),toggled:!1,events:{},show:function(){nav.toggled=!0;nav.$toggle.addClass('is-active').attr('aria-expanded','true');nav.$primaryNav.addClass('is-active');$('body').addClass('has-nav-active');$('html, body').animate({scrollTop:nav.$siteHeader.offset().top});$.overlay.show(nav.hide)},hide:function(){nav.toggled=!1;nav.$toggle.removeClass('is-active').attr('aria-expanded','false');nav.$primaryNav.removeClass('is-active');$('body').removeClass('has-nav-active');$.overlay.hide()},initMobileMenu:function(){nav.$subnavShow.on('click.subnav',nav.showSubNav);nav.$toggleOverlay.off('mouseenter.subnav').off('mouseleave.subnav');nav.$subnavHide.on('click',nav.hideSubNav);nav.$toggle.on('click',nav.toggle)},destroyMobileMenu:function(){nav.$subnavShow.off('click.subnav');nav.$toggleOverlay.on('mouseenter.subnav',nav.showSubNav).on('mouseleave.subnav',nav.hideSubNav);nav.$subnavHide.off('click',nav.hideSubNav);nav.$toggle.off('click',nav.toggle);nav.hide()},updateLayoutDimensions:function(){nav.offset=$('.j-pre-header').outerHeight()||0;nav.height=nav.$siteHeader.outerHeight()},toggle:function(){nav.toggled?nav.hide():nav.show()},showSubNav:function(e){e.preventDefault();if(!ps.navBreakpoint){$.overlay.show()}else{nav.$primaryNav.scrollTop(0)}
$(this).closest('.has-sub-nav').addClass('is-active')},hideSubNav:function(e){e.preventDefault();if(!ps.navBreakpoint){$.overlay.hide()}
$(this).closest('.has-sub-nav').removeClass('is-active')},positionHeader:function(){var $body=$('body');var scroll=Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop);nav.updateLayoutDimensions();if(scroll>nav.offset){$body.addClass('has-fixed-header').css('padding-top',nav.height);nav.$siteHeader.addClass('is-fixed')}else{$body.removeClass('has-fixed-header').css('padding-top','');nav.$siteHeader.removeClass('is-fixed')}},init:function(){nav.updateLayoutDimensions();nav.positionHeader();enquire.register('screen and (max-width: '+(ps.breakpoints.nav-1)+'px)',nav.initMobileMenu);enquire.register('screen and (min-width: '+ps.breakpoints.nav+'px)',nav.destroyMobileMenu);$(window).on('resize scroll',$.throttle(nav.positionHeader,10))},destroy:function(){enquire.unregister('screen and (max-width: '+(ps.breakpoints.nav-1)+'px)',nav.initMobileMenu);enquire.unregister('screen and (min-width: '+ps.breakpoints.nav+'px)',nav.destroyMobileMenu);nav.$subnavHide.off('click',nav.hideSubNav);nav.$subnavShow.off('click.subnav').off('mouseenter.subnav').off('mouseleave.subnav');$(window).off('resize scroll',$.throttle(nav.positionHeader,10))},reInit:function(){nav.$siteHeader=$('.j-site-header');nav.$primaryNav=$('.j-primary-nav');nav.$subnavShow=$('.j-show-sub-nav');nav.$subnavHide=$('.j-hide-sub-nav');nav.$toggle=$('.j-toggle-nav');nav.$toggleOverlay=$('.j-toggle-overlay');if(ps.navBreakpoint){nav.destroyMobileMenu();nav.initMobileMenu()}else{nav.destroy();nav.init()}}}
nav.init();$(document).on('submit','#j-login-form',function(e){e.preventDefault();var _form=$(this);var formData=_form.serializeArray();var formAction=_form.attr('action');_form.find('.s-input-error, .s-error').html('').addClass('is-hidden');$.ajax({url:formAction,type:'post',dataType:'json',data:formData,success:function(po_response){if(po_response.status){window.location.href='/'}else{if(po_response.data.errors.form){_form.find('.j-form-error').html(po_response.data.errors.form).removeClass('is-hidden')}
lo_errors=po_response.data.errors;if(!$.isEmptyObject(lo_errors)){$.each(lo_errors,function(name,value){_form.find('input[name="'+name+'"]').parents('.s-input').next('.s-input-error').html(value).removeClass('is-hidden')})}}},})});$(document).on('click','.j-accountLogout',function(){$.get('/customerapi/logout',{},function(po_data){if(po_data.status){window.location.href='/'}})});var search={$el:null,init:function(){GlobalEventBus.$on('search-results:show',search.onShow);GlobalEventBus.$on('search-results:hide',search.onHide)},initEvents:function(){$(window).on('resize.search',$.debounce(search.setMaxHeight,100))},destroyEvents:function(){$(window).off('resize.search')},setMaxHeight:function(){var rect=search.$el[0].getBoundingClientRect();search.$el.css('max-height',window.innerHeight-rect.top+'px')},onShow:function(){search.$el=$('.j-search-typeahead-results');search.setMaxHeight();search.initEvents();$.overlay.show(function(){GlobalEventBus.$emit('search:hide')})},onHide:function(){search.destroyEvents();$.overlay.hide()}}
search.init();var locationSelectorStrip={$wrap:$('.j-location-selector-strip'),$close:$('.j-location-selector-strip-close'),$dropdown:$('.j-location-selector'),$input:$('input[name="userselectedlocale"]'),select:function(value,$elem){locationSelectorStrip.$input.val($elem.attr('data-value'));locationSelectorStrip.$dropdown.find('[aria-haspopup="listbox"]').html($elem.html());var userSelectedLocale=$elem.attr('data-nicename');var gaData={eventCategory:'Country Selector',eventAction:'Header',eventLabel:userSelectedLocale};$(document).trigger('psevent',['countrySelectorClick',gaData])},close:function(){locationSelectorStrip.$wrap.remove();locationSelectorStrip.$close.off('click',locationSelectorStrip.close);$.setCookie('ps_localeswitcherclosed',1)},init:function(){locationSelectorStrip.$dropdown.dropdown({onSelect:locationSelectorStrip.select});locationSelectorStrip.$close.on('click',locationSelectorStrip.close)}};locationSelectorStrip.init();$('.j-site-footer-location-selector').dropdown({onSelect:function(value,$elem){var $form=$(this);var userSelectedLocale=$elem.attr('data-nicename');var gaData={eventCategory:'Country Selector',eventAction:'Footer',eventLabel:userSelectedLocale};$(document).trigger('psevent',['countrySelectorClick',gaData]);$.setCookie('ps_localeswitcherclosed',1);$form.find('[aria-haspopup="listbox"]').html($elem.html());$form.find('input[name="userselectedlocale"]').val($elem.attr('data-value'));$form.trigger('submit')}});$(document).on('submit','.j-newsletter-form',function(e){e.preventDefault();var formData=$(this).serializeArray();var signUpForm=$(this);signUpForm.find('.j-email-error').addClass('is-hidden');signUpForm.find('.j-success').addClass('is-hidden');$.ajax({url:'/quick-subscribe',type:'post',dataType:'json',data:formData,success:function(response){if(response.success){var gaData={eventCategory:'Email Signup',eventAction:'Sign Up',eventLabel:'Footer Sign Up',};$(document).trigger('psevent',['footerEmailSignUp'.gaData]);signUpForm.find('.j-success').removeClass('is-hidden').html(response.message.success);signUpForm.find('.fbclick-event').trigger('click');var subscribeTimer=setTimeout(function(){signUpForm.find('.j-success').addClass('is-hidden');signUpForm[0].reset()},4000)}else{if(response.message.email){signUpForm.find('.j-email-error').removeClass('is-hidden').html(response.message.email)}}},})});$(document).on('submit','.j-contact-from',function(e){e.preventDefault();var formData=$(this).serializeArray();var contactForm=$(this);contactForm.find('.j-input-error').addClass('is-hidden').text('');contactForm.find('.j-success').addClass('is-hidden');$.ajax({url:'/contact-us-action',type:'post',dataType:'json',data:formData,}).done(function(response){contactForm.find('.j-success').removeClass('is-hidden').html(response.message);var subscribeTimer=setTimeout(function(){contactForm[0].reset()},4000)}).fail(function(jqXHR){var errors=jqXHR.responseJSON.errors;for(var field in errors){if(field==='csrf'){contactForm.find('.j-error').text(errors[field]).removeClass('is-hidden')}else if(field==='sending'){contactForm.find('.j-error').text(errors[field]).removeClass('is-hidden')}else{$('[for="'+field+'"]').next().next().text(errors[field]).removeClass('is-hidden')}}})});$(document).on('submit','#j-forgot-password-form',function(e){e.preventDefault();var forgotpasswordForm=$(this);var formData=forgotpasswordForm.serializeArray();forgotpasswordForm.find('.j-form-success').addClass('is-hidden');forgotpasswordForm.find('.j-email-error').addClass('is-hidden');forgotpasswordForm.find('.j-form-error').addClass('is-hidden');$.ajax({url:'/customerapi/forgotpassword',type:'post',dataType:'json',data:formData,success:function(response){if(response.status){forgotpasswordForm.find('#email').val('');forgotpasswordForm.find('.j-form-success').removeClass('is-hidden').html(response.data.message)}else{if(response.data.errors.form){forgotpasswordForm.find('.j-form-error').removeClass('is-hidden').html(response.data.errors.form)}else{if(response.data.errors.email){forgotpasswordForm.find('.j-email-error').removeClass('is-hidden').html(response.data.errors.email)}}}},})});$(document).on('submit','#j-reset-password-form',function(e){e.preventDefault();var resetpasswordForm=$(this);var formData=resetpasswordForm.serializeArray();resetpasswordForm.find('.j-password-error').addClass('is-hidden');resetpasswordForm.find('.j-form-error').addClass('is-hidden');$.ajax({url:'/customerapi/resetpassword',type:'post',dataType:'json',data:formData,success:function(response){if(response.status){window.location.href='/my-account'}else{if(response.data.errors.form){resetpasswordForm.find('.j-form-error').removeClass('is-hidden').html(response.data.errors.form)}else{if(response.data.errors.password){resetpasswordForm.find('.j-password-error').removeClass('is-hidden').html(response.data.errors.password)}}}},})});var password={checkValidity:function(){var $this=$(this);var $rules=$('#'+$this.attr('aria-describedby'));var value=$this.val();$rules.find('.j-password-chars').toggleClass('is-valid',value.length>=8);$rules.find('.j-password-capital').toggleClass('is-valid',/[A-Z]/.test(value))},toggleVisibility:function(){var $toggle=$(this);var $input=$toggle.prev();var isPassword=$input.attr('type')==='password';$input.attr('type',isPassword?'text':'password');$toggle.toggleClass('is-toggled')},};$(document).on('keypress','.j-password',$.debounce(password.checkValidity,100));$(document).on('click','.j-password-toggle',password.toggleVisibility);$(document).on('click','.j-open-invoice',function(e){var orderid=$(this).data('orderid');var hash=$(this).data('hash');window.open('/print-invoice?i='+orderid+'&h='+hash,'_blank')});if(!(typeof peppercontentjs==='undefined')){$('.j-slider-product').each(function(){var productRowId=this.id;new Vue({el:'#'+productRowId,name:'ProductRow',data:function(){return{items:{}}},created:function(){this.items=window[productRowId].items}})});$('.j-slider-product').on('init',function(){$(this).verticallyPosition({image:'.s-image img'})});peppercontentjs.full.adaptiveHeight=!1;peppercontentjs.relatedposts.slidesToShow=4;peppercontentjs.init()}
$('.j-collapsible').collapsible();var collapsibleOnMobile=$('.j-collapsible-mobile');if(collapsibleOnMobile.length){enquire.register('(max-width: '+(ps.breakpoints.lg-1)+'px)',{match:function(){collapsibleOnMobile.collapsible()},unmatch:function(){collapsibleOnMobile.collapsible('destroy')},})}
$('.j-tabs').tabs();$('.j-faq-tabs').tabs({onSelect:function(tab){var title=tab.innerText+' - FAQs - '+window.sitename;document.title=title;window.history.replaceState('',title,'/'+(window.locale?window.locale.toLowerCase():'')+'/frequently-asked-questions/'+tab.id)}})}(jQuery))