(function(ElementProto){if(typeof ElementProto.matches!=='function'){ElementProto.matches=ElementProto.msMatchesSelector||ElementProto.mozMatchesSelector||ElementProto.webkitMatchesSelector||function matches(selector){var element=this;var elements=(element.document||element.ownerDocument).querySelectorAll(selector);var index=0;while(elements[index]&&elements[index]!==element){++index}
return Boolean(elements[index])}}
if(typeof ElementProto.closest!=='function'){ElementProto.closest=function closest(selector){var element=this;while(element&&element.nodeType===1){if(element.matches(selector)){return element}
element=element.parentNode}
return null}}})(window.Element.prototype);
/**
 * Copyright 2016 Google Inc. All Rights Reserved.
 *
 * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.
 *
 *  https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
 *
 */

(function(window, document) {
    'use strict';


// Exits early if all IntersectionObserver and IntersectionObserverEntry
// features are natively supported.
    if ('IntersectionObserver' in window &&
        'IntersectionObserverEntry' in window &&
        'intersectionRatio' in window.IntersectionObserverEntry.prototype) {

        // Minimal polyfill for Edge 15's lack of `isIntersecting`
        // See: https://github.com/w3c/IntersectionObserver/issues/211
        if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {
            Object.defineProperty(window.IntersectionObserverEntry.prototype,
                'isIntersecting', {
                    get: function () {
                        return this.intersectionRatio > 0;
                    }
                });
        }
        return;
    }


    /**
     * An IntersectionObserver registry. This registry exists to hold a strong
     * reference to IntersectionObserver instances currently observering a target
     * element. Without this registry, instances without another reference may be
     * garbage collected.
     */
    var registry = [];


    /**
     * Creates the global IntersectionObserverEntry constructor.
     * https://w3c.github.io/IntersectionObserver/#intersection-observer-entry
     * @param {Object} entry A dictionary of instance properties.
     * @constructor
     */
    function IntersectionObserverEntry(entry) {
        this.time = entry.time;
        this.target = entry.target;
        this.rootBounds = entry.rootBounds;
        this.boundingClientRect = entry.boundingClientRect;
        this.intersectionRect = entry.intersectionRect || getEmptyRect();
        this.isIntersecting = !!entry.intersectionRect;

        // Calculates the intersection ratio.
        var targetRect = this.boundingClientRect;
        var targetArea = targetRect.width * targetRect.height;
        var intersectionRect = this.intersectionRect;
        var intersectionArea = intersectionRect.width * intersectionRect.height;

        // Sets intersection ratio.
        if (targetArea) {
            this.intersectionRatio = intersectionArea / targetArea;
        } else {
            // If area is zero and is intersecting, sets to 1, otherwise to 0
            this.intersectionRatio = this.isIntersecting ? 1 : 0;
        }
    }


    /**
     * Creates the global IntersectionObserver constructor.
     * https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
     * @param {Function} callback The function to be invoked after intersection
     *     changes have queued. The function is not invoked if the queue has
     *     been emptied by calling the `takeRecords` method.
     * @param {Object=} opt_options Optional configuration options.
     * @constructor
     */
    function IntersectionObserver(callback, opt_options) {

        var options = opt_options || {};

        if (typeof callback != 'function') {
            throw new Error('callback must be a function');
        }

        if (options.root && options.root.nodeType != 1) {
            throw new Error('root must be an Element');
        }

        // Binds and throttles `this._checkForIntersections`.
        this._checkForIntersections = throttle(
            this._checkForIntersections.bind(this), this.THROTTLE_TIMEOUT);

        // Private properties.
        this._callback = callback;
        this._observationTargets = [];
        this._queuedEntries = [];
        this._rootMarginValues = this._parseRootMargin(options.rootMargin);

        // Public properties.
        this.thresholds = this._initThresholds(options.threshold);
        this.root = options.root || null;
        this.rootMargin = this._rootMarginValues.map(function(margin) {
            return margin.value + margin.unit;
        }).join(' ');
    }


    /**
     * The minimum interval within which the document will be checked for
     * intersection changes.
     */
    IntersectionObserver.prototype.THROTTLE_TIMEOUT = 100;


    /**
     * The frequency in which the polyfill polls for intersection changes.
     * this can be updated on a per instance basis and must be set prior to
     * calling `observe` on the first target.
     */
    IntersectionObserver.prototype.POLL_INTERVAL = null;

    /**
     * Use a mutation observer on the root element
     * to detect intersection changes.
     */
    IntersectionObserver.prototype.USE_MUTATION_OBSERVER = true;


    /**
     * Starts observing a target element for intersection changes based on
     * the thresholds values.
     * @param {Element} target The DOM element to observe.
     */
    IntersectionObserver.prototype.observe = function(target) {
        var isTargetAlreadyObserved = this._observationTargets.some(function(item) {
            return item.element == target;
        });

        if (isTargetAlreadyObserved) {
            return;
        }

        if (!(target && target.nodeType == 1)) {
            throw new Error('target must be an Element');
        }

        this._registerInstance();
        this._observationTargets.push({element: target, entry: null});
        this._monitorIntersections();
        this._checkForIntersections();
    };


    /**
     * Stops observing a target element for intersection changes.
     * @param {Element} target The DOM element to observe.
     */
    IntersectionObserver.prototype.unobserve = function(target) {
        this._observationTargets =
            this._observationTargets.filter(function(item) {

                return item.element != target;
            });
        if (!this._observationTargets.length) {
            this._unmonitorIntersections();
            this._unregisterInstance();
        }
    };


    /**
     * Stops observing all target elements for intersection changes.
     */
    IntersectionObserver.prototype.disconnect = function() {
        this._observationTargets = [];
        this._unmonitorIntersections();
        this._unregisterInstance();
    };


    /**
     * Returns any queue entries that have not yet been reported to the
     * callback and clears the queue. This can be used in conjunction with the
     * callback to obtain the absolute most up-to-date intersection information.
     * @return {Array} The currently queued entries.
     */
    IntersectionObserver.prototype.takeRecords = function() {
        var records = this._queuedEntries.slice();
        this._queuedEntries = [];
        return records;
    };


    /**
     * Accepts the threshold value from the user configuration object and
     * returns a sorted array of unique threshold values. If a value is not
     * between 0 and 1 and error is thrown.
     * @private
     * @param {Array|number=} opt_threshold An optional threshold value or
     *     a list of threshold values, defaulting to [0].
     * @return {Array} A sorted list of unique and valid threshold values.
     */
    IntersectionObserver.prototype._initThresholds = function(opt_threshold) {
        var threshold = opt_threshold || [0];
        if (!Array.isArray(threshold)) threshold = [threshold];

        return threshold.sort().filter(function(t, i, a) {
            if (typeof t != 'number' || isNaN(t) || t < 0 || t > 1) {
                throw new Error('threshold must be a number between 0 and 1 inclusively');
            }
            return t !== a[i - 1];
        });
    };


    /**
     * Accepts the rootMargin value from the user configuration object
     * and returns an array of the four margin values as an object containing
     * the value and unit properties. If any of the values are not properly
     * formatted or use a unit other than px or %, and error is thrown.
     * @private
     * @param {string=} opt_rootMargin An optional rootMargin value,
     *     defaulting to '0px'.
     * @return {Array<Object>} An array of margin objects with the keys
     *     value and unit.
     */
    IntersectionObserver.prototype._parseRootMargin = function(opt_rootMargin) {
        var marginString = opt_rootMargin || '0px';
        var margins = marginString.split(/\s+/).map(function(margin) {
            var parts = /^(-?\d*\.?\d+)(px|%)$/.exec(margin);
            if (!parts) {
                throw new Error('rootMargin must be specified in pixels or percent');
            }
            return {value: parseFloat(parts[1]), unit: parts[2]};
        });

        // Handles shorthand.
        margins[1] = margins[1] || margins[0];
        margins[2] = margins[2] || margins[0];
        margins[3] = margins[3] || margins[1];

        return margins;
    };


    /**
     * Starts polling for intersection changes if the polling is not already
     * happening, and if the page's visibilty state is visible.
     * @private
     */
    IntersectionObserver.prototype._monitorIntersections = function() {
        if (!this._monitoringIntersections) {
            this._monitoringIntersections = true;

            // If a poll interval is set, use polling instead of listening to
            // resize and scroll events or DOM mutations.
            if (this.POLL_INTERVAL) {
                this._monitoringInterval = setInterval(
                    this._checkForIntersections, this.POLL_INTERVAL);
            }
            else {
                addEvent(window, 'resize', this._checkForIntersections, true);
                addEvent(document, 'scroll', this._checkForIntersections, true);

                if (this.USE_MUTATION_OBSERVER && 'MutationObserver' in window) {
                    this._domObserver = new MutationObserver(this._checkForIntersections);
                    this._domObserver.observe(document, {
                        attributes: true,
                        childList: true,
                        characterData: true,
                        subtree: true
                    });
                }
            }
        }
    };


    /**
     * Stops polling for intersection changes.
     * @private
     */
    IntersectionObserver.prototype._unmonitorIntersections = function() {
        if (this._monitoringIntersections) {
            this._monitoringIntersections = false;

            clearInterval(this._monitoringInterval);
            this._monitoringInterval = null;

            removeEvent(window, 'resize', this._checkForIntersections, true);
            removeEvent(document, 'scroll', this._checkForIntersections, true);

            if (this._domObserver) {
                this._domObserver.disconnect();
                this._domObserver = null;
            }
        }
    };


    /**
     * Scans each observation target for intersection changes and adds them
     * to the internal entries queue. If new entries are found, it
     * schedules the callback to be invoked.
     * @private
     */
    IntersectionObserver.prototype._checkForIntersections = function() {
        var rootIsInDom = this._rootIsInDom();
        var rootRect = rootIsInDom ? this._getRootRect() : getEmptyRect();

        this._observationTargets.forEach(function(item) {
            var target = item.element;
            var targetRect = getBoundingClientRect(target);
            var rootContainsTarget = this._rootContainsTarget(target);
            var oldEntry = item.entry;
            var intersectionRect = rootIsInDom && rootContainsTarget &&
                this._computeTargetAndRootIntersection(target, rootRect);

            var newEntry = item.entry = new IntersectionObserverEntry({
                time: now(),
                target: target,
                boundingClientRect: targetRect,
                rootBounds: rootRect,
                intersectionRect: intersectionRect
            });

            if (!oldEntry) {
                this._queuedEntries.push(newEntry);
            } else if (rootIsInDom && rootContainsTarget) {
                // If the new entry intersection ratio has crossed any of the
                // thresholds, add a new entry.
                if (this._hasCrossedThreshold(oldEntry, newEntry)) {
                    this._queuedEntries.push(newEntry);
                }
            } else {
                // If the root is not in the DOM or target is not contained within
                // root but the previous entry for this target had an intersection,
                // add a new record indicating removal.
                if (oldEntry && oldEntry.isIntersecting) {
                    this._queuedEntries.push(newEntry);
                }
            }
        }, this);

        if (this._queuedEntries.length) {
            this._callback(this.takeRecords(), this);
        }
    };


    /**
     * Accepts a target and root rect computes the intersection between then
     * following the algorithm in the spec.
     * TODO(philipwalton): at this time clip-path is not considered.
     * https://w3c.github.io/IntersectionObserver/#calculate-intersection-rect-algo
     * @param {Element} target The target DOM element
     * @param {Object} rootRect The bounding rect of the root after being
     *     expanded by the rootMargin value.
     * @return {?Object} The final intersection rect object or undefined if no
     *     intersection is found.
     * @private
     */
    IntersectionObserver.prototype._computeTargetAndRootIntersection =
        function(target, rootRect) {

            // If the element isn't displayed, an intersection can't happen.
            if (window.getComputedStyle(target).display == 'none') return;

            var targetRect = getBoundingClientRect(target);
            var intersectionRect = targetRect;
            var parent = getParentNode(target);
            var atRoot = false;

            while (!atRoot) {
                var parentRect = null;
                var parentComputedStyle = parent.nodeType == 1 ?
                    window.getComputedStyle(parent) : {};

                // If the parent isn't displayed, an intersection can't happen.
                if (parentComputedStyle.display == 'none') return;

                if (parent == this.root || parent == document) {
                    atRoot = true;
                    parentRect = rootRect;
                } else {
                    // If the element has a non-visible overflow, and it's not the <body>
                    // or <html> element, update the intersection rect.
                    // Note: <body> and <html> cannot be clipped to a rect that's not also
                    // the document rect, so no need to compute a new intersection.
                    if (parent != document.body &&
                        parent != document.documentElement &&
                        parentComputedStyle.overflow != 'visible') {
                        parentRect = getBoundingClientRect(parent);
                    }
                }

                // If either of the above conditionals set a new parentRect,
                // calculate new intersection data.
                if (parentRect) {
                    intersectionRect = computeRectIntersection(parentRect, intersectionRect);

                    if (!intersectionRect) break;
                }
                parent = getParentNode(parent);
            }
            return intersectionRect;
        };


    /**
     * Returns the root rect after being expanded by the rootMargin value.
     * @return {Object} The expanded root rect.
     * @private
     */
    IntersectionObserver.prototype._getRootRect = function() {
        var rootRect;
        if (this.root) {
            rootRect = getBoundingClientRect(this.root);
        } else {
            // Use <html>/<body> instead of window since scroll bars affect size.
            var html = document.documentElement;
            var body = document.body;
            rootRect = {
                top: 0,
                left: 0,
                right: html.clientWidth || body.clientWidth,
                width: html.clientWidth || body.clientWidth,
                bottom: html.clientHeight || body.clientHeight,
                height: html.clientHeight || body.clientHeight
            };
        }
        return this._expandRectByRootMargin(rootRect);
    };


    /**
     * Accepts a rect and expands it by the rootMargin value.
     * @param {Object} rect The rect object to expand.
     * @return {Object} The expanded rect.
     * @private
     */
    IntersectionObserver.prototype._expandRectByRootMargin = function(rect) {
        var margins = this._rootMarginValues.map(function(margin, i) {
            return margin.unit == 'px' ? margin.value :
                margin.value * (i % 2 ? rect.width : rect.height) / 100;
        });
        var newRect = {
            top: rect.top - margins[0],
            right: rect.right + margins[1],
            bottom: rect.bottom + margins[2],
            left: rect.left - margins[3]
        };
        newRect.width = newRect.right - newRect.left;
        newRect.height = newRect.bottom - newRect.top;

        return newRect;
    };


    /**
     * Accepts an old and new entry and returns true if at least one of the
     * threshold values has been crossed.
     * @param {?IntersectionObserverEntry} oldEntry The previous entry for a
     *    particular target element or null if no previous entry exists.
     * @param {IntersectionObserverEntry} newEntry The current entry for a
     *    particular target element.
     * @return {boolean} Returns true if a any threshold has been crossed.
     * @private
     */
    IntersectionObserver.prototype._hasCrossedThreshold =
        function(oldEntry, newEntry) {

            // To make comparing easier, an entry that has a ratio of 0
            // but does not actually intersect is given a value of -1
            var oldRatio = oldEntry && oldEntry.isIntersecting ?
                oldEntry.intersectionRatio || 0 : -1;
            var newRatio = newEntry.isIntersecting ?
                newEntry.intersectionRatio || 0 : -1;

            // Ignore unchanged ratios
            if (oldRatio === newRatio) return;

            for (var i = 0; i < this.thresholds.length; i++) {
                var threshold = this.thresholds[i];

                // Return true if an entry matches a threshold or if the new ratio
                // and the old ratio are on the opposite sides of a threshold.
                if (threshold == oldRatio || threshold == newRatio ||
                    threshold < oldRatio !== threshold < newRatio) {
                    return true;
                }
            }
        };


    /**
     * Returns whether or not the root element is an element and is in the DOM.
     * @return {boolean} True if the root element is an element and is in the DOM.
     * @private
     */
    IntersectionObserver.prototype._rootIsInDom = function() {
        return !this.root || containsDeep(document, this.root);
    };


    /**
     * Returns whether or not the target element is a child of root.
     * @param {Element} target The target element to check.
     * @return {boolean} True if the target element is a child of root.
     * @private
     */
    IntersectionObserver.prototype._rootContainsTarget = function(target) {
        return containsDeep(this.root || document, target);
    };


    /**
     * Adds the instance to the global IntersectionObserver registry if it isn't
     * already present.
     * @private
     */
    IntersectionObserver.prototype._registerInstance = function() {
        if (registry.indexOf(this) < 0) {
            registry.push(this);
        }
    };


    /**
     * Removes the instance from the global IntersectionObserver registry.
     * @private
     */
    IntersectionObserver.prototype._unregisterInstance = function() {
        var index = registry.indexOf(this);
        if (index != -1) registry.splice(index, 1);
    };


    /**
     * Returns the result of the performance.now() method or null in browsers
     * that don't support the API.
     * @return {number} The elapsed time since the page was requested.
     */
    function now() {
        return window.performance && performance.now && performance.now();
    }


    /**
     * Throttles a function and delays its executiong, so it's only called at most
     * once within a given time period.
     * @param {Function} fn The function to throttle.
     * @param {number} timeout The amount of time that must pass before the
     *     function can be called again.
     * @return {Function} The throttled function.
     */
    function throttle(fn, timeout) {
        var timer = null;
        return function () {
            if (!timer) {
                timer = setTimeout(function() {
                    fn();
                    timer = null;
                }, timeout);
            }
        };
    }


    /**
     * Adds an event handler to a DOM node ensuring cross-browser compatibility.
     * @param {Node} node The DOM node to add the event handler to.
     * @param {string} event The event name.
     * @param {Function} fn The event handler to add.
     * @param {boolean} opt_useCapture Optionally adds the even to the capture
     *     phase. Note: this only works in modern browsers.
     */
    function addEvent(node, event, fn, opt_useCapture) {
        if (typeof node.addEventListener == 'function') {
            node.addEventListener(event, fn, opt_useCapture || false);
        }
        else if (typeof node.attachEvent == 'function') {
            node.attachEvent('on' + event, fn);
        }
    }


    /**
     * Removes a previously added event handler from a DOM node.
     * @param {Node} node The DOM node to remove the event handler from.
     * @param {string} event The event name.
     * @param {Function} fn The event handler to remove.
     * @param {boolean} opt_useCapture If the event handler was added with this
     *     flag set to true, it should be set to true here in order to remove it.
     */
    function removeEvent(node, event, fn, opt_useCapture) {
        if (typeof node.removeEventListener == 'function') {
            node.removeEventListener(event, fn, opt_useCapture || false);
        }
        else if (typeof node.detatchEvent == 'function') {
            node.detatchEvent('on' + event, fn);
        }
    }


    /**
     * Returns the intersection between two rect objects.
     * @param {Object} rect1 The first rect.
     * @param {Object} rect2 The second rect.
     * @return {?Object} The intersection rect or undefined if no intersection
     *     is found.
     */
    function computeRectIntersection(rect1, rect2) {
        var top = Math.max(rect1.top, rect2.top);
        var bottom = Math.min(rect1.bottom, rect2.bottom);
        var left = Math.max(rect1.left, rect2.left);
        var right = Math.min(rect1.right, rect2.right);
        var width = right - left;
        var height = bottom - top;

        return (width >= 0 && height >= 0) && {
            top: top,
            bottom: bottom,
            left: left,
            right: right,
            width: width,
            height: height
        };
    }


    /**
     * Shims the native getBoundingClientRect for compatibility with older IE.
     * @param {Element} el The element whose bounding rect to get.
     * @return {Object} The (possibly shimmed) rect of the element.
     */
    function getBoundingClientRect(el) {
        var rect;

        try {
            rect = el.getBoundingClientRect();
        } catch (err) {
            // Ignore Windows 7 IE11 "Unspecified error"
            // https://github.com/w3c/IntersectionObserver/pull/205
        }

        if (!rect) return getEmptyRect();

        // Older IE
        if (!(rect.width && rect.height)) {
            rect = {
                top: rect.top,
                right: rect.right,
                bottom: rect.bottom,
                left: rect.left,
                width: rect.right - rect.left,
                height: rect.bottom - rect.top
            };
        }
        return rect;
    }


    /**
     * Returns an empty rect object. An empty rect is returned when an element
     * is not in the DOM.
     * @return {Object} The empty rect.
     */
    function getEmptyRect() {
        return {
            top: 0,
            bottom: 0,
            left: 0,
            right: 0,
            width: 0,
            height: 0
        };
    }

    /**
     * Checks to see if a parent element contains a child elemnt (including inside
     * shadow DOM).
     * @param {Node} parent The parent element.
     * @param {Node} child The child element.
     * @return {boolean} True if the parent node contains the child node.
     */
    function containsDeep(parent, child) {
        var node = child;
        while (node) {
            if (node == parent) return true;

            node = getParentNode(node);
        }
        return false;
    }


    /**
     * Gets the parent node of an element or its host element if the parent node
     * is a shadow root.
     * @param {Node} node The node whose parent to get.
     * @return {Node|null} The parent node or null if no parent exists.
     */
    function getParentNode(node) {
        var parent = node.parentNode;

        if (parent && parent.nodeType == 11 && parent.host) {
            // If the parent is a shadow root, return the host element.
            return parent.host;
        }
        return parent;
    }


// Exposes the constructors globally.
    window.IntersectionObserver = IntersectionObserver;
    window.IntersectionObserverEntry = IntersectionObserverEntry;

}(window, document));

