(function(factory){typeof define=="function"&&define.amd?define("index",factory):factory()})(function(){"use strict";function _typeof(obj){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof=function(obj2){return typeof obj2}:_typeof=function(obj2){return obj2&&typeof Symbol=="function"&&obj2.constructor===Symbol&&obj2!==Symbol.prototype?"symbol":typeof obj2},_typeof(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;iarr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=!0,didErr=!1,err;return{s:function(){it=o[Symbol.iterator]()},n:function(){var step=it.next();return normalCompletion=step.done,step},e:function(e){didErr=!0,err=e},f:function(){try{!normalCompletion&&it.return!=null&&it.return()}finally{if(didErr)throw err}}}}var animationQueue={},Animation=function(){function Animation2(){_classCallCheck(this,Animation2)}return _createClass(Animation2,null,[{key:"slideUp",value:function(element,callback){var propertyToAnimate=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"height";element.style[propertyToAnimate]="".concat(element.scrollHeight,"px"),element.offsetHeight,element.style[propertyToAnimate]=0,animationQueue[element.id]&&(element.removeEventListener("transitionend",animationQueue[element.id]),delete animationQueue[element.id]);var transitionEnded=function transitionEnded2(event2){event2.propertyName==="height"&&(element.removeEventListener("transitionend",transitionEnded2),(callback||function(){})())};element.addEventListener("transitionend",transitionEnded)}},{key:"slideDown",value:function(element,callback){var propertyToAnimate=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"height";element.style[propertyToAnimate]="".concat(element.scrollHeight,"px");var transitionEnded=function transitionEnded2(event2){if(event2.propertyName===propertyToAnimate){var defaultValue="auto";propertyToAnimate==="max-height"&&(defaultValue="none"),element.style[propertyToAnimate]=defaultValue,element.removeEventListener("transitionend",transitionEnded2),delete animationQueue[element.id],(callback||function(){})()}};element.addEventListener("transitionend",transitionEnded),animationQueue[element.id]=transitionEnded}}]),Animation2}(),Dom=function(){function Dom2(){_classCallCheck(this,Dom2)}return _createClass(Dom2,null,[{key:"getSiblings",value:function(element,filter){for(var includeSelf=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,siblings=[],currentElement=element;currentElement=currentElement.previousElementSibling;)(!filter||currentElement.matches(filter))&&siblings.push(currentElement);for(includeSelf&&siblings.push(element),currentElement=element;currentElement=currentElement.nextElementSibling;)(!filter||currentElement.matches(filter))&&siblings.push(currentElement);return siblings}}]),Dom2}(),commonjsGlobal=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}function createCommonjsModule(fn,basedir,module){return module={path:basedir,exports:{},require:function(path,base){return commonjsRequire(path,base==null?module.path:base)}},fn(module,module.exports),module.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var browser=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;function Delegate2(root){this.listenerMap=[{},{}],root&&this.root(root),this.handle=Delegate2.prototype.handle.bind(this),this._removedListeners=[]}Delegate2.prototype.root=function(root){var listenerMap=this.listenerMap,eventType;if(this.rootElement){for(eventType in listenerMap[1])listenerMap[1].hasOwnProperty(eventType)&&this.rootElement.removeEventListener(eventType,this.handle,!0);for(eventType in listenerMap[0])listenerMap[0].hasOwnProperty(eventType)&&this.rootElement.removeEventListener(eventType,this.handle,!1)}if(!root||!root.addEventListener)return this.rootElement&&delete this.rootElement,this;this.rootElement=root;for(eventType in listenerMap[1])listenerMap[1].hasOwnProperty(eventType)&&this.rootElement.addEventListener(eventType,this.handle,!0);for(eventType in listenerMap[0])listenerMap[0].hasOwnProperty(eventType)&&this.rootElement.addEventListener(eventType,this.handle,!1);return this},Delegate2.prototype.captureForType=function(eventType){return["blur","error","focus","load","resize","scroll"].indexOf(eventType)!==-1},Delegate2.prototype.on=function(eventType,selector,handler,useCapture){var root,listenerMap,matcher,matcherParam;if(!eventType)throw new TypeError("Invalid event type: "+eventType);if(typeof selector=="function"&&(useCapture=handler,handler=selector,selector=null),useCapture===void 0&&(useCapture=this.captureForType(eventType)),typeof handler!="function")throw new TypeError("Handler must be a type of Function");return root=this.rootElement,listenerMap=this.listenerMap[useCapture?1:0],listenerMap[eventType]||(root&&root.addEventListener(eventType,this.handle,useCapture),listenerMap[eventType]=[]),selector?/^[a-z]+$/i.test(selector)?(matcherParam=selector,matcher=matchesTag):/^#[a-z0-9\-_]+$/i.test(selector)?(matcherParam=selector.slice(1),matcher=matchesId):(matcherParam=selector,matcher=Element.prototype.matches):(matcherParam=null,matcher=matchesRoot.bind(this)),listenerMap[eventType].push({selector:selector,handler:handler,matcher:matcher,matcherParam:matcherParam}),this},Delegate2.prototype.off=function(eventType,selector,handler,useCapture){var i,listener,listenerMap,listenerList,singleEventType;if(typeof selector=="function"&&(useCapture=handler,handler=selector,selector=null),useCapture===void 0)return this.off(eventType,selector,handler,!0),this.off(eventType,selector,handler,!1),this;if(listenerMap=this.listenerMap[useCapture?1:0],!eventType){for(singleEventType in listenerMap)listenerMap.hasOwnProperty(singleEventType)&&this.off(singleEventType,selector,handler);return this}if(listenerList=listenerMap[eventType],!listenerList||!listenerList.length)return this;for(i=listenerList.length-1;i>=0;i--)listener=listenerList[i],(!selector||selector===listener.selector)&&(!handler||handler===listener.handler)&&(this._removedListeners.push(listener),listenerList.splice(i,1));return listenerList.length||(delete listenerMap[eventType],this.rootElement&&this.rootElement.removeEventListener(eventType,this.handle,useCapture)),this},Delegate2.prototype.handle=function(event2){var i,l,type=event2.type,root,phase,listener,returned,listenerList=[],target,eventIgnore="ftLabsDelegateIgnore";if(event2[eventIgnore]!==!0){switch(target=event2.target,target.nodeType===3&&(target=target.parentNode),target.correspondingUseElement&&(target=target.correspondingUseElement),root=this.rootElement,phase=event2.eventPhase||(event2.target!==event2.currentTarget?3:2),phase){case 1:listenerList=this.listenerMap[1][type];break;case 2:this.listenerMap[0]&&this.listenerMap[0][type]&&(listenerList=listenerList.concat(this.listenerMap[0][type])),this.listenerMap[1]&&this.listenerMap[1][type]&&(listenerList=listenerList.concat(this.listenerMap[1][type]));break;case 3:listenerList=this.listenerMap[0][type];break}var toFire=[];for(l=listenerList.length;target&&l;){for(i=0;i-1&&target.hasAttribute("disabled")?toFire=[]:listener.matcher.call(target,listener.matcherParam,target)&&toFire.push([event2,target,listener]);if(target===root||(l=listenerList.length,target=target.parentElement||target.parentNode,target instanceof HTMLDocument))break}var ret;for(i=0;i-1)&&(returned=this.fire.apply(this,toFire[i]),returned===!1)){toFire[i][0][eventIgnore]=!0,toFire[i][0].preventDefault(),ret=!1;break}return ret}},Delegate2.prototype.fire=function(event2,target,listener){return listener.handler.call(target,event2,target)};function matchesTag(tagName,element){return tagName.toLowerCase()===element.tagName.toLowerCase()}function matchesRoot(selector,element){return this.rootElement===window?element===document||element===document.documentElement||element===window:this.rootElement===element}function matchesId(id,element){return id===element.id}Delegate2.prototype.destroy=function(){this.off(),this.root()};var _default=Delegate2;exports.default=_default,module.exports=exports.default}),Delegate=getDefaultExportFromCjs(browser),CollapsibleManager=function(){function CollapsibleManager2(){_classCallCheck(this,CollapsibleManager2),this.domDelegate=new Delegate(document.body),this._attachListeners()}return _createClass(CollapsibleManager2,[{key:"_attachListeners",value:function(){this.domDelegate.on("click",'[data-action="toggle-collapsible"]:not([disabled])',this._toggleCollapsible.bind(this)),document.addEventListener("collapsible:toggle",this._toggleCollapsible.bind(this))}},{key:"_toggleCollapsible",value:function(event2,target){var _this=this;!target&&event2.detail&&(target=document.querySelector('[aria-controls="'.concat(event2.detail.id,'"]')));var isOpen=target.getAttribute("aria-expanded")==="true",parentCollapsible=target.parentNode;isOpen?this._close(parentCollapsible):this._open(parentCollapsible),target.getAttribute("data-close-siblings")!=="false"&&Dom.getSiblings(parentCollapsible).forEach(function(collapsibleToClose){return _this._close(collapsibleToClose)})}},{key:"_open",value:function(collapsible){var toggleButton=collapsible.querySelector("[aria-controls]");if(!(!toggleButton||toggleButton.getAttribute("aria-expanded")==="true")){var collapsibleContent=collapsible.querySelector("#".concat(toggleButton.getAttribute("aria-controls")));toggleButton.setAttribute("aria-expanded","true"),collapsibleContent.hasAttribute("aria-hidden")&&collapsibleContent.setAttribute("aria-hidden","false"),Animation.slideDown(collapsibleContent,function(){toggleButton.hasAttribute("data-collapsible-force-overflow")&&(collapsibleContent.style.overflow="visible");var autofocusElement=collapsibleContent.querySelector("[autofocus]");autofocusElement&&autofocusElement.focus()})}}},{key:"_close",value:function(collapsible){var toggleButton=collapsible.querySelector("[aria-controls]");if(!(!toggleButton||toggleButton.getAttribute("aria-expanded")==="false")){var collapsibleContent=collapsible.querySelector("#".concat(toggleButton.getAttribute("aria-controls")));toggleButton.hasAttribute("data-collapsible-force-overflow")&&(collapsibleContent.style.overflow="hidden"),collapsibleContent.hasAttribute("aria-hidden")&&collapsibleContent.setAttribute("aria-hidden","true"),toggleButton.setAttribute("aria-expanded","false"),Animation.slideUp(collapsibleContent)}}}]),CollapsibleManager2}(),CountrySelector=function(){function CountrySelector2(countrySelect,provinceSelect){_classCallCheck(this,CountrySelector2),this.countrySelect=countrySelect,this.provinceSelect=provinceSelect,this.countrySelect&&this.provinceSelect&&(this._attachListeners(),this._initSelectors())}return _createClass(CountrySelector2,[{key:"destroy",value:function(){this.countrySelect&&this.countrySelect.removeEventListener("change",this._onCountryChangedListener)}},{key:"_initSelectors",value:function(){var defaultCountry=this.countrySelect.getAttribute("data-default");if(defaultCountry){for(var i=0;i!==this.countrySelect.options.length;++i)if(this.countrySelect.options[i].text===defaultCountry){this.countrySelect.selectedIndex=i;break}}else this.countrySelect.selectedIndex=0;var event2=new Event("change",{bubbles:!0});this.countrySelect.dispatchEvent(event2);var defaultProvince=this.provinceSelect.getAttribute("data-default");if(defaultProvince){for(var _i=0;_i!==this.provinceSelect.options.length;++_i)if(this.provinceSelect.options[_i].text===defaultProvince){this.provinceSelect.selectedIndex=_i;break}}}},{key:"_attachListeners",value:function(){this._onCountryChangedListener=this._onCountryChanged.bind(this),this.countrySelect.addEventListener("change",this._onCountryChangedListener)}},{key:"_onCountryChanged",value:function(){var _this=this,selectedOption=this.countrySelect.options[this.countrySelect.selectedIndex];if(selectedOption){var provinces=JSON.parse(selectedOption.getAttribute("data-provinces")||"[]");if(this.provinceSelect.innerHTML="",provinces.length===0){this.provinceSelect.closest(".form__input-wrapper").style.display="none";return}provinces.forEach(function(data){_this.provinceSelect.options.add(new Option(data[1],data[0]))}),this.provinceSelect.closest(".form__input-wrapper").style.display="block"}}}]),CountrySelector2}(),Responsive=function(){function Responsive2(){_classCallCheck(this,Responsive2)}return _createClass(Responsive2,null,[{key:"matchesBreakpoint",value:function(breakpoint){switch(breakpoint){case"phone":return window.matchMedia("screen and (max-width: 640px)").matches;case"tablet":return window.matchMedia("screen and (min-width: 641px) and (max-width: 1023px)").matches;case"tablet-and-up":return window.matchMedia("screen and (min-width: 641px)").matches;case"pocket":return window.matchMedia("screen and (max-width: 1023px)").matches;case"lap":return window.matchMedia("screen and (min-width: 1024px) and (max-width: 1279px)").matches;case"lap-and-up":return window.matchMedia("screen and (min-width: 1024px)").matches;case"desk":return window.matchMedia("screen and (min-width: 1280px)").matches;case"widescreen":return window.matchMedia("screen and (min-width: 1440px)").matches;case"supports-hover":return window.matchMedia("(hover: hover) and (pointer: fine)").matches}}},{key:"getCurrentBreakpoint",value:function(){if(window.matchMedia("screen and (max-width: 640px)").matches)return"phone";if(window.matchMedia("screen and (min-width: 641px) and (max-width: 1023px)").matches)return"tablet";if(window.matchMedia("screen and (min-width: 1024px) and (max-width: 1279px)").matches)return"lap";if(window.matchMedia("screen and (min-width: 1280px)").matches)return"desk"}}]),Responsive2}(),DesktopNavigation=function(){function DesktopNavigation2(element,navigationLayout,openTrigger){_classCallCheck(this,DesktopNavigation2),this.element=element,this.delegateElement=new Delegate(this.element),this.delegateRoot=new Delegate(document.documentElement),this.useInlineNavigation=navigationLayout==="inline",this.isNavigationVisible=this.useInlineNavigation,this.openTrigger=openTrigger,Responsive.matchesBreakpoint("supports-hover")||(this.openTrigger="click"),this.openItems=[],this.dropdownActivationTimeouts={},this.dropdownDeactivationTimeouts={},this.DROPDOWN_TIMEOUT=100,this._attachListeners(),this.useInlineNavigation&&this._setupInlineNavigation()}return _createClass(DesktopNavigation2,[{key:"destroy",value:function(){this.delegateElement.off(),this.delegateRoot.off()}},{key:"onBlockSelect",value:function(event2){var _this=this;this.useInlineNavigation||this._openNavigation(),Dom.getSiblings(event2.target.parentNode,".is-dropdown-open").forEach(function(openItem){_this._deactivateDropdown(event2,openItem.querySelector('[data-type="menuitem"][aria-haspopup]'))}),this._activateDropdown(event2,event2.target.previousElementSibling)}},{key:"onBlockDeselect",value:function(event2){this.useInlineNavigation||this._closeNavigation(),this._deactivateDropdown(event2,event2.target.parentNode)}},{key:"_attachListeners",value:function(){this.delegateElement.on("focusout",this._onFocusOut.bind(this)),this.delegateRoot.on("click",this._onClick.bind(this)),this.delegateElement.on("click",'[data-action="toggle-menu"]',this._toggleNavigation.bind(this)),this.openTrigger==="hover"?(this.delegateElement.on("focusin",'[data-type="menuitem"][aria-haspopup]',this._activateDropdown.bind(this)),this.delegateElement.on("mouseover",'[data-type="menuitem"][aria-haspopup]',this._activateDropdown.bind(this)),this.delegateElement.on("mouseover",'[data-type="menu"][aria-hidden="false"]',this._blockDropdownDeactivation.bind(this)),this.delegateElement.on("focusout",".is-dropdown-open",this._deactivateDropdown.bind(this)),this.delegateElement.on("mouseout",".is-dropdown-open",this._deactivateDropdown.bind(this))):this.delegateElement.on("click",'[data-type="menuitem"][aria-haspopup]',this._toggleDropdown.bind(this))}},{key:"_onFocusOut",value:function(event2){event2.relatedTarget!==null&&!this.element.contains(event2.relatedTarget)&&this._closeNavigation()}},{key:"_onClick",value:function(event2){this.element.contains(event2.target)||this._closeNavigation()}},{key:"_openNavigation",value:function(){this.useInlineNavigation||(this.element.querySelector('[data-action="toggle-menu"]').setAttribute("aria-expanded","true"),this.element.querySelector('[data-type="menu"]').setAttribute("aria-hidden","false"),this.isNavigationVisible=!0)}},{key:"_closeNavigation",value:function(){var _this2=this;if(this.useInlineNavigation||(this.element.querySelector('[data-action="toggle-menu"]').setAttribute("aria-expanded","false"),this.element.querySelector('[data-type="menu"]').setAttribute("aria-hidden","true")),this.isNavigationVisible=!1,this.openTrigger==="click"){var cloneOpenItems=this.openItems.slice(0);cloneOpenItems.forEach(function(item){_this2._deactivateDropdown(event,item)})}}},{key:"_toggleNavigation",value:function(event2){this.isNavigationVisible?this._closeNavigation():this._openNavigation()}},{key:"_toggleDropdown",value:function(event2,target){target.getAttribute("aria-expanded")==="false"&&event2.preventDefault(),target.getAttribute("aria-expanded")==="true"?target.getAttribute("href")==="#"&&(event2.preventDefault(),this._deactivateDropdown(event2,target.closest(".is-dropdown-open"))):this._activateDropdown(event2,target)}},{key:"_activateDropdown",value:function(event2,target){var _this3=this;if(this.openTrigger==="click"){var cloneOpenItems=this.openItems.slice(0);cloneOpenItems.forEach(function(item){item.contains(target)||_this3._deactivateDropdown(event2,item)})}var menuToOpen=Dom.getSiblings(target,"[aria-hidden]")[0],callback=function(){if(target.setAttribute("aria-expanded","true"),target.parentNode.classList.add("is-dropdown-open"),menuToOpen.setAttribute("aria-hidden","false"),_this3.openTrigger==="hover"&&_this3.dropdownDeactivationTimeouts[menuToOpen.id]&&(clearTimeout(_this3.dropdownDeactivationTimeouts[menuToOpen.id]),delete _this3.dropdownDeactivationTimeouts[menuToOpen.id]),_this3.useInlineNavigation){var windowWidth=window.innerWidth,shouldOpenLeft=!1;menuToOpen.querySelectorAll(".nav-dropdown").forEach(function(subSubMenu){subSubMenu.getBoundingClientRect().right>windowWidth&&(shouldOpenLeft=!0)}),shouldOpenLeft&&menuToOpen.classList.add("nav-dropdown--inverse")}target.closest('[data-type="menu"]').classList.add("nav-dropdown--glued"),menuToOpen.classList.contains("mega-menu")&&_this3._setupMegaMenu(menuToOpen),_this3.openTrigger==="click"&&_this3.openItems.push(target.parentNode)};if(this.openTrigger==="click")callback();else{for(var toDeactivate in this.dropdownActivationTimeouts)this.dropdownActivationTimeouts.hasOwnProperty(toDeactivate)&&(clearTimeout(this.dropdownActivationTimeouts[toDeactivate]),delete this.dropdownActivationTimeouts[toDeactivate]);callback()}}},{key:"_deactivateDropdown",value:function(event2,target){var _this4=this;if(!(this.openTrigger==="hover"&&target.contains(event2.relatedTarget))){var menuToClose=target.querySelector("[aria-hidden]"),callback=function(){target.classList.remove("is-dropdown-open"),target.querySelector('[data-type="menuitem"]').setAttribute("aria-expanded","false");var menuToClose2=target.querySelector("[aria-hidden]");if(menuToClose2.setAttribute("aria-hidden","true"),target.closest('[data-type="menu"]').classList.remove("nav-dropdown--glued"),_this4.openTrigger==="click"){target.querySelectorAll(".is-dropdown-open").forEach(function(item){_this4._deactivateDropdown(event2,item);var index2=_this4.openItems.indexOf(item);index2>-1&&_this4.openItems.splice(index2,1)});var index=_this4.openItems.indexOf(target);index>-1&&_this4.openItems.splice(index,1)}};this.openTrigger==="click"?callback():this.dropdownDeactivationTimeouts[menuToClose.id]=setTimeout(function(){callback(),delete _this4.dropdownDeactivationTimeouts[menuToClose.id]},this.DROPDOWN_TIMEOUT)}}},{key:"_blockDropdownDeactivation",value:function(event2,target){if(this.dropdownDeactivationTimeouts[target.id]!==void 0){clearTimeout(this.dropdownDeactivationTimeouts[target.id]),delete this.dropdownDeactivationTimeouts[target.id];for(var toDeactivate in this.dropdownActivationTimeouts)this.dropdownActivationTimeouts.hasOwnProperty(toDeactivate)&&(clearTimeout(this.dropdownActivationTimeouts[toDeactivate]),delete this.dropdownActivationTimeouts[toDeactivate])}}},{key:"_setupMegaMenu",value:function(megaMenu){if(!this.useInlineNavigation){var navDropdownWidth=megaMenu.closest(".nav-dropdown").clientWidth;megaMenu.style.maxWidth=Math.min(1400-navDropdownWidth,parseInt(window.innerWidth-navDropdownWidth-80))+"px"}}},{key:"_setupInlineNavigation",value:function(){var _this5=this;this.element.querySelectorAll(".mega-menu").forEach(function(megaMenu){megaMenu.closest(".nav-bar__item").classList.add("nav-bar__item--static")}),"MutationObserver"in window&&(this.dropdownMenuObserver=new MutationObserver(function(mutationList){mutationList.forEach(function(mutation){mutation.target.getAttribute("aria-hidden")==="false"&&mutation.target.style.setProperty("--distance-to-top","".concat(mutation.target.getBoundingClientRect().top,"px"))})}),this.element.querySelectorAll(".nav-dropdown .nav-dropdown").forEach(function(item){_this5.dropdownMenuObserver.observe(item,{attributes:!0,attributeFilter:["aria-hidden"]})}))}}]),DesktopNavigation2}(),fastdom=createCommonjsModule(function(module){(function(win){var debug=function(){},raf=win.requestAnimationFrame||win.webkitRequestAnimationFrame||win.mozRequestAnimationFrame||win.msRequestAnimationFrame||function(cb){return setTimeout(cb,16)};function FastDom(){var self2=this;self2.reads=[],self2.writes=[],self2.raf=raf.bind(win)}FastDom.prototype={constructor:FastDom,measure:function(fn,ctx){var task=ctx?fn.bind(ctx):fn;return this.reads.push(task),scheduleFlush(this),task},mutate:function(fn,ctx){var task=ctx?fn.bind(ctx):fn;return this.writes.push(task),scheduleFlush(this),task},clear:function(task){return remove(this.reads,task)||remove(this.writes,task)},extend:function(props){if(_typeof(props)!="object")throw new Error("expected object");var child=Object.create(this);return mixin(child,props),child.fastdom=this,child.initialize&&child.initialize(),child},catch:null};function scheduleFlush(fastdom2){fastdom2.scheduled||(fastdom2.scheduled=!0,fastdom2.raf(flush.bind(null,fastdom2)))}function flush(fastdom2){var writes=fastdom2.writes,reads=fastdom2.reads,error;try{debug("flushing reads",reads.length),runTasks(reads),debug("flushing writes",writes.length),runTasks(writes)}catch(e){error=e}if(fastdom2.scheduled=!1,(reads.length||writes.length)&&scheduleFlush(fastdom2),error)if(debug("task errored",error.message),fastdom2.catch)fastdom2.catch(error);else throw error}function runTasks(tasks){for(var task;task=tasks.shift();)task()}function remove(array,item){var index=array.indexOf(item);return!!~index&&!!array.splice(index,1)}function mixin(target,source){for(var key in source)source.hasOwnProperty(key)&&(target[key]=source[key])}var exports=win.fastdom=win.fastdom||new FastDom;module.exports=exports})(typeof window!="undefined"?window:commonjsGlobal)}),CollectionFilterDrawer=function(){function CollectionFilterDrawer2(options){_classCallCheck(this,CollectionFilterDrawer2),this.element=document.getElementById("mobile-collection-filters"),this.delegateRoot=new Delegate(document.documentElement),this.options=options,this.isOpen=!1,this.element&&this._attachListeners()}return _createClass(CollectionFilterDrawer2,[{key:"destroy",value:function(){this.delegateRoot.off()}},{key:"_attachListeners",value:function(){this.delegateRoot.on("click",'[aria-controls="mobile-collection-filters"][data-action="open-drawer"]',this.open.bind(this)),this.delegateRoot.on("click",'#mobile-collection-filters [data-action="close-drawer"]',this.close.bind(this)),document.addEventListener("collection-filter:close",this.close.bind(this)),document.addEventListener("click",this._detectOutsideClick.bind(this)),window.addEventListener("resize",this._computeDrawerHeight.bind(this))}},{key:"open",value:function(event2){event2&&event2.stopPropagation(),this._computeDrawerHeight(),this.isOpen=!0,document.querySelector('[aria-controls="mobile-collection-filters"]').setAttribute("aria-expanded","true"),document.getElementById("mobile-collection-filters").setAttribute("aria-hidden","false"),document.body.classList.add("no-mobile-scroll")}},{key:"close",value:function(event2){event2&&event2.stopPropagation(),this.isOpen=!1,document.querySelector('[aria-controls="mobile-collection-filters"]').setAttribute("aria-expanded","false"),document.getElementById("mobile-collection-filters").setAttribute("aria-hidden","true"),document.body.classList.remove("no-mobile-scroll")}},{key:"_computeDrawerHeight",value:function(){document.getElementById("mobile-collection-filters").querySelector(".collection-drawer").style.maxHeight="".concat(window.innerHeight,"px")}},{key:"_filtersHaveChanged",value:function(newFilters){var _this=this;this.element&&fastdom.mutate(function(){var filterCountElement=_this.element.querySelector(".collection-drawer__filter-count");filterCountElement.innerText="(".concat(newFilters.length,")"),filterCountElement.style.display=newFilters.length===0?"none":"inline",_this.element.querySelector('[data-action="clear-tags"]').style.display=newFilters.length===0?"none":"block",_this.options.filterType==="group"&&_this.element.querySelectorAll(".collection__filter-item-active").forEach(function(item){var parentList=item.closest(".collection__filter-group"),activeDataTag=parentList.querySelector(".is-selected[data-tag]");activeDataTag?(item.style.display="block",item.innerText=activeDataTag.getAttribute("data-tag-user")):item.style.display="none"})})}},{key:"_detectOutsideClick",value:function(event2){this.isOpen&&!event2.target.closest(".collection-drawer__inner")&&this.close()}}]),CollectionFilterDrawer2}(),ExitPopup=function(){function ExitPopup2(element){_classCallCheck(this,ExitPopup2),this.element=element,this.delegateElement=new Delegate(this.element),this.rootDelegateElement=new Delegate(document.body),this.options=JSON.parse(element.getAttribute("data-popup-settings")),this.hasOpenOnceInCurrentPage=!1;try{window.location.hash==="#exit-popup"&&window.theme.pageType!=="captcha"&&this._openPopup()}catch(error){}this._attachListeners()}return _createClass(ExitPopup2,[{key:"destroy",value:function(){this.delegateElement.off()}},{key:"_attachListeners",value:function(){var _this=this;this._onKeyPressedListener=this._onKeyPressed.bind(this),Responsive.matchesBreakpoint("supports-hover")&&(this.delegateElement.on("click",'[data-action="close-popup"]',this._closePopup.bind(this)),document.body.addEventListener("mouseleave",function(){_this.hasOpenOnceInCurrentPage||(!_this.options.showOnlyOnce||_this.options.showOnlyOnce&&localStorage.getItem("themeExitPopup")===null)&&_this._openPopup()}),this._clickOutsideListener=this._checkClickOutside.bind(this))}},{key:"_openPopup",value:function(){window.theme.isNewsletterPopupOpen||(this.element.setAttribute("aria-hidden","false"),localStorage.setItem("themeExitPopup","true"),this.hasOpenOnceInCurrentPage=!0,window.theme.isExitPopupOpen=!0,this.delegateElement.on("click",this._clickOutsideListener),this.rootDelegateElement.on("keyup",this._onKeyPressedListener))}},{key:"_closePopup",value:function(){this.element.setAttribute("aria-hidden","true"),window.theme.isExitPopupOpen=!1,this.delegateElement.off("click",this._clickOutsideListener),this.rootDelegateElement.off("keyup",this._onKeyPressedListener)}},{key:"_checkClickOutside",value:function(event2){(!this.element.contains(event2.target)||this.element===event2.target)&&this._closePopup()}},{key:"_onKeyPressed",value:function(event2){event2.key==="Escape"&&this._closePopup()}}]),ExitPopup2}(),LoadingBar=function(){function LoadingBar2(){_classCallCheck(this,LoadingBar2),this.element=document.querySelector(".loading-bar"),this.element&&(document.addEventListener("theme:loading:start",this._onLoadingStart.bind(this)),document.addEventListener("theme:loading:end",this._onLoadingEnd.bind(this)),this.element.addEventListener("transitionend",this._onTransitionEnd.bind(this)))}return _createClass(LoadingBar2,[{key:"_onLoadingStart",value:function(){this.element.classList.add("is-visible"),this.element.style.width="40%"}},{key:"_onLoadingEnd",value:function(){this.element.style.width="100%",this.element.classList.add("is-finished")}},{key:"_onTransitionEnd",value:function(event2){event2.propertyName==="width"&&this.element.classList.contains("is-finished")&&(this.element.classList.remove("is-visible"),this.element.classList.remove("is-finished"),this.element.style.width="0")}}]),LoadingBar2}(),Accessibility=function(){function Accessibility2(){_classCallCheck(this,Accessibility2)}return _createClass(Accessibility2,null,[{key:"trapFocus",value:function(container,namespace){this.listeners=this.listeners||{};var elementToFocus=container.querySelector("[autofocus]")||container;container.setAttribute("tabindex","-1"),elementToFocus.focus(),this.listeners[namespace]=function(event2){container!==event2.target&&!container.contains(event2.target)&&elementToFocus.focus()},document.addEventListener("focusin",this.listeners[namespace])}},{key:"removeTrapFocus",value:function(container,namespace){container&&container.removeAttribute("tabindex"),document.removeEventListener("focusin",this.listeners[namespace])}},{key:"clearTrapFocus",value:function(){for(var key in this.listeners)this.listeners.hasOwnProperty(key)&&document.removeEventListener("focusin",this.listeners[key]);this.listeners={}}}]),Accessibility2}(),Cart=function(){function Cart2(element,options){_classCallCheck(this,Cart2),this.element=element,this.delegateElement=new Delegate(this.element),this.delegateRoot=new Delegate(document.documentElement),this.options=options,this.element&&(this.miniCartElement=document.getElementById("mini-cart"),this.isMiniCartOpen=!1,window.theme.pageType!=="cart"&&this.miniCartElement&&(this.miniCartToggleElement=this.element.querySelector('[aria-controls="'.concat(this.miniCartElement.id,'"]')),this._checkMiniCartScrollability()),this.itemCount=window.theme.cartCount,this._attachListeners())}return _createClass(Cart2,[{key:"destroy",value:function(){this.delegateElement.off(),this.delegateRoot.off(),window.removeEventListener("resize",this._calculateMiniCartHeightListener)}},{key:"_attachListeners",value:function(){this._calculateMiniCartHeightListener=this._calculateMiniCartHeight.bind(this),window.theme.pageType!=="cart"&&window.theme.cartType!=="page"&&(this.delegateElement.on("click",'[data-action="toggle-mini-cart"]',this._toggleMiniCart.bind(this)),this.delegateRoot.on("click",this._onWindowClick.bind(this)),window.addEventListener("resize",this._calculateMiniCartHeightListener)),this.delegateRoot.on("click",'[data-action="decrease-quantity"]',this._updateQuantity.bind(this)),this.delegateRoot.on("click",'[data-action="increase-quantity"]',this._updateQuantity.bind(this)),this.delegateRoot.on("change",".quantity-selector:not(.quantity-selector--product) .quantity-selector__value",this._updateQuantity.bind(this)),this.delegateRoot.on("keyup",".quantity-selector:not(.quantity-selector--product) .quantity-selector__value",this._updateQuantitySize.bind(this)),this.delegateRoot.on("keydown",".quantity-selector__value",this._blockEnterKey.bind(this)),this.delegateRoot.on("product:added",this._onProductAdded.bind(this)),this.delegateRoot.on("cart:refresh",this._onCartRefresh.bind(this))}},{key:"_toggleMiniCart",value:function(event2){event2&&event2.preventDefault(),this.isMiniCartOpen?this._closeMiniCart():this._openMiniCart()}},{key:"_openMiniCart",value:function(){this.miniCartToggleElement.setAttribute("aria-expanded","true"),Responsive.getCurrentBreakpoint()==="phone"&&this.miniCartToggleElement.querySelector(".header__cart-icon").setAttribute("aria-expanded","true"),this.miniCartElement.setAttribute("aria-hidden","false"),this.isMiniCartOpen=!0,this._calculateMiniCartHeight(),Accessibility.trapFocus(this.miniCartElement,"mini-cart"),document.body.classList.add("no-mobile-scroll")}},{key:"_closeMiniCart",value:function(){this.miniCartToggleElement.setAttribute("aria-expanded","false"),Responsive.getCurrentBreakpoint()==="phone"&&(this.miniCartToggleElement.querySelector(".header__cart-icon").setAttribute("aria-expanded","false"),this.miniCartElement.style.maxHeight=""),this.miniCartElement.setAttribute("aria-hidden","true"),this.isMiniCartOpen=!1,document.body.classList.remove("no-mobile-scroll")}},{key:"_calculateMiniCartHeight",value:function(){if(Responsive.getCurrentBreakpoint()==="phone")if(this.isMiniCartOpen){var maxHeight=window.innerHeight-document.querySelector(".header").getBoundingClientRect().bottom;this.miniCartElement.style.maxHeight="".concat(maxHeight,"px");var miniCartContentElement=this.miniCartElement.querySelector(".mini-cart__content"),miniCartRecapElement=this.miniCartElement.querySelector(".mini-cart__recap");miniCartRecapElement&&(miniCartContentElement.style.maxHeight="".concat(maxHeight-miniCartRecapElement.clientHeight,"px"))}else this.miniCartElement.style.maxHeight="",this.miniCartElement.querySelector(".mini-cart__content").style.maxHeight="";else this.miniCartElement.style.maxHeight="",this.miniCartElement.querySelector(".mini-cart__content").style.maxHeight=""}},{key:"_updateQuantity",value:function(event2,target){var _this=this,parsedQuantity=1;target.tagName==="INPUT"?parsedQuantity=parseInt(target.value):parsedQuantity=parseInt(target.getAttribute("data-quantity"));var cartProductoData=buscarProductoInfoPorSku(target.getAttribute("data-sku"));if(typeof cartProductoData!="undefined"&&(current_collection=="BEBIDAS"||parsedQuantity>cartProductoData.qty&&(parsedQuantity=cartProductoData.qty)),window.theme.cartType==="page"){target.hasAttribute("data-href")?window.location.href=target.getAttribute("data-href"):window.location.href="".concat(window.routes.cartChangeUrl,"?id=").concat(target.getAttribute("data-line-id"),"&quantity=").concat(parsedQuantity);return}document.dispatchEvent(new CustomEvent("theme:loading:start")),fetch("".concat(window.routes.cartChangeUrl,".js"),{body:JSON.stringify({id:target.getAttribute("data-line-id"),quantity:parsedQuantity}),credentials:"same-origin",method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"}}).then(function(cart){cart.json().then(function(content){typeof window.BOLD!="undefined"&&typeof window.BOLD.common!="undefined"&&typeof window.BOLD.common.cartDoctor!="undefined"&&(content=window.BOLD.common.cartDoctor.fix(content)),console.log("se relleno el carrito"),_this.itemCount=content.item_count,_this._rerender(!1).then(function(){document.dispatchEvent(new CustomEvent("theme:loading:end"))})})}),event2.preventDefault()}},{key:"_updateQuantitySize",value:function(event2,target){target.setAttribute("size",Math.max(target.value.length,2))}},{key:"_blockEnterKey",value:function(event2){if(event2.key==="Enter")return!1}},{key:"_rerender",value:function(){var _this2=this,scrollToTop=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,url="";return window.theme.pageType!=="cart"?url="".concat(window.routes.cartUrl,"?view=mini-cart×tamp=").concat(Date.now()):url="".concat(window.routes.cartUrl,"?timestamp=").concat(Date.now()),fetch(url,{credentials:"same-origin",method:"GET"}).then(function(content){content.text().then(function(html){typeof window.BOLD!="undefined"&&typeof window.BOLD.common!="undefined"&&typeof window.BOLD.common.eventEmitter!="undefined"&&typeof window.BOLD.common.eventEmitter.emit!="undefined"&&BOLD.common.eventEmitter.emit("BOLD_COMMON_cart_loaded");var myDiv=document.createElement("div");if(myDiv.innerHTML=html,myDiv.firstElementChild&&myDiv.firstElementChild.hasAttribute("data-item-count")&&(_this2.itemCount=parseInt(myDiv.firstElementChild.getAttribute("data-item-count"))),_this2.element.querySelector(".header__cart-count").textContent=_this2.itemCount,window.theme.cartType!=="page"){if(window.theme.pageType!=="cart"){var tempElement=document.createElement("div");tempElement.innerHTML=html;var miniCartItemListElement=_this2.miniCartElement.querySelector(".mini-cart__line-item-list"),scrollPosition=null;miniCartItemListElement&&(scrollPosition=miniCartItemListElement.scrollTop),_this2.miniCartElement.innerHTML=tempElement.querySelector(".mini-cart").innerHTML;var newMiniCartItemListElement=_this2.miniCartElement.querySelector(".mini-cart__line-item-list");newMiniCartItemListElement&&scrollPosition!==null&&(newMiniCartItemListElement.scrollTop=scrollPosition),_this2._checkMiniCartScrollability(),_this2._calculateMiniCartHeight(),_this2.element.dispatchEvent(new CustomEvent("cart:rerendered"))}else{var _tempElement=document.createElement("div");_tempElement.innerHTML=html;var originalCart=document.querySelector('[data-section-type="cart"]');originalCart.innerHTML=_tempElement.querySelector('[data-section-type="cart"]').innerHTML,scrollToTop&&window.scrollTo({top:0,behavior:"smooth"}),window.SPR&&(window.SPR.initDomEls(),window.SPR.loadBadges()),_this2.element.dispatchEvent(new CustomEvent("cart:rerendered",{bubbles:!0}))}fillDeliveryInfo()}})})}},{key:"_checkMiniCartScrollability",value:function(){var miniCartItemList=this.miniCartElement.querySelector(".mini-cart__line-item-list");miniCartItemList&&miniCartItemList.scrollHeight>miniCartItemList.clientHeight&&miniCartItemList.classList.add("is-scrollable")}},{key:"_onProductAdded",value:function(event2){var _this3=this;this.itemCount+=event2.detail.quantity,this._onCartRefresh().then(function(){window.theme.pageType!=="cart"&&(_this3.options.useStickyHeader||window.scrollTo({top:0,behavior:"smooth"}),window.theme.pageType!=="cart"&&window.theme.cartType==="drawer"&&_this3._openMiniCart())})}},{key:"_onCartRefresh",value:function(event2){var scrollToTop=!0;return event2&&event2.detail&&(scrollToTop=event2.detail.scrollToTop),this._rerender(scrollToTop).then(function(){document.dispatchEvent(new CustomEvent("theme:loading:end"))})}},{key:"_onWindowClick",value:function(event2){this.miniCartElement&&this.isMiniCartOpen&&!this.element.contains(event2.target)&&this._closeMiniCart()}}]),Cart2}(),MobileNavigation=function(){function MobileNavigation2(element){_classCallCheck(this,MobileNavigation2),this.element=element,this.delegateElement=new Delegate(this.element),this.delegateRoot=new Delegate(document.documentElement),this.mobileMenuElement=this.element.querySelector(".mobile-menu"),this.mobileMenuToggleElement=this.element.querySelector('[aria-controls="'.concat(this.mobileMenuElement.id,'"]')),this.isOpen=!1,this._attachListeners()}return _createClass(MobileNavigation2,[{key:"destroy",value:function(){this.delegateElement.off(),this.delegateRoot.off(),window.removeEventListener("resize",this._calculatMaxHeightListener)}},{key:"_attachListeners",value:function(){this._calculatMaxHeightListener=this._calculateMaxHeight.bind(this),this.delegateElement.on("click",'[data-action="toggle-menu"]',this._toggleMenu.bind(this)),this.delegateElement.on("click",'[data-action="open-panel"]',this._openPanel.bind(this)),this.delegateElement.on("click",'[data-action="close-panel"]',this._closePanel.bind(this)),this.delegateRoot.on("click",this._onWindowClick.bind(this)),window.addEventListener("resize",this._calculatMaxHeightListener)}},{key:"_toggleMenu",value:function(){this.isOpen=!this.isOpen,this.mobileMenuToggleElement.setAttribute("aria-expanded",this.isOpen?"true":"false"),this.mobileMenuElement.setAttribute("aria-hidden",this.isOpen?"false":"true"),this.isOpen?(this._calculateMaxHeight(),document.body.classList.add("no-mobile-scroll")):(this.mobileMenuElement.style.maxHeight="",this.element.querySelectorAll(".mobile-menu__panel.is-open").forEach(function(item){item.classList.remove("is-open")}),document.body.classList.remove("no-mobile-scroll"))}},{key:"_openPanel",value:function(event2,target){target.setAttribute("aria-expanded","true"),this.element.querySelector("#".concat(target.getAttribute("aria-controls"))).classList.add("is-open")}},{key:"_closePanel",value:function(event2,target){var panelToClose=target.closest(".mobile-menu__panel.is-open");panelToClose.classList.remove("is-open"),this.element.querySelector('[aria-controls="'.concat(panelToClose.id,'"]')).setAttribute("aria-expanded","false")}},{key:"_calculateMaxHeight",value:function(){this.isOpen&&(this.mobileMenuElement.style.maxHeight="".concat(window.innerHeight-document.querySelector(".header").getBoundingClientRect().bottom,"px"))}},{key:"_onWindowClick",value:function(event2){this.isOpen&&!this.element.contains(event2.target)&&this._toggleMenu()}}]),MobileNavigation2}(),ModalManager=function(){function ModalManager2(){_classCallCheck(this,ModalManager2),this.domDelegate=new Delegate(document.body),this.activeModal=document.querySelector('.modal[aria-hidden="false"]'),this._attachListeners()}return _createClass(ModalManager2,[{key:"_attachListeners",value:function(){this._onKeyPressedListener=this._onKeyPressed.bind(this),this.domDelegate.on("click",'[data-action="open-modal"]',this._openModal.bind(this)),this.domDelegate.on("click",'[data-action="close-modal"]',this._closeModal.bind(this)),document.addEventListener("modal:close",this._closeModal.bind(this)),this._clickOutsideListener=this._checkClickOutside.bind(this),this.activeModal&&(document.documentElement.classList.add("is-locked"),this.domDelegate.on("click",this._clickOutsideListener))}},{key:"_openModal",value:function(event2,target){var _this=this,modal=document.querySelector("#".concat(target.getAttribute("aria-controls")));if(modal){var onOpen=function onOpen2(event3){event3.propertyName==="visibility"&&(modal.removeEventListener("transitionend",onOpen2),Accessibility.trapFocus(modal,"modal"),_this.activeModal=modal)};return modal.addEventListener("transitionend",onOpen),modal.setAttribute("aria-hidden","false"),document.documentElement.classList.add("is-locked"),this.domDelegate.on("click",this._clickOutsideListener),this.domDelegate.on("keyup",this._onKeyPressedListener),!1}}},{key:"_closeModal",value:function(){var _this2=this;if(this.activeModal){var onClose=function onClose2(event2){event2.propertyName==="visibility"&&(_this2.activeModal.removeEventListener("transitionend",onClose2),Accessibility.removeTrapFocus(_this2.activeModal,"modal"),_this2.activeModal.dispatchEvent(new CustomEvent("modal:closed")),_this2.activeModal=null)};this.activeModal.addEventListener("transitionend",onClose),this.activeModal.setAttribute("aria-hidden","true"),document.documentElement.classList.remove("is-locked"),this.domDelegate.off("click",this._clickOutsideListener),this.domDelegate.off("keyup",this._onKeyPressedListener)}}},{key:"_checkClickOutside",value:function(event2){this.activeModal&&(!this.activeModal.contains(event2.target)||this.activeModal===event2.target)&&this._closeModal()}},{key:"_onKeyPressed",value:function(event2){event2.key==="Escape"&&this._closeModal()}}]),ModalManager2}(),NewsletterPopup=function(){function NewsletterPopup2(element){_classCallCheck(this,NewsletterPopup2),this.element=element,this.delegateElement=new Delegate(this.element),this.rootDelegateElement=new Delegate(document.body),this.options=JSON.parse(element.getAttribute("data-popup-settings"));try{window.location.hash==="#newsletter-popup"&&window.theme.pageType!=="captcha"?this._openPopup():(!this.options.showOnlyOnce||this.options.showOnlyOnce&&localStorage.getItem("themePopup")===null)&&setTimeout(this._openPopup.bind(this),this.options.apparitionDelay*1e3)}catch(error){}this._attachListeners()}return _createClass(NewsletterPopup2,[{key:"destroy",value:function(){this.delegateElement.off()}},{key:"_attachListeners",value:function(){this._onKeyPressedListener=this._onKeyPressed.bind(this),this.delegateElement.on("click",'[data-action="close-popup"]',this._closePopup.bind(this)),this._clickOutsideListener=this._checkClickOutside.bind(this)}},{key:"_openPopup",value:function(){window.theme.isExitPopupOpen||(this.element.setAttribute("aria-hidden","false"),localStorage.setItem("themePopup","true"),window.theme.isNewsletterPopupOpen=!0,this.delegateElement.on("click",this._clickOutsideListener),this.rootDelegateElement.on("keyup",this._onKeyPressedListener))}},{key:"_closePopup",value:function(){this.element.setAttribute("aria-hidden","true"),window.theme.isNewsletterPopupOpen=!1,this.delegateElement.off("click"),this.rootDelegateElement.off("keyup",this._onKeyPressedListener)}},{key:"_checkClickOutside",value:function(event2){(!this.element.contains(event2.target)||this.element===event2.target)&&this._closePopup()}},{key:"_onKeyPressed",value:function(event2){event2.key==="Escape"&&this._closePopup()}}]),NewsletterPopup2}(),OverflowScroller=function(){function OverflowScroller2(element,options){_classCallCheck(this,OverflowScroller2),element&&(this.element=element,this.options=options,this.lastKnownY=window.scrollY,this.currentTop=0,this.initialTopOffset=options.offsetTop||parseInt(window.getComputedStyle(this.element).top),this._attachListeners())}return _createClass(OverflowScroller2,[{key:"destroy",value:function(){window.removeEventListener("scroll",this._checkPositionListener)}},{key:"_attachListeners",value:function(){this._checkPositionListener=this._checkPosition.bind(this),window.addEventListener("scroll",this._checkPositionListener)}},{key:"_checkPosition",value:function(){var _this=this;fastdom.measure(function(){var bounds=_this.element.getBoundingClientRect(),maxTop=bounds.top+window.scrollY-_this.element.offsetTop+_this.initialTopOffset,minTop=_this.element.clientHeight-window.innerHeight+(_this.options.offsetBottom||0);window.scrollY<_this.lastKnownY?_this.currentTop-=window.scrollY-_this.lastKnownY:_this.currentTop+=_this.lastKnownY-window.scrollY,_this.currentTop=Math.min(Math.max(_this.currentTop,-minTop),maxTop,_this.initialTopOffset),_this.lastKnownY=window.scrollY}),fastdom.mutate(function(){_this.element.style.top="".concat(_this.currentTop,"px")})}}]),OverflowScroller2}(),PopoverManager=function(){function PopoverManager2(){_classCallCheck(this,PopoverManager2),this.delegateElement=new Delegate(document.body),this.delegateRoot=new Delegate(document.documentElement),this.activePopover=null,this._attachListeners()}return _createClass(PopoverManager2,[{key:"_attachListeners",value:function(){this._onLooseFocusListener=this._onLooseFocus.bind(this),this.delegateElement.on("click",'[data-action="toggle-popover"]',this._togglePopover.bind(this)),this.delegateElement.on("click",'[data-action="show-popover-panel"]',this._showPanel.bind(this)),this.delegateRoot.on("click",this._onWindowClick.bind(this)),document.addEventListener("popover:close",this._closeActivePopover.bind(this)),window.addEventListener("resize",this._windowResized.bind(this))}},{key:"_togglePopover",value:function(event2,target){var hasActivePopover=this.activePopover!==null,previousActivePopoverId=this.activePopover?this.activePopover.id:null;target.hasAttribute("data-follow-link")&&Responsive.matchesBreakpoint(target.getAttribute("data-follow-link"))||(hasActivePopover&&this._closeActivePopover(),(!hasActivePopover||hasActivePopover&&target.getAttribute("aria-controls")!==previousActivePopoverId)&&this._openPopover(target),event2.preventDefault())}},{key:"_closeActivePopover",value:function(){this.activePopover.setAttribute("aria-hidden","true"),document.querySelector('[aria-controls="'.concat(this.activePopover.id,'"]')).setAttribute("aria-expanded","false"),this.activePopover.removeEventListener("focusout",this._onLooseFocusListener),this.activePopover=null}},{key:"_openPopover",value:function(target){var element=document.getElementById(target.getAttribute("aria-controls"));if(target.setAttribute("aria-expanded","true"),element.setAttribute("aria-hidden","false"),Responsive.getCurrentBreakpoint()==="phone")element.style.height="".concat(window.innerHeight-document.querySelector(".header").getBoundingClientRect().bottom,"px");else{element.style.height="";var panelList=element.querySelector(".popover__panel-list");panelList&&(panelList.style.height="".concat(panelList.clientHeight,"px"))}this.activePopover=element,this.activePopover.addEventListener("focusout",this._onLooseFocusListener)}},{key:"_showPanel",value:function(event2,target){if(this.activePopover){var panels=this.activePopover.querySelectorAll(".popover__panel");panels.forEach(function(panel){panel.id===target.getAttribute("aria-controls")?(panel.classList.add("is-selected"),panel.closest(".popover__panel-list").style.height="".concat(panel.clientHeight,"px")):panel.classList.remove("is-selected")})}}},{key:"_onWindowClick",value:function(event2){event2.target.getAttribute("data-action")==="toggle-popover"||event2.target.closest('[data-action="toggle-popover"]')||this.activePopover&&!this.activePopover.contains(event2.target)&&this._closeActivePopover()}},{key:"_onLooseFocus",value:function(event2){this.activePopover&&event2.relatedTarget!==null&&!this.activePopover.contains(event2.relatedTarget)&&this._closeActivePopover()}},{key:"_windowResized",value:function(){Responsive.getCurrentBreakpoint()==="phone"&&this.activePopover&&(this.activePopover.style.height="".concat(window.innerHeight-document.querySelector(".header").getBoundingClientRect().bottom,"px"))}}]),PopoverManager2}(),ProductItemColorSwatch=function(){function ProductItemColorSwatch2(element){_classCallCheck(this,ProductItemColorSwatch2),this.element=element,this.delegateElement=new Delegate(this.element),this._attachListeners(),this.recalculateSwatches()}return _createClass(ProductItemColorSwatch2,[{key:"destroy",value:function(){this.delegateElement.off(),window.removeEventListener("resize",this._recalculateSwatchesListener)}},{key:"recalculateSwatches",value:function(){var _this=this;fastdom.measure(function(){_this.element.querySelectorAll(".product-item__swatch-list").forEach(function(swatchList){var currentWidth=swatchList.clientWidth,maxAllowedWidth=parseInt(Math.min(currentWidth,200)),maxFit=Math.floor(maxAllowedWidth/30);fastdom.mutate(function(){var colorSwatches=swatchList.querySelectorAll(".color-swatch");colorSwatches.forEach(function(colorSwatch,index){colorSwatch.classList.remove("color-swatch--view-more"),maxFit===index+1&&maxFit!==colorSwatches.length&&colorSwatch.classList.add("color-swatch--view-more")})})})})}},{key:"_attachListeners",value:function(){this._recalculateSwatchesListener=this.recalculateSwatches.bind(this),this.delegateElement.on("change",".product-item__swatch-list .color-swatch__radio",this._colorChanged.bind(this)),window.addEventListener("resize",this._recalculateSwatchesListener)}},{key:"_colorChanged",value:function(event2,target){var productItem=target.closest(".product-item"),variantUrl=target.getAttribute("data-variant-url");productItem.querySelector(".product-item__image-wrapper").setAttribute("href",variantUrl),productItem.querySelector(".product-item__title").setAttribute("href",variantUrl);var originalImageElement=productItem.querySelector(".product-item__primary-image");if(target.hasAttribute("data-image-url")&&target.getAttribute("data-media-id")!==originalImageElement.getAttribute("data-media-id")){var newImageElement=document.createElement("img");newImageElement.className="product-item__primary-image lazyload image--fade-in",newImageElement.setAttribute("data-media-id",target.getAttribute("data-media-id")),newImageElement.setAttribute("data-src",target.getAttribute("data-image-url")),newImageElement.setAttribute("data-widths",target.getAttribute("data-image-widths")),newImageElement.setAttribute("data-sizes","auto"),originalImageElement.parentNode.style.paddingBottom="".concat(100/newImageElement.getAttribute("data-image-aspect-ratio"),"%"),originalImageElement.parentNode.replaceChild(newImageElement,originalImageElement)}}}]),ProductItemColorSwatch2}(),Currency=function(){function Currency2(){_classCallCheck(this,Currency2)}return _createClass(Currency2,null,[{key:"formatMoney",value:function(cents,format){typeof cents=="string"&&(cents=cents.replace(".",""));var placeholderRegex=/\{\{\s*(\w+)\s*\}\}/,formatString=format||"${{amount}}";function defaultTo(value2,defaultValue){return value2==null||value2!==value2?defaultValue:value2}function formatWithDelimiters(number,precision,thousands,decimal){if(precision=defaultTo(precision,2),thousands=defaultTo(thousands,","),decimal=defaultTo(decimal,"."),isNaN(number)||number==null)return 0;number=(number/100).toFixed(precision);var parts=number.split("."),dollarsAmount=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+thousands),centsAmount=parts[1]?decimal+parts[1]:"";return dollarsAmount+centsAmount}var value="";switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_space_separator":value=formatWithDelimiters(cents,2," ",".");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,",",".");break;case"amount_no_decimals_with_space_separator":value=formatWithDelimiters(cents,0," ");break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break}return formatString.indexOf("with_comma_separator")!==-1?formatString.replace(placeholderRegex,value).replace(",00",""):formatString.replace(placeholderRegex,value).replace(".00","")}}]),Currency2}(),Form=function(){function Form2(){_classCallCheck(this,Form2)}return _createClass(Form2,null,[{key:"serialize",value:function(form){function stringKey(key,value){var beginBracket=key.lastIndexOf("[");if(beginBracket===-1){var _hash={};return _hash[key]=value,_hash}var newKey=key.substr(0,beginBracket),newValue={};return newValue[key.substring(beginBracket+1,key.length-1)]=value,stringKey(newKey,newValue)}for(var hash={},i=0,len=form.elements.length;inewVariant.price?(productPrices.innerHTML+=''.concat(window.languages.productSalePrice,"").concat(Currency.formatMoney(newVariant.price,window.theme.moneyFormat),""),productPrices.innerHTML+=''.concat(window.languages.productRegularPrice,"").concat(Currency.formatMoney(newVariant.compare_at_price,window.theme.moneyFormat),"")):productPrices.innerHTML+=''.concat(window.languages.productSalePrice,"").concat(Currency.formatMoney(newVariant.price,window.theme.moneyFormat),""),productPrices.style.display=""}}},{key:"_updateInventory",value:function(newVariant){if(!(!this.options.showInventoryQuantity||!newVariant)){var productFormInventoryElement=this.element.querySelector(".product-form__inventory"),variantInventoryManagement=this.variantsInventories[newVariant.id].inventory_management,variantInventoryPolicy=this.variantsInventories[newVariant.id].inventory_policy,variantInventoryQuantity=this.variantsInventories[newVariant.id].inventory_quantity,variantInventoryMessage=this.variantsInventories[newVariant.id].inventory_message;if(productFormInventoryElement){productFormInventoryElement.classList.remove("inventory--high"),productFormInventoryElement.classList.remove("inventory--low"),newVariant.available&&(variantInventoryManagement!==null&&variantInventoryPolicy==="deny"&&this.options.lowInventoryThreshold>0&&variantInventoryQuantity<=this.options.lowInventoryThreshold?productFormInventoryElement.classList.add("inventory--low"):productFormInventoryElement.classList.add("inventory--high"));var stockCountdown=this.element.querySelector(".inventory-bar");if(stockCountdown){var stockCountdownProgress=Math.min(Math.max(variantInventoryQuantity/parseInt(stockCountdown.getAttribute("data-stock-countdown-max"))*100,0),100);stockCountdown.classList.toggle("inventory-bar--hidden",stockCountdownProgress===0),stockCountdown.firstElementChild.style.width="".concat(stockCountdownProgress,"%")}productFormInventoryElement.innerHTML=variantInventoryMessage}}}},{key:"_updateSku",value:function(newVariant,previousVariant){var productSku=this.element.querySelector(".product-meta__sku");if(productSku){var productSkuNumber=productSku.querySelector(".product-meta__sku-number");if(!newVariant||newVariant.sku==="")productSku.style.display="none";else{if(previousVariant&&previousVariant.sku===newVariant.sku)return;productSkuNumber.innerHTML=newVariant.sku,productSku.style.display=""}}}},{key:"_updateDiscountLabel",value:function(newVariant,previousVariant){if(window.theme.showDiscount){var discountLabel=this.element.querySelector(".product-meta .product-label--on-sale");if(discountLabel)if(!newVariant||!(newVariant.price".concat(Currency.formatMoney(newVariant.compare_at_price-newVariant.price,window.theme.moneyFormat),""),discountLabel.innerHTML="".concat(window.languages.collectionOnSaleLabel.replace("{{savings}}",savings)),discountLabel.style.display="inline-block"}}}},{key:"_updateUnitPrice",value:function(newVariant,previousVariant){var unitPriceMeasurement=this.element.querySelector(".unit-price-measurement");if(unitPriceMeasurement)if(!newVariant||!newVariant.unit_price_measurement)unitPriceMeasurement.parentNode.style.display="none";else{unitPriceMeasurement.parentNode.style.display="block",unitPriceMeasurement.querySelector(".unit-price-measurement__price").innerHTML=Currency.formatMoney(newVariant.unit_price,window.theme.moneyFormat),unitPriceMeasurement.querySelector(".unit-price-measurement__reference-unit").innerHTML=newVariant.unit_price_measurement.reference_unit;var unitPriceReferenceValue=unitPriceMeasurement.querySelector(".unit-price-measurement__reference-value");unitPriceReferenceValue.innerHTML=newVariant.unit_price_measurement.reference_value,unitPriceReferenceValue.style.display=newVariant.unit_price_measurement.reference_value===1?"none":"inline"}}},{key:"_updateSelectors",value:function(newVariant){var _this2=this,applyClassToSelector=function(selector,valueIndex,available){var selectorType=selector.getAttribute("data-selector-type");switch(selectorType){case"color":selector.querySelector(".color-swatch:nth-child(".concat(valueIndex+1,")")).classList.toggle("color-swatch--disabled",!available);break;case"variant":selector.querySelector(".variant-swatch:nth-child(".concat(valueIndex+1,")")).classList.toggle("variant-swatch--disabled",!available);break;case"block":selector.querySelector(".block-swatch:nth-child(".concat(valueIndex+1,")")).classList.toggle("block-swatch--disabled",!available);break}};this.variantSelectors&&this.variantSelectors[0]&&this.productOptionsWithValues[0].values.forEach(function(value,valueIndex){applyClassToSelector(_this2.variantSelectors[0],valueIndex,_this2.productData.variants.some(function(variant){return variant.option1===value&&variant.available})),_this2.variantSelectors[1]&&_this2.productOptionsWithValues[1].values.forEach(function(value2,valueIndex2){applyClassToSelector(_this2.variantSelectors[1],valueIndex2,_this2.productData.variants.some(function(variant){return variant.option2===value2&&variant.option1===_this2.option1&&variant.available})),_this2.variantSelectors[2]&&_this2.productOptionsWithValues[2].values.forEach(function(value3,valueIndex3){applyClassToSelector(_this2.variantSelectors[2],valueIndex3,_this2.productData.variants.some(function(variant){return variant.option3===value3&&variant.option1===_this2.option1&&variant.option2===_this2.option2&&variant.available}))})})})}},{key:"_updateAddToCartButton",value:function(newVariant){var addToCartButtonElement=this.element.querySelector(".product-form__add-button"),infoListElement=this.element.querySelector(".product-form__info-list");if(addToCartButtonElement&&(newVariant?(infoListElement.style.display="block",newVariant.available?(addToCartButtonElement.removeAttribute("disabled"),addToCartButtonElement.classList.remove("button--disabled"),addToCartButtonElement.classList.add("button--primary"),addToCartButtonElement.setAttribute("data-action","add-to-cart"),addToCartButtonElement.innerHTML=window.languages.productFormAddToCart):(addToCartButtonElement.setAttribute("disabled","disabled"),addToCartButtonElement.classList.add("button--disabled"),addToCartButtonElement.classList.remove("button--primary"),addToCartButtonElement.removeAttribute("data-action"),addToCartButtonElement.innerHTML=window.languages.productFormSoldOut)):(addToCartButtonElement.setAttribute("disabled","disabled"),addToCartButtonElement.classList.add("button--disabled"),addToCartButtonElement.classList.remove("button--primary"),addToCartButtonElement.removeAttribute("data-action"),addToCartButtonElement.innerHTML=window.languages.productFormUnavailable,infoListElement.style.display="none"),this.options.showPaymentButton)){var paymentButtonElement=this.element.querySelector(".shopify-payment-button");if(!paymentButtonElement)return;!newVariant||!newVariant.available?paymentButtonElement.style.display="none":paymentButtonElement.style.display="block"}}},{key:"_onOptionChanged",value:function(event2,target){this["option"+target.getAttribute("data-option-position")]=target.value;var selectedValueElement=target.closest(".product-form__option").querySelector(".product-form__selected-value");selectedValueElement&&(selectedValueElement.innerHTML=target.value);var previousVariant=this.currentVariant;if(this.currentVariant=this._getCurrentVariantFromOptions(),this._onVariantChanged(previousVariant,this.currentVariant),this.currentVariant){if(this.options.enableHistoryState&&history.replaceState){var newUrl="".concat(window.location.protocol,"//").concat(window.location.host).concat(window.location.pathname,"?variant=").concat(this.currentVariant.id);window.history.replaceState({path:newUrl},"",newUrl)}this.masterSelector.querySelector("[selected]").removeAttribute("selected"),this.masterSelector.querySelector('[value="'.concat(this.currentVariant.id,'"]')).setAttribute("selected","selected")}typeof window.BOLD!="undefined"&&typeof window.BOLD.common!="undefined"&&typeof window.BOLD.common.eventEmitter!="undefined"&&typeof window.BOLD.common.eventEmitter.emit!="undefined"&&BOLD.common.eventEmitter.emit("BOLD_COMMON_variant_changed",{variant:this.currentVariant})}},{key:"_getCurrentVariantFromOptions",value:function(){var _this3=this,found=!1;return this.productData.variants.forEach(function(variant){variant.option1===_this3.option1&&variant.option2===_this3.option2&&variant.option3===_this3.option3&&(found=variant)}),found||null}},{key:"_addToCart",value:function(event2,target){var _this4=this;if(window.theme.cartType==="page")return;event2.preventDefault(),event2.stopPropagation(),target.setAttribute("disabled","disabled"),document.dispatchEvent(new CustomEvent("theme:loading:start")),console.log("agregando al carreto");var stockCheck=!1,formProd=this.element.querySelector('form[action*="/cart/add"]'),productoData=buscarProductoInfoPorSku(Form.serialize(formProd).sku);console.log("productoData",Form.serialize(formProd)),localStorage.setItem("category-"+Form.serialize(formProd).id,Form.serialize(formProd).category1),dataLayer.push({ecommerce:null}),dataLayer.push({event:"add_to_cart",ecommerce:{items:[{item_id:Form.serialize(formProd).sku,item_name:Form.serialize(formProd).p_name,affiliation:localStorage.getItem("suc_name"),coupon:"",currency:"MXN",discount:0,item_brand:"El Globo",item_category:Form.serialize(formProd).category1,item_category2:"",price:Form.serialize(formProd).category1=="BEBIDAS"?"":parseFloat(productoData.precio),quantity:Form.serialize(formProd).quantity}]}}),fetchMTDCart(function(error,cart){if(error)console.error(error);else{var productId=Form.serialize(formProd).id,productExists=!1,productQuantity=0;cart.items.forEach(function(item){console.log("item.id: ",item.id),item.id===parseInt(productId)&&(productExists=!0,productQuantity=item.quantity)}),productExists?(console.log("productoData",productoData.precio),parseInt(productQuantity)').concat(message,"

"),afterElement.removeAttribute("disabled"),afterElement.parentNode.insertAdjacentElement("afterend",messageElement),Animation.slideDown(messageElement),setTimeout(function(){Animation.slideUp(messageElement,function(){messageElement.remove()})},5500)}}]),ProductVariants2}(),ProductModel=function(){function ProductModel2(element){_classCallCheck(this,ProductModel2),this.element=element,this.delegateElement=new Delegate(this.element),this.delegateRoot=new Delegate(document.documentElement),this._attachListeners();var stylesheet=document.createElement("link");stylesheet.rel="stylesheet",stylesheet.href="https://cdn.shopify.com/shopifycloud/model-viewer-ui/assets/v1.0/model-viewer-ui.css",document.head.appendChild(stylesheet),window.Shopify.loadFeatures([{name:"model-viewer-ui",version:"1.0",onLoad:this._setupModelViewerUI.bind(this)},{name:"shopify-xr",version:"1.0"}])}return _createClass(ProductModel2,[{key:"destroy",value:function(){}},{key:"_attachListeners",value:function(){var _this=this;this.element.querySelector("model-viewer").addEventListener("shopify_model_viewer_ui_toggle_play",function(){_this.element.dispatchEvent(new CustomEvent("model:played",{bubbles:!0}))}),this.element.querySelector("model-viewer").addEventListener("shopify_model_viewer_ui_toggle_pause",function(){_this.element.dispatchEvent(new CustomEvent("model:paused",{bubbles:!0}))})}},{key:"hasBeenSelected",value:function(isInitialLoading){Responsive.matchesBreakpoint("supports-hover")&&!isInitialLoading&&this.modelUi.play()}},{key:"hasBeenDeselected",value:function(){this.modelUi.pause()}},{key:"_setupModelViewerUI",value:function(){this.modelElement=this.element.querySelector("model-viewer"),this.modelUi=new window.Shopify.ModelViewerUI(this.modelElement)}}]),ProductModel2}(),ProductVideo=function(){function ProductVideo2(element,enableVideoLooping){switch(_classCallCheck(this,ProductVideo2),this.element=element,this.delegateElement=new Delegate(this.element),this.enableVideoLooping=enableVideoLooping,this.player=null,this.element.getAttribute("data-media-type")){case"video":var stylesheet=document.createElement("link");stylesheet.rel="stylesheet",stylesheet.href="https://cdn.shopify.com/shopifycloud/shopify-plyr/v1.0/shopify-plyr.css",document.head.appendChild(stylesheet),window.Shopify.loadFeatures([{name:"video-ui",version:"1.0",onLoad:this._setupHtml5Video.bind(this)}]);break;case"external_video":this._setupExternalVideo();break}}return _createClass(ProductVideo2,[{key:"destroy",value:function(){this.player&&this.player.destroy()}},{key:"hasBeenSelected",value:function(isInitialLoading){Responsive.matchesBreakpoint("supports-hover")&&!isInitialLoading&&this.play()}},{key:"hasBeenDeselected",value:function(){this.pause()}},{key:"play",value:function(){switch(this.element.getAttribute("data-media-type")){case"video":this.player.play();break;case"external_video":this.player.playVideo(),this.element.focus();break}}},{key:"pause",value:function(){switch(this.element.getAttribute("data-media-type")){case"video":this.player.pause();break;case"external_video":this.player.pauseVideo();break}}},{key:"_setupHtml5Video",value:function(){var _this=this;this.player=new Shopify.Plyr(this.element.querySelector("video"),{controls:["play","progress","mute","volume","play-large","fullscreen"],loop:{active:this.enableVideoLooping},hideControlsOnPause:!0,clickToPlay:!0,iconUrl:"//cdn.shopify.com/shopifycloud/shopify-plyr/v1.0/shopify-plyr.svg",tooltips:{controls:!1,seek:!0}}),this.player.on("play",function(){_this.element.dispatchEvent(new CustomEvent("video:played",{bubbles:!0}))}),this.player.on("pause",function(){_this.element.dispatchEvent(new CustomEvent("video:paused",{bubbles:!0}))})}},{key:"_setupExternalVideo",value:function(){this.element.getAttribute("data-media-host")==="youtube"&&this._loadYouTubeScript().then(this._setupYouTubePlayer.bind(this))}},{key:"_setupYouTubePlayer",value:function(){var _this2=this,playerLoadingInterval=setInterval(function(){window.YT!==void 0&&window.YT.Player!==void 0&&(_this2.player=new YT.Player(_this2.element.querySelector("iframe"),{videoId:_this2.element.getAttribute("data-video-id"),events:{onStateChange:function(event2){event2.data===0&&_this2.enableVideoLooping&&event2.target.seekTo(0)}}}),clearInterval(playerLoadingInterval))},50)}},{key:"_loadYouTubeScript",value:function(){return new Promise(function(resolve,reject){var script=document.createElement("script");document.body.appendChild(script),script.onload=resolve,script.onerror=reject,script.async=!0,script.src="//www.youtube.com/iframe_api"})}}]),ProductVideo2}(),evEmitter=createCommonjsModule(function(module){(function(global2,factory){module.exports?module.exports=factory():global2.EvEmitter=factory()})(typeof window!="undefined"?window:commonjsGlobal,function(){function EvEmitter(){}var proto=EvEmitter.prototype;return proto.on=function(eventName,listener){if(!(!eventName||!listener)){var events=this._events=this._events||{},listeners=events[eventName]=events[eventName]||[];return listeners.indexOf(listener)==-1&&listeners.push(listener),this}},proto.once=function(eventName,listener){if(!(!eventName||!listener)){this.on(eventName,listener);var onceEvents=this._onceEvents=this._onceEvents||{},onceListeners=onceEvents[eventName]=onceEvents[eventName]||{};return onceListeners[listener]=!0,this}},proto.off=function(eventName,listener){var listeners=this._events&&this._events[eventName];if(!(!listeners||!listeners.length)){var index=listeners.indexOf(listener);return index!=-1&&listeners.splice(index,1),this}},proto.emitEvent=function(eventName,args){var listeners=this._events&&this._events[eventName];if(!(!listeners||!listeners.length)){listeners=listeners.slice(0),args=args||[];for(var onceListeners=this._onceEvents&&this._onceEvents[eventName],i=0;i