jfredson

Untitled

May 31st, 2019
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 220.50 KB | None | 0 0
  1. window.theme = window.theme || {};
  2. window.slate = window.slate || {};
  3.  
  4. /* ================ VENDORS ================ */
  5. /* Simple jQuery Equal Heights @version 1.5.1. Copyright (c) 2013 Matt Banks. Dual licensed under the MIT and GPL licenses. */
  6. !function(a){a.fn.equalHeights=function(){var b=0,c=a(this);return c.each(function(){var c=a(this).innerHeight();c>b&&(b=c)}),c.css("height",b)},a("[data-equal]").each(function(){var b=a(this),c=b.data("equal");b.find(c).equalHeights()})}(jQuery);
  7.  
  8. /*!
  9. * enquire.js v2.1.2 - Awesome Media Queries in JavaScript
  10. * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/enquire.js
  11. * License: MIT (http://www.opensource.org/licenses/mit-license.php)
  12. */
  13. !function(a,b,c){var d=window.matchMedia;"undefined"!=typeof module&&module.exports?module.exports=c(d):"function"==typeof define&&define.amd?define(function(){return b[a]=c(d)}):b[a]=c(d)}("enquire",this,function(a){"use strict";function b(a,b){var c,d=0,e=a.length;for(d;e>d&&(c=b(a[d],d),c!==!1);d++);}function c(a){return"[object Array]"===Object.prototype.toString.apply(a)}function d(a){return"function"==typeof a}function e(a){this.options=a,!a.deferSetup&&this.setup()}function f(b,c){this.query=b,this.isUnconditional=c,this.handlers=[],this.mql=a(b);var d=this;this.listener=function(a){d.mql=a,d.assess()},this.mql.addListener(this.listener)}function g(){if(!a)throw new Error("matchMedia not present, legacy browsers require a polyfill");this.queries={},this.browserIsIncapable=!a("only all").matches}return e.prototype={setup:function(){this.options.setup&&this.options.setup(),this.initialised=!0},on:function(){!this.initialised&&this.setup(),this.options.match&&this.options.match()},off:function(){this.options.unmatch&&this.options.unmatch()},destroy:function(){this.options.destroy?this.options.destroy():this.off()},equals:function(a){return this.options===a||this.options.match===a}},f.prototype={addHandler:function(a){var b=new e(a);this.handlers.push(b),this.matches()&&b.on()},removeHandler:function(a){var c=this.handlers;b(c,function(b,d){return b.equals(a)?(b.destroy(),!c.splice(d,1)):void 0})},matches:function(){return this.mql.matches||this.isUnconditional},clear:function(){b(this.handlers,function(a){a.destroy()}),this.mql.removeListener(this.listener),this.handlers.length=0},assess:function(){var a=this.matches()?"on":"off";b(this.handlers,function(b){b[a]()})}},g.prototype={register:function(a,e,g){var h=this.queries,i=g&&this.browserIsIncapable;return h[a]||(h[a]=new f(a,i)),d(e)&&(e={match:e}),c(e)||(e=[e]),b(e,function(b){d(b)&&(b={match:b}),h[a].addHandler(b)}),this},unregister:function(a,b){var c=this.queries[a];return c&&(b?c.removeHandler(b):(c.clear(),delete this.queries[a])),this}},new g});
  14.  
  15. /*! Magnific Popup - v1.0.0 - 2015-03-30
  16. * http://dimsemenov.com/plugins/magnific-popup/
  17. * Copyright (c) 2015 Dmitry Semenov; */
  18. !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isIE7=-1!==c.indexOf("MSIE 7."),b.isIE8=-1!==c.indexOf("MSIE 8."),b.isLowIE=b.isIE7||b.isIE8,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e<h.length;e++)if(g=h[e],g.parsed&&(g=g.el[0]),g===c.el[0]){b.index=e;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],f="",b.ev=c.mainEl&&c.mainEl.length?c.mainEl.eq(0):d,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=x("bg").on("click"+p,function(){b.close()}),b.wrap=x("wrap").attr("tabindex",-1).on("click"+p,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=x("container",b.wrap)),b.contentContainer=x("content"),b.st.preloader&&(b.preloader=x("preloader",b.container,b.st.tLoading));var i=a.magnificPopup.modules;for(e=0;e<i.length;e++){var j=i[e];j=j.charAt(0).toUpperCase()+j.slice(1),b["init"+j].call(b)}y("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(w(l,function(a,b,c,d){c.close_replaceWith=z(d.type)}),f+=" mfp-close-btn-in"):b.wrap.append(z())),b.st.alignTop&&(f+=" mfp-align-top"),b.wrap.css(b.fixedContentPos?{overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.st.overflowY}:{top:v.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:d.height(),position:"absolute"}),b.st.enableEscapeKey&&d.on("keyup"+p,function(a){27===a.keyCode&&b.close()}),v.on("resize"+p,function(){b.updateSize()}),b.st.closeOnContentClick||(f+=" mfp-auto-cursor"),f&&b.wrap.addClass(f);var k=b.wH=v.height(),n={};if(b.fixedContentPos&&b._hasScrollBar(k)){var o=b._getScrollbarSize();o&&(n.marginRight=o)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var r=b.st.mainClass;return b.isIE7&&(r+=" mfp-ie7"),r&&b._addClassToMFP(r),b.updateItemHTML(),y("BuildControls"),a("html").css(n),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||a(document.body)),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(q),b._setFocus()):b.bgOverlay.addClass(q),d.on("focusin"+p,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(k),y(m),c},close:function(){b.isOpen&&(y(i),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(r),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){y(h);var c=r+" "+q+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var e={marginRight:""};b.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}d.off("keyup"+p+" focusin"+p),b.ev.off(p),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,y(j)},updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||v.height();b.fixedContentPos||b.wrap.css("height",b.wH),y("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(y("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var f=b.st[d]?b.st[d].markup:!1;y("FirstMarkupParse",f),b.currTemplate[d]=f?a(f):!0}e&&e!==c.type&&b.container.removeClass("mfp-"+e+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,y(n,c),e=c.type,b.container.prepend(b.contentContainer),y("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(z()):b.content=a:b.content="",y(k),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,y("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||2!==c.which&&!c.ctrlKey&&!c.metaKey){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(v.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};y("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(s)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?d.height():document.body.scrollHeight)>(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(a,c){if(void 0===c||c===!1)return!0;if(e=a.split("_"),e.length>1){var d=b.find(p+"-"+e[0]);if(d.length>0){var f=e[1];"replaceWith"===f?d[0]!==c[0]&&d.replaceWith(c):"img"===f?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(e[1],c)}}else b.find(p+"-"+a).html(c)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery",g=Boolean(a.fn.mfpFastClick);return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s),h=g?"mfpFastClick":"click";e[h](function(){b.prev()}),f[h](function(){b.next()}),b.isIE7&&(x("b",e[0],!1,!0),x("a",e[0],!1,!0),x("b",f[0],!1,!0),x("a",f[0],!1,!0)),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowLeft&&g&&b.arrowLeft.add(b.arrowRight).destroyMfpFastClick(),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){v.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g,h=a(this);if(c){var i,j,k,l,m,n;h.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,v.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0],(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)&&(l=!0,d())}).on("touchend"+f,function(a){d(),l||n>1||(g=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){g=!1},b),e())})})}h.on("click"+f,function(){g||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&v.off("touchmove"+f+" touchend"+f)}}(),A()});
  19. /*
  20. * ScrollToFixed
  21. * https://github.com/bigspotteddog/ScrollToFixed
  22. *
  23. * Copyright (c) 2011 Joseph Cava-Lynch
  24. * MIT license
  25. */
  26. (function(a){a.isScrollToFixed=function(b){return !!a(b).data("ScrollToFixed")};a.ScrollToFixed=function(d,i){var l=this;l.$el=a(d);l.el=d;l.$el.data("ScrollToFixed",l);var c=false;var G=l.$el;var H;var E;var e;var y;var D=0;var q=0;var j=-1;var f=-1;var t=null;var z;var g;function u(){G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");f=-1;D=G.offset().top;q=G.offset().left;if(l.options.offsets){q+=(G.offset().left-G.position().left)}if(j==-1){j=q}H=G.css("position");c=true;if(l.options.bottom!=-1){G.trigger("preFixed.ScrollToFixed");w();G.trigger("fixed.ScrollToFixed")}}function n(){var I=l.options.limit;if(!I){return 0}if(typeof(I)==="function"){return I.apply(G)}return I}function p(){return H==="fixed"}function x(){return H==="absolute"}function h(){return !(p()||x())}function w(){if(!p()){t.css({display:G.css("display"),width:G.outerWidth(true),height:G.outerHeight(true),"float":G.css("float")});cssOptions={"z-index":l.options.zIndex,position:"fixed",top:l.options.bottom==-1?s():"",bottom:l.options.bottom==-1?"":l.options.bottom,"margin-left":"0px"};if(!l.options.dontSetWidth){cssOptions.width=G.width()}G.css(cssOptions);G.addClass(l.options.baseClassName);if(l.options.className){G.addClass(l.options.className)}H="fixed"}}function b(){var J=n();var I=q;if(l.options.removeOffsets){I="";J=J-D}cssOptions={position:"absolute",top:J,left:I,"margin-left":"0px",bottom:""};if(!l.options.dontSetWidth){cssOptions.width=G.width()}G.css(cssOptions);H="absolute"}function k(){if(!h()){f=-1;t.css("display","none");G.css({"z-index":y,width:"",position:E,left:"",top:e,"margin-left":""});G.removeClass("scroll-to-fixed-fixed");if(l.options.className){G.removeClass(l.options.className)}H=null}}function v(I){if(I!=f){G.css("left",q-I);f=I}}function s(){var I=l.options.marginTop;if(!I){return 0}if(typeof(I)==="function"){return I.apply(G)}return I}function A(){if(!a.isScrollToFixed(G)){return}var K=c;if(!c){u()}else{if(h()){D=G.offset().top;q=G.offset().left}}var I=a(window).scrollLeft();var L=a(window).scrollTop();var J=n();if(l.options.minWidth&&a(window).width()<l.options.minWidth){if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}else{if(l.options.maxWidth&&a(window).width()>l.options.maxWidth){if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}else{if(l.options.bottom==-1){if(J>0&&L>=J-s()){if(!x()||!K){o();G.trigger("preAbsolute.ScrollToFixed");b();G.trigger("unfixed.ScrollToFixed")}}else{if(L>=D-s()){if(!p()||!K){o();G.trigger("preFixed.ScrollToFixed");w();f=-1;G.trigger("fixed.ScrollToFixed")}v(I)}else{if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}}}else{if(J>0){if(L+a(window).height()-G.outerHeight(true)>=J-(s()||-m())){if(p()){o();G.trigger("preUnfixed.ScrollToFixed");if(E==="absolute"){b()}else{k()}G.trigger("unfixed.ScrollToFixed")}}else{if(!p()){o();G.trigger("preFixed.ScrollToFixed");w()}v(I);G.trigger("fixed.ScrollToFixed")}}else{v(I)}}}}}function m(){if(!l.options.bottom){return 0}return l.options.bottom}function o(){var I=G.css("position");if(I=="absolute"){G.trigger("postAbsolute.ScrollToFixed")}else{if(I=="fixed"){G.trigger("postFixed.ScrollToFixed")}else{G.trigger("postUnfixed.ScrollToFixed")}}}var C=function(I){if(G.is(":visible")){c=false;A()}};var F=function(I){(!!window.requestAnimationFrame)?requestAnimationFrame(A):A()};var B=function(){var J=document.body;if(document.createElement&&J&&J.appendChild&&J.removeChild){var L=document.createElement("div");if(!L.getBoundingClientRect){return null}L.innerHTML="x";L.style.cssText="position:fixed;top:100px;";J.appendChild(L);var M=J.style.height,N=J.scrollTop;J.style.height="3000px";J.scrollTop=500;var I=L.getBoundingClientRect().top;J.style.height=M;var K=(I===100);J.removeChild(L);J.scrollTop=N;return K}return null};var r=function(I){I=I||window.event;if(I.preventDefault){I.preventDefault()}I.returnValue=false};l.init=function(){l.options=a.extend({},a.ScrollToFixed.defaultOptions,i);y=G.css("z-index");l.$el.css("z-index",l.options.zIndex);t=a("<div />");H=G.css("position");E=G.css("position");e=G.css("top");if(h()){l.$el.after(t)}a(window).bind("resize.ScrollToFixed",C);a(window).bind("scroll.ScrollToFixed",F);if("ontouchmove" in window){a(window).bind("touchmove.ScrollToFixed",A)}if(l.options.preFixed){G.bind("preFixed.ScrollToFixed",l.options.preFixed)}if(l.options.postFixed){G.bind("postFixed.ScrollToFixed",l.options.postFixed)}if(l.options.preUnfixed){G.bind("preUnfixed.ScrollToFixed",l.options.preUnfixed)}if(l.options.postUnfixed){G.bind("postUnfixed.ScrollToFixed",l.options.postUnfixed)}if(l.options.preAbsolute){G.bind("preAbsolute.ScrollToFixed",l.options.preAbsolute)}if(l.options.postAbsolute){G.bind("postAbsolute.ScrollToFixed",l.options.postAbsolute)}if(l.options.fixed){G.bind("fixed.ScrollToFixed",l.options.fixed)}if(l.options.unfixed){G.bind("unfixed.ScrollToFixed",l.options.unfixed)}if(l.options.spacerClass){t.addClass(l.options.spacerClass)}G.bind("resize.ScrollToFixed",function(){t.height(G.height())});G.bind("scroll.ScrollToFixed",function(){G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");A()});G.bind("detach.ScrollToFixed",function(I){r(I);G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");a(window).unbind("resize.ScrollToFixed",C);a(window).unbind("scroll.ScrollToFixed",F);G.unbind(".ScrollToFixed");t.remove();l.$el.removeData("ScrollToFixed")});C()};l.init()};a.ScrollToFixed.defaultOptions={marginTop:0,limit:0,bottom:-1,zIndex:1000,baseClassName:"scroll-to-fixed-fixed"};a.fn.scrollToFixed=function(b){return this.each(function(){(new a.ScrollToFixed(this,b))})}})(jQuery);
  27.  
  28. /*
  29. _ _ _ _
  30. ___| (_) ___| | __ (_)___
  31. / __| | |/ __| |/ / | / __|
  32. \__ \ | | (__| < _ | \__ \
  33. |___/_|_|\___|_|\_(_)/ |___/
  34. |__/
  35.  
  36. Version: 1.3.15
  37. Author: Ken Wheeler
  38. Website: http://kenwheeler.github.io
  39. Docs: http://kenwheeler.github.io/slick
  40. Repo: http://github.com/kenwheeler/slick
  41. Issues: http://github.com/kenwheeler/slick/issues
  42.  
  43. */
  44.  
  45. !function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){"use strict";var b=window.Slick||{};b=function(){function c(c,d){var f,g,e=this;if(e.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:a(c),appendDots:a(c),arrows:!0,asNavFor:null,prevArrow:'<button type="button" data-role="none" class="slick-prev">Previous</button>',nextArrow:'<button type="button" data-role="none" class="slick-next">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(a,b){return'<button type="button" data-role="none">'+(b+1)+"</button>"},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",fade:!1,focusOnSelect:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",onBeforeChange:null,onAfterChange:null,onInit:null,onReInit:null,onSetPosition:null,pauseOnHover:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rtl:!1,slide:"div",slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,variableWidth:!1,vertical:!1,waitForAnimate:!0},e.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,$list:null,touchObject:{},transformsEnabled:!1},a.extend(e,e.initials),e.activeBreakpoint=null,e.animType=null,e.animProp=null,e.breakpoints=[],e.breakpointSettings=[],e.cssTransitions=!1,e.paused=!1,e.positionProp=null,e.respondTo=null,e.shouldClick=!0,e.$slider=a(c),e.$slidesCache=null,e.transformType=null,e.transitionType=null,e.windowWidth=0,e.windowTimer=null,e.options=a.extend({},e.defaults,d),e.currentSlide=e.options.initialSlide,e.originalSettings=e.options,f=e.options.responsive||null,f&&f.length>-1){e.respondTo=e.options.respondTo||"window";for(g in f)f.hasOwnProperty(g)&&(e.breakpoints.push(f[g].breakpoint),e.breakpointSettings[f[g].breakpoint]=f[g].settings);e.breakpoints.sort(function(a,b){return b-a})}e.autoPlay=a.proxy(e.autoPlay,e),e.autoPlayClear=a.proxy(e.autoPlayClear,e),e.changeSlide=a.proxy(e.changeSlide,e),e.clickHandler=a.proxy(e.clickHandler,e),e.selectHandler=a.proxy(e.selectHandler,e),e.setPosition=a.proxy(e.setPosition,e),e.swipeHandler=a.proxy(e.swipeHandler,e),e.dragHandler=a.proxy(e.dragHandler,e),e.keyHandler=a.proxy(e.keyHandler,e),e.autoPlayIterator=a.proxy(e.autoPlayIterator,e),e.instanceUid=b++,e.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,e.init(),e.checkResponsive()}var b=0;return c}(),b.prototype.addSlide=function(b,c,d){var e=this;if("boolean"==typeof c)d=c,c=null;else if(0>c||c>=e.slideCount)return!1;e.unload(),"number"==typeof c?0===c&&0===e.$slides.length?a(b).appendTo(e.$slideTrack):d?a(b).insertBefore(e.$slides.eq(c)):a(b).insertAfter(e.$slides.eq(c)):d===!0?a(b).prependTo(e.$slideTrack):a(b).appendTo(e.$slideTrack),e.$slides=e.$slideTrack.children(this.options.slide),e.$slideTrack.children(this.options.slide).detach(),e.$slideTrack.append(e.$slides),e.$slides.each(function(b,c){a(c).attr("index",b)}),e.$slidesCache=e.$slides,e.reinit()},b.prototype.animateSlide=function(b,c){var d={},e=this;if(1===e.options.slidesToShow&&e.options.adaptiveHeight===!0&&e.options.vertical===!1){var f=e.$slides.eq(e.currentSlide).outerHeight(!0);e.$list.animate({height:f},e.options.speed)}e.options.rtl===!0&&e.options.vertical===!1&&(b=-b),e.transformsEnabled===!1?e.options.vertical===!1?e.$slideTrack.animate({left:b},e.options.speed,e.options.easing,c):e.$slideTrack.animate({top:b},e.options.speed,e.options.easing,c):e.cssTransitions===!1?a({animStart:e.currentLeft}).animate({animStart:b},{duration:e.options.speed,easing:e.options.easing,step:function(a){e.options.vertical===!1?(d[e.animType]="translate("+a+"px, 0px)",e.$slideTrack.css(d)):(d[e.animType]="translate(0px,"+a+"px)",e.$slideTrack.css(d))},complete:function(){c&&c.call()}}):(e.applyTransition(),d[e.animType]=e.options.vertical===!1?"translate3d("+b+"px, 0px, 0px)":"translate3d(0px,"+b+"px, 0px)",e.$slideTrack.css(d),c&&setTimeout(function(){e.disableTransition(),c.call()},e.options.speed))},b.prototype.asNavFor=function(b){var c=this,d=null!=c.options.asNavFor?a(c.options.asNavFor).getSlick():null;null!=d&&d.slideHandler(b,!0)},b.prototype.applyTransition=function(a){var b=this,c={};c[b.transitionType]=b.options.fade===!1?b.transformType+" "+b.options.speed+"ms "+b.options.cssEase:"opacity "+b.options.speed+"ms "+b.options.cssEase,b.options.fade===!1?b.$slideTrack.css(c):b.$slides.eq(a).css(c)},b.prototype.autoPlay=function(){var a=this;a.autoPlayTimer&&clearInterval(a.autoPlayTimer),a.slideCount>a.options.slidesToShow&&a.paused!==!0&&(a.autoPlayTimer=setInterval(a.autoPlayIterator,a.options.autoplaySpeed))},b.prototype.autoPlayClear=function(){var a=this;a.autoPlayTimer&&clearInterval(a.autoPlayTimer)},b.prototype.autoPlayIterator=function(){var a=this;a.options.infinite===!1?1===a.direction?(a.currentSlide+1===a.slideCount-1&&(a.direction=0),a.slideHandler(a.currentSlide+a.options.slidesToScroll)):(0===a.currentSlide-1&&(a.direction=1),a.slideHandler(a.currentSlide-a.options.slidesToScroll)):a.slideHandler(a.currentSlide+a.options.slidesToScroll)},b.prototype.buildArrows=function(){var b=this;b.options.arrows===!0&&b.slideCount>b.options.slidesToShow&&(b.$prevArrow=a(b.options.prevArrow),b.$nextArrow=a(b.options.nextArrow),b.htmlExpr.test(b.options.prevArrow)&&b.$prevArrow.appendTo(b.options.appendArrows),b.htmlExpr.test(b.options.nextArrow)&&b.$nextArrow.appendTo(b.options.appendArrows),b.options.infinite!==!0&&b.$prevArrow.addClass("slick-disabled"))},b.prototype.buildDots=function(){var c,d,b=this;if(b.options.dots===!0&&b.slideCount>b.options.slidesToShow){for(d='<ul class="'+b.options.dotsClass+'">',c=0;c<=b.getDotCount();c+=1)d+="<li>"+b.options.customPaging.call(this,b,c)+"</li>";d+="</ul>",b.$dots=a(d).appendTo(b.options.appendDots),b.$dots.find("li").first().addClass("slick-active")}},b.prototype.buildOut=function(){var b=this;b.$slides=b.$slider.children(b.options.slide+":not(.slick-cloned)").addClass("slick-slide"),b.slideCount=b.$slides.length,b.$slides.each(function(b,c){a(c).attr("index",b)}),b.$slidesCache=b.$slides,b.$slider.addClass("slick-slider"),b.$slideTrack=0===b.slideCount?a('<div class="slick-track"/>').appendTo(b.$slider):b.$slides.wrapAll('<div class="slick-track"/>').parent(),b.$list=b.$slideTrack.wrap('<div class="slick-list"/>').parent(),b.$slideTrack.css("opacity",0),b.options.centerMode===!0&&(b.options.slidesToScroll=1),a("img[data-lazy]",b.$slider).not("[src]").addClass("slick-loading"),b.setupInfinite(),b.buildArrows(),b.buildDots(),b.updateDots(),b.options.accessibility===!0&&b.$list.prop("tabIndex",0),b.setSlideClasses("number"==typeof this.currentSlide?this.currentSlide:0),b.options.draggable===!0&&b.$list.addClass("draggable")},b.prototype.checkResponsive=function(){var c,d,e,b=this,f=b.$slider.width(),g=window.innerWidth||a(window).width();if("window"===b.respondTo?e=g:"slider"===b.respondTo?e=f:"min"===b.respondTo&&(e=Math.min(g,f)),b.originalSettings.responsive&&b.originalSettings.responsive.length>-1&&null!==b.originalSettings.responsive){d=null;for(c in b.breakpoints)b.breakpoints.hasOwnProperty(c)&&e<b.breakpoints[c]&&(d=b.breakpoints[c]);null!==d?null!==b.activeBreakpoint?d!==b.activeBreakpoint&&(b.activeBreakpoint=d,b.options=a.extend({},b.originalSettings,b.breakpointSettings[d]),b.refresh()):(b.activeBreakpoint=d,b.options=a.extend({},b.originalSettings,b.breakpointSettings[d]),b.refresh()):null!==b.activeBreakpoint&&(b.activeBreakpoint=null,b.options=b.originalSettings,b.refresh())}},b.prototype.changeSlide=function(b,c){var f,g,h,i,j,d=this,e=a(b.target);switch(e.is("a")&&b.preventDefault(),h=0!==d.slideCount%d.options.slidesToScroll,f=h?0:(d.slideCount-d.currentSlide)%d.options.slidesToScroll,b.data.message){case"previous":g=0===f?d.options.slidesToScroll:d.options.slidesToShow-f,d.slideCount>d.options.slidesToShow&&d.slideHandler(d.currentSlide-g,!1,c);break;case"next":g=0===f?d.options.slidesToScroll:f,d.slideCount>d.options.slidesToShow&&d.slideHandler(d.currentSlide+g,!1,c);break;case"index":var k=0===b.data.index?0:b.data.index||a(b.target).parent().index()*d.options.slidesToScroll;if(i=d.getNavigableIndexes(),j=0,i[k]&&i[k]===k)if(k>i[i.length-1])k=i[i.length-1];else for(var l in i){if(k<i[l]){k=j;break}j=i[l]}d.slideHandler(k,!1,c);default:return}},b.prototype.clickHandler=function(a){var b=this;b.shouldClick===!1&&(a.stopImmediatePropagation(),a.stopPropagation(),a.preventDefault())},b.prototype.destroy=function(){var b=this;b.autoPlayClear(),b.touchObject={},a(".slick-cloned",b.$slider).remove(),b.$dots&&b.$dots.remove(),b.$prevArrow&&"object"!=typeof b.options.prevArrow&&b.$prevArrow.remove(),b.$nextArrow&&"object"!=typeof b.options.nextArrow&&b.$nextArrow.remove(),b.$slides.parent().hasClass("slick-track")&&b.$slides.unwrap().unwrap(),b.$slides.removeClass("slick-slide slick-active slick-center slick-visible").removeAttr("index").css({position:"",left:"",top:"",zIndex:"",opacity:"",width:""}),b.$slider.removeClass("slick-slider"),b.$slider.removeClass("slick-initialized"),b.$list.off(".slick"),a(window).off(".slick-"+b.instanceUid),a(document).off(".slick-"+b.instanceUid)},b.prototype.disableTransition=function(a){var b=this,c={};c[b.transitionType]="",b.options.fade===!1?b.$slideTrack.css(c):b.$slides.eq(a).css(c)},b.prototype.fadeSlide=function(a,b,c){var d=this;d.cssTransitions===!1?(d.$slides.eq(b).css({zIndex:1e3}),d.$slides.eq(b).animate({opacity:1},d.options.speed,d.options.easing,c),d.$slides.eq(a).animate({opacity:0},d.options.speed,d.options.easing)):(d.applyTransition(b),d.applyTransition(a),d.$slides.eq(b).css({opacity:1,zIndex:1e3}),d.$slides.eq(a).css({opacity:0}),c&&setTimeout(function(){d.disableTransition(b),d.disableTransition(a),c.call()},d.options.speed))},b.prototype.filterSlides=function(a){var b=this;null!==a&&(b.unload(),b.$slideTrack.children(this.options.slide).detach(),b.$slidesCache.filter(a).appendTo(b.$slideTrack),b.reinit())},b.prototype.getCurrent=function(){var a=this;return a.currentSlide},b.prototype.getDotCount=function(){var a=this,b=0,c=0,d=0;if(a.options.infinite===!0)d=Math.ceil(a.slideCount/a.options.slidesToScroll);else for(;b<a.slideCount;)++d,b=c+a.options.slidesToShow,c+=a.options.slidesToScroll<=a.options.slidesToShow?a.options.slidesToScroll:a.options.slidesToShow;return d-1},b.prototype.getLeft=function(a){var c,d,g,b=this,e=0;return b.slideOffset=0,d=b.$slides.first().outerHeight(),b.options.infinite===!0?(b.slideCount>b.options.slidesToShow&&(b.slideOffset=-1*b.slideWidth*b.options.slidesToShow,e=-1*d*b.options.slidesToShow),0!==b.slideCount%b.options.slidesToScroll&&a+b.options.slidesToScroll>b.slideCount&&b.slideCount>b.options.slidesToShow&&(a>b.slideCount?(b.slideOffset=-1*(b.options.slidesToShow-(a-b.slideCount))*b.slideWidth,e=-1*(b.options.slidesToShow-(a-b.slideCount))*d):(b.slideOffset=-1*b.slideCount%b.options.slidesToScroll*b.slideWidth,e=-1*b.slideCount%b.options.slidesToScroll*d))):a+b.options.slidesToShow>b.slideCount&&(b.slideOffset=(a+b.options.slidesToShow-b.slideCount)*b.slideWidth,e=(a+b.options.slidesToShow-b.slideCount)*d),b.slideCount<=b.options.slidesToShow&&(b.slideOffset=0,e=0),b.options.centerMode===!0&&b.options.infinite===!0?b.slideOffset+=b.slideWidth*Math.floor(b.options.slidesToShow/2)-b.slideWidth:b.options.centerMode===!0&&(b.slideOffset=0,b.slideOffset+=b.slideWidth*Math.floor(b.options.slidesToShow/2)),c=b.options.vertical===!1?-1*a*b.slideWidth+b.slideOffset:-1*a*d+e,b.options.variableWidth===!0&&(g=b.slideCount<=b.options.slidesToShow||b.options.infinite===!1?b.$slideTrack.children(".slick-slide").eq(a):b.$slideTrack.children(".slick-slide").eq(a+b.options.slidesToShow),c=g[0]?-1*g[0].offsetLeft:0,b.options.centerMode===!0&&(g=b.options.infinite===!1?b.$slideTrack.children(".slick-slide").eq(a):b.$slideTrack.children(".slick-slide").eq(a+b.options.slidesToShow+1),c=g[0]?-1*g[0].offsetLeft:0,c+=(b.$list.width()-g.outerWidth())/2)),c},b.prototype.getNavigableIndexes=function(){for(var a=this,b=0,c=0,d=[];b<a.slideCount;)d.push(b),b=c+a.options.slidesToScroll,c+=a.options.slidesToScroll<=a.options.slidesToShow?a.options.slidesToScroll:a.options.slidesToShow;return d},b.prototype.getSlideCount=function(){var c,b=this;if(b.options.swipeToSlide===!0){var d=null;return b.$slideTrack.find(".slick-slide").each(function(c,e){return e.offsetLeft+a(e).outerWidth()/2>-1*b.swipeLeft?(d=e,!1):void 0}),c=Math.abs(a(d).attr("index")-b.currentSlide)}return b.options.slidesToScroll},b.prototype.init=function(){var b=this;a(b.$slider).hasClass("slick-initialized")||(a(b.$slider).addClass("slick-initialized"),b.buildOut(),b.setProps(),b.startLoad(),b.loadSlider(),b.initializeEvents(),b.updateArrows(),b.updateDots()),null!==b.options.onInit&&b.options.onInit.call(this,b)},b.prototype.initArrowEvents=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.on("click.slick",{message:"previous"},a.changeSlide),a.$nextArrow.on("click.slick",{message:"next"},a.changeSlide))},b.prototype.initDotEvents=function(){var b=this;b.options.dots===!0&&b.slideCount>b.options.slidesToShow&&a("li",b.$dots).on("click.slick",{message:"index"},b.changeSlide),b.options.dots===!0&&b.options.pauseOnDotsHover===!0&&b.options.autoplay===!0&&a("li",b.$dots).on("mouseenter.slick",function(){b.paused=!0,b.autoPlayClear()}).on("mouseleave.slick",function(){b.paused=!1,b.autoPlay()})},b.prototype.initializeEvents=function(){var b=this;b.initArrowEvents(),b.initDotEvents(),b.$list.on("touchstart.slick mousedown.slick",{action:"start"},b.swipeHandler),b.$list.on("touchmove.slick mousemove.slick",{action:"move"},b.swipeHandler),b.$list.on("touchend.slick mouseup.slick",{action:"end"},b.swipeHandler),b.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},b.swipeHandler),b.$list.on("click.slick",b.clickHandler),b.options.pauseOnHover===!0&&b.options.autoplay===!0&&(b.$list.on("mouseenter.slick",function(){b.paused=!0,b.autoPlayClear()}),b.$list.on("mouseleave.slick",function(){b.paused=!1,b.autoPlay()})),b.options.accessibility===!0&&b.$list.on("keydown.slick",b.keyHandler),b.options.focusOnSelect===!0&&a(b.options.slide,b.$slideTrack).on("click.slick",b.selectHandler),a(window).on("orientationchange.slick.slick-"+b.instanceUid,function(){b.checkResponsive(),b.setPosition()}),a(window).on("resize.slick.slick-"+b.instanceUid,function(){a(window).width()!==b.windowWidth&&(clearTimeout(b.windowDelay),b.windowDelay=window.setTimeout(function(){b.windowWidth=a(window).width(),b.checkResponsive(),b.setPosition()},50))}),a("*[draggable!=true]",b.$slideTrack).on("dragstart",function(a){a.preventDefault()}),a(window).on("load.slick.slick-"+b.instanceUid,b.setPosition),a(document).on("ready.slick.slick-"+b.instanceUid,b.setPosition)},b.prototype.initUI=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.show(),a.$nextArrow.show()),a.options.dots===!0&&a.slideCount>a.options.slidesToShow&&a.$dots.show(),a.options.autoplay===!0&&a.autoPlay()},b.prototype.keyHandler=function(a){var b=this;37===a.keyCode&&b.options.accessibility===!0?b.changeSlide({data:{message:"previous"}}):39===a.keyCode&&b.options.accessibility===!0&&b.changeSlide({data:{message:"next"}})},b.prototype.lazyLoad=function(){function g(b){a("img[data-lazy]",b).each(function(){var b=a(this),c=a(this).attr("data-lazy");b.load(function(){b.animate({opacity:1},200)}).css({opacity:0}).attr("src",c).removeAttr("data-lazy").removeClass("slick-loading")})}var c,d,e,f,b=this;b.options.centerMode===!0?b.options.infinite===!0?(e=b.currentSlide+(b.options.slidesToShow/2+1),f=e+b.options.slidesToShow+2):(e=Math.max(0,b.currentSlide-(b.options.slidesToShow/2+1)),f=2+(b.options.slidesToShow/2+1)+b.currentSlide):(e=b.options.infinite?b.options.slidesToShow+b.currentSlide:b.currentSlide,f=e+b.options.slidesToShow,b.options.fade===!0&&(e>0&&e--,f<=b.slideCount&&f++)),c=b.$slider.find(".slick-slide").slice(e,f),g(c),b.slideCount<=b.options.slidesToShow?(d=b.$slider.find(".slick-slide"),g(d)):b.currentSlide>=b.slideCount-b.options.slidesToShow?(d=b.$slider.find(".slick-cloned").slice(0,b.options.slidesToShow),g(d)):0===b.currentSlide&&(d=b.$slider.find(".slick-cloned").slice(-1*b.options.slidesToShow),g(d))},b.prototype.loadSlider=function(){var a=this;a.setPosition(),a.$slideTrack.css({opacity:1}),a.$slider.removeClass("slick-loading"),a.initUI(),"progressive"===a.options.lazyLoad&&a.progressiveLazyLoad()},b.prototype.postSlide=function(a){var b=this;null!==b.options.onAfterChange&&b.options.onAfterChange.call(this,b,a),b.animating=!1,b.setPosition(),b.swipeLeft=null,b.options.autoplay===!0&&b.paused===!1&&b.autoPlay()},b.prototype.progressiveLazyLoad=function(){var c,d,b=this;c=a("img[data-lazy]",b.$slider).length,c>0&&(d=a("img[data-lazy]",b.$slider).first(),d.attr("src",d.attr("data-lazy")).removeClass("slick-loading").load(function(){d.removeAttr("data-lazy"),b.progressiveLazyLoad()}).error(function(){d.removeAttr("data-lazy"),b.progressiveLazyLoad()}))},b.prototype.refresh=function(){var b=this,c=b.currentSlide;b.destroy(),a.extend(b,b.initials),b.init(),b.changeSlide({data:{message:"index",index:c}},!0)},b.prototype.reinit=function(){var b=this;b.$slides=b.$slideTrack.children(b.options.slide).addClass("slick-slide"),b.slideCount=b.$slides.length,b.currentSlide>=b.slideCount&&0!==b.currentSlide&&(b.currentSlide=b.currentSlide-b.options.slidesToScroll),b.slideCount<=b.options.slidesToShow&&(b.currentSlide=0),b.setProps(),b.setupInfinite(),b.buildArrows(),b.updateArrows(),b.initArrowEvents(),b.buildDots(),b.updateDots(),b.initDotEvents(),b.options.focusOnSelect===!0&&a(b.options.slide,b.$slideTrack).on("click.slick",b.selectHandler),b.setSlideClasses(0),b.setPosition(),null!==b.options.onReInit&&b.options.onReInit.call(this,b)},b.prototype.removeSlide=function(a,b,c){var d=this;return"boolean"==typeof a?(b=a,a=b===!0?0:d.slideCount-1):a=b===!0?--a:a,d.slideCount<1||0>a||a>d.slideCount-1?!1:(d.unload(),c===!0?d.$slideTrack.children().remove():d.$slideTrack.children(this.options.slide).eq(a).remove(),d.$slides=d.$slideTrack.children(this.options.slide),d.$slideTrack.children(this.options.slide).detach(),d.$slideTrack.append(d.$slides),d.$slidesCache=d.$slides,d.reinit(),void 0)},b.prototype.setCSS=function(a){var d,e,b=this,c={};b.options.rtl===!0&&(a=-a),d="left"==b.positionProp?a+"px":"0px",e="top"==b.positionProp?a+"px":"0px",c[b.positionProp]=a,b.transformsEnabled===!1?b.$slideTrack.css(c):(c={},b.cssTransitions===!1?(c[b.animType]="translate("+d+", "+e+")",b.$slideTrack.css(c)):(c[b.animType]="translate3d("+d+", "+e+", 0px)",b.$slideTrack.css(c)))},b.prototype.setDimensions=function(){var b=this;if(b.options.vertical===!1?b.options.centerMode===!0&&b.$list.css({padding:"0px "+b.options.centerPadding}):(b.$list.height(b.$slides.first().outerHeight(!0)*b.options.slidesToShow),b.options.centerMode===!0&&b.$list.css({padding:b.options.centerPadding+" 0px"})),b.listWidth=b.$list.width(),b.listHeight=b.$list.height(),b.options.vertical===!1&&b.options.variableWidth===!1)b.slideWidth=Math.ceil(b.listWidth/b.options.slidesToShow),b.$slideTrack.width(Math.ceil(b.slideWidth*b.$slideTrack.children(".slick-slide").length));else if(b.options.variableWidth===!0){var c=0;b.slideWidth=Math.ceil(b.listWidth/b.options.slidesToShow),b.$slideTrack.children(".slick-slide").each(function(){c+=Math.ceil(a(this).outerWidth(!0))}),b.$slideTrack.width(Math.ceil(c)+1)}else b.slideWidth=Math.ceil(b.listWidth),b.$slideTrack.height(Math.ceil(b.$slides.first().outerHeight(!0)*b.$slideTrack.children(".slick-slide").length));var d=b.$slides.first().outerWidth(!0)-b.$slides.first().width();b.options.variableWidth===!1&&b.$slideTrack.children(".slick-slide").width(b.slideWidth-d)},b.prototype.setFade=function(){var c,b=this;b.$slides.each(function(d,e){c=-1*b.slideWidth*d,b.options.rtl===!0?a(e).css({position:"relative",right:c,top:0,zIndex:800,opacity:0}):a(e).css({position:"relative",left:c,top:0,zIndex:800,opacity:0})}),b.$slides.eq(b.currentSlide).css({zIndex:900,opacity:1})},b.prototype.setHeight=function(){var a=this;if(1===a.options.slidesToShow&&a.options.adaptiveHeight===!0&&a.options.vertical===!1){var b=a.$slides.eq(a.currentSlide).outerHeight(!0);a.$list.css("height",b)}},b.prototype.setPosition=function(){var a=this;a.setDimensions(),a.setHeight(),a.options.fade===!1?a.setCSS(a.getLeft(a.currentSlide)):a.setFade(),null!==a.options.onSetPosition&&a.options.onSetPosition.call(this,a)},b.prototype.setProps=function(){var a=this,b=document.body.style;a.positionProp=a.options.vertical===!0?"top":"left","top"===a.positionProp?a.$slider.addClass("slick-vertical"):a.$slider.removeClass("slick-vertical"),(void 0!==b.WebkitTransition||void 0!==b.MozTransition||void 0!==b.msTransition)&&a.options.useCSS===!0&&(a.cssTransitions=!0),void 0!==b.OTransform&&(a.animType="OTransform",a.transformType="-o-transform",a.transitionType="OTransition",void 0===b.perspectiveProperty&&void 0===b.webkitPerspective&&(a.animType=!1)),void 0!==b.MozTransform&&(a.animType="MozTransform",a.transformType="-moz-transform",a.transitionType="MozTransition",void 0===b.perspectiveProperty&&void 0===b.MozPerspective&&(a.animType=!1)),void 0!==b.webkitTransform&&(a.animType="webkitTransform",a.transformType="-webkit-transform",a.transitionType="webkitTransition",void 0===b.perspectiveProperty&&void 0===b.webkitPerspective&&(a.animType=!1)),void 0!==b.msTransform&&(a.animType="msTransform",a.transformType="-ms-transform",a.transitionType="msTransition",void 0===b.msTransform&&(a.animType=!1)),void 0!==b.transform&&a.animType!==!1&&(a.animType="transform",a.transformType="transform",a.transitionType="transition"),a.transformsEnabled=null!==a.animType&&a.animType!==!1},b.prototype.setSlideClasses=function(a){var c,d,e,f,b=this;b.$slider.find(".slick-slide").removeClass("slick-active").removeClass("slick-center"),d=b.$slider.find(".slick-slide"),b.options.centerMode===!0?(c=Math.floor(b.options.slidesToShow/2),b.options.infinite===!0&&(a>=c&&a<=b.slideCount-1-c?b.$slides.slice(a-c,a+c+1).addClass("slick-active"):(e=b.options.slidesToShow+a,d.slice(e-c+1,e+c+2).addClass("slick-active")),0===a?d.eq(d.length-1-b.options.slidesToShow).addClass("slick-center"):a===b.slideCount-1&&d.eq(b.options.slidesToShow).addClass("slick-center")),b.$slides.eq(a).addClass("slick-center")):a>=0&&a<=b.slideCount-b.options.slidesToShow?b.$slides.slice(a,a+b.options.slidesToShow).addClass("slick-active"):d.length<=b.options.slidesToShow?d.addClass("slick-active"):(f=b.slideCount%b.options.slidesToShow,e=b.options.infinite===!0?b.options.slidesToShow+a:a,b.options.slidesToShow==b.options.slidesToScroll&&b.slideCount-a<b.options.slidesToShow?d.slice(e-(b.options.slidesToShow-f),e+f).addClass("slick-active"):d.slice(e,e+b.options.slidesToShow).addClass("slick-active")),"ondemand"===b.options.lazyLoad&&b.lazyLoad()},b.prototype.setupInfinite=function(){var c,d,e,b=this;if(b.options.fade===!0&&(b.options.centerMode=!1),b.options.infinite===!0&&b.options.fade===!1&&(d=null,b.slideCount>b.options.slidesToShow)){for(e=b.options.centerMode===!0?b.options.slidesToShow+1:b.options.slidesToShow,c=b.slideCount;c>b.slideCount-e;c-=1)d=c-1,a(b.$slides[d]).clone(!0).attr("id","").attr("index",d-b.slideCount).prependTo(b.$slideTrack).addClass("slick-cloned");for(c=0;e>c;c+=1)d=c,a(b.$slides[d]).clone(!0).attr("id","").attr("index",d+b.slideCount).appendTo(b.$slideTrack).addClass("slick-cloned");b.$slideTrack.find(".slick-cloned").find("[id]").each(function(){a(this).attr("id","")})}},b.prototype.selectHandler=function(b){var c=this,d=parseInt(a(b.target).parents(".slick-slide").attr("index"));return d||(d=0),c.slideCount<=c.options.slidesToShow?(c.$slider.find(".slick-slide").removeClass("slick-active"),c.$slides.eq(d).addClass("slick-active"),c.options.centerMode===!0&&(c.$slider.find(".slick-slide").removeClass("slick-center"),c.$slides.eq(d).addClass("slick-center")),c.asNavFor(d),void 0):(c.slideHandler(d),void 0)},b.prototype.slideHandler=function(a,b,c){var d,e,f,g,i=null,j=this;return b=b||!1,j.animating===!0&&j.options.waitForAnimate===!0||j.options.fade===!0&&j.currentSlide===a||j.slideCount<=j.options.slidesToShow?void 0:(b===!1&&j.asNavFor(a),d=a,i=j.getLeft(d),g=j.getLeft(j.currentSlide),j.currentLeft=null===j.swipeLeft?g:j.swipeLeft,j.options.infinite===!1&&j.options.centerMode===!1&&(0>a||a>j.getDotCount()*j.options.slidesToScroll)?(j.options.fade===!1&&(d=j.currentSlide,c!==!0?j.animateSlide(g,function(){j.postSlide(d)}):j.postSlide(d)),void 0):j.options.infinite===!1&&j.options.centerMode===!0&&(0>a||a>j.slideCount-j.options.slidesToScroll)?(j.options.fade===!1&&(d=j.currentSlide,c!==!0?j.animateSlide(g,function(){j.postSlide(d)}):j.postSlide(d)),void 0):(j.options.autoplay===!0&&clearInterval(j.autoPlayTimer),e=0>d?0!==j.slideCount%j.options.slidesToScroll?j.slideCount-j.slideCount%j.options.slidesToScroll:j.slideCount+d:d>=j.slideCount?0!==j.slideCount%j.options.slidesToScroll?0:d-j.slideCount:d,j.animating=!0,null!==j.options.onBeforeChange&&a!==j.currentSlide&&j.options.onBeforeChange.call(this,j,j.currentSlide,e),f=j.currentSlide,j.currentSlide=e,j.setSlideClasses(j.currentSlide),j.updateDots(),j.updateArrows(),j.options.fade===!0?(c!==!0?j.fadeSlide(f,e,function(){j.postSlide(e)}):j.postSlide(e),void 0):(c!==!0?j.animateSlide(i,function(){j.postSlide(e)}):j.postSlide(e),void 0)))},b.prototype.startLoad=function(){var a=this;a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.hide(),a.$nextArrow.hide()),a.options.dots===!0&&a.slideCount>a.options.slidesToShow&&a.$dots.hide(),a.$slider.addClass("slick-loading")},b.prototype.swipeDirection=function(){var a,b,c,d,e=this;return a=e.touchObject.startX-e.touchObject.curX,b=e.touchObject.startY-e.touchObject.curY,c=Math.atan2(b,a),d=Math.round(180*c/Math.PI),0>d&&(d=360-Math.abs(d)),45>=d&&d>=0?e.options.rtl===!1?"left":"right":360>=d&&d>=315?e.options.rtl===!1?"left":"right":d>=135&&225>=d?e.options.rtl===!1?"right":"left":"vertical"},b.prototype.swipeEnd=function(){var b=this;if(b.dragging=!1,b.shouldClick=b.touchObject.swipeLength>10?!1:!0,void 0===b.touchObject.curX)return!1;if(b.touchObject.swipeLength>=b.touchObject.minSwipe)switch(b.swipeDirection()){case"left":b.slideHandler(b.currentSlide+b.getSlideCount()),b.currentDirection=0,b.touchObject={};break;case"right":b.slideHandler(b.currentSlide-b.getSlideCount()),b.currentDirection=1,b.touchObject={}}else b.touchObject.startX!==b.touchObject.curX&&(b.slideHandler(b.currentSlide),b.touchObject={})},b.prototype.swipeHandler=function(a){var b=this;if(!(b.options.swipe===!1||"ontouchend"in document&&b.options.swipe===!1||b.options.draggable===!1&&-1!==a.type.indexOf("mouse")))switch(b.touchObject.fingerCount=a.originalEvent&&void 0!==a.originalEvent.touches?a.originalEvent.touches.length:1,b.touchObject.minSwipe=b.listWidth/b.options.touchThreshold,a.data.action){case"start":b.swipeStart(a);break;case"move":b.swipeMove(a);break;case"end":b.swipeEnd(a)}},b.prototype.swipeMove=function(a){var c,d,e,f,b=this;return f=void 0!==a.originalEvent?a.originalEvent.touches:null,!b.dragging||f&&1!==f.length?!1:(c=b.getLeft(b.currentSlide),b.touchObject.curX=void 0!==f?f[0].pageX:a.clientX,b.touchObject.curY=void 0!==f?f[0].pageY:a.clientY,b.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(b.touchObject.curX-b.touchObject.startX,2))),d=b.swipeDirection(),"vertical"!==d?(void 0!==a.originalEvent&&b.touchObject.swipeLength>4&&a.preventDefault(),e=(b.options.rtl===!1?1:-1)*(b.touchObject.curX>b.touchObject.startX?1:-1),b.swipeLeft=b.options.vertical===!1?c+b.touchObject.swipeLength*e:c+b.touchObject.swipeLength*(b.$list.height()/b.listWidth)*e,b.options.fade===!0||b.options.touchMove===!1?!1:b.animating===!0?(b.swipeLeft=null,!1):(b.setCSS(b.swipeLeft),void 0)):void 0)},b.prototype.swipeStart=function(a){var c,b=this;return 1!==b.touchObject.fingerCount||b.slideCount<=b.options.slidesToShow?(b.touchObject={},!1):(void 0!==a.originalEvent&&void 0!==a.originalEvent.touches&&(c=a.originalEvent.touches[0]),b.touchObject.startX=b.touchObject.curX=void 0!==c?c.pageX:a.clientX,b.touchObject.startY=b.touchObject.curY=void 0!==c?c.pageY:a.clientY,b.dragging=!0,void 0)},b.prototype.unfilterSlides=function(){var a=this;null!==a.$slidesCache&&(a.unload(),a.$slideTrack.children(this.options.slide).detach(),a.$slidesCache.appendTo(a.$slideTrack),a.reinit())},b.prototype.unload=function(){var b=this;a(".slick-cloned",b.$slider).remove(),b.$dots&&b.$dots.remove(),b.$prevArrow&&"object"!=typeof b.options.prevArrow&&b.$prevArrow.remove(),b.$nextArrow&&"object"!=typeof b.options.nextArrow&&b.$nextArrow.remove(),b.$slides.removeClass("slick-slide slick-active slick-visible").css("width","")},b.prototype.updateArrows=function(){var b,a=this;b=Math.floor(a.options.slidesToShow/2),a.options.arrows===!0&&a.options.infinite!==!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow.removeClass("slick-disabled"),a.$nextArrow.removeClass("slick-disabled"),0===a.currentSlide?(a.$prevArrow.addClass("slick-disabled"),a.$nextArrow.removeClass("slick-disabled")):a.currentSlide>=a.slideCount-a.options.slidesToShow&&a.options.centerMode===!1?(a.$nextArrow.addClass("slick-disabled"),a.$prevArrow.removeClass("slick-disabled")):a.currentSlide>a.slideCount-a.options.slidesToShow+b&&a.options.centerMode===!0&&(a.$nextArrow.addClass("slick-disabled"),a.$prevArrow.removeClass("slick-disabled")))},b.prototype.updateDots=function(){var a=this;null!==a.$dots&&(a.$dots.find("li").removeClass("slick-active"),a.$dots.find("li").eq(Math.floor(a.currentSlide/a.options.slidesToScroll)).addClass("slick-active"))},a.fn.slick=function(a){var c=this;return c.each(function(c,d){d.slick=new b(d,a)})},a.fn.slickAdd=function(a,b,c){var d=this;return d.each(function(d,e){e.slick.addSlide(a,b,c)})},a.fn.slickCurrentSlide=function(){var a=this;return a.get(0).slick.getCurrent()},a.fn.slickFilter=function(a){var b=this;return b.each(function(b,c){c.slick.filterSlides(a)})},a.fn.slickGoTo=function(a,b){var c=this;return c.each(function(c,d){d.slick.changeSlide({data:{message:"index",index:parseInt(a)}},b)})},a.fn.slickNext=function(){var a=this;return a.each(function(a,b){b.slick.changeSlide({data:{message:"next"}})})},a.fn.slickPause=function(){var a=this;return a.each(function(a,b){b.slick.autoPlayClear(),b.slick.paused=!0})},a.fn.slickPlay=function(){var a=this;return a.each(function(a,b){b.slick.paused=!1,b.slick.autoPlay()})},a.fn.slickPrev=function(){var a=this;return a.each(function(a,b){b.slick.changeSlide({data:{message:"previous"}})})},a.fn.slickRemove=function(a,b){var c=this;return c.each(function(c,d){d.slick.removeSlide(a,b)})},a.fn.slickRemoveAll=function(){var a=this;return a.each(function(a,b){b.slick.removeSlide(null,null,!0)})},a.fn.slickGetOption=function(a){var b=this;return b.get(0).slick.options[a]},a.fn.slickSetOption=function(a,b,c){var d=this;return d.each(function(d,e){e.slick.options[a]=b,c===!0&&(e.slick.unload(),e.slick.reinit())})},a.fn.slickUnfilter=function(){var a=this;return a.each(function(a,b){b.slick.unfilterSlides()})},a.fn.unslick=function(){var a=this;return a.each(function(a,b){b.slick&&b.slick.destroy()})},a.fn.getSlick=function(){var a=null,b=this;return b.each(function(b,c){a=c.slick}),a}});
  46. /* Jonathan Snook - MIT License - https://github.com/snookca/prepareTransition */
  47. !(function(a){a.fn.prepareTransition=function(){return this.each(function(){var b=a(this);b.one("TransitionEnd webkitTransitionEnd transitionend oTransitionEnd",function(){b.removeClass("is-transitioning")});var c=["transition-duration","-moz-transition-duration","-webkit-transition-duration","-o-transition-duration"];var d=0;a.each(c,function(a,c){d=parseFloat(b.css(c))||d});if(d!=0){b.addClass("is-transitioning");b[0].offsetWidth}})}})(jQuery);
  48.  
  49. /* replaceUrlParam - http://stackoverflow.com/questions/7171099/how-to-replace-url-parameter-with-javascript-jquery */
  50. function replaceUrlParam(e,r,a){var n=new RegExp("("+r+"=).*?(&|$)"),c=e;return c=e.search(n)>=0?e.replace(n,"$1"+a+"$2"):c+(c.indexOf("?")>0?"&":"?")+r+"="+a};
  51.  
  52. /**
  53. * @license
  54. * lodash 4.5.1 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
  55. * Build: `lodash core -o ./dist/lodash.core.js`
  56. */
  57. ;(function(){function n(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function t(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(c===an?i===i:r(i,c)))var c=i,f=o}return f}function r(n,t,r){var e;return r(n,function(n,r,u){return t(n,r,u)?(e=n,false):void 0}),e}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return O(t,function(t){return n[t]})}function o(n){return n&&n.Object===Object?n:null}function i(n){return vn[n];
  58. }function c(n){var t=false;if(null!=n&&typeof n.toString!="function")try{t=!!(n+"")}catch(r){}return t}function f(n,t){return n=typeof n=="number"||hn.test(n)?+n:-1,n>-1&&0==n%1&&(null==t?9007199254740991:t)>n}function a(n){if(Y(n)&&!Pn(n)){if(n instanceof l)return n;if(En.call(n,"__wrapped__")){var t=new l(n.__wrapped__,n.__chain__);return t.__actions__=N(n.__actions__),t}}return new l(n)}function l(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function p(n,t,r,e){var u;return(u=n===an)||(u=xn[r],
  59. u=(n===u||n!==n&&u!==u)&&!En.call(e,r)),u?t:n}function s(n){return X(n)?Fn(n):{}}function h(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(an,r)},t)}function v(n,t){var r=true;return $n(n,function(n,e,u){return r=!!t(n,e,u)}),r}function y(n,t){var r=[];return $n(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function _(t,r,e,u){u||(u=[]);for(var o=-1,i=t.length;++o<i;){var c=t[o];r>0&&Y(c)&&L(c)&&(e||Pn(c)||K(c))?r>1?_(c,r-1,e,u):n(u,c):e||(u[u.length]=c);
  60. }return u}function g(n,t){return n&&qn(n,t,en)}function b(n,t){return y(t,function(t){return Q(n[t])})}function j(n,t,r,e,u){return n===t?true:null==n||null==t||!X(n)&&!Y(t)?n!==n&&t!==t:m(n,t,j,r,e,u)}function m(n,t,r,e,u,o){var i=Pn(n),f=Pn(t),a="[object Array]",l="[object Array]";i||(a=kn.call(n),"[object Arguments]"==a&&(a="[object Object]")),f||(l=kn.call(t),"[object Arguments]"==l&&(l="[object Object]"));var p="[object Object]"==a&&!c(n),f="[object Object]"==l&&!c(t);return!(l=a==l)||i||p?2&u||(a=p&&En.call(n,"__wrapped__"),
  61. f=f&&En.call(t,"__wrapped__"),!a&&!f)?l?(o||(o=[]),(a=J(o,function(t){return t[0]===n}))&&a[1]?a[1]==t:(o.push([n,t]),t=(i?I:q)(n,t,r,e,u,o),o.pop(),t)):false:r(a?n.value():n,f?t.value():t,e,u,o):$(n,t,a)}function d(n){var t=typeof n;return"function"==t?n:null==n?cn:("object"==t?x:A)(n)}function w(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function O(n,t){var r=-1,e=L(n)?Array(n.length):[];return $n(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function x(n){var t=en(n);return function(r){
  62. var e=t.length;if(null==r)return!e;for(r=Object(r);e--;){var u=t[e];if(!(u in r&&j(n[u],r[u],an,3)))return false}return true}}function E(n,t){return n=Object(n),P(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function A(n){return function(t){return null==t?an:t[n]}}function k(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function N(n){return k(n,0,n.length)}function S(n,t){var r;return $n(n,function(n,e,u){return r=t(n,e,u),
  63. !r}),!!r}function T(t,r){return P(r,function(t,r){return r.func.apply(r.thisArg,n([t],r.args))},t)}function F(n,t,r,e){r||(r={});for(var u=-1,o=t.length;++u<o;){var i=t[u],c=e?e(r[i],n[i],i,r,n):n[i],f=r,a=f[i];En.call(f,i)&&(a===c||a!==a&&c!==c)&&(c!==an||i in f)||(f[i]=c)}return r}function R(n){return V(function(t,r){var e=-1,u=r.length,o=u>1?r[u-1]:an,o=typeof o=="function"?(u--,o):an;for(t=Object(t);++e<u;){var i=r[e];i&&n(t,i,e,o)}return t})}function B(n){return function(){var t=arguments,r=s(n.prototype),t=n.apply(r,t);
  64. return X(t)?t:r}}function D(n,t,r){function e(){for(var o=-1,i=arguments.length,c=-1,f=r.length,a=Array(f+i),l=this&&this!==wn&&this instanceof e?u:n;++c<f;)a[c]=r[c];for(;i--;)a[c++]=arguments[++o];return l.apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");var u=B(n);return e}function I(n,t,r,e,u,o){var i=-1,c=1&u,f=n.length,a=t.length;if(f!=a&&!(2&u&&a>f))return false;for(a=true;++i<f;){var l=n[i],p=t[i];if(void 0!==an){a=false;break}if(c){if(!S(t,function(n){return l===n||r(l,n,e,u,o);
  65. })){a=false;break}}else if(l!==p&&!r(l,p,e,u,o)){a=false;break}}return a}function $(n,t,r){switch(r){case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object Number]":return n!=+n?t!=+t:n==+t;case"[object RegExp]":case"[object String]":return n==t+""}return false}function q(n,t,r,e,u,o){var i=2&u,c=en(n),f=c.length,a=en(t).length;if(f!=a&&!i)return false;for(var l=f;l--;){var p=c[l];if(!(i?p in t:En.call(t,p)))return false}for(a=true;++l<f;){
  66. var p=c[l],s=n[p],h=t[p];if(void 0!==an||s!==h&&!r(s,h,e,u,o)){a=false;break}i||(i="constructor"==p)}return a&&!i&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(a=false)),a}function z(n){var t=n?n.length:an;if(W(t)&&(Pn(n)||nn(n)||K(n))){n=String;for(var r=-1,e=Array(t);++r<t;)e[r]=n(r);t=e}else t=null;return t}function C(n){var t=n&&n.constructor,t=Q(t)&&t.prototype||xn;return n===t}function G(n){
  67. return n?n[0]:an}function J(n,t){return r(n,d(t),$n)}function M(n,t){return $n(n,typeof t=="function"?t:cn)}function P(n,t,r){return e(n,d(t),r,3>arguments.length,$n)}function U(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Un(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=an),r}}function V(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");return t=In(t===an?n.length-1:Un(t),0),function(){for(var r=arguments,e=-1,u=In(r.length-t,0),o=Array(u);++e<u;)o[e]=r[t+e];
  68. for(u=Array(t+1),e=-1;++e<t;)u[e]=r[e];return u[t]=o,n.apply(this,u)}}function H(n,t){return n>t}function K(n){return Y(n)&&L(n)&&En.call(n,"callee")&&(!Rn.call(n,"callee")||"[object Arguments]"==kn.call(n))}function L(n){return null!=n&&!(typeof n=="function"&&Q(n))&&W(zn(n))}function Q(n){return n=X(n)?kn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n}function W(n){return typeof n=="number"&&n>-1&&0==n%1&&9007199254740991>=n}function X(n){var t=typeof n;return!!n&&("object"==t||"function"==t);
  69. }function Y(n){return!!n&&typeof n=="object"}function Z(n){return typeof n=="number"||Y(n)&&"[object Number]"==kn.call(n)}function nn(n){return typeof n=="string"||!Pn(n)&&Y(n)&&"[object String]"==kn.call(n)}function tn(n,t){return t>n}function rn(n){return typeof n=="string"?n:null==n?"":n+""}function en(n){var t=C(n);if(!t&&!L(n))return Dn(Object(n));var r,e=z(n),u=!!e,e=e||[],o=e.length;for(r in n)!En.call(n,r)||u&&("length"==r||f(r,o))||t&&"constructor"==r||e.push(r);return e}function un(n){for(var t=-1,r=C(n),e=w(n),u=e.length,o=z(n),i=!!o,o=o||[],c=o.length;++t<u;){
  70. var a=e[t];i&&("length"==a||f(a,c))||"constructor"==a&&(r||!En.call(n,a))||o.push(a)}return o}function on(n){return n?u(n,en(n)):[]}function cn(n){return n}function fn(t,r,e){var u=en(r),o=b(r,u);null!=e||X(r)&&(o.length||!u.length)||(e=r,r=t,t=this,o=b(r,en(r)));var i=X(e)&&"chain"in e?e.chain:true,c=Q(t);return $n(o,function(e){var u=r[e];t[e]=u,c&&(t.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=t(this.__wrapped__);return(e.__actions__=N(this.__actions__)).push({func:u,args:arguments,
  71. thisArg:t}),e.__chain__=r,e}return u.apply(t,n([this.value()],arguments))})}),t}var an,ln=1/0,pn=/[&<>"'`]/g,sn=RegExp(pn.source),hn=/^(?:0|[1-9]\d*)$/,vn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"},yn={"function":true,object:true},_n=yn[typeof exports]&&exports&&!exports.nodeType?exports:an,gn=yn[typeof module]&&module&&!module.nodeType?module:an,bn=gn&&gn.exports===_n?_n:an,jn=o(yn[typeof self]&&self),mn=o(yn[typeof window]&&window),dn=o(yn[typeof this]&&this),wn=o(_n&&gn&&typeof global=="object"&&global)||mn!==(dn&&dn.window)&&mn||jn||dn||Function("return this")(),On=Array.prototype,xn=Object.prototype,En=xn.hasOwnProperty,An=0,kn=xn.toString,Nn=wn._,Sn=wn.Reflect,Tn=Sn?Sn.f:an,Fn=Object.create,Rn=xn.propertyIsEnumerable,Bn=wn.isFinite,Dn=Object.keys,In=Math.max,$n=function(n,t){
  72. return function(r,e){if(null==r)return r;if(!L(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}(g),qn=function(n){return function(t,r,e){var u=-1,o=Object(t);e=e(t);for(var i=e.length;i--;){var c=e[n?i:++u];if(false===r(o[c],c,o))break}return t}}();Tn&&!Rn.call({valueOf:1},"valueOf")&&(w=function(n){n=Tn(n);for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r});var zn=A("length"),Cn=V(function(t,r){return Pn(t)||(t=null==t?[]:[Object(t)]),_(r,1),
  73. n(N(t),on)}),Gn=V(function(n,t,r){return D(n,t,r)}),Jn=V(function(n,t){return h(n,1,t)}),Mn=V(function(n,t,r){return h(n,Vn(t)||0,r)}),Pn=Array.isArray,Un=Number,Vn=Number,Hn=R(function(n,t){F(t,en(t),n)}),Kn=R(function(n,t){F(t,un(t),n)}),Ln=R(function(n,t,r,e){F(t,un(t),n,e)}),Qn=V(function(n){return n.push(an,p),Ln.apply(an,n)}),Wn=V(function(n,t){return null==n?{}:E(n,_(t,1))}),Xn=d;l.prototype=s(a.prototype),l.prototype.constructor=l,a.assignIn=Kn,a.before=U,a.bind=Gn,a.chain=function(n){return n=a(n),
  74. n.__chain__=true,n},a.compact=function(n){return y(n,Boolean)},a.concat=Cn,a.create=function(n,t){var r=s(n);return t?Hn(r,t):r},a.defaults=Qn,a.defer=Jn,a.delay=Mn,a.filter=function(n,t){return y(n,d(t))},a.flatten=function(n){return n&&n.length?_(n,1):[]},a.flattenDeep=function(n){return n&&n.length?_(n,ln):[]},a.iteratee=Xn,a.keys=en,a.map=function(n,t){return O(n,d(t))},a.matches=function(n){return x(Hn({},n))},a.mixin=fn,a.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");
  75. return function(){return!n.apply(this,arguments)}},a.once=function(n){return U(2,n)},a.pick=Wn,a.slice=function(n,t,r){var e=n?n.length:0;return r=r===an?e:+r,e?k(n,null==t?0:+t,r):[]},a.sortBy=function(n,t){var r=0;return t=d(t),O(O(n,function(n,e,u){return{c:n,b:r++,a:t(n,e,u)}}).sort(function(n,t){var r;n:{r=n.a;var e=t.a;if(r!==e){var u=null===r,o=r===an,i=r===r,c=null===e,f=e===an,a=e===e;if(r>e&&!c||!i||u&&!f&&a||o&&a){r=1;break n}if(e>r&&!u||!a||c&&!o&&i||f&&i){r=-1;break n}}r=0}return r||n.b-t.b;
  76. }),A("c"))},a.tap=function(n,t){return t(n),n},a.thru=function(n,t){return t(n)},a.toArray=function(n){return L(n)?n.length?N(n):[]:on(n)},a.values=on,a.extend=Kn,fn(a,a),a.clone=function(n){return X(n)?Pn(n)?N(n):F(n,en(n)):n},a.escape=function(n){return(n=rn(n))&&sn.test(n)?n.replace(pn,i):n},a.every=function(n,t,r){return t=r?an:t,v(n,d(t))},a.find=J,a.forEach=M,a.has=function(n,t){return null!=n&&En.call(n,t)},a.head=G,a.identity=cn,a.indexOf=function(n,t,r){var e=n?n.length:0;r=typeof r=="number"?0>r?In(e+r,0):r:0,
  77. r=(r||0)-1;for(var u=t===t;++r<e;){var o=n[r];if(u?o===t:o!==o)return r}return-1},a.isArguments=K,a.isArray=Pn,a.isBoolean=function(n){return true===n||false===n||Y(n)&&"[object Boolean]"==kn.call(n)},a.isDate=function(n){return Y(n)&&"[object Date]"==kn.call(n)},a.isEmpty=function(n){if(L(n)&&(Pn(n)||nn(n)||Q(n.splice)||K(n)))return!n.length;for(var t in n)if(En.call(n,t))return false;return true},a.isEqual=function(n,t){return j(n,t)},a.isFinite=function(n){return typeof n=="number"&&Bn(n)},a.isFunction=Q,a.isNaN=function(n){
  78. return Z(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=Z,a.isObject=X,a.isRegExp=function(n){return X(n)&&"[object RegExp]"==kn.call(n)},a.isString=nn,a.isUndefined=function(n){return n===an},a.last=function(n){var t=n?n.length:0;return t?n[t-1]:an},a.max=function(n){return n&&n.length?t(n,cn,H):an},a.min=function(n){return n&&n.length?t(n,cn,tn):an},a.noConflict=function(){return wn._===this&&(wn._=Nn),this},a.noop=function(){},a.reduce=P,a.result=function(n,t,r){return t=null==n?an:n[t],
  79. t===an&&(t=r),Q(t)?t.call(n):t},a.size=function(n){return null==n?0:(n=L(n)?n:en(n),n.length)},a.some=function(n,t,r){return t=r?an:t,S(n,d(t))},a.uniqueId=function(n){var t=++An;return rn(n)+t},a.each=M,a.first=G,fn(a,function(){var n={};return g(a,function(t,r){En.call(a.prototype,r)||(n[r]=t)}),n}(),{chain:false}),a.VERSION="4.5.1",$n("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?String.prototype:On)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);
  80. a.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),a.prototype.toJSON=a.prototype.valueOf=a.prototype.value=function(){return T(this.__wrapped__,this.__actions__)},(mn||jn||{})._=a,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return a}):_n&&gn?(bn&&((gn.exports=a)._=a),_n._=a):wn._=a}).call(this);
  81. /*
  82. * Debounce function
  83. * based on unminified version from http://davidwalsh.name/javascript-debounce-function
  84. */
  85. theme.debounce = function(n,t,u){var e;return function(){var a=this,r=arguments,i=function(){e=null,u||n.apply(a,r)},o=u&&!e;clearTimeout(e),e=setTimeout(i,t),o&&n.apply(a,r)}};
  86.  
  87.  
  88. /* ================ SLATE ================ */
  89. window.theme = window.theme || {};
  90.  
  91. theme.Sections = function Sections() {
  92. this.constructors = {};
  93. this.instances = [];
  94.  
  95. $(document)
  96. .on('shopify:section:load', this._onSectionLoad.bind(this))
  97. .on('shopify:section:unload', this._onSectionUnload.bind(this))
  98. .on('shopify:section:select', this._onSelect.bind(this))
  99. .on('shopify:section:deselect', this._onDeselect.bind(this))
  100. .on('shopify:block:select', this._onBlockSelect.bind(this))
  101. .on('shopify:block:deselect', this._onBlockDeselect.bind(this));
  102. };
  103.  
  104. theme.Sections.prototype = _.assignIn({}, theme.Sections.prototype, {
  105. _createInstance: function(container, constructor) {
  106. var $container = $(container);
  107. var id = $container.attr('data-section-id');
  108. var type = $container.attr('data-section-type');
  109.  
  110. constructor = constructor || this.constructors[type];
  111.  
  112. if (_.isUndefined(constructor)) {
  113. return;
  114. }
  115.  
  116. var instance = _.assignIn(new constructor(container), {
  117. id: id,
  118. type: type,
  119. container: container
  120. });
  121.  
  122. this.instances.push(instance);
  123. },
  124.  
  125. _onSectionLoad: function(evt) {
  126. var container = $('[data-section-id]', evt.target)[0];
  127. if (container) {
  128. this._createInstance(container);
  129. }
  130. },
  131.  
  132. _onSectionUnload: function(evt) {
  133. this.instances = _.filter(this.instances, function(instance) {
  134. var isEventInstance = instance.id === evt.originalEvent.detail.sectionId;
  135.  
  136. if (isEventInstance) {
  137. if (_.isFunction(instance.onUnload)) {
  138. instance.onUnload(evt);
  139. }
  140. }
  141.  
  142. return !isEventInstance;
  143. });
  144. },
  145.  
  146. _onSelect: function(evt) {
  147. // eslint-disable-next-line no-shadow
  148. var instance = _.find(this.instances, function(instance) {
  149. return instance.id === evt.originalEvent.detail.sectionId;
  150. });
  151.  
  152. if (!_.isUndefined(instance) && _.isFunction(instance.onSelect)) {
  153. instance.onSelect(evt);
  154. }
  155. },
  156.  
  157. _onDeselect: function(evt) {
  158. // eslint-disable-next-line no-shadow
  159. var instance = _.find(this.instances, function(instance) {
  160. return instance.id === evt.originalEvent.detail.sectionId;
  161. });
  162.  
  163. if (!_.isUndefined(instance) && _.isFunction(instance.onDeselect)) {
  164. instance.onDeselect(evt);
  165. }
  166. },
  167.  
  168. _onBlockSelect: function(evt) {
  169. // eslint-disable-next-line no-shadow
  170. var instance = _.find(this.instances, function(instance) {
  171. return instance.id === evt.originalEvent.detail.sectionId;
  172. });
  173.  
  174. if (!_.isUndefined(instance) && _.isFunction(instance.onBlockSelect)) {
  175. instance.onBlockSelect(evt);
  176. }
  177. },
  178.  
  179. _onBlockDeselect: function(evt) {
  180. // eslint-disable-next-line no-shadow
  181. var instance = _.find(this.instances, function(instance) {
  182. return instance.id === evt.originalEvent.detail.sectionId;
  183. });
  184.  
  185. if (!_.isUndefined(instance) && _.isFunction(instance.onBlockDeselect)) {
  186. instance.onBlockDeselect(evt);
  187. }
  188. },
  189.  
  190. register: function(type, constructor) {
  191. this.constructors[type] = constructor;
  192.  
  193. $('[data-section-type=' + type + ']').each(
  194. function(index, container) {
  195. this._createInstance(container, constructor);
  196. }.bind(this)
  197. );
  198. }
  199. });
  200.  
  201. /**
  202. * Currency Helpers
  203. * -----------------------------------------------------------------------------
  204. * A collection of useful functions that help with currency formatting
  205. *
  206. * Current contents
  207. * - formatMoney - Takes an amount in cents and returns it as a formatted dollar value.
  208. *
  209. * Alternatives
  210. * - Accounting.js - http://openexchangerates.github.io/accounting.js/
  211. *
  212. */
  213.  
  214. theme.Currency = (function() {
  215. var moneyFormat = '${{amount}}';
  216.  
  217. function formatMoney(cents, format) {
  218. if (typeof cents === 'string') {
  219. cents = cents.replace('.', '');
  220. }
  221. var value = '';
  222. var placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
  223. var formatString = format || moneyFormat;
  224.  
  225. function formatWithDelimiters(number, precision, thousands, decimal) {
  226. thousands = thousands || ',';
  227. decimal = decimal || '.';
  228.  
  229. if (isNaN(number) || number === null) {
  230. return 0;
  231. }
  232.  
  233. number = (number / 100.0).toFixed(precision);
  234.  
  235. var parts = number.split('.');
  236. var dollarsAmount = parts[0].replace(
  237. /(\d)(?=(\d\d\d)+(?!\d))/g,
  238. '$1' + thousands
  239. );
  240. var centsAmount = parts[1] ? decimal + parts[1] : '';
  241.  
  242. return dollarsAmount + centsAmount;
  243. }
  244.  
  245. switch (formatString.match(placeholderRegex)[1]) {
  246. case 'amount':
  247. value = formatWithDelimiters(cents, 2);
  248. break;
  249. case 'amount_no_decimals':
  250. value = formatWithDelimiters(cents, 0);
  251. break;
  252. case 'amount_with_comma_separator':
  253. value = formatWithDelimiters(cents, 2, '.', ',');
  254. break;
  255. case 'amount_no_decimals_with_comma_separator':
  256. value = formatWithDelimiters(cents, 0, '.', ',');
  257. break;
  258. case 'amount_no_decimals_with_space_separator':
  259. value = formatWithDelimiters(cents, 0, ' ');
  260. break;
  261. case 'amount_with_apostrophe_separator':
  262. value = formatWithDelimiters(cents, 2, "'");
  263. break;
  264. }
  265.  
  266. return formatString.replace(placeholderRegex, value);
  267. }
  268.  
  269. return {
  270. formatMoney: formatMoney
  271. };
  272. })();
  273.  
  274. /**
  275. * Image Helper Functions
  276. * -----------------------------------------------------------------------------
  277. * A collection of functions that help with basic image operations.
  278. *
  279. */
  280.  
  281. theme.Images = (function() {
  282. /**
  283. * Preloads an image in memory and uses the browsers cache to store it until needed.
  284. *
  285. * @param {Array} images - A list of image urls
  286. * @param {String} size - A shopify image size attribute
  287. */
  288.  
  289. function preload(images, size) {
  290. if (typeof images === 'string') {
  291. images = [images];
  292. }
  293.  
  294. for (var i = 0; i < images.length; i++) {
  295. var image = images[i];
  296. this.loadImage(this.getSizedImageUrl(image, size));
  297. }
  298. }
  299.  
  300. /**
  301. * Loads and caches an image in the browsers cache.
  302. * @param {string} path - An image url
  303. */
  304. function loadImage(path) {
  305. new Image().src = path;
  306. }
  307.  
  308. /**
  309. * Swaps the src of an image for another OR returns the imageURL to the callback function
  310. * @param image
  311. * @param element
  312. * @param callback
  313. */
  314. function switchImage(image, element, callback) {
  315. var size = this.imageSize(element.src);
  316. var imageUrl = this.getSizedImageUrl(image.src, size);
  317.  
  318. if (callback) {
  319. callback(imageUrl, image, element); // eslint-disable-line callback-return
  320. } else {
  321. element.src = imageUrl;
  322. }
  323. }
  324.  
  325. /**
  326. * +++ Useful
  327. * Find the Shopify image attribute size
  328. *
  329. * @param {string} src
  330. * @returns {null}
  331. */
  332. function imageSize(src) {
  333. var match = src.match(
  334. /.+_((?:pico|icon|thumb|small|compact|medium|large|grande)|\d{1,4}x\d{0,4}|x\d{1,4})[.@]/
  335. );
  336.  
  337. if (match !== null) {
  338. return match[1];
  339. } else {
  340. return null;
  341. }
  342. }
  343.  
  344. /**
  345. * +++ Useful
  346. * Adds a Shopify size attribute to a URL
  347. *
  348. * @param src
  349. * @param size
  350. * @returns {*}
  351. */
  352. function getSizedImageUrl(src, size) {
  353. if (size === null) {
  354. return src;
  355. }
  356.  
  357. if (size === 'master') {
  358. return this.removeProtocol(src);
  359. }
  360.  
  361. var match = src.match(
  362. /\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?$/i
  363. );
  364.  
  365. if (match !== null) {
  366. var prefix = src.split(match[0]);
  367. var suffix = match[0];
  368.  
  369. return this.removeProtocol(prefix[0] + '_' + size + suffix);
  370. }
  371.  
  372. return null;
  373. }
  374.  
  375. function removeProtocol(path) {
  376. return path.replace(/http(s)?:/, '');
  377. }
  378.  
  379. return {
  380. preload: preload,
  381. loadImage: loadImage,
  382. switchImage: switchImage,
  383. imageSize: imageSize,
  384. getSizedImageUrl: getSizedImageUrl,
  385. removeProtocol: removeProtocol
  386. };
  387. })();
  388.  
  389. /**
  390. * Variant Selection scripts
  391. * ------------------------------------------------------------------------------
  392. *
  393. * Handles change events from the variant inputs in any `cart/add` forms that may
  394. * exist. Also updates the master select and triggers updates when the variants
  395. * price or image changes.
  396. *
  397. * @namespace variants
  398. */
  399.  
  400. slate.Variants = (function() {
  401. /**
  402. * Variant constructor
  403. *
  404. * @param {object} options - Settings from `product.js`
  405. */
  406. function Variants(options) {
  407. this.$container = options.$container;
  408. this.product = options.product;
  409. this.singleOptionSelector = options.singleOptionSelector;
  410. this.originalSelectorId = options.originalSelectorId;
  411. this.enableHistoryState = options.enableHistoryState;
  412. this.currentVariant = this._getVariantFromOptions();
  413.  
  414. $(this.singleOptionSelector, this.$container).on(
  415. 'change',
  416. this._onSelectChange.bind(this)
  417. );
  418. }
  419.  
  420. Variants.prototype = _.assignIn({}, Variants.prototype, {
  421. /**
  422. * Get the currently selected options from add-to-cart form. Works with all
  423. * form input elements.
  424. *
  425. * @return {array} options - Values of currently selected variants
  426. */
  427. _getCurrentOptions: function() {
  428. var currentOptions = _.map(
  429. $(this.singleOptionSelector, this.$container),
  430. function(element) {
  431. var $element = $(element);
  432. var type = $element.attr('type');
  433. var currentOption = {};
  434.  
  435. if (type === 'radio' || type === 'checkbox') {
  436. if ($element[0].checked) {
  437. currentOption.value = $element.val();
  438. currentOption.index = $element.data('index');
  439.  
  440. return currentOption;
  441. } else {
  442. return false;
  443. }
  444. } else {
  445. currentOption.value = $element.val();
  446. currentOption.index = $element.data('index');
  447.  
  448. return currentOption;
  449. }
  450. }
  451. );
  452.  
  453. // remove any unchecked input values if using radio buttons or checkboxes
  454. currentOptions = _.compact(currentOptions);
  455.  
  456. return currentOptions;
  457. },
  458.  
  459. /**
  460. * Find variant based on selected values.
  461. *
  462. * @param {array} selectedValues - Values of variant inputs
  463. * @return {object || undefined} found - Variant object from product.variants
  464. */
  465. _getVariantFromOptions: function() {
  466. var selectedValues = this._getCurrentOptions();
  467. var variants = this.product.variants;
  468.  
  469. var found = _.find(variants, function(variant) {
  470. return selectedValues.every(function(values) {
  471. return _.isEqual(variant[values.index], values.value);
  472. });
  473. });
  474.  
  475. return found;
  476. },
  477.  
  478. /**
  479. * Event handler for when a variant input changes.
  480. */
  481. _onSelectChange: function() {
  482. var variant = this._getVariantFromOptions();
  483.  
  484. this.$container.trigger({
  485. type: 'variantChange',
  486. variant: variant
  487. });
  488.  
  489. if (!variant) {
  490. return;
  491. }
  492.  
  493. this._updateMasterSelect(variant);
  494. this._updateImages(variant);
  495. this._updatePrice(variant);
  496. this._updateSKU(variant);
  497. this.currentVariant = variant;
  498.  
  499. if (this.enableHistoryState) {
  500. this._updateHistoryState(variant);
  501. }
  502. },
  503.  
  504. /**
  505. * Trigger event when variant image changes
  506. *
  507. * @param {object} variant - Currently selected variant
  508. * @return {event} variantImageChange
  509. */
  510. _updateImages: function(variant) {
  511. var variantImage = variant.featured_image || {};
  512. var currentVariantImage = this.currentVariant.featured_image || {};
  513.  
  514. if (
  515. !variant.featured_image ||
  516. variantImage.src === currentVariantImage.src
  517. ) {
  518. return;
  519. }
  520.  
  521. this.$container.trigger({
  522. type: 'variantImageChange',
  523. variant: variant
  524. });
  525. },
  526.  
  527. /**
  528. * Trigger event when variant price changes.
  529. *
  530. * @param {object} variant - Currently selected variant
  531. * @return {event} variantPriceChange
  532. */
  533. _updatePrice: function(variant) {
  534. if (
  535. variant.price === this.currentVariant.price &&
  536. variant.compare_at_price === this.currentVariant.compare_at_price
  537. ) {
  538. return;
  539. }
  540.  
  541. this.$container.trigger({
  542. type: 'variantPriceChange',
  543. variant: variant
  544. });
  545. },
  546.  
  547. /**
  548. * Trigger event when variant SKU changes.
  549. *
  550. * @param {object} variant - Currently selected variant
  551. * @return {event} variantSKUChange
  552. */
  553. _updateSKU: function(variant) {
  554. if (variant.sku === this.currentVariant.sku) {
  555. return;
  556. }
  557.  
  558. this.$container.trigger({
  559. type: 'variantSKUChange',
  560. variant: variant
  561. });
  562. },
  563.  
  564. /**
  565. * Update history state for product deeplinking
  566. *
  567. * @param {variant} variant - Currently selected variant
  568. * @return {k} [description]
  569. */
  570. _updateHistoryState: function(variant) {
  571. if (!history.replaceState || !variant) {
  572. return;
  573. }
  574.  
  575. var newurl =
  576. window.location.protocol +
  577. '//' +
  578. window.location.host +
  579. window.location.pathname +
  580. '?variant=' +
  581. variant.id;
  582. window.history.replaceState({ path: newurl }, '', newurl);
  583. },
  584.  
  585. /**
  586. * Update hidden master select of variant change
  587. *
  588. * @param {variant} variant - Currently selected variant
  589. */
  590. _updateMasterSelect: function(variant) {
  591. $(this.originalSelectorId, this.$container).val(variant.id);
  592. }
  593. });
  594.  
  595. return Variants;
  596. })();
  597.  
  598.  
  599. /* ================ MODULES ================ */
  600. {% if settings.cart_type == 'drawer' %}
  601. /*!
  602. handlebars v1.3.0
  603.  
  604. Copyright (C) 2011 by Yehuda Katz
  605.  
  606. Permission is hereby granted, free of charge, to any person obtaining a copy
  607. of this software and associated documentation files (the "Software"), to deal
  608. in the Software without restriction, including without limitation the rights
  609. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  610. copies of the Software, and to permit persons to whom the Software is
  611. furnished to do so, subject to the following conditions:
  612.  
  613. The above copyright notice and this permission notice shall be included in
  614. all copies or substantial portions of the Software.
  615.  
  616. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  617. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  618. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  619. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  620. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  621. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  622. THE SOFTWARE.
  623.  
  624. @license
  625. */
  626. var Handlebars=function(){var e=function(){"use strict";function t(e){this.string=e}var e;t.prototype.toString=function(){return""+this.string};e=t;return e}();var t=function(e){"use strict";function o(e){return r[e]||"&"}function u(e,t){for(var n in t){if(Object.prototype.hasOwnProperty.call(t,n)){e[n]=t[n]}}}function c(e){if(e instanceof n){return e.toString()}else if(!e&&e!==0){return""}e=""+e;if(!s.test(e)){return e}return e.replace(i,o)}function h(e){if(!e&&e!==0){return true}else if(l(e)&&e.length===0){return true}else{return false}}var t={};var n=e;var r={"&":"&","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var i=/[&<>"'`]/g;var s=/[&<>"'`]/;t.extend=u;var a=Object.prototype.toString;t.toString=a;var f=function(e){return typeof e==="function"};if(f(/x/)){f=function(e){return typeof e==="function"&&a.call(e)==="[object Function]"}}var f;t.isFunction=f;var l=Array.isArray||function(e){return e&&typeof e==="object"?a.call(e)==="[object Array]":false};t.isArray=l;t.escapeExpression=c;t.isEmpty=h;return t}(e);var n=function(){"use strict";function n(e,n){var r;if(n&&n.firstLine){r=n.firstLine;e+=" - "+r+":"+n.firstColumn}var i=Error.prototype.constructor.call(this,e);for(var s=0;s<t.length;s++){this[t[s]]=i[t[s]]}if(r){this.lineNumber=r;this.column=n.firstColumn}}var e;var t=["description","fileName","lineNumber","message","name","number","stack"];n.prototype=new Error;e=n;return e}();var r=function(e,t){"use strict";function h(e,t){this.helpers=e||{};this.partials=t||{};p(this)}function p(e){e.registerHelper("helperMissing",function(e){if(arguments.length===2){return undefined}else{throw new i("Missing helper: '"+e+"'")}});e.registerHelper("blockHelperMissing",function(t,n){var r=n.inverse||function(){},i=n.fn;if(f(t)){t=t.call(this)}if(t===true){return i(this)}else if(t===false||t==null){return r(this)}else if(a(t)){if(t.length>0){return e.helpers.each(t,n)}else{return r(this)}}else{return i(t)}});e.registerHelper("each",function(e,t){var n=t.fn,r=t.inverse;var i=0,s="",o;if(f(e)){e=e.call(this)}if(t.data){o=m(t.data)}if(e&&typeof e==="object"){if(a(e)){for(var u=e.length;i<u;i++){if(o){o.index=i;o.first=i===0;o.last=i===e.length-1}s=s+n(e[i],{data:o})}}else{for(var l in e){if(e.hasOwnProperty(l)){if(o){o.key=l;o.index=i;o.first=i===0}s=s+n(e[l],{data:o});i++}}}}if(i===0){s=r(this)}return s});e.registerHelper("if",function(e,t){if(f(e)){e=e.call(this)}if(!t.hash.includeZero&&!e||r.isEmpty(e)){return t.inverse(this)}else{return t.fn(this)}});e.registerHelper("unless",function(t,n){return e.helpers["if"].call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})});e.registerHelper("with",function(e,t){if(f(e)){e=e.call(this)}if(!r.isEmpty(e))return t.fn(e)});e.registerHelper("log",function(t,n){var r=n.data&&n.data.level!=null?parseInt(n.data.level,10):1;e.log(r,t)})}function v(e,t){d.log(e,t)}var n={};var r=e;var i=t;var s="1.3.0";n.VERSION=s;var o=4;n.COMPILER_REVISION=o;var u={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};n.REVISION_CHANGES=u;var a=r.isArray,f=r.isFunction,l=r.toString,c="[object Object]";n.HandlebarsEnvironment=h;h.prototype={constructor:h,logger:d,log:v,registerHelper:function(e,t,n){if(l.call(e)===c){if(n||t){throw new i("Arg not supported with multiple helpers")}r.extend(this.helpers,e)}else{if(n){t.not=n}this.helpers[e]=t}},registerPartial:function(e,t){if(l.call(e)===c){r.extend(this.partials,e)}else{this.partials[e]=t}}};var d={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,t){if(d.level<=e){var n=d.methodMap[e];if(typeof console!=="undefined"&&console[n]){console[n].call(console,t)}}}};n.logger=d;n.log=v;var m=function(e){var t={};r.extend(t,e);return t};n.createFrame=m;return n}(t,n);var i=function(e,t,n){"use strict";function a(e){var t=e&&e[0]||1,n=o;if(t!==n){if(t<n){var r=u[n],i=u[t];throw new s("Template was precompiled with an older version of Handlebars than the current runtime. "+"Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}else{throw new s("Template was precompiled with a newer version of Handlebars than the current runtime. "+"Please update your runtime to a newer version ("+e[1]+").")}}}function f(e,t){if(!t){throw new s("No environment passed to template")}var n=function(e,n,r,i,o,u){var a=t.VM.invokePartial.apply(this,arguments);if(a!=null){return a}if(t.compile){var f={helpers:i,partials:o,data:u};o[n]=t.compile(e,{data:u!==undefined},t);return o[n](r,f)}else{throw new s("The partial "+n+" could not be compiled when running in runtime-only mode")}};var r={escapeExpression:i.escapeExpression,invokePartial:n,programs:[],program:function(e,t,n){var r=this.programs[e];if(n){r=c(e,t,n)}else if(!r){r=this.programs[e]=c(e,t)}return r},merge:function(e,t){var n=e||t;if(e&&t&&e!==t){n={};i.extend(n,t);i.extend(n,e)}return n},programWithDepth:t.VM.programWithDepth,noop:t.VM.noop,compilerInfo:null};return function(n,i){i=i||{};var s=i.partial?i:t,o,u;if(!i.partial){o=i.helpers;u=i.partials}var a=e.call(r,s,n,o,u,i.data);if(!i.partial){t.VM.checkRevision(r.compilerInfo)}return a}}function l(e,t,n){var r=Array.prototype.slice.call(arguments,3);var i=function(e,i){i=i||{};return t.apply(this,[e,i.data||n].concat(r))};i.program=e;i.depth=r.length;return i}function c(e,t,n){var r=function(e,r){r=r||{};return t(e,r.data||n)};r.program=e;r.depth=0;return r}function h(e,t,n,r,i,o){var u={partial:true,helpers:r,partials:i,data:o};if(e===undefined){throw new s("The partial "+t+" could not be found")}else if(e instanceof Function){return e(n,u)}}function p(){return""}var r={};var i=e;var s=t;var o=n.COMPILER_REVISION;var u=n.REVISION_CHANGES;r.checkRevision=a;r.template=f;r.programWithDepth=l;r.program=c;r.invokePartial=h;r.noop=p;return r}(t,n,r);var s=function(e,t,n,r,i){"use strict";var s;var o=e;var u=t;var a=n;var f=r;var l=i;var c=function(){var e=new o.HandlebarsEnvironment;f.extend(e,o);e.SafeString=u;e.Exception=a;e.Utils=f;e.VM=l;e.template=function(t){return l.template(t,e)};return e};var h=c();h.create=c;s=h;return s}(r,e,n,t,i);var o=function(e){"use strict";function r(e){e=e||{};this.firstLine=e.first_line;this.firstColumn=e.first_column;this.lastColumn=e.last_column;this.lastLine=e.last_line}var t;var n=e;var i={ProgramNode:function(e,t,n,s){var o,u;if(arguments.length===3){s=n;n=null}else if(arguments.length===2){s=t;t=null}r.call(this,s);this.type="program";this.statements=e;this.strip={};if(n){u=n[0];if(u){o={first_line:u.firstLine,last_line:u.lastLine,last_column:u.lastColumn,first_column:u.firstColumn};this.inverse=new i.ProgramNode(n,t,o)}else{this.inverse=new i.ProgramNode(n,t)}this.strip.right=t.left}else if(t){this.strip.left=t.right}},MustacheNode:function(e,t,n,s,o){r.call(this,o);this.type="mustache";this.strip=s;if(n!=null&&n.charAt){var u=n.charAt(3)||n.charAt(2);this.escaped=u!=="{"&&u!=="&"}else{this.escaped=!!n}if(e instanceof i.SexprNode){this.sexpr=e}else{this.sexpr=new i.SexprNode(e,t)}this.sexpr.isRoot=true;this.id=this.sexpr.id;this.params=this.sexpr.params;this.hash=this.sexpr.hash;this.eligibleHelper=this.sexpr.eligibleHelper;this.isHelper=this.sexpr.isHelper},SexprNode:function(e,t,n){r.call(this,n);this.type="sexpr";this.hash=t;var i=this.id=e[0];var s=this.params=e.slice(1);var o=this.eligibleHelper=i.isSimple;this.isHelper=o&&(s.length||t)},PartialNode:function(e,t,n,i){r.call(this,i);this.type="partial";this.partialName=e;this.context=t;this.strip=n},BlockNode:function(e,t,i,s,o){r.call(this,o);if(e.sexpr.id.original!==s.path.original){throw new n(e.sexpr.id.original+" doesn't match "+s.path.original,this)}this.type="block";this.mustache=e;this.program=t;this.inverse=i;this.strip={left:e.strip.left,right:s.strip.right};(t||i).strip.left=e.strip.right;(i||t).strip.right=s.strip.left;if(i&&!t){this.isInverse=true}},ContentNode:function(e,t){r.call(this,t);this.type="content";this.string=e},HashNode:function(e,t){r.call(this,t);this.type="hash";this.pairs=e},IdNode:function(e,t){r.call(this,t);this.type="ID";var i="",s=[],o=0;for(var u=0,a=e.length;u<a;u++){var f=e[u].part;i+=(e[u].separator||"")+f;if(f===".."||f==="."||f==="this"){if(s.length>0){throw new n("Invalid path: "+i,this)}else if(f===".."){o++}else{this.isScoped=true}}else{s.push(f)}}this.original=i;this.parts=s;this.string=s.join(".");this.depth=o;this.isSimple=e.length===1&&!this.isScoped&&o===0;this.stringModeValue=this.string},PartialNameNode:function(e,t){r.call(this,t);this.type="PARTIAL_NAME";this.name=e.original},DataNode:function(e,t){r.call(this,t);this.type="DATA";this.id=e},StringNode:function(e,t){r.call(this,t);this.type="STRING";this.original=this.string=this.stringModeValue=e},IntegerNode:function(e,t){r.call(this,t);this.type="INTEGER";this.original=this.integer=e;this.stringModeValue=Number(e)},BooleanNode:function(e,t){r.call(this,t);this.type="BOOLEAN";this.bool=e;this.stringModeValue=e==="true"},CommentNode:function(e,t){r.call(this,t);this.type="comment";this.comment=e}};t=i;return t}(n);var u=function(){"use strict";var e;var t=function(){function t(e,t){return{left:e.charAt(2)==="~",right:t.charAt(0)==="~"||t.charAt(1)==="~"}}function r(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,root:3,statements:4,EOF:5,program:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,sexpr:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,CLOSE_UNESCAPED:24,OPEN_PARTIAL:25,partialName:26,partial_option0:27,sexpr_repetition0:28,sexpr_option0:29,dataName:30,param:31,STRING:32,INTEGER:33,BOOLEAN:34,OPEN_SEXPR:35,CLOSE_SEXPR:36,hash:37,hash_repetition_plus0:38,hashSegment:39,ID:40,EQUALS:41,DATA:42,pathSegments:43,SEP:44,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"},productions_:[0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]],performAction:function(n,r,i,s,o,u,a){var f=u.length-1;switch(o){case 1:return new s.ProgramNode(u[f-1],this._$);break;case 2:return new s.ProgramNode([],this._$);break;case 3:this.$=new s.ProgramNode([],u[f-1],u[f],this._$);break;case 4:this.$=new s.ProgramNode(u[f-2],u[f-1],u[f],this._$);break;case 5:this.$=new s.ProgramNode(u[f-1],u[f],[],this._$);break;case 6:this.$=new s.ProgramNode(u[f],this._$);break;case 7:this.$=new s.ProgramNode([],this._$);break;case 8:this.$=new s.ProgramNode([],this._$);break;case 9:this.$=[u[f]];break;case 10:u[f-1].push(u[f]);this.$=u[f-1];break;case 11:this.$=new s.BlockNode(u[f-2],u[f-1].inverse,u[f-1],u[f],this._$);break;case 12:this.$=new s.BlockNode(u[f-2],u[f-1],u[f-1].inverse,u[f],this._$);break;case 13:this.$=u[f];break;case 14:this.$=u[f];break;case 15:this.$=new s.ContentNode(u[f],this._$);break;case 16:this.$=new s.CommentNode(u[f],this._$);break;case 17:this.$=new s.MustacheNode(u[f-1],null,u[f-2],t(u[f-2],u[f]),this._$);break;case 18:this.$=new s.MustacheNode(u[f-1],null,u[f-2],t(u[f-2],u[f]),this._$);break;case 19:this.$={path:u[f-1],strip:t(u[f-2],u[f])};break;case 20:this.$=new s.MustacheNode(u[f-1],null,u[f-2],t(u[f-2],u[f]),this._$);break;case 21:this.$=new s.MustacheNode(u[f-1],null,u[f-2],t(u[f-2],u[f]),this._$);break;case 22:this.$=new s.PartialNode(u[f-2],u[f-1],t(u[f-3],u[f]),this._$);break;case 23:this.$=t(u[f-1],u[f]);break;case 24:this.$=new s.SexprNode([u[f-2]].concat(u[f-1]),u[f],this._$);break;case 25:this.$=new s.SexprNode([u[f]],null,this._$);break;case 26:this.$=u[f];break;case 27:this.$=new s.StringNode(u[f],this._$);break;case 28:this.$=new s.IntegerNode(u[f],this._$);break;case 29:this.$=new s.BooleanNode(u[f],this._$);break;case 30:this.$=u[f];break;case 31:u[f-1].isHelper=true;this.$=u[f-1];break;case 32:this.$=new s.HashNode(u[f],this._$);break;case 33:this.$=[u[f-2],u[f]];break;case 34:this.$=new s.PartialNameNode(u[f],this._$);break;case 35:this.$=new s.PartialNameNode(new s.StringNode(u[f],this._$),this._$);break;case 36:this.$=new s.PartialNameNode(new s.IntegerNode(u[f],this._$));break;case 37:this.$=new s.DataNode(u[f],this._$);break;case 38:this.$=new s.IdNode(u[f],this._$);break;case 39:u[f-2].push({part:u[f],separator:u[f-1]});this.$=u[f-2];break;case 40:this.$=[{part:u[f]}];break;case 43:this.$=[];break;case 44:u[f-1].push(u[f]);break;case 47:this.$=[u[f]];break;case 48:u[f-1].push(u[f]);break}},table:[{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}],defaultActions:{3:[2,2],16:[2,1],50:[2,42]},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e;i.length=i.length-e;s.length=s.length-e}function m(){var e;e=n.lexer.lex()||1;if(typeof e!=="number"){e=n.symbols_[e]||e}return e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=this;if(typeof this.lexer.yylloc=="undefined")this.lexer.yylloc={};var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")this.parseError=this.yy.parseError;var g,y,b,w,E,S,x={},T,N,C,k;while(true){b=r[r.length-1];if(this.defaultActions[b]){w=this.defaultActions[b]}else{if(g===null||typeof g=="undefined"){g=m()}w=o[b]&&o[b][g]}if(typeof w==="undefined"||!w.length||!w[0]){var L="";if(!l){k=[];for(T in o[b])if(this.terminals_[T]&&T>2){k.push("'"+this.terminals_[T]+"'")}if(this.lexer.showPosition){L="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[g]||g)+"'"}else{L="Parse error on line "+(a+1)+": Unexpected "+(g==1?"end of input":"'"+(this.terminals_[g]||g)+"'")}this.parseError(L,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:p,expected:k})}}if(w[0]instanceof Array&&w.length>1){throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g)}switch(w[0]){case 1:r.push(g);i.push(this.lexer.yytext);s.push(this.lexer.yylloc);r.push(w[1]);g=null;if(!y){f=this.lexer.yyleng;u=this.lexer.yytext;a=this.lexer.yylineno;p=this.lexer.yylloc;if(l>0)l--}else{g=y;y=null}break;case 2:N=this.productions_[w[1]][1];x.$=i[i.length-N];x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column};if(d){x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]}S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!=="undefined"){return S}if(N){r=r.slice(0,-1*N*2);i=i.slice(0,-1*N);s=s.slice(0,-1*N)}r.push(this.productions_[w[1]][0]);i.push(x.$);s.push(x._$);C=o[r[r.length-2]][r[r.length-1]];r.push(C);break;case 3:return true}}return true}};var n=function(){var e={EOF:1,parseError:function(t,n){if(this.yy.parser){this.yy.parser.parseError(t,n)}else{throw new Error(t)}},setInput:function(e){this._input=e;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges)this.yylloc.range=[0,0];this.offset=0;return this},input:function(){var e=this._input[0];this.yytext+=e;this.yyleng++;this.offset++;this.match+=e;this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);if(t){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges)this.yylloc.range[1]++;this._input=this._input.slice(1);return e},unput:function(e){var t=e.length;var n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-t-1);this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(n.length-1)this.yylineno-=n.length-1;var i=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t};if(this.options.ranges){this.yylloc.range=[i[0],i[0]+this.yyleng-t]}return this},more:function(){this._more=true;return this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;if(e.length<20){e+=this._input.substr(0,20-e.length)}return(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput();var t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done){return this.EOF}if(!this._input)this.done=true;var e,t,n,r,i,s;if(!this._more){this.yytext="";this.match=""}var o=this._currentRules();for(var u=0;u<o.length;u++){n=this._input.match(this.rules[o[u]]);if(n&&(!t||n[0].length>t[0].length)){t=n;r=u;if(!this.options.flex)break}}if(t){s=t[0].match(/(?:\r\n?|\n).*/g);if(s)this.yylineno+=s.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length};this.yytext+=t[0];this.match+=t[0];this.matches=t;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._input=this._input.slice(t[0].length);this.matched+=t[0];e=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input)this.done=false;if(e)return e;else return}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function(){var t=this.next();if(typeof t!=="undefined"){return t}else{return this.lex()}},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};e.options={};e.performAction=function(t,n,r,i){function s(e,t){return n.yytext=n.yytext.substr(e,n.yyleng-t)}var o=i;switch(r){case 0:if(n.yytext.slice(-2)==="\\\\"){s(0,1);this.begin("mu")}else if(n.yytext.slice(-1)==="\\"){s(0,1);this.begin("emu")}else{this.begin("mu")}if(n.yytext)return 14;break;case 1:return 14;break;case 2:this.popState();return 14;break;case 3:s(0,4);this.popState();return 15;break;case 4:return 35;break;case 5:return 36;break;case 6:return 25;break;case 7:return 16;break;case 8:return 20;break;case 9:return 19;break;case 10:return 19;break;case 11:return 23;break;case 12:return 22;break;case 13:this.popState();this.begin("com");break;case 14:s(3,5);this.popState();return 15;break;case 15:return 22;break;case 16:return 41;break;case 17:return 40;break;case 18:return 40;break;case 19:return 44;break;case 20:break;case 21:this.popState();return 24;break;case 22:this.popState();return 18;break;case 23:n.yytext=s(1,2).replace(/\\"/g,'"');return 32;break;case 24:n.yytext=s(1,2).replace(/\\'/g,"'");return 32;break;case 25:return 42;break;case 26:return 34;break;case 27:return 34;break;case 28:return 33;break;case 29:return 40;break;case 30:n.yytext=s(1,2);return 40;break;case 31:return"INVALID";break;case 32:return 5;break}};e.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];e.conditions={mu:{rules:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],inclusive:false},emu:{rules:[2],inclusive:false},com:{rules:[3],inclusive:false},INITIAL:{rules:[0,1,32],inclusive:true}};return e}();e.lexer=n;r.prototype=e;e.Parser=r;return new r}();e=t;return e}();var a=function(e,t){"use strict";function s(e){if(e.constructor===i.ProgramNode){return e}r.yy=i;return r.parse(e)}var n={};var r=e;var i=t;n.parser=r;n.parse=s;return n}(u,o);var f=function(e){"use strict";function r(){}function i(e,t,r){if(e==null||typeof e!=="string"&&e.constructor!==r.AST.ProgramNode){throw new n("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+e)}t=t||{};if(!("data"in t)){t.data=true}var i=r.parse(e);var s=(new r.Compiler).compile(i,t);return(new r.JavaScriptCompiler).compile(s,t)}function s(e,t,r){function s(){var n=r.parse(e);var i=(new r.Compiler).compile(n,t);var s=(new r.JavaScriptCompiler).compile(i,t,undefined,true);return r.template(s)}if(e==null||typeof e!=="string"&&e.constructor!==r.AST.ProgramNode){throw new n("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e)}t=t||{};if(!("data"in t)){t.data=true}var i;return function(e,t){if(!i){i=s()}return i.call(this,e,t)}}var t={};var n=e;t.Compiler=r;r.prototype={compiler:r,disassemble:function(){var e=this.opcodes,t,n=[],r,i;for(var s=0,o=e.length;s<o;s++){t=e[s];if(t.opcode==="DECLARE"){n.push("DECLARE "+t.name+"="+t.value)}else{r=[];for(var u=0;u<t.args.length;u++){i=t.args[u];if(typeof i==="string"){i='"'+i.replace("\n","\\n")+'"'}r.push(i)}n.push(t.opcode+" "+r.join(" "))}}return n.join("\n")},equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t){return false}for(var n=0;n<t;n++){var r=this.opcodes[n],i=e.opcodes[n];if(r.opcode!==i.opcode||r.args.length!==i.args.length){return false}for(var s=0;s<r.args.length;s++){if(r.args[s]!==i.args[s]){return false}}}t=this.children.length;if(e.children.length!==t){return false}for(n=0;n<t;n++){if(!this.children[n].equals(e.children[n])){return false}}return true},guid:0,compile:function(e,t){this.opcodes=[];this.children=[];this.depths={list:[]};this.options=t;var n=this.options.knownHelpers;this.options.knownHelpers={helperMissing:true,blockHelperMissing:true,each:true,"if":true,unless:true,"with":true,log:true};if(n){for(var r in n){this.options.knownHelpers[r]=n[r]}}return this.accept(e)},accept:function(e){var t=e.strip||{},n;if(t.left){this.opcode("strip")}n=this[e.type](e);if(t.right){this.opcode("strip")}return n},program:function(e){var t=e.statements;for(var n=0,r=t.length;n<r;n++){this.accept(t[n])}this.isSimple=r===1;this.depths.list=this.depths.list.sort(function(e,t){return e-t});return this},compileProgram:function(e){var t=(new this.compiler).compile(e,this.options);var n=this.guid++,r;this.usePartial=this.usePartial||t.usePartial;this.children[n]=t;for(var i=0,s=t.depths.list.length;i<s;i++){r=t.depths.list[i];if(r<2){continue}else{this.addDepth(r-1)}}return n},block:function(e){var t=e.mustache,n=e.program,r=e.inverse;if(n){n=this.compileProgram(n)}if(r){r=this.compileProgram(r)}var i=t.sexpr;var s=this.classifySexpr(i);if(s==="helper"){this.helperSexpr(i,n,r)}else if(s==="simple"){this.simpleSexpr(i);this.opcode("pushProgram",n);this.opcode("pushProgram",r);this.opcode("emptyHash");this.opcode("blockValue")}else{this.ambiguousSexpr(i,n,r);this.opcode("pushProgram",n);this.opcode("pushProgram",r);this.opcode("emptyHash");this.opcode("ambiguousBlockValue")}this.opcode("append")},hash:function(e){var t=e.pairs,n,r;this.opcode("pushHash");for(var i=0,s=t.length;i<s;i++){n=t[i];r=n[1];if(this.options.stringParams){if(r.depth){this.addDepth(r.depth)}this.opcode("getContext",r.depth||0);this.opcode("pushStringParam",r.stringModeValue,r.type);if(r.type==="sexpr"){this.sexpr(r)}}else{this.accept(r)}this.opcode("assignToHash",n[0])}this.opcode("popHash")},partial:function(e){var t=e.partialName;this.usePartial=true;if(e.context){this.ID(e.context)}else{this.opcode("push","depth0")}this.opcode("invokePartial",t.name);this.opcode("append")},content:function(e){this.opcode("appendContent",e.string)},mustache:function(e){this.sexpr(e.sexpr);if(e.escaped&&!this.options.noEscape){this.opcode("appendEscaped")}else{this.opcode("append")}},ambiguousSexpr:function(e,t,n){var r=e.id,i=r.parts[0],s=t!=null||n!=null;this.opcode("getContext",r.depth);this.opcode("pushProgram",t);this.opcode("pushProgram",n);this.opcode("invokeAmbiguous",i,s)},simpleSexpr:function(e){var t=e.id;if(t.type==="DATA"){this.DATA(t)}else if(t.parts.length){this.ID(t)}else{this.addDepth(t.depth);this.opcode("getContext",t.depth);this.opcode("pushContext")}this.opcode("resolvePossibleLambda")},helperSexpr:function(e,t,r){var i=this.setupFullMustacheParams(e,t,r),s=e.id.parts[0];if(this.options.knownHelpers[s]){this.opcode("invokeKnownHelper",i.length,s)}else if(this.options.knownHelpersOnly){throw new n("You specified knownHelpersOnly, but used the unknown helper "+s,e)}else{this.opcode("invokeHelper",i.length,s,e.isRoot)}},sexpr:function(e){var t=this.classifySexpr(e);if(t==="simple"){this.simpleSexpr(e)}else if(t==="helper"){this.helperSexpr(e)}else{this.ambiguousSexpr(e)}},ID:function(e){this.addDepth(e.depth);this.opcode("getContext",e.depth);var t=e.parts[0];if(!t){this.opcode("pushContext")}else{this.opcode("lookupOnContext",e.parts[0])}for(var n=1,r=e.parts.length;n<r;n++){this.opcode("lookup",e.parts[n])}},DATA:function(e){this.options.data=true;if(e.id.isScoped||e.id.depth){throw new n("Scoped data references are not supported: "+e.original,e)}this.opcode("lookupData");var t=e.id.parts;for(var r=0,i=t.length;r<i;r++){this.opcode("lookup",t[r])}},STRING:function(e){this.opcode("pushString",e.string)},INTEGER:function(e){this.opcode("pushLiteral",e.integer)},BOOLEAN:function(e){this.opcode("pushLiteral",e.bool)},comment:function(){},opcode:function(e){this.opcodes.push({opcode:e,args:[].slice.call(arguments,1)})},declare:function(e,t){this.opcodes.push({opcode:"DECLARE",name:e,value:t})},addDepth:function(e){if(e===0){return}if(!this.depths[e]){this.depths[e]=true;this.depths.list.push(e)}},classifySexpr:function(e){var t=e.isHelper;var n=e.eligibleHelper;var r=this.options;if(n&&!t){var i=e.id.parts[0];if(r.knownHelpers[i]){t=true}else if(r.knownHelpersOnly){n=false}}if(t){return"helper"}else if(n){return"ambiguous"}else{return"simple"}},pushParams:function(e){var t=e.length,n;while(t--){n=e[t];if(this.options.stringParams){if(n.depth){this.addDepth(n.depth)}this.opcode("getContext",n.depth||0);this.opcode("pushStringParam",n.stringModeValue,n.type);if(n.type==="sexpr"){this.sexpr(n)}}else{this[n.type](n)}}},setupFullMustacheParams:function(e,t,n){var r=e.params;this.pushParams(r);this.opcode("pushProgram",t);this.opcode("pushProgram",n);if(e.hash){this.hash(e.hash)}else{this.opcode("emptyHash")}return r}};t.precompile=i;t.compile=s;return t}(n);var l=function(e,t){"use strict";function u(e){this.value=e}function a(){}var n;var r=e.COMPILER_REVISION;var i=e.REVISION_CHANGES;var s=e.log;var o=t;a.prototype={nameLookup:function(e,t){var n,r;if(e.indexOf("depth")===0){n=true}if(/^[0-9]+$/.test(t)){r=e+"["+t+"]"}else if(a.isValidJavaScriptVariableName(t)){r=e+"."+t}else{r=e+"['"+t+"']"}if(n){return"("+e+" && "+r+")"}else{return r}},compilerInfo:function(){var e=r,t=i[e];return"this.compilerInfo = ["+e+",'"+t+"'];\n"},appendToBuffer:function(e){if(this.environment.isSimple){return"return "+e+";"}else{return{appendToBuffer:true,content:e,toString:function(){return"buffer += "+e+";"}}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(e,t,n,r){this.environment=e;this.options=t||{};s("debug",this.environment.disassemble()+"\n\n");this.name=this.environment.name;this.isChild=!!n;this.context=n||{programs:[],environments:[],aliases:{}};this.preamble();this.stackSlot=0;this.stackVars=[];this.registers={list:[]};this.hashes=[];this.compileStack=[];this.inlineStack=[];this.compileChildren(e,t);var i=e.opcodes,u;this.i=0;for(var a=i.length;this.i<a;this.i++){u=i[this.i];if(u.opcode==="DECLARE"){this[u.name]=u.value}else{this[u.opcode].apply(this,u.args)}if(u.opcode!==this.stripNext){this.stripNext=false}}this.pushSource("");if(this.stackSlot||this.inlineStack.length||this.compileStack.length){throw new o("Compile completed with content left on stack")}return this.createFunctionContext(r)},preamble:function(){var e=[];if(!this.isChild){var t=this.namespace;var n="helpers = this.merge(helpers, "+t+".helpers);";if(this.environment.usePartial){n=n+" partials = this.merge(partials, "+t+".partials);"}if(this.options.data){n=n+" data = data || {};"}e.push(n)}else{e.push("")}if(!this.environment.isSimple){e.push(", buffer = "+this.initializeBuffer())}else{e.push("")}this.lastContext=0;this.source=e},createFunctionContext:function(e){var t=this.stackVars.concat(this.registers.list);if(t.length>0){this.source[1]=this.source[1]+", "+t.join(", ")}if(!this.isChild){for(var n in this.context.aliases){if(this.context.aliases.hasOwnProperty(n)){this.source[1]=this.source[1]+", "+n+"="+this.context.aliases[n]}}}if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";"}if(!this.isChild){this.source[1]+="\n"+this.context.programs.join("\n")+"\n"}if(!this.environment.isSimple){this.pushSource("return buffer;")}var r=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var i=0,o=this.environment.depths.list.length;i<o;i++){r.push("depth"+this.environment.depths.list[i])}var u=this.mergeSource();if(!this.isChild){u=this.compilerInfo()+u}if(e){r.push(u);return Function.apply(this,r)}else{var a="function "+(this.name||"")+"("+r.join(",")+") {\n "+u+"}";s("debug",a+"\n\n");return a}},mergeSource:function(){var e="",t;for(var n=0,r=this.source.length;n<r;n++){var i=this.source[n];if(i.appendToBuffer){if(t){t=t+"\n + "+i.content}else{t=i.content}}else{if(t){e+="buffer += "+t+";\n ";t=undefined}e+=i+"\n "}}return e},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e);this.replaceStack(function(t){e.splice(1,0,t);return"blockHelperMissing.call("+e.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e);var t=this.topStack();e.splice(1,0,t);this.pushSource("if (!"+this.lastHelper+") { "+t+" = blockHelperMissing.call("+e.join(", ")+"); }")},appendContent:function(e){if(this.pendingContent){e=this.pendingContent+e}if(this.stripNext){e=e.replace(/^\s+/,"")}this.pendingContent=e},strip:function(){if(this.pendingContent){this.pendingContent=this.pendingContent.replace(/\s+$/,"")}this.stripNext="strip"},append:function(){this.flushInline();var e=this.popStack();this.pushSource("if("+e+" || "+e+" === 0) { "+this.appendToBuffer(e)+" }");if(this.environment.isSimple){this.pushSource("else { "+this.appendToBuffer("''")+" }")}},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression";this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(e){if(this.lastContext!==e){this.lastContext=e}},lookupOnContext:function(e){this.push(this.nameLookup("depth"+this.lastContext,e,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"';this.replaceStack(function(e){return"typeof "+e+" === functionType ? "+e+".apply(depth0) : "+e})},lookup:function(e){this.replaceStack(function(t){return t+" == null || "+t+" === false ? "+t+" : "+this.nameLookup(t,e,"context")})},lookupData:function(){this.pushStackLiteral("data")},pushStringParam:function(e,t){this.pushStackLiteral("depth"+this.lastContext);this.pushString(t);if(t!=="sexpr"){if(typeof e==="string"){this.pushString(e)}else{this.pushStackLiteral(e)}}},emptyHash:function(){this.pushStackLiteral("{}");if(this.options.stringParams){this.push("{}");this.push("{}")}},pushHash:function(){if(this.hash){this.hashes.push(this.hash)}this.hash={values:[],types:[],contexts:[]}},popHash:function(){var e=this.hash;this.hash=this.hashes.pop();if(this.options.stringParams){this.push("{"+e.contexts.join(",")+"}");this.push("{"+e.types.join(",")+"}")}this.push("{\n "+e.values.join(",\n ")+"\n }")},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},push:function(e){this.inlineStack.push(e);return e},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){if(e!=null){this.pushStackLiteral(this.programExpression(e))}else{this.pushStackLiteral(null)}},invokeHelper:function(e,t,n){this.context.aliases.helperMissing="helpers.helperMissing";this.useRegister("helper");var r=this.lastHelper=this.setupHelper(e,t,true);var i=this.nameLookup("depth"+this.lastContext,t,"context");var s="helper = "+r.name+" || "+i;if(r.paramsInit){s+=","+r.paramsInit}this.push("("+s+",helper "+"? helper.call("+r.callParams+") "+": helperMissing.call("+r.helperMissingParams+"))");if(!n){this.flushInline()}},invokeKnownHelper:function(e,t){var n=this.setupHelper(e,t);this.push(n.name+".call("+n.callParams+")")},invokeAmbiguous:function(e,t){this.context.aliases.functionType='"function"';this.useRegister("helper");this.emptyHash();var n=this.setupHelper(0,e,t);var r=this.lastHelper=this.nameLookup("helpers",e,"helper");var i=this.nameLookup("depth"+this.lastContext,e,"context");var s=this.nextStack();if(n.paramsInit){this.pushSource(n.paramsInit)}this.pushSource("if (helper = "+r+") { "+s+" = helper.call("+n.callParams+"); }");this.pushSource("else { helper = "+i+"; "+s+" = typeof helper === functionType ? helper.call("+n.callParams+") : helper; }")},invokePartial:function(e){var t=[this.nameLookup("partials",e,"partial"),"'"+e+"'",this.popStack(),"helpers","partials"];if(this.options.data){t.push("data")}this.context.aliases.self="this";this.push("self.invokePartial("+t.join(", ")+")")},assignToHash:function(e){var t=this.popStack(),n,r;if(this.options.stringParams){r=this.popStack();n=this.popStack()}var i=this.hash;if(n){i.contexts.push("'"+e+"': "+n)}if(r){i.types.push("'"+e+"': "+r)}i.values.push("'"+e+"': ("+t+")")},compiler:a,compileChildren:function(e,t){var n=e.children,r,i;for(var s=0,o=n.length;s<o;s++){r=n[s];i=new this.compiler;var u=this.matchExistingProgram(r);if(u==null){this.context.programs.push("");u=this.context.programs.length;r.index=u;r.name="program"+u;this.context.programs[u]=i.compile(r,t,this.context);this.context.environments[u]=r}else{r.index=u;r.name="program"+u}}},matchExistingProgram:function(e){for(var t=0,n=this.context.environments.length;t<n;t++){var r=this.context.environments[t];if(r&&r.equals(e)){return t}}},programExpression:function(e){this.context.aliases.self="this";if(e==null){return"self.noop"}var t=this.environment.children[e],n=t.depths.list,r;var i=[t.index,t.name,"data"];for(var s=0,o=n.length;s<o;s++){r=n[s];if(r===1){i.push("depth0")}else{i.push("depth"+(r-1))}}return(n.length===0?"self.program(":"self.programWithDepth(")+i.join(", ")+")"},register:function(e,t){this.useRegister(e);this.pushSource(e+" = "+t+";")},useRegister:function(e){if(!this.registers[e]){this.registers[e]=true;this.registers.list.push(e)}},pushStackLiteral:function(e){return this.push(new u(e))},pushSource:function(e){if(this.pendingContent){this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent)));this.pendingContent=undefined}if(e){this.source.push(e)}},pushStack:function(e){this.flushInline();var t=this.incrStack();if(e){this.pushSource(t+" = "+e+";")}this.compileStack.push(t);return t},replaceStack:function(e){var t="",n=this.isInline(),r,i,s;if(n){var o=this.popStack(true);if(o instanceof u){r=o.value;s=true}else{i=!this.stackSlot;var a=!i?this.topStackName():this.incrStack();t="("+this.push(a)+" = "+o+"),";r=this.topStack()}}else{r=this.topStack()}var f=e.call(this,r);if(n){if(!s){this.popStack()}if(i){this.stackSlot--}this.push("("+t+f+")")}else{if(!/^stack/.test(r)){r=this.nextStack()}this.pushSource(r+" = ("+t+f+");")}return r},nextStack:function(){return this.pushStack()},incrStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot)}return this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;if(e.length){this.inlineStack=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];if(r instanceof u){this.compileStack.push(r)}else{this.pushStack(r)}}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),n=(t?this.inlineStack:this.compileStack).pop();if(!e&&n instanceof u){return n.value}else{if(!t){if(!this.stackSlot){throw new o("Invalid stack pop")}this.stackSlot--}return n}},topStack:function(e){var t=this.isInline()?this.inlineStack:this.compileStack,n=t[t.length-1];if(!e&&n instanceof u){return n.value}else{return n}},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},setupHelper:function(e,t,n){var r=[],i=this.setupParams(e,r,n);var s=this.nameLookup("helpers",t,"helper");return{params:r,paramsInit:i,name:s,callParams:["depth0"].concat(r).join(", "),helperMissingParams:n&&["depth0",this.quotedString(t)].concat(r).join(", ")}},setupOptions:function(e,t){var n=[],r=[],i=[],s,o,u;n.push("hash:"+this.popStack());if(this.options.stringParams){n.push("hashTypes:"+this.popStack());n.push("hashContexts:"+this.popStack())}o=this.popStack();u=this.popStack();if(u||o){if(!u){this.context.aliases.self="this";u="self.noop"}if(!o){this.context.aliases.self="this";o="self.noop"}n.push("inverse:"+o);n.push("fn:"+u)}for(var a=0;a<e;a++){s=this.popStack();t.push(s);if(this.options.stringParams){i.push(this.popStack());r.push(this.popStack())}}if(this.options.stringParams){n.push("contexts:["+r.join(",")+"]");n.push("types:["+i.join(",")+"]")}if(this.options.data){n.push("data:data")}return n},setupParams:function(e,t,n){var r="{"+this.setupOptions(e,t).join(",")+"}";if(n){this.useRegister("options");t.push("options");return"options="+r}else{t.push(r);return""}}};var f=("break else new var"+" case finally return void"+" catch for switch while"+" continue function this with"+" default if throw"+" delete in try"+" do instanceof typeof"+" abstract enum int short"+" boolean export interface static"+" byte extends long super"+" char final native synchronized"+" class float package throws"+" const goto private transient"+" debugger implements protected volatile"+" double import public let yield").split(" ");var l=a.RESERVED_WORDS={};for(var c=0,h=f.length;c<h;c++){l[f[c]]=true}a.isValidJavaScriptVariableName=function(e){if(!a.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)){return true}return false};n=a;return n}(r,n);var c=function(e,t,n,r,i){"use strict";var s;var o=e;var u=t;var a=n.parser;var f=n.parse;var l=r.Compiler;var c=r.compile;var h=r.precompile;var p=i;var d=o.create;var v=function(){var e=d();e.compile=function(t,n){return c(t,n,e)};e.precompile=function(t,n){return h(t,n,e)};e.AST=u;e.Compiler=l;e.JavaScriptCompiler=p;e.Parser=a;e.parse=f;return e};o=v();o.create=v;s=o;return s}(s,o,a,f,l);return c}();
  627. /*============================================================================
  628. Ajax the add to cart experience by revealing it in a side drawer
  629. Plugin Documentation - http://shopify.github.io/Timber/#ajax-cart
  630. (c) Copyright 2015 Shopify Inc. Author: Carson Shold (@cshold). All Rights Reserved.
  631.  
  632. This file includes:
  633. - Basic Shopify Ajax API calls
  634. - Ajax cart plugin
  635.  
  636. This requires:
  637. - jQuery 1.8+
  638. - handlebars.min.js (for cart template)
  639. - modernizer.min.js
  640. - snippet/ajax-cart-template.liquid
  641.  
  642. Customized version of Shopify's jQuery API
  643. (c) Copyright 2009-2015 Shopify Inc. Author: Caroline Schnapp. All Rights Reserved.
  644. ==============================================================================*/
  645. if (typeof ShopifyAPI === 'undefined') {
  646. ShopifyAPI = {};
  647. }
  648.  
  649. /*============================================================================
  650. API Helper Functions
  651. ==============================================================================*/
  652. function attributeToString(attribute) {
  653. if (typeof attribute !== 'string') {
  654. attribute += '';
  655. if (attribute === 'undefined') {
  656. attribute = '';
  657. }
  658. }
  659. return jQuery.trim(attribute);
  660. }
  661.  
  662. /*============================================================================
  663. API Functions
  664. ==============================================================================*/
  665. ShopifyAPI.onCartUpdate = function() {
  666. // alert('There are now ' + cart.item_count + ' items in the cart.');
  667. };
  668.  
  669. ShopifyAPI.updateCartNote = function(note, callback) {
  670. var params = {
  671. type: 'POST',
  672. url: '/cart/update.js',
  673. data: 'note=' + attributeToString(note),
  674. dataType: 'json',
  675. success: function(cart) {
  676. if (typeof callback === 'function') {
  677. callback(cart);
  678. } else {
  679. ShopifyAPI.onCartUpdate(cart);
  680. }
  681. },
  682. error: function(XMLHttpRequest, textStatus) {
  683. ShopifyAPI.onError(XMLHttpRequest, textStatus);
  684. }
  685. };
  686. jQuery.ajax(params);
  687. };
  688.  
  689. ShopifyAPI.onError = function(XMLHttpRequest) {
  690. var data = eval('(' + XMLHttpRequest.responseText + ')');
  691. if (data.message) {
  692. alert(data.message + '(' + data.status + '): ' + data.description);
  693. }
  694. };
  695.  
  696. /*============================================================================
  697. POST to cart/add.js returns the JSON of the cart
  698. - Allow use of form element instead of just id
  699. - Allow custom error callback
  700. ==============================================================================*/
  701. ShopifyAPI.addItemFromForm = function(form, callback, errorCallback) {
  702. var formData = new FormData(form);
  703. var params = {
  704. type: 'POST',
  705. url: '/cart/add.js',
  706. data: formData,
  707. processData: false,
  708. contentType: false,
  709. dataType: 'json',
  710. success: function(line_item) {
  711. if (typeof callback === 'function') {
  712. callback(line_item, form);
  713. } else {
  714. ShopifyAPI.onItemAdded(line_item, form);
  715. }
  716. },
  717. error: function(XMLHttpRequest, textStatus) {
  718. if (typeof errorCallback === 'function') {
  719. errorCallback(XMLHttpRequest, textStatus);
  720. } else {
  721. ShopifyAPI.onError(XMLHttpRequest, textStatus);
  722. }
  723. }
  724. };
  725. jQuery.ajax(params);
  726. };
  727.  
  728. // Get from cart.js returns the cart in JSON
  729. ShopifyAPI.getCart = function(callback) {
  730. jQuery.getJSON('/cart.js', function(cart) {
  731. if (typeof callback === 'function') {
  732. callback(cart);
  733. } else {
  734. ShopifyAPI.onCartUpdate(cart);
  735. }
  736. });
  737. };
  738.  
  739. // POST to cart/change.js returns the cart in JSON
  740. ShopifyAPI.changeItem = function(line, quantity, callback) {
  741. var params = {
  742. type: 'POST',
  743. url: '/cart/change.js',
  744. data: 'quantity=' + quantity + '&line=' + line,
  745. dataType: 'json',
  746. success: function(cart) {
  747. if (typeof callback === 'function') {
  748. callback(cart);
  749. } else {
  750. ShopifyAPI.onCartUpdate(cart);
  751. }
  752. },
  753. error: function(XMLHttpRequest, textStatus) {
  754. ShopifyAPI.onError(XMLHttpRequest, textStatus);
  755. }
  756. };
  757. jQuery.ajax(params);
  758. };
  759.  
  760. /*============================================================================
  761. Ajax Shopify Add To Cart
  762. ==============================================================================*/
  763. var ajaxCart = (function(module, $) {
  764. 'use strict';
  765.  
  766. // Public functions
  767. var init, loadCart;
  768.  
  769. // Private general variables
  770. var settings, isUpdating, $body;
  771.  
  772. // Private plugin variables
  773. var $formContainer,
  774. $addToCart,
  775. $cartCountSelector,
  776. $cartCostSelector,
  777. $cartContainer;
  778.  
  779. // Private functions
  780. var updateCountPrice,
  781. formOverride,
  782. itemAddedCallback,
  783. itemErrorCallback,
  784. cartUpdateCallback,
  785. buildCart,
  786. cartCallback,
  787. adjustCart,
  788. adjustCartCallback,
  789. qtySelectors,
  790. validateQty;
  791.  
  792. /*============================================================================
  793. Initialise the plugin and define global options
  794. ==============================================================================*/
  795. init = function(options) {
  796. // Default settings
  797. settings = {
  798. formSelector: 'form[action^="/cart/add"]',
  799. cartContainer: '#CartContainer',
  800. addToCartSelector: 'input[type="submit"]',
  801. cartCountSelector: null,
  802. cartCostSelector: null,
  803. moneyFormat: '${{amount}}',
  804. disableAjaxCart: false,
  805. enableQtySelectors: true
  806. };
  807.  
  808. // Override defaults with arguments
  809. $.extend(settings, options);
  810.  
  811. // Select DOM elements
  812. $formContainer = $(settings.formSelector);
  813. $cartContainer = $(settings.cartContainer);
  814. $addToCart = $formContainer.find(settings.addToCartSelector);
  815. $cartCountSelector = $(settings.cartCountSelector);
  816. $cartCostSelector = $(settings.cartCostSelector);
  817.  
  818. // General Selectors
  819. $body = $('body');
  820.  
  821. // Track cart activity status
  822. isUpdating = false;
  823.  
  824. // Setup ajax quantity selectors on the any template if enableQtySelectors is true
  825. if (settings.enableQtySelectors) {
  826. qtySelectors();
  827. }
  828.  
  829. // Take over the add to cart form submit action if ajax enabled
  830. if (!settings.disableAjaxCart && $addToCart.length) {
  831. formOverride();
  832. }
  833.  
  834. // Run this function in case we're using the quantity selector outside of the cart
  835. adjustCart();
  836. };
  837.  
  838. loadCart = function() {
  839. $body.addClass('drawer--is-loading');
  840. ShopifyAPI.getCart(cartUpdateCallback);
  841. };
  842.  
  843. updateCountPrice = function(cart) {
  844. if ($cartCountSelector) {
  845. $cartCountSelector.html(cart.item_count).removeClass('hidden-count');
  846.  
  847. if (cart.item_count === 0) {
  848. $cartCountSelector.addClass('hidden-count');
  849. }
  850. }
  851. if ($cartCostSelector) {
  852. $cartCostSelector.html(
  853. theme.Currency.formatMoney(cart.total_price, settings.moneyFormat)
  854. );
  855. }
  856. };
  857.  
  858. formOverride = function() {
  859. $formContainer.on('submit', function(evt) {
  860. evt.preventDefault();
  861.  
  862. // Add class to be styled if desired
  863. $addToCart.removeClass('is-added').addClass('is-adding');
  864.  
  865. // Remove any previous quantity errors
  866. $('.qty-error').remove();
  867.  
  868. ShopifyAPI.addItemFromForm(
  869. evt.target,
  870. itemAddedCallback,
  871. itemErrorCallback
  872. );
  873. });
  874. };
  875.  
  876. itemAddedCallback = function() {
  877. $addToCart.removeClass('is-adding').addClass('is-added');
  878.  
  879. ShopifyAPI.getCart(cartUpdateCallback);
  880. };
  881.  
  882. itemErrorCallback = function(XMLHttpRequest) {
  883. var data = eval('(' + XMLHttpRequest.responseText + ')');
  884. $addToCart.removeClass('is-adding is-added');
  885.  
  886. if (data.message) {
  887. if (data.status === 422) {
  888. $formContainer.after(
  889. '<div class="errors qty-error">' + data.description + '</div>'
  890. );
  891. }
  892. }
  893. };
  894.  
  895. cartUpdateCallback = function(cart) {
  896. // Update quantity and price
  897. updateCountPrice(cart);
  898. buildCart(cart);
  899. };
  900.  
  901. buildCart = function(cart) {
  902. // Start with a fresh cart div
  903. $cartContainer.empty();
  904.  
  905. // Show empty cart
  906. if (cart.item_count === 0) {
  907. $cartContainer.append(
  908. '<p class="cart--empty-message">' +
  909. theme.strings.cartEmpty +
  910. '</p>\n' +
  911. '<p class="cookie-message">' +
  912. theme.strings.cartCookies +
  913. '</p>'
  914. );
  915. cartCallback(cart);
  916. return;
  917. }
  918.  
  919. // Handlebars.js cart layout
  920. var items = [],
  921. item = {},
  922. data = {},
  923. source = $('#CartTemplate').html(),
  924. template = Handlebars.compile(source);
  925.  
  926. // Add each item to our handlebars.js data
  927. $.each(cart.items, function(index, cartItem) {
  928. /* Hack to get product image thumbnail
  929. * - If image is not null
  930. * - Remove file extension, add _small, and re-add extension
  931. * - Create server relative link
  932. * - A hard-coded url of no-image
  933. */
  934. var prodImg;
  935. if (cartItem.image !== null) {
  936. prodImg = cartItem.image
  937. .replace(/(\.[^.]*)$/, '_small$1')
  938. .replace('http:', '');
  939. } else {
  940. prodImg =
  941. '//cdn.shopify.com/s/assets/admin/no-image-medium-cc9732cb976dd349a0df1d39816fbcc7.gif';
  942. }
  943.  
  944. if (cartItem.properties !== null) {
  945. $.each(cartItem.properties, function(key, value) {
  946. if (key.charAt(0) === '_' || !value) {
  947. delete cartItem.properties[key];
  948. }
  949. });
  950. }
  951.  
  952. if (cartItem.properties !== null) {
  953. $.each(cartItem.properties, function(key, value) {
  954. if (key.charAt(0) === '_' || !value) {
  955. delete cartItem.properties[key];
  956. }
  957. });
  958. }
  959.  
  960. if (cartItem.line_level_discount_allocations.length !== 0) {
  961. for (var discount in cartItem.line_level_discount_allocations) {
  962. var amount =
  963. cartItem.line_level_discount_allocations[discount].amount;
  964.  
  965. cartItem.line_level_discount_allocations[
  966. discount
  967. ].formattedAmount = theme.Currency.formatMoney(
  968. amount,
  969. settings.moneyFormat
  970. );
  971. }
  972. }
  973.  
  974. if (cart.cart_level_discount_applications.length !== 0) {
  975. for (var cartDiscount in cart.cart_level_discount_applications) {
  976. var cartAmount =
  977. cart.cart_level_discount_applications[cartDiscount]
  978. .total_allocated_amount;
  979.  
  980. cart.cart_level_discount_applications[
  981. cartDiscount
  982. ].formattedAmount = theme.Currency.formatMoney(
  983. cartAmount,
  984. settings.moneyFormat
  985. );
  986. }
  987. }
  988.  
  989. // Create item's data object and add to 'items' array
  990. item = {
  991. key: cartItem.key,
  992. line: index + 1, // Shopify uses a 1+ index in the API
  993. url: cartItem.url,
  994. img: prodImg,
  995. name: cartItem.product_title,
  996. variation: cartItem.variant_title,
  997. properties: cartItem.properties,
  998. itemAdd: cartItem.quantity + 1,
  999. itemMinus: cartItem.quantity - 1,
  1000. itemQty: cartItem.quantity,
  1001. price: theme.Currency.formatMoney(
  1002. cartItem.original_line_price,
  1003. settings.moneyFormat
  1004. ),
  1005. discountedPrice: theme.Currency.formatMoney(
  1006. cartItem.final_line_price,
  1007. settings.moneyFormat
  1008. ),
  1009. discounts: cartItem.line_level_discount_allocations,
  1010. discountsApplied:
  1011. cartItem.line_level_discount_allocations.length === 0 ? false : true,
  1012. vendor: cartItem.vendor
  1013. };
  1014.  
  1015. items.push(item);
  1016. });
  1017.  
  1018. // Gather all cart data and add to DOM
  1019. data = {
  1020. items: items,
  1021. note: cart.note,
  1022. totalPrice: theme.Currency.formatMoney(
  1023. cart.total_price,
  1024. settings.moneyFormat
  1025. ),
  1026. cartDiscounts: cart.cart_level_discount_applications,
  1027. cartDiscountsApplied:
  1028. cart.cart_level_discount_applications.length === 0 ? false : true
  1029. };
  1030.  
  1031. $cartContainer.append(template(data));
  1032.  
  1033. cartCallback(cart);
  1034. };
  1035.  
  1036. cartCallback = function(cart) {
  1037. $body.removeClass('drawer--is-loading');
  1038. $body.trigger('ajaxCart.afterCartLoad', cart);
  1039.  
  1040. if (window.Shopify && Shopify.StorefrontExpressButtons) {
  1041. Shopify.StorefrontExpressButtons.initialize();
  1042. }
  1043. };
  1044.  
  1045. adjustCart = function() {
  1046. // Delegate all events because elements reload with the cart
  1047.  
  1048. // Add or remove from the quantity
  1049. $body.on('click', '.ajaxcart__qty-adjust', function() {
  1050. if (isUpdating) {
  1051. return;
  1052. }
  1053. var $el = $(this),
  1054. line = $el.data('line'),
  1055. $qtySelector = $el.siblings('.ajaxcart__qty-num'),
  1056. qty = parseInt($qtySelector.val().replace(/\D/g, ''));
  1057.  
  1058. qty = validateQty(qty);
  1059.  
  1060. // Add or subtract from the current quantity
  1061. if ($el.hasClass('ajaxcart__qty--plus')) {
  1062. qty += 1;
  1063. } else {
  1064. qty -= 1;
  1065. if (qty <= 0) qty = 0;
  1066. }
  1067.  
  1068. // If it has a data-line, update the cart.
  1069. // Otherwise, just update the input's number
  1070. if (line) {
  1071. updateQuantity(line, qty);
  1072. } else {
  1073. $qtySelector.val(qty);
  1074. }
  1075. });
  1076.  
  1077. // Update quantity based on input on change
  1078. $body.on('change', '.ajaxcart__qty-num', function() {
  1079. if (isUpdating) {
  1080. return;
  1081. }
  1082. var $el = $(this),
  1083. line = $el.data('line'),
  1084. qty = parseInt($el.val().replace(/\D/g, ''));
  1085.  
  1086. qty = validateQty(qty);
  1087.  
  1088. // If it has a data-line, update the cart
  1089. if (line) {
  1090. updateQuantity(line, qty);
  1091. }
  1092. });
  1093.  
  1094. // Prevent cart from being submitted while quantities are changing
  1095. $body.on('submit', 'form.ajaxcart', function(evt) {
  1096. if (isUpdating) {
  1097. evt.preventDefault();
  1098. }
  1099. });
  1100.  
  1101. // Highlight the text when focused
  1102. $body.on('focus', '.ajaxcart__qty-adjust', function() {
  1103. var $el = $(this);
  1104. setTimeout(function() {
  1105. $el.select();
  1106. }, 50);
  1107. });
  1108.  
  1109. function updateQuantity(line, qty) {
  1110. isUpdating = true;
  1111.  
  1112. // Add activity classes when changing cart quantities
  1113. var $row = $('.ajaxcart__row[data-line="' + line + '"]').addClass(
  1114. 'is-loading'
  1115. );
  1116.  
  1117. if (qty === 0) {
  1118. $row.parent().addClass('is-removed');
  1119. }
  1120.  
  1121. // Slight delay to make sure removed animation is done
  1122. setTimeout(function() {
  1123. ShopifyAPI.changeItem(line, qty, adjustCartCallback);
  1124. }, 250);
  1125. }
  1126.  
  1127. // Save note anytime it's changed
  1128. $body.on('change', 'textarea[name="note"]', function() {
  1129. var newNote = $(this).val();
  1130.  
  1131. // Update the cart note in case they don't click update/checkout
  1132. ShopifyAPI.updateCartNote(newNote, function() {});
  1133. });
  1134. };
  1135.  
  1136. adjustCartCallback = function(cart) {
  1137. // Update quantity and price
  1138. updateCountPrice(cart);
  1139.  
  1140. // Reprint cart on short timeout so you don't see the content being removed
  1141. setTimeout(function() {
  1142. ShopifyAPI.getCart(buildCart);
  1143. isUpdating = false;
  1144. }, 150);
  1145. };
  1146.  
  1147. qtySelectors = function() {
  1148. // Change number inputs to JS ones, similar to ajax cart but without API integration.
  1149. // Make sure to add the existing name and id to the new input element
  1150. var $numInputs = $('input[type="number"]');
  1151.  
  1152. if ($numInputs.length) {
  1153. $numInputs.each(function() {
  1154. var $el = $(this),
  1155. currentQty = $el.val(),
  1156. inputName = $el.attr('name'),
  1157. inputId = $el.attr('id');
  1158.  
  1159. var itemAdd = currentQty + 1,
  1160. itemMinus = currentQty - 1,
  1161. itemQty = currentQty;
  1162.  
  1163. var source = $('#JsQty').html(),
  1164. template = Handlebars.compile(source),
  1165. data = {
  1166. key: $el.data('id'),
  1167. itemQty: itemQty,
  1168. itemAdd: itemAdd,
  1169. itemMinus: itemMinus,
  1170. inputName: inputName,
  1171. inputId: inputId
  1172. };
  1173.  
  1174. // Append new quantity selector then remove original
  1175. $el.after(template(data)).remove();
  1176. });
  1177.  
  1178. // Setup listeners to add/subtract from the input
  1179. $('.js-qty__adjust').on('click', function() {
  1180. var $el = $(this),
  1181. $qtySelector = $el.siblings('.js-qty__num'),
  1182. qty = parseInt($qtySelector.val().replace(/\D/g, ''));
  1183.  
  1184. qty = validateQty(qty);
  1185.  
  1186. // Add or subtract from the current quantity
  1187. if ($el.hasClass('js-qty__adjust--plus')) {
  1188. qty += 1;
  1189. } else {
  1190. qty -= 1;
  1191. if (qty <= 1) qty = 1;
  1192. }
  1193.  
  1194. // Update the input's number
  1195. $qtySelector.val(qty);
  1196. });
  1197. }
  1198. };
  1199.  
  1200. validateQty = function(qty) {
  1201. if (parseFloat(qty) === parseInt(qty) && !isNaN(qty)) {
  1202. // We have a valid number!
  1203. } else {
  1204. // Not a number. Default to 1.
  1205. qty = 1;
  1206. }
  1207. return qty;
  1208. };
  1209.  
  1210. module = {
  1211. init: init,
  1212. load: loadCart
  1213. };
  1214.  
  1215. return module;
  1216. })(ajaxCart || {}, jQuery);
  1217.  
  1218. {% endif %}
  1219. /*============================================================================
  1220. Money Format
  1221. - Shopify.format money is defined in option_selection.js.
  1222. If that file is not included, it is redefined here.
  1223. ==============================================================================*/
  1224. window.timber = window.timber || {};
  1225. window.theme = window.theme || {};
  1226.  
  1227. timber.initCache = function() {
  1228. timber.cache = {
  1229. // General
  1230. $html: $('html'),
  1231. $body: $('body'),
  1232. $window: $(window),
  1233.  
  1234. // Navigation
  1235. $navigation: $('#AccessibleNav'),
  1236.  
  1237. // Product Page
  1238. $optionSelector: $('.single-option-selector'),
  1239.  
  1240. // Customer Pages
  1241. $recoverPasswordLink: $('#RecoverPassword'),
  1242. $hideRecoverPasswordLink: $('#HideRecoverPasswordLink'),
  1243. $recoverPasswordForm: $('#RecoverPasswordForm'),
  1244. $customerLoginForm: $('#CustomerLoginForm'),
  1245. $passwordResetSuccess: $('#ResetSuccess')
  1246. };
  1247. };
  1248.  
  1249. timber.init = function() {
  1250. timber.initCache();
  1251. timber.accessibleNav();
  1252. timber.drawersInit();
  1253. timber.responsiveVideos();
  1254. timber.loginForms();
  1255. };
  1256.  
  1257. timber.accessibleNav = function() {
  1258. var classes = {
  1259. active: 'nav-hover',
  1260. focus: 'nav-focus',
  1261. outside: 'nav-outside',
  1262. hasDropdown: 'site-nav--has-dropdown',
  1263. link: 'site-nav__link'
  1264. };
  1265. var selectors = {
  1266. active: '.' + classes.active,
  1267. hasDropdown: '.' + classes.hasDropdown,
  1268. dropdown: '[data-meganav-dropdown]',
  1269. link: 'a',
  1270. nextLink: '> a',
  1271. parentLink: '[data-meganav-type="parent"]',
  1272. childLink: '[data-meganav-type="child"]'
  1273. };
  1274.  
  1275. var $nav = timber.cache.$navigation,
  1276. $allLinks = $nav.find(selectors.link),
  1277. $parents = $nav.find(selectors.hasDropdown),
  1278. $childLinks = $nav.find(selectors.childLink),
  1279. $topLevel = $parents.find(selectors.nextLink),
  1280. $dropdowns = $nav.find(selectors.dropdown),
  1281. $subMenuLinks = $dropdowns.find(selectors.link);
  1282.  
  1283. // Mouseenter
  1284. $parents.on('mouseenter touchstart', function(evt) {
  1285. var $el = $(this);
  1286. var evtType = evt.type;
  1287. var $dropdowns = $nav.find(selectors.active);
  1288.  
  1289. if (!$el.hasClass(classes.active)) {
  1290. // force stop the click from happening
  1291. evt.preventDefault();
  1292. evt.stopImmediatePropagation();
  1293. }
  1294.  
  1295. // Make sure we close any opened same level dropdown before opening a new one
  1296. if (evtType === 'touchstart' && $dropdowns.length > 0) {
  1297. hideDropdown($el);
  1298. }
  1299.  
  1300. showDropdown($el);
  1301. });
  1302.  
  1303. $childLinks.on('touchstart', function(evt) {
  1304. evt.stopImmediatePropagation();
  1305. });
  1306.  
  1307. $parents.on('mouseleave', function() {
  1308. hideDropdown($(this));
  1309. });
  1310.  
  1311. $allLinks.on('focus', function() {
  1312. handleFocus($(this));
  1313. });
  1314.  
  1315. $allLinks.on('blur', function() {
  1316. removeFocus($topLevel);
  1317. });
  1318.  
  1319. // accessibleNav private methods
  1320. function handleFocus($el) {
  1321. var $newFocus = null,
  1322. $previousItem = $el.parent().prev();
  1323.  
  1324. // Always put tabindex -1 on previous element just in case the user is going backward.
  1325. // In that case, we want to focus on the previous parent and not the previous parent childs
  1326.  
  1327. $allLinks.attr('tabindex', '');
  1328.  
  1329. if ($previousItem.hasClass(classes.hasDropdown)) {
  1330. $previousItem.find(selectors.dropdown + ' a').attr('tabindex', -1);
  1331. }
  1332.  
  1333. $newFocus = $el.parents(selectors.hasDropdown).find('> a');
  1334. addFocus($newFocus);
  1335. }
  1336.  
  1337. function showDropdown($el) {
  1338. var $toplevel = $el.find(selectors.nextLink);
  1339.  
  1340. $toplevel.attr('aria-expanded', true);
  1341.  
  1342. $el.addClass(classes.active);
  1343.  
  1344. setTimeout(function() {
  1345. timber.cache.$body.on('touchstart.MegaNav', function() {
  1346. hideDropdowns();
  1347. });
  1348. }, 250);
  1349. }
  1350.  
  1351. function hideDropdown($el) {
  1352. var $dropdowns = $el.parent().find(selectors.active);
  1353. var $parentLink = $dropdowns.find(selectors.nextLink);
  1354.  
  1355. $parentLink.attr('aria-expanded', false);
  1356.  
  1357. $dropdowns.removeClass(classes.active);
  1358.  
  1359. timber.cache.$body.off('touchstart.MegaNav');
  1360. }
  1361.  
  1362. function hideDropdowns() {
  1363. var $dropdowns = $nav.find(selectors.active);
  1364. $.each($dropdowns, function() {
  1365. hideDropdown($(this));
  1366. });
  1367. }
  1368.  
  1369. function addFocus($el) {
  1370. $el.addClass(classes.focus);
  1371.  
  1372. if ($el.attr('aria-expanded') !== undefined) {
  1373. $el.attr('aria-expanded', true);
  1374. }
  1375. }
  1376.  
  1377. function removeFocus($el) {
  1378. $el.removeClass(classes.focus);
  1379.  
  1380. $subMenuLinks.attr('tabindex', -1);
  1381.  
  1382. if ($el.attr('aria-expanded') !== undefined) {
  1383. $el.attr('aria-expanded', false);
  1384. }
  1385. }
  1386.  
  1387. // Check if dropdown is outside of viewport
  1388. function handleDropdownOffset($dropdowns) {
  1389. var viewportSize = $(window).width();
  1390. $dropdowns.removeClass(classes.outside);
  1391.  
  1392. $.each($dropdowns, function() {
  1393. var $dropdown = $(this);
  1394. var dropdownOffset = $dropdown.offset().left + $dropdown.width();
  1395. if (dropdownOffset > viewportSize) {
  1396. $dropdown.addClass(classes.outside);
  1397. }
  1398. });
  1399. }
  1400.  
  1401. timber.cache.$window.load(function() {
  1402. handleDropdownOffset($dropdowns);
  1403. });
  1404.  
  1405. timber.cache.$window.resize(function() {
  1406. afterResize(function() {
  1407. handleDropdownOffset($dropdowns);
  1408. }, 250);
  1409. });
  1410. };
  1411.  
  1412. timber.drawersInit = function() {
  1413. timber.LeftDrawer = new timber.Drawers('NavDrawer', 'left');
  1414. if (theme.settings.cartType === 'drawer') {
  1415. timber.RightDrawer = new timber.Drawers('CartDrawer', 'right', {
  1416. onDrawerOpen: ajaxCart.load
  1417. });
  1418. }
  1419. };
  1420.  
  1421. timber.getHash = function() {
  1422. return window.location.hash;
  1423. };
  1424.  
  1425. timber.responsiveVideos = function() {
  1426. var $iframeVideo = $(
  1427. 'iframe[src*="youtube.com/embed"], iframe[src*="player.vimeo"]'
  1428. );
  1429. var $iframeReset = $iframeVideo.add('iframe#admin_bar_iframe');
  1430.  
  1431. $iframeVideo.each(function() {
  1432. // Add wrapper to make video responsive
  1433. if (!$(this).parents('.video-wrapper').length) {
  1434. $(this).wrap('<div class="video-wrapper"></div>');
  1435. }
  1436. });
  1437.  
  1438. $iframeReset.each(function() {
  1439. // Re-set the src attribute on each iframe after page load
  1440. // for Chrome's 'incorrect iFrame content on 'back'' bug.
  1441. // https://code.google.com/p/chromium/issues/detail?id=395791
  1442. // Need to specifically target video and admin bar
  1443. this.src = this.src;
  1444. });
  1445. };
  1446.  
  1447. timber.loginForms = function() {
  1448. function showRecoverPasswordForm() {
  1449. timber.cache.$recoverPasswordForm.show();
  1450. timber.cache.$customerLoginForm.hide();
  1451. }
  1452.  
  1453. function hideRecoverPasswordForm() {
  1454. timber.cache.$recoverPasswordForm.hide();
  1455. timber.cache.$customerLoginForm.show();
  1456. }
  1457.  
  1458. timber.cache.$recoverPasswordLink.on('click', function(evt) {
  1459. evt.preventDefault();
  1460. showRecoverPasswordForm();
  1461. });
  1462.  
  1463. timber.cache.$hideRecoverPasswordLink.on('click', function(evt) {
  1464. evt.preventDefault();
  1465. hideRecoverPasswordForm();
  1466. });
  1467.  
  1468. // Allow deep linking to recover password form
  1469. if (timber.getHash() === '#recover') {
  1470. showRecoverPasswordForm();
  1471. }
  1472. };
  1473.  
  1474. timber.resetPasswordSuccess = function() {
  1475. timber.cache.$passwordResetSuccess.show();
  1476. };
  1477.  
  1478. /*============================================================================
  1479. Drawer modules
  1480. - Docs http://shopify.github.io/Timber/#drawers
  1481. ==============================================================================*/
  1482. timber.Drawers = (function() {
  1483. var Drawer = function(id, position, options) {
  1484. var defaults = {
  1485. close: '.js-drawer-close',
  1486. open: '.js-drawer-open-button-' + position,
  1487. openButtonLeftClass: 'js-drawer-open-button-left',
  1488. drawerLeftClass: 'drawer--left',
  1489. drawerRightClass: 'drawer--right',
  1490. openClass: 'js-drawer-open',
  1491. dirOpenClass: 'js-drawer-open-' + position
  1492. };
  1493.  
  1494. this.nodes = {
  1495. $parent: $('body, html'),
  1496. $page: $('#PageContainer'),
  1497. $moved: $('.page-container')
  1498. };
  1499.  
  1500. this.config = $.extend(defaults, options);
  1501. this.position = position;
  1502.  
  1503. this.$drawer = $('#' + id);
  1504.  
  1505. if (!this.$drawer.length) {
  1506. return false;
  1507. }
  1508.  
  1509. this.drawerIsOpen = false;
  1510. this.init();
  1511. };
  1512.  
  1513. Drawer.prototype.init = function() {
  1514. var $openBtn = $(this.config.open);
  1515.  
  1516. // Add aria controls
  1517. $openBtn.attr('aria-expanded', 'false');
  1518.  
  1519. $openBtn.on('click', $.proxy(this.open, this));
  1520. this.$drawer.find(this.config.close).on('click', $.proxy(this.close, this));
  1521. };
  1522.  
  1523. Drawer.prototype.open = function(evt) {
  1524. // Keep track if drawer was opened from a click, or called by another function
  1525. var externalCall = false;
  1526.  
  1527. // Other drawers that might be open (will be closed later)
  1528. var $otherDrawers = $('.drawer').not(this.$drawer);
  1529.  
  1530. // don't open an opened drawer
  1531. if (this.drawerIsOpen) {
  1532. if (evt) {
  1533. evt.preventDefault();
  1534. }
  1535. return;
  1536. }
  1537.  
  1538. // Close other drawers if they are open
  1539. var self = this;
  1540. $otherDrawers.each(function() {
  1541. if (!$(this).hasClass(self.config.openClass)) {
  1542. return;
  1543. }
  1544.  
  1545. if ($(this).hasClass(self.config.drawerLeftClass)) {
  1546. timber.LeftDrawer.close();
  1547. }
  1548.  
  1549. if ($(this).hasClass(self.config.drawerRightClass)) {
  1550. timber.RightDrawer.close();
  1551. }
  1552. });
  1553.  
  1554. // Prevent following href if link is clicked
  1555. if (evt) {
  1556. evt.preventDefault();
  1557. } else {
  1558. externalCall = true;
  1559. }
  1560.  
  1561. // Without this, the drawer opens, the click event bubbles up to $nodes.page
  1562. // which closes the drawer.
  1563. if (evt && evt.stopPropagation) {
  1564. evt.stopPropagation();
  1565. // save the source of the click, we'll focus to this on close
  1566. this.$activeSource = $(evt.currentTarget);
  1567. }
  1568.  
  1569. if (this.drawerIsOpen && !externalCall) {
  1570. return this.close();
  1571. }
  1572.  
  1573. // Add is-transitioning class to moved elements on open so drawer can have
  1574. // transition for close animation
  1575. this.nodes.$moved.addClass('is-transitioning');
  1576. this.$drawer.prepareTransition();
  1577.  
  1578. this.nodes.$parent.addClass(
  1579. this.config.openClass + ' ' + this.config.dirOpenClass
  1580. );
  1581. this.$drawer.addClass(this.config.openClass);
  1582.  
  1583. this.drawerIsOpen = true;
  1584.  
  1585. // Set focus on drawer
  1586. Drawer.prototype.trapFocus({
  1587. $container: this.$drawer,
  1588. namespace: 'drawer_focus'
  1589. });
  1590.  
  1591. // Run function when drawer opens if set
  1592. if (
  1593. this.config.onDrawerOpen &&
  1594. typeof this.config.onDrawerOpen === 'function'
  1595. ) {
  1596. if (!externalCall) {
  1597. this.config.onDrawerOpen();
  1598. }
  1599. }
  1600.  
  1601. if (this.$activeSource && this.$activeSource.attr('aria-expanded')) {
  1602. this.$activeSource.attr('aria-expanded', 'true');
  1603. }
  1604.  
  1605. this.bindEvents();
  1606. };
  1607.  
  1608. Drawer.prototype.close = function(evt) {
  1609. // don't close a closed drawer
  1610. if (!this.drawerIsOpen) {
  1611. return;
  1612. }
  1613.  
  1614. if (evt.keyCode !== 27) {
  1615. evt.preventDefault();
  1616. }
  1617. // deselect any focused form elements
  1618. $(document.activeElement).trigger('blur');
  1619.  
  1620. // Ensure closing transition is applied to moved elements, like the nav
  1621. this.nodes.$moved.prepareTransition({ disableExisting: true });
  1622. this.$drawer.prepareTransition({ disableExisting: true });
  1623.  
  1624. this.nodes.$parent.removeClass(
  1625. this.config.dirOpenClass + ' ' + this.config.openClass
  1626. );
  1627. this.$drawer.removeClass(this.config.openClass);
  1628.  
  1629. this.drawerIsOpen = false;
  1630.  
  1631. // Remove focus on drawer
  1632. Drawer.prototype.removeTrapFocus({
  1633. $container: this.$drawer,
  1634. namespace: 'drawer_focus'
  1635. });
  1636.  
  1637. if (this.$activeSource && this.$activeSource.attr('aria-expanded')) {
  1638. this.$activeSource.attr('aria-expanded', 'false');
  1639. }
  1640.  
  1641. this.unbindEvents();
  1642. };
  1643.  
  1644. /**
  1645. * Traps the focus in a particular container
  1646. *
  1647. * @param {object} options - Options to be used
  1648. * @param {jQuery} options.$container - Container to trap focus within
  1649. * @param {jQuery} options.$elementToFocus - Element to be focused when focus leaves container
  1650. * @param {string} options.namespace - Namespace used for new focus event handler
  1651. */
  1652. Drawer.prototype.trapFocus = function(options) {
  1653. var eventName = options.namespace
  1654. ? 'focusin.' + options.namespace
  1655. : 'focusin';
  1656.  
  1657. if (!options.$elementToFocus) {
  1658. options.$elementToFocus = options.$container;
  1659. options.$container.attr('tabindex', '-1');
  1660. }
  1661.  
  1662. options.$elementToFocus.focus();
  1663.  
  1664. $(document).on(eventName, function(evt) {
  1665. if (
  1666. options.$container[0] !== evt.target &&
  1667. !options.$container.has(evt.target).length
  1668. ) {
  1669. options.$container.focus();
  1670. }
  1671. });
  1672. };
  1673.  
  1674. /**
  1675. * Removes the trap of focus in a particular container
  1676. *
  1677. * @param {object} options - Options to be used
  1678. * @param {jQuery} options.$container - Container to trap focus within
  1679. * @param {string} options.namespace - Namespace used for new focus event handler
  1680. */
  1681. Drawer.prototype.removeTrapFocus = function(options) {
  1682. var eventName = options.namespace
  1683. ? 'focusin.' + options.namespace
  1684. : 'focusin';
  1685.  
  1686. if (options.$container && options.$container.length) {
  1687. options.$container.removeAttr('tabindex');
  1688. }
  1689.  
  1690. $(document).off(eventName);
  1691. };
  1692.  
  1693. Drawer.prototype.bindEvents = function() {
  1694. // Lock scrolling on mobile
  1695. this.nodes.$page.on('touchmove.drawer', function() {
  1696. return false;
  1697. });
  1698.  
  1699. this.$drawer.on('click.drawer', function(event) {
  1700. if ($(this).hasClass('drawer--left')) {
  1701. event.stopPropagation();
  1702. }
  1703. });
  1704.  
  1705. $('.page-container, .drawer__header-container').on(
  1706. 'click.drawer',
  1707. this.close.bind(this)
  1708. );
  1709.  
  1710. // Pressing escape closes drawer
  1711. this.nodes.$parent.on(
  1712. 'keyup.drawer',
  1713. $.proxy(function(evt) {
  1714. // The hamburger 'open' button changes to a 'close' button when the drawer
  1715. // is open. Clicking on it will close the drawer.
  1716. if (this.$activeSource !== undefined) {
  1717. this.$activeSource.on(
  1718. 'click.drawer',
  1719. $.proxy(function() {
  1720. if (
  1721. !this.$activeSource.hasClass(this.config.openButtonLeftClass)
  1722. ) {
  1723. return;
  1724. }
  1725. this.close();
  1726. }, this)
  1727. );
  1728. }
  1729. if (evt.keyCode === 27) {
  1730. this.close(evt);
  1731. }
  1732. }, this)
  1733. );
  1734. };
  1735.  
  1736. Drawer.prototype.unbindEvents = function() {
  1737. if (this.$activeSource !== undefined) {
  1738. this.$activeSource.off('.drawer');
  1739. }
  1740. this.nodes.$page.off('.drawer');
  1741. this.nodes.$parent.off('.drawer');
  1742. };
  1743.  
  1744. return Drawer;
  1745. })();
  1746.  
  1747. // Initialize Timber's JS on docready
  1748. $(timber.init);
  1749.  
  1750. /*
  1751. * Shopify JS for customizing Slick.js
  1752. * http://kenwheeler.github.io/slick/
  1753. * Untouched JS in assets/slick.min.js
  1754. */
  1755.  
  1756. var slickTheme = (function(module, $) {
  1757. 'use strict';
  1758.  
  1759. // Public functions
  1760. var init, onInit, beforeChange, afterChange;
  1761.  
  1762. // Private variables
  1763. var settings,
  1764. $slider,
  1765. $allSlides,
  1766. $activeSlide,
  1767. $pagination,
  1768. scrolled,
  1769. $heroText,
  1770. $heroImage;
  1771. var currentActiveSlide = 0;
  1772.  
  1773. // Private functions
  1774. var cacheObjects,
  1775. setParallax,
  1776. calculateParallax,
  1777. keyboardNavigation,
  1778. togglePause,
  1779. showMobileText,
  1780. applySlideColor,
  1781. slideshowA11ySetup;
  1782.  
  1783. /*============================================================================
  1784. Initialise the plugin and define global options
  1785. ==============================================================================*/
  1786. cacheObjects = function() {
  1787. slickTheme.cache = {
  1788. $html: $('html'),
  1789. $window: $(window),
  1790. $hero: $('#Hero'),
  1791. $heroImage: $('.hero__image'),
  1792. $headerWrapper: $('.header-wrapper'),
  1793. $pauseButton: $('.hero__pause'),
  1794. $textWrapperMobile: $('.hero__adapt-text-wrap')
  1795. };
  1796.  
  1797. slickTheme.vars = {
  1798. slides: '.slick-slide',
  1799. activeSlide: '.slick-active',
  1800. slideImage: '.hero__image',
  1801. slickList: '.slick-list',
  1802. textContent: '.hero__text-content',
  1803. pagination: '[data-slide-pagination]',
  1804. hiddenClass: 'hero__slide--hidden',
  1805. heroHeaderClass: 'hero__header',
  1806. pausedClass: 'is-paused',
  1807. loadSlideA11yString: slickTheme.cache.$hero.data('slide-nav-a11y'),
  1808. activeSlideA11yString: slickTheme.cache.$hero.data(
  1809. 'slide-nav-active-a11y'
  1810. )
  1811. };
  1812. };
  1813.  
  1814. init = function(options) {
  1815. cacheObjects();
  1816.  
  1817. // Default settings
  1818. settings = {
  1819. // User options
  1820. $element: null,
  1821. parallax: false,
  1822.  
  1823. // Private settings
  1824. isTouch: Modernizr.touch ? true : false,
  1825.  
  1826. // Slick options
  1827. accessibility: true,
  1828. arrows: false,
  1829. dots: true,
  1830. focusOnChange: true,
  1831. adaptiveHeight: true
  1832. };
  1833.  
  1834. // Override defaults with arguments
  1835. $.extend(settings, options);
  1836.  
  1837. /*
  1838. * Init slick slider
  1839. * - Add any additional option changes here
  1840. * - https://github.com/kenwheeler/slick/#options
  1841. */
  1842. settings.$element.slick({
  1843. accessibility: settings.accessibility,
  1844. arrows: settings.arrows,
  1845. dots: settings.dots,
  1846. slide: '.hero__slide',
  1847. /* eslint-disable shopify/jquery-dollar-sign-reference */
  1848. prevArrow: $('.slick-prev'),
  1849. nextArrow: $('.slick-next'),
  1850. appendDots: $('.hero__dots-wrapper'),
  1851. /* eslint-enable shopify/jquery-dollar-sign-reference */
  1852. adaptiveHeight: false,
  1853. draggable: false,
  1854. fade: true,
  1855. focusOnChange: settings.focusOnChange,
  1856. autoplay: slickTheme.cache.$hero.data('autoplay'),
  1857. autoplaySpeed: slickTheme.cache.$hero.data('autoplayspeed'),
  1858. onInit: this.onInit,
  1859. onBeforeChange: this.beforeChange,
  1860. onAfterChange: this.afterChange,
  1861. customPaging: function(slick, index) {
  1862. var labelString =
  1863. index === 0
  1864. ? slickTheme.vars.activeSlideA11yString
  1865. : slickTheme.vars.loadSlideA11yString;
  1866. return (
  1867. '<a href="#Hero" aria-label="' +
  1868. labelString.replace('[slide_number]', index + 1) +
  1869. '" data-slide-number="' +
  1870. index +
  1871. '" data-slide-pagination aria-controls="SlickSlide' +
  1872. (index + 1) +
  1873. '"></a>'
  1874. );
  1875. }
  1876. });
  1877. };
  1878.  
  1879. onInit = function(obj) {
  1880. $slider = obj.$slider;
  1881. $allSlides = $slider.find(slickTheme.vars.slides);
  1882. $activeSlide = $slider.find(
  1883. slickTheme.vars.slides + slickTheme.vars.activeSlide
  1884. );
  1885. $pagination = $slider.find(slickTheme.vars.pagination);
  1886.  
  1887. if (!settings.isTouch) {
  1888. $allSlides.addClass(slickTheme.vars.hiddenClass);
  1889. $activeSlide.removeClass(slickTheme.vars.hiddenClass);
  1890. }
  1891.  
  1892. if (settings.autoplay) {
  1893. slickTheme.cache.$pauseButton.on('click', togglePause);
  1894.  
  1895. $(document).scroll(
  1896. theme.debounce(
  1897. function() {
  1898. if (this.$slider.outerHeight() < window.pageYOffset) {
  1899. settings.$element.slickPause();
  1900. } else if (
  1901. !slickTheme.cache.$pauseButton.hasClass(
  1902. slickTheme.vars.pausedClass
  1903. )
  1904. ) {
  1905. settings.$element.slickPlay();
  1906. }
  1907. }.bind(this),
  1908. 250
  1909. )
  1910. );
  1911. }
  1912.  
  1913. // Prevent default slick behaviour of autoplaying on mouseleave
  1914. slickTheme.cache.$hero
  1915. .find(slickTheme.vars.slickList)
  1916. .off('mouseleave.slick');
  1917.  
  1918. if (settings.adaptHeight) {
  1919. showMobileText(0);
  1920. }
  1921.  
  1922. slideshowA11ySetup();
  1923.  
  1924. if (settings.parallax && Modernizr.csstransforms3d) {
  1925. setParallax();
  1926. }
  1927. };
  1928.  
  1929. beforeChange = function(evt, currentSlide, nextSlide) {
  1930. if (!settings.isTouch) {
  1931. $allSlides.removeClass(slickTheme.vars.hiddenClass);
  1932. }
  1933.  
  1934. if (settings.adaptHeight) {
  1935. showMobileText(nextSlide);
  1936. }
  1937.  
  1938. applySlideColor(nextSlide, currentSlide);
  1939.  
  1940. $pagination.each(function(index) {
  1941. var labelString =
  1942. index === nextSlide
  1943. ? slickTheme.vars.activeSlideA11yString
  1944. : slickTheme.vars.loadSlideA11yString;
  1945.  
  1946. labelString = labelString.replace('[slide_number]', index + 1);
  1947. $(this).attr('aria-label', labelString);
  1948. });
  1949.  
  1950. // Set upcoming slide as index
  1951. currentActiveSlide = nextSlide;
  1952.  
  1953. // Set new active slide to proper parallax position
  1954. if (settings.parallax && Modernizr.csstransforms3d) {
  1955. calculateParallax(currentActiveSlide);
  1956. }
  1957. };
  1958.  
  1959. afterChange = function() {
  1960. if (settings.isTouch) {
  1961. return;
  1962. }
  1963.  
  1964. $activeSlide = $slider.find(
  1965. slickTheme.vars.slides + slickTheme.vars.activeSlide
  1966. );
  1967. $allSlides.addClass(slickTheme.vars.hiddenClass).attr('aria-hidden', true);
  1968. $activeSlide
  1969. .removeClass(slickTheme.vars.hiddenClass)
  1970. .attr('aria-hidden', false);
  1971. };
  1972.  
  1973. setParallax = function() {
  1974. $heroText = $(slickTheme.vars.textContent);
  1975. $heroImage = $(slickTheme.vars.slideImage);
  1976.  
  1977. slickTheme.cache.$window.on('scroll', function() {
  1978. calculateParallax(currentActiveSlide);
  1979. });
  1980. };
  1981.  
  1982. calculateParallax = function(currentSlide) {
  1983. scrolled = slickTheme.cache.$window.scrollTop();
  1984.  
  1985. $($heroText[currentSlide]).css({
  1986. transform: 'translate3d(0, ' + scrolled / 8 + 'px, 0)'
  1987. });
  1988.  
  1989. $($heroImage[currentSlide]).css({
  1990. transform: 'translate3d(0, ' + scrolled / 8 + 'px, 0)'
  1991. });
  1992. };
  1993.  
  1994. keyboardNavigation = function(evt) {
  1995. if (evt.keyCode === 37) {
  1996. settings.$element.slickPrev();
  1997. }
  1998. if (evt.keyCode === 39) {
  1999. settings.$element.slickNext();
  2000. }
  2001. };
  2002.  
  2003. togglePause = function() {
  2004. var $pauseButton = $(this);
  2005. var isPaused = $pauseButton.hasClass(slickTheme.vars.pausedClass);
  2006.  
  2007. $pauseButton
  2008. .toggleClass(slickTheme.vars.pausedClass, !isPaused)
  2009. .attr(
  2010. 'aria-label',
  2011. isPaused
  2012. ? $pauseButton.data('label-pause')
  2013. : $pauseButton.data('label-play')
  2014. );
  2015.  
  2016. if (settings.autoplay) {
  2017. if (isPaused) {
  2018. settings.$element.slickPlay();
  2019. } else {
  2020. settings.$element.slickPause();
  2021. }
  2022. }
  2023. };
  2024.  
  2025. showMobileText = function(slideIndex) {
  2026. var $allTextContent = slickTheme.cache.$textWrapperMobile.find(
  2027. slickTheme.vars.textContent
  2028. );
  2029. var $currentTextContent = slickTheme.cache.$textWrapperMobile.find(
  2030. '[data-index="' + slideIndex + '"]'
  2031. );
  2032. if (!$currentTextContent.length && $allSlides.length === 1) {
  2033. slickTheme.cache.$textWrapperMobile.hide();
  2034. } else {
  2035. slickTheme.cache.$textWrapperMobile.show();
  2036. }
  2037. $allTextContent.hide();
  2038. $currentTextContent.show();
  2039. };
  2040.  
  2041. applySlideColor = function(nextSlideIndex, previousSlideIndex) {
  2042. var prefixClassName = 'hero--color-';
  2043.  
  2044. theme.cache.$siteHeader
  2045. .removeClass(prefixClassName + previousSlideIndex)
  2046. .addClass(prefixClassName + nextSlideIndex);
  2047. $slider
  2048. .removeClass(prefixClassName + previousSlideIndex)
  2049. .addClass(prefixClassName + nextSlideIndex);
  2050. };
  2051.  
  2052. slideshowA11ySetup = function() {
  2053. var $list = slickTheme.cache.$hero.find(slickTheme.vars.slickList);
  2054.  
  2055. // When an element in the slider is focused
  2056. // pause slideshow and set aria-live.
  2057. slickTheme.cache.$hero
  2058. .on('focusin mouseenter', function(evt) {
  2059. if (
  2060. !slickTheme.cache.$hero.has(evt.target).length ||
  2061. $list.attr('aria-live') === 'polite'
  2062. ) {
  2063. return;
  2064. }
  2065.  
  2066. $list.attr('aria-live', 'polite');
  2067. if (settings.autoplay) {
  2068. settings.$element.slickPause();
  2069. }
  2070. })
  2071. .on('focusout mouseleave', function(evt) {
  2072. if (slickTheme.cache.$hero.has(evt.relatedTarget).length) {
  2073. return;
  2074. }
  2075.  
  2076. $list.removeAttr('aria-live');
  2077. if (settings.autoplay) {
  2078. // Only resume playing if the user hasn't paused using the pause
  2079. // button
  2080. if (
  2081. !slickTheme.cache.$pauseButton.hasClass(slickTheme.vars.pausedClass)
  2082. ) {
  2083. settings.$element.slickPlay();
  2084. }
  2085. }
  2086. })
  2087. .on('keyup', keyboardNavigation.bind(this));
  2088.  
  2089. $list.removeAttr('tabindex');
  2090.  
  2091. $allSlides.each(function(index) {
  2092. $(this)
  2093. .attr('id', 'SlickSlide' + (index + 1))
  2094. .attr('aria-hidden', true);
  2095. });
  2096.  
  2097. $activeSlide.attr('aria-hidden', false);
  2098.  
  2099. if ($allSlides.length > 1) {
  2100. $pagination.each(function() {
  2101. $(this).on('click keyup', function(evt) {
  2102. if (evt.type === 'keyup' && evt.which !== 13) return;
  2103.  
  2104. evt.preventDefault();
  2105.  
  2106. if (evt.type === 'keyup') {
  2107. slickTheme.cache.$hero.focus();
  2108. }
  2109. });
  2110. });
  2111. }
  2112. };
  2113.  
  2114. module = {
  2115. init: init,
  2116. onInit: onInit,
  2117. beforeChange: beforeChange,
  2118. afterChange: afterChange
  2119. };
  2120.  
  2121. return module;
  2122. })(slickTheme || {}, jQuery);
  2123.  
  2124.  
  2125. /* ================ Sections ================ */
  2126. window.theme = window.theme || {};
  2127.  
  2128. theme.Product = (function() {
  2129. function Product(container) {
  2130. var $window = $(window);
  2131.  
  2132. this.settings = {
  2133. productPageLoad: false,
  2134. preloadImage: false,
  2135. enableHistoryState: true,
  2136. namespace: '.productSection'
  2137. };
  2138.  
  2139. this.selectors = {
  2140. productImageWrapper: '.product-single__photo-wrapper',
  2141. productImages: '.product-single__photos',
  2142. productImagePhoto: '.product-single__photo',
  2143. productImagePhotoFlexWrapper: '.product-single__photo--flex-wrapper',
  2144. productThumbnail: '.product-single__thumbnail',
  2145. productImagePhotoContainer: '.product-single__photo--container',
  2146. productFullDetails: '.product-single__full-details',
  2147. productForm: '.add-to-cart__form',
  2148. addToCart: '.btn--add-to-cart',
  2149. addToCartText: '.btn__text',
  2150. priceContainer: '[data-price-container]',
  2151. productPrice: '#ProductPrice',
  2152. SKU: '.variant-sku',
  2153. priceA11y: '#PriceA11y',
  2154. comparePrice: '#ComparePrice',
  2155. comparePriceA11y: '#ComparePriceA11y',
  2156. comparePriceWrapper: '.product-single__price--wrapper',
  2157. quantityElements: '.js-quantity-selector, label + .js-qty',
  2158. originalSelectorId: '#ProductSelect',
  2159. singleOptionSelector: '.single-option-selector__radio',
  2160. radioWrapper: '.radio-wrapper',
  2161. meta: '.product-single__meta',
  2162. productWrapper: '.product-single',
  2163. shopifyPaymentButton: '.shopify-payment-button'
  2164. };
  2165.  
  2166. var $container = (this.$container = $(container));
  2167. var sectionId = $container.attr('data-section-id');
  2168.  
  2169. if (!$('#ProductJson-' + sectionId).html()) {
  2170. return;
  2171. }
  2172.  
  2173. this.productSingleObject = JSON.parse(
  2174. document.getElementById('ProductJson-' + sectionId).innerHTML
  2175. );
  2176. this.zoomType = $container.data('image-zoom-type');
  2177.  
  2178. this.initBreakpoints();
  2179. this.stringOverrides();
  2180. this.initProductVariant();
  2181. this.initStickyProductMeta();
  2182. this.productThumbnailSwitch();
  2183.  
  2184. if (this.zoomType) {
  2185. this.productImageZoom();
  2186. }
  2187.  
  2188. if (theme.settings.cartType === 'drawer') {
  2189. ajaxCart.init({
  2190. formSelector: '#AddToCartForm--' + sectionId,
  2191. cartContainer: '#CartContainer',
  2192. addToCartSelector: '#AddToCart--' + sectionId,
  2193. enableQtySelectors: true,
  2194. moneyFormat: theme.strings.moneyFormat
  2195. });
  2196. }
  2197.  
  2198. $window
  2199. .on('load' + this.settings.namespace, theme.initStickyProductMeta)
  2200. .on(
  2201. 'resize' + this.settings.namespace,
  2202. theme.debounce(this.initStickyProductMeta, 150).bind(this)
  2203. );
  2204. }
  2205.  
  2206. Product.prototype = _.assignIn({}, Product.prototype, {
  2207. initProductVariant: function() {
  2208. var options = {
  2209. $container: this.$container,
  2210. enableHistoryState:
  2211. this.$container.data('enable-history-state') || false,
  2212. singleOptionSelector: this.selectors.singleOptionSelector,
  2213. originalSelectorId: this.selectors.originalSelectorId,
  2214. product: this.productSingleObject
  2215. };
  2216.  
  2217. this.variants = new slate.Variants(options);
  2218. this.$container.on(
  2219. 'variantChange' + this.settings.namespace,
  2220. this.productPage.bind(this)
  2221. );
  2222. this.$container.on(
  2223. 'variantImageChange' + this.settings.namespace,
  2224. this.showVariantImage.bind(this)
  2225. );
  2226. },
  2227.  
  2228. initBreakpoints: function() {
  2229. var self = this;
  2230. var $container = self.$container;
  2231. self.zoomType = $container.data('image-zoom-type');
  2232.  
  2233. enquire.register(theme.variables.mediaQuerySmall, {
  2234. match: function() {
  2235. self.createImageCarousel();
  2236. if (self.zoomType) {
  2237. if ($(self.selectors.productImagePhoto).length) {
  2238. // remove event handlers for product zoom on mobile
  2239. $(self.selectors.productImagePhoto).off();
  2240. }
  2241. }
  2242. },
  2243. unmatch: function() {
  2244. self.destroyImageCarousel();
  2245. self.reorderImages();
  2246. if (self.zoomType) {
  2247. // reinit product zoom
  2248. self.productImageZoom();
  2249. }
  2250. }
  2251. });
  2252. },
  2253.  
  2254. stringOverrides: function() {
  2255. // Override defaults in theme.strings with potential
  2256. // template overrides
  2257.  
  2258. theme.productStrings = theme.productStrings || {};
  2259. $.extend(theme.strings, theme.productStrings);
  2260. },
  2261.  
  2262. resizeElements: function() {
  2263. $(
  2264. this.selectors.productGridImages,
  2265. this.$container
  2266. ).imagesLoaded(function() {
  2267. $(this.selectors.productGridImages, this.$container)
  2268. .css('height', 'auto')
  2269. .equalHeights();
  2270. });
  2271. },
  2272.  
  2273. showVariantImage: function(evt) {
  2274. var variant = evt.variant;
  2275. var $newImage = $(
  2276. '.product-single__photo[data-image-id="' +
  2277. variant.featured_image.id +
  2278. '"]'
  2279. );
  2280. var imageIndex;
  2281.  
  2282. if (variant && variant.featured_image) {
  2283. this.setActiveThumbnail(variant.featured_image.id);
  2284. }
  2285.  
  2286. if (theme.variables.bpSmall) {
  2287. // Switch carousel slide, unless it's the first photo on load
  2288. imageIndex = $newImage.closest('.slick-slide').attr('index');
  2289. // Navigate to slide unless it's the first photo on load
  2290. // If there is no index, slider is not initalized.
  2291. if (_.isUndefined(imageIndex)) {
  2292. return;
  2293. }
  2294.  
  2295. if (imageIndex !== 0 || theme.variables.productPageLoad) {
  2296. $(this.selectors.productImages, this.$container).slickGoTo(
  2297. imageIndex
  2298. );
  2299. }
  2300. // Switch image variant on thumbnail layout for desktop view;
  2301. // When a image variant is updated on mobile view, update the
  2302. // desktop view also.
  2303. if (!this.$container.data('scroll-to-image')) {
  2304. this.switchImage(variant.featured_image.id);
  2305. }
  2306. } else {
  2307. if (this.$container.data('scroll-to-image')) {
  2308. imageIndex = $newImage.closest('.slick-slide').index();
  2309. // Scroll to/reorder image unless it's the first photo on load
  2310. if (imageIndex !== 0 || theme.variables.productPageLoad) {
  2311. if (theme.variables.productPageSticky) {
  2312. // Scroll to variant image
  2313. $('html, body').animate(
  2314. {
  2315. scrollTop: $newImage.offset().top
  2316. },
  2317. 250
  2318. );
  2319. } else {
  2320. // Move selected variant image to top, preventing scrolling
  2321. var currentScroll = $(document).scrollTop();
  2322. $newImage
  2323. .closest(
  2324. $(
  2325. this.selectors.productImagePhotoFlexWrapper,
  2326. this.$container
  2327. )
  2328. )
  2329. .prependTo($(this.selectors.productImages, this.$container));
  2330. $(document).scrollTop(currentScroll);
  2331. }
  2332. }
  2333. } else {
  2334. // Thumbnail layout
  2335. // Move selected variant image to top
  2336. $newImage
  2337. .closest(
  2338. $(this.selectors.productImagePhotoFlexWrapper, this.$container)
  2339. )
  2340. .prependTo($(this.selectors.productImages, this.$container));
  2341. // Switch image variant for thumnail layout
  2342. this.switchImage(variant.featured_image.id);
  2343. }
  2344. }
  2345.  
  2346. if (!theme.variables.productPageLoad) {
  2347. theme.variables.productPageLoad = true;
  2348. }
  2349. },
  2350.  
  2351. switchImage: function(imageId) {
  2352. $(this.selectors.productImagePhotoContainer, this.$container).addClass(
  2353. 'hide'
  2354. );
  2355. $(this.selectors.productImagePhotoContainer, this.$container)
  2356. .filter('#ProductImageWrapper-' + imageId)
  2357. .removeClass('hide');
  2358. },
  2359.  
  2360. reorderImages: function() {
  2361. if (this.$container.data('scroll-to-image')) return;
  2362. var $newImage = $(
  2363. this.selectors.productImagePhotoContainer,
  2364. this.$container
  2365. ).not('.hide');
  2366. $newImage
  2367. .closest(
  2368. $(this.selectors.productImagePhotoFlexWrapper, this.$container)
  2369. )
  2370. .prependTo($(this.selectors.productImages, this.$container));
  2371. },
  2372.  
  2373. productThumbnailSwitch: function() {
  2374. var self = this;
  2375. var $productThumbnails = $('#ProductThumbs', this.$container).find(
  2376. this.selectors.productThumbnail
  2377. );
  2378.  
  2379. if ($productThumbnails.length) {
  2380. // Switch the main image with one of the thumbnails
  2381. // Note: this does not change the variant selected, just the image
  2382. $productThumbnails.on('click', function(evt) {
  2383. evt.preventDefault();
  2384. var newImageId = $(this).attr('data-image-id');
  2385. var $newImage = $(
  2386. '.product-single__photo[data-image-id="' + newImageId + '"]'
  2387. );
  2388.  
  2389. self.switchImage(newImageId);
  2390. self.setActiveThumbnail(newImageId);
  2391.  
  2392. // Thumbnail layout
  2393. // Move selected featured image to top
  2394. $newImage
  2395. .closest(
  2396. $(self.selectors.productImagePhotoFlexWrapper, self.$container)
  2397. )
  2398. .prependTo($(self.selectors.productImages, self.$container));
  2399. });
  2400. }
  2401. },
  2402.  
  2403. setActiveThumbnail: function(imageId) {
  2404. var $productThumbnails = $('#ProductThumbs', this.$container).find(
  2405. this.selectors.productThumbnail
  2406. );
  2407.  
  2408. if ($productThumbnails.length) {
  2409. var activeClass = 'active-thumb';
  2410. var $thumbnail = $(
  2411. this.selectors.productThumbnail + "[data-image-id='" + imageId + "']",
  2412. this.$container
  2413. );
  2414.  
  2415. $productThumbnails.removeClass(activeClass);
  2416. $thumbnail.addClass(activeClass);
  2417. }
  2418. },
  2419.  
  2420. productImageZoom: function() {
  2421. if (
  2422. !$(this.selectors.productImagePhoto, this.$container).length ||
  2423. theme.variables.bpSmall
  2424. ) {
  2425. return;
  2426. }
  2427.  
  2428. $(this.selectors.productImagePhoto, this.$container).magnificPopup({
  2429. type: 'image',
  2430. mainClass: 'mfp-fade',
  2431. closeOnBgClick: true,
  2432. closeBtnInside: false,
  2433. closeOnContentClick: true,
  2434. tClose: theme.strings.zoomClose,
  2435. removalDelay: 500,
  2436. gallery: {
  2437. enabled: true,
  2438. navigateByImgClick: false,
  2439. arrowMarkup:
  2440. '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"><span class="mfp-chevron mfp-chevron-%dir%"></span></button>',
  2441. tPrev: theme.strings.zoomPrev,
  2442. tNext: theme.strings.zoomNext
  2443. }
  2444. });
  2445. },
  2446.  
  2447. createImageCarousel: function() {
  2448. var self = this;
  2449.  
  2450. if (
  2451. !$(this.selectors.productImages, this.$container).length ||
  2452. $(this.selectors.productImagePhoto, this.$container).length < 2
  2453. ) {
  2454. return;
  2455. }
  2456.  
  2457. $(this.selectors.productImages, this.$container).slick({
  2458. arrows: false,
  2459. dots: true,
  2460. adaptiveHeight: true,
  2461. onAfterChange: function() {
  2462. // Let's do this after changing slides
  2463. // Update featured image and active thumbnail on desktop
  2464. // when changing slides
  2465. self.setFeaturedImage();
  2466. }
  2467. });
  2468. },
  2469.  
  2470. setFeaturedImage: function() {
  2471. // Thumbnail layout only
  2472. if (this.$container.data('scroll-to-image')) return;
  2473. var imageId = $(this.selectors.productImages, this.$container)
  2474. .find('.slick-slide.slick-active .product-single__photo')
  2475. .attr('data-image-id');
  2476.  
  2477. this.switchImage(imageId);
  2478. this.setActiveThumbnail(imageId);
  2479. },
  2480.  
  2481. destroyImageCarousel: function() {
  2482. if (!$(this.selectors.productImages, this.$container).length) {
  2483. return;
  2484. }
  2485. $(this.selectors.productImages, this.$container).unslick();
  2486. },
  2487.  
  2488. productPage: function(evt) {
  2489. var moneyFormat = theme.strings.moneyFormat;
  2490. var variant = evt.variant;
  2491. var translations = theme.strings;
  2492.  
  2493. if (variant) {
  2494. // Display variant image on featured product
  2495. if (!$('body').hasClass('template-product')) {
  2496. if (variant.featured_image) {
  2497. var $newImage = $(
  2498. this.selectors.productImageWrapper +
  2499. '[data-image-id="' +
  2500. variant.featured_image.id +
  2501. '"]',
  2502. this.$container
  2503. );
  2504. var $otherImages = $(
  2505. this.selectors.productImageWrapper +
  2506. ':not([data-image-id="' +
  2507. variant.featured_image.id +
  2508. '"])',
  2509. this.$container
  2510. );
  2511.  
  2512. $newImage.removeClass('hide');
  2513. $otherImages.addClass('hide');
  2514. }
  2515. }
  2516.  
  2517. $(this.selectors.priceContainer, this.$container).removeClass(
  2518. 'visibility-hidden'
  2519. );
  2520. $(this.selectors.productPrice, this.$container).attr(
  2521. 'aria-hidden',
  2522. 'false'
  2523. );
  2524. $(this.selectors.priceA11y, this.$container).attr(
  2525. 'aria-hidden',
  2526. 'false'
  2527. );
  2528.  
  2529. // Select a valid variant if available
  2530. if (variant.available) {
  2531. // Available, enable the submit button, change text, show quantity elements
  2532. $(this.selectors.addToCart, this.$container)
  2533. .removeClass('disabled')
  2534. .prop('disabled', false);
  2535. $(this.selectors.addToCartText, this.$container).html(
  2536. translations.addToCart
  2537. );
  2538. $(this.selectors.quantityElements, this.$container).show();
  2539. $(this.selectors.shopifyPaymentButton, this.$container).show();
  2540.  
  2541. // Update the full details link
  2542. var $link = $(this.selectors.productFullDetails, this.$container);
  2543. if ($link.length) {
  2544. $link.attr(
  2545. 'href',
  2546. this.updateUrlParameter($link.attr('href'), 'variant', variant.id)
  2547. );
  2548. }
  2549. } else {
  2550. // Sold out, disable the submit button, change text, hide quantity elements
  2551. $(this.selectors.addToCart, this.$container)
  2552. .addClass('disabled')
  2553. .prop('disabled', true);
  2554. $(this.selectors.addToCartText, this.$container).html(
  2555. translations.soldOut
  2556. );
  2557. $(this.selectors.quantityElements, this.$container).hide();
  2558. $(this.selectors.shopifyPaymentButton, this.$container).hide();
  2559. }
  2560.  
  2561. $(this.selectors.productPrice, this.$container)
  2562. .html(theme.Currency.formatMoney(variant.price, moneyFormat))
  2563. .show();
  2564.  
  2565. // Also update and show the product's compare price if necessary
  2566. if (variant.compare_at_price > variant.price) {
  2567. $(this.selectors.comparePrice, this.$container).html(
  2568. theme.Currency.formatMoney(variant.compare_at_price, moneyFormat)
  2569. );
  2570. $(this.selectors.comparePriceWrapper, this.$container).removeClass(
  2571. 'hide'
  2572. );
  2573. $(this.selectors.productPrice, this.$container).addClass('on-sale');
  2574. $(this.selectors.comparePriceWrapper, this.$container).attr(
  2575. 'aria-hidden',
  2576. 'false'
  2577. );
  2578. $(this.selectors.comparePriceA11y, this.$container).attr(
  2579. 'aria-hidden',
  2580. 'false'
  2581. );
  2582. } else {
  2583. $(this.selectors.comparePriceWrapper, this.$container)
  2584. .addClass('hide')
  2585. .attr('aria-hidden', 'true');
  2586. $(this.selectors.productPrice, this.$container).removeClass(
  2587. 'on-sale'
  2588. );
  2589. $(this.selectors.comparePrice, this.$container).html('');
  2590. $(this.selectors.comparePriceA11y, this.$container).attr(
  2591. 'aria-hidden',
  2592. 'true'
  2593. );
  2594. }
  2595.  
  2596. // Also Show SKU
  2597. $(this.selectors.SKU).html(variant.sku);
  2598. } else {
  2599. // The variant doesn't exist, disable submit button.
  2600. // This may be an error or notice that a specific variant is not available.
  2601. // To only show available variants, implement linked product options:
  2602. // - http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/linked-product-options
  2603. $(this.selectors.addToCart, this.$container)
  2604. .addClass('disabled')
  2605. .prop('disabled', true);
  2606. $(this.selectors.addToCartText, this.$container).html(
  2607. translations.unavailable
  2608. );
  2609. $(this.selectors.quantityElements, this.$container).hide();
  2610. $(this.selectors.shopifyPaymentButton, this.$container).hide();
  2611.  
  2612. $(this.selectors.priceContainer, this.$container).addClass(
  2613. 'visibility-hidden'
  2614. );
  2615. $(this.selectors.productPrice, this.$container).attr(
  2616. 'aria-hidden',
  2617. 'true'
  2618. );
  2619. $(this.selectors.priceA11y, this.$container).attr(
  2620. 'aria-hidden',
  2621. 'true'
  2622. );
  2623. $(this.selectors.comparePriceWrapper, this.$container).attr(
  2624. 'aria-hidden',
  2625. 'true'
  2626. );
  2627. $(this.selectors.comparePriceA11y, this.$container).attr(
  2628. 'aria-hidden',
  2629. 'true'
  2630. );
  2631. }
  2632. },
  2633.  
  2634. updateUrlParameter: function(url, key, value) {
  2635. var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
  2636. var separator = url.indexOf('?') === -1 ? '?' : '&';
  2637.  
  2638. if (url.match(re)) {
  2639. return url.replace(re, '$1' + key + '=' + value + '$2');
  2640. } else {
  2641. return url + separator + key + '=' + value;
  2642. }
  2643. },
  2644.  
  2645. initStickyProductMeta: function() {
  2646. var $meta = $(this.selectors.meta, this.$container);
  2647. var $wrapper = $(this.selectors.productWrapper, this.$container);
  2648.  
  2649. if ($meta.find('#shopify-product-reviews').length) {
  2650. theme.variables.productPageSticky = false;
  2651. return;
  2652. }
  2653.  
  2654. if (
  2655. !$meta.length ||
  2656. $(this.selectors.productImagePhoto, this.$container).length < 2
  2657. ) {
  2658. return;
  2659. }
  2660.  
  2661. // Force detatch if already detached. Prevent layout issues.
  2662. $meta.trigger('detach.ScrollToFixed');
  2663.  
  2664. // Detach and stop if on mobile breakpoint
  2665. if (theme.variables.bpSmall) {
  2666. return;
  2667. }
  2668.  
  2669. var productCopyHeight = $meta.outerHeight();
  2670. var productImagesHeight = $(
  2671. this.selectors.productImages,
  2672. this.$container
  2673. ).height();
  2674.  
  2675. /*============================================================================
  2676. Calculate when to detach fixed element to avoid content overlap.
  2677. Subtract product copy height from the limit because plugin uses offset().top
  2678. ==============================================================================*/
  2679. var calcLimit = $wrapper.offset().top + $wrapper.height();
  2680. calcLimit -= productCopyHeight;
  2681.  
  2682. // Init sticky if desc shorter than images and fits in viewport
  2683. if (
  2684. productCopyHeight < productImagesHeight &&
  2685. productCopyHeight < $(window).height()
  2686. ) {
  2687. theme.variables.productPageSticky = true;
  2688. $meta.scrollToFixed({
  2689. limit: calcLimit
  2690. });
  2691. } else {
  2692. theme.variables.productPageSticky = false;
  2693. }
  2694. },
  2695.  
  2696. onUnload: function() {
  2697. this.$container.off(this.settings.namespace);
  2698. this.destroyImageCarousel();
  2699. }
  2700. });
  2701.  
  2702. return Product;
  2703. })();
  2704.  
  2705. window.theme = window.theme || {};
  2706.  
  2707. theme.Collection = (function() {
  2708. function Collection(container) {
  2709. this.selectors = {
  2710. productGridImages: '.grid-uniform .grid-product__image-wrapper',
  2711. $productGridRows: $('.collage-grid__row'),
  2712. productGridPhotosLarge: '.grid__item--large .grid-product__image-link',
  2713. $collectionImage: $('.collection-hero__image'),
  2714. filterDropdowns: '.filter-dropdown',
  2715. filterSelect: '.filter-dropdown__select',
  2716. filterLabel: '.filter-dropdown__label',
  2717. sortDropdown: '#sortBy'
  2718. };
  2719.  
  2720. var $container = (this.$container = $(container));
  2721. this.gridType = $container.data('grid-type');
  2722.  
  2723. this.selectors.$collectionImage.addClass('is-init');
  2724.  
  2725. // Enable parallax effect if 3d transforms are supported
  2726. if (!Modernizr.csstransforms3d) {
  2727. return;
  2728. }
  2729.  
  2730. theme.cache.$window.on('scroll', function() {
  2731. var scrolled = theme.cache.$window.scrollTop();
  2732. theme.cache.$collectionImage.css({
  2733. transform: 'translate3d(0, ' + scrolled / 4.5 + 'px, 0)'
  2734. });
  2735. });
  2736.  
  2737. this.init();
  2738. }
  2739.  
  2740. Collection.prototype = _.assignIn({}, Collection.prototype, {
  2741. init: function() {
  2742. this.cacheSelectors();
  2743. this.setQueryParams();
  2744.  
  2745. this.cache.$sortDropdown.on('change', this.sortCollection.bind(this));
  2746.  
  2747. if (this.gridType === 'collage') {
  2748. this.initCollageGrid();
  2749. } else if (this.gridType === 'grid') {
  2750. theme.equalHeights.call(this);
  2751. }
  2752. },
  2753.  
  2754. updateFilterLabel: function(evt, element) {
  2755. var $select = evt ? $(evt.target) : $(element);
  2756. var $label = $select
  2757. .prev('.filter-dropdown__label')
  2758. .find('.filter-dropdown__label--active');
  2759. var selectedVariant = $select.find('option:selected').text();
  2760.  
  2761. $label.html(' ' + selectedVariant);
  2762. this.cache.$filterDropdowns.addClass('loaded');
  2763. },
  2764.  
  2765. cacheSelectors: function() {
  2766. this.cache = {
  2767. $html: $('html'),
  2768. $window: $(window),
  2769. $productGridImages: $(this.selectors.productGridImages),
  2770. $productGridRows: $(this.selectors.productGridRows),
  2771. $productGridPhotosLarge: $(this.selectors.productGridPhotosLarge),
  2772. $filterDropdowns: $(this.selectors.filterDropdowns),
  2773. $filterSelect: $(this.selectors.filterSelect),
  2774. $filterLabel: $(this.selectors.filterLabel),
  2775. $sortDropdown: $(this.selectors.sortDropdown)
  2776. };
  2777. },
  2778.  
  2779. setQueryParams: function() {
  2780. //don't execute if sort dropdown is not present.
  2781. if (!this.cache.$sortDropdown.length) {
  2782. return;
  2783. }
  2784.  
  2785. Shopify.queryParams = this.parseQueryString();
  2786. },
  2787.  
  2788. parseQueryString: function() {
  2789. if (!location.search.length) {
  2790. return {};
  2791. }
  2792.  
  2793. var params = {};
  2794.  
  2795. for (
  2796. var aKeyValue, i = 0, aCouples = location.search.substr(1).split('&');
  2797. i < aCouples.length;
  2798. i++
  2799. ) {
  2800. aKeyValue = aCouples[i].split('=');
  2801. if (aKeyValue.length > 1) {
  2802. params[decodeURIComponent(aKeyValue[0])] = decodeURIComponent(
  2803. aKeyValue[1]
  2804. );
  2805. }
  2806. }
  2807. return params;
  2808. },
  2809.  
  2810. initCollageGrid: function() {
  2811. if (!this.cache.$productGridRows.length) {
  2812. return;
  2813. }
  2814.  
  2815. this.collageGridHeights();
  2816.  
  2817. theme.cache.$window.on(
  2818. 'resize',
  2819. theme.debounce(this.collageGridHeights, 500)
  2820. );
  2821. },
  2822.  
  2823. collageGridHeights: function() {
  2824. if (theme.variables.bpSmall || !this.cache.$productGridRows.length) {
  2825. return;
  2826. }
  2827.  
  2828. // calculate image heights for each row of grid images
  2829. for (var i = this.cache.$productGridRows.length - 1; i >= 0; i--) {
  2830. var $currentRow = $(this.cache.$productGridRows[i]);
  2831. var $smallImages = $currentRow.find(
  2832. '.grid__item--small .grid-product__image-wrapper'
  2833. );
  2834. var $largeImageWrapper = $currentRow.find(
  2835. '.grid__item--large .grid-product__image-wrapper'
  2836. );
  2837. var $largeImage = $largeImageWrapper.find('.grid-product__image-link');
  2838.  
  2839. // calculate the bottom edge of the small image
  2840. var smallImageOffset =
  2841. $smallImages[1].offsetTop + $smallImages[1].offsetHeight;
  2842.  
  2843. // calculate the bottom edge of the large image for the row
  2844. var largeImageOffset =
  2845. $largeImageWrapper[0].offsetTop + $largeImageWrapper[0].offsetHeight;
  2846.  
  2847. var largeImageHeight = 0;
  2848.  
  2849. // Depending on which image is lower, increase or decrease the large
  2850. // image size
  2851. if (smallImageOffset > largeImageOffset) {
  2852. largeImageHeight =
  2853. $largeImage.height() + (smallImageOffset - largeImageOffset);
  2854. } else {
  2855. largeImageHeight =
  2856. $largeImage.height() - (largeImageOffset - smallImageOffset);
  2857. }
  2858.  
  2859. $largeImage.css('height', largeImageHeight);
  2860. }
  2861. },
  2862.  
  2863. clearCollageGridHeights: function() {
  2864. if (!this.cache.$productGridRows.length) {
  2865. return;
  2866. }
  2867.  
  2868. this.cache.$productGridPhotosLarge.removeAttr('style');
  2869. },
  2870.  
  2871. collectionSorting: function() {
  2872. if (!this.cache.$tagList.length) {
  2873. return;
  2874. }
  2875.  
  2876. this.cache.$tagList.on('change', function() {
  2877. window.location.href = $(this).val();
  2878. });
  2879. },
  2880.  
  2881. sortCollection: function() {
  2882. if (!this.cache.$sortDropdown.length) {
  2883. return;
  2884. }
  2885.  
  2886. if (Shopify.queryParams.page) {
  2887. delete Shopify.queryParams.page;
  2888. }
  2889. Shopify.queryParams.sort_by = this.cache.$sortDropdown.val();
  2890. location.search = jQuery.param(Shopify.queryParams);
  2891. }
  2892. });
  2893.  
  2894. return Collection;
  2895. })();
  2896.  
  2897. window.theme = window.theme || {};
  2898.  
  2899. theme.HeaderSection = (function() {
  2900. function Header(container) {
  2901. timber.drawersInit();
  2902. theme.initCache();
  2903. theme.fitNav();
  2904. theme.resizeLogo();
  2905. theme.searchModal();
  2906.  
  2907. var $container = (this.$container = $(container));
  2908. this.template = $container.attr('data-template');
  2909.  
  2910. // ajaxCart.init will run from Product.prototype when on the product page
  2911. if (
  2912. theme.settings.cartType === 'drawer' &&
  2913. this.template.indexOf('product') === -1
  2914. ) {
  2915. ajaxCart.init({
  2916. formSelector: '.add-to-cart__form',
  2917. cartContainer: '#CartContainer',
  2918. addToCartSelector: '.add-to-cart',
  2919. enableQtySelectors: true,
  2920. moneyFormat: theme.strings.moneyFormat
  2921. });
  2922. }
  2923.  
  2924. theme.cache.$window.on('load', theme.resizeLogo);
  2925. theme.cache.$window.on('resize', theme.debounce(theme.resizeLogo, 150));
  2926.  
  2927. // Check for header absolute position
  2928. if ($('#Hero').hasClass('hero')) {
  2929. $('.header-wrapper').addClass('hero__header');
  2930. } else {
  2931. $('.header-wrapper').removeClass('hero__header');
  2932. }
  2933.  
  2934. this.initSideBarDropDowns();
  2935. }
  2936.  
  2937. Header.prototype = _.assignIn({}, Header.prototype, {
  2938. onSelect: function() {
  2939. this.handleDrawerOpenInEditor(event);
  2940. },
  2941.  
  2942. onDeselect: function() {
  2943. timber.LeftDrawer.close(event);
  2944. },
  2945.  
  2946. handleDrawerOpenInEditor: function(event) {
  2947. if (
  2948. theme.cache.$siteNav.hasClass('site-nav--compress') ||
  2949. theme.variables.bpSmall
  2950. ) {
  2951. setTimeout(function() {
  2952. timber.LeftDrawer.drawerIsOpen = false;
  2953. timber.LeftDrawer.open();
  2954. }, 500);
  2955. } else if (!theme.cache.$siteNav.hasClass('site-nav--compress')) {
  2956. timber.LeftDrawer.drawerIsOpen = true;
  2957. timber.LeftDrawer.close(event);
  2958. }
  2959. },
  2960.  
  2961. initSideBarDropDowns: function() {
  2962. var $toggleBtns = $('.mobile-nav__toggle-btn');
  2963. // Setup aria attributes
  2964. $toggleBtns.attr('aria-expanded', 'false');
  2965.  
  2966. $toggleBtns.each(function() {
  2967. var $button = $(this);
  2968. $button.attr('aria-controls', $button.attr('data-aria-controls'));
  2969. });
  2970.  
  2971. $toggleBtns.on('click', function() {
  2972. var $button = $(this);
  2973. var currentlyExpanded = $button.attr('aria-expanded');
  2974. var toggleState = false;
  2975. // Updated aria-expanded value based on state pre-click
  2976. if (currentlyExpanded === 'true') {
  2977. $button.attr('aria-expanded', 'false');
  2978. } else {
  2979. $button.attr('aria-expanded', 'true');
  2980. toggleState = true;
  2981. }
  2982.  
  2983. // Toggle that expands/collapses sublist
  2984. $button
  2985. .closest('.mobile-nav__has-sublist')
  2986. .toggleClass('mobile-nav--expanded', toggleState)
  2987. .next()
  2988. .slideToggle();
  2989. });
  2990. }
  2991. });
  2992.  
  2993. return Header;
  2994. })();
  2995.  
  2996. window.theme = window.theme || {};
  2997.  
  2998. theme.FeaturedContentSection = (function() {
  2999. function FeaturedContent() {
  3000. theme.styleTextLinks();
  3001. }
  3002.  
  3003. return FeaturedContent;
  3004. })();
  3005.  
  3006. window.theme = window.theme || {};
  3007.  
  3008. theme.NewsletterSection = (function() {
  3009. function Newsletter() {
  3010. theme.styleTextLinks();
  3011. }
  3012.  
  3013. return Newsletter;
  3014. })();
  3015.  
  3016. theme.SlideshowSection = (function() {
  3017. function SlideshowSection() {
  3018. theme.initCache();
  3019.  
  3020. var $slideshow = (this.$slideshow = $('#Hero'));
  3021. var autoplay = (this.autoplay = $slideshow.data('autoplay'));
  3022.  
  3023. slickTheme.init({
  3024. $element: $slideshow,
  3025. parallax: $slideshow.data('parallax'),
  3026. autoplay: autoplay,
  3027. autoplaySpeed: $slideshow.data('autoplayspeed'),
  3028. adaptHeight: $slideshow.data('adapt'),
  3029. arrows: true
  3030. });
  3031.  
  3032. // remove header absolute display if slideshow is empty
  3033. if (!$slideshow.hasClass('hero')) {
  3034. $('.header-wrapper').removeClass(slickTheme.vars.heroHeaderClass);
  3035. }
  3036. }
  3037.  
  3038. return SlideshowSection;
  3039. })();
  3040.  
  3041. theme.SlideshowSection.prototype = _.assignIn(
  3042. {},
  3043. theme.SlideshowSection.prototype,
  3044. {
  3045. onUnload: function() {
  3046. this.$slideshow.unslick();
  3047. },
  3048.  
  3049. onBlockSelect: function(evt) {
  3050. var $slide = $('.slide--' + evt.detail.blockId);
  3051. var slideIndex = $slide.attr('index');
  3052.  
  3053. // Go to selected slide, pause autoplay
  3054. this.$slideshow.slickGoTo(slideIndex);
  3055. if (this.autoplay) {
  3056. this.$slideshow.slickPause();
  3057. }
  3058. },
  3059.  
  3060. onBlockDeselect: function() {
  3061. if (
  3062. this.autoplay &&
  3063. !slickTheme.cache.$pauseButton.hasClass(slickTheme.vars.pausedClass)
  3064. ) {
  3065. this.$slideshow.slickPlay();
  3066. }
  3067. }
  3068. }
  3069. );
  3070.  
  3071. window.theme = window.theme || {};
  3072.  
  3073. theme.PasswordHeader = (function() {
  3074. function PasswordHeader() {
  3075. this.init();
  3076. }
  3077.  
  3078. PasswordHeader.prototype = _.assignIn({}, PasswordHeader.prototype, {
  3079. init: function() {
  3080. $('.js-toggle-login-modal').magnificPopup({
  3081. type: 'inline',
  3082. mainClass: 'mfp-fade',
  3083. closeOnBgClick: false,
  3084. closeBtnInside: false,
  3085. closeOnContentClick: false,
  3086. tClose: password.strings.pageClose,
  3087. removalDelay: 500,
  3088. callbacks: {
  3089. open: function() {
  3090. window.setTimeout(function() {
  3091. document.getElementById('password').focus();
  3092. }, 50);
  3093. },
  3094. close: function() {
  3095. window.setTimeout(function() {
  3096. document.getElementById('email').focus();
  3097. }, 50);
  3098. }
  3099. }
  3100. });
  3101. if ($('.storefront-password-form .errors').size()) {
  3102. $('.js-toggle-login-modal').click();
  3103. }
  3104. }
  3105. });
  3106.  
  3107. return PasswordHeader;
  3108. })();
  3109.  
  3110. window.theme = window.theme || {};
  3111.  
  3112. theme.PasswordContent = (function() {
  3113. function PasswordContent() {
  3114. theme.styleTextLinks();
  3115. }
  3116.  
  3117. return PasswordContent;
  3118. })();
  3119.  
  3120. theme.Maps = (function() {
  3121. var config = {
  3122. zoom: 14
  3123. };
  3124. var apiStatus = null;
  3125. var mapsToLoad = [];
  3126.  
  3127. var errors = {
  3128. addressNoResults: theme.strings.addressNoResults,
  3129. addressQueryLimit: theme.strings.addressQueryLimit,
  3130. addressError: theme.strings.addressError,
  3131. authError: theme.strings.authError
  3132. };
  3133.  
  3134. var selectors = {
  3135. section: '[data-section-type="map"]',
  3136. map: '[data-map]',
  3137. mapOverlay: '[data-map-overlay]'
  3138. };
  3139.  
  3140. var classes = {
  3141. mapError: 'map-section--load-error',
  3142. errorMsg: 'map-section__error errors text-center'
  3143. };
  3144.  
  3145. // Global function called by Google on auth errors.
  3146. // Show an auto error message on all map instances.
  3147. // eslint-disable-next-line camelcase, no-unused-vars
  3148. window.gm_authFailure = function() {
  3149. if (!Shopify.designMode) return;
  3150.  
  3151. if (Shopify.designMode) {
  3152. $(selectors.section).addClass(classes.mapError);
  3153. $(selectors.map).remove();
  3154. $(selectors.mapOverlay).after(
  3155. '<div class="' +
  3156. classes.errorMsg +
  3157. '">' +
  3158. theme.strings.authError +
  3159. '</div>'
  3160. );
  3161. }
  3162. };
  3163.  
  3164. function Map(container) {
  3165. this.$container = $(container);
  3166. this.$map = this.$container.find(selectors.map);
  3167. this.key = this.$map.data('api-key');
  3168.  
  3169. if (typeof this.key !== 'string' || this.key === '') {
  3170. return;
  3171. }
  3172.  
  3173. if (apiStatus === 'loaded') {
  3174. var self = this;
  3175.  
  3176. // Check if the script has previously been loaded with this key
  3177. var $script = $('script[src*="' + this.key + '&"]');
  3178. if ($script.length === 0) {
  3179. $.getScript(
  3180. 'https://maps.googleapis.com/maps/api/js?key=' + this.key
  3181. ).then(function() {
  3182. apiStatus = 'loaded';
  3183. self.createMap();
  3184. });
  3185. } else {
  3186. this.createMap();
  3187. }
  3188. } else {
  3189. mapsToLoad.push(this);
  3190.  
  3191. if (apiStatus !== 'loading') {
  3192. apiStatus = 'loading';
  3193. if (typeof window.google === 'undefined') {
  3194. $.getScript(
  3195. 'https://maps.googleapis.com/maps/api/js?key=' + this.key
  3196. ).then(function() {
  3197. apiStatus = 'loaded';
  3198. initAllMaps();
  3199. });
  3200. }
  3201. }
  3202. }
  3203. }
  3204.  
  3205. function initAllMaps() {
  3206. // API has loaded, load all Map instances in queue
  3207. $.each(mapsToLoad, function(index, instance) {
  3208. instance.createMap();
  3209. });
  3210. }
  3211.  
  3212. function geolocate($map) {
  3213. var deferred = $.Deferred();
  3214. var geocoder = new google.maps.Geocoder();
  3215. var address = $map.data('address-setting');
  3216.  
  3217. geocoder.geocode({ address: address }, function(results, status) {
  3218. if (status !== google.maps.GeocoderStatus.OK) {
  3219. deferred.reject(status);
  3220. }
  3221.  
  3222. deferred.resolve(results);
  3223. });
  3224.  
  3225. return deferred;
  3226. }
  3227.  
  3228. Map.prototype = _.assignIn({}, Map.prototype, {
  3229. createMap: function() {
  3230. var $map = this.$map;
  3231.  
  3232. return geolocate($map)
  3233. .then(
  3234. function(results) {
  3235. var mapOptions = {
  3236. zoom: config.zoom,
  3237. center: results[0].geometry.location,
  3238. draggable: false,
  3239. clickableIcons: false,
  3240. scrollwheel: false,
  3241. disableDoubleClickZoom: true,
  3242. disableDefaultUI: true
  3243. };
  3244.  
  3245. var map = (this.map = new google.maps.Map($map[0], mapOptions));
  3246. var center = (this.center = map.getCenter());
  3247.  
  3248. //eslint-disable-next-line no-unused-vars
  3249. var marker = new google.maps.Marker({
  3250. map: map,
  3251. position: map.getCenter()
  3252. });
  3253.  
  3254. google.maps.event.addDomListener(window, 'resize', function() {
  3255. google.maps.event.trigger(map, 'resize');
  3256. map.setCenter(center);
  3257. $map.removeAttr('style');
  3258. });
  3259. }.bind(this)
  3260. )
  3261. .fail(function() {
  3262. var errorMessage;
  3263.  
  3264. switch (status) {
  3265. case 'ZERO_RESULTS':
  3266. errorMessage = errors.addressNoResults;
  3267. break;
  3268. case 'OVER_QUERY_LIMIT':
  3269. errorMessage = errors.addressQueryLimit;
  3270. break;
  3271. case 'REQUEST_DENIED':
  3272. errorMessage = errors.authError;
  3273. break;
  3274. default:
  3275. errorMessage = errors.addressError;
  3276. break;
  3277. }
  3278.  
  3279. // Show errors only to merchant in the editor.
  3280. if (Shopify.designMode) {
  3281. $map
  3282. .parent()
  3283. .addClass(classes.mapError)
  3284. .html(
  3285. '<div class="' +
  3286. classes.errorMsg +
  3287. '">' +
  3288. errorMessage +
  3289. '</div>'
  3290. );
  3291. }
  3292. });
  3293. },
  3294.  
  3295. onUnload: function() {
  3296. if (this.$map.length === 0) {
  3297. return;
  3298. }
  3299. google.maps.event.clearListeners(this.map, 'resize');
  3300. }
  3301. });
  3302.  
  3303. return Map;
  3304. })();
  3305.  
  3306. window.theme = window.theme || {};
  3307.  
  3308. theme.Search = (function() {
  3309. function Search() {
  3310. theme.equalHeights();
  3311. }
  3312.  
  3313. return Search;
  3314. })();
  3315.  
  3316.  
  3317. theme.variables = {
  3318. productPageLoad : false,
  3319. productPageSticky : true,
  3320.  
  3321. // Breakpoints from src/stylesheets/global/variables.scss.liquid
  3322. mediaQuerySmall : 'screen and (max-width: 590px)',
  3323. mediaQueryMedium : 'screen and (min-width: 591px) and (max-width: 768px)',
  3324. mediaQueryMediumUp : 'screen and (min-width: 591px)',
  3325. mediaQueryLarge : 'screen and (min-width: 769px)',
  3326. bpSmall : false
  3327. };
  3328.  
  3329. theme.initCache = function() {
  3330. theme.cache = {
  3331. $window : $(window),
  3332. $html : $('html'),
  3333. $body : $('body'),
  3334. $drawerRight : $('.drawer--right'),
  3335.  
  3336. $hero : $('#Hero'),
  3337. $customSelect : $('.js-selector'),
  3338.  
  3339. $collectionImage : $('.collection-hero__image'),
  3340.  
  3341. $siteHeader : $('.site-header'),
  3342. $siteNav : $('.site-nav'),
  3343. $siteNavOpen : $('.site-nav--open'),
  3344. $cartBuggle : $('.cart-link__bubble'),
  3345. $logoWrapper : $('.site-header__logo'),
  3346. $logo : $('.site-header__logo img'),
  3347. $toggleSearchModal : $('.js-toggle-search-modal'),
  3348. $searchBox : $('.site-nav--search__bar'),
  3349.  
  3350. $productImages : $('.product-single__photos'),
  3351. $productImagePhoto : $('.product-single__photo'),
  3352.  
  3353. $indentedRteImages : $('.rte--indented-images'),
  3354.  
  3355. $productGridRows : $('.collage-grid__row'),
  3356. $productGridPhotosLarge : $('.grid__item--large .grid-product__image-link'),
  3357.  
  3358. // Equal height elements
  3359. $productGridImages : $('.grid-uniform .grid-product__image-wrapper'),
  3360.  
  3361. $returnLink : $('.return-link')
  3362. };
  3363. };
  3364.  
  3365. theme.init = function() {
  3366. theme.initCache();
  3367. theme.setBreakpoints();
  3368. theme.fitNav();
  3369. theme.cartInit();
  3370. theme.afterCartLoad();
  3371. theme.checkoutIndicator();
  3372. theme.returnLink();
  3373. theme.styleTextLinks();
  3374. theme.searchModal();
  3375.  
  3376. // Functions to run on load so image sizes can be calculated
  3377. theme.cache.$window.on('load', theme.resizeLogo);
  3378. theme.cache.$window.on('load', theme.articleImages);
  3379.  
  3380. // Functions to re-run on resize
  3381. theme.cache.$window.on('resize', theme.debounce(theme.resizeLogo, 150));
  3382. };
  3383.  
  3384. theme.returnLink = function() {
  3385. if (!document.referrer || !theme.cache.$returnLink.length || !window.history.length) {
  3386. return;
  3387. }
  3388.  
  3389. theme.cache.$returnLink.on('click', theme.backButton);
  3390. };
  3391.  
  3392. theme.backButton = function() {
  3393. var referrerDomain = urlDomain(document.referrer);
  3394. var shopDomain = urlDomain(document.url);
  3395.  
  3396. if (shopDomain === referrerDomain) {
  3397. history.back();
  3398. return false;
  3399. }
  3400.  
  3401. function urlDomain(url) {
  3402. var a = document.createElement('a');
  3403. a.href = url;
  3404. return a.hostname;
  3405. }
  3406. };
  3407.  
  3408. theme.setBreakpoints = function() {
  3409. enquire.register(theme.variables.mediaQuerySmall, {
  3410. match: function() {
  3411. if (theme.settings.gridType === 'collage') {
  3412. theme.clearCollageGridHeights();
  3413. }
  3414.  
  3415. theme.variables.bpSmall = true;
  3416. },
  3417. unmatch: function() {
  3418. theme.variables.bpSmall = false;
  3419. }
  3420. });
  3421.  
  3422. };
  3423.  
  3424. theme.fitNav = function() {
  3425. // Measure children of site nav on load and resize.
  3426. // If wider than parent, switch to mobile nav.
  3427. controlNav();
  3428. theme.cache.$window.on('load', controlNav);
  3429. theme.cache.$window.on('resize', theme.debounce(controlNav, 150));
  3430.  
  3431. function controlNav() {
  3432. // Subtract 20 from width to account for inline-block spacing
  3433. var navWidth = theme.cache.$siteNav.parent().outerWidth() - 20;
  3434. var navItemWidth = 0;
  3435. theme.cache.$siteNav.find('> li').each(function() {
  3436. var $el = $(this);
  3437. // Round up to be safe
  3438. navItemWidth += Math.ceil($(this).width());
  3439. });
  3440.  
  3441. if (navItemWidth > navWidth) {
  3442. theme.cache.$siteNav.addClass('site-nav--compress');
  3443. theme.cache.$siteNav.parent().removeClass('large--two-thirds').addClass('large--one-sixth');
  3444. theme.cache.$siteNavOpen.addClass('site-nav--open__display');
  3445. theme.cache.$siteNavOpen.parent().removeClass('large--hide');
  3446. theme.cache.$logoWrapper.parent().removeClass('large--one-third').addClass('large--two-thirds');
  3447. theme.cache.$logoWrapper.removeClass('large--left').addClass('text-center');
  3448. theme.cache.$searchBox.hide();
  3449. } else {
  3450. theme.cache.$siteNav.removeClass('site-nav--compress');
  3451. theme.cache.$siteNavOpen.removeClass('site-nav--open__display');
  3452. theme.cache.$siteNavOpen.parent().addClass('large--hide');
  3453. theme.cache.$searchBox.show();
  3454. }
  3455.  
  3456. theme.cache.$siteNav.addClass('site-nav--init');
  3457. theme.cache.$siteNavOpen.addClass('site-nav--init');
  3458. }
  3459. };
  3460.  
  3461. theme.resizeLogo = function() {
  3462. // Using .each() as there can be a reversed logo too
  3463. theme.cache.$logo.each(function() {
  3464. var $el = $(this),
  3465. logoWidthOnScreen = $el.width(),
  3466. containerWidth = $el.closest('.grid__item').width();
  3467. // If image exceeds container, let's make it smaller
  3468. if (logoWidthOnScreen > containerWidth) {
  3469. $el.css('maxWidth', containerWidth);
  3470. }
  3471. else {
  3472. $el.removeAttr('style');
  3473. }
  3474. });
  3475. };
  3476.  
  3477. theme.sizeCartDrawerFooter = function() {
  3478. // Stop if our drawer doesn't have a fixed footer
  3479. if (!theme.cache.$drawerRight.hasClass('drawer--has-fixed-footer')) {
  3480. return;
  3481. }
  3482.  
  3483. // Elements are reprinted regularly so selectors are not cached
  3484. var $cartFooter = $('.ajaxcart__footer').removeAttr('style');
  3485. var $cartInner = $('.ajaxcart__inner').removeAttr('style');
  3486. var cartFooterHeight = $cartFooter.outerHeight();
  3487. var cartDrawerTitleHeight = $('.drawer--right .drawer__header').outerHeight();
  3488. var $cartDrawerInner = $('.drawer--right .drawer__inner');
  3489.  
  3490. if(cartDrawerTitleHeight != 80) {
  3491. $cartDrawerInner.css('top', cartDrawerTitleHeight);
  3492. }
  3493.  
  3494. $cartInner.css('bottom', cartFooterHeight);
  3495. $cartFooter.css('height', cartFooterHeight);
  3496. };
  3497.  
  3498. theme.afterCartLoad = function() {
  3499. theme.cache.$body.on('ajaxCart.afterCartLoad', function(evt, cart) {
  3500. // Open cart drawer
  3501. timber.RightDrawer.open();
  3502.  
  3503. // Size the cart's fixed footer
  3504. theme.sizeCartDrawerFooter();
  3505.  
  3506. // Show cart bubble in nav if items exist
  3507. if (cart.items.length > 0) {
  3508. theme.cache.$cartBuggle.addClass('cart-link__bubble--visible');
  3509. } else {
  3510. theme.cache.$cartBuggle.removeClass('cart-link__bubble--visible');
  3511. }
  3512. });
  3513. };
  3514.  
  3515. theme.checkoutIndicator = function() {
  3516. // Add a loading indicator on the cart checkout button (/cart and drawer)
  3517. theme.cache.$body.on('click', '.cart__checkout', function() {
  3518. $(this).addClass('btn--loading');
  3519. });
  3520. };
  3521.  
  3522. theme.searchModal = function() {
  3523. if (!theme.cache.$toggleSearchModal.length) {
  3524. return;
  3525. }
  3526.  
  3527. theme.cache.$toggleSearchModal.magnificPopup({
  3528. type: 'inline',
  3529. mainClass: 'mfp-fade',
  3530. closeOnBgClick: true,
  3531. closeBtnInside: false,
  3532. closeOnContentClick: false,
  3533. tClose: theme.strings.zoomClose,
  3534. alignTop: true,
  3535. removalDelay: 500
  3536. });
  3537. }
  3538.  
  3539. theme.clearCollageGridHeights = function() {
  3540. if (!theme.cache.$productGridRows.length) {
  3541. return;
  3542. };
  3543.  
  3544. theme.cache.$productGridPhotosLarge.removeAttr('style');
  3545. };
  3546.  
  3547. theme.articleImages = function() {
  3548. if (!theme.cache.$indentedRteImages.length) {
  3549. return;
  3550. }
  3551.  
  3552. theme.cache.$indentedRteImages.find('img').each(function() {
  3553. var $el = $(this);
  3554. var attr = $el.attr('style');
  3555.  
  3556. // Check if undefined or float: none
  3557. if (!attr || attr == 'float: none;') {
  3558. // Remove grid-breaking styles if image isn't wider than parent
  3559. if ($el.width() < theme.cache.$indentedRteImages.width()) {
  3560. $el.addClass('rte__no-indent');
  3561. }
  3562. }
  3563. });
  3564. };
  3565.  
  3566. theme.styleTextLinks = function() {
  3567. $('.rte').find('a:not(:has(img))').addClass('text-link');
  3568. };
  3569.  
  3570. theme.equalHeights = function() {
  3571. var self = this;
  3572. theme.cache.$window.on('load', resizeElements());
  3573.  
  3574. theme.cache.$window.on(
  3575. 'resize',
  3576. afterResize(
  3577. function() {
  3578. resizeElements();
  3579. },
  3580. 250,
  3581. 'equal-heights'
  3582. )
  3583. );
  3584.  
  3585. function resizeElements() {
  3586. self.cache.$productGridImages.css('height', 'auto').equalHeights();
  3587. }
  3588. };
  3589.  
  3590. theme.cartInit = function() {
  3591. if (!theme.cookiesEnabled()) {
  3592. theme.cache.$body.addClass('cart--no-cookies');
  3593. }
  3594. };
  3595.  
  3596. theme.cookiesEnabled = function() {
  3597. var cookieEnabled = navigator.cookieEnabled;
  3598.  
  3599. if (!cookieEnabled){
  3600. document.cookie = 'testcookie';
  3601. cookieEnabled = (document.cookie.indexOf('testcookie') !== -1);
  3602. }
  3603. return cookieEnabled;
  3604. }
  3605.  
  3606. $(document).ready(function() {
  3607. theme.init();
  3608. var sections = new theme.Sections();
  3609.  
  3610. sections.register('product-template', theme.Product);
  3611. sections.register('collection-template', theme.Collection);
  3612. sections.register('header-section', theme.HeaderSection);
  3613. sections.register('featured-content-section', theme.FeaturedContentSection);
  3614. sections.register('newsletter-section', theme.NewsletterSection);
  3615. sections.register('slideshow-section', theme.SlideshowSection);
  3616. sections.register('password-header', theme.PasswordHeader);
  3617. sections.register('password-content', theme.PasswordContent);
  3618. sections.register('map', theme.Maps);
  3619. sections.register('search', theme.Search);
  3620. });
  3621.  
  3622. /*
  3623. * Run function after window resize
  3624. * http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed
  3625. */
  3626. var afterResize = (function () {
  3627. var t = {};
  3628. return function (callback, ms, uniqueId) {
  3629. if (!uniqueId) {
  3630. uniqueId = "Don't call this twice without a uniqueId";
  3631. }
  3632. if (t[uniqueId]) {
  3633. clearTimeout(t[uniqueId]);
  3634. }
  3635. t[uniqueId] = setTimeout(callback, ms);
  3636. };
  3637. })();
Advertisement
Add Comment
Please, Sign In to add comment