// NodeList.forEach ES5 polyfill - https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach#Polyfill

if (window.NodeList && !NodeList.prototype.forEach) {
	NodeList.prototype.forEach = function (callback, thisArg) {
		thisArg = thisArg || window;
		for (var i = 0; i < this.length; i++) {
			callback.call(thisArg, this[i], i, this);
		}
	};
}

/*----------------------------------------
 * objectFitPolyfill 2.1.1
 *
 * Basic, no-frills version -
 * Defaults to object-fit: cover and object-position: 50% 50%
 *
 * Made by Constance Chen
 * Released under the MIT license
 *
 * https://github.com/constancecchen/object-fit-polyfill
 *--------------------------------------*/

(function() {
	"use strict";

	// if the page is being rendered on the server, don't continue
	if(typeof window === "undefined") {
		return;
	}

	// Workaround for Edge 16+, which only implemented object-fit for <img> tags
	// TODO: Keep an eye on Edge to determine which version has full final support
	var edgeVersion = window.navigator.userAgent.match(/Edge\/(\d{2})\./);
	var edgePartialSupport = (edgeVersion) ? (parseInt(edgeVersion[1], 10) >= 16) : false;

	// If the browser does support object-fit, we don't need to continue
	if("objectFit" in document.documentElement.style !== false && !edgePartialSupport) {
		window.objectFitPolyfill = function() {
			return false
		};
		return;
	}

	/**
	 * Check the container's parent element to make sure it will
	 * correctly handle and clip absolutely positioned children
	 *
	 * @param {node} $container - parent element
	 */
	var checkParentContainer = function($container) {
		var styles = window.getComputedStyle($container, null);
		var position = styles.getPropertyValue("position");
		var overflow = styles.getPropertyValue("overflow");
		var display = styles.getPropertyValue("display");

		if(!position || position === "static") {
			$container.style.position = "relative";
		}
		if(overflow !== "hidden") {
			$container.style.overflow = "hidden";
		}
		// Guesstimating that people want the parent to act like full width/height wrapper here.
		// Mostly attempts to target <picture> elements, which default to inline.
		if(!display || display === "inline") {
			$container.style.display = "block";
		}
		if($container.clientHeight === 0) {
			$container.style.height = "100%";
		}

		// Add a CSS class hook, in case people need to override styles for any reason.
		if($container.className.indexOf("object-fit-polyfill") === -1) {
			$container.className = $container.className + " object-fit-polyfill";
		}
	};

	/**
	 * Check for pre-set max-width/height, min-width/height,
	 * positioning, or margins, which can mess up image calculations
	 *
	 * @param {node} $media - img/video element
	 */
	var checkMediaProperties = function($media) {
		var styles = window.getComputedStyle($media, null);
		var constraints = {
			"max-width": "none",
			"max-height": "none",
			"min-width": "0px",
			"min-height": "0px",
			"top": "auto",
			"right": "auto",
			"bottom": "auto",
			"left": "auto",
			"margin-top": "0px",
			"margin-right": "0px",
			"margin-bottom": "0px",
			"margin-left": "0px",
		};

		for(var property in constraints) {
			var constraint = styles.getPropertyValue(property);

			if(constraint !== constraints[property]) {
				$media.style[property] = constraints[property];
			}
		}
	};

	/**
	 * Calculate & set object-fit
	 *
	 * @param {node} $media - img/video/picture element
	 */
	var objectFit = function($media) {
		// If necessary, make the parent container work with absolutely positioned elements
		var $container = $media.parentNode;
		checkParentContainer($container);

		// Check for any pre-set CSS which could mess up image calculations
		checkMediaProperties($media);

		// Mathematically figure out which side needs covering, and add CSS positioning & centering
		$media.style.position = "absolute";
		$media.style.height = "100%";
		$media.style.width = "auto";

		if(
			$media.clientWidth > $container.clientWidth
		) {
			$media.style.top = "0";
			$media.style.marginTop = "0";
			$media.style.left = "50%";
			$media.style.marginLeft = ($media.clientWidth / -2) + "px";
		} else {
			$media.style.width = "100%";
			$media.style.height = "auto";
			$media.style.left = "0";
			$media.style.marginLeft = "0";
			$media.style.top = "50%";
			$media.style.marginTop = ($media.clientHeight / -2) + "px";
		}
	};

	/**
	 * Initialize plugin
	 *
	 * @param {node} media - Optional specific DOM node(s) to be polyfilled
	 */
	var objectFitPolyfill = function(media) {
		if(typeof media === "undefined") {
			// If left blank, all media on the page will be polyfilled.
			media = document.querySelectorAll("[data-object-fit]");
		} else
			if(media && media.nodeName) {
				// If it's a single node, wrap it in an array so it works.
				media = [media];
			} else
				if(typeof media === "object" && media.length && media[0].nodeName) {
					// If it's an array of DOM nodes (e.g. a jQuery selector), it's fine as-is.
					media = media;
				} else {
					// Otherwise, if it's invalid or an incorrect type, return false to let people know.
					return false;
				}

		for(var i = 0; i < media.length; i++) {
			if(!media[i].nodeName) {
				continue;
			}
			var mediaType = media[i].nodeName.toLowerCase();

			if(mediaType === "img" && !edgePartialSupport) {
				if(media[i].complete) {
					objectFit(media[i]);
				} else {
					media[i].addEventListener("load", function() {
						objectFit(this);
					});
				}
			} else
				if(mediaType === "video") {
					if(media[i].readyState > 0) {
						objectFit(media[i]);
					} else {
						media[i].addEventListener("loadedmetadata", function() {
							objectFit(this);
						});
					}
				}
		}

		return true;
	};

	document.addEventListener("DOMContentLoaded", function() {
		objectFitPolyfill(document.querySelectorAll('.js-object-fit-polyfill'));

	});
	window.addEventListener("resize", function() {
		objectFitPolyfill(document.querySelectorAll('.js-object-fit-polyfill'));
	});

	window.objectFitPolyfill = objectFitPolyfill;

})();

