Members-Manager/media/uikit-v3/js/uikit.js

11842 lines
324 KiB
JavaScript

/*! UIkit 3.0.0-rc.16 | http://www.getuikit.com | (c) 2014 - 2018 YOOtheme | MIT License */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define('uikit', factory) :
(global.UIkit = factory());
}(this, (function () { 'use strict';
function bind(fn, context) {
return function (a) {
var l = arguments.length;
return l ? l > 1 ? fn.apply(context, arguments) : fn.call(context, a) : fn.call(context);
};
}
var objPrototype = Object.prototype;
var hasOwnProperty = objPrototype.hasOwnProperty;
function hasOwn(obj, key) {
return hasOwnProperty.call(obj, key);
}
var hyphenateCache = {};
var hyphenateRe = /([a-z\d])([A-Z])/g;
function hyphenate(str) {
if (!(str in hyphenateCache)) {
hyphenateCache[str] = str
.replace(hyphenateRe, '$1-$2')
.toLowerCase();
}
return hyphenateCache[str];
}
var camelizeRe = /-(\w)/g;
function camelize(str) {
return str.replace(camelizeRe, toUpper);
}
function toUpper(_, c) {
return c ? c.toUpperCase() : '';
}
function ucfirst(str) {
return str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : '';
}
var strPrototype = String.prototype;
var startsWithFn = strPrototype.startsWith || function (search) { return this.lastIndexOf(search, 0) === 0; };
function startsWith(str, search) {
return startsWithFn.call(str, search);
}
var endsWithFn = strPrototype.endsWith || function (search) { return this.substr(-search.length) === search; };
function endsWith(str, search) {
return endsWithFn.call(str, search);
}
var includesFn = function (search) { return ~this.indexOf(search); };
var includesStr = strPrototype.includes || includesFn;
var includesArray = Array.prototype.includes || includesFn;
function includes(obj, search) {
return obj && (isString(obj) ? includesStr : includesArray).call(obj, search);
}
var isArray = Array.isArray;
function isFunction(obj) {
return typeof obj === 'function';
}
function isObject(obj) {
return obj !== null && typeof obj === 'object';
}
function isPlainObject(obj) {
return isObject(obj) && Object.getPrototypeOf(obj) === objPrototype;
}
function isWindow(obj) {
return isObject(obj) && obj === obj.window;
}
function isDocument(obj) {
return isObject(obj) && obj.nodeType === 9;
}
function isJQuery(obj) {
return isObject(obj) && !!obj.jquery;
}
function isNode(obj) {
return obj instanceof Node || isObject(obj) && obj.nodeType >= 1;
}
var toString = objPrototype.toString;
function isNodeCollection(obj) {
return toString.call(obj).match(/^\[object (NodeList|HTMLCollection)\]$/);
}
function isBoolean(value) {
return typeof value === 'boolean';
}
function isString(value) {
return typeof value === 'string';
}
function isNumber(value) {
return typeof value === 'number';
}
function isNumeric(value) {
return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
}
function isUndefined(value) {
return value === void 0;
}
function toBoolean(value) {
return isBoolean(value)
? value
: value === 'true' || value === '1' || value === ''
? true
: value === 'false' || value === '0'
? false
: value;
}
function toNumber(value) {
var number = Number(value);
return !isNaN(number) ? number : false;
}
function toFloat(value) {
return parseFloat(value) || 0;
}
function toNode(element) {
return isNode(element) || isWindow(element) || isDocument(element)
? element
: isNodeCollection(element) || isJQuery(element)
? element[0]
: isArray(element)
? toNode(element[0])
: null;
}
var arrayProto = Array.prototype;
function toNodes(element) {
return isNode(element)
? [element]
: isNodeCollection(element)
? arrayProto.slice.call(element)
: isArray(element)
? element.map(toNode).filter(Boolean)
: isJQuery(element)
? element.toArray()
: [];
}
function toList(value) {
return isArray(value)
? value
: isString(value)
? value.split(/,(?![^(]*\))/).map(function (value) { return isNumeric(value)
? toNumber(value)
: toBoolean(value.trim()); })
: [value];
}
function toMs(time) {
return !time
? 0
: endsWith(time, 'ms')
? toFloat(time)
: toFloat(time) * 1000;
}
function swap(value, a, b) {
return value.replace(new RegExp((a + "|" + b), 'mg'), function (match) {
return match === a ? b : a;
});
}
var assign = Object.assign || function (target) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
target = Object(target);
for (var i = 0; i < args.length; i++) {
var source = args[i];
if (source !== null) {
for (var key in source) {
if (hasOwn(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
};
function each(obj, cb) {
for (var key in obj) {
cb.call(obj[key], obj[key], key);
}
}
function sortBy(collection, prop) {
return collection.sort(function (a, b) { return a[prop] > b[prop]
? 1
: b[prop] > a[prop]
? -1
: 0; }
);
}
function clamp(number, min, max) {
if ( min === void 0 ) min = 0;
if ( max === void 0 ) max = 1;
return Math.min(Math.max(number, min), max);
}
function noop() {}
function intersectRect(r1, r2) {
return r1.left < r2.right &&
r1.right > r2.left &&
r1.top < r2.bottom &&
r1.bottom > r2.top;
}
function pointInRect(point, rect) {
return point.x <= rect.right &&
point.x >= rect.left &&
point.y <= rect.bottom &&
point.y >= rect.top;
}
var Dimensions = {
ratio: function(dimensions, prop, value) {
var obj;
var aProp = prop === 'width' ? 'height' : 'width';
return ( obj = {}, obj[aProp] = dimensions[prop] ? Math.round(value * dimensions[aProp] / dimensions[prop]) : dimensions[aProp], obj[prop] = value, obj );
},
contain: function(dimensions, maxDimensions) {
var this$1 = this;
dimensions = assign({}, dimensions);
each(dimensions, function (_, prop) { return dimensions = dimensions[prop] > maxDimensions[prop]
? this$1.ratio(dimensions, prop, maxDimensions[prop])
: dimensions; }
);
return dimensions;
},
cover: function(dimensions, maxDimensions) {
var this$1 = this;
dimensions = this.contain(dimensions, maxDimensions);
each(dimensions, function (_, prop) { return dimensions = dimensions[prop] < maxDimensions[prop]
? this$1.ratio(dimensions, prop, maxDimensions[prop])
: dimensions; }
);
return dimensions;
}
};
function attr(element, name, value) {
if (isObject(name)) {
for (var key in name) {
attr(element, key, name[key]);
}
return;
}
if (isUndefined(value)) {
element = toNode(element);
return element && element.getAttribute(name);
} else {
toNodes(element).forEach(function (element) {
if (isFunction(value)) {
value = value.call(element, attr(element, name));
}
if (value === null) {
removeAttr(element, name);
} else {
element.setAttribute(name, value);
}
});
}
}
function hasAttr(element, name) {
return toNodes(element).some(function (element) { return element.hasAttribute(name); });
}
function removeAttr(element, name) {
element = toNodes(element);
name.split(' ').forEach(function (name) { return element.forEach(function (element) { return element.removeAttribute(name); }
); }
);
}
function data(element, attribute) {
for (var i = 0, attrs = [attribute, ("data-" + attribute)]; i < attrs.length; i++) {
if (hasAttr(element, attrs[i])) {
return attr(element, attrs[i]);
}
}
}
function query(selector, context) {
return toNode(selector) || find(selector, getContext(selector, context));
}
function queryAll(selector, context) {
var nodes = toNodes(selector);
return nodes.length && nodes || findAll(selector, getContext(selector, context));
}
function getContext(selector, context) {
if ( context === void 0 ) context = document;
return isContextSelector(selector) || isDocument(context)
? context
: context.ownerDocument;
}
function find(selector, context) {
return toNode(_query(selector, context, 'querySelector'));
}
function findAll(selector, context) {
return toNodes(_query(selector, context, 'querySelectorAll'));
}
function _query(selector, context, queryFn) {
if ( context === void 0 ) context = document;
if (!selector || !isString(selector)) {
return null;
}
selector = selector.replace(contextSanitizeRe, '$1 *');
var removes;
if (isContextSelector(selector)) {
removes = [];
selector = selector.split(',').map(function (selector, i) {
var ctx = context;
selector = selector.trim();
if (selector[0] === '!') {
var selectors = selector.substr(1).trim().split(' ');
ctx = closest(context.parentNode, selectors[0]);
selector = selectors.slice(1).join(' ').trim();
}
if (selector[0] === '-') {
var selectors$1 = selector.substr(1).trim().split(' ');
var prev = (ctx || context).previousElementSibling;
ctx = matches(prev, selector.substr(1)) ? prev : null;
selector = selectors$1.slice(1).join(' ');
}
if (!ctx) {
return null;
}
if (!ctx.id) {
ctx.id = "uk-" + (Date.now()) + i;
removes.push(function () { return removeAttr(ctx, 'id'); });
}
return ("#" + (escape(ctx.id)) + " " + selector);
}).filter(Boolean).join(',');
context = document;
}
try {
return context[queryFn](selector);
} catch (e) {
return null;
} finally {
removes && removes.forEach(function (remove) { return remove(); });
}
}
var contextSelectorRe = /(^|,)\s*[!>+~-]/;
var contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
function isContextSelector(selector) {
return isString(selector) && selector.match(contextSelectorRe);
}
var elProto = Element.prototype;
var matchesFn = elProto.matches || elProto.webkitMatchesSelector || elProto.msMatchesSelector;
function matches(element, selector) {
return toNodes(element).some(function (element) { return matchesFn.call(element, selector); });
}
var closestFn = elProto.closest || function (selector) {
var ancestor = this;
do {
if (matches(ancestor, selector)) {
return ancestor;
}
ancestor = ancestor.parentNode;
} while (ancestor && ancestor.nodeType === 1);
};
function closest(element, selector) {
if (startsWith(selector, '>')) {
selector = selector.slice(1);
}
return isNode(element)
? element.parentNode && closestFn.call(element, selector)
: toNodes(element).map(function (element) { return element.parentNode && closestFn.call(element, selector); }).filter(Boolean);
}
function parents(element, selector) {
var elements = [];
var parent = toNode(element).parentNode;
while (parent && parent.nodeType === 1) {
if (matches(parent, selector)) {
elements.push(parent);
}
parent = parent.parentNode;
}
return elements;
}
var escapeFn = window.CSS && CSS.escape || function (css) { return css.replace(/([^\x7f-\uFFFF\w-])/g, function (match) { return ("\\" + match); }); };
function escape(css) {
return isString(css) ? escapeFn.call(null, css) : '';
}
var voidElements = {
area: true,
base: true,
br: true,
col: true,
embed: true,
hr: true,
img: true,
input: true,
keygen: true,
link: true,
menuitem: true,
meta: true,
param: true,
source: true,
track: true,
wbr: true
};
function isVoidElement(element) {
return toNodes(element).some(function (element) { return voidElements[element.tagName.toLowerCase()]; });
}
function isVisible(element) {
return toNodes(element).some(function (element) { return element.offsetWidth || element.offsetHeight || element.getClientRects().length; });
}
var selInput = 'input,select,textarea,button';
function isInput(element) {
return toNodes(element).some(function (element) { return matches(element, selInput); });
}
function filter(element, selector) {
return toNodes(element).filter(function (element) { return matches(element, selector); });
}
function within(element, selector) {
return !isString(selector)
? element === selector || (isDocument(selector)
? selector.documentElement
: toNode(selector)).contains(toNode(element)) // IE 11 document does not implement contains
: matches(element, selector) || closest(element, selector);
}
function on() {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var ref = getArgs(args);
var targets = ref[0];
var type = ref[1];
var selector = ref[2];
var listener = ref[3];
var useCapture = ref[4];
targets = toEventTargets(targets);
if (selector) {
listener = delegate(targets, selector, listener);
}
if (listener.length > 1) {
listener = detail(listener);
}
type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.addEventListener(type, listener, useCapture); }
); }
);
return function () { return off(targets, type, listener, useCapture); };
}
function off(targets, type, listener, useCapture) {
if ( useCapture === void 0 ) useCapture = false;
targets = toEventTargets(targets);
type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.removeEventListener(type, listener, useCapture); }
); }
);
}
function once() {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var ref = getArgs(args);
var element = ref[0];
var type = ref[1];
var selector = ref[2];
var listener = ref[3];
var useCapture = ref[4];
var condition = ref[5];
var off = on(element, type, selector, function (e) {
var result = !condition || condition(e);
if (result) {
off();
listener(e, result);
}
}, useCapture);
return off;
}
function trigger(targets, event, detail) {
return toEventTargets(targets).reduce(function (notCanceled, target) { return notCanceled && target.dispatchEvent(createEvent(event, true, true, detail)); }
, true);
}
function createEvent(e, bubbles, cancelable, detail) {
if ( bubbles === void 0 ) bubbles = true;
if ( cancelable === void 0 ) cancelable = false;
if (isString(e)) {
var event = document.createEvent('CustomEvent'); // IE 11
event.initCustomEvent(e, bubbles, cancelable, detail);
e = event;
}
return e;
}
function getArgs(args) {
if (isFunction(args[2])) {
args.splice(2, 0, false);
}
return args;
}
function delegate(delegates, selector, listener) {
var this$1 = this;
return function (e) {
delegates.forEach(function (delegate) {
var current = selector[0] === '>'
? findAll(selector, delegate).reverse().filter(function (element) { return within(e.target, element); })[0]
: closest(e.target, selector);
if (current) {
e.delegate = delegate;
e.current = current;
listener.call(this$1, e);
}
});
};
}
function detail(listener) {
return function (e) { return isArray(e.detail) ? listener.apply(void 0, [e].concat(e.detail)) : listener(e); };
}
function isEventTarget(target) {
return target && 'addEventListener' in target;
}
function toEventTarget(target) {
return isEventTarget(target) ? target : toNode(target);
}
function toEventTargets(target) {
return isArray(target)
? target.map(toEventTarget).filter(Boolean)
: isString(target)
? findAll(target)
: isEventTarget(target)
? [target]
: toNodes(target);
}
function preventClick() {
var timer = setTimeout(once(document, 'click', function (e) {
e.preventDefault();
e.stopImmediatePropagation();
clearTimeout(timer);
}, true));
trigger(document, 'touchcancel');
}
/* global setImmediate */
var Promise = 'Promise' in window ? window.Promise : PromiseFn;
var Deferred = function() {
var this$1 = this;
this.promise = new Promise(function (resolve, reject) {
this$1.reject = reject;
this$1.resolve = resolve;
});
};
/**
* Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
*/
var RESOLVED = 0;
var REJECTED = 1;
var PENDING = 2;
var async = 'setImmediate' in window ? setImmediate : setTimeout;
function PromiseFn(executor) {
this.state = PENDING;
this.value = undefined;
this.deferred = [];
var promise = this;
try {
executor(
function (x) {
promise.resolve(x);
},
function (r) {
promise.reject(r);
}
);
} catch (e) {
promise.reject(e);
}
}
PromiseFn.reject = function (r) {
return new PromiseFn(function (resolve, reject) {
reject(r);
});
};
PromiseFn.resolve = function (x) {
return new PromiseFn(function (resolve, reject) {
resolve(x);
});
};
PromiseFn.all = function all(iterable) {
return new PromiseFn(function (resolve, reject) {
var result = [];
var count = 0;
if (iterable.length === 0) {
resolve(result);
}
function resolver(i) {
return function (x) {
result[i] = x;
count += 1;
if (count === iterable.length) {
resolve(result);
}
};
}
for (var i = 0; i < iterable.length; i += 1) {
PromiseFn.resolve(iterable[i]).then(resolver(i), reject);
}
});
};
PromiseFn.race = function race(iterable) {
return new PromiseFn(function (resolve, reject) {
for (var i = 0; i < iterable.length; i += 1) {
PromiseFn.resolve(iterable[i]).then(resolve, reject);
}
});
};
var p = PromiseFn.prototype;
p.resolve = function resolve(x) {
var promise = this;
if (promise.state === PENDING) {
if (x === promise) {
throw new TypeError('Promise settled with itself.');
}
var called = false;
try {
var then = x && x.then;
if (x !== null && isObject(x) && isFunction(then)) {
then.call(
x,
function (x) {
if (!called) {
promise.resolve(x);
}
called = true;
},
function (r) {
if (!called) {
promise.reject(r);
}
called = true;
}
);
return;
}
} catch (e) {
if (!called) {
promise.reject(e);
}
return;
}
promise.state = RESOLVED;
promise.value = x;
promise.notify();
}
};
p.reject = function reject(reason) {
var promise = this;
if (promise.state === PENDING) {
if (reason === promise) {
throw new TypeError('Promise settled with itself.');
}
promise.state = REJECTED;
promise.value = reason;
promise.notify();
}
};
p.notify = function notify() {
var this$1 = this;
async(function () {
if (this$1.state !== PENDING) {
while (this$1.deferred.length) {
var ref = this$1.deferred.shift();
var onResolved = ref[0];
var onRejected = ref[1];
var resolve = ref[2];
var reject = ref[3];
try {
if (this$1.state === RESOLVED) {
if (isFunction(onResolved)) {
resolve(onResolved.call(undefined, this$1.value));
} else {
resolve(this$1.value);
}
} else if (this$1.state === REJECTED) {
if (isFunction(onRejected)) {
resolve(onRejected.call(undefined, this$1.value));
} else {
reject(this$1.value);
}
}
} catch (e) {
reject(e);
}
}
}
});
};
p.then = function then(onResolved, onRejected) {
var this$1 = this;
return new PromiseFn(function (resolve, reject) {
this$1.deferred.push([onResolved, onRejected, resolve, reject]);
this$1.notify();
});
};
p.catch = function (onRejected) {
return this.then(undefined, onRejected);
};
function ajax(url, options) {
return new Promise(function (resolve, reject) {
var env = assign({
data: null,
method: 'GET',
headers: {},
xhr: new XMLHttpRequest(),
beforeSend: noop,
responseType: ''
}, options);
env.beforeSend(env);
var xhr = env.xhr;
for (var prop in env) {
if (prop in xhr) {
try {
xhr[prop] = env[prop];
} catch (e) {}
}
}
xhr.open(env.method.toUpperCase(), url);
for (var header in env.headers) {
xhr.setRequestHeader(header, env.headers[header]);
}
on(xhr, 'load', function () {
if (xhr.status === 0 || xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
resolve(xhr);
} else {
reject(assign(Error(xhr.statusText), {
xhr: xhr,
status: xhr.status
}));
}
});
on(xhr, 'error', function () { return reject(assign(Error('Network Error'), {xhr: xhr})); });
on(xhr, 'timeout', function () { return reject(assign(Error('Network Timeout'), {xhr: xhr})); });
xhr.send(env.data);
});
}
function getImage(src, srcset, sizes) {
return new Promise(function (resolve, reject) {
var img = new Image();
img.onerror = reject;
img.onload = function () { return resolve(img); };
sizes && (img.sizes = sizes);
srcset && (img.srcset = srcset);
img.src = src;
});
}
function isReady() {
return document.readyState === 'complete' || document.readyState !== 'loading' && !document.documentElement.doScroll;
}
function ready(fn) {
if (isReady()) {
fn();
return;
}
var handle = function () {
unbind1();
unbind2();
fn();
};
var unbind1 = on(document, 'DOMContentLoaded', handle);
var unbind2 = on(window, 'load', handle);
}
function index(element, ref) {
return ref
? toNodes(element).indexOf(toNode(ref))
: toNodes((element = toNode(element)) && element.parentNode.children).indexOf(element);
}
function getIndex(i, elements, current, finite) {
if ( current === void 0 ) current = 0;
if ( finite === void 0 ) finite = false;
elements = toNodes(elements);
var length = elements.length;
i = isNumeric(i)
? toNumber(i)
: i === 'next'
? current + 1
: i === 'previous'
? current - 1
: index(elements, i);
if (finite) {
return clamp(i, 0, length - 1);
}
i %= length;
return i < 0 ? i + length : i;
}
function empty(element) {
element = toNode(element);
element.innerHTML = '';
return element;
}
function html(parent, html) {
parent = toNode(parent);
return isUndefined(html)
? parent.innerHTML
: append(parent.hasChildNodes() ? empty(parent) : parent, html);
}
function prepend(parent, element) {
parent = toNode(parent);
if (!parent.hasChildNodes()) {
return append(parent, element);
} else {
return insertNodes(element, function (element) { return parent.insertBefore(element, parent.firstChild); });
}
}
function append(parent, element) {
parent = toNode(parent);
return insertNodes(element, function (element) { return parent.appendChild(element); });
}
function before(ref, element) {
ref = toNode(ref);
return insertNodes(element, function (element) { return ref.parentNode.insertBefore(element, ref); });
}
function after(ref, element) {
ref = toNode(ref);
return insertNodes(element, function (element) { return ref.nextSibling
? before(ref.nextSibling, element)
: append(ref.parentNode, element); }
);
}
function insertNodes(element, fn) {
element = isString(element) ? fragment(element) : element;
return element
? 'length' in element
? toNodes(element).map(fn)
: fn(element)
: null;
}
function remove(element) {
toNodes(element).map(function (element) { return element.parentNode && element.parentNode.removeChild(element); });
}
function wrapAll(element, structure) {
structure = toNode(before(element, structure));
while (structure.firstChild) {
structure = structure.firstChild;
}
append(structure, element);
return structure;
}
function wrapInner(element, structure) {
return toNodes(toNodes(element).map(function (element) { return element.hasChildNodes ? wrapAll(toNodes(element.childNodes), structure) : append(element, structure); }
));
}
function unwrap(element) {
toNodes(element)
.map(function (element) { return element.parentNode; })
.filter(function (value, index, self) { return self.indexOf(value) === index; })
.forEach(function (parent) {
before(parent, parent.childNodes);
remove(parent);
});
}
var fragmentRe = /^\s*<(\w+|!)[^>]*>/;
var singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
function fragment(html) {
var matches = singleTagRe.exec(html);
if (matches) {
return document.createElement(matches[1]);
}
var container = document.createElement('div');
if (fragmentRe.test(html)) {
container.insertAdjacentHTML('beforeend', html.trim());
} else {
container.textContent = html;
}
return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild;
}
function apply(node, fn) {
if (!node || node.nodeType !== 1) {
return;
}
fn(node);
node = node.firstElementChild;
while (node) {
apply(node, fn);
node = node.nextElementSibling;
}
}
function addClass(element) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
apply$1(element, args, 'add');
}
function removeClass(element) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
apply$1(element, args, 'remove');
}
function removeClasses(element, cls) {
attr(element, 'class', function (value) { return (value || '').replace(new RegExp(("\\b" + cls + "\\b"), 'g'), ''); });
}
function replaceClass(element) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
args[0] && removeClass(element, args[0]);
args[1] && addClass(element, args[1]);
}
function hasClass(element, cls) {
return toNodes(element).some(function (element) { return element.classList.contains(cls); });
}
function toggleClass(element) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
if (!args.length) {
return;
}
args = getArgs$1(args);
var force = !isString(args[args.length - 1]) ? args.pop() : []; // in iOS 9.3 force === undefined evaluates to false
args = args.filter(Boolean);
toNodes(element).forEach(function (ref) {
var classList = ref.classList;
for (var i = 0; i < args.length; i++) {
supports.Force
? classList.toggle.apply(classList, [args[i]].concat(force))
: (classList[(!isUndefined(force) ? force : !classList.contains(args[i])) ? 'add' : 'remove'](args[i]));
}
});
}
function apply$1(element, args, fn) {
args = getArgs$1(args).filter(Boolean);
args.length && toNodes(element).forEach(function (ref) {
var classList = ref.classList;
supports.Multiple
? classList[fn].apply(classList, args)
: args.forEach(function (cls) { return classList[fn](cls); });
});
}
function getArgs$1(args) {
return args.reduce(function (args, arg) { return args.concat.call(args, isString(arg) && includes(arg, ' ') ? arg.trim().split(' ') : arg); }
, []);
}
var supports = {};
// IE 11
(function () {
var list = document.createElement('_').classList;
if (list) {
list.add('a', 'b');
list.toggle('c', false);
supports.Multiple = list.contains('b');
supports.Force = !list.contains('c');
}
list = null;
})();
var cssNumber = {
'animation-iteration-count': true,
'column-count': true,
'fill-opacity': true,
'flex-grow': true,
'flex-shrink': true,
'font-weight': true,
'line-height': true,
'opacity': true,
'order': true,
'orphans': true,
'widows': true,
'z-index': true,
'zoom': true
};
function css(element, property, value) {
return toNodes(element).map(function (element) {
if (isString(property)) {
property = propName(property);
if (isUndefined(value)) {
return getStyle(element, property);
} else if (!value && value !== 0) {
element.style.removeProperty(property);
} else {
element.style[property] = isNumeric(value) && !cssNumber[property] ? (value + "px") : value;
}
} else if (isArray(property)) {
var styles = getStyles(element);
return property.reduce(function (props, property) {
props[property] = styles[propName(property)];
return props;
}, {});
} else if (isObject(property)) {
each(property, function (value, property) { return css(element, property, value); });
}
return element;
})[0];
}
function getStyles(element, pseudoElt) {
element = toNode(element);
return element.ownerDocument.defaultView.getComputedStyle(element, pseudoElt);
}
function getStyle(element, property, pseudoElt) {
return getStyles(element, pseudoElt)[property];
}
var vars = {};
function getCssVar(name) {
if (!(name in vars)) {
/* usage in css: .var-name:before { content:"xyz" } */
var element = append(document.documentElement, document.createElement('div'));
addClass(element, ("var-" + name));
try {
vars[name] = getStyle(element, 'content', ':before').replace(/^["'](.*)["']$/, '$1');
vars[name] = JSON.parse(vars[name]);
} catch (e) {}
document.documentElement.removeChild(element);
}
return vars[name];
}
var cssProps = {};
function propName(name) {
var ret = cssProps[name];
if (!ret) {
ret = cssProps[name] = vendorPropName(name) || name;
}
return ret;
}
var cssPrefixes = ['webkit', 'moz', 'ms'];
var ref = document.createElement('_');
var style = ref.style;
function vendorPropName(name) {
name = hyphenate(name);
if (name in style) {
return name;
}
var i = cssPrefixes.length, prefixedName;
while (i--) {
prefixedName = "-" + (cssPrefixes[i]) + "-" + name;
if (prefixedName in style) {
return prefixedName;
}
}
}
function transition(element, props, duration, timing) {
if ( duration === void 0 ) duration = 400;
if ( timing === void 0 ) timing = 'linear';
return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) {
for (var name in props) {
var value = css(element, name);
if (value === '') {
css(element, name, value);
}
}
var timer = setTimeout(function () { return trigger(element, 'transitionend'); }, duration);
once(element, 'transitionend transitioncanceled', function (ref) {
var type = ref.type;
clearTimeout(timer);
removeClass(element, 'uk-transition');
css(element, {
'transition-property': '',
'transition-duration': '',
'transition-timing-function': ''
});
type === 'transitioncanceled' ? reject() : resolve();
}, false, function (ref) {
var target = ref.target;
return element === target;
});
addClass(element, 'uk-transition');
css(element, assign({
'transition-property': Object.keys(props).map(propName).join(','),
'transition-duration': (duration + "ms"),
'transition-timing-function': timing
}, props));
}); }
));
}
var Transition = {
start: transition,
stop: function(element) {
trigger(element, 'transitionend');
return Promise.resolve();
},
cancel: function(element) {
trigger(element, 'transitioncanceled');
},
inProgress: function(element) {
return hasClass(element, 'uk-transition');
}
};
var animationPrefix = 'uk-animation-';
var clsCancelAnimation = 'uk-cancel-animation';
function animate(element, animation, duration, origin, out) {
var arguments$1 = arguments;
if ( duration === void 0 ) duration = 200;
return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) {
if (hasClass(element, clsCancelAnimation)) {
requestAnimationFrame(function () { return Promise.resolve().then(function () { return animate.apply(void 0, arguments$1).then(resolve, reject); }
); }
);
return;
}
var cls = animation + " " + animationPrefix + (out ? 'leave' : 'enter');
if (startsWith(animation, animationPrefix)) {
if (origin) {
cls += " uk-transform-origin-" + origin;
}
if (out) {
cls += " " + animationPrefix + "reverse";
}
}
reset();
once(element, 'animationend animationcancel', function (ref) {
var type = ref.type;
var hasReset = false;
if (type === 'animationcancel') {
reject();
reset();
} else {
resolve();
Promise.resolve().then(function () {
hasReset = true;
reset();
});
}
requestAnimationFrame(function () {
if (!hasReset) {
addClass(element, clsCancelAnimation);
requestAnimationFrame(function () { return removeClass(element, clsCancelAnimation); });
}
});
}, false, function (ref) {
var target = ref.target;
return element === target;
});
css(element, 'animationDuration', (duration + "ms"));
addClass(element, cls);
function reset() {
css(element, 'animationDuration', '');
removeClasses(element, (animationPrefix + "\\S*"));
}
}); }
));
}
var inProgress = new RegExp((animationPrefix + "(enter|leave)"));
var Animation = {
in: function(element, animation, duration, origin) {
return animate(element, animation, duration, origin, false);
},
out: function(element, animation, duration, origin) {
return animate(element, animation, duration, origin, true);
},
inProgress: function(element) {
return inProgress.test(attr(element, 'class'));
},
cancel: function(element) {
trigger(element, 'animationcancel');
}
};
function $(selector, context) {
return !isString(selector)
? toNode(selector)
: isHtml(selector)
? toNode(fragment(selector))
: find(selector, context);
}
function $$(selector, context) {
return !isString(selector)
? toNodes(selector)
: isHtml(selector)
? toNodes(fragment(selector))
: findAll(selector, context);
}
function isHtml(str) {
return str[0] === '<' || str.match(/^\s*</);
}
var dirs = {
width: ['x', 'left', 'right'],
height: ['y', 'top', 'bottom']
};
function positionAt(element, target, elAttach, targetAttach, elOffset, targetOffset, flip, boundary) {
elAttach = getPos(elAttach);
targetAttach = getPos(targetAttach);
var flipped = {element: elAttach, target: targetAttach};
if (!element || !target) {
return flipped;
}
var dim = getDimensions(element);
var targetDim = getDimensions(target);
var position = targetDim;
moveTo(position, elAttach, dim, -1);
moveTo(position, targetAttach, targetDim, 1);
elOffset = getOffsets(elOffset, dim.width, dim.height);
targetOffset = getOffsets(targetOffset, targetDim.width, targetDim.height);
elOffset['x'] += targetOffset['x'];
elOffset['y'] += targetOffset['y'];
position.left += elOffset['x'];
position.top += elOffset['y'];
boundary = getDimensions(boundary || window$1(element));
if (flip) {
each(dirs, function (ref, prop) {
var dir = ref[0];
var align = ref[1];
var alignFlip = ref[2];
if (!(flip === true || includes(flip, dir))) {
return;
}
var elemOffset = elAttach[dir] === align
? -dim[prop]
: elAttach[dir] === alignFlip
? dim[prop]
: 0;
var targetOffset = targetAttach[dir] === align
? targetDim[prop]
: targetAttach[dir] === alignFlip
? -targetDim[prop]
: 0;
if (position[align] < boundary[align] || position[align] + dim[prop] > boundary[alignFlip]) {
var centerOffset = dim[prop] / 2;
var centerTargetOffset = targetAttach[dir] === 'center' ? -targetDim[prop] / 2 : 0;
elAttach[dir] === 'center' && (
apply(centerOffset, centerTargetOffset)
|| apply(-centerOffset, -centerTargetOffset)
) || apply(elemOffset, targetOffset);
}
function apply(elemOffset, targetOffset) {
var newVal = position[align] + elemOffset + targetOffset - elOffset[dir] * 2;
if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) {
position[align] = newVal;
['element', 'target'].forEach(function (el) {
flipped[el][dir] = !elemOffset
? flipped[el][dir]
: flipped[el][dir] === dirs[prop][1]
? dirs[prop][2]
: dirs[prop][1];
});
return true;
}
}
});
}
offset(element, position);
return flipped;
}
function offset(element, coordinates) {
element = toNode(element);
if (coordinates) {
var currentOffset = offset(element);
var pos = css(element, 'position');
['left', 'top'].forEach(function (prop) {
if (prop in coordinates) {
var value = css(element, prop);
css(element, prop, coordinates[prop] - currentOffset[prop]
+ toFloat(pos === 'absolute' && value === 'auto'
? position(element)[prop]
: value)
);
}
});
return;
}
return getDimensions(element);
}
function getDimensions(element) {
element = toNode(element);
var ref = window$1(element);
var top = ref.pageYOffset;
var left = ref.pageXOffset;
if (isWindow(element)) {
var height = element.innerHeight;
var width = element.innerWidth;
return {
top: top,
left: left,
height: height,
width: width,
bottom: top + height,
right: left + width,
};
}
var style, hidden;
if (!isVisible(element)) {
style = attr(element, 'style');
hidden = attr(element, 'hidden');
attr(element, {
style: ((style || '') + ";display:block !important;"),
hidden: null
});
}
var rect = element.getBoundingClientRect();
if (!isUndefined(style)) {
attr(element, {style: style, hidden: hidden});
}
return {
height: rect.height,
width: rect.width,
top: rect.top + top,
left: rect.left + left,
bottom: rect.bottom + top,
right: rect.right + left,
};
}
function position(element) {
element = toNode(element);
var parent = element.offsetParent || docEl(element);
var parentOffset = offset(parent);
var ref = ['top', 'left'].reduce(function (props, prop) {
var propName$$1 = ucfirst(prop);
props[prop] -= parentOffset[prop]
+ toFloat(css(element, ("margin" + propName$$1)))
+ toFloat(css(parent, ("border" + propName$$1 + "Width")));
return props;
}, offset(element));
var top = ref.top;
var left = ref.left;
return {top: top, left: left};
}
var height = dimension('height');
var width = dimension('width');
function dimension(prop) {
var propName$$1 = ucfirst(prop);
return function (element, value) {
element = toNode(element);
if (isUndefined(value)) {
if (isWindow(element)) {
return element[("inner" + propName$$1)];
}
if (isDocument(element)) {
var doc = element.documentElement;
return Math.max(doc[("offset" + propName$$1)], doc[("scroll" + propName$$1)]);
}
value = css(element, prop);
value = value === 'auto' ? element[("offset" + propName$$1)] : toFloat(value) || 0;
return value - boxModelAdjust(prop, element);
} else {
css(element, prop, !value && value !== 0
? ''
: +value + boxModelAdjust(prop, element) + 'px'
);
}
};
}
function boxModelAdjust(prop, element) {
return css(element, 'boxSizing') === 'border-box'
? dirs[prop].slice(1).map(ucfirst).reduce(function (value, prop) { return value
+ toFloat(css(element, ("padding" + prop)))
+ toFloat(css(element, ("border" + prop + "Width"))); }
, 0)
: 0;
}
function moveTo(position, attach, dim, factor) {
each(dirs, function (ref, prop) {
var dir = ref[0];
var align = ref[1];
var alignFlip = ref[2];
if (attach[dir] === alignFlip) {
position[align] += dim[prop] * factor;
} else if (attach[dir] === 'center') {
position[align] += dim[prop] * factor / 2;
}
});
}
function getPos(pos) {
var x = /left|center|right/;
var y = /top|center|bottom/;
pos = (pos || '').split(' ');
if (pos.length === 1) {
pos = x.test(pos[0])
? pos.concat(['center'])
: y.test(pos[0])
? ['center'].concat(pos)
: ['center', 'center'];
}
return {
x: x.test(pos[0]) ? pos[0] : 'center',
y: y.test(pos[1]) ? pos[1] : 'center'
};
}
function getOffsets(offsets, width, height) {
var ref = (offsets || '').split(' ');
var x = ref[0];
var y = ref[1];
return {
x: x ? toFloat(x) * (endsWith(x, '%') ? width / 100 : 1) : 0,
y: y ? toFloat(y) * (endsWith(y, '%') ? height / 100 : 1) : 0
};
}
function flipPosition(pos) {
switch (pos) {
case 'left':
return 'right';
case 'right':
return 'left';
case 'top':
return 'bottom';
case 'bottom':
return 'top';
default:
return pos;
}
}
function isInView(element, topOffset, leftOffset, relativeToViewport) {
if ( topOffset === void 0 ) topOffset = 0;
if ( leftOffset === void 0 ) leftOffset = 0;
if (!isVisible(element)) {
return false;
}
element = toNode(element);
var win = window$1(element);
var client, bounding;
if (relativeToViewport) {
client = element.getBoundingClientRect();
bounding = {
top: -topOffset,
left: -leftOffset,
bottom: topOffset + height(win),
right: leftOffset + width(win)
};
} else {
var ref = offsetPosition(element);
var elTop = ref[0];
var elLeft = ref[1];
var top = win.pageYOffset;
var left = win.pageXOffset;
client = {
top: elTop,
left: elLeft,
bottom: elTop + element.offsetHeight,
right: elTop + element.offsetWidth
};
bounding = {
top: top - topOffset,
left: left - leftOffset,
bottom: top + topOffset + height(win),
right: left + leftOffset + width(win)
};
}
return intersectRect(client, bounding) || pointInRect({x: client.left, y: client.top}, bounding);
}
function scrolledOver(element, heightOffset) {
if ( heightOffset === void 0 ) heightOffset = 0;
if (!isVisible(element)) {
return 0;
}
element = toNode(element);
var win = window$1(element);
var doc = document$1(element);
var elHeight = element.offsetHeight + heightOffset;
var ref = offsetPosition(element);
var top = ref[0];
var vp = height(win);
var vh = vp + Math.min(0, top - vp);
var diff = Math.max(0, vp - (height(doc) + heightOffset - (top + elHeight)));
return clamp(((vh + win.pageYOffset - top) / ((vh + (elHeight - (diff < vp ? diff : 0))) / 100)) / 100);
}
function scrollTop(element, top) {
element = toNode(element);
if (isWindow(element) || isDocument(element)) {
var ref = window$1(element);
var scrollTo = ref.scrollTo;
var pageXOffset = ref.pageXOffset;
scrollTo(pageXOffset, top);
} else {
element.scrollTop = top;
}
}
function offsetPosition(element) {
var offset = [0, 0];
do {
offset[0] += element.offsetTop;
offset[1] += element.offsetLeft;
if (css(element, 'position') === 'fixed') {
var win = window$1(element);
offset[0] += win.pageYOffset;
offset[1] += win.pageXOffset;
return offset;
}
} while ((element = element.offsetParent));
return offset;
}
function window$1(element) {
return isWindow(element) ? element : document$1(element).defaultView;
}
function document$1(element) {
return toNode(element).ownerDocument;
}
function docEl(element) {
return document$1(element).documentElement;
}
/* global DocumentTouch */
var isIE = /msie|trident/i.test(window.navigator.userAgent);
var isRtl = attr(document.documentElement, 'dir') === 'rtl';
var hasTouchEvents = 'ontouchstart' in window;
var hasPointerEvents = window.PointerEvent;
var hasTouch = hasTouchEvents
|| window.DocumentTouch && document instanceof DocumentTouch
|| navigator.maxTouchPoints; // IE >=11
var pointerDown = !hasTouch ? 'mousedown' : ("mousedown " + (hasTouchEvents ? 'touchstart' : 'pointerdown'));
var pointerMove = !hasTouch ? 'mousemove' : ("mousemove " + (hasTouchEvents ? 'touchmove' : 'pointermove'));
var pointerUp = !hasTouch ? 'mouseup' : ("mouseup " + (hasTouchEvents ? 'touchend' : 'pointerup'));
var pointerEnter = hasTouch && hasPointerEvents ? 'pointerenter' : 'mouseenter';
var pointerLeave = hasTouch && hasPointerEvents ? 'pointerleave' : 'mouseleave';
/*
Based on:
Copyright (c) 2016 Wilson Page wilsonpage@me.com
https://github.com/wilsonpage/fastdom
*/
var fastdom = {
reads: [],
writes: [],
read: function(task) {
this.reads.push(task);
scheduleFlush();
return task;
},
write: function(task) {
this.writes.push(task);
scheduleFlush();
return task;
},
clear: function(task) {
return remove$1(this.reads, task) || remove$1(this.writes, task);
},
flush: function() {
runTasks(this.reads);
runTasks(this.writes.splice(0, this.writes.length));
this.scheduled = false;
if (this.reads.length || this.writes.length) {
scheduleFlush();
}
}
};
function scheduleFlush() {
if (!fastdom.scheduled) {
fastdom.scheduled = true;
requestAnimationFrame(fastdom.flush.bind(fastdom));
}
}
function runTasks(tasks) {
var task;
while ((task = tasks.shift())) {
task();
}
}
function remove$1(array, item) {
var index = array.indexOf(item);
return !!~index && !!array.splice(index, 1);
}
function MouseTracker() {}
MouseTracker.prototype = {
positions: [],
position: null,
init: function() {
var this$1 = this;
this.positions = [];
this.position = null;
var ticking = false;
this.unbind = on(document, 'mousemove', function (e) {
if (ticking) {
return;
}
setTimeout(function () {
var time = Date.now();
var ref = this$1.positions;
var length = ref.length;
if (length && (time - this$1.positions[length - 1].time > 100)) {
this$1.positions.splice(0, length);
}
this$1.positions.push({time: time, x: e.pageX, y: e.pageY});
if (this$1.positions.length > 5) {
this$1.positions.shift();
}
ticking = false;
}, 5);
ticking = true;
});
},
cancel: function() {
if (this.unbind) {
this.unbind();
}
},
movesTo: function(target) {
if (this.positions.length < 2) {
return false;
}
var p = offset(target);
var position$$1 = this.positions[this.positions.length - 1];
var ref = this.positions;
var prevPos = ref[0];
if (p.left <= position$$1.x && position$$1.x <= p.right && p.top <= position$$1.y && position$$1.y <= p.bottom) {
return false;
}
var points = [
[{x: p.left, y: p.top}, {x: p.right, y: p.bottom}],
[{x: p.right, y: p.top}, {x: p.left, y: p.bottom}]
];
if (p.right <= position$$1.x) ; else if (p.left >= position$$1.x) {
points[0].reverse();
points[1].reverse();
} else if (p.bottom <= position$$1.y) {
points[0].reverse();
} else if (p.top >= position$$1.y) {
points[1].reverse();
}
return !!points.reduce(function (result, point) {
return result + (slope(prevPos, point[0]) < slope(position$$1, point[0]) && slope(prevPos, point[1]) > slope(position$$1, point[1]));
}, 0);
}
};
function slope(a, b) {
return (b.y - a.y) / (b.x - a.x);
}
var strats = {};
// concat strategy
strats.args =
strats.events =
strats.init =
strats.created =
strats.beforeConnect =
strats.connected =
strats.ready =
strats.beforeDisconnect =
strats.disconnected =
strats.destroy = function (parentVal, childVal) {
parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal;
return childVal
? parentVal
? parentVal.concat(childVal)
: isArray(childVal)
? childVal
: [childVal]
: parentVal;
};
// update strategy
strats.update = function (parentVal, childVal) {
return strats.args(parentVal, isFunction(childVal) ? {read: childVal} : childVal);
};
// property strategy
strats.props = function (parentVal, childVal) {
if (isArray(childVal)) {
childVal = childVal.reduce(function (value, key) {
value[key] = String;
return value;
}, {});
}
return strats.methods(parentVal, childVal);
};
// extend strategy
strats.computed =
strats.methods = function (parentVal, childVal) {
return childVal
? parentVal
? assign({}, parentVal, childVal)
: childVal
: parentVal;
};
// data strategy
strats.data = function (parentVal, childVal, vm) {
if (!vm) {
if (!childVal) {
return parentVal;
}
if (!parentVal) {
return childVal;
}
return function (vm) {
return mergeFnData(parentVal, childVal, vm);
};
}
return mergeFnData(parentVal, childVal, vm);
};
function mergeFnData(parentVal, childVal, vm) {
return strats.computed(
isFunction(parentVal)
? parentVal.call(vm, vm)
: parentVal,
isFunction(childVal)
? childVal.call(vm, vm)
: childVal
);
}
// default strategy
var defaultStrat = function (parentVal, childVal) {
return isUndefined(childVal) ? parentVal : childVal;
};
function mergeOptions(parent, child, vm) {
var options = {};
if (isFunction(child)) {
child = child.options;
}
if (child.extends) {
parent = mergeOptions(parent, child.extends, vm);
}
if (child.mixins) {
for (var i = 0, l = child.mixins.length; i < l; i++) {
parent = mergeOptions(parent, child.mixins[i], vm);
}
}
for (var key in parent) {
mergeKey(key);
}
for (var key$1 in child) {
if (!hasOwn(parent, key$1)) {
mergeKey(key$1);
}
}
function mergeKey(key) {
options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm);
}
return options;
}
function parseOptions(options, args) {
var obj;
if ( args === void 0 ) args = [];
try {
return !options
? {}
: startsWith(options, '{')
? JSON.parse(options)
: args.length && !includes(options, ':')
? (( obj = {}, obj[args[0]] = options, obj ))
: options.split(';').reduce(function (options, option) {
var ref = option.split(/:(.*)/);
var key = ref[0];
var value = ref[1];
if (key && !isUndefined(value)) {
options[key.trim()] = value.trim();
}
return options;
}, {});
} catch (e) {
return {};
}
}
var id = 0;
var Player = function(el) {
this.id = ++id;
this.el = toNode(el);
};
Player.prototype.isVideo = function () {
return this.isYoutube() || this.isVimeo() || this.isHTML5();
};
Player.prototype.isHTML5 = function () {
return this.el.tagName === 'VIDEO';
};
Player.prototype.isIFrame = function () {
return this.el.tagName === 'IFRAME';
};
Player.prototype.isYoutube = function () {
return this.isIFrame() && !!this.el.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/);
};
Player.prototype.isVimeo = function () {
return this.isIFrame() && !!this.el.src.match(/vimeo\.com\/video\/.*/);
};
Player.prototype.enableApi = function () {
var this$1 = this;
if (this.ready) {
return this.ready;
}
var youtube = this.isYoutube();
var vimeo = this.isVimeo();
var poller;
if (youtube || vimeo) {
return this.ready = new Promise(function (resolve) {
once(this$1.el, 'load', function () {
if (youtube) {
var listener = function () { return post(this$1.el, {event: 'listening', id: this$1.id}); };
poller = setInterval(listener, 100);
listener();
}
});
listen(function (data$$1) { return youtube && data$$1.id === this$1.id && data$$1.event === 'onReady' || vimeo && Number(data$$1.player_id) === this$1.id; })
.then(function () {
resolve();
poller && clearInterval(poller);
});
attr(this$1.el, 'src', ("" + (this$1.el.src) + (includes(this$1.el.src, '?') ? '&' : '?') + (youtube ? 'enablejsapi=1' : ("api=1&player_id=" + (this$1.id)))));
});
}
return Promise.resolve();
};
Player.prototype.play = function () {
var this$1 = this;
if (!this.isVideo()) {
return;
}
if (this.isIFrame()) {
this.enableApi().then(function () { return post(this$1.el, {func: 'playVideo', method: 'play'}); });
} else if (this.isHTML5()) {
try {
var promise = this.el.play();
if (promise) {
promise.catch(noop);
}
} catch (e) {}
}
};
Player.prototype.pause = function () {
var this$1 = this;
if (!this.isVideo()) {
return;
}
if (this.isIFrame()) {
this.enableApi().then(function () { return post(this$1.el, {func: 'pauseVideo', method: 'pause'}); });
} else if (this.isHTML5()) {
this.el.pause();
}
};
Player.prototype.mute = function () {
var this$1 = this;
if (!this.isVideo()) {
return;
}
if (this.isIFrame()) {
this.enableApi().then(function () { return post(this$1.el, {func: 'mute', method: 'setVolume', value: 0}); });
} else if (this.isHTML5()) {
this.el.muted = true;
attr(this.el, 'muted', '');
}
};
function post(el, cmd) {
try {
el.contentWindow.postMessage(JSON.stringify(assign({event: 'command'}, cmd)), '*');
} catch (e) {}
}
function listen(cb) {
return new Promise(function (resolve) {
once(window, 'message', function (_, data$$1) { return resolve(data$$1); }, false, function (ref) {
var data$$1 = ref.data;
if (!data$$1 || !isString(data$$1)) {
return;
}
try {
data$$1 = JSON.parse(data$$1);
} catch (e) {
return;
}
return data$$1 && cb(data$$1);
});
});
}
/*
Based on:
Copyright (c) 2010-2016 Thomas Fuchs
http://zeptojs.com/
*/
var touch = {}, clickTimeout, swipeTimeout, tapTimeout, clicked;
function swipeDirection(ref) {
var x1 = ref.x1;
var x2 = ref.x2;
var y1 = ref.y1;
var y2 = ref.y2;
return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down');
}
function cancelAll() {
clickTimeout && clearTimeout(clickTimeout);
swipeTimeout && clearTimeout(swipeTimeout);
tapTimeout && clearTimeout(tapTimeout);
clickTimeout = swipeTimeout = tapTimeout = null;
touch = {};
}
ready(function () {
on(document, 'click', function () { return clicked = true; }, true);
on(document, pointerDown, function (e) {
var target = e.target;
var ref = getPos$1(e);
var x = ref.x;
var y = ref.y;
var now = Date.now();
var type = getType(e.type);
if (touch.type && touch.type !== type) {
return;
}
touch.el = 'tagName' in target ? target : target.parentNode;
clickTimeout && clearTimeout(clickTimeout);
touch.x1 = x;
touch.y1 = y;
if (touch.last && now - touch.last <= 250) {
touch = {};
}
touch.type = type;
touch.last = now;
clicked = e.button > 0;
});
on(document, pointerMove, function (e) {
if (e.defaultPrevented) {
return;
}
var ref = getPos$1(e);
var x = ref.x;
var y = ref.y;
touch.x2 = x;
touch.y2 = y;
});
on(document, pointerUp, function (ref) {
var type = ref.type;
var target = ref.target;
if (touch.type !== getType(type)) {
return;
}
// swipe
if (touch.x2 && Math.abs(touch.x1 - touch.x2) > 30 || touch.y2 && Math.abs(touch.y1 - touch.y2) > 30) {
swipeTimeout = setTimeout(function () {
if (touch.el) {
trigger(touch.el, 'swipe');
trigger(touch.el, ("swipe" + (swipeDirection(touch))));
}
touch = {};
});
// normal tap
} else if ('last' in touch) {
tapTimeout = setTimeout(function () { return trigger(touch.el, 'tap'); });
// trigger single click after 350ms of inactivity
if (touch.el && type !== 'mouseup' && within(target, touch.el)) {
clickTimeout = setTimeout(function () {
clickTimeout = null;
if (touch.el && !clicked) {
trigger(touch.el, 'click');
}
touch = {};
}, 350);
}
} else {
touch = {};
}
});
on(document, 'touchcancel', cancelAll);
on(window, 'scroll', cancelAll);
});
var touching = false;
on(document, 'touchstart', function () { return touching = true; }, true);
on(document, 'click', function () {touching = false;});
on(document, 'touchcancel', function () { return touching = false; }, true);
function isTouch(e) {
return touching || e.pointerType === 'touch';
}
function getPos$1(e) {
var touches = e.touches;
var changedTouches = e.changedTouches;
var ref = touches && touches[0] || changedTouches && changedTouches[0] || e;
var x = ref.pageX;
var y = ref.pageY;
return {x: x, y: y};
}
function getType(type) {
return type.slice(0, 5);
}
var util = /*#__PURE__*/Object.freeze({
ajax: ajax,
getImage: getImage,
transition: transition,
Transition: Transition,
animate: animate,
Animation: Animation,
attr: attr,
hasAttr: hasAttr,
removeAttr: removeAttr,
data: data,
addClass: addClass,
removeClass: removeClass,
removeClasses: removeClasses,
replaceClass: replaceClass,
hasClass: hasClass,
toggleClass: toggleClass,
$: $,
$$: $$,
positionAt: positionAt,
offset: offset,
position: position,
height: height,
width: width,
flipPosition: flipPosition,
isInView: isInView,
scrolledOver: scrolledOver,
scrollTop: scrollTop,
isReady: isReady,
ready: ready,
index: index,
getIndex: getIndex,
empty: empty,
html: html,
prepend: prepend,
append: append,
before: before,
after: after,
remove: remove,
wrapAll: wrapAll,
wrapInner: wrapInner,
unwrap: unwrap,
fragment: fragment,
apply: apply,
isIE: isIE,
isRtl: isRtl,
hasTouch: hasTouch,
pointerDown: pointerDown,
pointerMove: pointerMove,
pointerUp: pointerUp,
pointerEnter: pointerEnter,
pointerLeave: pointerLeave,
on: on,
off: off,
once: once,
trigger: trigger,
createEvent: createEvent,
toEventTargets: toEventTargets,
preventClick: preventClick,
fastdom: fastdom,
isVoidElement: isVoidElement,
isVisible: isVisible,
selInput: selInput,
isInput: isInput,
filter: filter,
within: within,
bind: bind,
hasOwn: hasOwn,
hyphenate: hyphenate,
camelize: camelize,
ucfirst: ucfirst,
startsWith: startsWith,
endsWith: endsWith,
includes: includes,
isArray: isArray,
isFunction: isFunction,
isObject: isObject,
isPlainObject: isPlainObject,
isWindow: isWindow,
isDocument: isDocument,
isJQuery: isJQuery,
isNode: isNode,
isNodeCollection: isNodeCollection,
isBoolean: isBoolean,
isString: isString,
isNumber: isNumber,
isNumeric: isNumeric,
isUndefined: isUndefined,
toBoolean: toBoolean,
toNumber: toNumber,
toFloat: toFloat,
toNode: toNode,
toNodes: toNodes,
toList: toList,
toMs: toMs,
swap: swap,
assign: assign,
each: each,
sortBy: sortBy,
clamp: clamp,
noop: noop,
intersectRect: intersectRect,
pointInRect: pointInRect,
Dimensions: Dimensions,
MouseTracker: MouseTracker,
mergeOptions: mergeOptions,
parseOptions: parseOptions,
Player: Player,
Promise: Promise,
Deferred: Deferred,
query: query,
queryAll: queryAll,
find: find,
findAll: findAll,
matches: matches,
closest: closest,
parents: parents,
escape: escape,
css: css,
getStyles: getStyles,
getStyle: getStyle,
getCssVar: getCssVar,
propName: propName,
isTouch: isTouch,
getPos: getPos$1
});
function componentAPI (UIkit) {
var DATA = UIkit.data;
var components = {};
UIkit.component = function (name, options) {
if (!options) {
if (isPlainObject(components[name])) {
components[name] = UIkit.extend(components[name]);
}
return components[name];
}
UIkit[name] = function (element, data$$1) {
var i = arguments.length, argsArray = Array(i);
while ( i-- ) argsArray[i] = arguments[i];
var component = UIkit.component(name);
if (isPlainObject(element)) {
return new component({data: element});
}
if (component.options.functional) {
return new component({data: [].concat( argsArray )});
}
return element && element.nodeType ? init(element) : $$(element).map(init)[0];
function init(element) {
var instance = UIkit.getComponent(element, name);
if (instance) {
if (!data$$1) {
return instance;
} else {
instance.$destroy();
}
}
return new component({el: element, data: data$$1});
}
};
var opt = isPlainObject(options) ? assign({}, options) : options.options;
opt.name = name;
if (opt.install) {
opt.install(UIkit, opt, name);
}
if (UIkit._initialized && !opt.functional) {
var id = hyphenate(name);
fastdom.read(function () { return UIkit[name](("[uk-" + id + "],[data-uk-" + id + "]")); });
}
return components[name] = isPlainObject(options) ? opt : options;
};
UIkit.getComponents = function (element) { return element && element[DATA] || {}; };
UIkit.getComponent = function (element, name) { return UIkit.getComponents(element)[name]; };
UIkit.connect = function (node) {
if (node[DATA]) {
for (var name in node[DATA]) {
node[DATA][name]._callConnected();
}
}
for (var i = 0; i < node.attributes.length; i++) {
var name$1 = getComponentName(node.attributes[i].name);
if (name$1 && name$1 in components) {
UIkit[name$1](node);
}
}
};
UIkit.disconnect = function (node) {
for (var name in node[DATA]) {
node[DATA][name]._callDisconnected();
}
};
}
function getComponentName(attribute) {
return startsWith(attribute, 'uk-') || startsWith(attribute, 'data-uk-')
? camelize(attribute.replace('data-uk-', '').replace('uk-', ''))
: false;
}
function boot (UIkit) {
var connect = UIkit.connect;
var disconnect = UIkit.disconnect;
if (!('MutationObserver' in window)) {
return;
}
if (document.body) {
init();
} else {
(new MutationObserver(function () {
if (document.body) {
this.disconnect();
init();
}
})).observe(document, {childList: true, subtree: true});
}
function init() {
apply$$1(document.body, connect);
fastdom.flush();
(new MutationObserver(function (mutations) { return mutations.forEach(applyMutation); })).observe(document, {
childList: true,
subtree: true,
characterData: true,
attributes: true
});
UIkit._initialized = true;
}
function applyMutation(mutation) {
var target = mutation.target;
var type = mutation.type;
var update = type !== 'attributes'
? applyChildList(mutation)
: applyAttribute(mutation);
update && UIkit.update(target);
}
function applyAttribute(ref) {
var target = ref.target;
var attributeName = ref.attributeName;
if (attributeName === 'href') {
return true;
}
var name = getComponentName(attributeName);
if (!name || !(name in UIkit)) {
return;
}
if (hasAttr(target, attributeName)) {
UIkit[name](target);
return true;
}
var component = UIkit.getComponent(target, name);
if (component) {
component.$destroy();
return true;
}
}
function applyChildList(ref) {
var addedNodes = ref.addedNodes;
var removedNodes = ref.removedNodes;
for (var i = 0; i < addedNodes.length; i++) {
apply$$1(addedNodes[i], connect);
}
for (var i$1 = 0; i$1 < removedNodes.length; i$1++) {
apply$$1(removedNodes[i$1], disconnect);
}
return true;
}
function apply$$1(node, fn) {
if (node.nodeType !== 1 || hasAttr(node, 'uk-no-boot')) {
return;
}
fn(node);
node = node.firstElementChild;
while (node) {
var next = node.nextElementSibling;
apply$$1(node, fn);
node = next;
}
}
}
function globalAPI (UIkit) {
var DATA = UIkit.data;
UIkit.use = function (plugin) {
if (plugin.installed) {
return;
}
plugin.call(null, this);
plugin.installed = true;
return this;
};
UIkit.mixin = function (mixin, component) {
component = (isString(component) ? UIkit.component(component) : component) || this;
mixin = mergeOptions({}, mixin);
mixin.mixins = component.options.mixins;
delete component.options.mixins;
component.options = mergeOptions(component.options, mixin);
};
UIkit.extend = function (options) {
options = options || {};
var Super = this;
var Sub = function UIkitComponent (options) {
this._init(options);
};
Sub.prototype = Object.create(Super.prototype);
Sub.prototype.constructor = Sub;
Sub.options = mergeOptions(Super.options, options);
Sub.super = Super;
Sub.extend = Super.extend;
return Sub;
};
UIkit.update = function (element, e) {
e = createEvent(e || 'update');
element = element ? toNode(element) : document.body;
path(element).map(function (element) { return update(element[DATA], e); });
apply(element, function (element) { return update(element[DATA], e); });
};
var container;
Object.defineProperty(UIkit, 'container', {
get: function() {
return container || document.body;
},
set: function(element) {
container = $(element);
}
});
function update(data$$1, e) {
if (!data$$1) {
return;
}
for (var name in data$$1) {
if (data$$1[name]._isReady) {
data$$1[name]._callUpdate(e);
}
}
}
function path(element) {
var path = [];
while (element && element !== document.body && element.parentNode) {
element = element.parentNode;
path.unshift(element);
}
return path;
}
}
function hooksAPI (UIkit) {
UIkit.prototype._callHook = function (hook) {
var this$1 = this;
var handlers = this.$options[hook];
if (handlers) {
handlers.forEach(function (handler) { return handler.call(this$1); });
}
};
UIkit.prototype._callConnected = function () {
var this$1 = this;
if (this._connected) {
return;
}
this._data = {};
this._initProps();
this._callHook('beforeConnect');
this._connected = true;
this._initEvents();
this._initObserver();
this._callHook('connected');
if (!this._isReady) {
ready(function () { return this$1._callReady(); });
}
this._callUpdate();
};
UIkit.prototype._callDisconnected = function () {
if (!this._connected) {
return;
}
this._callHook('beforeDisconnect');
if (this._observer) {
this._observer.disconnect();
this._observer = null;
}
this._unbindEvents();
this._callHook('disconnected');
this._connected = false;
};
UIkit.prototype._callReady = function () {
if (this._isReady) {
return;
}
this._isReady = true;
this._callHook('ready');
this._resetComputeds();
this._callUpdate();
};
UIkit.prototype._callUpdate = function (e) {
var this$1 = this;
e = createEvent(e || 'update');
var type = e.type;
if (includes(['update', 'load', 'resize'], type)) {
this._resetComputeds();
}
var updates = this.$options.update;
var ref = this._frames;
var reads = ref.reads;
var writes = ref.writes;
if (!updates) {
return;
}
updates.forEach(function (ref, i) {
var read = ref.read;
var write = ref.write;
var events = ref.events;
if (type !== 'update' && !includes(events, type)) {
return;
}
if (read && !includes(fastdom.reads, reads[i])) {
reads[i] = fastdom.read(function () {
var result = this$1._connected && read.call(this$1, this$1._data, e);
if (result === false && write) {
fastdom.clear(writes[i]);
delete writes[i];
} else if (isPlainObject(result)) {
assign(this$1._data, result);
}
delete reads[i];
});
}
if (write && !includes(fastdom.writes, writes[i])) {
writes[i] = fastdom.write(function () {
this$1._connected && write.call(this$1, this$1._data, e);
delete writes[i];
});
}
});
};
}
function stateAPI (UIkit) {
var uid = 0;
UIkit.prototype._init = function (options) {
options = options || {};
options.data = normalizeData(options, this.constructor.options);
this.$options = mergeOptions(this.constructor.options, options, this);
this.$el = null;
this.$props = {};
this._frames = {reads: {}, writes: {}};
this._events = [];
this._uid = uid++;
this._initData();
this._initMethods();
this._initComputeds();
this._callHook('created');
if (options.el) {
this.$mount(options.el);
}
};
UIkit.prototype._initData = function () {
var this$1 = this;
var ref = this.$options;
var data$$1 = ref.data; if ( data$$1 === void 0 ) data$$1 = {};
for (var key in data$$1) {
this$1.$props[key] = this$1[key] = data$$1[key];
}
};
UIkit.prototype._initMethods = function () {
var this$1 = this;
var ref = this.$options;
var methods = ref.methods;
if (methods) {
for (var key in methods) {
this$1[key] = bind(methods[key], this$1);
}
}
};
UIkit.prototype._initComputeds = function () {
var this$1 = this;
var ref = this.$options;
var computed = ref.computed;
this._resetComputeds();
if (computed) {
for (var key in computed) {
registerComputed(this$1, key, computed[key]);
}
}
};
UIkit.prototype._resetComputeds = function () {
this._computeds = {};
};
UIkit.prototype._initProps = function (props) {
var this$1 = this;
var key;
this._resetComputeds();
props = props || getProps(this.$options, this.$name);
for (key in props) {
if (!isUndefined(props[key])) {
this$1.$props[key] = props[key];
}
}
var exclude = [this.$options.computed, this.$options.methods];
for (key in this$1.$props) {
if (key in props && notIn(exclude, key)) {
this$1[key] = this$1.$props[key];
}
}
};
UIkit.prototype._initEvents = function () {
var this$1 = this;
var ref = this.$options;
var events = ref.events;
if (events) {
events.forEach(function (event) {
if (!hasOwn(event, 'handler')) {
for (var key in event) {
registerEvent(this$1, event[key], key);
}
} else {
registerEvent(this$1, event);
}
});
}
};
UIkit.prototype._unbindEvents = function () {
this._events.forEach(function (unbind) { return unbind(); });
this._events = [];
};
UIkit.prototype._initObserver = function () {
var this$1 = this;
var ref = this.$options;
var attrs = ref.attrs;
var props = ref.props;
var el = ref.el;
if (this._observer || !props || attrs === false) {
return;
}
attrs = isArray(attrs) ? attrs : Object.keys(props);
this._observer = new MutationObserver(function () {
var data$$1 = getProps(this$1.$options, this$1.$name);
if (attrs.some(function (key) { return !isUndefined(data$$1[key]) && data$$1[key] !== this$1.$props[key]; })) {
this$1.$reset();
}
});
var filter$$1 = attrs.map(function (key) { return hyphenate(key); }).concat(this.$name);
this._observer.observe(el, {
attributes: true,
attributeFilter: filter$$1.concat(filter$$1.map(function (key) { return ("data-" + key); }))
});
};
function getProps(opts, name) {
var data$$1 = {};
var args = opts.args; if ( args === void 0 ) args = [];
var props = opts.props; if ( props === void 0 ) props = {};
var el = opts.el;
if (!props) {
return data$$1;
}
for (var key in props) {
var prop = hyphenate(key);
var value = data(el, prop);
if (!isUndefined(value)) {
value = props[key] === Boolean && value === ''
? true
: coerce(props[key], value);
if (prop === 'target' && (!value || startsWith(value, '_'))) {
continue;
}
data$$1[key] = value;
}
}
var options = parseOptions(data(el, name), args);
for (var key$1 in options) {
var prop$1 = camelize(key$1);
if (props[prop$1] !== undefined) {
data$$1[prop$1] = coerce(props[prop$1], options[key$1]);
}
}
return data$$1;
}
function registerComputed(component, key, cb) {
Object.defineProperty(component, key, {
enumerable: true,
get: function() {
var _computeds = component._computeds;
var $props = component.$props;
var $el = component.$el;
if (!hasOwn(_computeds, key)) {
_computeds[key] = cb.call(component, $props, $el);
}
return _computeds[key];
},
set: function(value) {
component._computeds[key] = value;
}
});
}
function registerEvent(component, event, key) {
if (!isPlainObject(event)) {
event = ({name: key, handler: event});
}
var name = event.name;
var el = event.el;
var handler = event.handler;
var capture = event.capture;
var passive = event.passive;
var delegate = event.delegate;
var filter$$1 = event.filter;
var self = event.self;
el = isFunction(el)
? el.call(component)
: el || component.$el;
if (isArray(el)) {
el.forEach(function (el) { return registerEvent(component, assign({}, event, {el: el}), key); });
return;
}
if (!el || filter$$1 && !filter$$1.call(component)) {
return;
}
handler = detail(isString(handler) ? component[handler] : bind(handler, component));
if (self) {
handler = selfFilter(handler);
}
component._events.push(
on(
el,
name,
!delegate
? null
: isString(delegate)
? delegate
: delegate.call(component),
handler,
isBoolean(passive)
? {passive: passive, capture: capture}
: capture
)
);
}
function selfFilter(handler) {
return function selfHandler(e) {
if (e.target === e.currentTarget || e.target === e.current) {
return handler.call(null, e);
}
};
}
function notIn(options, key) {
return options.every(function (arr) { return !arr || !hasOwn(arr, key); });
}
function detail(listener) {
return function (e) { return isArray(e.detail) ? listener.apply(void 0, [e].concat(e.detail)) : listener(e); };
}
function coerce(type, value) {
if (type === Boolean) {
return toBoolean(value);
} else if (type === Number) {
return toNumber(value);
} else if (type === 'list') {
return toList(value);
} else if (type === 'media') {
return toMedia(value);
}
return type ? type(value) : value;
}
function toMedia(value) {
if (isString(value)) {
if (value[0] === '@') {
var name = "media-" + (value.substr(1));
value = toFloat(getCssVar(name));
} else if (isNaN(value)) {
return value;
}
}
return value && !isNaN(value) ? ("(min-width: " + value + "px)") : false;
}
function normalizeData(ref, ref$1) {
var data$$1 = ref.data;
var el = ref.el;
var args = ref$1.args;
var props = ref$1.props; if ( props === void 0 ) props = {};
data$$1 = isArray(data$$1)
? args && args.length
? data$$1.slice(0, args.length).reduce(function (data$$1, value, index$$1) {
if (isPlainObject(value)) {
assign(data$$1, value);
} else {
data$$1[args[index$$1]] = value;
}
return data$$1;
}, {})
: undefined
: data$$1;
if (data$$1) {
for (var key in data$$1) {
if (isUndefined(data$$1[key])) {
delete data$$1[key];
} else {
data$$1[key] = props[key] ? coerce(props[key], data$$1[key], el) : data$$1[key];
}
}
}
return data$$1;
}
}
function instanceAPI (UIkit) {
var DATA = UIkit.data;
UIkit.prototype.$mount = function (el) {
var ref = this.$options;
var name = ref.name;
if (!el[DATA]) {
el[DATA] = {};
}
if (el[DATA][name]) {
return;
}
el[DATA][name] = this;
this.$el = this.$options.el = this.$options.el || el;
this._callHook('init');
if (within(el, document)) {
this._callConnected();
}
};
UIkit.prototype.$emit = function (e) {
this._callUpdate(e);
};
UIkit.prototype.$reset = function () {
this._callDisconnected();
this._callConnected();
};
UIkit.prototype.$destroy = function (removeEl) {
if ( removeEl === void 0 ) removeEl = false;
var ref = this.$options;
var el = ref.el;
var name = ref.name;
if (el) {
this._callDisconnected();
}
this._callHook('destroy');
if (!el || !el[DATA]) {
return;
}
delete el[DATA][name];
if (!Object.keys(el[DATA]).length) {
delete el[DATA];
}
if (removeEl) {
remove(this.$el);
}
};
UIkit.prototype.$create = function (component, element, data$$1) {
return UIkit[component](element, data$$1);
};
UIkit.prototype.$update = UIkit.update;
UIkit.prototype.$getComponent = UIkit.getComponent;
var names = {};
Object.defineProperties(UIkit.prototype, {
$container: Object.getOwnPropertyDescriptor(UIkit, 'container'),
$name: {
get: function() {
var ref = this.$options;
var name = ref.name;
if (!names[name]) {
names[name] = UIkit.prefix + hyphenate(name);
}
return names[name];
}
}
});
}
var UIkit = function (options) {
this._init(options);
};
UIkit.util = util;
UIkit.data = '__uikit__';
UIkit.prefix = 'uk-';
UIkit.options = {};
globalAPI(UIkit);
hooksAPI(UIkit);
stateAPI(UIkit);
componentAPI(UIkit);
instanceAPI(UIkit);
var Class = {
connected: function() {
addClass(this.$el, this.$name);
}
};
var Togglable = {
props: {
cls: Boolean,
animation: 'list',
duration: Number,
origin: String,
transition: String,
queued: Boolean
},
data: {
cls: false,
animation: [false],
duration: 200,
origin: false,
transition: 'linear',
queued: false,
initProps: {
overflow: '',
height: '',
paddingTop: '',
paddingBottom: '',
marginTop: '',
marginBottom: ''
},
hideProps: {
overflow: 'hidden',
height: 0,
paddingTop: 0,
paddingBottom: 0,
marginTop: 0,
marginBottom: 0
}
},
computed: {
hasAnimation: function(ref) {
var animation = ref.animation;
return !!animation[0];
},
hasTransition: function(ref) {
var animation = ref.animation;
return this.hasAnimation && animation[0] === true;
}
},
methods: {
toggleElement: function(targets, show, animate$$1) {
var this$1 = this;
return new Promise(function (resolve) {
targets = toNodes(targets);
var all = function (targets) { return Promise.all(targets.map(function (el) { return this$1._toggleElement(el, show, animate$$1); })); };
var toggled = targets.filter(function (el) { return this$1.isToggled(el); });
var untoggled = targets.filter(function (el) { return !includes(toggled, el); });
var p;
if (!this$1.queued || !isUndefined(animate$$1) || !isUndefined(show) || !this$1.hasAnimation || targets.length < 2) {
p = all(untoggled.concat(toggled));
} else {
var body = document.body;
var scroll = body.scrollTop;
var el = toggled[0];
var inProgress = Animation.inProgress(el) && hasClass(el, 'uk-animation-leave')
|| Transition.inProgress(el) && el.style.height === '0px';
p = all(toggled);
if (!inProgress) {
p = p.then(function () {
var p = all(untoggled);
body.scrollTop = scroll;
return p;
});
}
}
p.then(resolve, noop);
});
},
toggleNow: function(targets, show) {
var this$1 = this;
return new Promise(function (resolve) { return Promise.all(toNodes(targets).map(function (el) { return this$1._toggleElement(el, show, false); })).then(resolve, noop); });
},
isToggled: function(el) {
var nodes = toNodes(el || this.$el);
return this.cls
? hasClass(nodes, this.cls.split(' ')[0])
: !hasAttr(nodes, 'hidden');
},
updateAria: function(el) {
if (this.cls === false) {
attr(el, 'aria-hidden', !this.isToggled(el));
}
},
_toggleElement: function(el, show, animate$$1) {
var this$1 = this;
show = isBoolean(show)
? show
: Animation.inProgress(el)
? hasClass(el, 'uk-animation-leave')
: Transition.inProgress(el)
? el.style.height === '0px'
: !this.isToggled(el);
if (!trigger(el, ("before" + (show ? 'show' : 'hide')), [this])) {
return Promise.reject();
}
var promise = (animate$$1 === false || !this.hasAnimation
? this._toggleImmediate
: this.hasTransition
? this._toggleHeight
: this._toggleAnimation
)(el, show);
trigger(el, show ? 'show' : 'hide', [this]);
return promise.then(function () {
trigger(el, show ? 'shown' : 'hidden', [this$1]);
this$1.$update(el);
});
},
_toggle: function(el, toggled) {
if (!el) {
return;
}
var changed;
if (this.cls) {
changed = includes(this.cls, ' ') || Boolean(toggled) !== hasClass(el, this.cls);
changed && toggleClass(el, this.cls, includes(this.cls, ' ') ? undefined : toggled);
} else {
changed = Boolean(toggled) === hasAttr(el, 'hidden');
changed && attr(el, 'hidden', !toggled ? '' : null);
}
$$('[autofocus]', el).some(function (el) { return isVisible(el) && (el.focus() || true); });
this.updateAria(el);
changed && this.$update(el);
},
_toggleImmediate: function(el, show) {
this._toggle(el, show);
return Promise.resolve();
},
_toggleHeight: function(el, show) {
var this$1 = this;
var inProgress = Transition.inProgress(el);
var inner = el.hasChildNodes ? toFloat(css(el.firstElementChild, 'marginTop')) + toFloat(css(el.lastElementChild, 'marginBottom')) : 0;
var currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0;
Transition.cancel(el);
if (!this.isToggled(el)) {
this._toggle(el, true);
}
height(el, '');
// Update child components first
fastdom.flush();
var endHeight = height(el) + (inProgress ? 0 : inner);
height(el, currentHeight);
return (show
? Transition.start(el, assign({}, this.initProps, {overflow: 'hidden', height: endHeight}), Math.round(this.duration * (1 - currentHeight / endHeight)), this.transition)
: Transition.start(el, this.hideProps, Math.round(this.duration * (currentHeight / endHeight)), this.transition).then(function () { return this$1._toggle(el, false); })
).then(function () { return css(el, this$1.initProps); });
},
_toggleAnimation: function(el, show) {
var this$1 = this;
Animation.cancel(el);
if (show) {
this._toggle(el, true);
return Animation.in(el, this.animation[0], this.duration, this.origin);
}
return Animation.out(el, this.animation[1] || this.animation[0], this.duration, this.origin).then(function () { return this$1._toggle(el, false); });
}
}
};
var Accordion = {
mixins: [Class, Togglable],
props: {
targets: String,
active: null,
collapsible: Boolean,
multiple: Boolean,
toggle: String,
content: String,
transition: String
},
data: {
targets: '> *',
active: false,
animation: [true],
collapsible: true,
multiple: false,
clsOpen: 'uk-open',
toggle: '> .uk-accordion-title',
content: '> .uk-accordion-content',
transition: 'ease'
},
computed: {
items: function(ref, $el) {
var targets = ref.targets;
return $$(targets, $el);
}
},
events: [
{
name: 'click',
delegate: function() {
return ((this.targets) + " " + (this.$props.toggle));
},
handler: function(e) {
e.preventDefault();
this.toggle(index($$(((this.targets) + " " + (this.$props.toggle)), this.$el), e.current));
}
}
],
connected: function() {
if (this.active === false) {
return;
}
var active = this.items[Number(this.active)];
if (active && !hasClass(active, this.clsOpen)) {
this.toggle(active, false);
}
},
update: function() {
var this$1 = this;
this.items.forEach(function (el) { return this$1._toggleImmediate($(this$1.content, el), hasClass(el, this$1.clsOpen)); });
var active = !this.collapsible && !hasClass(this.items, this.clsOpen) && this.items[0];
if (active) {
this.toggle(active, false);
}
},
methods: {
toggle: function(item, animate$$1) {
var this$1 = this;
var index$$1 = getIndex(item, this.items);
var active = filter(this.items, ("." + (this.clsOpen)));
item = this.items[index$$1];
item && [item]
.concat(!this.multiple && !includes(active, item) && active || [])
.forEach(function (el) {
var isItem = el === item;
var state = isItem && !hasClass(el, this$1.clsOpen);
if (!state && isItem && !this$1.collapsible && active.length < 2) {
return;
}
toggleClass(el, this$1.clsOpen, state);
var content = el._wrapper ? el._wrapper.firstElementChild : $(this$1.content, el);
if (!el._wrapper) {
el._wrapper = wrapAll(content, '<div>');
attr(el._wrapper, 'hidden', state ? '' : null);
}
this$1._toggleImmediate(content, true);
this$1.toggleElement(el._wrapper, state, animate$$1).then(function () {
if (hasClass(el, this$1.clsOpen) === state) {
if (!state) {
this$1._toggleImmediate(content, false);
}
el._wrapper = null;
unwrap(content);
}
});
});
}
}
};
var Alert = {
mixins: [Class, Togglable],
args: 'animation',
props: {
close: String
},
data: {
animation: [true],
selClose: '.uk-alert-close',
duration: 150,
hideProps: assign({opacity: 0}, Togglable.data.hideProps)
},
events: [
{
name: 'click',
delegate: function() {
return this.selClose;
},
handler: function(e) {
e.preventDefault();
this.close();
}
}
],
methods: {
close: function() {
var this$1 = this;
this.toggleElement(this.$el).then(function () { return this$1.$destroy(true); });
}
}
};
function Core (UIkit) {
ready(function () {
var scroll = 0;
var started = 0;
on(window, 'load resize', function (e) { return UIkit.update(null, e); });
on(window, 'scroll', function (e) {
var target = e.target;
e.dir = scroll <= window.pageYOffset ? 'down' : 'up';
e.pageYOffset = scroll = window.pageYOffset;
UIkit.update(target.nodeType !== 1 ? document.body : target, e);
}, {passive: true, capture: true});
on(document, 'loadedmetadata load', function (ref) {
var target = ref.target;
return UIkit.update(target, 'load');
}, true);
on(document, 'animationstart', function (ref) {
var target = ref.target;
if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) {
started++;
css(document.body, 'overflowX', 'hidden');
setTimeout(function () {
if (!--started) {
css(document.body, 'overflowX', '');
}
}, toMs(css(target, 'animationDuration')) + 100);
}
}, true);
if (!hasTouch) {
return;
}
var cls = 'uk-hover';
on(document, 'tap', function (ref) {
var target = ref.target;
return $$(("." + cls)).forEach(function (el) { return !within(target, el) && removeClass(el, cls); }
);
}
);
Object.defineProperty(UIkit, 'hoverSelector', {
set: function(selector) {
on(document, 'tap', selector, function (ref) {
var current = ref.current;
return addClass(current, cls);
});
}
});
UIkit.hoverSelector = '.uk-animation-toggle, .uk-transition-toggle, [uk-hover]';
});
}
var Video = {
args: 'autoplay',
props: {
automute: Boolean,
autoplay: Boolean,
},
data: {
automute: false,
autoplay: true
},
computed: {
inView: function(ref) {
var autoplay = ref.autoplay;
return autoplay === 'inview';
}
},
connected: function() {
if (this.inView && !hasAttr(this.$el, 'preload')) {
this.$el.preload = 'none';
}
},
ready: function() {
this.player = new Player(this.$el);
if (this.automute) {
this.player.mute();
}
},
update: [
{
read: function(_, ref) {
var type = ref.type;
return !this.player || (type === 'scroll' || type === 'resize') && !this.inView
? false
: {
visible: isVisible(this.$el) && css(this.$el, 'visibility') !== 'hidden',
inView: this.inView && isInView(this.$el)
};
},
write: function(ref) {
var visible = ref.visible;
var inView = ref.inView;
if (!visible || this.inView && !inView) {
this.player.pause();
} else if (this.autoplay === true || this.inView && inView) {
this.player.play();
}
},
events: ['load', 'resize', 'scroll']
}
]
};
var Cover = {
mixins: [Class, Video],
props: {
width: Number,
height: Number
},
data: {
automute: true
},
update: {
read: function() {
var el = this.$el;
if (!isVisible(el)) {
return false;
}
var ref = el.parentNode;
var height$$1 = ref.offsetHeight;
var width$$1 = ref.offsetWidth;
return {height: height$$1, width: width$$1};
},
write: function(ref) {
var height$$1 = ref.height;
var width$$1 = ref.width;
var el = this.$el;
var elWidth = this.width || el.naturalWidth || el.videoWidth || el.clientWidth;
var elHeight = this.height || el.naturalHeight || el.videoHeight || el.clientHeight;
if (!elWidth || !elHeight) {
return;
}
css(el, Dimensions.cover(
{
width: elWidth,
height: elHeight
},
{
width: width$$1 + (width$$1 % 2 ? 1 : 0),
height: height$$1 + (height$$1 % 2 ? 1 : 0)
}
));
},
events: ['load', 'resize']
}
};
var Position = {
props: {
pos: String,
offset: null,
flip: Boolean,
clsPos: String
},
data: {
pos: ("bottom-" + (!isRtl ? 'left' : 'right')),
flip: true,
offset: false,
clsPos: ''
},
computed: {
pos: function(ref) {
var pos = ref.pos;
return (pos + (!includes(pos, '-') ? '-center' : '')).split('-');
},
dir: function() {
return this.pos[0];
},
align: function() {
return this.pos[1];
}
},
methods: {
positionAt: function(element, target, boundary) {
removeClasses(element, ((this.clsPos) + "-(top|bottom|left|right)(-[a-z]+)?"));
css(element, {top: '', left: ''});
var node;
var ref = this;
var offset$$1 = ref.offset;
offset$$1 = isNumeric(offset$$1)
? offset$$1
: (node = $(offset$$1))
? offset(node)[axis === 'x' ? 'left' : 'top'] - offset(target)[axis === 'x' ? 'right' : 'bottom']
: 0;
var axis = this.getAxis();
var ref$1 = positionAt(
element,
target,
axis === 'x' ? ((flipPosition(this.dir)) + " " + (this.align)) : ((this.align) + " " + (flipPosition(this.dir))),
axis === 'x' ? ((this.dir) + " " + (this.align)) : ((this.align) + " " + (this.dir)),
axis === 'x' ? ("" + (this.dir === 'left' ? -offset$$1 : offset$$1)) : (" " + (this.dir === 'top' ? -offset$$1 : offset$$1)),
null,
this.flip,
boundary
).target;
var x = ref$1.x;
var y = ref$1.y;
this.dir = axis === 'x' ? x : y;
this.align = axis === 'x' ? y : x;
toggleClass(element, ((this.clsPos) + "-" + (this.dir) + "-" + (this.align)), this.offset === false);
},
getAxis: function() {
return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
}
}
};
var active;
var Drop = {
mixins: [Position, Togglable],
args: 'pos',
props: {
mode: 'list',
toggle: Boolean,
boundary: Boolean,
boundaryAlign: Boolean,
delayShow: Number,
delayHide: Number,
clsDrop: String
},
data: {
mode: ['click', 'hover'],
toggle: '- *',
boundary: window,
boundaryAlign: false,
delayShow: 0,
delayHide: 800,
clsDrop: false,
hoverIdle: 200,
animation: ['uk-animation-fade'],
cls: 'uk-open'
},
computed: {
boundary: function(ref, $el) {
var boundary = ref.boundary;
return query(boundary, $el);
},
clsDrop: function(ref) {
var clsDrop = ref.clsDrop;
return clsDrop || ("uk-" + (this.$options.name));
},
clsPos: function() {
return this.clsDrop;
}
},
init: function() {
this.tracker = new MouseTracker();
},
connected: function() {
addClass(this.$el, this.clsDrop);
var ref = this.$props;
var toggle = ref.toggle;
this.toggle = toggle && this.$create('toggle', query(toggle, this.$el), {
target: this.$el,
mode: this.mode
});
this.updateAria(this.$el);
},
events: [
{
name: 'click',
delegate: function() {
return ("." + (this.clsDrop) + "-close");
},
handler: function(e) {
e.preventDefault();
this.hide(false);
}
},
{
name: 'click',
delegate: function() {
return 'a[href^="#"]';
},
handler: function(e) {
if (e.defaultPrevented) {
return;
}
var id = e.target.hash;
if (!id) {
e.preventDefault();
}
if (!id || !within(id, this.$el)) {
this.hide(false);
}
}
},
{
name: 'beforescroll',
handler: function() {
this.hide(false);
}
},
{
name: 'toggle',
self: true,
handler: function(e, toggle) {
e.preventDefault();
if (this.isToggled()) {
this.hide(false);
} else {
this.show(toggle, false);
}
}
},
{
name: pointerEnter,
filter: function() {
return includes(this.mode, 'hover');
},
handler: function(e) {
if (isTouch(e)) {
return;
}
if (active
&& active !== this
&& active.toggle
&& includes(active.toggle.mode, 'hover')
&& !within(e.target, active.toggle.$el)
&& !pointInRect({x: e.pageX, y: e.pageY}, offset(active.$el))
) {
active.hide(false);
}
e.preventDefault();
this.show(this.toggle);
}
},
{
name: 'toggleshow',
handler: function(e, toggle) {
if (toggle && !includes(toggle.target, this.$el)) {
return;
}
e.preventDefault();
this.show(toggle || this.toggle);
}
},
{
name: ("togglehide " + pointerLeave),
handler: function(e, toggle) {
if (isTouch(e) || toggle && !includes(toggle.target, this.$el)) {
return;
}
e.preventDefault();
if (this.toggle && includes(this.toggle.mode, 'hover')) {
this.hide();
}
}
},
{
name: 'beforeshow',
self: true,
handler: function() {
this.clearTimers();
Animation.cancel(this.$el);
this.position();
}
},
{
name: 'show',
self: true,
handler: function() {
this.tracker.init();
if (this.toggle) {
addClass(this.toggle.$el, this.cls);
attr(this.toggle.$el, 'aria-expanded', 'true');
}
registerEvent();
}
},
{
name: 'beforehide',
self: true,
handler: function() {
this.clearTimers();
}
},
{
name: 'hide',
handler: function(ref) {
var target = ref.target;
if (this.$el !== target) {
active = active === null && within(target, this.$el) && this.isToggled() ? this : active;
return;
}
active = this.isActive() ? null : active;
if (this.toggle) {
removeClass(this.toggle.$el, this.cls);
attr(this.toggle.$el, 'aria-expanded', 'false');
this.toggle.$el.blur();
$$('a, button', this.toggle.$el).forEach(function (el) { return el.blur(); });
}
this.tracker.cancel();
}
}
],
update: {
write: function() {
if (this.isToggled() && !Animation.inProgress(this.$el)) {
this.position();
}
},
events: ['resize']
},
methods: {
show: function(toggle, delay) {
var this$1 = this;
if ( delay === void 0 ) delay = true;
var show = function () { return !this$1.isToggled() && this$1.toggleElement(this$1.$el, true); };
var tryShow = function () {
this$1.toggle = toggle || this$1.toggle;
this$1.clearTimers();
if (this$1.isActive()) {
return;
} else if (delay && active && active !== this$1 && active.isDelaying) {
this$1.showTimer = setTimeout(this$1.show, 10);
return;
} else if (this$1.isParentOf(active)) {
if (active.hideTimer) {
active.hide(false);
} else {
return;
}
} else if (active && !this$1.isChildOf(active) && !this$1.isParentOf(active)) {
var prev;
while (active && active !== prev && !this$1.isChildOf(active)) {
prev = active;
active.hide(false);
}
}
if (delay && this$1.delayShow) {
this$1.showTimer = setTimeout(show, this$1.delayShow);
} else {
show();
}
active = this$1;
};
if (toggle && this.toggle && toggle.$el !== this.toggle.$el) {
once(this.$el, 'hide', tryShow);
this.hide(false);
} else {
tryShow();
}
},
hide: function(delay) {
var this$1 = this;
if ( delay === void 0 ) delay = true;
var hide = function () { return this$1.toggleNow(this$1.$el, false); };
this.clearTimers();
this.isDelaying = this.tracker.movesTo(this.$el);
if (delay && this.isDelaying) {
this.hideTimer = setTimeout(this.hide, this.hoverIdle);
} else if (delay && this.delayHide) {
this.hideTimer = setTimeout(hide, this.delayHide);
} else {
hide();
}
},
clearTimers: function() {
clearTimeout(this.showTimer);
clearTimeout(this.hideTimer);
this.showTimer = null;
this.hideTimer = null;
this.isDelaying = false;
},
isActive: function() {
return active === this;
},
isChildOf: function(drop) {
return drop && drop !== this && within(this.$el, drop.$el);
},
isParentOf: function(drop) {
return drop && drop !== this && within(drop.$el, this.$el);
},
position: function() {
removeClasses(this.$el, ((this.clsDrop) + "-(stack|boundary)"));
css(this.$el, {top: '', left: '', display: 'block'});
toggleClass(this.$el, ((this.clsDrop) + "-boundary"), this.boundaryAlign);
var boundary = offset(this.boundary);
var alignTo = this.boundaryAlign ? boundary : offset(this.toggle.$el);
if (this.align === 'justify') {
var prop = this.getAxis() === 'y' ? 'width' : 'height';
css(this.$el, prop, alignTo[prop]);
} else if (this.$el.offsetWidth > Math.max(boundary.right - alignTo.left, alignTo.right - boundary.left)) {
addClass(this.$el, ((this.clsDrop) + "-stack"));
}
this.positionAt(this.$el, this.boundaryAlign ? this.boundary : this.toggle.$el, this.boundary);
css(this.$el, 'display', '');
}
}
};
var registered;
function registerEvent() {
if (registered) {
return;
}
registered = true;
on(document, 'click', function (ref) {
var target = ref.target;
var defaultPrevented = ref.defaultPrevented;
var prev;
if (defaultPrevented) {
return;
}
while (active && active !== prev && !within(target, active.$el) && !(active.toggle && within(target, active.toggle.$el))) {
prev = active;
active.hide(false);
}
});
}
var Dropdown = {
extends: Drop
};
var FormCustom = {
mixins: [Class],
args: 'target',
props: {
target: Boolean
},
data: {
target: false
},
computed: {
input: function(_, $el) {
return $(selInput, $el);
},
state: function() {
return this.input.nextElementSibling;
},
target: function(ref, $el) {
var target = ref.target;
return target && (target === true
&& this.input.parentNode === $el
&& this.input.nextElementSibling
|| query(target, $el));
}
},
update: function() {
var ref = this;
var target = ref.target;
var input = ref.input;
if (!target) {
return;
}
var option;
var prop = isInput(target) ? 'value' : 'textContent';
var prev = target[prop];
var value = input.files && input.files[0]
? input.files[0].name
: matches(input, 'select') && (option = $$('option', input).filter(function (el) { return el.selected; })[0])
? option.textContent
: input.value;
if (prev !== value) {
target[prop] = value;
}
},
events: [
{
name: 'focusin focusout mouseenter mouseleave',
delegate: selInput,
handler: function(ref) {
var type = ref.type;
var current = ref.current;
if (current === this.input) {
toggleClass(
this.state,
("uk-" + (includes(type, 'focus') ? 'focus' : 'hover')),
includes(['focusin', 'mouseenter'], type)
);
}
}
},
{
name: 'change',
handler: function() {
this.$emit();
}
}
]
};
// Deprecated
var Gif = {
update: {
read: function(data$$1) {
var inview = isInView(this.$el);
if (!inview || data$$1.isInView === inview) {
return false;
}
data$$1.isInView = inview;
},
write: function() {
this.$el.src = this.$el.src;
},
events: ['scroll', 'load', 'resize']
}
};
var Margin = {
props: {
margin: String,
firstColumn: Boolean
},
data: {
margin: 'uk-margin-small-top',
firstColumn: 'uk-first-column'
},
update: {
read: function(data$$1) {
var items = this.$el.children;
var rows = [[]];
if (!items.length || !isVisible(this.$el)) {
return data$$1.rows = rows;
}
data$$1.rows = getRows(items);
data$$1.stacks = !data$$1.rows.some(function (row) { return row.length > 1; });
},
write: function(ref) {
var this$1 = this;
var rows = ref.rows;
rows.forEach(function (row, i) { return row.forEach(function (el, j) {
toggleClass(el, this$1.margin, i !== 0);
toggleClass(el, this$1.firstColumn, j === 0);
}); }
);
},
events: ['load', 'resize']
}
};
function getRows(items) {
var rows = [[]];
for (var i = 0; i < items.length; i++) {
var el = items[i];
var dim = getOffset(el);
if (!dim.height) {
continue;
}
for (var j = rows.length - 1; j >= 0; j--) {
var row = rows[j];
if (!row[0]) {
row.push(el);
break;
}
var leftDim = getOffset(row[0]);
if (dim.top >= leftDim.bottom - 1) {
rows.push([el]);
break;
}
if (dim.bottom > leftDim.top) {
if (dim.left < leftDim.left && !isRtl) {
row.unshift(el);
break;
}
row.push(el);
break;
}
if (j === 0) {
rows.unshift([el]);
break;
}
}
}
return rows;
}
function getOffset(element) {
var offsetTop = element.offsetTop;
var offsetLeft = element.offsetLeft;
var offsetHeight = element.offsetHeight;
return {
top: offsetTop,
left: offsetLeft,
height: offsetHeight,
bottom: offsetTop + offsetHeight
};
}
var Grid = {
extends: Margin,
mixins: [Class],
name: 'grid',
props: {
masonry: Boolean,
parallax: Number
},
data: {
margin: 'uk-grid-margin',
clsStack: 'uk-grid-stack',
masonry: false,
parallax: 0
},
computed: {
length: function(_, $el) {
return $el.children.length;
},
parallax: function(ref) {
var parallax = ref.parallax;
return parallax && this.length ? Math.abs(parallax) : '';
}
},
connected: function() {
this.masonry && addClass(this.$el, 'uk-flex-top uk-flex-wrap-top');
},
update: [
{
read: function(ref) {
var rows = ref.rows;
if (this.masonry || this.parallax) {
rows = rows.map(function (elements) { return sortBy(elements, 'offsetLeft'); });
}
var hasStaticContent = rows.some(function (elements) { return elements.some(function (element) { return css(element, 'position') === 'static'; }); });
var translates = false;
var elHeight = '';
if (this.masonry && this.length) {
var height$$1 = 0;
translates = rows.reduce(function (translates, row, i) {
translates[i] = row.map(function (_, j) { return i === 0 ? 0 : toFloat(translates[i - 1][j]) + (height$$1 - toFloat(rows[i - 1][j] && rows[i - 1][j].offsetHeight)); });
height$$1 = row.reduce(function (height$$1, el) { return Math.max(height$$1, el.offsetHeight); }, 0);
return translates;
}, []);
elHeight = maxColumnHeight(rows) + getMarginTop(this.$el, this.margin) * (rows.length - 1);
}
return {rows: rows, translates: translates, height: hasStaticContent ? elHeight : false};
},
write: function(ref) {
var stacks = ref.stacks;
var height$$1 = ref.height;
toggleClass(this.$el, this.clsStack, stacks);
css(this.$el, 'paddingBottom', this.parallax);
height$$1 !== false && css(this.$el, 'height', height$$1);
},
events: ['load', 'resize']
},
{
read: function(ref) {
var height$$1 = ref.height;
return {
scrolled: this.parallax
? scrolledOver(this.$el, height$$1 ? height$$1 - height(this.$el) : 0) * this.parallax
: false
};
},
write: function(ref) {
var rows = ref.rows;
var scrolled = ref.scrolled;
var translates = ref.translates;
if (scrolled === false && !translates) {
return;
}
rows.forEach(function (row, i) { return row.forEach(function (el, j) { return css(el, 'transform', !scrolled && !translates ? '' : ("translateY(" + ((translates && -translates[i][j]) + (scrolled ? j % 2 ? scrolled : scrolled / 8 : 0)) + "px)")); }
); }
);
},
events: ['scroll', 'load', 'resize']
}
]
};
function getMarginTop(root, cls) {
var nodes = toNodes(root.children);
var ref = nodes.filter(function (el) { return hasClass(el, cls); });
var node = ref[0];
return toFloat(node
? css(node, 'marginTop')
: css(nodes[0], 'paddingLeft'));
}
function maxColumnHeight(rows) {
return Math.max.apply(Math, rows.reduce(function (sum, row) {
row.forEach(function (el, i) { return sum[i] = (sum[i] || 0) + el.offsetHeight; });
return sum;
}, []));
}
var HeightMatch = {
args: 'target',
props: {
target: String,
row: Boolean
},
data: {
target: '> *',
row: true
},
computed: {
elements: function(ref, $el) {
var target = ref.target;
return $$(target, $el);
}
},
update: {
read: function() {
var this$1 = this;
css(this.elements, {
minHeight: '',
boxSizing: ''
});
return {
rows: !this.row
? [this.match(this.elements)]
: getRows(this.elements).map(function (elements) { return this$1.match(elements); })
};
},
write: function(ref) {
var rows = ref.rows;
rows.forEach(function (ref) {
var height$$1 = ref.height;
var elements = ref.elements;
return css(elements, {
minHeight: height$$1,
boxSizing: 'border-box'
});
});
},
events: ['load', 'resize']
},
methods: {
match: function(elements) {
if (elements.length < 2) {
return {};
}
var heights = [];
var max = 0;
elements
.forEach(function (el) {
var ref = offset(el);
var height$$1 = ref.height;
max = Math.max(max, height$$1);
heights.push(height$$1);
});
elements = elements.filter(function (el, i) { return heights[i] < max; });
return {height: max, elements: elements};
}
}
};
var HeightViewport = {
props: {
expand: Boolean,
offsetTop: Boolean,
offsetBottom: Boolean,
minHeight: Number
},
data: {
expand: false,
offsetTop: false,
offsetBottom: false,
minHeight: 0
},
connected: function() {
css(this.$el, 'boxSizing', 'border-box');
},
update: {
read: function() {
var viewport = height(window);
var minHeight = '';
if (this.expand) {
minHeight = viewport - (offsetHeight(document.documentElement) - offsetHeight(this.$el)) || '';
} else {
var ref = offset(this.$el);
var top = ref.top;
// on mobile devices (iOS and Android) window.innerHeight !== 100vh
minHeight = 'calc(100vh';
if (top < viewport / 2 && this.offsetTop) {
minHeight += " - " + top + "px";
}
if (this.offsetBottom === true) {
minHeight += " - " + (offsetHeight(this.$el.nextElementSibling)) + "px";
} else if (isNumeric(this.offsetBottom)) {
minHeight += " - " + (this.offsetBottom) + "vh";
} else if (this.offsetBottom && endsWith(this.offsetBottom, 'px')) {
minHeight += " - " + (toFloat(this.offsetBottom)) + "px";
} else if (isString(this.offsetBottom)) {
minHeight += " - " + (offsetHeight(query(this.offsetBottom, this.$el))) + "px";
}
minHeight += ')';
}
return {minHeight: minHeight, viewport: viewport};
},
write: function(ref) {
var minHeight = ref.minHeight;
css(this.$el, {height: '', minHeight: minHeight});
if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
css(this.$el, 'minHeight', this.minHeight);
}
// IE 11 fix (min-height on a flex container won't apply to its flex items)
var height$$1;
if (/* isIE && */(height$$1 = Math.round(toFloat(css(this.$el, 'minHeight')))) >= offsetHeight(this.$el)) {
css(this.$el, 'height', height$$1);
}
},
events: ['load', 'resize']
}
};
function offsetHeight(el) {
return el && el.offsetHeight || 0;
}
var svgs = {};
var SVG = {
props: {
id: String,
icon: String,
src: String,
style: String,
width: Number,
height: Number,
ratio: Number,
'class': String
},
data: {
ratio: 1,
id: false,
exclude: ['ratio', 'src', 'icon'],
'class': ''
},
connected: function() {
var this$1 = this;
var assign$$1;
this.class += ' uk-svg';
if (!this.icon && includes(this.src, '#')) {
var parts = this.src.split('#');
if (parts.length > 1) {
(assign$$1 = parts, this.src = assign$$1[0], this.icon = assign$$1[1]);
}
}
this.svg = this.getSvg().then(function (svg) {
var el;
if (isString(svg)) {
if (this$1.icon && includes(svg, '<symbol')) {
svg = parseSymbols(svg, this$1.icon) || svg;
}
el = $(svg.substr(svg.indexOf('<svg')));
} else {
el = svg.cloneNode(true);
}
if (!el) {
return Promise.reject('SVG not found.');
}
var dimensions = attr(el, 'viewBox');
if (dimensions) {
dimensions = dimensions.split(' ');
this$1.width = this$1.$props.width || dimensions[2];
this$1.height = this$1.$props.height || dimensions[3];
}
this$1.width *= this$1.ratio;
this$1.height *= this$1.ratio;
for (var prop in this$1.$options.props) {
if (this$1[prop] && !includes(this$1.exclude, prop)) {
attr(el, prop, this$1[prop]);
}
}
if (!this$1.id) {
removeAttr(el, 'id');
}
if (this$1.width && !this$1.height) {
removeAttr(el, 'height');
}
if (this$1.height && !this$1.width) {
removeAttr(el, 'width');
}
var root = this$1.$el;
if (isVoidElement(root) || root.tagName === 'CANVAS') {
attr(root, {hidden: true, id: null});
var next = root.nextElementSibling;
if (next && el.isEqualNode(next)) {
el = next;
} else {
after(root, el);
}
} else {
var last = root.lastElementChild;
if (last && el.isEqualNode(last)) {
el = last;
} else {
append(root, el);
}
}
this$1.svgEl = el;
return el;
}, noop);
},
disconnected: function() {
var this$1 = this;
if (isVoidElement(this.$el)) {
attr(this.$el, {hidden: null, id: this.id || null});
}
if (this.svg) {
this.svg.then(function (svg) { return (!this$1._connected || svg !== this$1.svgEl) && remove(svg); }, noop);
}
this.svg = this.svgEl = null;
},
methods: {
getSvg: function() {
var this$1 = this;
if (!this.src) {
return Promise.reject();
}
if (svgs[this.src]) {
return svgs[this.src];
}
svgs[this.src] = new Promise(function (resolve, reject) {
if (startsWith(this$1.src, 'data:')) {
resolve(decodeURIComponent(this$1.src.split(',')[1]));
} else {
ajax(this$1.src).then(
function (xhr) { return resolve(xhr.response); },
function () { return reject('SVG not found.'); }
);
}
});
return svgs[this.src];
}
}
};
var symbolRe = /<symbol(.*?id=(['"])(.*?)\2[^]*?<\/)symbol>/g;
var symbols = {};
function parseSymbols(svg, icon) {
if (!symbols[svg]) {
symbols[svg] = {};
var match;
while ((match = symbolRe.exec(svg))) {
symbols[svg][match[3]] = "<svg xmlns=\"http://www.w3.org/2000/svg\"" + (match[1]) + "svg>";
}
symbolRe.lastIndex = 0;
}
return symbols[svg][icon];
}
var closeIcon = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"1\" y1=\"1\" x2=\"13\" y2=\"13\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"13\" y1=\"1\" x2=\"1\" y2=\"13\"/></svg>";
var closeLarge = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"1\" y1=\"1\" x2=\"19\" y2=\"19\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"19\" y1=\"1\" x2=\"1\" y2=\"19\"/></svg>";
var marker = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"9\" y=\"4\" width=\"1\" height=\"11\"/><rect x=\"4\" y=\"9\" width=\"11\" height=\"1\"/></svg>";
var navbarToggleIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect y=\"9\" width=\"20\" height=\"2\"/><rect y=\"3\" width=\"20\" height=\"2\"/><rect y=\"15\" width=\"20\" height=\"2\"/></svg>";
var overlayIcon = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"19\" y=\"0\" width=\"1\" height=\"40\"/><rect x=\"0\" y=\"19\" width=\"40\" height=\"1\"/></svg>";
var paginationNext = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 1 6 6 1 11\"/></svg>";
var paginationPrevious = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"6 1 1 6 6 11\"/></svg>";
var searchIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"9\" cy=\"9\" r=\"7\"/><path fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" d=\"M14,14 L18,18 L14,14 Z\"/></svg>";
var searchLarge = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" cx=\"17.5\" cy=\"17.5\" r=\"16.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" x1=\"38\" y1=\"39\" x2=\"29\" y2=\"30\"/></svg>";
var searchNavbar = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"10.5\" cy=\"10.5\" r=\"9.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"23\" y1=\"23\" x2=\"17\" y2=\"17\"/></svg>";
var slidenavNext = "<svg width=\"14px\" height=\"24px\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"1.225,23 12.775,12 1.225,1 \"/></svg>";
var slidenavNextLarge = "<svg width=\"25px\" height=\"40px\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"4.002,38.547 22.527,20.024 4,1.5 \"/></svg>";
var slidenavPrevious = "<svg width=\"14px\" height=\"24px\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"12.775,1 1.225,12 12.775,23 \"/></svg>";
var slidenavPreviousLarge = "<svg width=\"25px\" height=\"40px\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"20.527,1.5 2,20.024 20.525,38.547 \"/></svg>";
var spinner = "<svg width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" cx=\"15\" cy=\"15\" r=\"14\"/></svg>";
var totop = "<svg width=\"18\" height=\"10\" viewBox=\"0 0 18 10\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 9 9 1 17 9 \"/></svg>";
var parsed = {};
var icons = {
spinner: spinner,
totop: totop,
marker: marker,
'close-icon': closeIcon,
'close-large': closeLarge,
'navbar-toggle-icon': navbarToggleIcon,
'overlay-icon': overlayIcon,
'pagination-next': paginationNext,
'pagination-previous': paginationPrevious,
'search-icon': searchIcon,
'search-large': searchLarge,
'search-navbar': searchNavbar,
'slidenav-next': slidenavNext,
'slidenav-next-large': slidenavNextLarge,
'slidenav-previous': slidenavPrevious,
'slidenav-previous-large': slidenavPreviousLarge
};
var Icon = {
install: install,
attrs: ['icon', 'ratio'],
mixins: [Class, SVG],
args: 'icon',
props: ['icon'],
data: {exclude: ['id', 'style', 'class', 'src', 'icon', 'ratio']},
isIcon: true,
connected: function() {
addClass(this.$el, 'uk-icon');
},
methods: {
getSvg: function() {
var icon = getIcon(applyRtl(this.icon));
if (!icon) {
return Promise.reject('Icon not found.');
}
return Promise.resolve(icon);
}
}
};
var IconComponent = {
extends: Icon,
data: function (vm) { return ({
icon: hyphenate(vm.constructor.options.name)
}); }
};
var Slidenav = {
extends: IconComponent,
connected: function() {
addClass(this.$el, 'uk-slidenav');
},
computed: {
icon: function(ref, $el) {
var icon = ref.icon;
return hasClass($el, 'uk-slidenav-large')
? (icon + "-large")
: icon;
}
}
};
var Search = {
extends: IconComponent,
computed: {
icon: function(ref, $el) {
var icon = ref.icon;
return hasClass($el, 'uk-search-icon') && parents($el, '.uk-search-large').length
? 'search-large'
: parents($el, '.uk-search-navbar').length
? 'search-navbar'
: icon;
}
}
};
var Close = {
extends: IconComponent,
computed: {
icon: function() {
return ("close-" + (hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'));
}
}
};
var Spinner = {
extends: IconComponent,
connected: function() {
var this$1 = this;
this.svg.then(function (svg) { return this$1.ratio !== 1 && css($('circle', svg), 'strokeWidth', 1 / this$1.ratio); }, noop);
}
};
function install(UIkit) {
UIkit.icon.add = function (name, svg) {
var obj;
var added = isString(name) ? (( obj = {}, obj[name] = svg, obj )) : name;
each(added, function (svg, name) {
icons[name] = svg;
delete parsed[name];
});
if (UIkit._initialized) {
apply(document.body, function (el) { return each(UIkit.getComponents(el), function (cmp) { return cmp.$options.isIcon && cmp.icon in added && cmp.$reset(); }
); }
);
}
};
}
function getIcon(icon) {
if (!icons[icon]) {
return null;
}
if (!parsed[icon]) {
parsed[icon] = $(icons[icon].trim());
}
return parsed[icon];
}
function applyRtl(icon) {
return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
}
var Img = {
props: {
dataSrc: String,
dataSrcset: Boolean,
sizes: String,
width: Number,
height: Number,
offsetTop: String,
offsetLeft: String,
target: String
},
data: {
dataSrc: '',
dataSrcset: false,
sizes: false,
width: false,
height: false,
offsetTop: '50vh',
offsetLeft: 0,
target: false
},
computed: {
cacheKey: function(ref) {
var dataSrc = ref.dataSrc;
return ((this.$name) + "." + dataSrc);
},
width: function(ref) {
var width$$1 = ref.width;
var dataWidth = ref.dataWidth;
return width$$1 || dataWidth;
},
height: function(ref) {
var height$$1 = ref.height;
var dataHeight = ref.dataHeight;
return height$$1 || dataHeight;
},
sizes: function(ref) {
var sizes = ref.sizes;
var dataSizes = ref.dataSizes;
return sizes || dataSizes;
},
isImg: function(_, $el) {
return isImg($el);
},
target: function(ref) {
var target = ref.target;
return [this.$el].concat(queryAll(target, this.$el));
},
offsetTop: function(ref) {
var offsetTop = ref.offsetTop;
return toPx(offsetTop, 'height');
},
offsetLeft: function(ref) {
var offsetLeft = ref.offsetLeft;
return toPx(offsetLeft, 'width');
}
},
connected: function() {
if (storage[this.cacheKey]) {
setSrcAttrs(this.$el, storage[this.cacheKey] || this.dataSrc, this.dataSrcset, this.sizes);
} else if (this.isImg && this.width && this.height) {
setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
}
},
update: [
{
read: function(ref) {
var this$1 = this;
var delay = ref.delay;
var image = ref.image;
if (!delay) {
return;
}
if (image || !this.target.some(function (el) { return isInView(el, this$1.offsetTop, this$1.offsetLeft, true); })) {
if (!this.isImg && image) {
image.then(function (img) { return img && setSrcAttrs(this$1.$el, currentSrc(img)); });
}
return;
}
return {
image: getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) {
setSrcAttrs(this$1.$el, currentSrc(img), img.srcset, img.sizes);
storage[this$1.cacheKey] = currentSrc(img);
return img;
}, noop)
};
},
write: function(data$$1) {
// Give placeholder images time to apply their dimensions
if (!data$$1.delay) {
this.$emit();
return data$$1.delay = true;
}
},
events: ['scroll', 'load', 'resize']
}
]
};
function setSrcAttrs(el, src, srcset, sizes) {
if (isImg(el)) {
sizes && (el.sizes = sizes);
srcset && (el.srcset = srcset);
src && (el.src = src);
} else if (src) {
var change = !includes(el.style.backgroundImage, src);
css(el, 'backgroundImage', ("url(" + src + ")"));
if (change) {
trigger(el, createEvent('load', false));
}
}
}
var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
function getPlaceholderImage(width$$1, height$$1, sizes) {
var assign$$1;
if (sizes) {
var matches$$1;
while ((matches$$1 = sizesRe.exec(sizes))) {
if (!matches$$1[1] || window.matchMedia(matches$$1[1]).matches) {
matches$$1 = evaluateSize(matches$$1[2]);
break;
}
}
sizesRe.lastIndex = 0;
((assign$$1 = Dimensions.ratio({width: width$$1, height: height$$1}, 'width', toPx(matches$$1 || '100vw')), width$$1 = assign$$1.width, height$$1 = assign$$1.height));
}
return ("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width$$1 + "\" height=\"" + height$$1 + "\"></svg>");
}
var sizeRe = /\d+(?:\w+|%)/g;
var additionRe = /[+-]?(\d+)/g;
function evaluateSize(size) {
return startsWith(size, 'calc')
? size
.substring(5, size.length - 1)
.replace(sizeRe, function (size) { return toPx(size); })
.replace(/ /g, '')
.match(additionRe)
.reduce(function (a, b) { return a + +b; }, 0)
: size;
}
function toPx(value, property, element) {
if ( property === void 0 ) property = 'width';
if ( element === void 0 ) element = window;
return isNumeric(value)
? +value
: endsWith(value, 'vw')
? percent(element, 'width', value)
: endsWith(value, 'vh')
? percent(element, 'height', value)
: endsWith(value, '%')
? percent(element, property, value)
: toFloat(value);
}
var dimensions = {height: height, width: width};
function percent(element, property, value) {
return dimensions[property](element) * toFloat(value) / 100;
}
function isImg(el) {
return el.tagName === 'IMG';
}
function currentSrc(el) {
return el.currentSrc || el.src;
}
var key = '__test__';
var storage;
// workaround for Safari's private browsing mode and accessing sessionStorage in Blink
try {
storage = window.sessionStorage || {};
storage[key] = 1;
delete storage[key];
} catch (e) {
storage = {};
}
var Leader = {
mixins: [Class],
props: {
fill: String,
media: 'media'
},
data: {
fill: '',
media: false,
clsWrapper: 'uk-leader-fill',
clsHide: 'uk-leader-hide',
attrFill: 'data-fill'
},
computed: {
fill: function(ref) {
var fill = ref.fill;
return fill || getCssVar('leader-fill');
}
},
connected: function() {
var assign$$1;
(assign$$1 = wrapInner(this.$el, ("<span class=\"" + (this.clsWrapper) + "\">")), this.wrapper = assign$$1[0]);
},
disconnected: function() {
unwrap(this.wrapper.childNodes);
},
update: [
{
read: function(ref) {
var changed = ref.changed;
var width$$1 = ref.width;
var prev = width$$1;
width$$1 = Math.floor(this.$el.offsetWidth / 2);
return {
width: width$$1,
changed: changed || prev !== width$$1,
hide: this.media && !window.matchMedia(this.media).matches
};
},
write: function(data$$1) {
toggleClass(this.wrapper, this.clsHide, data$$1.hide);
if (data$$1.changed) {
data$$1.changed = false;
attr(this.wrapper, this.attrFill, new Array(data$$1.width).join(this.fill));
}
},
events: ['load', 'resize']
}
]
};
var Container = {
props: {
container: Boolean
},
data: {
container: true
},
computed: {
container: function(ref) {
var container = ref.container;
return container === true && this.$container || container && $(container);
}
}
};
var active$1;
var Modal = {
mixins: [Class, Container, Togglable],
props: {
selPanel: String,
selClose: String,
escClose: Boolean,
bgClose: Boolean,
stack: Boolean
},
data: {
cls: 'uk-open',
escClose: true,
bgClose: true,
overlay: true,
stack: false
},
computed: {
panel: function(ref, $el) {
var selPanel = ref.selPanel;
return $(selPanel, $el);
},
transitionElement: function() {
return this.panel;
},
transitionDuration: function() {
return toMs(css(this.transitionElement, 'transitionDuration'));
},
bgClose: function(ref) {
var bgClose = ref.bgClose;
return bgClose && this.panel;
}
},
events: [
{
name: 'click',
delegate: function() {
return this.selClose;
},
handler: function(e) {
e.preventDefault();
this.hide();
}
},
{
name: 'toggle',
self: true,
handler: function(e) {
if (e.defaultPrevented) {
return;
}
e.preventDefault();
this.toggle();
}
},
{
name: 'beforeshow',
self: true,
handler: function(e) {
var prev = active$1 && active$1 !== this && active$1;
active$1 = this;
if (prev) {
if (this.stack) {
this.prev = prev;
} else {
prev.hide().then(this.show);
e.preventDefault();
return;
}
}
registerEvents();
}
},
{
name: 'beforehide',
self: true,
handler: function() {
active$1 = active$1 && active$1 !== this && active$1 || this.prev;
if (!active$1) {
deregisterEvents();
}
}
},
{
name: 'show',
self: true,
handler: function() {
if (!hasClass(document.documentElement, this.clsPage)) {
this.scrollbarWidth = width(window) - width(document);
css(document.body, 'overflowY', this.scrollbarWidth && this.overlay ? 'scroll' : '');
}
addClass(document.documentElement, this.clsPage);
}
},
{
name: 'hidden',
self: true,
handler: function() {
var this$1 = this;
var found;
var ref = this;
var prev = ref.prev;
while (prev) {
if (prev.clsPage === this$1.clsPage) {
found = true;
break;
}
prev = prev.prev;
}
if (!found) {
removeClass(document.documentElement, this.clsPage);
}
!this.prev && css(document.body, 'overflowY', '');
}
}
],
methods: {
toggle: function() {
return this.isToggled() ? this.hide() : this.show();
},
show: function() {
if (this.isToggled()) {
return Promise.resolve();
}
if (this.container && this.$el.parentNode !== this.container) {
append(this.container, this.$el);
this._callConnected();
}
return this.toggleNow(this.$el, true);
},
hide: function() {
return this.isToggled()
? this.toggleNow(this.$el, false)
: Promise.resolve();
},
getActive: function() {
return active$1;
},
_toggleImmediate: function(el, show) {
var this$1 = this;
return new Promise(function (resolve) { return requestAnimationFrame(function () {
this$1._toggle(el, show);
if (this$1.transitionDuration) {
once(this$1.transitionElement, 'transitionend', resolve, false, function (e) { return e.target === this$1.transitionElement; });
} else {
resolve();
}
}); }
);
}
}
};
var events;
function registerEvents() {
if (events) {
return;
}
events = [
on(document, 'click', function (ref) {
var target = ref.target;
var defaultPrevented = ref.defaultPrevented;
if (active$1 && active$1.bgClose && !defaultPrevented && (!active$1.overlay || within(target, active$1.$el)) && !within(target, active$1.panel)) {
active$1.hide();
}
}),
on(document, 'keydown', function (e) {
if (e.keyCode === 27 && active$1 && active$1.escClose) {
e.preventDefault();
active$1.hide();
}
})
];
}
function deregisterEvents() {
events && events.forEach(function (unbind) { return unbind(); });
events = null;
}
var Modal$1 = {
install: install$1,
mixins: [Modal],
data: {
clsPage: 'uk-modal-page',
selPanel: '.uk-modal-dialog',
selClose: '.uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full'
},
events: [
{
name: 'show',
self: true,
handler: function() {
if (hasClass(this.panel, 'uk-margin-auto-vertical')) {
addClass(this.$el, 'uk-flex');
} else {
css(this.$el, 'display', 'block');
}
height(this.$el); // force reflow
}
},
{
name: 'hidden',
self: true,
handler: function() {
css(this.$el, 'display', '');
removeClass(this.$el, 'uk-flex');
}
}
]
};
function install$1 (UIkit) {
UIkit.modal.dialog = function (content, options) {
var dialog = UIkit.modal((" <div class=\"uk-modal\"> <div class=\"uk-modal-dialog\">" + content + "</div> </div> "), options);
dialog.show();
on(dialog.$el, 'hidden', function (ref) {
var target = ref.target;
var currentTarget = ref.currentTarget;
if (target === currentTarget) {
dialog.$destroy(true);
}
});
return dialog;
};
UIkit.modal.alert = function (message, options) {
options = assign({bgClose: false, escClose: false, labels: UIkit.modal.labels}, options);
return new Promise(
function (resolve) { return on(UIkit.modal.dialog((" <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-primary uk-modal-close\" autofocus>" + (options.labels.ok) + "</button> </div> "), options).$el, 'hide', resolve); }
);
};
UIkit.modal.confirm = function (message, options) {
options = assign({bgClose: false, escClose: true, labels: UIkit.modal.labels}, options);
return new Promise(function (resolve, reject) {
var confirm = UIkit.modal.dialog((" <form> <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (options.labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\" autofocus>" + (options.labels.ok) + "</button> </div> </form> "), options);
var resolved = false;
on(confirm.$el, 'submit', 'form', function (e) {
e.preventDefault();
resolve();
resolved = true;
confirm.hide();
});
on(confirm.$el, 'hide', function () {
if (!resolved) {
reject();
}
});
});
};
UIkit.modal.prompt = function (message, value, options) {
options = assign({bgClose: false, escClose: true, labels: UIkit.modal.labels}, options);
return new Promise(function (resolve) {
var prompt = UIkit.modal.dialog((" <form class=\"uk-form-stacked\"> <div class=\"uk-modal-body\"> <label>" + (isString(message) ? message : html(message)) + "</label> <input class=\"uk-input\" autofocus> </div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (options.labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\">" + (options.labels.ok) + "</button> </div> </form> "), options),
input = $('input', prompt.$el);
input.value = value;
var resolved = false;
on(prompt.$el, 'submit', 'form', function (e) {
e.preventDefault();
resolve(input.value);
resolved = true;
prompt.hide();
});
on(prompt.$el, 'hide', function () {
if (!resolved) {
resolve(null);
}
});
});
};
UIkit.modal.labels = {
ok: 'Ok',
cancel: 'Cancel'
};
}
var Nav = {
extends: Accordion,
data: {
targets: '> .uk-parent',
toggle: '> a',
content: '> ul'
}
};
var Navbar = {
mixins: [Class],
props: {
dropdown: String,
mode: 'list',
align: String,
offset: Number,
boundary: Boolean,
boundaryAlign: Boolean,
clsDrop: String,
delayShow: Number,
delayHide: Number,
dropbar: Boolean,
dropbarMode: String,
dropbarAnchor: Boolean,
duration: Number
},
data: {
dropdown: '.uk-navbar-nav > li',
align: !isRtl ? 'left' : 'right',
clsDrop: 'uk-navbar-dropdown',
mode: undefined,
offset: undefined,
delayShow: undefined,
delayHide: undefined,
boundaryAlign: undefined,
flip: 'x',
boundary: true,
dropbar: false,
dropbarMode: 'slide',
dropbarAnchor: false,
duration: 200,
},
computed: {
boundary: function(ref, $el) {
var boundary = ref.boundary;
var boundaryAlign = ref.boundaryAlign;
return (boundary === true || boundaryAlign) ? $el : boundary;
},
dropbarAnchor: function(ref, $el) {
var dropbarAnchor = ref.dropbarAnchor;
return query(dropbarAnchor, $el);
},
pos: function(ref) {
var align = ref.align;
return ("bottom-" + align);
},
dropdowns: function(ref, $el) {
var dropdown = ref.dropdown;
var clsDrop = ref.clsDrop;
return $$((dropdown + " ." + clsDrop), $el);
}
},
beforeConnect: function() {
var ref = this.$props;
var dropbar = ref.dropbar;
this.dropbar = dropbar && (query(dropbar, this.$el) || $('+ .uk-navbar-dropbar', this.$el) || $('<div></div>'));
if (this.dropbar) {
addClass(this.dropbar, 'uk-navbar-dropbar');
if (this.dropbarMode === 'slide') {
addClass(this.dropbar, 'uk-navbar-dropbar-slide');
}
}
},
disconnected: function() {
this.dropbar && remove(this.dropbar);
},
update: function() {
var this$1 = this;
this.$create(
'drop',
this.dropdowns.filter(function (el) { return !this$1.getDropdown(el); }),
assign({}, this.$props, {boundary: this.boundary, pos: this.pos, offset: this.dropbar || this.offset})
);
},
events: [
{
name: 'mouseover',
delegate: function() {
return this.dropdown;
},
handler: function(ref) {
var current = ref.current;
var active = this.getActive();
if (active && active.toggle && !within(active.toggle.$el, current) && !active.tracker.movesTo(active.$el)) {
active.hide(false);
}
}
},
{
name: 'mouseleave',
el: function() {
return this.dropbar;
},
handler: function() {
var active = this.getActive();
if (active && !matches(this.dropbar, ':hover')) {
active.hide();
}
}
},
{
name: 'beforeshow',
capture: true,
filter: function() {
return this.dropbar;
},
handler: function() {
if (!this.dropbar.parentNode) {
after(this.dropbarAnchor || this.$el, this.dropbar);
}
}
},
{
name: 'show',
capture: true,
filter: function() {
return this.dropbar;
},
handler: function(_, drop) {
var $el = drop.$el;
var dir = drop.dir;
this.clsDrop && addClass($el, ((this.clsDrop) + "-dropbar"));
if (dir === 'bottom') {
this.transitionTo($el.offsetHeight + toFloat(css($el, 'marginTop')) + toFloat(css($el, 'marginBottom')), $el);
}
}
},
{
name: 'beforehide',
filter: function() {
return this.dropbar;
},
handler: function(e, ref) {
var $el = ref.$el;
var active = this.getActive();
if (matches(this.dropbar, ':hover') && active && active.$el === $el) {
e.preventDefault();
}
}
},
{
name: 'hide',
filter: function() {
return this.dropbar;
},
handler: function(_, ref) {
var $el = ref.$el;
var active = this.getActive();
if (!active || active && active.$el === $el) {
this.transitionTo(0);
}
}
}
],
methods: {
getActive: function() {
var ref = this.dropdowns.map(this.getDropdown).filter(function (drop) { return drop.isActive(); });
var active = ref[0];
return active && includes(active.mode, 'hover') && within(active.toggle.$el, this.$el) && active;
},
transitionTo: function(newHeight, el) {
var ref = this;
var dropbar = ref.dropbar;
var oldHeight = isVisible(dropbar) ? height(dropbar) : 0;
el = oldHeight < newHeight && el;
css(el, 'clip', ("rect(0," + (el.offsetWidth) + "px," + oldHeight + "px,0)"));
height(dropbar, oldHeight);
Transition.cancel([el, dropbar]);
return Promise.all([
Transition.start(dropbar, {height: newHeight}, this.duration),
Transition.start(el, {clip: ("rect(0," + (el.offsetWidth) + "px," + newHeight + "px,0)")}, this.duration)
])
.catch(noop)
.then(function () { return css(el, {clip: ''}); });
},
getDropdown: function(el) {
return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
}
}
};
var scroll;
var Offcanvas = {
mixins: [Modal],
args: 'mode',
props: {
content: String,
mode: String,
flip: Boolean,
overlay: Boolean
},
data: {
content: '.uk-offcanvas-content',
mode: 'slide',
flip: false,
overlay: false,
clsPage: 'uk-offcanvas-page',
clsContainer: 'uk-offcanvas-container',
selPanel: '.uk-offcanvas-bar',
clsFlip: 'uk-offcanvas-flip',
clsContent: 'uk-offcanvas-content',
clsContentAnimation: 'uk-offcanvas-content-animation',
clsSidebarAnimation: 'uk-offcanvas-bar-animation',
clsMode: 'uk-offcanvas',
clsOverlay: 'uk-offcanvas-overlay',
selClose: '.uk-offcanvas-close'
},
computed: {
content: function(ref) {
var content = ref.content;
return $(content) || document.body;
},
clsFlip: function(ref) {
var flip = ref.flip;
var clsFlip = ref.clsFlip;
return flip ? clsFlip : '';
},
clsOverlay: function(ref) {
var overlay = ref.overlay;
var clsOverlay = ref.clsOverlay;
return overlay ? clsOverlay : '';
},
clsMode: function(ref) {
var mode = ref.mode;
var clsMode = ref.clsMode;
return (clsMode + "-" + mode);
},
clsSidebarAnimation: function(ref) {
var mode = ref.mode;
var clsSidebarAnimation = ref.clsSidebarAnimation;
return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation;
},
clsContentAnimation: function(ref) {
var mode = ref.mode;
var clsContentAnimation = ref.clsContentAnimation;
return mode !== 'push' && mode !== 'reveal' ? '' : clsContentAnimation;
},
transitionElement: function(ref) {
var mode = ref.mode;
return mode === 'reveal' ? this.panel.parentNode : this.panel;
}
},
update: {
write: function() {
if (this.getActive() === this) {
if (this.overlay || this.clsContentAnimation) {
width(this.content, width(window) - this.scrollbarWidth);
}
if (this.overlay) {
height(this.content, height(window));
if (scroll) {
this.content.scrollTop = scroll.y;
}
}
}
},
events: ['resize']
},
events: [
{
name: 'click',
delegate: function() {
return 'a[href^="#"]';
},
handler: function(ref) {
var current = ref.current;
if (current.hash && $(current.hash, this.content)) {
scroll = null;
this.hide();
}
}
},
{
name: 'beforescroll',
filter: function() {
return this.overlay;
},
handler: function(e, scroll, target) {
if (scroll && target && this.isToggled() && $(target, this.content)) {
once(this.$el, 'hidden', function () { return scroll.scrollTo(target); });
e.preventDefault();
}
}
},
{
name: 'show',
self: true,
handler: function() {
scroll = scroll || {x: window.pageXOffset, y: window.pageYOffset};
if (this.mode === 'reveal' && !hasClass(this.panel, this.clsMode)) {
wrapAll(this.panel, '<div>');
addClass(this.panel.parentNode, this.clsMode);
}
css(document.documentElement, 'overflowY', (!this.clsContentAnimation || this.flip) && this.scrollbarWidth && this.overlay ? 'scroll' : '');
addClass(document.body, this.clsContainer, this.clsFlip, this.clsOverlay);
height(document.body); // force reflow
addClass(this.content, this.clsContentAnimation);
addClass(this.panel, this.clsSidebarAnimation, this.mode !== 'reveal' ? this.clsMode : '');
addClass(this.$el, this.clsOverlay);
css(this.$el, 'display', 'block');
height(this.$el); // force reflow
}
},
{
name: 'hide',
self: true,
handler: function() {
removeClass(this.content, this.clsContentAnimation);
var active = this.getActive();
if (this.mode === 'none' || active && active !== this && active !== this.prev) {
trigger(this.panel, 'transitionend');
}
}
},
{
name: 'hidden',
self: true,
handler: function() {
if (this.mode === 'reveal') {
unwrap(this.panel);
}
if (!this.overlay) {
scroll = {x: window.pageXOffset, y: window.pageYOffset};
} else if (!scroll) {
var ref = this.content;
var x = ref.scrollLeft;
var y = ref.scrollTop;
scroll = {x: x, y: y};
}
removeClass(this.panel, this.clsSidebarAnimation, this.clsMode);
removeClass(this.$el, this.clsOverlay);
css(this.$el, 'display', '');
removeClass(document.body, this.clsContainer, this.clsFlip, this.clsOverlay);
document.body.scrollTop = scroll.y;
css(document.documentElement, 'overflowY', '');
width(this.content, '');
height(this.content, '');
window.scroll(scroll.x, scroll.y);
scroll = null;
}
},
{
name: 'swipeLeft swipeRight',
handler: function(e) {
if (this.isToggled() && isTouch(e) && (e.type === 'swipeLeft' && !this.flip || e.type === 'swipeRight' && this.flip)) {
this.hide();
}
}
}
]
};
var OverflowAuto = {
mixins: [Class],
props: {
selContainer: String,
selContent: String,
},
data: {
selContainer: '.uk-modal',
selContent: '.uk-modal-dialog',
},
computed: {
container: function(ref, $el) {
var selContainer = ref.selContainer;
return closest($el, selContainer);
},
content: function(ref, $el) {
var selContent = ref.selContent;
return closest($el, selContent);
}
},
connected: function() {
css(this.$el, 'minHeight', 150);
},
update: {
read: function() {
if (!this.content || !this.container) {
return false;
}
return {
current: toFloat(css(this.$el, 'maxHeight')),
max: Math.max(150, height(this.container) - (offset(this.content).height - height(this.$el)))
};
},
write: function(ref) {
var current = ref.current;
var max = ref.max;
css(this.$el, 'maxHeight', max);
if (Math.round(current) !== Math.round(max)) {
trigger(this.$el, 'resize');
}
},
events: ['load', 'resize']
}
};
var Responsive = {
props: ['width', 'height'],
connected: function() {
addClass(this.$el, 'uk-responsive-width');
},
update: {
read: function() {
return isVisible(this.$el) && this.width && this.height
? {width: width(this.$el.parentNode), height: this.height}
: false;
},
write: function(dim) {
height(this.$el, Dimensions.contain({height: this.height, width: this.width}, dim).height);
},
events: ['load', 'resize']
}
};
var Scroll = {
props: {
duration: Number,
offset: Number
},
data: {
duration: 1000,
offset: 0
},
methods: {
scrollTo: function(el) {
var this$1 = this;
el = el && $(el) || document.body;
var docHeight = height(document);
var winHeight = height(window);
var target = offset(el).top - this.offset;
if (target + winHeight > docHeight) {
target = docHeight - winHeight;
}
if (!trigger(this.$el, 'beforescroll', [this, el])) {
return;
}
var start = Date.now();
var startY = window.pageYOffset;
var step = function () {
var currentY = startY + (target - startY) * ease(clamp((Date.now() - start) / this$1.duration));
scrollTop(window, currentY);
// scroll more if we have not reached our destination
if (currentY !== target) {
requestAnimationFrame(step);
} else {
trigger(this$1.$el, 'scrolled', [this$1, el]);
}
};
step();
}
},
events: {
click: function(e) {
if (e.defaultPrevented) {
return;
}
e.preventDefault();
this.scrollTo(escape(this.$el.hash).substr(1));
}
}
};
function ease(k) {
return 0.5 * (1 - Math.cos(Math.PI * k));
}
var Scrollspy = {
args: 'cls',
props: {
cls: 'list',
target: String,
hidden: Boolean,
offsetTop: Number,
offsetLeft: Number,
repeat: Boolean,
delay: Number
},
data: function () { return ({
cls: [],
target: false,
hidden: true,
offsetTop: 0,
offsetLeft: 0,
repeat: false,
delay: 0,
inViewClass: 'uk-scrollspy-inview'
}); },
computed: {
elements: function(ref, $el) {
var target = ref.target;
return target ? $$(target, $el) : [$el];
}
},
update: [
{
write: function() {
if (this.hidden) {
css(filter(this.elements, (":not(." + (this.inViewClass) + ")")), 'visibility', 'hidden');
}
}
},
{
read: function(els) {
var this$1 = this;
if (!els.delay) {
return;
}
this.elements.forEach(function (el, i) {
var elData = els[i];
if (!elData || elData.el !== el) {
var cls = data(el, 'uk-scrollspy-class');
elData = {el: el, toggles: cls && cls.split(',') || this$1.cls};
}
elData.show = isInView(el, this$1.offsetTop, this$1.offsetLeft);
els[i] = elData;
});
},
write: function(els) {
var this$1 = this;
// Let child components be applied at least once first
if (!els.delay) {
this.$emit();
return els.delay = true;
}
this.elements.forEach(function (el, i) {
var elData = els[i];
var cls = elData.toggles[i] || elData.toggles[0];
if (elData.show && !elData.inview && !elData.queued) {
var show = function () {
css(el, 'visibility', '');
addClass(el, this$1.inViewClass);
toggleClass(el, cls);
trigger(el, 'inview');
this$1.$update(el);
elData.inview = true;
elData.abort && elData.abort();
};
if (this$1.delay) {
elData.queued = true;
els.promise = (els.promise || Promise.resolve()).then(function () {
return !elData.inview && new Promise(function (resolve) {
var timer = setTimeout(function () {
show();
resolve();
}, els.promise || this$1.elements.length === 1 ? this$1.delay : 0);
elData.abort = function () {
clearTimeout(timer);
resolve();
elData.queued = false;
};
});
});
} else {
show();
}
} else if (!elData.show && (elData.inview || elData.queued) && this$1.repeat) {
elData.abort && elData.abort();
if (!elData.inview) {
return;
}
css(el, 'visibility', this$1.hidden ? 'hidden' : '');
removeClass(el, this$1.inViewClass);
toggleClass(el, cls);
trigger(el, 'outview');
this$1.$update(el);
elData.inview = false;
}
});
},
events: ['scroll', 'load', 'resize']
}
]
};
var ScrollspyNav = {
props: {
cls: String,
closest: String,
scroll: Boolean,
overflow: Boolean,
offset: Number
},
data: {
cls: 'uk-active',
closest: false,
scroll: false,
overflow: true,
offset: 0
},
computed: {
links: function(_, $el) {
return $$('a[href^="#"]', $el).filter(function (el) { return el.hash; });
},
elements: function() {
return this.closest ? closest(this.links, this.closest) : this.links;
},
targets: function() {
return $$(this.links.map(function (el) { return el.hash; }).join(','));
}
},
update: [
{
read: function() {
if (this.scroll) {
this.$create('scroll', this.links, {offset: this.offset || 0});
}
}
},
{
read: function(data$$1) {
var this$1 = this;
var scroll = window.pageYOffset + this.offset + 1;
var max = height(document) - height(window) + this.offset;
data$$1.active = false;
this.targets.every(function (el, i) {
var ref = offset(el);
var top = ref.top;
var last = i + 1 === this$1.targets.length;
if (!this$1.overflow && (i === 0 && top > scroll || last && top + el.offsetTop < scroll)) {
return false;
}
if (!last && offset(this$1.targets[i + 1]).top <= scroll) {
return true;
}
if (scroll >= max) {
for (var j = this$1.targets.length - 1; j > i; j--) {
if (isInView(this$1.targets[j])) {
el = this$1.targets[j];
break;
}
}
}
return !(data$$1.active = $(filter(this$1.links, ("[href=\"#" + (el.id) + "\"]"))));
});
},
write: function(ref) {
var active = ref.active;
this.links.forEach(function (el) { return el.blur(); });
removeClass(this.elements, this.cls);
if (active) {
trigger(this.$el, 'active', [active, addClass(this.closest ? closest(active, this.closest) : active, this.cls)]);
}
},
events: ['scroll', 'load', 'resize']
}
]
};
var Sticky = {
mixins: [Class],
props: {
top: null,
bottom: Boolean,
offset: Number,
animation: String,
clsActive: String,
clsInactive: String,
clsFixed: String,
clsBelow: String,
selTarget: String,
widthElement: Boolean,
showOnUp: Boolean,
media: 'media',
targetOffset: Number
},
data: {
top: 0,
bottom: false,
offset: 0,
animation: '',
clsActive: 'uk-active',
clsInactive: '',
clsFixed: 'uk-sticky-fixed',
clsBelow: 'uk-sticky-below',
selTarget: '',
widthElement: false,
showOnUp: false,
media: false,
targetOffset: false
},
computed: {
selTarget: function(ref, $el) {
var selTarget = ref.selTarget;
return selTarget && $(selTarget, $el) || $el;
},
widthElement: function(ref, $el) {
var widthElement = ref.widthElement;
return query(widthElement, $el) || this.placeholder;
}
},
connected: function() {
this.placeholder = $('+ .uk-sticky-placeholder', this.$el) || $('<div class="uk-sticky-placeholder"></div>');
if (!this.isActive) {
this.hide();
}
},
disconnected: function() {
if (this.isActive) {
this.isActive = false;
this.hide();
removeClass(this.selTarget, this.clsInactive);
}
remove(this.placeholder);
this.placeholder = null;
this.widthElement = null;
},
events: [
{
name: 'active',
self: true,
handler: function() {
replaceClass(this.selTarget, this.clsInactive, this.clsActive);
}
},
{
name: 'inactive',
self: true,
handler: function() {
replaceClass(this.selTarget, this.clsActive, this.clsInactive);
}
},
{
name: 'load hashchange popstate',
el: window,
handler: function() {
var this$1 = this;
if (!(this.targetOffset !== false && location.hash && window.pageYOffset > 0)) {
return;
}
var target = $(location.hash);
if (target) {
fastdom.read(function () {
var ref = offset(target);
var top = ref.top;
var elTop = offset(this$1.$el).top;
var elHeight = this$1.$el.offsetHeight;
if (this$1.isActive && elTop + elHeight >= top && elTop <= top + target.offsetHeight) {
scrollTop(window, top - elHeight - (isNumeric(this$1.targetOffset) ? this$1.targetOffset : 0) - this$1.offset);
}
});
}
}
}
],
update: [
{
read: function() {
return {
height: this.$el.offsetHeight,
top: offset(this.isActive ? this.placeholder : this.$el).top
};
},
write: function(ref) {
var height$$1 = ref.height;
var top = ref.top;
var ref$1 = this;
var placeholder = ref$1.placeholder;
css(placeholder, assign(
{height: css(this.$el, 'position') !== 'absolute' ? height$$1 : ''},
css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
));
if (!within(placeholder, document)) {
after(this.$el, placeholder);
attr(placeholder, 'hidden', '');
}
this.topOffset = top;
this.bottomOffset = this.topOffset + height$$1;
var bottom = parseProp('bottom', this);
this.top = Math.max(toFloat(parseProp('top', this)), this.topOffset) - this.offset;
this.bottom = bottom && bottom - height$$1;
this.inactive = this.media && !window.matchMedia(this.media).matches;
},
events: ['load', 'resize']
},
{
read: function(_, ref) {
var scrollY = ref.scrollY; if ( scrollY === void 0 ) scrollY = window.pageYOffset;
this.width = (isVisible(this.widthElement) ? this.widthElement : this.$el).offsetWidth;
return {
scroll: this.scroll = scrollY,
visible: isVisible(this.$el)
};
},
write: function(ref, ref$1) {
var this$1 = this;
var visible = ref.visible;
var scroll = ref.scroll;
if ( ref$1 === void 0 ) ref$1 = {};
var dir = ref$1.dir;
if (scroll < 0 || !visible || this.disabled || this.showOnUp && !dir) {
return;
}
if (this.inactive
|| scroll < this.top
|| this.showOnUp && (scroll <= this.top || dir === 'down' || dir === 'up' && !this.isActive && scroll <= this.bottomOffset)
) {
if (!this.isActive) {
return;
}
this.isActive = false;
if (this.animation && scroll > this.topOffset) {
Animation.cancel(this.$el);
Animation.out(this.$el, this.animation).then(function () { return this$1.hide(); }, noop);
} else {
this.hide();
}
} else if (this.isActive) {
this.update();
} else if (this.animation) {
Animation.cancel(this.$el);
this.show();
Animation.in(this.$el, this.animation).catch(noop);
} else {
this.show();
}
},
events: ['load', 'resize', 'scroll']
} ],
methods: {
show: function() {
this.isActive = true;
this.update();
attr(this.placeholder, 'hidden', null);
},
hide: function() {
if (!this.isActive || hasClass(this.selTarget, this.clsActive)) {
trigger(this.$el, 'inactive');
}
removeClass(this.$el, this.clsFixed, this.clsBelow);
css(this.$el, {position: '', top: '', width: ''});
attr(this.placeholder, 'hidden', '');
},
update: function() {
var active = this.top !== 0 || this.scroll > this.top;
var top = Math.max(0, this.offset);
if (this.bottom && this.scroll > this.bottom - this.offset) {
top = this.bottom - this.scroll;
}
css(this.$el, {
position: 'fixed',
top: (top + "px"),
width: this.width
});
if (hasClass(this.selTarget, this.clsActive)) {
if (!active) {
trigger(this.$el, 'inactive');
}
} else if (active) {
trigger(this.$el, 'active');
}
toggleClass(this.$el, this.clsBelow, this.scroll > this.bottomOffset);
addClass(this.$el, this.clsFixed);
}
}
};
function parseProp(prop, ref) {
var $props = ref.$props;
var $el = ref.$el;
var propOffset = ref[(prop + "Offset")];
var value = $props[prop];
if (!value) {
return;
}
if (isNumeric(value)) {
return propOffset + toFloat(value);
} else if (isString(value) && value.match(/^-?\d+vh$/)) {
return height(window) * toFloat(value) / 100;
} else {
var el = value === true ? $el.parentNode : query(value, $el);
if (el) {
return offset(el).top + el.offsetHeight;
}
}
}
var Switcher = {
mixins: [Togglable],
args: 'connect',
props: {
connect: String,
toggle: String,
active: Number,
swiping: Boolean
},
data: {
connect: '~.uk-switcher',
toggle: '> *',
active: 0,
swiping: true,
cls: 'uk-active',
clsContainer: 'uk-switcher',
attrItem: 'uk-switcher-item',
queued: true
},
computed: {
connects: function(ref, $el) {
var connect = ref.connect;
return queryAll(connect, $el);
},
toggles: function(ref, $el) {
var toggle = ref.toggle;
return $$(toggle, $el);
}
},
events: [
{
name: 'click',
delegate: function() {
return ((this.toggle) + ":not(.uk-disabled)");
},
handler: function(e) {
e.preventDefault();
this.show(e.current);
}
},
{
name: 'click',
el: function() {
return this.connects;
},
delegate: function() {
return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]");
},
handler: function(e) {
e.preventDefault();
this.show(data(e.current, this.attrItem));
}
},
{
name: 'swipeRight swipeLeft',
filter: function() {
return this.swiping;
},
el: function() {
return this.connects;
},
handler: function(e) {
if (!isTouch(e)) {
return;
}
e.preventDefault();
if (!window.getSelection().toString()) {
this.show(e.type === 'swipeLeft' ? 'next' : 'previous');
}
}
}
],
update: function() {
var this$1 = this;
this.connects.forEach(function (list) { return this$1.updateAria(list.children); });
this.show(filter(this.toggles, ("." + (this.cls)))[0] || this.toggles[this.active] || this.toggles[0]);
},
methods: {
index: function() {
return !!this.connects.length && index(filter(this.connects[0].children, ("." + (this.cls)))[0]);
},
show: function(item) {
var this$1 = this;
var ref = this.toggles;
var length = ref.length;
var prev = this.index();
var hasPrev = prev >= 0;
var dir = item === 'previous' ? -1 : 1;
var toggle, next = getIndex(item, this.toggles, prev);
for (var i = 0; i < length; i++, next = (next + dir + length) % length) {
if (!matches(this$1.toggles[next], '.uk-disabled, [disabled]')) {
toggle = this$1.toggles[next];
break;
}
}
if (!toggle || prev >= 0 && hasClass(toggle, this.cls) || prev === next) {
return;
}
removeClass(this.toggles, this.cls);
attr(this.toggles, 'aria-expanded', false);
addClass(toggle, this.cls);
attr(toggle, 'aria-expanded', true);
this.connects.forEach(function (list) {
if (!hasPrev) {
this$1.toggleNow(list.children[next]);
} else {
this$1.toggleElement([list.children[prev], list.children[next]]);
}
});
}
}
};
var Tab = {
mixins: [Class],
extends: Switcher,
props: {
media: 'media'
},
data: {
media: 960,
attrItem: 'uk-tab-item'
},
connected: function() {
var cls = hasClass(this.$el, 'uk-tab-left')
? 'uk-tab-left'
: hasClass(this.$el, 'uk-tab-right')
? 'uk-tab-right'
: false;
if (cls) {
this.$create('toggle', this.$el, {cls: cls, mode: 'media', media: this.media});
}
}
};
var Toggle = {
mixins: [Togglable],
args: 'target',
props: {
href: String,
target: null,
mode: 'list',
media: 'media'
},
data: {
href: false,
target: false,
mode: 'click',
queued: true,
media: false
},
computed: {
target: function(ref, $el) {
var href = ref.href;
var target = ref.target;
target = queryAll(target || href, $el);
return target.length && target || [$el];
}
},
events: [
{
name: (pointerEnter + " " + pointerLeave),
filter: function() {
return includes(this.mode, 'hover');
},
handler: function(e) {
if (!isTouch(e)) {
this.toggle(("toggle" + (e.type === pointerEnter ? 'show' : 'hide')));
}
}
},
{
name: 'click',
filter: function() {
return includes(this.mode, 'click') || hasTouch && includes(this.mode, 'hover');
},
handler: function(e) {
if (!isTouch(e) && !includes(this.mode, 'click')) {
return;
}
// TODO better isToggled handling
var link;
if (closest(e.target, 'a[href="#"], button')
|| (link = closest(e.target, 'a[href]')) && (
this.cls
|| !isVisible(this.target)
|| link.hash && matches(this.target, link.hash)
)
) {
once(document, 'click', function (e) { return e.preventDefault(); });
}
this.toggle();
}
}
],
update: {
write: function() {
if (!includes(this.mode, 'media') || !this.media) {
return;
}
var toggled = this.isToggled(this.target);
if (window.matchMedia(this.media).matches ? !toggled : toggled) {
this.toggle();
}
},
events: ['load', 'resize']
},
methods: {
toggle: function(type) {
if (trigger(this.target, type || 'toggle', [this])) {
this.toggleElement(this.target);
}
}
}
};
function core (UIkit) {
// core components
UIkit.component('accordion', Accordion);
UIkit.component('alert', Alert);
UIkit.component('cover', Cover);
UIkit.component('drop', Drop);
UIkit.component('dropdown', Dropdown);
UIkit.component('formCustom', FormCustom);
UIkit.component('gif', Gif);
UIkit.component('grid', Grid);
UIkit.component('heightMatch', HeightMatch);
UIkit.component('heightViewport', HeightViewport);
UIkit.component('icon', Icon);
UIkit.component('img', Img);
UIkit.component('leader', Leader);
UIkit.component('margin', Margin);
UIkit.component('modal', Modal$1);
UIkit.component('nav', Nav);
UIkit.component('navbar', Navbar);
UIkit.component('offcanvas', Offcanvas);
UIkit.component('overflowAuto', OverflowAuto);
UIkit.component('responsive', Responsive);
UIkit.component('scroll', Scroll);
UIkit.component('scrollspy', Scrollspy);
UIkit.component('scrollspyNav', ScrollspyNav);
UIkit.component('sticky', Sticky);
UIkit.component('svg', SVG);
UIkit.component('switcher', Switcher);
UIkit.component('tab', Tab);
UIkit.component('toggle', Toggle);
UIkit.component('video', Video);
// Icon components
UIkit.component('close', Close);
UIkit.component('marker', IconComponent);
UIkit.component('navbarToggleIcon', IconComponent);
UIkit.component('overlayIcon', IconComponent);
UIkit.component('paginationNext', IconComponent);
UIkit.component('paginationPrevious', IconComponent);
UIkit.component('searchIcon', Search);
UIkit.component('slidenavNext', Slidenav);
UIkit.component('slidenavPrevious', Slidenav);
UIkit.component('spinner', Spinner);
UIkit.component('totop', IconComponent);
// core functionality
UIkit.use(Core);
}
UIkit.version = '3.0.0-rc.16';
core(UIkit);
var Countdown = {
mixins: [Class],
props: {
date: String,
clsWrapper: String
},
data: {
date: '',
clsWrapper: '.uk-countdown-%unit%'
},
computed: {
date: function(ref) {
var date = ref.date;
return Date.parse(date);
},
days: function(ref, $el) {
var clsWrapper = ref.clsWrapper;
return $(clsWrapper.replace('%unit%', 'days'), $el);
},
hours: function(ref, $el) {
var clsWrapper = ref.clsWrapper;
return $(clsWrapper.replace('%unit%', 'hours'), $el);
},
minutes: function(ref, $el) {
var clsWrapper = ref.clsWrapper;
return $(clsWrapper.replace('%unit%', 'minutes'), $el);
},
seconds: function(ref, $el) {
var clsWrapper = ref.clsWrapper;
return $(clsWrapper.replace('%unit%', 'seconds'), $el);
},
units: function() {
var this$1 = this;
return ['days', 'hours', 'minutes', 'seconds'].filter(function (unit) { return this$1[unit]; });
}
},
connected: function() {
this.start();
},
disconnected: function() {
var this$1 = this;
this.stop();
this.units.forEach(function (unit) { return empty(this$1[unit]); });
},
events: [
{
name: 'visibilitychange',
el: document,
handler: function() {
if (document.hidden) {
this.stop();
} else {
this.start();
}
}
}
],
update: {
write: function() {
var this$1 = this;
var timespan = getTimeSpan(this.date);
if (timespan.total <= 0) {
this.stop();
timespan.days
= timespan.hours
= timespan.minutes
= timespan.seconds
= 0;
}
this.units.forEach(function (unit) {
var digits = String(Math.floor(timespan[unit]));
digits = digits.length < 2 ? ("0" + digits) : digits;
var el = this$1[unit];
if (el.textContent !== digits) {
digits = digits.split('');
if (digits.length !== el.children.length) {
html(el, digits.map(function () { return '<span></span>'; }).join(''));
}
digits.forEach(function (digit, i) { return el.children[i].textContent = digit; });
}
});
}
},
methods: {
start: function() {
var this$1 = this;
this.stop();
if (this.date && this.units.length) {
this.$emit();
this.timer = setInterval(function () { return this$1.$emit(); }, 1000);
}
},
stop: function() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
}
}
};
function getTimeSpan(date) {
var total = date - Date.now();
return {
total: total,
seconds: total / 1000 % 60,
minutes: total / 1000 / 60 % 60,
hours: total / 1000 / 60 / 60 % 24,
days: total / 1000 / 60 / 60 / 24
};
}
var targetClass = 'uk-animation-target';
var Animate = {
props: {
animation: Number
},
data: {
animation: 150
},
computed: {
target: function() {
return this.$el;
}
},
methods: {
animate: function(action) {
var this$1 = this;
addStyle();
var children = toNodes(this.target.children);
var propsFrom = children.map(function (el) { return getProps(el, true); });
var oldHeight = height(this.target);
var oldScrollY = window.pageYOffset;
action();
Transition.cancel(this.target);
children.forEach(Transition.cancel);
reset(this.target);
this.$update(this.target);
fastdom.flush();
var newHeight = height(this.target);
children = children.concat(toNodes(this.target.children).filter(function (el) { return !includes(children, el); }));
var propsTo = children.map(function (el, i) { return el.parentNode && i in propsFrom
? propsFrom[i]
? isVisible(el)
? getPositionWithMargin(el)
: {opacity: 0}
: {opacity: isVisible(el) ? 1 : 0}
: false; }
);
propsFrom = propsTo.map(function (props, i) {
var from = children[i].parentNode === this$1.target
? propsFrom[i] || getProps(children[i])
: false;
if (from) {
if (!props) {
delete from.opacity;
} else if (!('opacity' in props)) {
var opacity = from.opacity;
if (opacity % 1) {
props.opacity = 1;
} else {
delete from.opacity;
}
}
}
return from;
});
addClass(this.target, targetClass);
children.forEach(function (el, i) { return propsFrom[i] && css(el, propsFrom[i]); });
css(this.target, 'height', oldHeight);
scrollTop(window, oldScrollY);
return Promise.all(children.map(function (el, i) { return propsFrom[i] && propsTo[i]
? Transition.start(el, propsTo[i], this$1.animation, 'ease')
: Promise.resolve(); }
).concat(Transition.start(this.target, {height: newHeight}, this.animation, 'ease'))).then(function () {
children.forEach(function (el, i) { return css(el, {display: propsTo[i].opacity === 0 ? 'none' : '', zIndex: ''}); });
reset(this$1.target);
this$1.$update(this$1.target);
fastdom.flush(); // needed for IE11
}, noop);
}
}
};
function getProps(el, opacity) {
var zIndex = css(el, 'zIndex');
return isVisible(el)
? assign({
display: '',
opacity: opacity ? css(el, 'opacity') : '0',
pointerEvents: 'none',
position: 'absolute',
zIndex: zIndex === 'auto' ? index(el) : zIndex
}, getPositionWithMargin(el))
: false;
}
function reset(el) {
css(el.children, {
height: '',
left: '',
opacity: '',
pointerEvents: '',
position: '',
top: '',
width: ''
});
removeClass(el, targetClass);
css(el, 'height', '');
}
function getPositionWithMargin(el) {
var ref = el.getBoundingClientRect();
var height$$1 = ref.height;
var width$$1 = ref.width;
var ref$1 = position(el);
var top = ref$1.top;
var left = ref$1.left;
top += toFloat(css(el, 'marginTop'));
return {top: top, left: left, height: height$$1, width: width$$1};
}
var style$1;
function addStyle() {
if (!style$1) {
style$1 = append(document.head, '<style>').sheet;
style$1.insertRule(
("." + targetClass + " > * {\n margin-top: 0 !important;\n transform: none !important;\n }"), 0
);
}
}
var Filter = {
mixins: [Animate],
args: 'target',
props: {
target: Boolean,
selActive: Boolean
},
data: {
target: null,
selActive: false,
attrItem: 'uk-filter-control',
cls: 'uk-active',
animation: 250
},
computed: {
toggles: function(ref, $el) {
var attrItem = ref.attrItem;
return $$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), $el);
},
target: function(ref, $el) {
var target = ref.target;
return $(target, $el);
}
},
events: [
{
name: 'click',
delegate: function() {
return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]");
},
handler: function(e) {
e.preventDefault();
this.apply(e.current);
}
}
],
connected: function() {
var this$1 = this;
if (this.selActive === false) {
return;
}
var actives = $$(this.selActive, this.$el);
this.toggles.forEach(function (el) { return toggleClass(el, this$1.cls, includes(actives, el)); });
},
update: function(data$$1) {
var toggles = data$$1.toggles;
var children = data$$1.children;
if (isEqualList(toggles, this.toggles, false) && isEqualList(children, this.target.children, false)) {
return;
}
data$$1.toggles = this.toggles;
data$$1.children = this.target.children;
this.setState(this.getState(), false);
},
methods: {
apply: function(el) {
this.setState(mergeState(el, this.attrItem, this.getState()));
},
getState: function() {
var this$1 = this;
return this.toggles
.filter(function (item) { return hasClass(item, this$1.cls); })
.reduce(function (state, el) { return mergeState(el, this$1.attrItem, state); }, {filter: {'': ''}, sort: []});
},
setState: function(state, animate$$1) {
var this$1 = this;
if ( animate$$1 === void 0 ) animate$$1 = true;
state = assign({filter: {'': ''}, sort: []}, state);
trigger(this.$el, 'beforeFilter', [this, state]);
var children = toNodes(this.target.children);
this.toggles.forEach(function (el) { return toggleClass(el, this$1.cls, matchFilter(el, this$1.attrItem, state)); });
var apply$$1 = function () {
var selector = getSelector(state);
children.forEach(function (el) { return css(el, 'display', selector && !matches(el, selector) ? 'none' : ''); });
var ref = state.sort;
var sort = ref[0];
var order = ref[1];
if (sort) {
var sorted = sortItems(children, sort, order);
if (!isEqualList(sorted, children)) {
sorted.forEach(function (el) { return append(this$1.target, el); });
}
}
};
if (animate$$1) {
this.animate(apply$$1).then(function () { return trigger(this$1.$el, 'afterFilter', [this$1]); });
} else {
apply$$1();
trigger(this.$el, 'afterFilter', [this]);
}
}
}
};
function getFilter(el, attr$$1) {
return parseOptions(data(el, attr$$1), ['filter']);
}
function mergeState(el, attr$$1, state) {
toNodes(el).forEach(function (el) {
var filterBy = getFilter(el, attr$$1);
var filter$$1 = filterBy.filter;
var group = filterBy.group;
var sort = filterBy.sort;
var order = filterBy.order; if ( order === void 0 ) order = 'asc';
if (filter$$1 || isUndefined(sort)) {
if (group) {
delete state.filter[''];
state.filter[group] = filter$$1;
} else {
state.filter = {'': filter$$1};
}
}
if (!isUndefined(sort)) {
state.sort = [sort, order];
}
});
return state;
}
function matchFilter(el, attr$$1, ref) {
var stateFilter = ref.filter;
var ref_sort = ref.sort;
var stateSort = ref_sort[0];
var stateOrder = ref_sort[1];
var ref$1 = getFilter(el, attr$$1);
var filter$$1 = ref$1.filter;
var group = ref$1.group; if ( group === void 0 ) group = '';
var sort = ref$1.sort;
var order = ref$1.order; if ( order === void 0 ) order = 'asc';
return Boolean(
(filter$$1 || isUndefined(sort)) && group in stateFilter && (filter$$1 === stateFilter[group] || isUndefined(filter$$1) && !stateFilter[group])
|| stateSort && sort && stateSort === sort && stateOrder === order
);
}
function isEqualList(listA, listB, strict) {
if ( strict === void 0 ) strict = true;
listA = toNodes(listA);
listB = toNodes(listB);
return listA.length === listB.length
&& listA.every(function (el, i) { return strict ? el === listB[i] : ~listB.indexOf(el); });
}
function getSelector(ref) {
var filter$$1 = ref.filter;
var selector = '';
each(filter$$1, function (value) { return selector += value || ''; });
return selector;
}
function sortItems(nodes, sort, order) {
return toNodes(nodes).sort(function (a, b) { return data(a, sort).localeCompare(data(b, sort), undefined, {numeric: true}) * (order === 'asc' || -1); });
}
var Animations = {
slide: {
show: function(dir) {
return [
{transform: translate(dir * -100)},
{transform: translate()}
];
},
percent: function(current) {
return translated(current);
},
translate: function(percent, dir) {
return [
{transform: translate(dir * -100 * percent)},
{transform: translate(dir * 100 * (1 - percent))}
];
}
}
};
function translated(el) {
return Math.abs(css(el, 'transform').split(',')[4] / el.offsetWidth) || 0;
}
function translate(value, unit) {
if ( value === void 0 ) value = 0;
if ( unit === void 0 ) unit = '%';
return ("translateX(" + value + (value ? unit : '') + ")"); // currently not translate3d to support IE, translate3d within translate3d does not work while transitioning
}
function scale3d(value) {
return ("scale3d(" + value + ", " + value + ", 1)");
}
var Animations$1 = assign({}, Animations, {
fade: {
show: function() {
return [
{opacity: 0},
{opacity: 1}
];
},
percent: function(current) {
return 1 - css(current, 'opacity');
},
translate: function(percent) {
return [
{opacity: 1 - percent},
{opacity: percent}
];
}
},
scale: {
show: function() {
return [
{opacity: 0, transform: scale3d(1 - .2)},
{opacity: 1, transform: scale3d(1)}
];
},
percent: function(current) {
return 1 - css(current, 'opacity');
},
translate: function(percent) {
return [
{opacity: 1 - percent, transform: scale3d(1 - .2 * percent)},
{opacity: percent, transform: scale3d(1 - .2 + .2 * percent)}
];
}
}
});
function Transitioner(prev, next, dir, ref) {
var animation = ref.animation;
var easing = ref.easing;
var percent = animation.percent;
var translate = animation.translate;
var show = animation.show; if ( show === void 0 ) show = noop;
var props = show(dir);
var deferred = new Deferred();
return {
dir: dir,
show: function(duration, percent, linear) {
var this$1 = this;
if ( percent === void 0 ) percent = 0;
var timing = linear ? 'linear' : easing;
duration -= Math.round(duration * clamp(percent, -1, 1));
this.translate(percent);
triggerUpdate(next, 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
Promise.all([
Transition.start(next, props[1], duration, timing),
Transition.start(prev, props[0], duration, timing)
]).then(function () {
this$1.reset();
deferred.resolve();
}, noop);
return deferred.promise;
},
stop: function() {
return Transition.stop([next, prev]);
},
cancel: function() {
Transition.cancel([next, prev]);
},
reset: function() {
for (var prop in props[0]) {
css([next, prev], prop, '');
}
},
forward: function(duration, percent) {
if ( percent === void 0 ) percent = this.percent();
Transition.cancel([next, prev]);
return this.show(duration, percent, true);
},
translate: function(percent) {
this.reset();
var props = translate(percent, dir);
css(next, props[1]);
css(prev, props[0]);
triggerUpdate(next, 'itemtranslatein', {percent: percent, dir: dir});
triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir: dir});
},
percent: function() {
return percent(prev || next, next, dir);
},
getDistance: function() {
return prev.offsetWidth;
}
};
}
function triggerUpdate(el, type, data$$1) {
trigger(el, createEvent(type, false, false, data$$1));
}
var SliderAutoplay = {
props: {
autoplay: Boolean,
autoplayInterval: Number,
pauseOnHover: Boolean
},
data: {
autoplay: false,
autoplayInterval: 7000,
pauseOnHover: true
},
connected: function() {
this.startAutoplay();
},
disconnected: function() {
this.stopAutoplay();
},
events: [
{
name: 'visibilitychange',
el: document,
handler: function() {
if (document.hidden) {
this.stopAutoplay();
} else {
this.startAutoplay();
}
}
},
{
name: pointerDown,
handler: 'stopAutoplay'
},
{
name: 'mouseenter',
filter: function() {
return this.autoplay;
},
handler: function() {
this.isHovering = true;
}
},
{
name: 'mouseleave',
filter: function() {
return this.autoplay;
},
handler: function() {
this.isHovering = false;
}
}
],
methods: {
startAutoplay: function() {
var this$1 = this;
this.stopAutoplay();
if (this.autoplay) {
this.interval = setInterval(
function () { return !(this$1.isHovering && this$1.pauseOnHover) && !this$1.stack.length && this$1.show('next'); },
this.autoplayInterval
);
}
},
stopAutoplay: function() {
if (this.interval) {
clearInterval(this.interval);
}
}
}
};
var SliderDrag = {
data: {
threshold: 10,
preventCatch: false
},
init: function() {
var this$1 = this;
['start', 'move', 'end'].forEach(function (key) {
var fn = this$1[key];
this$1[key] = function (e) {
var pos = getPos$1(e).x * (isRtl ? -1 : 1);
this$1.prevPos = pos !== this$1.pos ? this$1.pos : this$1.prevPos;
this$1.pos = pos;
fn(e);
};
});
},
events: [
{
name: pointerDown,
delegate: function() {
return this.slidesSelector;
},
handler: function(e) {
if (!isTouch(e) && hasTextNodesOnly(e.target)
|| e.button > 0
|| this.length < 2
|| this.preventCatch
) {
return;
}
this.start(e);
}
},
{
// Workaround for iOS 11 bug: https://bugs.webkit.org/show_bug.cgi?id=184250
name: 'touchmove',
passive: false,
handler: 'move',
delegate: function() {
return this.slidesSelector;
}
},
{
name: 'dragstart',
handler: function(e) {
e.preventDefault();
}
}
],
methods: {
start: function() {
var this$1 = this;
this.drag = this.pos;
if (this._transitioner) {
this.percent = this._transitioner.percent();
this.drag += this._transitioner.getDistance() * this.percent * this.dir;
this._transitioner.cancel();
this._transitioner.translate(this.percent);
this.dragging = true;
this.stack = [];
} else {
this.prevIndex = this.index;
}
// See above workaround notice
var off$$1 = on(document, pointerMove.replace(' touchmove', ''), this.move, {passive: false});
this.unbindMove = function () {
off$$1();
this$1.unbindMove = null;
};
on(window, 'scroll', this.unbindMove);
on(document, pointerUp, this.end, true);
},
move: function(e) {
var this$1 = this;
// See above workaround notice
if (!this.unbindMove) {
return;
}
var distance = this.pos - this.drag;
if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
return;
}
e.cancelable && e.preventDefault();
this.dragging = true;
this.dir = (distance < 0 ? 1 : -1);
var ref = this;
var slides = ref.slides;
var ref$1 = this;
var prevIndex = ref$1.prevIndex;
var dis = Math.abs(distance);
var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
var width$$1 = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
while (nextIndex !== prevIndex && dis > width$$1) {
this$1.drag -= width$$1 * this$1.dir;
prevIndex = nextIndex;
dis -= width$$1;
nextIndex = this$1.getIndex(prevIndex + this$1.dir, prevIndex);
width$$1 = this$1._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
}
this.percent = dis / width$$1;
var prev = slides[prevIndex];
var next = slides[nextIndex];
var changed = this.index !== nextIndex;
var edge = prevIndex === nextIndex;
var itemShown;
[this.index, this.prevIndex].filter(function (i) { return !includes([nextIndex, prevIndex], i); }).forEach(function (i) {
trigger(slides[i], 'itemhidden', [this$1]);
if (edge) {
itemShown = true;
this$1.prevIndex = prevIndex;
}
});
if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
trigger(slides[this.index], 'itemshown', [this]);
}
if (changed) {
this.prevIndex = prevIndex;
this.index = nextIndex;
!edge && trigger(prev, 'beforeitemhide', [this]);
trigger(next, 'beforeitemshow', [this]);
}
this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
if (changed) {
!edge && trigger(prev, 'itemhide', [this]);
trigger(next, 'itemshow', [this]);
}
},
end: function() {
off(window, 'scroll', this.unbindMove);
this.unbindMove && this.unbindMove();
off(document, pointerUp, this.end, true);
if (this.dragging) {
this.dragging = null;
if (this.index === this.prevIndex) {
this.percent = 1 - this.percent;
this.dir *= -1;
this._show(false, this.index, true);
this._transitioner = null;
} else {
var dirChange = (isRtl ? this.dir * (isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
this.index = dirChange ? this.index : this.prevIndex;
if (dirChange) {
this.percent = 1 - this.percent;
}
this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true);
}
preventClick();
}
this.drag
= this.percent
= null;
}
}
};
function hasTextNodesOnly(el) {
return !el.children.length && el.childNodes.length;
}
var SliderNav = {
data: {
selNav: false
},
computed: {
nav: function(ref, $el) {
var selNav = ref.selNav;
return $(selNav, $el);
},
navItemSelector: function(ref) {
var attrItem = ref.attrItem;
return ("[" + attrItem + "],[data-" + attrItem + "]");
},
navItems: function(_, $el) {
return $$(this.navItemSelector, $el);
}
},
update: [
{
write: function() {
var this$1 = this;
if (this.nav && this.length !== this.nav.children.length) {
html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1.attrItem) + "=\"" + i + "\"><a href=\"#\"></a></li>"); }).join(''));
}
toggleClass($$(this.navItemSelector, this.$el).concat(this.nav), 'uk-hidden', !this.maxIndex);
this.updateNav();
},
events: ['load', 'resize']
}
],
events: [
{
name: 'click',
delegate: function() {
return this.navItemSelector;
},
handler: function(e) {
e.preventDefault();
e.current.blur();
this.show(data(e.current, this.attrItem));
}
},
{
name: 'itemshow',
handler: 'updateNav'
}
],
methods: {
updateNav: function() {
var this$1 = this;
var i = this.getValidIndex();
this.navItems.forEach(function (el) {
var cmd = data(el, this$1.attrItem);
toggleClass(el, this$1.clsActive, toNumber(cmd) === i);
toggleClass(el, 'uk-invisible', this$1.finite && (cmd === 'previous' && i === 0 || cmd === 'next' && i >= this$1.maxIndex));
});
}
}
};
var Slider = {
mixins: [SliderAutoplay, SliderDrag, SliderNav],
props: {
clsActivated: Boolean,
easing: String,
index: Number,
finite: Boolean,
velocity: Number
},
data: function () { return ({
easing: 'ease',
finite: false,
velocity: 1,
index: 0,
stack: [],
percent: 0,
clsActive: 'uk-active',
clsActivated: false,
Transitioner: false,
transitionOptions: {}
}); },
computed: {
duration: function(ref, $el) {
var velocity = ref.velocity;
return speedUp($el.offsetWidth / velocity);
},
length: function() {
return this.slides.length;
},
list: function(ref, $el) {
var selList = ref.selList;
return $(selList, $el);
},
maxIndex: function() {
return this.length - 1;
},
slidesSelector: function(ref) {
var selList = ref.selList;
return (selList + " > *");
},
slides: function() {
return toNodes(this.list.children);
}
},
events: {
itemshown: function() {
this.$update(this.list);
}
},
methods: {
show: function(index$$1, force) {
var this$1 = this;
if ( force === void 0 ) force = false;
if (this.dragging || !this.length) {
return;
}
var ref = this;
var stack = ref.stack;
var queueIndex = force ? 0 : stack.length;
var reset = function () {
stack.splice(queueIndex, 1);
if (stack.length) {
this$1.show(stack.shift(), true);
}
};
stack[force ? 'unshift' : 'push'](index$$1);
if (!force && stack.length > 1) {
if (stack.length === 2) {
this._transitioner.forward(Math.min(this.duration, 200));
}
return;
}
var prevIndex = this.index;
var prev = hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
var nextIndex = this.getIndex(index$$1, this.index);
var next = this.slides[nextIndex];
if (prev === next) {
reset();
return;
}
this.dir = getDirection(index$$1, prevIndex);
this.prevIndex = prevIndex;
this.index = nextIndex;
prev && trigger(prev, 'beforeitemhide', [this]);
if (!trigger(next, 'beforeitemshow', [this, prev])) {
this.index = this.prevIndex;
reset();
return;
}
var promise = this._show(prev, next, force).then(function () {
prev && trigger(prev, 'itemhidden', [this$1]);
trigger(next, 'itemshown', [this$1]);
return new Promise(function (resolve) {
fastdom.write(function () {
stack.shift();
if (stack.length) {
this$1.show(stack.shift(), true);
} else {
this$1._transitioner = null;
}
resolve();
});
});
});
prev && trigger(prev, 'itemhide', [this]);
trigger(next, 'itemshow', [this]);
return promise;
},
getIndex: function(index$$1, prev) {
if ( index$$1 === void 0 ) index$$1 = this.index;
if ( prev === void 0 ) prev = this.index;
return clamp(getIndex(index$$1, this.slides, prev, this.finite), 0, this.maxIndex);
},
getValidIndex: function(index$$1, prevIndex) {
if ( index$$1 === void 0 ) index$$1 = this.index;
if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
return this.getIndex(index$$1, prevIndex);
},
_show: function(prev, next, force) {
this._transitioner = this._getTransitioner(
prev,
next,
this.dir,
assign({
easing: force
? next.offsetWidth < 600
? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */
: 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */
: this.easing
}, this.transitionOptions)
);
if (!force && !prev) {
this._transitioner.translate(1);
return Promise.resolve();
}
var ref = this.stack;
var length = ref.length;
return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent);
},
_getDistance: function(prev, next) {
return new this._getTransitioner(prev, prev !== next && next).getDistance();
},
_translate: function(percent, prev, next) {
if ( prev === void 0 ) prev = this.prevIndex;
if ( next === void 0 ) next = this.index;
var transitioner = this._getTransitioner(prev !== next ? prev : false, next);
transitioner.translate(percent);
return transitioner;
},
_getTransitioner: function(prev, next, dir, options) {
if ( prev === void 0 ) prev = this.prevIndex;
if ( next === void 0 ) next = this.index;
if ( dir === void 0 ) dir = this.dir || 1;
if ( options === void 0 ) options = this.transitionOptions;
return new this.Transitioner(
isNumber(prev) ? this.slides[prev] : prev,
isNumber(next) ? this.slides[next] : next,
dir * (isRtl ? -1 : 1),
options
);
}
}
};
function getDirection(index$$1, prevIndex) {
return index$$1 === 'next'
? 1
: index$$1 === 'previous'
? -1
: index$$1 < prevIndex
? -1
: 1;
}
function speedUp(x) {
return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
}
var Slideshow = {
mixins: [Slider],
props: {
animation: String
},
data: {
animation: 'slide',
clsActivated: 'uk-transition-active',
Animations: Animations,
Transitioner: Transitioner
},
computed: {
animation: function(ref) {
var animation = ref.animation;
var Animations$$1 = ref.Animations;
return assign(animation in Animations$$1 ? Animations$$1[animation] : Animations$$1.slide, {name: animation});
},
transitionOptions: function() {
return {animation: this.animation};
}
},
events: {
'itemshow itemhide itemshown itemhidden': function(ref) {
var target = ref.target;
this.$update(target);
},
itemshow: function() {
isNumber(this.prevIndex) && fastdom.flush(); // iOS 10+ will honor the video.play only if called from a gesture handler
},
beforeitemshow: function(ref) {
var target = ref.target;
addClass(target, this.clsActive);
},
itemshown: function(ref) {
var target = ref.target;
addClass(target, this.clsActivated);
},
itemhidden: function(ref) {
var target = ref.target;
removeClass(target, this.clsActive, this.clsActivated);
}
}
};
var LightboxPanel = {
mixins: [Container, Modal, Togglable, Slideshow],
functional: true,
props: {
delayControls: Number,
preload: Number,
videoAutoplay: Boolean,
template: String
},
data: function () { return ({
preload: 1,
videoAutoplay: false,
delayControls: 3000,
items: [],
cls: 'uk-open',
clsPage: 'uk-lightbox-page',
selList: '.uk-lightbox-items',
attrItem: 'uk-lightbox-item',
selClose: '.uk-close-large',
pauseOnHover: false,
velocity: 2,
Animations: Animations$1,
template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href=\"#\" uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href=\"#\" uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>"
}); },
created: function() {
var this$1 = this;
this.$mount(append(this.container, this.template));
this.caption = $('.uk-lightbox-caption', this.$el);
this.items.forEach(function () { return append(this$1.list, '<li></li>'); });
},
events: [
{
name: (pointerMove + " " + pointerDown + " keydown"),
handler: 'showControls'
},
{
name: 'click',
self: true,
delegate: function() {
return this.slidesSelector;
},
handler: function(e) {
e.preventDefault();
this.hide();
}
},
{
name: 'shown',
self: true,
handler: 'showControls'
},
{
name: 'hide',
self: true,
handler: function() {
this.hideControls();
removeClass(this.slides, this.clsActive);
Transition.stop(this.slides);
}
},
{
name: 'keyup',
el: document,
handler: function(e) {
if (!this.isToggled(this.$el)) {
return;
}
switch (e.keyCode) {
case 37:
this.show('previous');
break;
case 39:
this.show('next');
break;
}
}
},
{
name: 'beforeitemshow',
handler: function(e) {
if (this.isToggled()) {
return;
}
this.preventCatch = true;
e.preventDefault();
this.toggleNow(this.$el, true);
this.animation = Animations$1['scale'];
removeClass(e.target, this.clsActive);
this.stack.splice(1, 0, this.index);
}
},
{
name: 'itemshow',
handler: function(ref) {
var this$1 = this;
var target = ref.target;
var i = index(target);
var ref$1 = this.getItem(i);
var caption = ref$1.caption;
css(this.caption, 'display', caption ? '' : 'none');
html(this.caption, caption);
for (var j = 0; j <= this.preload; j++) {
this$1.loadItem(this$1.getIndex(i + j));
this$1.loadItem(this$1.getIndex(i - j));
}
}
},
{
name: 'itemshown',
handler: function() {
this.preventCatch = false;
}
},
{
name: 'itemload',
handler: function(_, item) {
var this$1 = this;
var source = item.source;
var type = item.type;
var alt = item.alt;
this.setItem(item, '<span uk-spinner></span>');
if (!source) {
return;
}
var matches$$1;
// Image
if (type === 'image' || source.match(/\.(jp(e)?g|png|gif|svg)($|\?)/i)) {
getImage(source).then(
function (img) { return this$1.setItem(item, ("<img width=\"" + (img.width) + "\" height=\"" + (img.height) + "\" src=\"" + source + "\" alt=\"" + (alt ? alt : '') + "\">")); },
function () { return this$1.setError(item); }
);
// Video
} else if (type === 'video' || source.match(/\.(mp4|webm|ogv)($|\?)/i)) {
var video = $(("<video controls playsinline" + (item.poster ? (" poster=\"" + (item.poster) + "\"") : '') + " uk-video=\"" + (this.videoAutoplay) + "\"></video>"));
attr(video, 'src', source);
on(video, 'error', function () { return this$1.setError(item); });
on(video, 'loadedmetadata', function () {
attr(video, {width: video.videoWidth, height: video.videoHeight});
this$1.setItem(item, video);
});
// Iframe
} else if (type === 'iframe' || source.match(/\.(html|php)($|\?)/i)) {
this.setItem(item, ("<iframe class=\"uk-lightbox-iframe\" src=\"" + source + "\" frameborder=\"0\" allowfullscreen></iframe>"));
// YouTube
} else if ((matches$$1 = source.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/watch\?v=([^&\s]+)/) || source.match(/()youtu\.be\/(.*)/))) {
var id = matches$$1[2];
var setIframe = function (width$$1, height$$1) {
if ( width$$1 === void 0 ) width$$1 = 640;
if ( height$$1 === void 0 ) height$$1 = 450;
return this$1.setItem(item, getIframe(("https://www.youtube" + (matches$$1[1] || '') + ".com/embed/" + id), width$$1, height$$1, this$1.videoAutoplay));
};
getImage(("https://img.youtube.com/vi/" + id + "/maxresdefault.jpg")).then(
function (ref) {
var width$$1 = ref.width;
var height$$1 = ref.height;
// YouTube default 404 thumb, fall back to low resolution
if (width$$1 === 120 && height$$1 === 90) {
getImage(("https://img.youtube.com/vi/" + id + "/0.jpg")).then(
function (ref) {
var width$$1 = ref.width;
var height$$1 = ref.height;
return setIframe(width$$1, height$$1);
},
setIframe
);
} else {
setIframe(width$$1, height$$1);
}
},
setIframe
);
// Vimeo
} else if ((matches$$1 = source.match(/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/))) {
ajax(("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" + (encodeURI(source))), {responseType: 'json', withCredentials: false})
.then(
function (ref) {
var ref_response = ref.response;
var height$$1 = ref_response.height;
var width$$1 = ref_response.width;
return this$1.setItem(item, getIframe(("https://player.vimeo.com/video/" + (matches$$1[2])), width$$1, height$$1, this$1.videoAutoplay));
},
function () { return this$1.setError(item); }
);
}
}
}
],
methods: {
loadItem: function(index$$1) {
if ( index$$1 === void 0 ) index$$1 = this.index;
var item = this.getItem(index$$1);
if (item.content) {
return;
}
trigger(this.$el, 'itemload', [item]);
},
getItem: function(index$$1) {
if ( index$$1 === void 0 ) index$$1 = this.index;
return this.items[index$$1] || {};
},
setItem: function(item, content) {
assign(item, {content: content});
var el = html(this.slides[this.items.indexOf(item)], content);
trigger(this.$el, 'itemloaded', [this, el]);
this.$update(el);
},
setError: function(item) {
this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
},
showControls: function() {
clearTimeout(this.controlsTimer);
this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
addClass(this.$el, 'uk-active', 'uk-transition-active');
},
hideControls: function() {
removeClass(this.$el, 'uk-active', 'uk-transition-active');
}
}
};
function getIframe(src, width$$1, height$$1, autoplay) {
return ("<iframe src=\"" + src + "\" width=\"" + width$$1 + "\" height=\"" + height$$1 + "\" style=\"max-width: 100%; box-sizing: border-box;\" frameborder=\"0\" allowfullscreen uk-video=\"autoplay: " + autoplay + "\" uk-responsive></iframe>");
}
var Lightbox = {
install: install$2,
props: {toggle: String},
data: {toggle: 'a'},
computed: {
toggles: function(ref, $el) {
var toggle = ref.toggle;
return $$(toggle, $el);
}
},
disconnected: function() {
this._destroy();
},
events: [
{
name: 'click',
delegate: function() {
return ((this.toggle) + ":not(.uk-disabled)");
},
handler: function(e) {
e.preventDefault();
e.current.blur();
this.show(index(this.toggles, e.current));
}
}
],
update: function(data$$1) {
data$$1.toggles = this.panel && data$$1.toggles || this.toggles;
if (!this.panel || isEqualList$1(data$$1.toggles, this.toggles)) {
return;
}
data$$1.toggles = this.toggles;
this._destroy();
this._init();
},
methods: {
_init: function() {
return this.panel = this.panel || this.$create('lightboxPanel', assign({}, this.$props, {
items: this.toggles.reduce(function (items, el) {
items.push(['href', 'caption', 'type', 'poster', 'alt'].reduce(function (obj, attr$$1) {
obj[attr$$1 === 'href' ? 'source' : attr$$1] = data(el, attr$$1);
return obj;
}, {}));
return items;
}, [])
}));
},
_destroy: function() {
if (this.panel) {
this.panel.$destroy(true);
this.panel = null;
}
},
show: function(index$$1) {
if (!this.panel) {
this._init();
}
return this.panel.show(index$$1);
},
hide: function() {
return this.panel && this.panel.hide();
}
}
};
function isEqualList$1(listA, listB) {
return listA.length === listB.length
&& listA.every(function (el, i) { return el === listB[i]; });
}
function install$2(UIkit, Lightbox) {
if (!UIkit.lightboxPanel) {
UIkit.component('lightboxPanel', LightboxPanel);
}
assign(
Lightbox.props,
UIkit.component('lightboxPanel').options.props
);
}
var obj;
var containers = {};
var Notification = {
functional: true,
args: ['message', 'status'],
data: {
message: '',
status: '',
timeout: 5000,
group: null,
pos: 'top-center',
clsClose: 'uk-notification-close',
clsMsg: 'uk-notification-message'
},
install: install$3,
created: function() {
if (!containers[this.pos]) {
containers[this.pos] = append(this.$container, ("<div class=\"uk-notification uk-notification-" + (this.pos) + "\"></div>"));
}
var container = css(containers[this.pos], 'display', 'block');
this.$mount(append(container,
("<div class=\"" + (this.clsMsg) + (this.status ? (" " + (this.clsMsg) + "-" + (this.status)) : '') + "\"> <a href=\"#\" class=\"" + (this.clsClose) + "\" data-uk-close></a> <div>" + (this.message) + "</div> </div>")
));
},
ready: function() {
var this$1 = this;
var marginBottom = toFloat(css(this.$el, 'marginBottom'));
Transition.start(
css(this.$el, {opacity: 0, marginTop: -this.$el.offsetHeight, marginBottom: 0}),
{opacity: 1, marginTop: 0, marginBottom: marginBottom}
).then(function () {
if (this$1.timeout) {
this$1.timer = setTimeout(this$1.close, this$1.timeout);
}
});
},
events: ( obj = {
click: function(e) {
if (closest(e.target, 'a[href="#"]')) {
e.preventDefault();
}
this.close();
}
}, obj[pointerEnter] = function () {
if (this.timer) {
clearTimeout(this.timer);
}
}, obj[pointerLeave] = function () {
if (this.timeout) {
this.timer = setTimeout(this.close, this.timeout);
}
}, obj ),
methods: {
close: function(immediate) {
var this$1 = this;
var removeFn = function () {
trigger(this$1.$el, 'close', [this$1]);
remove(this$1.$el);
if (!containers[this$1.pos].children.length) {
css(containers[this$1.pos], 'display', 'none');
}
};
if (this.timer) {
clearTimeout(this.timer);
}
if (immediate) {
removeFn();
} else {
Transition.start(this.$el, {
opacity: 0,
marginTop: -this.$el.offsetHeight,
marginBottom: 0
}).then(removeFn);
}
}
}
};
function install$3(UIkit) {
UIkit.notification.closeAll = function (group, immediate) {
apply(document.body, function (el) {
var notification = UIkit.getComponent(el, 'notification');
if (notification && (!group || group === notification.group)) {
notification.close(immediate);
}
});
};
}
var props = ['x', 'y', 'bgx', 'bgy', 'rotate', 'scale', 'color', 'backgroundColor', 'borderColor', 'opacity', 'blur', 'hue', 'grayscale', 'invert', 'saturate', 'sepia', 'fopacity'];
var Parallax = {
props: props.reduce(function (props, prop) {
props[prop] = 'list';
return props;
}, {
media: 'media'
}),
data: props.reduce(function (data$$1, prop) {
data$$1[prop] = undefined;
return data$$1;
}, {
media: false
}),
computed: {
props: function(properties, $el) {
var this$1 = this;
return props.reduce(function (props, prop) {
if (isUndefined(properties[prop])) {
return props;
}
var isColor = prop.match(/color/i);
var isCssProp = isColor || prop === 'opacity';
var pos, bgPos, diff;
var steps = properties[prop].slice(0);
if (isCssProp) {
css($el, prop, '');
}
if (steps.length < 2) {
steps.unshift((prop === 'scale'
? 1
: isCssProp
? css($el, prop)
: 0) || 0);
}
var unit = includes(steps.join(''), '%') ? '%' : 'px';
if (isColor) {
var ref = $el.style;
var color = ref.color;
steps = steps.map(function (step) { return parseColor($el, step); });
$el.style.color = color;
} else {
steps = steps.map(toFloat);
}
if (prop.match(/^bg/)) {
css($el, ("background-position-" + (prop[2])), '');
bgPos = css($el, 'backgroundPosition').split(' ')[prop[2] === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y]
if (this$1.covers) {
var min = Math.min.apply(Math, steps);
var max = Math.max.apply(Math, steps);
var down = steps.indexOf(min) < steps.indexOf(max);
diff = max - min;
steps = steps.map(function (step) { return step - (down ? min : max); });
pos = (down ? -diff : 0) + "px";
} else {
pos = bgPos;
}
}
props[prop] = {steps: steps, unit: unit, pos: pos, bgPos: bgPos, diff: diff};
return props;
}, {});
},
bgProps: function() {
var this$1 = this;
return ['bgx', 'bgy'].filter(function (bg) { return bg in this$1.props; });
},
covers: function(_, $el) {
return covers($el);
}
},
disconnected: function() {
delete this._image;
},
update: [
{
read: function(data$$1) {
var this$1 = this;
data$$1.active = !this.media || window.matchMedia(this.media).matches;
if (data$$1.image) {
data$$1.image.dimEl = {
width: this.$el.offsetWidth,
height: this.$el.offsetHeight
};
}
if ('image' in data$$1 || !this.covers || !this.bgProps.length) {
return;
}
var src = css(this.$el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
if (!src) {
return;
}
data$$1.image = false;
getImage(src).then(function (img) {
data$$1.image = {
width: img.naturalWidth,
height: img.naturalHeight
};
this$1.$emit();
});
},
write: function(ref) {
var this$1 = this;
var image = ref.image;
var active = ref.active;
if (!image) {
return;
}
if (!active) {
css(this.$el, {backgroundSize: '', backgroundRepeat: ''});
return;
}
var dimEl = image.dimEl;
var dim = Dimensions.cover(image, dimEl);
this.bgProps.forEach(function (prop) {
var ref = this$1.props[prop];
var diff = ref.diff;
var bgPos = ref.bgPos;
var steps = ref.steps;
var attr$$1 = prop === 'bgy' ? 'height' : 'width';
var span = dim[attr$$1] - dimEl[attr$$1];
if (!bgPos.match(/%$|0px/)) {
return;
}
if (span < diff) {
dimEl[attr$$1] = dim[attr$$1] + diff - span;
} else if (span > diff) {
var bgPosFloat = parseFloat(bgPos);
if (bgPosFloat) {
this$1.props[prop].steps = steps.map(function (step) { return step - (span - diff) / (100 / bgPosFloat); });
}
}
dim = Dimensions.cover(image, dimEl);
});
css(this.$el, {
backgroundSize: ((dim.width) + "px " + (dim.height) + "px"),
backgroundRepeat: 'no-repeat'
});
},
events: ['load', 'resize']
}
],
methods: {
reset: function() {
var this$1 = this;
each(this.getCss(0), function (_, prop) { return css(this$1.$el, prop, ''); });
},
getCss: function(percent) {
var ref = this;
var props = ref.props;
var translated = false;
return Object.keys(props).reduce(function (css$$1, prop) {
var ref = props[prop];
var steps = ref.steps;
var unit = ref.unit;
var pos = ref.pos;
var value = getValue(steps, percent);
switch (prop) {
// transforms
case 'x':
case 'y':
if (translated) {
break;
}
var ref$1 = ['x', 'y'].map(function (dir) { return prop === dir
? toFloat(value).toFixed(0) + unit
: props[dir]
? getValue(props[dir].steps, percent, 0) + props[dir].unit
: 0; }
);
var x = ref$1[0];
var y = ref$1[1];
translated = css$$1.transform += " translate3d(" + x + ", " + y + ", 0)";
break;
case 'rotate':
css$$1.transform += " rotate(" + value + "deg)";
break;
case 'scale':
css$$1.transform += " scale(" + value + ")";
break;
// bg image
case 'bgy':
case 'bgx':
css$$1[("background-position-" + (prop[2]))] = "calc(" + pos + " + " + (value + unit) + ")";
break;
// color
case 'color':
case 'backgroundColor':
case 'borderColor':
var ref$2 = getStep(steps, percent);
var start = ref$2[0];
var end = ref$2[1];
var p = ref$2[2];
css$$1[prop] = "rgba(" + (start.map(function (value, i) {
value = value + p * (end[i] - value);
return i === 3 ? toFloat(value) : parseInt(value, 10);
}).join(',')) + ")";
break;
// CSS Filter
case 'blur':
css$$1.filter += " blur(" + value + "px)";
break;
case 'hue':
css$$1.filter += " hue-rotate(" + value + "deg)";
break;
case 'fopacity':
css$$1.filter += " opacity(" + value + "%)";
break;
case 'grayscale':
case 'invert':
case 'saturate':
case 'sepia':
css$$1.filter += " " + prop + "(" + value + "%)";
break;
default:
css$$1[prop] = value;
}
return css$$1;
}, {transform: '', filter: ''});
}
}
};
function parseColor(el, color) {
return css(css(el, 'color', color), 'color').split(/[(),]/g).slice(1, -1).concat(1).slice(0, 4).map(function (n) { return toFloat(n); });
}
function getStep(steps, percent) {
var count = steps.length - 1;
var index$$1 = Math.min(Math.floor(count * percent), count - 1);
var step = steps.slice(index$$1, index$$1 + 2);
step.push(percent === 1 ? 1 : percent % (1 / count) * count);
return step;
}
function getValue(steps, percent, digits) {
if ( digits === void 0 ) digits = 2;
var ref = getStep(steps, percent);
var start = ref[0];
var end = ref[1];
var p = ref[2];
return (isNumber(start)
? start + Math.abs(start - end) * p * (start < end ? 1 : -1)
: +end
).toFixed(digits);
}
function covers(el) {
var ref = el.style;
var backgroundSize = ref.backgroundSize;
var covers = css(css(el, 'backgroundSize', ''), 'backgroundSize') === 'cover';
el.style.backgroundSize = backgroundSize;
return covers;
}
var Parallax$1 = {
mixins: [Parallax],
props: {
target: String,
viewport: Number,
easing: Number,
},
data: {
target: false,
viewport: 1,
easing: 1,
},
computed: {
target: function(ref, $el) {
var target = ref.target;
return target && query(target, $el) || $el;
}
},
update: [
{
read: function(ref) {
var percent = ref.percent;
return {
prev: percent,
percent: ease$1(scrolledOver(this.target) / (this.viewport || 1), this.easing)
};
},
write: function(ref, ref$1) {
var prev = ref.prev;
var percent = ref.percent;
var active = ref.active;
var type = ref$1.type;
if (type !== 'scroll') {
prev = false;
}
if (!active) {
this.reset();
return;
}
if (prev !== percent) {
css(this.$el, this.getCss(percent));
}
},
events: ['scroll', 'load', 'resize']
}
]
};
function ease$1(percent, easing) {
return clamp(percent * (1 - (easing - easing * percent)));
}
var SliderReactive = {
update: [
{
write: function() {
if (this.stack.length || this.dragging) {
return;
}
var index$$1 = this.getValidIndex();
delete this.index;
removeClass(this.slides, this.clsActive, this.clsActivated);
this.show(index$$1);
},
events: ['load', 'resize']
}
]
};
function Transitioner$1 (prev, next, dir, ref) {
var center = ref.center;
var easing = ref.easing;
var list = ref.list;
var deferred = new Deferred();
var from = prev
? getLeft(prev, list, center)
: getLeft(next, list, center) + bounds(next).width * dir;
var to = next
? getLeft(next, list, center)
: from + bounds(prev).width * dir * (isRtl ? -1 : 1);
return {
dir: dir,
show: function(duration, percent, linear) {
if ( percent === void 0 ) percent = 0;
var timing = linear ? 'linear' : easing;
duration -= Math.round(duration * clamp(percent, -1, 1));
this.translate(percent);
prev && this.updateTranslates();
percent = prev ? percent : clamp(percent, 0, 1);
triggerUpdate$1(this.getItemIn(), 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
prev && triggerUpdate$1(this.getItemIn(true), 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
Transition
.start(list, {transform: translate(-to * (isRtl ? -1 : 1), 'px')}, duration, timing)
.then(deferred.resolve, noop);
return deferred.promise;
},
stop: function() {
return Transition.stop(list);
},
cancel: function() {
Transition.cancel(list);
},
reset: function() {
css(list, 'transform', '');
},
forward: function(duration, percent) {
if ( percent === void 0 ) percent = this.percent();
Transition.cancel(list);
return this.show(duration, percent, true);
},
translate: function(percent) {
var distance = this.getDistance() * dir * (isRtl ? -1 : 1);
css(list, 'transform', translate(clamp(
-to + (distance - distance * percent),
-getWidth(list),
bounds(list).width
) * (isRtl ? -1 : 1), 'px'));
this.updateTranslates();
if (prev) {
percent = clamp(percent, -1, 1);
triggerUpdate$1(this.getItemIn(), 'itemtranslatein', {percent: percent, dir: dir});
triggerUpdate$1(this.getItemIn(true), 'itemtranslateout', {percent: 1 - percent, dir: dir});
}
},
percent: function() {
return Math.abs((css(list, 'transform').split(',')[4] * (isRtl ? -1 : 1) + from) / (to - from));
},
getDistance: function() {
return Math.abs(to - from);
},
getItemIn: function(out) {
if ( out === void 0 ) out = false;
var actives = this.getActives();
var all = sortBy(slides(list), 'offsetLeft');
var i = index(all, actives[dir * (out ? -1 : 1) > 0 ? actives.length - 1 : 0]);
return ~i && all[i + (prev && !out ? dir : 0)];
},
getActives: function() {
var left = getLeft(prev || next, list, center);
return sortBy(slides(list).filter(function (slide) {
var slideLeft = getElLeft(slide, list);
return slideLeft >= left && slideLeft + bounds(slide).width <= bounds(list).width + left;
}), 'offsetLeft');
},
updateTranslates: function() {
var actives = this.getActives();
slides(list).forEach(function (slide) {
var isActive = includes(actives, slide);
triggerUpdate$1(slide, ("itemtranslate" + (isActive ? 'in' : 'out')), {
percent: isActive ? 1 : 0,
dir: slide.offsetLeft <= next.offsetLeft ? 1 : -1
});
});
}
};
}
function getLeft(el, list, center) {
var left = getElLeft(el, list);
return center
? left - centerEl(el, list)
: Math.min(left, getMax(list));
}
function getMax(list) {
return Math.max(0, getWidth(list) - bounds(list).width);
}
function getWidth(list) {
return slides(list).reduce(function (right, el) { return bounds(el).width + right; }, 0);
}
function getMaxWidth(list) {
return slides(list).reduce(function (right, el) { return Math.max(right, bounds(el).width); }, 0);
}
function centerEl(el, list) {
return bounds(list).width / 2 - bounds(el).width / 2;
}
function getElLeft(el, list) {
return (position(el).left + (isRtl ? bounds(el).width - bounds(list).width : 0)) * (isRtl ? -1 : 1);
}
function bounds(el) {
return el.getBoundingClientRect();
}
function triggerUpdate$1(el, type, data$$1) {
trigger(el, createEvent(type, false, false, data$$1));
}
function slides(list) {
return toNodes(list.children);
}
var Slider$1 = {
mixins: [Class, Slider, SliderReactive],
props: {
center: Boolean,
sets: Boolean,
},
data: {
center: false,
sets: false,
attrItem: 'uk-slider-item',
selList: '.uk-slider-items',
selNav: '.uk-slider-nav',
clsContainer: 'uk-slider-container',
Transitioner: Transitioner$1
},
computed: {
avgWidth: function() {
return getWidth(this.list) / this.length;
},
finite: function(ref) {
var finite = ref.finite;
return finite || getWidth(this.list) < bounds(this.list).width + getMaxWidth(this.list) + this.center;
},
maxIndex: function() {
var this$1 = this;
if (!this.finite || this.center && !this.sets) {
return this.length - 1;
}
if (this.center) {
return this.sets[this.sets.length - 1];
}
css(this.slides, 'order', '');
var max = getMax(this.list);
var i = this.length;
while (i--) {
if (getElLeft(this$1.list.children[i], this$1.list) < max) {
return Math.min(i + 1, this$1.length - 1);
}
}
return 0;
},
sets: function(ref) {
var this$1 = this;
var sets = ref.sets;
var width$$1 = bounds(this.list).width / (this.center ? 2 : 1);
var left = 0;
var leftCenter = width$$1;
var slideLeft = 0;
sets = sets && this.slides.reduce(function (sets, slide, i) {
var ref = bounds(slide);
var slideWidth = ref.width;
var slideRight = slideLeft + slideWidth;
if (slideRight > left) {
if (!this$1.center && i > this$1.maxIndex) {
i = this$1.maxIndex;
}
if (!includes(sets, i)) {
var cmp = this$1.slides[i + 1];
if (this$1.center && cmp && slideWidth < leftCenter - bounds(cmp).width / 2) {
leftCenter -= slideWidth;
} else {
leftCenter = width$$1;
sets.push(i);
left = slideLeft + width$$1 + (this$1.center ? slideWidth / 2 : 0);
}
}
}
slideLeft += slideWidth;
return sets;
}, []);
return sets && sets.length && sets;
},
transitionOptions: function() {
return {
center: this.center,
list: this.list
};
}
},
connected: function() {
toggleClass(this.$el, this.clsContainer, !$(("." + (this.clsContainer)), this.$el));
},
update: {
write: function() {
var this$1 = this;
$$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), this.$el).forEach(function (el) {
var index$$1 = data(el, this$1.attrItem);
this$1.maxIndex && toggleClass(el, 'uk-hidden', isNumeric(index$$1) && (this$1.sets && !includes(this$1.sets, toFloat(index$$1)) || index$$1 > this$1.maxIndex));
});
},
events: ['load', 'resize']
},
events: {
beforeitemshow: function(e) {
var this$1 = this;
if (!this.dragging && this.sets && this.stack.length < 2 && !includes(this.sets, this.index)) {
this.index = this.getValidIndex();
}
var diff = Math.abs(
this.index
- this.prevIndex
+ (this.dir > 0 && this.index < this.prevIndex || this.dir < 0 && this.index > this.prevIndex ? (this.maxIndex + 1) * this.dir : 0)
);
if (!this.dragging && diff > 1) {
for (var i = 0; i < diff; i++) {
this$1.stack.splice(1, 0, this$1.dir > 0 ? 'next' : 'previous');
}
e.preventDefault();
return;
}
this.duration = speedUp(this.avgWidth / this.velocity)
* (bounds(
this.dir < 0 || !this.slides[this.prevIndex]
? this.slides[this.index]
: this.slides[this.prevIndex]
).width / this.avgWidth);
this.reorder();
},
itemshow: function() {
!isUndefined(this.prevIndex) && addClass(this._getTransitioner().getItemIn(), this.clsActive);
},
itemshown: function() {
var this$1 = this;
var actives = this._getTransitioner(this.index).getActives();
this.slides.forEach(function (slide) { return toggleClass(slide, this$1.clsActive, includes(actives, slide)); });
(!this.sets || includes(this.sets, toFloat(this.index))) && this.slides.forEach(function (slide) { return toggleClass(slide, this$1.clsActivated, includes(actives, slide)); });
}
},
methods: {
reorder: function() {
var this$1 = this;
css(this.slides, 'order', '');
if (this.finite) {
return;
}
var index$$1 = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index;
this.slides.forEach(function (slide, i) { return css(slide, 'order', this$1.dir > 0 && i < index$$1
? 1
: this$1.dir < 0 && i >= this$1.index
? -1
: ''
); }
);
if (!this.center) {
return;
}
var next = this.slides[index$$1];
var width$$1 = bounds(this.list).width / 2 - bounds(next).width / 2;
var j = 0;
while (width$$1 > 0) {
var slideIndex = this$1.getIndex(--j + index$$1, index$$1);
var slide = this$1.slides[slideIndex];
css(slide, 'order', slideIndex > index$$1 ? -2 : -1);
width$$1 -= bounds(slide).width;
}
},
getValidIndex: function(index$$1, prevIndex) {
var this$1 = this;
if ( index$$1 === void 0 ) index$$1 = this.index;
if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
index$$1 = this.getIndex(index$$1, prevIndex);
if (!this.sets) {
return index$$1;
}
var prev;
do {
if (includes(this$1.sets, index$$1)) {
return index$$1;
}
prev = index$$1;
index$$1 = this$1.getIndex(index$$1 + this$1.dir, prevIndex);
} while (index$$1 !== prev);
return index$$1;
}
}
};
var SliderParallax = {
mixins: [Parallax],
data: {
selItem: '!li'
},
computed: {
item: function(ref, $el) {
var selItem = ref.selItem;
return query(selItem, $el);
}
},
events: [
{
name: 'itemshown',
self: true,
el: function() {
return this.item;
},
handler: function() {
css(this.$el, this.getCss(.5));
}
},
{
name: 'itemin itemout',
self: true,
el: function() {
return this.item;
},
handler: function(ref) {
var type = ref.type;
var ref_detail = ref.detail;
var percent = ref_detail.percent;
var duration = ref_detail.duration;
var timing = ref_detail.timing;
var dir = ref_detail.dir;
Transition.cancel(this.$el);
css(this.$el, this.getCss(getCurrent(type, dir, percent)));
Transition.start(this.$el, this.getCss(isIn(type)
? .5
: dir > 0
? 1
: 0
), duration, timing).catch(noop);
}
},
{
name: 'transitioncanceled transitionend',
self: true,
el: function() {
return this.item;
},
handler: function() {
Transition.cancel(this.$el);
}
},
{
name: 'itemtranslatein itemtranslateout',
self: true,
el: function() {
return this.item;
},
handler: function(ref) {
var type = ref.type;
var ref_detail = ref.detail;
var percent = ref_detail.percent;
var dir = ref_detail.dir;
Transition.cancel(this.$el);
css(this.$el, this.getCss(getCurrent(type, dir, percent)));
}
}
]
};
function isIn(type) {
return endsWith(type, 'in');
}
function getCurrent(type, dir, percent) {
percent /= 2;
return !isIn(type)
? dir < 0
? percent
: 1 - percent
: dir < 0
? 1 - percent
: percent;
}
var Animations$2 = assign({}, Animations, {
fade: {
show: function() {
return [
{opacity: 0, zIndex: 0},
{zIndex: -1}
];
},
percent: function(current) {
return 1 - css(current, 'opacity');
},
translate: function(percent) {
return [
{opacity: 1 - percent, zIndex: 0},
{zIndex: -1}
];
}
},
scale: {
show: function() {
return [
{opacity: 0, transform: scale3d(1 + .5), zIndex: 0},
{zIndex: -1}
];
},
percent: function(current) {
return 1 - css(current, 'opacity');
},
translate: function(percent) {
return [
{opacity: 1 - percent, transform: scale3d(1 + .5 * percent), zIndex: 0},
{zIndex: -1}
];
}
},
pull: {
show: function(dir) {
return dir < 0
? [
{transform: translate(30), zIndex: -1},
{transform: translate(), zIndex: 0} ]
: [
{transform: translate(-100), zIndex: 0},
{transform: translate(), zIndex: -1}
];
},
percent: function(current, next, dir) {
return dir < 0
? 1 - translated(next)
: translated(current);
},
translate: function(percent, dir) {
return dir < 0
? [
{transform: translate(30 * percent), zIndex: -1},
{transform: translate(-100 * (1 - percent)), zIndex: 0} ]
: [
{transform: translate(-percent * 100), zIndex: 0},
{transform: translate(30 * (1 - percent)), zIndex: -1}
];
}
},
push: {
show: function(dir) {
return dir < 0
? [
{transform: translate(100), zIndex: 0},
{transform: translate(), zIndex: -1} ]
: [
{transform: translate(-30), zIndex: -1},
{transform: translate(), zIndex: 0}
];
},
percent: function(current, next, dir) {
return dir > 0
? 1 - translated(next)
: translated(current);
},
translate: function(percent, dir) {
return dir < 0
? [
{transform: translate(percent * 100), zIndex: 0},
{transform: translate(-30 * (1 - percent)), zIndex: -1} ]
: [
{transform: translate(-30 * percent), zIndex: -1},
{transform: translate(100 * (1 - percent)), zIndex: 0}
];
}
}
});
var Slideshow$1 = {
mixins: [Class, Slideshow, SliderReactive],
props: {
ratio: String,
minHeight: Boolean,
maxHeight: Boolean,
},
data: {
ratio: '16:9',
minHeight: false,
maxHeight: false,
selList: '.uk-slideshow-items',
attrItem: 'uk-slideshow-item',
selNav: '.uk-slideshow-nav',
Animations: Animations$2
},
update: {
read: function() {
var ref = this.ratio.split(':').map(Number);
var width$$1 = ref[0];
var height$$1 = ref[1];
height$$1 = height$$1 * this.$el.offsetWidth / width$$1;
if (this.minHeight) {
height$$1 = Math.max(this.minHeight, height$$1);
}
if (this.maxHeight) {
height$$1 = Math.min(this.maxHeight, height$$1);
}
return {height: height$$1};
},
write: function(ref) {
var hgt = ref.height;
height(this.list, Math.floor(hgt));
},
events: ['load', 'resize']
}
};
var obj$1;
var Sortable = {
mixins: [Class, Animate],
props: {
group: String,
threshold: Number,
clsItem: String,
clsPlaceholder: String,
clsDrag: String,
clsDragState: String,
clsBase: String,
clsNoDrag: String,
clsEmpty: String,
clsCustom: String,
handle: String
},
data: {
group: false,
threshold: 5,
clsItem: 'uk-sortable-item',
clsPlaceholder: 'uk-sortable-placeholder',
clsDrag: 'uk-sortable-drag',
clsDragState: 'uk-drag',
clsBase: 'uk-sortable',
clsNoDrag: 'uk-sortable-nodrag',
clsEmpty: 'uk-sortable-empty',
clsCustom: '',
handle: false
},
init: function() {
var this$1 = this;
['init', 'start', 'move', 'end'].forEach(function (key) {
var fn = this$1[key];
this$1[key] = function (e) {
this$1.scrollY = window.pageYOffset;
var ref = getPos$1(e);
var x = ref.x;
var y = ref.y;
this$1.pos = {x: x, y: y};
fn(e);
};
});
},
events: ( obj$1 = {}, obj$1[pointerDown] = 'init', obj$1 ),
update: {
write: function() {
if (this.clsEmpty) {
toggleClass(this.$el, this.clsEmpty, !this.$el.children.length);
}
css(this.handle ? $$(this.handle, this.$el) : this.$el.children, 'touchAction', 'none');
if (!this.drag) {
return;
}
offset(this.drag, {top: this.pos.y + this.origin.top, left: this.pos.x + this.origin.left});
var ref = offset(this.drag);
var top = ref.top;
var bottom = top + this.drag.offsetHeight;
var scroll;
if (top > 0 && top < this.scrollY) {
scroll = this.scrollY - 5;
} else if (bottom < height(document) && bottom > height(window) + this.scrollY) {
scroll = this.scrollY + 5;
}
scroll && setTimeout(function () { return scrollTop(window, scroll); }, 5);
}
},
methods: {
init: function(e) {
var target = e.target;
var button = e.button;
var defaultPrevented = e.defaultPrevented;
var ref = toNodes(this.$el.children).filter(function (el) { return within(target, el); });
var placeholder = ref[0];
if (!placeholder
|| isInput(e.target)
|| this.handle && !within(target, this.handle)
|| button > 0
|| within(target, ("." + (this.clsNoDrag)))
|| defaultPrevented
) {
return;
}
e.preventDefault();
this.touched = [this];
this.placeholder = placeholder;
this.origin = assign({target: target, index: index(placeholder)}, this.pos);
on(document, pointerMove, this.move);
on(document, pointerUp, this.end);
on(window, 'scroll', this.scroll);
if (!this.threshold) {
this.start(e);
}
},
start: function(e) {
this.drag = append(this.$container, this.placeholder.outerHTML.replace(/^<li/i, '<div').replace(/li>$/i, 'div>'));
css(this.drag, assign({
boxSizing: 'border-box',
width: this.placeholder.offsetWidth,
height: this.placeholder.offsetHeight
}, css(this.placeholder, ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'])));
attr(this.drag, 'uk-no-boot', '');
addClass(this.drag, this.clsDrag, this.clsCustom);
height(this.drag.firstElementChild, height(this.placeholder.firstElementChild));
var ref = offset(this.placeholder);
var left = ref.left;
var top = ref.top;
assign(this.origin, {left: left - this.pos.x, top: top - this.pos.y});
addClass(this.placeholder, this.clsPlaceholder);
addClass(this.$el.children, this.clsItem);
addClass(document.documentElement, this.clsDragState);
trigger(this.$el, 'start', [this, this.placeholder]);
this.move(e);
},
move: function(e) {
if (!this.drag) {
if (Math.abs(this.pos.x - this.origin.x) > this.threshold || Math.abs(this.pos.y - this.origin.y) > this.threshold) {
this.start(e);
}
return;
}
this.$emit();
var target = e.type === 'mousemove' ? e.target : document.elementFromPoint(this.pos.x - document.body.scrollLeft, this.pos.y - document.body.scrollTop);
var sortable = this.getSortable(target);
var previous = this.getSortable(this.placeholder);
var move = sortable !== previous;
if (!sortable || within(target, this.placeholder) || move && (!sortable.group || sortable.group !== previous.group)) {
return;
}
target = sortable.$el === target.parentNode && target || toNodes(sortable.$el.children).filter(function (element) { return within(target, element); })[0];
if (move) {
previous.remove(this.placeholder);
} else if (!target) {
return;
}
sortable.insert(this.placeholder, target);
if (!includes(this.touched, sortable)) {
this.touched.push(sortable);
}
},
scroll: function() {
var scroll = window.pageYOffset;
if (scroll !== this.scrollY) {
this.pos.y += scroll - this.scrollY;
this.scrollY = scroll;
this.$emit();
}
},
end: function(e) {
off(document, pointerMove, this.move);
off(document, pointerUp, this.end);
off(window, 'scroll', this.scroll);
if (!this.drag) {
if (e.type !== 'mouseup' && within(e.target, 'a[href]')) {
location.href = closest(e.target, 'a[href]').href;
}
return;
}
preventClick();
var sortable = this.getSortable(this.placeholder);
if (this === sortable) {
if (this.origin.index !== index(this.placeholder)) {
trigger(this.$el, 'moved', [this, this.placeholder]);
}
} else {
trigger(sortable.$el, 'added', [sortable, this.placeholder]);
trigger(this.$el, 'removed', [this, this.placeholder]);
}
trigger(this.$el, 'stop', [this, this.placeholder]);
remove(this.drag);
this.drag = null;
var classes = this.touched.map(function (sortable) { return ((sortable.clsPlaceholder) + " " + (sortable.clsItem)); }).join(' ');
this.touched.forEach(function (sortable) { return removeClass(sortable.$el.children, classes); });
removeClass(document.documentElement, this.clsDragState);
},
insert: function(element, target) {
var this$1 = this;
addClass(this.$el.children, this.clsItem);
var insert = function () {
if (target) {
if (!within(element, this$1.$el) || isPredecessor(element, target)) {
before(target, element);
} else {
after(target, element);
}
} else {
append(this$1.$el, element);
}
};
if (this.animation) {
this.animate(insert);
} else {
insert();
}
},
remove: function(element) {
if (!within(element, this.$el)) {
return;
}
if (this.animation) {
this.animate(function () { return remove(element); });
} else {
remove(element);
}
},
getSortable: function(element) {
return element && (this.$getComponent(element, 'sortable') || this.getSortable(element.parentNode));
}
}
};
function isPredecessor(element, target) {
return element.parentNode === target.parentNode && index(element) > index(target);
}
var obj$2;
var actives = [];
var Tooltip = {
mixins: [Container, Togglable, Position],
args: 'title',
props: {
delay: Number,
title: String
},
data: {
pos: 'top',
title: '',
delay: 0,
animation: ['uk-animation-scale-up'],
duration: 100,
cls: 'uk-active',
clsPos: 'uk-tooltip'
},
beforeConnect: function() {
this._hasTitle = hasAttr(this.$el, 'title');
attr(this.$el, {title: '', 'aria-expanded': false});
},
disconnected: function() {
this.hide();
attr(this.$el, {title: this._hasTitle ? this.title : null, 'aria-expanded': null});
},
methods: {
show: function() {
var this$1 = this;
if (includes(actives, this)) {
return;
}
actives.forEach(function (active) { return active.hide(); });
actives.push(this);
this._unbind = on(document, 'click', function (e) { return !within(e.target, this$1.$el) && this$1.hide(); });
clearTimeout(this.showTimer);
this.tooltip = append(this.container, ("<div class=\"" + (this.clsPos) + "\" aria-hidden><div class=\"" + (this.clsPos) + "-inner\">" + (this.title) + "</div></div>"));
attr(this.$el, 'aria-expanded', true);
this.positionAt(this.tooltip, this.$el);
this.origin = this.getAxis() === 'y' ? ((flipPosition(this.dir)) + "-" + (this.align)) : ((this.align) + "-" + (flipPosition(this.dir)));
this.showTimer = setTimeout(function () {
this$1.toggleElement(this$1.tooltip, true);
this$1.hideTimer = setInterval(function () {
if (!isVisible(this$1.$el)) {
this$1.hide();
}
}, 150);
}, this.delay);
},
hide: function() {
var index$$1 = actives.indexOf(this);
if (!~index$$1 || matches(this.$el, 'input') && this.$el === document.activeElement) {
return;
}
actives.splice(index$$1, 1);
clearTimeout(this.showTimer);
clearInterval(this.hideTimer);
attr(this.$el, 'aria-expanded', false);
this.toggleElement(this.tooltip, false);
this.tooltip && remove(this.tooltip);
this.tooltip = false;
this._unbind();
}
},
events: ( obj$2 = {}, obj$2[("focus " + pointerEnter + " " + pointerDown)] = function (e) {
if (e.type !== pointerDown || !isTouch(e)) {
this.show();
}
}, obj$2.blur = 'hide', obj$2[pointerLeave] = function (e) {
if (!isTouch(e)) {
this.hide();
}
}, obj$2 )
};
var Upload = {
props: {
allow: String,
clsDragover: String,
concurrent: Number,
maxSize: Number,
method: String,
mime: String,
msgInvalidMime: String,
msgInvalidName: String,
msgInvalidSize: String,
multiple: Boolean,
name: String,
params: Object,
type: String,
url: String,
},
data: {
allow: false,
clsDragover: 'uk-dragover',
concurrent: 1,
maxSize: 0,
method: 'POST',
mime: false,
msgInvalidMime: 'Invalid File Type: %s',
msgInvalidName: 'Invalid File Name: %s',
msgInvalidSize: 'Invalid File Size: %s Kilobytes Max',
multiple: false,
name: 'files[]',
params: {},
type: '',
url: '',
abort: noop,
beforeAll: noop,
beforeSend: noop,
complete: noop,
completeAll: noop,
error: noop,
fail: noop,
load: noop,
loadEnd: noop,
loadStart: noop,
progress: noop
},
events: {
change: function(e) {
if (!matches(e.target, 'input[type="file"]')) {
return;
}
e.preventDefault();
if (e.target.files) {
this.upload(e.target.files);
}
e.target.value = '';
},
drop: function(e) {
stop(e);
var transfer = e.dataTransfer;
if (!transfer || !transfer.files) {
return;
}
removeClass(this.$el, this.clsDragover);
this.upload(transfer.files);
},
dragenter: function(e) {
stop(e);
},
dragover: function(e) {
stop(e);
addClass(this.$el, this.clsDragover);
},
dragleave: function(e) {
stop(e);
removeClass(this.$el, this.clsDragover);
}
},
methods: {
upload: function(files) {
var this$1 = this;
if (!files.length) {
return;
}
trigger(this.$el, 'upload', [files]);
for (var i = 0; i < files.length; i++) {
if (this$1.maxSize && this$1.maxSize * 1000 < files[i].size) {
this$1.fail(this$1.msgInvalidSize.replace('%s', this$1.maxSize));
return;
}
if (this$1.allow && !match(this$1.allow, files[i].name)) {
this$1.fail(this$1.msgInvalidName.replace('%s', this$1.allow));
return;
}
if (this$1.mime && !match(this$1.mime, files[i].type)) {
this$1.fail(this$1.msgInvalidMime.replace('%s', this$1.mime));
return;
}
}
if (!this.multiple) {
files = [files[0]];
}
this.beforeAll(this, files);
var chunks = chunk(files, this.concurrent);
var upload = function (files) {
var data$$1 = new FormData();
files.forEach(function (file) { return data$$1.append(this$1.name, file); });
for (var key in this$1.params) {
data$$1.append(key, this$1.params[key]);
}
ajax(this$1.url, {
data: data$$1,
method: this$1.method,
responseType: this$1.type,
beforeSend: function (env) {
var xhr = env.xhr;
xhr.upload && on(xhr.upload, 'progress', this$1.progress);
['loadStart', 'load', 'loadEnd', 'abort'].forEach(function (type) { return on(xhr, type.toLowerCase(), this$1[type]); }
);
this$1.beforeSend(env);
}
}).then(
function (xhr) {
this$1.complete(xhr);
if (chunks.length) {
upload(chunks.shift());
} else {
this$1.completeAll(xhr);
}
},
function (e) { return this$1.error(e); }
);
};
upload(chunks.shift());
}
}
};
function match(pattern, path) {
return path.match(new RegExp(("^" + (pattern.replace(/\//g, '\\/').replace(/\*\*/g, '(\\/[^\\/]+)*').replace(/\*/g, '[^\\/]+').replace(/((?!\\))\?/g, '$1.')) + "$"), 'i'));
}
function chunk(files, size) {
var chunks = [];
for (var i = 0; i < files.length; i += size) {
var chunk = [];
for (var j = 0; j < size; j++) {
chunk.push(files[i + j]);
}
chunks.push(chunk);
}
return chunks;
}
function stop(e) {
e.preventDefault();
e.stopPropagation();
}
UIkit.component('countdown', Countdown);
UIkit.component('filter', Filter);
UIkit.component('lightbox', Lightbox);
UIkit.component('lightboxPanel', LightboxPanel);
UIkit.component('notification', Notification);
UIkit.component('parallax', Parallax$1);
UIkit.component('slider', Slider$1);
UIkit.component('sliderParallax', SliderParallax);
UIkit.component('slideshow', Slideshow$1);
UIkit.component('slideshowParallax', SliderParallax);
UIkit.component('sortable', Sortable);
UIkit.component('tooltip', Tooltip);
UIkit.component('upload', Upload);
{
boot(UIkit);
}
return UIkit;
})));