UNPKG

materialize-css

Version:

Builds Materialize distribution packages

1,703 lines (1,470 loc) 371 kB
/*! * Materialize v1.0.0 (http://materializecss.com) * Copyright 2014-2017 Materialize * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE) */ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */ (function (factory) { window.cash = factory(); })(function () { var doc = document, win = window, ArrayProto = Array.prototype, slice = ArrayProto.slice, filter = ArrayProto.filter, push = ArrayProto.push; var noop = function () {}, isFunction = function (item) { // @see https://crbug.com/568448 return typeof item === typeof noop && item.call; }, isString = function (item) { return typeof item === typeof ""; }; var idMatch = /^#[\w-]*$/, classMatch = /^\.[\w-]*$/, htmlMatch = /<.+>/, singlet = /^\w+$/; function find(selector, context) { context = context || doc; var elems = classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector); return elems; } var frag; function parseHTML(str) { if (!frag) { frag = doc.implementation.createHTMLDocument(null); var base = frag.createElement("base"); base.href = doc.location.href; frag.head.appendChild(base); } frag.body.innerHTML = str; return frag.body.childNodes; } function onReady(fn) { if (doc.readyState !== "loading") { fn(); } else { doc.addEventListener("DOMContentLoaded", fn); } } function Init(selector, context) { if (!selector) { return this; } // If already a cash collection, don't do any further processing if (selector.cash && selector !== win) { return selector; } var elems = selector, i = 0, length; if (isString(selector)) { elems = idMatch.test(selector) ? // If an ID use the faster getElementById check doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ? // If HTML, parse it into real elements parseHTML(selector) : // else use `find` find(selector, context); // If function, use as shortcut for DOM ready } else if (isFunction(selector)) { onReady(selector);return this; } if (!elems) { return this; } // If a single DOM element is passed in or received via ID, return the single element if (elems.nodeType || elems === win) { this[0] = elems; this.length = 1; } else { // Treat like an array and loop through each item. length = this.length = elems.length; for (; i < length; i++) { this[i] = elems[i]; } } return this; } function cash(selector, context) { return new Init(selector, context); } var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line cash: true, length: 0, push: push, splice: ArrayProto.splice, map: ArrayProto.map, init: Init }; Object.defineProperty(fn, "constructor", { value: cash }); cash.parseHTML = parseHTML; cash.noop = noop; cash.isFunction = isFunction; cash.isString = isString; cash.extend = fn.extend = function (target) { target = target || {}; var args = slice.call(arguments), length = args.length, i = 1; if (args.length === 1) { target = this; i = 0; } for (; i < length; i++) { if (!args[i]) { continue; } for (var key in args[i]) { if (args[i].hasOwnProperty(key)) { target[key] = args[i][key]; } } } return target; }; function each(collection, callback) { var l = collection.length, i = 0; for (; i < l; i++) { if (callback.call(collection[i], collection[i], i, collection) === false) { break; } } } function matches(el, selector) { var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector); return !!m && m.call(el, selector); } function getCompareFunction(selector) { return ( /* Use browser's `matches` function if string */ isString(selector) ? matches : /* Match a cash element */ selector.cash ? function (el) { return selector.is(el); } : /* Direct comparison */ function (el, selector) { return el === selector; } ); } function unique(collection) { return cash(slice.call(collection).filter(function (item, index, self) { return self.indexOf(item) === index; })); } cash.extend({ merge: function (first, second) { var len = +second.length, i = first.length, j = 0; for (; j < len; i++, j++) { first[i] = second[j]; } first.length = i; return first; }, each: each, matches: matches, unique: unique, isArray: Array.isArray, isNumeric: function (n) { return !isNaN(parseFloat(n)) && isFinite(n); } }); var uid = cash.uid = "_cash" + Date.now(); function getDataCache(node) { return node[uid] = node[uid] || {}; } function setData(node, key, value) { return getDataCache(node)[key] = value; } function getData(node, key) { var c = getDataCache(node); if (c[key] === undefined) { c[key] = node.dataset ? node.dataset[key] : cash(node).attr("data-" + key); } return c[key]; } function removeData(node, key) { var c = getDataCache(node); if (c) { delete c[key]; } else if (node.dataset) { delete node.dataset[key]; } else { cash(node).removeAttr("data-" + name); } } fn.extend({ data: function (name, value) { if (isString(name)) { return value === undefined ? getData(this[0], name) : this.each(function (v) { return setData(v, name, value); }); } for (var key in name) { this.data(key, name[key]); } return this; }, removeData: function (key) { return this.each(function (v) { return removeData(v, key); }); } }); var notWhiteMatch = /\S+/g; function getClasses(c) { return isString(c) && c.match(notWhiteMatch); } function hasClass(v, c) { return v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className); } function addClass(v, c, spacedName) { if (v.classList) { v.classList.add(c); } else if (spacedName.indexOf(" " + c + " ")) { v.className += " " + c; } } function removeClass(v, c) { if (v.classList) { v.classList.remove(c); } else { v.className = v.className.replace(c, ""); } } fn.extend({ addClass: function (c) { var classes = getClasses(c); return classes ? this.each(function (v) { var spacedName = " " + v.className + " "; each(classes, function (c) { addClass(v, c, spacedName); }); }) : this; }, attr: function (name, value) { if (!name) { return undefined; } if (isString(name)) { if (value === undefined) { return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined; } return this.each(function (v) { if (v.setAttribute) { v.setAttribute(name, value); } else { v[name] = value; } }); } for (var key in name) { this.attr(key, name[key]); } return this; }, hasClass: function (c) { var check = false, classes = getClasses(c); if (classes && classes.length) { this.each(function (v) { check = hasClass(v, classes[0]); return !check; }); } return check; }, prop: function (name, value) { if (isString(name)) { return value === undefined ? this[0][name] : this.each(function (v) { v[name] = value; }); } for (var key in name) { this.prop(key, name[key]); } return this; }, removeAttr: function (name) { return this.each(function (v) { if (v.removeAttribute) { v.removeAttribute(name); } else { delete v[name]; } }); }, removeClass: function (c) { if (!arguments.length) { return this.attr("class", ""); } var classes = getClasses(c); return classes ? this.each(function (v) { each(classes, function (c) { removeClass(v, c); }); }) : this; }, removeProp: function (name) { return this.each(function (v) { delete v[name]; }); }, toggleClass: function (c, state) { if (state !== undefined) { return this[state ? "addClass" : "removeClass"](c); } var classes = getClasses(c); return classes ? this.each(function (v) { var spacedName = " " + v.className + " "; each(classes, function (c) { if (hasClass(v, c)) { removeClass(v, c); } else { addClass(v, c, spacedName); } }); }) : this; } }); fn.extend({ add: function (selector, context) { return unique(cash.merge(this, cash(selector, context))); }, each: function (callback) { each(this, callback); return this; }, eq: function (index) { return cash(this.get(index)); }, filter: function (selector) { if (!selector) { return this; } var comparator = isFunction(selector) ? selector : getCompareFunction(selector); return cash(filter.call(this, function (e) { return comparator(e, selector); })); }, first: function () { return this.eq(0); }, get: function (index) { if (index === undefined) { return slice.call(this); } return index < 0 ? this[index + this.length] : this[index]; }, index: function (elem) { var child = elem ? cash(elem)[0] : this[0], collection = elem ? this : cash(child).parent().children(); return slice.call(collection).indexOf(child); }, last: function () { return this.eq(-1); } }); var camelCase = function () { var camelRegex = /(?:^\w|[A-Z]|\b\w)/g, whiteSpace = /[\s-_]+/g; return function (str) { return str.replace(camelRegex, function (letter, index) { return letter[index === 0 ? "toLowerCase" : "toUpperCase"](); }).replace(whiteSpace, ""); }; }(); var getPrefixedProp = function () { var cache = {}, doc = document, div = doc.createElement("div"), style = div.style; return function (prop) { prop = camelCase(prop); if (cache[prop]) { return cache[prop]; } var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), prefixes = ["webkit", "moz", "ms", "o"], props = (prop + " " + prefixes.join(ucProp + " ") + ucProp).split(" "); each(props, function (p) { if (p in style) { cache[p] = prop = cache[prop] = p; return false; } }); return cache[prop]; }; }(); cash.prefixedProp = getPrefixedProp; cash.camelCase = camelCase; fn.extend({ css: function (prop, value) { if (isString(prop)) { prop = getPrefixedProp(prop); return arguments.length > 1 ? this.each(function (v) { return v.style[prop] = value; }) : win.getComputedStyle(this[0])[prop]; } for (var key in prop) { this.css(key, prop[key]); } return this; } }); function compute(el, prop) { return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0; } each(["Width", "Height"], function (v) { var lower = v.toLowerCase(); fn[lower] = function () { return this[0].getBoundingClientRect()[lower]; }; fn["inner" + v] = function () { return this[0]["client" + v]; }; fn["outer" + v] = function (margins) { return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0); }; }); function registerEvent(node, eventName, callback) { var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {}); eventCache[eventName] = eventCache[eventName] || []; eventCache[eventName].push(callback); node.addEventListener(eventName, callback); } function removeEvent(node, eventName, callback) { var events = getData(node, "_cashEvents"), eventCache = events && events[eventName], index; if (!eventCache) { return; } if (callback) { node.removeEventListener(eventName, callback); index = eventCache.indexOf(callback); if (index >= 0) { eventCache.splice(index, 1); } } else { each(eventCache, function (event) { node.removeEventListener(eventName, event); }); eventCache = []; } } fn.extend({ off: function (eventName, callback) { return this.each(function (v) { return removeEvent(v, eventName, callback); }); }, on: function (eventName, delegate, callback, runOnce) { // jshint ignore:line var originalCallback; if (!isString(eventName)) { for (var key in eventName) { this.on(key, delegate, eventName[key]); } return this; } if (isFunction(delegate)) { callback = delegate; delegate = null; } if (eventName === "ready") { onReady(callback); return this; } if (delegate) { originalCallback = callback; callback = function (e) { var t = e.target; while (!matches(t, delegate)) { if (t === this || t === null) { return t = false; } t = t.parentNode; } if (t) { originalCallback.call(t, e); } }; } return this.each(function (v) { var finalCallback = callback; if (runOnce) { finalCallback = function () { callback.apply(this, arguments); removeEvent(v, eventName, finalCallback); }; } registerEvent(v, eventName, finalCallback); }); }, one: function (eventName, delegate, callback) { return this.on(eventName, delegate, callback, true); }, ready: onReady, /** * Modified * Triggers browser event * @param String eventName * @param Object data - Add properties to event object */ trigger: function (eventName, data) { if (document.createEvent) { var evt = document.createEvent('HTMLEvents'); evt.initEvent(eventName, true, false); evt = this.extend(evt, data); return this.each(function (v) { return v.dispatchEvent(evt); }); } } }); function encode(name, value) { return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); } function getSelectMultiple_(el) { var values = []; each(el.options, function (o) { if (o.selected) { values.push(o.value); } }); return values.length ? values : null; } function getSelectSingle_(el) { var selectedIndex = el.selectedIndex; return selectedIndex >= 0 ? el.options[selectedIndex].value : null; } function getValue(el) { var type = el.type; if (!type) { return null; } switch (type.toLowerCase()) { case "select-one": return getSelectSingle_(el); case "select-multiple": return getSelectMultiple_(el); case "radio": return el.checked ? el.value : null; case "checkbox": return el.checked ? el.value : null; default: return el.value ? el.value : null; } } fn.extend({ serialize: function () { var query = ""; each(this[0].elements || this, function (el) { if (el.disabled || el.tagName === "FIELDSET") { return; } var name = el.name; switch (el.type.toLowerCase()) { case "file": case "reset": case "submit": case "button": break; case "select-multiple": var values = getValue(el); if (values !== null) { each(values, function (value) { query += encode(name, value); }); } break; default: var value = getValue(el); if (value !== null) { query += encode(name, value); } } }); return query.substr(1); }, val: function (value) { if (value === undefined) { return getValue(this[0]); } return this.each(function (v) { return v.value = value; }); } }); function insertElement(el, child, prepend) { if (prepend) { var first = el.childNodes[0]; el.insertBefore(child, first); } else { el.appendChild(child); } } function insertContent(parent, child, prepend) { var str = isString(child); if (!str && child.length) { each(child, function (v) { return insertContent(parent, v, prepend); }); return; } each(parent, str ? function (v) { return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child); } : function (v, i) { return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend); }); } fn.extend({ after: function (selector) { cash(selector).insertAfter(this); return this; }, append: function (content) { insertContent(this, content); return this; }, appendTo: function (parent) { insertContent(cash(parent), this); return this; }, before: function (selector) { cash(selector).insertBefore(this); return this; }, clone: function () { return cash(this.map(function (v) { return v.cloneNode(true); })); }, empty: function () { this.html(""); return this; }, html: function (content) { if (content === undefined) { return this[0].innerHTML; } var source = content.nodeType ? content[0].outerHTML : content; return this.each(function (v) { return v.innerHTML = source; }); }, insertAfter: function (selector) { var _this = this; cash(selector).each(function (el, i) { var parent = el.parentNode, sibling = el.nextSibling; _this.each(function (v) { parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling); }); }); return this; }, insertBefore: function (selector) { var _this2 = this; cash(selector).each(function (el, i) { var parent = el.parentNode; _this2.each(function (v) { parent.insertBefore(i === 0 ? v : v.cloneNode(true), el); }); }); return this; }, prepend: function (content) { insertContent(this, content, true); return this; }, prependTo: function (parent) { insertContent(cash(parent), this, true); return this; }, remove: function () { return this.each(function (v) { if (!!v.parentNode) { return v.parentNode.removeChild(v); } }); }, text: function (content) { if (content === undefined) { return this[0].textContent; } return this.each(function (v) { return v.textContent = content; }); } }); var docEl = doc.documentElement; fn.extend({ position: function () { var el = this[0]; return { left: el.offsetLeft, top: el.offsetTop }; }, offset: function () { var rect = this[0].getBoundingClientRect(); return { top: rect.top + win.pageYOffset - docEl.clientTop, left: rect.left + win.pageXOffset - docEl.clientLeft }; }, offsetParent: function () { return cash(this[0].offsetParent); } }); fn.extend({ children: function (selector) { var elems = []; this.each(function (el) { push.apply(elems, el.children); }); elems = unique(elems); return !selector ? elems : elems.filter(function (v) { return matches(v, selector); }); }, closest: function (selector) { if (!selector || this.length < 1) { return cash(); } if (this.is(selector)) { return this.filter(selector); } return this.parent().closest(selector); }, is: function (selector) { if (!selector) { return false; } var match = false, comparator = getCompareFunction(selector); this.each(function (el) { match = comparator(el, selector); return !match; }); return match; }, find: function (selector) { if (!selector || selector.nodeType) { return cash(selector && this.has(selector).length ? selector : null); } var elems = []; this.each(function (el) { push.apply(elems, find(selector, el)); }); return unique(elems); }, has: function (selector) { var comparator = isString(selector) ? function (el) { return find(selector, el).length !== 0; } : function (el) { return el.contains(selector); }; return this.filter(comparator); }, next: function () { return cash(this[0].nextElementSibling); }, not: function (selector) { if (!selector) { return this; } var comparator = getCompareFunction(selector); return this.filter(function (el) { return !comparator(el, selector); }); }, parent: function () { var result = []; this.each(function (item) { if (item && item.parentNode) { result.push(item.parentNode); } }); return unique(result); }, parents: function (selector) { var last, result = []; this.each(function (item) { last = item; while (last && last.parentNode && last !== doc.body.parentNode) { last = last.parentNode; if (!selector || selector && matches(last, selector)) { result.push(last); } } }); return unique(result); }, prev: function () { return cash(this[0].previousElementSibling); }, siblings: function (selector) { var collection = this.parent().children(selector), el = this[0]; return collection.filter(function (i) { return i !== el; }); } }); return cash; }); ; var Component = function () { /** * Generic constructor for all components * @constructor * @param {Element} el * @param {Object} options */ function Component(classDef, el, options) { _classCallCheck(this, Component); // Display error if el is valid HTML Element if (!(el instanceof Element)) { console.error(Error(el + ' is not an HTML Element')); } // If exists, destroy and reinitialize in child var ins = classDef.getInstance(el); if (!!ins) { ins.destroy(); } this.el = el; this.$el = cash(el); } /** * Initializes components * @param {class} classDef * @param {Element | NodeList | jQuery} els * @param {Object} options */ _createClass(Component, null, [{ key: "init", value: function init(classDef, els, options) { var instances = null; if (els instanceof Element) { instances = new classDef(els, options); } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { var instancesArr = []; for (var i = 0; i < els.length; i++) { instancesArr.push(new classDef(els[i], options)); } instances = instancesArr; } return instances; } }]); return Component; }(); ; // Required for Meteor package, the use of window prevents export by Meteor (function (window) { if (window.Package) { M = {}; } else { window.M = {}; } // Check for jQuery M.jQueryLoaded = !!window.jQuery; })(window); // AMD if (typeof define === 'function' && define.amd) { define('M', [], function () { return M; }); // Common JS } else if (typeof exports !== 'undefined' && !exports.nodeType) { if (typeof module !== 'undefined' && !module.nodeType && module.exports) { exports = module.exports = M; } exports.default = M; } M.version = '1.0.0'; M.keys = { TAB: 9, ENTER: 13, ESC: 27, ARROW_UP: 38, ARROW_DOWN: 40 }; /** * TabPress Keydown handler */ M.tabPressed = false; M.keyDown = false; var docHandleKeydown = function (e) { M.keyDown = true; if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { M.tabPressed = true; } }; var docHandleKeyup = function (e) { M.keyDown = false; if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { M.tabPressed = false; } }; var docHandleFocus = function (e) { if (M.keyDown) { document.body.classList.add('keyboard-focused'); } }; var docHandleBlur = function (e) { document.body.classList.remove('keyboard-focused'); }; document.addEventListener('keydown', docHandleKeydown, true); document.addEventListener('keyup', docHandleKeyup, true); document.addEventListener('focus', docHandleFocus, true); document.addEventListener('blur', docHandleBlur, true); /** * Initialize jQuery wrapper for plugin * @param {Class} plugin javascript class * @param {string} pluginName jQuery plugin name * @param {string} classRef Class reference name */ M.initializeJqueryWrapper = function (plugin, pluginName, classRef) { jQuery.fn[pluginName] = function (methodOrOptions) { // Call plugin method if valid method name is passed in if (plugin.prototype[methodOrOptions]) { var params = Array.prototype.slice.call(arguments, 1); // Getter methods if (methodOrOptions.slice(0, 3) === 'get') { var instance = this.first()[0][classRef]; return instance[methodOrOptions].apply(instance, params); } // Void methods return this.each(function () { var instance = this[classRef]; instance[methodOrOptions].apply(instance, params); }); // Initialize plugin if options or no argument is passed in } else if (typeof methodOrOptions === 'object' || !methodOrOptions) { plugin.init(this, arguments[0]); return this; } // Return error if an unrecognized method name is passed in jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName); }; }; /** * Automatically initialize components * @param {Element} context DOM Element to search within for components */ M.AutoInit = function (context) { // Use document.body if no context is given var root = !!context ? context : document.body; var registry = { Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'), Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'), Chips: root.querySelectorAll('.chips:not(.no-autoinit)'), Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'), Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'), Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'), Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'), Modal: root.querySelectorAll('.modal:not(.no-autoinit)'), Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'), Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'), ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'), FormSelect: root.querySelectorAll('select:not(.no-autoinit)'), Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'), Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'), TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'), Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'), Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'), FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)') }; for (var pluginName in registry) { var plugin = M[pluginName]; plugin.init(registry[pluginName]); } }; /** * Generate approximated selector string for a jQuery object * @param {jQuery} obj jQuery object to be parsed * @returns {string} */ M.objectSelectorString = function (obj) { var tagStr = obj.prop('tagName') || ''; var idStr = obj.attr('id') || ''; var classStr = obj.attr('class') || ''; return (tagStr + idStr + classStr).replace(/\s/g, ''); }; // Unique Random ID M.guid = function () { function s4() { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); } return function () { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); }; }(); /** * Escapes hash from special characters * @param {string} hash String returned from this.hash * @returns {string} */ M.escapeHash = function (hash) { return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1'); }; M.elementOrParentIsFixed = function (element) { var $element = $(element); var $checkElements = $element.add($element.parents()); var isFixed = false; $checkElements.each(function () { if ($(this).css('position') === 'fixed') { isFixed = true; return false; } }); return isFixed; }; /** * @typedef {Object} Edges * @property {Boolean} top If the top edge was exceeded * @property {Boolean} right If the right edge was exceeded * @property {Boolean} bottom If the bottom edge was exceeded * @property {Boolean} left If the left edge was exceeded */ /** * @typedef {Object} Bounding * @property {Number} left left offset coordinate * @property {Number} top top offset coordinate * @property {Number} width * @property {Number} height */ /** * Escapes hash from special characters * @param {Element} container Container element that acts as the boundary * @param {Bounding} bounding element bounding that is being checked * @param {Number} offset offset from edge that counts as exceeding * @returns {Edges} */ M.checkWithinContainer = function (container, bounding, offset) { var edges = { top: false, right: false, bottom: false, left: false }; var containerRect = container.getBoundingClientRect(); // If body element is smaller than viewport, use viewport height instead. var containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom; var scrollLeft = container.scrollLeft; var scrollTop = container.scrollTop; var scrolledX = bounding.left - scrollLeft; var scrolledY = bounding.top - scrollTop; // Check for container and viewport for each edge if (scrolledX < containerRect.left + offset || scrolledX < offset) { edges.left = true; } if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) { edges.right = true; } if (scrolledY < containerRect.top + offset || scrolledY < offset) { edges.top = true; } if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) { edges.bottom = true; } return edges; }; M.checkPossibleAlignments = function (el, container, bounding, offset) { var canAlign = { top: true, right: true, bottom: true, left: true, spaceOnTop: null, spaceOnRight: null, spaceOnBottom: null, spaceOnLeft: null }; var containerAllowsOverflow = getComputedStyle(container).overflow === 'visible'; var containerRect = container.getBoundingClientRect(); var containerHeight = Math.min(containerRect.height, window.innerHeight); var containerWidth = Math.min(containerRect.width, window.innerWidth); var elOffsetRect = el.getBoundingClientRect(); var scrollLeft = container.scrollLeft; var scrollTop = container.scrollTop; var scrolledX = bounding.left - scrollLeft; var scrolledYTopEdge = bounding.top - scrollTop; var scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop; // Check for container and viewport for left canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width); if (canAlign.spaceOnRight < 0) { canAlign.left = false; } // Check for container and viewport for Right canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width; if (canAlign.spaceOnLeft < 0) { canAlign.right = false; } // Check for container and viewport for Top canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset); if (canAlign.spaceOnBottom < 0) { canAlign.top = false; } // Check for container and viewport for Bottom canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset); if (canAlign.spaceOnTop < 0) { canAlign.bottom = false; } return canAlign; }; M.getOverflowParent = function (element) { if (element == null) { return null; } if (element === document.body || getComputedStyle(element).overflow !== 'visible') { return element; } return M.getOverflowParent(element.parentElement); }; /** * Gets id of component from a trigger * @param {Element} trigger trigger * @returns {string} */ M.getIdFromTrigger = function (trigger) { var id = trigger.getAttribute('data-target'); if (!id) { id = trigger.getAttribute('href'); if (id) { id = id.slice(1); } else { id = ''; } } return id; }; /** * Multi browser support for document scroll top * @returns {Number} */ M.getDocumentScrollTop = function () { return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; }; /** * Multi browser support for document scroll left * @returns {Number} */ M.getDocumentScrollLeft = function () { return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; }; /** * @typedef {Object} Edges * @property {Boolean} top If the top edge was exceeded * @property {Boolean} right If the right edge was exceeded * @property {Boolean} bottom If the bottom edge was exceeded * @property {Boolean} left If the left edge was exceeded */ /** * @typedef {Object} Bounding * @property {Number} left left offset coordinate * @property {Number} top top offset coordinate * @property {Number} width * @property {Number} height */ /** * Get time in ms * @license https://raw.github.com/jashkenas/underscore/master/LICENSE * @type {function} * @return {number} */ var getTime = Date.now || function () { return new Date().getTime(); }; /** * Returns a function, that, when invoked, will only be triggered at most once * during a given window of time. Normally, the throttled function will run * as much as it can, without ever going more than once per `wait` duration; * but if you'd like to disable the execution on the leading edge, pass * `{leading: false}`. To disable execution on the trailing edge, ditto. * @license https://raw.github.com/jashkenas/underscore/master/LICENSE * @param {function} func * @param {number} wait * @param {Object=} options * @returns {Function} */ M.throttle = function (func, wait, options) { var context = void 0, args = void 0, result = void 0; var timeout = null; var previous = 0; options || (options = {}); var later = function () { previous = options.leading === false ? 0 : getTime(); timeout = null; result = func.apply(context, args); context = args = null; }; return function () { var now = getTime(); if (!previous && options.leading === false) previous = now; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; }; ; /* v2.2.0 2017 Julian Garnier Released under the MIT license */ var $jscomp = { scope: {} };$jscomp.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function (e, r, p) { if (p.get || p.set) throw new TypeError("ES3 does not support getters and setters.");e != Array.prototype && e != Object.prototype && (e[r] = p.value); };$jscomp.getGlobal = function (e) { return "undefined" != typeof window && window === e ? e : "undefined" != typeof global && null != global ? global : e; };$jscomp.global = $jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; $jscomp.initSymbol = function () { $jscomp.initSymbol = function () {};$jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); };$jscomp.symbolCounter_ = 0;$jscomp.Symbol = function (e) { return $jscomp.SYMBOL_PREFIX + (e || "") + $jscomp.symbolCounter_++; }; $jscomp.initSymbolIterator = function () { $jscomp.initSymbol();var e = $jscomp.global.Symbol.iterator;e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator"));"function" != typeof Array.prototype[e] && $jscomp.defineProperty(Array.prototype, e, { configurable: !0, writable: !0, value: function () { return $jscomp.arrayIterator(this); } });$jscomp.initSymbolIterator = function () {}; };$jscomp.arrayIterator = function (e) { var r = 0;return $jscomp.iteratorPrototype(function () { return r < e.length ? { done: !1, value: e[r++] } : { done: !0 }; }); }; $jscomp.iteratorPrototype = function (e) { $jscomp.initSymbolIterator();e = { next: e };e[$jscomp.global.Symbol.iterator] = function () { return this; };return e; };$jscomp.array = $jscomp.array || {};$jscomp.iteratorFromArray = function (e, r) { $jscomp.initSymbolIterator();e instanceof String && (e += "");var p = 0, m = { next: function () { if (p < e.length) { var u = p++;return { value: r(u, e[u]), done: !1 }; }m.next = function () { return { done: !0, value: void 0 }; };return m.next(); } };m[Symbol.iterator] = function () { return m; };return m; }; $jscomp.polyfill = function (e, r, p, m) { if (r) { p = $jscomp.global;e = e.split(".");for (m = 0; m < e.length - 1; m++) { var u = e[m];u in p || (p[u] = {});p = p[u]; }e = e[e.length - 1];m = p[e];r = r(m);r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r }); } };$jscomp.polyfill("Array.prototype.keys", function (e) { return e ? e : function () { return $jscomp.iteratorFromArray(this, function (e) { return e; }); }; }, "es6-impl", "es3");var $jscomp$this = this; (function (r) { M.anime = r(); })(function () { function e(a) { if (!h.col(a)) try { return document.querySelectorAll(a); } catch (c) {} }function r(a, c) { for (var d = a.length, b = 2 <= arguments.length ? arguments[1] : void 0, f = [], n = 0; n < d; n++) { if (n in a) { var k = a[n];c.call(b, k, n, a) && f.push(k); } }return f; }function p(a) { return a.reduce(function (a, d) { return a.concat(h.arr(d) ? p(d) : d); }, []); }function m(a) { if (h.arr(a)) return a; h.str(a) && (a = e(a) || a);return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [a]; }function u(a, c) { return a.some(function (a) { return a === c; }); }function C(a) { var c = {}, d;for (d in a) { c[d] = a[d]; }return c; }function D(a, c) { var d = C(a), b;for (b in a) { d[b] = c.hasOwnProperty(b) ? c[b] : a[b]; }return d; }function z(a, c) { var d = C(a), b;for (b in c) { d[b] = h.und(a[b]) ? c[b] : a[b]; }return d; }function T(a) { a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (a, c, d, k) { return c + c + d + d + k + k; });var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); a = parseInt(c[1], 16);var d = parseInt(c[2], 16), c = parseInt(c[3], 16);return "rgba(" + a + "," + d + "," + c + ",1)"; }function U(a) { function c(a, c, b) { 0 > b && (b += 1);1 < b && --b;return b < 1 / 6 ? a + 6 * (c - a) * b : .5 > b ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a; }var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a = parseInt(d[1]) / 360;var b = parseInt(d[2]) / 100, f = parseInt(d[3]) / 100, d = d[4] || 1;if (0 == b) f = b = a = f;else { var n = .5 > f ? f * (1 + b) : f + b - f * b, k = 2 * f - n, f = c(k, n, a + 1 / 3), b = c(k, n, a);a = c(k, n, a - 1 / 3); }return "rgba(" + 255 * f + "," + 255 * b + "," + 255 * a + "," + d + ")"; }function y(a) { if (a = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2]; }function V(a) { if (-1 < a.indexOf("translate") || "perspective" === a) return "px";if (-1 < a.indexOf("rotate") || -1 < a.indexOf("skew")) return "deg"; }function I(a, c) { return h.fnc(a) ? a(c.target, c.id, c.total) : a; }function E(a, c) { if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0"; }function J(a, c) { if (h.dom(a) && u(W, c)) return "transform";if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return "attribute";if (h.dom(a) && "transform" !== c && E(a, c)) return "css";if (null != a[c]) return "object"; }function X(a, c) { var d = V(c), d = -1 < c.indexOf("scale") ? 1 : 0 + d;a = a.style.transform;if (!a) return d;for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a);) { f.push(b[1]), n.push(b[2]); }a = r(n, function (a, b) { return f[b] === c; });return a.length ? a[0] : d; }function K(a, c) { switch (J(a, c)) {case "transform": return X(a, c);case "css": return E(a, c);case "attribute": return a.getAttribute(c);}return a[c] || 0; }function L(a, c) { var d = /^(\*=|\+=|-=)/.exec(a);if (!d) return a;var b = y(a) || 0;c = parseFloat(c);a = parseFloat(a.replace(d[0], ""));switch (d[0][0]) {case "+": return c + a + b;case "-": return c - a + b;case "*": return c * a + b;} }function F(a, c) { return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2)); }function M(a) { a = a.points;for (var c = 0, d, b = 0; b < a.numberOfItems; b++) { var f = a.getItem(b);0 < b && (c += F(d, f));d = f; }return c; }function N(a) { if (a.getTotalLength) return a.getTotalLength();switch (a.tagName.toLowerCase()) {case "circle": return 2 * Math.PI * a.getAttribute("r");case "rect": return 2 * a.getAttribute("width") + 2 * a.getAttribute("height");case "line": return F({ x: a.getAttribute("x1"), y: a.getAttribute("y1") }, { x: a.getAttribute("x2"), y: a.getAttribute("y2") });case "polyline": return M(a);case "polygon": var c = a.points;return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0));} }function Y(a, c) { function d(b) { b = void 0 === b ? 0 : b;return a.el.getPointAtLength(1 <= c + b ? c + b : 0); }var b = d(), f = d(-1), n = d(1);switch (a.property) {case "x": return b.x;case "y": return b.y; case "angle": return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI;} }function O(a, c) { var d = /-?\d*\.?\d+/g, b;b = h.pth(a) ? a.totalLength : a;if (h.col(b)) { if (h.rgb(b)) { var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b = f ? "rgba(" + f[1] + ",1)" : b; } else b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0; } else f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f;b += "";return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [0], strings: h.str(a) || c ? b.split(d) : [] }; }function P(a) { a = a ? p(h.arr(a) ? a.map(m) : m(a)) : [];return r(a, function (a, d, b) { return b.indexOf(a) === d; }); }function Z(a) { var c = P(a);return c.map(function (a, b) { return { target: a, id: b, total: c.length }; }); }function aa(a, c) { var d = C(c);if (h.arr(a)) { var b = a.length;2 !== b || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a }; }return m(a).map(function (a, b) { b = b ? 0 : c.delay;a = h.obj(a) && !h.pth(a) ? a : { value: a };h.und(a.delay) && (a.delay = b);return a; }).map(function (a) { return z(a, d); }); }function ba(a, c) { var d = {}, b;for (b in a) { var f = I(a[b], c);h.arr(f) && (f = f.map(function (a) { return I(a, c); }), 1 === f.length && (f = f[0]));d[b] = f; }d.duration = parseFloat(d.duration);d.delay = parseFloat(d.delay);return d; }function ca(a) { return h.arr(a) ? A.apply(this, a) : Q[a]; }function da(a, c) { var d;return a.tweens.map(function (b) { b = ba(b, c);var f = b.value, e = K(c.target, a.name), k = d ? d.to.original : e, k = h.arr(f) ? f[0] : k, w = L(h.arr(f) ? f[1] : f, k), e = y(w) || y(k) || y(e);b.from = O(k, e);b.to = O(w, e);b.start = d ? d.end : a.offset;b.end = b.start + b.delay + b.duration;b.easing = ca(b.easing);b.elasticity = (1E3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1E3;b.isPath = h.pth(f);b.isColor = h.col(b.from.original);b.isColor && (b.round = 1);return d = b; }); }function ea(a, c) { return r(p(a.map(function (a) { return c.map(function (b) { var c = J(a.target, b.name);if (c) { var d = da(b, a);b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay }; } else b = void 0;return b; }); })), function (a) { return !h.und(a); }); }function R(a, c, d, b) { var f = "delay" === a;return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function (b) { return b[a]; })) : f ? b.delay : d.offset + b.delay + b.duration; }function fa(a) { var c = D(ga, a), d = D(S, a), b = Z(a.targets), f = [], e = z(c, d), k;for (k in a) { e.hasOwnProperty(k) || "targets" === k || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) }); }a = ea(b, f);return z(c, { children: [], animatables: b, animations: a, duration: R("duration", a, c, d), delay: R("delay", a, c, d) }); }function q(a) { function c() { return window.Promise && new Promise(function (a) { return p = a; }); }function d(a) { return g.reversed ? g.duration - a : a; }function b(a) { for (var b = 0, c = {}, d = g.animations, f = d.length; b < f;) { var e = d[b], k = e.animatable, h