// Scroll Width Polyfill version 1.1
// Github: https://github.com/gregwhitworth/scrollWidthPolyfill
// License: MIT License (http://opensource.org/licenses/MIT)
var polyScrollWidth = (function (document, window) {

	var polyScrollWidth = window.polyScrollWidth || {
		"needsPoly": false,
		"usedPoly": false,
		"version": 1.1
	};

	var origScrollWidth = Object.getOwnPropertyDescriptor(Element.prototype, 'scrollWidth').get;

	init();

	// Init
	// ---------------------------------------------
	// This initializes the polyfill and checks to see
	// if the scrollWidth method is producing a reasonable
	// result, if so then no need to polyfill.
	function init() {
		var needsPoly = featureDetect();
		if(!needsPoly) {
			polyScrollWidth.needsPoly = false;
			return polyScrollWidth;
		} else {
			polyScrollWidth.needsPoly = true;
		}

		// Create new polyfill for scrollWidth since we need to polyfill it
		Object.defineProperty(Element.prototype, "scrollWidth", { configurable: true, enumerable: true, get: getScrollWidth });
	}

	// Feature Detect
	// ---------------------------------------------
	// Unfortunately we're making this polyfill for interop reasons, so we
	// need to do a quick test to ensure that it is implemented correctly.
	// Because of this we will create two ghost elements and then match them
	// to see if they return reasonable results for scrollWidth
	function featureDetect() {
		var needsPoly = false;
		var overrideStyles = [
			{
				"name":"float",
				"value":"left"
			},
			{
				"name":"paddingLeft",
				"value":"0px"
			},
			{
				"name":"paddingRight",
				"value":"0px"
			},
			{
				"name":"position",
				"value":"absolute"
			},
			{
				"name":"width",
				"value":"0px"
			},
			{
				"name":"borderRightWidth",
				"value":"0px"
			},
			{
				"name":"borderLeftWidth",
				"value":"0px"
			},
			{
				"name":"visibility",
				"value":"hidden"
			}
		];

		var ghostMeasureInput = createGhostElement("input", null, overrideStyles, "Test", true);

		// Check within +/- 2 pixels for reasonable results of scrollWidth in comparison to clientWidth [both should include padding]
		if(ghostMeasureInput.scrollWidth == 0) {
			needsPoly = true;
		}

		return needsPoly;
	}

	// Create Ghost Element
	// ---------------------------------------------
	// This will create the ghost items and then return the measured results. It also
	// deletes the node and removes the HTML after it's done.
	// <param name="elType"" type="string">This is the type of element you want to create, for example a div</param>
	// <param name="computedStyles" type="CSSStyleDeclaration">These are the computed styles of the element you're wanting your ghost element to match</param>
	// <param name="overrideStyles" type="[{name, value}]">These are the styles you want to override on the new element (eg: [{"name":"visibility", "value":"hidden"}])</param>
	// <param name="content" type="string">This is the content that you want to be included in the element for measurement</param>
	// <param name="callScrollWidth" type="bool">Do you want to call scrollWidth, if you set this to true and the polyfill has been set you'll end up in a loop</param>
	// <return name="ghostMeasure" type="{"scrollWidth", "clientWidth"}">These are the two widths that we care about and will pass these back to the methods that want to do something with them</param>
	function createGhostElement(elType, computedStyles, /* [{ name, value }] */ overrideStyles,  content, callScrollWidth) {
		var id, el, ghostMeasure;
		elType = elType.toLowerCase();

		id = "swMeasure-" + Date.now();
		el = document.createElement(elType);
		el.id = id;

		var initStyle = el.style;

		if(computedStyles !== null) {
			var csKeys = Object.keys(computedStyles.__proto__);
			csKeys.forEach(function(prop) {
				initStyle[prop] = computedStyles[prop];
			})
			el.style = initStyle;
		}

		overrideStyles.forEach(function(overrideStyle) {
			el.style[overrideStyle.name] = overrideStyle.value;
		});

		if(elType == "input" || elType == "textarea") {
			el.value = content;
		}
		else {
			el.textContent = content;
		}

		document.getElementsByTagName('body')[0].appendChild(el);

		el = document.getElementById(id);

		ghostMeasure = {
			"scrollWidth": (callScrollWidth) ? el.scrollWidth : 0,
			"clientWidth": parseInt(el.clientWidth, 10)
		};

		el.outerHTML = "";
		delete el;

		return ghostMeasure;
	}

	// Get Scroll Width
	// --------------------------------------------------------
	// Will get all necessary information from the input to
	// completely polyfill el.scrollWidth
	// <return type="int">The max of the element width or the clientWidth</return>
	function getScrollWidth() {
		if(this.nodeName != "INPUT" && this.nodeName != "TEXTAREA") return origScrollWidth.call(this);

		polyScrollWidth.usedPoly = true;
		var width = "auto";
		var computedStyles = window.getComputedStyle(this, null);

		// We only want to set the width of the container if it is a textarea since
		// that will need accurate wrapping. For any other input we just want the
		// length of the text as one long string so width should be ""
		if(this.nodeName == "TEXTAREA") width = computedStyles.width;

		var overrideStyles = [
			{
				"name": "position",
				"value": "absolute"
			},
			{
				"name": "float",
				"value": "left"
			},
			{
				"name":"visibility",
				"value":"hidden"
			},
			// We don't want the width set
			{
				"name":"width",
				"value": width
			}
		];

		var ghost = createGhostElement("div", computedStyles, overrideStyles, this.value, false);

		return Math.max(parseInt(computedStyles.width), ghost.clientWidth); //scrollWidth returns the max of content or element width
	}

	return polyScrollWidth;
})(document, window);

