import e from"jquery";function _typeof(e){_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};return _typeof(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var i=0;ie.length)&&(t=e.length);for(var i=0,n=new Array(t);i0&&void 0!==arguments[0]?arguments[0]:6;var t=arguments.length>1?arguments[1]:void 0;var i="";var n="0123456789abcdefghijklmnopqrstuvwxyz";var s=n.length;for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:{},n=i.ignoreLeaveWindow,s=void 0!==n&&n,a=i.ignoreReappear,o=void 0!==a&&a;return function leaveEventHandler(i){for(var n=arguments.length,a=new Array(n>1?n-1:0),r=1;r').appendTo(document.head);var n=e(".foundation-mq").css("font-family");var s;s=parseStyleToObject(n);t.queries=[];for(var a in s)s.hasOwnProperty(a)&&t.queries.push({name:a,value:"only screen and (min-width: ".concat(s[a],")")});this.current=this._getCurrentSize();this._watcher()},_reInit:function _reInit(){this.isInitialized=false;this._init()}, /** * Checks if the screen is at least as wide as a breakpoint. * @function * @param {String} size - Name of the breakpoint to check. * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller. */ atLeast:function atLeast(e){var t=this.get(e);return!!t&&window.matchMedia(t).matches}, /** * Checks if the screen is within the given breakpoint. * If smaller than the breakpoint of larger than its upper limit it returns false. * @function * @param {String} size - Name of the breakpoint to check. * @returns {Boolean} `true` if the breakpoint matches, `false` otherwise. */ only:function only(e){return e===this._getCurrentSize()}, /** * Checks if the screen is within a breakpoint or smaller. * @function * @param {String} size - Name of the breakpoint to check. * @returns {Boolean} `true` if the breakpoint matches, `false` if it's larger. */ upTo:function upTo(e){var t=this.next(e);return!t||!this.atLeast(t)}, /** * Checks if the screen matches to a breakpoint. * @function * @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method. * @returns {Boolean} `true` if the breakpoint matches, `false` if it does not. */ is:function is(e){var t=e.trim().split(" ").filter((function(e){return!!e.length}));var i=_slicedToArray(t,2),n=i[0],s=i[1],a=void 0===s?"":s;if("only"===a)return this.only(n);if(!a||"up"===a)return this.atLeast(n);if("down"===a)return this.upTo(n);throw new Error('\n Invalid breakpoint passed to MediaQuery.is().\n Expected a breakpoint name formatted like " ", got "'.concat(e,'".\n '))}, /** * Gets the media query of a breakpoint. * @function * @param {String} size - Name of the breakpoint to get. * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist. */ get:function get(e){for(var t in this.queries)if(this.queries.hasOwnProperty(t)){var i=this.queries[t];if(e===i.name)return i.value}return null}, /** * Get the breakpoint following the given breakpoint. * @function * @param {String} size - Name of the breakpoint. * @returns {String|null} - The name of the following breakpoint, or `null` if the passed breakpoint was the last one. */ next:function next(e){var t=this;var i=this.queries.findIndex((function(i){return t._getQueryName(i)===e}));if(-1===i)throw new Error('\n Unknown breakpoint "'.concat(e,'" passed to MediaQuery.next().\n Ensure it is present in your Sass "$breakpoints" setting.\n '));var n=this.queries[i+1];return n?n.name:null}, /** * Returns the name of the breakpoint related to the given value. * @function * @private * @param {String|Object} value - Breakpoint name or query object. * @returns {String} Name of the breakpoint. */ _getQueryName:function _getQueryName(e){if("string"===typeof e)return e;if("object"===_typeof(e))return e.name;throw new TypeError('\n Invalid value passed to MediaQuery._getQueryName().\n Expected a breakpoint name (String) or a breakpoint query (Object), got "'.concat(e,'" (').concat(_typeof(e),")\n "))}, /** * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one). * @function * @private * @returns {String} Name of the current breakpoint. */ _getCurrentSize:function _getCurrentSize(){var e;for(var t=0;t1?i[1].trim():""}return"undefined"===typeof e.prototype?e.constructor.name:e.prototype.constructor.name}function parseValue(e){return"true"===e||"false"!==e&&(isNaN(1*e)?e:parseFloat(e))}function hyphenate(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var a={ImNotTouchingYou:ImNotTouchingYou,OverlapArea:OverlapArea,GetDimensions:GetDimensions,GetExplicitOffsets:GetExplicitOffsets}; /** * Compares the dimensions of an element to a container and determines collision events with container. * @function * @param {jQuery} element - jQuery object to test for collisions. * @param {jQuery} parent - jQuery object to use as bounding container. * @param {Boolean} lrOnly - set to true to check left and right values only. * @param {Boolean} tbOnly - set to true to check top and bottom values only. * @default if no parent object passed, detects collisions with `window`. * @returns {Boolean} - true if collision free, false if a collision in any direction. */function ImNotTouchingYou(e,t,i,n,s){return 0===OverlapArea(e,t,i,n,s)}function OverlapArea(e,t,i,n,s){var a,o,r,l,c=GetDimensions(e);if(t){var h=GetDimensions(t);o=h.height+h.offset.top-(c.offset.top+c.height);a=c.offset.top-h.offset.top;r=c.offset.left-h.offset.left;l=h.width+h.offset.left-(c.offset.left+c.width)}else{o=c.windowDims.height+c.windowDims.offset.top-(c.offset.top+c.height);a=c.offset.top-c.windowDims.offset.top;r=c.offset.left-c.windowDims.offset.left;l=c.windowDims.width-(c.offset.left+c.width)}o=s?0:Math.min(o,0);a=Math.min(a,0);r=Math.min(r,0);l=Math.min(l,0);return i?r+l:n?a+o:Math.sqrt(a*a+o*o+r*r+l*l)} /** * Uses native methods to return an object of dimension values. * @function * @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window. * @returns {Object} - nested object of integer pixel values * TODO - if element is window, return only those values. */function GetDimensions(e){e=e.length?e[0]:e;if(e===window||e===document)throw new Error("I'm sorry, Dave. I'm afraid I can't do that.");var t=e.getBoundingClientRect(),i=e.parentNode.getBoundingClientRect(),n=document.body.getBoundingClientRect(),s=window.pageYOffset,a=window.pageXOffset;return{width:t.width,height:t.height,offset:{top:t.top+s,left:t.left+a},parentDims:{width:i.width,height:i.height,offset:{top:i.top+s,left:i.left+a}},windowDims:{width:n.width,height:n.height,offset:{top:s,left:a}}}} /** * Returns an object of top and left integer pixel values for dynamically rendered elements, * such as: Tooltip, Reveal, and Dropdown. Maintained for backwards compatibility, and where * you don't know alignment, but generally from * 6.4 forward you should use GetExplicitOffsets, as GetOffsets conflates position and alignment. * @function * @param {jQuery} element - jQuery object for the element being positioned. * @param {jQuery} anchor - jQuery object for the element's anchor point. * @param {String} position - a string relating to the desired position of the element, relative to it's anchor * @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element. * @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element. * @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset. * TODO alter/rewrite to work with `em` values as well/instead of pixels */function GetExplicitOffsets(e,t,i,n,s,a,o){var r=GetDimensions(e),l=t?GetDimensions(t):null;var c,h;if(null!==l){switch(i){case"top":c=l.offset.top-(r.height+s);break;case"bottom":c=l.offset.top+l.height+s;break;case"left":h=l.offset.left-(r.width+a);break;case"right":h=l.offset.left+l.width+a;break}switch(i){case"top":case"bottom":switch(n){case"left":h=l.offset.left+a;break;case"right":h=l.offset.left-r.width+l.width-a;break;case"center":h=o?a:l.offset.left+l.width/2-r.width/2+a;break}break;case"right":case"left":switch(n){case"bottom":c=l.offset.top-s+l.height-r.height;break;case"top":c=l.offset.top+s;break;case"center":c=l.offset.top+s+l.height/2-r.height/2;break}break}}return{top:c,left:h}} /** * Runs a callback function when images are fully loaded. * @param {Object} images - Image(s) to check if loaded. * @param {Func} callback - Function to execute when image is fully loaded. */function onImagesLoaded(t,i){var n=t.length;0===n&&i();t.each((function(){if(this.complete&&"undefined"!==typeof this.naturalWidth)singleImageLoaded();else{var t=new Image;var i="load.zf.images error.zf.images";e(t).one(i,(function me(){e(this).off(i,me);singleImageLoaded()}));t.src=e(this).attr("src")}}));function singleImageLoaded(){n--;0===n&&i()}}var o={9:"TAB",13:"ENTER",27:"ESCAPE",32:"SPACE",35:"END",36:"HOME",37:"ARROW_LEFT",38:"ARROW_UP",39:"ARROW_RIGHT",40:"ARROW_DOWN"};var r={};function findFocusable(t){return!!t&&t.find("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]").filter((function(){return!(!e(this).is(":visible")||e(this).attr("tabindex")<0)})).sort((function(t,i){if(e(t).attr("tabindex")===e(i).attr("tabindex"))return 0;var n=parseInt(e(t).attr("tabindex"),10),s=parseInt(e(i).attr("tabindex"),10);return"undefined"===typeof e(t).attr("tabindex")&&s>0?1:"undefined"===typeof e(i).attr("tabindex")&&n>0?-1:0===n&&s>0?1:0===s&&n>0||ns?1:void 0}))}function parseKey(e){var t=o[e.which||e.keyCode]||String.fromCharCode(e.which).toUpperCase();t=t.replace(/\W+/,"");e.shiftKey&&(t="SHIFT_".concat(t));e.ctrlKey&&(t="CTRL_".concat(t));e.altKey&&(t="ALT_".concat(t));t=t.replace(/_$/,"");return t}var l={keys:getKeyCodes(o), /** * Parses the (keyboard) event and returns a String that represents its key * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE * @param {Event} event - the event generated by the event handler * @return String key - String that represents the key pressed */ parseKey:parseKey, /** * Handles the given (keyboard) event * @param {Event} event - the event generated by the event handler * @param {String} component - Foundation component's name, e.g. Slider or Reveal * @param {Objects} functions - collection of functions that are to be executed */ handleKey:function handleKey(t,i,n){var s,a,o,l=r[i],c=this.parseKey(t);if(!l)return console.warn("Component not defined!");if(true!==t.zfIsKeyHandled){s="undefined"===typeof l.ltr?l:rtl()?e.extend({},l.ltr,l.rtl):e.extend({},l.rtl,l.ltr);a=s[c];o=n[a];if(o&&"function"===typeof o){var h=o.apply();t.zfIsKeyHandled=true;(n.handled||"function"===typeof n.handled)&&n.handled(h)}else(n.unhandled||"function"===typeof n.unhandled)&&n.unhandled()}}, /** * Finds all focusable elements within the given `$element` * @param {jQuery} $element - jQuery object to search within * @return {jQuery} $focusable - all focusable elements within `$element` */ findFocusable:findFocusable, /** * Returns the component name name * @param {Object} component - Foundation component, e.g. Slider or Reveal * @return String componentName */ register:function register(e,t){r[e]=t}, /** * Traps the focus in the given element. * @param {jQuery} $element jQuery object to trap the foucs into. */ trapFocus:function trapFocus(e){var t=findFocusable(e),i=t.eq(0),n=t.eq(-1);e.on("keydown.zf.trapfocus",(function(e){if(e.target===n[0]&&"TAB"===parseKey(e)){e.preventDefault();i.focus()}else if(e.target===i[0]&&"SHIFT_TAB"===parseKey(e)){e.preventDefault();n.focus()}}))}, /** * Releases the trapped focus from the given element. * @param {jQuery} $element jQuery object to release the focus for. */ releaseFocus:function releaseFocus(e){e.off("keydown.zf.trapfocus")}};function getKeyCodes(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=e[i]);return t}var c=["mui-enter","mui-leave"];var h=["mui-enter-active","mui-leave-active"];var d={animateIn:function animateIn(e,t,i){animate(true,e,t,i)},animateOut:function animateOut(e,t,i){animate(false,e,t,i)}};function Move(e,t,i){var n,s,a=null;if(0!==e)n=window.requestAnimationFrame(move);else{i.apply(t);t.trigger("finished.zf.animate",[t]).triggerHandler("finished.zf.animate",[t])}function move(o){a||(a=o);s=o-a;i.apply(t);if(s1&&void 0!==arguments[1]?arguments[1]:"zf";t.attr("role","menubar");t.find("a").attr({role:"menuitem"});var n=t.find("li").attr({role:"none"}),s="is-".concat(i,"-submenu"),a="".concat(s,"-item"),o="is-".concat(i,"-submenu-parent"),r="accordion"!==i;n.each((function(){var t=e(this),n=t.children("ul");if(n.length){t.addClass(o);if(r){var l=t.children("a:first");l.attr({"aria-haspopup":true,"aria-label":l.attr("aria-label")||l.text()});"drilldown"===i&&t.attr({"aria-expanded":false})}n.addClass("submenu ".concat(s)).attr({"data-submenu":"",role:"menubar"});"drilldown"===i&&n.attr({"aria-hidden":true})}t.parent("[data-submenu]").length&&t.addClass("is-submenu-item ".concat(a))}))},Burn:function Burn(e,t){var i="is-".concat(t,"-submenu"),n="".concat(i,"-item"),s="is-".concat(t,"-submenu-parent");e.find(">li, > li > ul, .menu, .menu > li, [data-submenu] > li").removeClass("".concat(i," ").concat(n," ").concat(s," is-submenu-item submenu is-active")).removeAttr("data-submenu").css("display","")}};function Timer(e,t,i){var n,s,a=this,o=t.duration,r=Object.keys(e.data())[0]||"timer",l=-1;this.isPaused=false;this.restart=function(){l=-1;clearTimeout(s);this.start()};this.start=function(){this.isPaused=false;clearTimeout(s);l=l<=0?o:l;e.data("paused",false);n=Date.now();s=setTimeout((function(){t.infinite&&a.restart();i&&"function"===typeof i&&i()}),l);e.trigger("timerstart.zf.".concat(r))};this.pause=function(){this.isPaused=true;clearTimeout(s);e.data("paused",true);var t=Date.now();l-=t-n;e.trigger("timerpaused.zf.".concat(r))}}var f={};var p,v,g,m,y=false,_=false;function onTouchEnd(t){this.removeEventListener("touchmove",onTouchMove);this.removeEventListener("touchend",onTouchEnd);if(!_){var i=e.Event("tap",m||t);e(this).trigger(i)}m=null;y=false;_=false}function onTouchMove(t){true===e.spotSwipe.preventDefault&&t.preventDefault();if(y){var i=t.touches[0].pageX;var n=p-i;var s;_=true;g=(new Date).getTime()-v;Math.abs(n)>=e.spotSwipe.moveThreshold&&g<=e.spotSwipe.timeThreshold&&(s=n>0?"left":"right");if(s){t.preventDefault();onTouchEnd.apply(this,arguments);e(this).trigger(e.Event("swipe",Object.assign({},t)),s).trigger(e.Event("swipe".concat(s),Object.assign({},t)))}}}function onTouchStart(t){if(1===t.touches.length){p=t.touches[0].pageX;m=t;y=true;_=false;v=(new Date).getTime();this.addEventListener("touchmove",onTouchMove,{passive:true===e.spotSwipe.preventDefault});this.addEventListener("touchend",onTouchEnd,false)}}function init(){this.addEventListener&&this.addEventListener("touchstart",onTouchStart,{passive:true})}var b=function(){function SpotSwipe(){_classCallCheck(this,SpotSwipe);this.version="1.0.0";this.enabled="ontouchstart"in document.documentElement;this.preventDefault=false;this.moveThreshold=75;this.timeThreshold=200;this._init()}_createClass(SpotSwipe,[{key:"_init",value:function _init(){e.event.special.swipe={setup:init};e.event.special.tap={setup:init};e.each(["left","up","down","right"],(function(){e.event.special["swipe".concat(this)]={setup:function setup(){e(this).on("swipe",e.noop)}}}))}}]);return SpotSwipe}();f.setupSpotSwipe=function(){e.spotSwipe=new b(e)};f.setupTouchHandler=function(){e.fn.addTouch=function(){this.each((function(i,n){e(n).bind("touchstart touchmove touchend touchcancel",(function(e){t(e)}))}));var t=function handleTouch(e){var t,i=e.changedTouches,n=i[0],s={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"},a=s[e.type];if("MouseEvent"in window&&"function"===typeof window.MouseEvent)t=new window.MouseEvent(a,{bubbles:true,cancelable:true,screenX:n.screenX,screenY:n.screenY,clientX:n.clientX,clientY:n.clientY});else{t=document.createEvent("MouseEvent");t.initMouseEvent(a,true,true,window,1,n.screenX,n.screenY,n.clientX,n.clientY,false,false,false,false,0,null)}n.target.dispatchEvent(t)}}};f.init=function(){if("undefined"===typeof e.spotSwipe){f.setupSpotSwipe(e);f.setupTouchHandler(e)}};var w=function(){var e=["WebKit","Moz","O","Ms",""];for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:{};this.$element=t;this.options=e.extend(true,{},Abide.defaults,this.$element.data(),i);this.isEnabled=true;this.formnovalidate=null;this.className="Abide";this._init()}},{key:"_init",value:function _init(){var t=this;this.$inputs=e.merge(this.$element.find("input").not('[type="submit"]'),this.$element.find("textarea, select"));this.$submits=this.$element.find('[type="submit"]');var i=this.$element.find("[data-abide-error]");if(this.options.a11yAttributes){this.$inputs.each((function(i,n){return t.addA11yAttributes(e(n))}));i.each((function(i,n){return t.addGlobalErrorA11yAttributes(e(n))}))}this._events()}},{key:"_events",value:function _events(){var t=this;this.$element.off(".abide").on("reset.zf.abide",(function(){t.resetForm()})).on("submit.zf.abide",(function(){return t.validateForm()}));this.$submits.off("click.zf.abide keydown.zf.abide").on("click.zf.abide keydown.zf.abide",(function(e){if(!e.key||" "===e.key||"Enter"===e.key){e.preventDefault();t.formnovalidate=null!==e.target.getAttribute("formnovalidate");t.$element.submit()}}));"fieldChange"===this.options.validateOn&&this.$inputs.off("change.zf.abide").on("change.zf.abide",(function(i){t.validateInput(e(i.target))}));this.options.liveValidate&&this.$inputs.off("input.zf.abide").on("input.zf.abide",(function(i){t.validateInput(e(i.target))}));this.options.validateOnBlur&&this.$inputs.off("blur.zf.abide").on("blur.zf.abide",(function(i){t.validateInput(e(i.target))}))}},{key:"_reflow",value:function _reflow(){this._init()} /** * Checks whether the submitted form should be validated or not, consodering formnovalidate and isEnabled * @returns {Boolean} * @private */},{key:"_validationIsDisabled",value:function _validationIsDisabled(){return false===this.isEnabled||("boolean"===typeof this.formnovalidate?this.formnovalidate:!!this.$submits.length&&null!==this.$submits[0].getAttribute("formnovalidate"))}},{key:"enableValidation",value:function enableValidation(){this.isEnabled=true}},{key:"disableValidation",value:function disableValidation(){this.isEnabled=false} /** * Checks whether or not a form element has the required attribute and if it's checked or not * @param {Object} element - jQuery object to check for required attribute * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty */},{key:"requiredCheck",value:function requiredCheck(e){if(!e.attr("required"))return true;var t=true;switch(e[0].type){case"checkbox":t=e[0].checked;break;case"select":case"select-one":case"select-multiple":var i=e.find("option:selected");i.length&&i.val()||(t=false);break;default:e.val()&&e.val().length||(t=false)}return t} /** * Get: * - Based on $el, the first element(s) corresponding to `formErrorSelector` in this order: * 1. The element's direct sibling('s). * 2. The element's parent's children. * - Element(s) with the attribute `[data-form-error-for]` set with the element's id. * * This allows for multiple form errors per input, though if none are found, no form errors will be shown. * * @param {Object} $el - jQuery object to use as reference to find the form error selector. * @param {String[]} [failedValidators] - List of failed validators. * @returns {Object} jQuery object with the selector. */},{key:"findFormError",value:function findFormError(e,t){var i=this;var n=e.length?e[0].id:"";var s=e.siblings(this.options.formErrorSelector);s.length||(s=e.parent().find(this.options.formErrorSelector));n&&(s=s.add(this.$element.find('[data-form-error-for="'.concat(n,'"]'))));if(!!t){s=s.not("[data-form-error-on]");t.forEach((function(t){s=s.add(e.siblings('[data-form-error-on="'.concat(t,'"]')));s=s.add(i.$element.find('[data-form-error-for="'.concat(n,'"][data-form-error-on="').concat(t,'"]')))}))}return s} /** * Get the first element in this order: * 2. The