/* flatpickr v4.5.1, @license MIT */
(function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global.flatpickr=factory())}(this,(function(){'use strict';var pad=function pad(number){return("0"+number).slice(-2)};var int=function int(bool){return bool===!0?1:0};function debounce(func,wait,immediate){if(immediate===void 0){immediate=!1}
var timeout;return function(){var context=this,args=arguments;timeout!==null&&clearTimeout(timeout);timeout=window.setTimeout(function(){timeout=null;if(!immediate)func.apply(context,args)},wait);if(immediate&&!timeout)func.apply(context,args)}}
var arrayify=function arrayify(obj){return obj instanceof Array?obj:[obj]};var do_nothing=function do_nothing(){return undefined};var monthToStr=function monthToStr(monthNumber,shorthand,locale){return locale.months[shorthand?"shorthand":"longhand"][monthNumber]};var revFormat={D:do_nothing,F:function F(dateObj,monthName,locale){dateObj.setMonth(locale.months.longhand.indexOf(monthName))},G:function G(dateObj,hour){dateObj.setHours(parseFloat(hour))},H:function H(dateObj,hour){dateObj.setHours(parseFloat(hour))},J:function J(dateObj,day){dateObj.setDate(parseFloat(day))},K:function K(dateObj,amPM,locale){dateObj.setHours(dateObj.getHours()%12+12*int(new RegExp(locale.amPM[1],"i").test(amPM)))},M:function M(dateObj,shortMonth,locale){dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth))},S:function S(dateObj,seconds){dateObj.setSeconds(parseFloat(seconds))},U:function U(_,unixSeconds){return new Date(parseFloat(unixSeconds)*1000)},W:function W(dateObj,weekNum){var weekNumber=parseInt(weekNum);return new Date(dateObj.getFullYear(),0,2+(weekNumber-1)*7,0,0,0,0)},Y:function Y(dateObj,year){dateObj.setFullYear(parseFloat(year))},Z:function Z(_,ISODate){return new Date(ISODate)},d:function d(dateObj,day){dateObj.setDate(parseFloat(day))},h:function h(dateObj,hour){dateObj.setHours(parseFloat(hour))},i:function i(dateObj,minutes){dateObj.setMinutes(parseFloat(minutes))},j:function j(dateObj,day){dateObj.setDate(parseFloat(day))},l:do_nothing,m:function m(dateObj,month){dateObj.setMonth(parseFloat(month)-1)},n:function n(dateObj,month){dateObj.setMonth(parseFloat(month)-1)},s:function s(dateObj,seconds){dateObj.setSeconds(parseFloat(seconds))},w:do_nothing,y:function y(dateObj,year){dateObj.setFullYear(2000+parseFloat(year))}};var tokenRegex={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",w:"(\\d\\d|\\d)",y:"(\\d{2})"};var formats={Z:function Z(date){return date.toISOString()},D:function D(date,locale,options){return locale.weekdays.shorthand[formats.w(date,locale,options)]},F:function F(date,locale,options){return monthToStr(formats.n(date,locale,options)-1,!1,locale)},G:function G(date,locale,options){return pad(formats.h(date,locale,options))},H:function H(date){return pad(date.getHours())},J:function J(date,locale){return locale.ordinal!==undefined?date.getDate()+locale.ordinal(date.getDate()):date.getDate()},K:function K(date,locale){return locale.amPM[int(date.getHours()>11)]},M:function M(date,locale){return monthToStr(date.getMonth(),!0,locale)},S:function S(date){return pad(date.getSeconds())},U:function U(date){return date.getTime()/1000},W:function W(date,_,options){return options.getWeek(date)},Y:function Y(date){return date.getFullYear()},d:function d(date){return pad(date.getDate())},h:function h(date){return date.getHours()%12?date.getHours()%12:12},i:function i(date){return pad(date.getMinutes())},j:function j(date){return date.getDate()},l:function l(date,locale){return locale.weekdays.longhand[date.getDay()]},m:function m(date){return pad(date.getMonth()+1)},n:function n(date){return date.getMonth()+1},s:function s(date){return date.getSeconds()},w:function w(date){return date.getDay()},y:function y(date){return String(date.getFullYear()).substring(2)}};var english={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function ordinal(nth){var s=nth%100;if(s>3&&s<21)return"th";switch(s%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year"};var createDateFormatter=function createDateFormatter(_ref){var _ref$config=_ref.config,config=_ref$config===void 0?defaults:_ref$config,_ref$l10n=_ref.l10n,l10n=_ref$l10n===void 0?english:_ref$l10n;return function(dateObj,frmt,overrideLocale){if(config.formatDate!==undefined)return config.formatDate(dateObj,frmt);var locale=overrideLocale||l10n;return frmt.split("").map(function(c,i,arr){return formats[c]&&arr[i-1]!=="\\"?formats[c](dateObj,locale,config):c!=="\\"?c:""}).join("")}};var createDateParser=function createDateParser(_ref2){var _ref2$config=_ref2.config,config=_ref2$config===void 0?defaults:_ref2$config,_ref2$l10n=_ref2.l10n,l10n=_ref2$l10n===void 0?english:_ref2$l10n;return function(date,givenFormat,timeless,customLocale){if(date!==0&&!date)return undefined;var locale=customLocale||l10n;var parsedDate;var date_orig=date;if(date instanceof Date)parsedDate=new Date(date.getTime());else if(typeof date!=="string"&&date.toFixed!==undefined)parsedDate=new Date(date);else if(typeof date==="string"){var format=givenFormat||(config||defaults).dateFormat;var datestr=String(date).trim();if(datestr==="today"){parsedDate=new Date();timeless=!0}else if(/Z$/.test(datestr)||/GMT$/.test(datestr))parsedDate=new Date(date);else if(config&&config.parseDate)parsedDate=config.parseDate(date,format);else{parsedDate=!config||!config.noCalendar?new Date(new Date().getFullYear(),0,1,0,0,0,0):new Date(new Date().setHours(0,0,0,0));var matched,ops=[];for(var i=0,matchIndex=0,regexStr="";i<format.length;i++){var token=format[i];var isBackSlash=token==="\\";var escaped=format[i-1]==="\\"||isBackSlash;if(tokenRegex[token]&&!escaped){regexStr+=tokenRegex[token];var match=new RegExp(regexStr).exec(date);if(match&&(matched=!0)){ops[token!=="Y"?"push":"unshift"]({fn:revFormat[token],val:match[++matchIndex]})}}else if(!isBackSlash)regexStr+=".";ops.forEach(function(_ref3){var fn=_ref3.fn,val=_ref3.val;return parsedDate=fn(parsedDate,val,locale)||parsedDate})}
parsedDate=matched?parsedDate:undefined}}
if(!(parsedDate instanceof Date&&!isNaN(parsedDate.getTime()))){config.errorHandler(new Error("Invalid date provided: "+date_orig));return undefined}
if(timeless===!0)parsedDate.setHours(0,0,0,0);return parsedDate}};function compareDates(date1,date2,timeless){if(timeless===void 0){timeless=!0}
if(timeless!==!1){return new Date(date1.getTime()).setHours(0,0,0,0)-new Date(date2.getTime()).setHours(0,0,0,0)}
return date1.getTime()-date2.getTime()}
var getWeek=function getWeek(givenDate){var date=new Date(givenDate.getTime());date.setHours(0,0,0,0);date.setDate(date.getDate()+3-(date.getDay()+6)%7);var week1=new Date(date.getFullYear(),0,4);return 1+Math.round(((date.getTime()-week1.getTime())/86400000-3+(week1.getDay()+6)%7)/7)};var isBetween=function isBetween(ts,ts1,ts2){return ts>Math.min(ts1,ts2)&&ts<Math.max(ts1,ts2)};var duration={DAY:86400000};var defaults={_disable:[],_enable:[],allowInput:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window==="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enable:[],enableSeconds:!1,enableTime:!1,errorHandler:function errorHandler(err){return typeof console!=="undefined"&&console.warn(err)},getWeek:getWeek,hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date(),onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:undefined,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1};function toggleClass(elem,className,bool){if(bool===!0)return elem.classList.add(className);elem.classList.remove(className)}
function createElement(tag,className,content){var e=window.document.createElement(tag);className=className||"";content=content||"";e.className=className;if(content!==undefined)e.textContent=content;return e}
function clearNode(node){while(node.firstChild){node.removeChild(node.firstChild)}}
function findParent(node,condition){if(condition(node))return node;else if(node.parentNode)return findParent(node.parentNode,condition);return undefined}
function createNumberInput(inputClassName,opts){var wrapper=createElement("div","numInputWrapper"),numInput=createElement("input","numInput "+inputClassName),arrowUp=createElement("span","arrowUp"),arrowDown=createElement("span","arrowDown");numInput.type="text";numInput.pattern="\\d*";if(opts!==undefined)for(var key in opts){numInput.setAttribute(key,opts[key])}
wrapper.appendChild(numInput);wrapper.appendChild(arrowUp);wrapper.appendChild(arrowDown);return wrapper}
if(typeof Object.assign!=="function"){Object.assign=function(target){if(!target){throw TypeError("Cannot convert undefined or null to object")}
for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}
var _loop=function _loop(){var source=args[_i];if(source){Object.keys(source).forEach(function(key){return target[key]=source[key]})}};for(var _i=0;_i<args.length;_i++){_loop()}
return target}}
var DEBOUNCED_CHANGE_MS=300;function FlatpickrInstance(element,instanceConfig){var self={config:Object.assign({},flatpickr.defaultConfig),l10n:english};self.parseDate=createDateParser({config:self.config,l10n:self.l10n});self._handlers=[];self._bind=bind;self._setHoursFromDate=setHoursFromDate;self._positionCalendar=positionCalendar;self.changeMonth=changeMonth;self.changeYear=changeYear;self.clear=clear;self.close=close;self._createElement=createElement;self.destroy=destroy;self.isEnabled=isEnabled;self.jumpToDate=jumpToDate;self.open=open;self.redraw=redraw;self.set=set;self.setDate=setDate;self.toggle=toggle;function setupHelperFunctions(){self.utils={getDaysInMonth:function getDaysInMonth(month,yr){if(month===void 0){month=self.currentMonth}
if(yr===void 0){yr=self.currentYear}
if(month===1&&(yr%4===0&&yr%100!==0||yr%400===0))return 29;return self.l10n.daysInMonth[month]}}}
function init(){self.element=self.input=element;self.isOpen=!1;parseConfig();setupLocale();setupInputs();setupDates();setupHelperFunctions();if(!self.isMobile)build();bindEvents();if(self.selectedDates.length||self.config.noCalendar){if(self.config.enableTime){setHoursFromDate(self.config.noCalendar?self.latestSelectedDateObj||self.config.minDate:undefined)}
updateValue(!1)}
setCalendarWidth();self.showTimeInput=self.selectedDates.length>0||self.config.noCalendar;var isSafari=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);if(!self.isMobile&&isSafari){positionCalendar()}
triggerEvent("onReady")}
function bindToInstance(fn){return fn.bind(self)}
function setCalendarWidth(){var config=self.config;if(config.weekNumbers===!1&&config.showMonths===1)return;else if(config.noCalendar!==!0){window.requestAnimationFrame(function(){self.calendarContainer.style.visibility="hidden";self.calendarContainer.style.display="block";if(self.daysContainer!==undefined){var daysWidth=(self.days.offsetWidth+1)*config.showMonths;self.daysContainer.style.width=daysWidth+"px";self.calendarContainer.style.width=daysWidth+(self.weekWrapper!==undefined?self.weekWrapper.offsetWidth:0)+"px";self.calendarContainer.style.removeProperty("visibility");self.calendarContainer.style.removeProperty("display")}})}}
function updateTime(e){if(self.selectedDates.length===0)return;if(e!==undefined&&e.type!=="blur"){timeWrapper(e)}
var prevValue=self._input.value;setHoursFromInputs();updateValue();if(self._input.value!==prevValue){self._debouncedChange()}}
function ampm2military(hour,amPM){return hour%12+12*int(amPM===self.l10n.amPM[1])}
function military2ampm(hour){switch(hour%24){case 0:case 12:return 12;default:return hour%12}}
function setHoursFromInputs(){if(self.hourElement===undefined||self.minuteElement===undefined)return;var hours=(parseInt(self.hourElement.value.slice(-2),10)||0)%24,minutes=(parseInt(self.minuteElement.value,10)||0)%60,seconds=self.secondElement!==undefined?(parseInt(self.secondElement.value,10)||0)%60:0;if(self.amPM!==undefined){hours=ampm2military(hours,self.amPM.textContent)}
var limitMinHours=self.config.minTime!==undefined||self.config.minDate&&self.minDateHasTime&&self.latestSelectedDateObj&&compareDates(self.latestSelectedDateObj,self.config.minDate,!0)===0;var limitMaxHours=self.config.maxTime!==undefined||self.config.maxDate&&self.maxDateHasTime&&self.latestSelectedDateObj&&compareDates(self.latestSelectedDateObj,self.config.maxDate,!0)===0;if(limitMaxHours){var maxTime=self.config.maxTime!==undefined?self.config.maxTime:self.config.maxDate;hours=Math.min(hours,maxTime.getHours());if(hours===maxTime.getHours())minutes=Math.min(minutes,maxTime.getMinutes());if(minutes===maxTime.getMinutes())seconds=Math.min(seconds,maxTime.getSeconds())}
if(limitMinHours){var minTime=self.config.minTime!==undefined?self.config.minTime:self.config.minDate;hours=Math.max(hours,minTime.getHours());if(hours===minTime.getHours())minutes=Math.max(minutes,minTime.getMinutes());if(minutes===minTime.getMinutes())seconds=Math.max(seconds,minTime.getSeconds())}
setHours(hours,minutes,seconds)}
function setHoursFromDate(dateObj){var date=dateObj||self.latestSelectedDateObj;if(date)setHours(date.getHours(),date.getMinutes(),date.getSeconds())}
function setDefaultHours(){var hours=self.config.defaultHour;var minutes=self.config.defaultMinute;var seconds=self.config.defaultSeconds;if(self.config.minDate!==undefined){var min_hr=self.config.minDate.getHours();var min_minutes=self.config.minDate.getMinutes();hours=Math.max(hours,min_hr);if(hours===min_hr)minutes=Math.max(min_minutes,minutes);if(hours===min_hr&&minutes===min_minutes)seconds=self.config.minDate.getSeconds()}
if(self.config.maxDate!==undefined){var max_hr=self.config.maxDate.getHours();var max_minutes=self.config.maxDate.getMinutes();hours=Math.min(hours,max_hr);if(hours===max_hr)minutes=Math.min(max_minutes,minutes);if(hours===max_hr&&minutes===max_minutes)seconds=self.config.maxDate.getSeconds()}
setHours(hours,minutes,seconds)}
function setHours(hours,minutes,seconds){if(self.latestSelectedDateObj!==undefined){self.latestSelectedDateObj.setHours(hours%24,minutes,seconds||0,0)}
if(!self.hourElement||!self.minuteElement||self.isMobile)return;self.hourElement.value=pad(!self.config.time_24hr?(12+hours)%12+12*int(hours%12===0):hours);self.minuteElement.value=pad(minutes);if(self.amPM!==undefined)self.amPM.textContent=self.l10n.amPM[int(hours>=12)];if(self.secondElement!==undefined)self.secondElement.value=pad(seconds)}
function onYearInput(event){var year=parseInt(event.target.value)+(event.delta||0);if(year/1000>1||event.key==="Enter"&&!/[^\d]/.test(year.toString())){changeYear(year)}}
function bind(element,event,handler,options){if(event instanceof Array)return event.forEach(function(ev){return bind(element,ev,handler,options)});if(element instanceof Array)return element.forEach(function(el){return bind(el,event,handler,options)});element.addEventListener(event,handler,options);self._handlers.push({element:element,event:event,handler:handler,options:options})}
function onClick(handler){return function(evt){evt.which===1&&handler(evt)}}
function triggerChange(){triggerEvent("onChange")}
function bindEvents(){if(self.config.wrap){["open","close","toggle","clear"].forEach(function(evt){Array.prototype.forEach.call(self.element.querySelectorAll("[data-"+evt+"]"),function(el){return bind(el,"click",self[evt])})})}
if(self.isMobile){setupMobile();return}
var debouncedResize=debounce(onResize,50);self._debouncedChange=debounce(triggerChange,DEBOUNCED_CHANGE_MS);if(self.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent))bind(self.daysContainer,"mouseover",function(e){if(self.config.mode==="range")onMouseOver(e.target)});bind(window.document.body,"keydown",onKeyDown);if(!self.config.static)bind(self._input,"keydown",onKeyDown);if(!self.config.inline&&!self.config.static)bind(window,"resize",debouncedResize);if(window.ontouchstart!==undefined)bind(window.document,"click",documentClick);else bind(window.document,"mousedown",onClick(documentClick));bind(window.document,"focus",documentClick,{capture:!0});if(self.config.clickOpens===!0){bind(self._input,"focus",self.open);bind(self._input,"mousedown",onClick(self.open))}
if(self.daysContainer!==undefined){bind(self.monthNav,"mousedown",onClick(onMonthNavClick));bind(self.monthNav,["keyup","increment"],onYearInput);bind(self.daysContainer,"mousedown",onClick(selectDate))}
if(self.timeContainer!==undefined&&self.minuteElement!==undefined&&self.hourElement!==undefined){var selText=function selText(e){return e.target.select()};bind(self.timeContainer,["increment"],updateTime);bind(self.timeContainer,"blur",updateTime,{capture:!0});bind(self.timeContainer,"mousedown",onClick(timeIncrement));bind([self.hourElement,self.minuteElement],["focus","click"],selText);if(self.secondElement!==undefined)bind(self.secondElement,"focus",function(){return self.secondElement&&self.secondElement.select()});if(self.amPM!==undefined){bind(self.amPM,"mousedown",onClick(function(e){updateTime(e);triggerChange()}))}}}
function jumpToDate(jumpDate){var jumpTo=jumpDate!==undefined?self.parseDate(jumpDate):self.latestSelectedDateObj||(self.config.minDate&&self.config.minDate>self.now?self.config.minDate:self.config.maxDate&&self.config.maxDate<self.now?self.config.maxDate:self.now);try{if(jumpTo!==undefined){self.currentYear=jumpTo.getFullYear();self.currentMonth=jumpTo.getMonth()}}catch(e){e.message="Invalid date supplied: "+jumpTo;self.config.errorHandler(e)}
self.redraw()}
function timeIncrement(e){if(~e.target.className.indexOf("arrow"))incrementNumInput(e,e.target.classList.contains("arrowUp")?1:-1)}
function incrementNumInput(e,delta,inputElem){var target=e&&e.target;var input=inputElem||target&&target.parentNode&&target.parentNode.firstChild;var event=createEvent("increment");event.delta=delta;input&&input.dispatchEvent(event)}
function build(){var fragment=window.document.createDocumentFragment();self.calendarContainer=createElement("div","flatpickr-calendar");self.calendarContainer.tabIndex=-1;if(!self.config.noCalendar){fragment.appendChild(buildMonthNav());self.innerContainer=createElement("div","flatpickr-innerContainer");if(self.config.weekNumbers){var _buildWeeks=buildWeeks(),weekWrapper=_buildWeeks.weekWrapper,weekNumbers=_buildWeeks.weekNumbers;self.innerContainer.appendChild(weekWrapper);self.weekNumbers=weekNumbers;self.weekWrapper=weekWrapper}
self.rContainer=createElement("div","flatpickr-rContainer");self.rContainer.appendChild(buildWeekdays());if(!self.daysContainer){self.daysContainer=createElement("div","flatpickr-days");self.daysContainer.tabIndex=-1}
buildDays();self.rContainer.appendChild(self.daysContainer);self.innerContainer.appendChild(self.rContainer);fragment.appendChild(self.innerContainer)}
if(self.config.enableTime){fragment.appendChild(buildTime())}
toggleClass(self.calendarContainer,"rangeMode",self.config.mode==="range");toggleClass(self.calendarContainer,"animate",self.config.animate===!0);toggleClass(self.calendarContainer,"multiMonth",self.config.showMonths>1);self.calendarContainer.appendChild(fragment);var customAppend=self.config.appendTo!==undefined&&self.config.appendTo.nodeType!==undefined;if(self.config.inline||self.config.static){self.calendarContainer.classList.add(self.config.inline?"inline":"static");if(self.config.inline){if(!customAppend&&self.element.parentNode)self.element.parentNode.insertBefore(self.calendarContainer,self._input.nextSibling);else if(self.config.appendTo!==undefined)self.config.appendTo.appendChild(self.calendarContainer)}
if(self.config.static){var wrapper=createElement("div","flatpickr-wrapper");if(self.element.parentNode)self.element.parentNode.insertBefore(wrapper,self.element);wrapper.appendChild(self.element);if(self.altInput)wrapper.appendChild(self.altInput);wrapper.appendChild(self.calendarContainer)}}
if(!self.config.static&&!self.config.inline)(self.config.appendTo!==undefined?self.config.appendTo:window.document.body).appendChild(self.calendarContainer)}
function createDay(className,date,dayNumber,i){var dateIsEnabled=isEnabled(date,!0),dayElement=createElement("span","flatpickr-day "+className,date.getDate().toString());dayElement.dateObj=date;dayElement.$i=i;dayElement.setAttribute("aria-label",self.formatDate(date,self.config.ariaDateFormat));if(className.indexOf("hidden")===-1&&compareDates(date,self.now)===0){self.todayDateElem=dayElement;dayElement.classList.add("today");dayElement.setAttribute("aria-current","date")}
if(dateIsEnabled){dayElement.tabIndex=-1;if(isDateSelected(date)){dayElement.classList.add("selected");self.selectedDateElem=dayElement;if(self.config.mode==="range"){toggleClass(dayElement,"startRange",self.selectedDates[0]&&compareDates(date,self.selectedDates[0],!0)===0);toggleClass(dayElement,"endRange",self.selectedDates[1]&&compareDates(date,self.selectedDates[1],!0)===0);if(className==="nextMonthDay")dayElement.classList.add("inRange")}}}else{dayElement.classList.add("disabled")}
if(self.config.mode==="range"){if(isDateInRange(date)&&!isDateSelected(date))dayElement.classList.add("inRange")}
if(self.weekNumbers&&self.config.showMonths===1&&className!=="prevMonthDay"&&dayNumber%7===1){self.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+self.config.getWeek(date)+"</span>")}
triggerEvent("onDayCreate",dayElement);return dayElement}
function focusOnDayElem(targetNode){targetNode.focus();if(self.config.mode==="range")onMouseOver(targetNode)}
function getFirstAvailableDay(delta){var startMonth=delta>0?0:self.config.showMonths-1;var endMonth=delta>0?self.config.showMonths:-1;for(var m=startMonth;m!=endMonth;m+=delta){var month=self.daysContainer.children[m];var startIndex=delta>0?0:month.children.length-1;var endIndex=delta>0?month.children.length:-1;for(var i=startIndex;i!=endIndex;i+=delta){var c=month.children[i];if(c.className.indexOf("hidden")===-1&&isEnabled(c.dateObj))return c}}
return undefined}
function getNextAvailableDay(current,delta){var givenMonth=current.className.indexOf("Month")===-1?current.dateObj.getMonth():self.currentMonth;var endMonth=delta>0?self.config.showMonths:-1;var loopDelta=delta>0?1:-1;for(var m=givenMonth-self.currentMonth;m!=endMonth;m+=loopDelta){var month=self.daysContainer.children[m];var startIndex=givenMonth-self.currentMonth===m?current.$i+delta:delta<0?month.children.length-1:0;var numMonthDays=month.children.length;for(var i=startIndex;i>=0&&i<numMonthDays&&i!=(delta>0?numMonthDays:-1);i+=loopDelta){var c=month.children[i];if(c.className.indexOf("hidden")===-1&&isEnabled(c.dateObj)&&Math.abs(current.$i-i)>=Math.abs(delta))return focusOnDayElem(c)}}
self.changeMonth(loopDelta);focusOnDay(getFirstAvailableDay(loopDelta),0);return undefined}
function focusOnDay(current,offset){var dayFocused=isInView(document.activeElement);var startElem=current!==undefined?current:dayFocused?document.activeElement:self.selectedDateElem!==undefined&&isInView(self.selectedDateElem)?self.selectedDateElem:self.todayDateElem!==undefined&&isInView(self.todayDateElem)?self.todayDateElem:getFirstAvailableDay(offset>0?1:-1);if(startElem===undefined)return self._input.focus();if(!dayFocused)return focusOnDayElem(startElem);getNextAvailableDay(startElem,offset)}
function buildMonthDays(year,month){var firstOfMonth=(new Date(year,month,1).getDay()-self.l10n.firstDayOfWeek+7)%7;var prevMonthDays=self.utils.getDaysInMonth((month-1+12)%12);var daysInMonth=self.utils.getDaysInMonth(month),days=window.document.createDocumentFragment(),isMultiMonth=self.config.showMonths>1,prevMonthDayClass=isMultiMonth?"prevMonthDay hidden":"prevMonthDay",nextMonthDayClass=isMultiMonth?"nextMonthDay hidden":"nextMonthDay";var dayNumber=prevMonthDays+1-firstOfMonth,dayIndex=0;for(;dayNumber<=prevMonthDays;dayNumber++,dayIndex++){days.appendChild(createDay(prevMonthDayClass,new Date(year,month-1,dayNumber),dayNumber,dayIndex))}
for(dayNumber=1;dayNumber<=daysInMonth;dayNumber++,dayIndex++){days.appendChild(createDay("",new Date(year,month,dayNumber),dayNumber,dayIndex))}
for(var dayNum=daysInMonth+1;dayNum<=42-firstOfMonth&&(self.config.showMonths===1||dayIndex%7!==0);dayNum++,dayIndex++){days.appendChild(createDay(nextMonthDayClass,new Date(year,month+1,dayNum%daysInMonth),dayNum,dayIndex))}
var dayContainer=createElement("div","dayContainer");dayContainer.appendChild(days);return dayContainer}
function buildDays(){if(self.daysContainer===undefined){return}
clearNode(self.daysContainer);if(self.weekNumbers)clearNode(self.weekNumbers);var frag=document.createDocumentFragment();for(var i=0;i<self.config.showMonths;i++){var d=new Date(self.currentYear,self.currentMonth,1);d.setMonth(self.currentMonth+i);frag.appendChild(buildMonthDays(d.getFullYear(),d.getMonth()))}
self.daysContainer.appendChild(frag);self.days=self.daysContainer.firstChild;if(self.config.mode==="range"&&self.selectedDates.length===1){onMouseOver()}}
function buildMonth(){var container=createElement("div","flatpickr-month");var monthNavFragment=window.document.createDocumentFragment();var monthElement=createElement("span","cur-month");var yearInput=createNumberInput("cur-year",{tabindex:"-1"});var yearElement=yearInput.childNodes[0];yearElement.setAttribute("aria-label",self.l10n.yearAriaLabel);if(self.config.minDate)yearElement.setAttribute("data-min",self.config.minDate.getFullYear().toString());if(self.config.maxDate){yearElement.setAttribute("data-max",self.config.maxDate.getFullYear().toString());yearElement.disabled=!!self.config.minDate&&self.config.minDate.getFullYear()===self.config.maxDate.getFullYear()}
var currentMonth=createElement("div","flatpickr-current-month");currentMonth.appendChild(monthElement);currentMonth.appendChild(yearInput);monthNavFragment.appendChild(currentMonth);container.appendChild(monthNavFragment);return{container:container,yearElement:yearElement,monthElement:monthElement}}
function buildMonths(){clearNode(self.monthNav);self.monthNav.appendChild(self.prevMonthNav);for(var m=self.config.showMonths;m--;){var month=buildMonth();self.yearElements.push(month.yearElement);self.monthElements.push(month.monthElement);self.monthNav.appendChild(month.container)}
self.monthNav.appendChild(self.nextMonthNav)}
function buildMonthNav(){self.monthNav=createElement("div","flatpickr-months");self.yearElements=[];self.monthElements=[];self.prevMonthNav=createElement("span","flatpickr-prev-month");self.prevMonthNav.innerHTML=self.config.prevArrow;self.nextMonthNav=createElement("span","flatpickr-next-month");self.nextMonthNav.innerHTML=self.config.nextArrow;buildMonths();Object.defineProperty(self,"_hidePrevMonthArrow",{get:function get(){return self.__hidePrevMonthArrow},set:function set(bool){if(self.__hidePrevMonthArrow!==bool){toggleClass(self.prevMonthNav,"disabled",bool);self.__hidePrevMonthArrow=bool}}});Object.defineProperty(self,"_hideNextMonthArrow",{get:function get(){return self.__hideNextMonthArrow},set:function set(bool){if(self.__hideNextMonthArrow!==bool){toggleClass(self.nextMonthNav,"disabled",bool);self.__hideNextMonthArrow=bool}}});self.currentYearElement=self.yearElements[0];updateNavigationCurrentMonth();return self.monthNav}
function buildTime(){self.calendarContainer.classList.add("hasTime");if(self.config.noCalendar)self.calendarContainer.classList.add("noCalendar");self.timeContainer=createElement("div","flatpickr-time");self.timeContainer.tabIndex=-1;var separator=createElement("span","flatpickr-time-separator",":");var hourInput=createNumberInput("flatpickr-hour");self.hourElement=hourInput.childNodes[0];var minuteInput=createNumberInput("flatpickr-minute");self.minuteElement=minuteInput.childNodes[0];self.hourElement.tabIndex=self.minuteElement.tabIndex=-1;self.hourElement.value=pad(self.latestSelectedDateObj?self.latestSelectedDateObj.getHours():self.config.time_24hr?self.config.defaultHour:military2ampm(self.config.defaultHour));self.minuteElement.value=pad(self.latestSelectedDateObj?self.latestSelectedDateObj.getMinutes():self.config.defaultMinute);self.hourElement.setAttribute("data-step",self.config.hourIncrement.toString());self.minuteElement.setAttribute("data-step",self.config.minuteIncrement.toString());self.hourElement.setAttribute("data-min",self.config.time_24hr?"0":"1");self.hourElement.setAttribute("data-max",self.config.time_24hr?"23":"12");self.minuteElement.setAttribute("data-min","0");self.minuteElement.setAttribute("data-max","59");self.timeContainer.appendChild(hourInput);self.timeContainer.appendChild(separator);self.timeContainer.appendChild(minuteInput);if(self.config.time_24hr)self.timeContainer.classList.add("time24hr");if(self.config.enableSeconds){self.timeContainer.classList.add("hasSeconds");var secondInput=createNumberInput("flatpickr-second");self.secondElement=secondInput.childNodes[0];self.secondElement.value=pad(self.latestSelectedDateObj?self.latestSelectedDateObj.getSeconds():self.config.defaultSeconds);self.secondElement.setAttribute("data-step",self.minuteElement.getAttribute("data-step"));self.secondElement.setAttribute("data-min",self.minuteElement.getAttribute("data-min"));self.secondElement.setAttribute("data-max",self.minuteElement.getAttribute("data-max"));self.timeContainer.appendChild(createElement("span","flatpickr-time-separator",":"));self.timeContainer.appendChild(secondInput)}
if(!self.config.time_24hr){self.amPM=createElement("span","flatpickr-am-pm",self.l10n.amPM[int((self.latestSelectedDateObj?self.hourElement.value:self.config.defaultHour)>11)]);self.amPM.title=self.l10n.toggleTitle;self.amPM.tabIndex=-1;self.timeContainer.appendChild(self.amPM)}
return self.timeContainer}
function buildWeekdays(){if(!self.weekdayContainer)self.weekdayContainer=createElement("div","flatpickr-weekdays");else clearNode(self.weekdayContainer);for(var i=self.config.showMonths;i--;){var container=createElement("div","flatpickr-weekdaycontainer");self.weekdayContainer.appendChild(container)}
updateWeekdays();return self.weekdayContainer}
function updateWeekdays(){var firstDayOfWeek=self.l10n.firstDayOfWeek;var weekdays=self.l10n.weekdays.shorthand.concat();if(firstDayOfWeek>0&&firstDayOfWeek<weekdays.length){weekdays=weekdays.splice(firstDayOfWeek,weekdays.length).concat(weekdays.splice(0,firstDayOfWeek))}
for(var i=self.config.showMonths;i--;){self.weekdayContainer.children[i].innerHTML="\n      <span class=flatpickr-weekday>\n        "+weekdays.join("</span><span class=flatpickr-weekday>")+"\n      </span>\n      "}}
function buildWeeks(){self.calendarContainer.classList.add("hasWeeks");var weekWrapper=createElement("div","flatpickr-weekwrapper");weekWrapper.appendChild(createElement("span","flatpickr-weekday",self.l10n.weekAbbreviation));var weekNumbers=createElement("div","flatpickr-weeks");weekWrapper.appendChild(weekNumbers);return{weekWrapper:weekWrapper,weekNumbers:weekNumbers}}
function changeMonth(value,is_offset){if(is_offset===void 0){is_offset=!0}
var delta=is_offset?value:value-self.currentMonth;if(delta<0&&self._hidePrevMonthArrow===!0||delta>0&&self._hideNextMonthArrow===!0)return;self.currentMonth+=delta;if(self.currentMonth<0||self.currentMonth>11){self.currentYear+=self.currentMonth>11?1:-1;self.currentMonth=(self.currentMonth+12)%12;triggerEvent("onYearChange")}
buildDays();triggerEvent("onMonthChange");updateNavigationCurrentMonth()}
function clear(triggerChangeEvent){if(triggerChangeEvent===void 0){triggerChangeEvent=!0}
self.input.value="";if(self.altInput!==undefined)self.altInput.value="";if(self.mobileInput!==undefined)self.mobileInput.value="";self.selectedDates=[];self.latestSelectedDateObj=undefined;self.showTimeInput=!1;if(self.config.enableTime===!0){setDefaultHours()}
self.redraw();if(triggerChangeEvent)triggerEvent("onChange")}
function close(){self.isOpen=!1;if(!self.isMobile){self.calendarContainer.classList.remove("open");self._input.classList.remove("active")}
triggerEvent("onClose")}
function destroy(){if(self.config!==undefined)triggerEvent("onDestroy");for(var i=self._handlers.length;i--;){var h=self._handlers[i];h.element.removeEventListener(h.event,h.handler,h.options)}
self._handlers=[];if(self.mobileInput){if(self.mobileInput.parentNode)self.mobileInput.parentNode.removeChild(self.mobileInput);self.mobileInput=undefined}else if(self.calendarContainer&&self.calendarContainer.parentNode){if(self.config.static&&self.calendarContainer.parentNode){var wrapper=self.calendarContainer.parentNode;wrapper.lastChild&&wrapper.removeChild(wrapper.lastChild);while(wrapper.firstChild){wrapper.parentNode.insertBefore(wrapper.firstChild,wrapper)}
wrapper.parentNode.removeChild(wrapper)}else self.calendarContainer.parentNode.removeChild(self.calendarContainer)}
if(self.altInput){self.input.type="text";if(self.altInput.parentNode)self.altInput.parentNode.removeChild(self.altInput);delete self.altInput}
if(self.input){self.input.type=self.input._type;self.input.classList.remove("flatpickr-input");self.input.removeAttribute("readonly");self.input.value=""}["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(k){try{delete self[k]}catch(_){}})}
function isCalendarElem(elem){if(self.config.appendTo&&self.config.appendTo.contains(elem))return!0;return self.calendarContainer.contains(elem)}
function documentClick(e){if(self.isOpen&&!self.config.inline){var isCalendarElement=isCalendarElem(e.target);var isInput=e.target===self.input||e.target===self.altInput||self.element.contains(e.target)||e.path&&e.path.indexOf&&(~e.path.indexOf(self.input)||~e.path.indexOf(self.altInput));var lostFocus=e.type==="blur"?isInput&&e.relatedTarget&&!isCalendarElem(e.relatedTarget):!isInput&&!isCalendarElement;var isIgnored=!self.config.ignoredFocusElements.some(function(elem){return elem.contains(e.target)});if(lostFocus&&isIgnored){self.close();if(self.config.mode==="range"&&self.selectedDates.length===1){self.clear(!1);self.redraw()}}}}
function changeYear(newYear){if(!newYear||self.config.minDate&&newYear<self.config.minDate.getFullYear()||self.config.maxDate&&newYear>self.config.maxDate.getFullYear())return;var newYearNum=newYear,isNewYear=self.currentYear!==newYearNum;self.currentYear=newYearNum||self.currentYear;if(self.config.maxDate&&self.currentYear===self.config.maxDate.getFullYear()){self.currentMonth=Math.min(self.config.maxDate.getMonth(),self.currentMonth)}else if(self.config.minDate&&self.currentYear===self.config.minDate.getFullYear()){self.currentMonth=Math.max(self.config.minDate.getMonth(),self.currentMonth)}
if(isNewYear){self.redraw();triggerEvent("onYearChange")}}
function isEnabled(date,timeless){if(timeless===void 0){timeless=!0}
var dateToCheck=self.parseDate(date,undefined,timeless);if(self.config.minDate&&dateToCheck&&compareDates(dateToCheck,self.config.minDate,timeless!==undefined?timeless:!self.minDateHasTime)<0||self.config.maxDate&&dateToCheck&&compareDates(dateToCheck,self.config.maxDate,timeless!==undefined?timeless:!self.maxDateHasTime)>0)return!1;if(self.config.enable.length===0&&self.config.disable.length===0)return!0;if(dateToCheck===undefined)return!1;var bool=self.config.enable.length>0,array=bool?self.config.enable:self.config.disable;for(var i=0,d;i<array.length;i++){d=array[i];if(typeof d==="function"&&d(dateToCheck))return bool;else if(d instanceof Date&&dateToCheck!==undefined&&d.getTime()===dateToCheck.getTime())return bool;else if(typeof d==="string"&&dateToCheck!==undefined){var parsed=self.parseDate(d,undefined,!0);return parsed&&parsed.getTime()===dateToCheck.getTime()?bool:!bool}else if(typeof d==="object"&&dateToCheck!==undefined&&d.from&&d.to&&dateToCheck.getTime()>=d.from.getTime()&&dateToCheck.getTime()<=d.to.getTime())return bool}
return!bool}
function isInView(elem){if(self.daysContainer!==undefined)return elem.className.indexOf("hidden")===-1&&self.daysContainer.contains(elem);return!1}
function onKeyDown(e){var isInput=e.target===self._input;var allowInput=self.config.allowInput;var allowKeydown=self.isOpen&&(!allowInput||!isInput);var allowInlineKeydown=self.config.inline&&isInput&&!allowInput;if(e.keyCode===13&&isInput){if(allowInput){self.setDate(self._input.value,!0,e.target===self.altInput?self.config.altFormat:self.config.dateFormat);return e.target.blur()}else self.open()}else if(isCalendarElem(e.target)||allowKeydown||allowInlineKeydown){var isTimeObj=!!self.timeContainer&&self.timeContainer.contains(e.target);switch(e.keyCode){case 13:if(isTimeObj)updateTime();else selectDate(e);break;case 27:e.preventDefault();focusAndClose();break;case 8:case 46:if(isInput&&!self.config.allowInput){e.preventDefault();self.clear()}
break;case 37:case 39:if(!isTimeObj){e.preventDefault();if(self.daysContainer!==undefined&&(allowInput===!1||isInView(document.activeElement))){var _delta=e.keyCode===39?1:-1;if(!e.ctrlKey)focusOnDay(undefined,_delta);else{changeMonth(_delta);focusOnDay(getFirstAvailableDay(1),0)}}}else if(self.hourElement)self.hourElement.focus();break;case 38:case 40:e.preventDefault();var delta=e.keyCode===40?1:-1;if(self.daysContainer){if(e.ctrlKey){changeYear(self.currentYear-delta);focusOnDay(getFirstAvailableDay(1),0)}else if(!isTimeObj)focusOnDay(undefined,delta*7)}else if(self.config.enableTime){if(!isTimeObj&&self.hourElement)self.hourElement.focus();updateTime(e);self._debouncedChange()}
break;case 9:if(!isTimeObj)break;var elems=[self.hourElement,self.minuteElement,self.secondElement,self.amPM].filter(function(x){return x});var i=elems.indexOf(e.target);if(i!==-1){var target=elems[i+(e.shiftKey?-1:1)];if(target!==undefined){e.preventDefault();target.focus()}}
break;default:break}}
if(self.amPM!==undefined&&e.target===self.amPM){switch(e.key){case self.l10n.amPM[0].charAt(0):case self.l10n.amPM[0].charAt(0).toLowerCase():self.amPM.textContent=self.l10n.amPM[0];setHoursFromInputs();updateValue();break;case self.l10n.amPM[1].charAt(0):case self.l10n.amPM[1].charAt(0).toLowerCase():self.amPM.textContent=self.l10n.amPM[1];setHoursFromInputs();updateValue();break}}
triggerEvent("onKeyDown",e)}
function onMouseOver(elem){if(self.selectedDates.length!==1||elem&&(!elem.classList.contains("flatpickr-day")||elem.classList.contains("disabled")))return;var hoverDate=elem?elem.dateObj.getTime():self.days.firstElementChild.dateObj.getTime(),initialDate=self.parseDate(self.selectedDates[0],undefined,!0).getTime(),rangeStartDate=Math.min(hoverDate,self.selectedDates[0].getTime()),rangeEndDate=Math.max(hoverDate,self.selectedDates[0].getTime()),lastDate=self.daysContainer.lastChild.lastChild.dateObj.getTime();var containsDisabled=!1;var minRange=0,maxRange=0;for(var t=rangeStartDate;t<lastDate;t+=duration.DAY){if(!isEnabled(new Date(t),!0)){containsDisabled=containsDisabled||t>rangeStartDate&&t<rangeEndDate;if(t<initialDate&&(!minRange||t>minRange))minRange=t;else if(t>initialDate&&(!maxRange||t<maxRange))maxRange=t}}
for(var m=0;m<self.config.showMonths;m++){var month=self.daysContainer.children[m];var prevMonth=self.daysContainer.children[m-1];var _loop=function _loop(i,l){var dayElem=month.children[i],date=dayElem.dateObj;var timestamp=date.getTime();var outOfRange=minRange>0&&timestamp<minRange||maxRange>0&&timestamp>maxRange;if(outOfRange){dayElem.classList.add("notAllowed");["inRange","startRange","endRange"].forEach(function(c){dayElem.classList.remove(c)});return"continue"}else if(containsDisabled&&!outOfRange)return"continue";["startRange","inRange","endRange","notAllowed"].forEach(function(c){dayElem.classList.remove(c)});if(elem!==undefined){elem.classList.add(hoverDate<self.selectedDates[0].getTime()?"startRange":"endRange");if(month.contains(elem)||!(m>0&&prevMonth&&prevMonth.lastChild.dateObj.getTime()>=timestamp)){if(initialDate<hoverDate&&timestamp===initialDate)dayElem.classList.add("startRange");else if(initialDate>hoverDate&&timestamp===initialDate)dayElem.classList.add("endRange");if(timestamp>=minRange&&(maxRange===0||timestamp<=maxRange)&&isBetween(timestamp,initialDate,hoverDate))dayElem.classList.add("inRange")}}};for(var i=0,l=month.children.length;i<l;i++){var _ret=_loop(i,l);if(_ret==="continue")continue}}}
function onResize(){if(self.isOpen&&!self.config.static&&!self.config.inline)positionCalendar()}
function open(e,positionElement){if(positionElement===void 0){positionElement=self._positionElement}
if(self.isMobile===!0){if(e){e.preventDefault();e.target&&e.target.blur()}
setTimeout(function(){self.mobileInput!==undefined&&self.mobileInput.focus()},0);triggerEvent("onOpen");return}
if(self._input.disabled||self.config.inline)return;var wasOpen=self.isOpen;self.isOpen=!0;if(!wasOpen){self.calendarContainer.classList.add("open");self._input.classList.add("active");triggerEvent("onOpen");positionCalendar(positionElement)}
if(self.config.enableTime===!0&&self.config.noCalendar===!0){if(self.selectedDates.length===0){self.setDate(self.config.minDate!==undefined?new Date(self.config.minDate.getTime()):new Date(),!1);setDefaultHours();updateValue()}
if(self.config.allowInput===!1&&(e===undefined||!self.timeContainer.contains(e.relatedTarget))){setTimeout(function(){return self.hourElement.select()},50)}}}
function minMaxDateSetter(type){return function(date){var dateObj=self.config["_"+type+"Date"]=self.parseDate(date,self.config.dateFormat);var inverseDateObj=self.config["_"+(type==="min"?"max":"min")+"Date"];if(dateObj!==undefined){self[type==="min"?"minDateHasTime":"maxDateHasTime"]=dateObj.getHours()>0||dateObj.getMinutes()>0||dateObj.getSeconds()>0}
if(self.selectedDates){self.selectedDates=self.selectedDates.filter(function(d){return isEnabled(d)});if(!self.selectedDates.length&&type==="min")setHoursFromDate(dateObj);updateValue()}
if(self.daysContainer){redraw();if(dateObj!==undefined)self.currentYearElement[type]=dateObj.getFullYear().toString();else self.currentYearElement.removeAttribute(type);self.currentYearElement.disabled=!!inverseDateObj&&dateObj!==undefined&&inverseDateObj.getFullYear()===dateObj.getFullYear()}}}
function parseConfig(){var boolOpts=["wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"];var hooks=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"];var userConfig=Object.assign({},instanceConfig,JSON.parse(JSON.stringify(element.dataset||{})));var formats$$1={};self.config.parseDate=userConfig.parseDate;self.config.formatDate=userConfig.formatDate;Object.defineProperty(self.config,"enable",{get:function get(){return self.config._enable},set:function set(dates){self.config._enable=parseDateRules(dates)}});Object.defineProperty(self.config,"disable",{get:function get(){return self.config._disable},set:function set(dates){self.config._disable=parseDateRules(dates)}});var timeMode=userConfig.mode==="time";if(!userConfig.dateFormat&&(userConfig.enableTime||timeMode)){formats$$1.dateFormat=userConfig.noCalendar||timeMode?"H:i"+(userConfig.enableSeconds?":S":""):flatpickr.defaultConfig.dateFormat+" H:i"+(userConfig.enableSeconds?":S":"")}
if(userConfig.altInput&&(userConfig.enableTime||timeMode)&&!userConfig.altFormat){formats$$1.altFormat=userConfig.noCalendar||timeMode?"h:i"+(userConfig.enableSeconds?":S K":" K"):flatpickr.defaultConfig.altFormat+(" h:i"+(userConfig.enableSeconds?":S":"")+" K")}
Object.defineProperty(self.config,"minDate",{get:function get(){return self.config._minDate},set:minMaxDateSetter("min")});Object.defineProperty(self.config,"maxDate",{get:function get(){return self.config._maxDate},set:minMaxDateSetter("max")});var minMaxTimeSetter=function minMaxTimeSetter(type){return function(val){self.config[type==="min"?"_minTime":"_maxTime"]=self.parseDate(val,"H:i")}};Object.defineProperty(self.config,"minTime",{get:function get(){return self.config._minTime},set:minMaxTimeSetter("min")});Object.defineProperty(self.config,"maxTime",{get:function get(){return self.config._maxTime},set:minMaxTimeSetter("max")});if(userConfig.mode==="time"){self.config.noCalendar=!0;self.config.enableTime=!0}
Object.assign(self.config,formats$$1,userConfig);for(var i=0;i<boolOpts.length;i++){self.config[boolOpts[i]]=self.config[boolOpts[i]]===!0||self.config[boolOpts[i]]==="true"}
for(var _i=hooks.length;_i--;){if(self.config[hooks[_i]]!==undefined){self.config[hooks[_i]]=arrayify(self.config[hooks[_i]]||[]).map(bindToInstance)}}
self.isMobile=!self.config.disableMobile&&!self.config.inline&&self.config.mode==="single"&&!self.config.disable.length&&!self.config.enable.length&&!self.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var _i2=0;_i2<self.config.plugins.length;_i2++){var pluginConf=self.config.plugins[_i2](self)||{};for(var key in pluginConf){if(~hooks.indexOf(key)){self.config[key]=arrayify(pluginConf[key]).map(bindToInstance).concat(self.config[key])}else if(typeof userConfig[key]==="undefined")self.config[key]=pluginConf[key]}}
triggerEvent("onParseConfig")}
function setupLocale(){if(typeof self.config.locale!=="object"&&typeof flatpickr.l10ns[self.config.locale]==="undefined")self.config.errorHandler(new Error("flatpickr: invalid locale "+self.config.locale));self.l10n=Object.assign({},flatpickr.l10ns.default,typeof self.config.locale==="object"?self.config.locale:self.config.locale!=="default"?flatpickr.l10ns[self.config.locale]:undefined);tokenRegex.K="("+self.l10n.amPM[0]+"|"+self.l10n.amPM[1]+"|"+self.l10n.amPM[0].toLowerCase()+"|"+self.l10n.amPM[1].toLowerCase()+")";self.formatDate=createDateFormatter(self);self.parseDate=createDateParser({config:self.config,l10n:self.l10n})}
function positionCalendar(customPositionElement){if(self.calendarContainer===undefined)return;triggerEvent("onPreCalendarPosition");var positionElement=customPositionElement||self._positionElement;var calendarHeight=Array.prototype.reduce.call(self.calendarContainer.children,function(acc,child){return acc+child.offsetHeight},0),calendarWidth=self.calendarContainer.offsetWidth,configPos=self.config.position.split(" "),configPosVertical=configPos[0],configPosHorizontal=configPos.length>1?configPos[1]:null,inputBounds=positionElement.getBoundingClientRect(),distanceFromBottom=window.innerHeight-inputBounds.bottom,showOnTop=configPosVertical==="above"||configPosVertical!=="below"&&distanceFromBottom<calendarHeight&&inputBounds.top>calendarHeight;var top=window.pageYOffset+inputBounds.top+(!showOnTop?positionElement.offsetHeight+2:-calendarHeight-2);toggleClass(self.calendarContainer,"arrowTop",!showOnTop);toggleClass(self.calendarContainer,"arrowBottom",showOnTop);if(self.config.inline)return;var left=window.pageXOffset+inputBounds.left-(configPosHorizontal!=null&&configPosHorizontal==="center"?(calendarWidth-inputBounds.width)/2:0);var right=window.document.body.offsetWidth-inputBounds.right;var rightMost=left+calendarWidth>window.document.body.offsetWidth;toggleClass(self.calendarContainer,"rightMost",rightMost);if(self.config.static)return;self.calendarContainer.style.top=top+"px";if(!rightMost){self.calendarContainer.style.left=left+"px";self.calendarContainer.style.right="auto"}else{self.calendarContainer.style.left="auto";self.calendarContainer.style.right=right+"px"}}
function redraw(){if(self.config.noCalendar||self.isMobile)return;updateNavigationCurrentMonth();buildDays()}
function focusAndClose(){self._input.focus();if(window.navigator.userAgent.indexOf("MSIE")!==-1||navigator.msMaxTouchPoints!==undefined){setTimeout(self.close,0)}else{self.close()}}
function selectDate(e){e.preventDefault();e.stopPropagation();var isSelectable=function isSelectable(day){return day.classList&&day.classList.contains("flatpickr-day")&&!day.classList.contains("disabled")&&!day.classList.contains("notAllowed")};var t=findParent(e.target,isSelectable);if(t===undefined)return;var target=t;var selectedDate=self.latestSelectedDateObj=new Date(target.dateObj.getTime());var shouldChangeMonth=(selectedDate.getMonth()<self.currentMonth||selectedDate.getMonth()>self.currentMonth+self.config.showMonths-1)&&self.config.mode!=="range";self.selectedDateElem=target;if(self.config.mode==="single")self.selectedDates=[selectedDate];else if(self.config.mode==="multiple"){var selectedIndex=isDateSelected(selectedDate);if(selectedIndex)self.selectedDates.splice(parseInt(selectedIndex),1);else self.selectedDates.push(selectedDate)}else if(self.config.mode==="range"){if(self.selectedDates.length===2)self.clear(!1);self.selectedDates.push(selectedDate);if(compareDates(selectedDate,self.selectedDates[0],!0)!==0)self.selectedDates.sort(function(a,b){return a.getTime()-b.getTime()})}
setHoursFromInputs();if(shouldChangeMonth){var isNewYear=self.currentYear!==selectedDate.getFullYear();self.currentYear=selectedDate.getFullYear();self.currentMonth=selectedDate.getMonth();if(isNewYear)triggerEvent("onYearChange");triggerEvent("onMonthChange")}
updateNavigationCurrentMonth();buildDays();updateValue();if(self.config.enableTime)setTimeout(function(){return self.showTimeInput=!0},50);if(!shouldChangeMonth&&self.config.mode!=="range"&&self.config.showMonths===1)focusOnDayElem(target);else self.selectedDateElem&&self.selectedDateElem.focus();if(self.hourElement!==undefined)setTimeout(function(){return self.hourElement!==undefined&&self.hourElement.select()},451);if(self.config.closeOnSelect){var single=self.config.mode==="single"&&!self.config.enableTime;var range=self.config.mode==="range"&&self.selectedDates.length===2&&!self.config.enableTime;if(single||range){focusAndClose()}}
triggerChange()}
var CALLBACKS={locale:[setupLocale,updateWeekdays],showMonths:[buildMonths,setCalendarWidth,buildWeekdays]};function set(option,value){if(option!==null&&typeof option==="object")Object.assign(self.config,option);else{self.config[option]=value;if(CALLBACKS[option]!==undefined)CALLBACKS[option].forEach(function(x){return x()})}
self.redraw();jumpToDate()}
function setSelectedDate(inputDate,format){var dates=[];if(inputDate instanceof Array)dates=inputDate.map(function(d){return self.parseDate(d,format)});else if(inputDate instanceof Date||typeof inputDate==="number")dates=[self.parseDate(inputDate,format)];else if(typeof inputDate==="string"){switch(self.config.mode){case "single":case "time":dates=[self.parseDate(inputDate,format)];break;case "multiple":dates=inputDate.split(self.config.conjunction).map(function(date){return self.parseDate(date,format)});break;case "range":dates=inputDate.split(self.l10n.rangeSeparator).map(function(date){return self.parseDate(date,format)});break;default:break}}else self.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(inputDate)));self.selectedDates=dates.filter(function(d){return d instanceof Date&&isEnabled(d,!1)});if(self.config.mode==="range")self.selectedDates.sort(function(a,b){return a.getTime()-b.getTime()})}
function setDate(date,triggerChange,format){if(triggerChange===void 0){triggerChange=!1}
if(format===void 0){format=self.config.dateFormat}
if(date!==0&&!date||date instanceof Array&&date.length===0)return self.clear(triggerChange);setSelectedDate(date,format);self.showTimeInput=self.selectedDates.length>0;self.latestSelectedDateObj=self.selectedDates[0];self.redraw();jumpToDate();setHoursFromDate();updateValue(triggerChange);if(triggerChange)triggerEvent("onChange")}
function parseDateRules(arr){return arr.slice().map(function(rule){if(typeof rule==="string"||typeof rule==="number"||rule instanceof Date){return self.parseDate(rule,undefined,!0)}else if(rule&&typeof rule==="object"&&rule.from&&rule.to)return{from:self.parseDate(rule.from,undefined),to:self.parseDate(rule.to,undefined)};return rule}).filter(function(x){return x})}
function setupDates(){self.selectedDates=[];self.now=self.parseDate(self.config.now)||new Date();var preloadedDate=self.config.defaultDate||((self.input.nodeName==="INPUT"||self.input.nodeName==="TEXTAREA")&&self.input.placeholder&&self.input.value===self.input.placeholder?null:self.input.value);if(preloadedDate)setSelectedDate(preloadedDate,self.config.dateFormat);var initialDate=self.selectedDates.length>0?self.selectedDates[0]:self.config.minDate&&self.config.minDate.getTime()>self.now.getTime()?self.config.minDate:self.config.maxDate&&self.config.maxDate.getTime()<self.now.getTime()?self.config.maxDate:self.now;self.currentYear=initialDate.getFullYear();self.currentMonth=initialDate.getMonth();if(self.selectedDates.length>0)self.latestSelectedDateObj=self.selectedDates[0];if(self.config.minTime!==undefined)self.config.minTime=self.parseDate(self.config.minTime,"H:i");if(self.config.maxTime!==undefined)self.config.maxTime=self.parseDate(self.config.maxTime,"H:i");self.minDateHasTime=!!self.config.minDate&&(self.config.minDate.getHours()>0||self.config.minDate.getMinutes()>0||self.config.minDate.getSeconds()>0);self.maxDateHasTime=!!self.config.maxDate&&(self.config.maxDate.getHours()>0||self.config.maxDate.getMinutes()>0||self.config.maxDate.getSeconds()>0);Object.defineProperty(self,"showTimeInput",{get:function get(){return self._showTimeInput},set:function set(bool){self._showTimeInput=bool;if(self.calendarContainer)toggleClass(self.calendarContainer,"showTimeInput",bool);self.isOpen&&positionCalendar()}})}
function setupInputs(){self.input=self.config.wrap?element.querySelector("[data-input]"):element;if(!self.input){self.config.errorHandler(new Error("Invalid input element specified"));return}
self.input._type=self.input.type;self.input.type="text";self.input.classList.add("flatpickr-input");self._input=self.input;if(self.config.altInput){self.altInput=createElement(self.input.nodeName,self.input.className+" "+self.config.altInputClass);self._input=self.altInput;self.altInput.placeholder=self.input.placeholder;self.altInput.disabled=self.input.disabled;self.altInput.required=self.input.required;self.altInput.tabIndex=self.input.tabIndex;self.altInput.type="text";self.input.setAttribute("type","hidden");if(!self.config.static&&self.input.parentNode)self.input.parentNode.insertBefore(self.altInput,self.input.nextSibling)}
if(!self.config.allowInput)self._input.setAttribute("readonly","readonly");self._positionElement=self.config.positionElement||self._input}
function setupMobile(){var inputType=self.config.enableTime?self.config.noCalendar?"time":"datetime-local":"date";self.mobileInput=createElement("input",self.input.className+" flatpickr-mobile");self.mobileInput.step=self.input.getAttribute("step")||"any";self.mobileInput.tabIndex=1;self.mobileInput.type=inputType;self.mobileInput.disabled=self.input.disabled;self.mobileInput.required=self.input.required;self.mobileInput.placeholder=self.input.placeholder;self.mobileFormatStr=inputType==="datetime-local"?"Y-m-d\\TH:i:S":inputType==="date"?"Y-m-d":"H:i:S";if(self.selectedDates.length>0){self.mobileInput.defaultValue=self.mobileInput.value=self.formatDate(self.selectedDates[0],self.mobileFormatStr)}
if(self.config.minDate)self.mobileInput.min=self.formatDate(self.config.minDate,"Y-m-d");if(self.config.maxDate)self.mobileInput.max=self.formatDate(self.config.maxDate,"Y-m-d");self.input.type="hidden";if(self.altInput!==undefined)self.altInput.type="hidden";try{if(self.input.parentNode)self.input.parentNode.insertBefore(self.mobileInput,self.input.nextSibling)}catch(_a){}
bind(self.mobileInput,"change",function(e){self.setDate(e.target.value,!1,self.mobileFormatStr);triggerEvent("onChange");triggerEvent("onClose")})}
function toggle(e){if(self.isOpen===!0)return self.close();self.open(e)}
function triggerEvent(event,data){var hooks=self.config[event];if(hooks!==undefined&&hooks.length>0){for(var i=0;hooks[i]&&i<hooks.length;i++){hooks[i](self.selectedDates,self.input.value,self,data)}}
if(event==="onChange"){self.input.dispatchEvent(createEvent("change"));self.input.dispatchEvent(createEvent("input"))}}
function createEvent(name){var e=document.createEvent("Event");e.initEvent(name,!0,!0);return e}
function isDateSelected(date){for(var i=0;i<self.selectedDates.length;i++){if(compareDates(self.selectedDates[i],date)===0)return""+i}
return!1}
function isDateInRange(date){if(self.config.mode!=="range"||self.selectedDates.length<2)return!1;return compareDates(date,self.selectedDates[0])>=0&&compareDates(date,self.selectedDates[1])<=0}
function updateNavigationCurrentMonth(){if(self.config.noCalendar||self.isMobile||!self.monthNav)return;self.yearElements.forEach(function(yearElement,i){var d=new Date(self.currentYear,self.currentMonth,1);d.setMonth(self.currentMonth+i);self.monthElements[i].textContent=monthToStr(d.getMonth(),self.config.shorthandCurrentMonth,self.l10n)+" ";yearElement.value=d.getFullYear().toString()});self._hidePrevMonthArrow=self.config.minDate!==undefined&&(self.currentYear===self.config.minDate.getFullYear()?self.currentMonth<=self.config.minDate.getMonth():self.currentYear<self.config.minDate.getFullYear());self._hideNextMonthArrow=self.config.maxDate!==undefined&&(self.currentYear===self.config.maxDate.getFullYear()?self.currentMonth+1>self.config.maxDate.getMonth():self.currentYear>self.config.maxDate.getFullYear())}
function updateValue(triggerChange){if(triggerChange===void 0){triggerChange=!0}
if(self.selectedDates.length===0)return self.clear(triggerChange);if(self.mobileInput!==undefined&&self.mobileFormatStr){self.mobileInput.value=self.latestSelectedDateObj!==undefined?self.formatDate(self.latestSelectedDateObj,self.mobileFormatStr):""}
var joinChar=self.config.mode!=="range"?self.config.conjunction:self.l10n.rangeSeparator;self.input.value=self.selectedDates.map(function(dObj){return self.formatDate(dObj,self.config.dateFormat)}).join(joinChar);if(self.altInput!==undefined){self.altInput.value=self.selectedDates.map(function(dObj){return self.formatDate(dObj,self.config.altFormat)}).join(joinChar)}
if(triggerChange!==!1)triggerEvent("onValueUpdate")}
function onMonthNavClick(e){e.preventDefault();var isPrevMonth=self.prevMonthNav.contains(e.target);var isNextMonth=self.nextMonthNav.contains(e.target);if(isPrevMonth||isNextMonth){changeMonth(isPrevMonth?-1:1)}else if(self.yearElements.indexOf(e.target)>=0){e.target.select()}else if(e.target.classList.contains("arrowUp")){self.changeYear(self.currentYear+1)}else if(e.target.classList.contains("arrowDown")){self.changeYear(self.currentYear-1)}}
function timeWrapper(e){e.preventDefault();var isKeyDown=e.type==="keydown",input=e.target;if(self.amPM!==undefined&&e.target===self.amPM){self.amPM.textContent=self.l10n.amPM[int(self.amPM.textContent===self.l10n.amPM[0])]}
var min=parseFloat(input.getAttribute("data-min")),max=parseFloat(input.getAttribute("data-max")),step=parseFloat(input.getAttribute("data-step")),curValue=parseInt(input.value,10),delta=e.delta||(isKeyDown?e.which===38?1:-1:0);var newValue=curValue+step*delta;if(typeof input.value!=="undefined"&&input.value.length===2){var isHourElem=input===self.hourElement,isMinuteElem=input===self.minuteElement;if(newValue<min){newValue=max+newValue+int(!isHourElem)+(int(isHourElem)&&int(!self.amPM));if(isMinuteElem)incrementNumInput(undefined,-1,self.hourElement)}else if(newValue>max){newValue=input===self.hourElement?newValue-max-int(!self.amPM):min;if(isMinuteElem)incrementNumInput(undefined,1,self.hourElement)}
if(self.amPM&&isHourElem&&(step===1?newValue+curValue===23:Math.abs(newValue-curValue)>step)){self.amPM.textContent=self.l10n.amPM[int(self.amPM.textContent===self.l10n.amPM[0])]}
input.value=pad(newValue)}}
init();return self}
function _flatpickr(nodeList,config){var nodes=Array.prototype.slice.call(nodeList);var instances=[];for(var i=0;i<nodes.length;i++){var node=nodes[i];try{if(node.getAttribute("data-fp-omit")!==null)continue;if(node._flatpickr!==undefined){node._flatpickr.destroy();node._flatpickr=undefined}
node._flatpickr=FlatpickrInstance(node,config||{});instances.push(node._flatpickr)}catch(e){console.error(e)}}
return instances.length===1?instances[0]:instances}
if(typeof HTMLElement!=="undefined"){HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(config){return _flatpickr(this,config)};HTMLElement.prototype.flatpickr=function(config){return _flatpickr([this],config)}}
var flatpickr=function flatpickr(selector,config){if(selector instanceof NodeList)return _flatpickr(selector,config);else if(typeof selector==="string")return _flatpickr(window.document.querySelectorAll(selector),config);return _flatpickr([selector],config)};flatpickr.defaultConfig=defaults;flatpickr.l10ns={en:Object.assign({},english),default:Object.assign({},english)};flatpickr.localize=function(l10n){flatpickr.l10ns.default=Object.assign({},flatpickr.l10ns.default,l10n)};flatpickr.setDefaults=function(config){flatpickr.defaultConfig=Object.assign({},flatpickr.defaultConfig,config)};flatpickr.parseDate=createDateParser({});flatpickr.formatDate=createDateFormatter({});flatpickr.compareDates=compareDates;if(typeof jQuery!=="undefined"){jQuery.fn.flatpickr=function(config){return _flatpickr(this,config)}}
Date.prototype.fp_incr=function(days){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+(typeof days==="string"?parseInt(days,10):days))};if(typeof window!=="undefined"){window.flatpickr=flatpickr}
return flatpickr})));extend=function(out){out=out||{};for(var i=1;i<arguments.length;i++){if(!arguments[i]){continue}
for(var key in arguments[i]){if(arguments[i].hasOwnProperty(key)){out[key]=arguments[i][key]}}}
return out};function setViewportCustomProperties(){const vh=window.innerHeight*0.01;const vw=document.body.clientWidth*0.01;if(!vh||!vw){return}
clearInterval(viewportCustomPropertiesIntervalHandler);document.documentElement.style.setProperty('--vh',"".concat(vh,"px"));document.documentElement.style.setProperty('--vw',"".concat(vw,"px"))}
const viewportCustomPropertiesIntervalHandler=setInterval(()=>{setViewportCustomProperties()},100);setViewportCustomProperties();let windowWidth=window.innerWidth
window.addEventListener('resize',function(){if(window.innerWidth!==windowWidth){windowWidth=window.innerWidth;setViewportCustomProperties()}});const request={};fetchSVG=function(url,el){if(!url){return}
request[url]=request[url]||fetch(url).then(response=>response.text()).then(data=>new Promise((resolve,reject)=>{const parser=new DOMParser();const parsed=parser.parseFromString(data,'image/svg+xml');const svg=parsed.querySelector('svg');if(svg){resolve(svg)}else{reject(new Error('Unable to parse SVG '+url))}}));request[url].then(svg=>{const clone=svg.cloneNode(!0);const attr=clone.attributes;const attrLen=attr.length;for(let i=0;i<attrLen;++i){if(attr[i].specified){if('class'===attr[i].name){const classes=attr[i].value.replace(/\s+/g,' ').trim().split(' ');const classesLen=classes.length;for(let j=0;j<classesLen;++j){el.classList.add(classes[j])}}else{el.setAttribute(attr[i].name,attr[i].value)}}}
while(clone.childNodes.length){el.appendChild(clone.childNodes[0])}})}