/* Minification failed. Returning unminified contents.
(2221,4-7): run-time error JS1009: Expected '}': ...
(2222,4-5): run-time error JS1009: Expected '}': ;
(2241,2-3): run-time error JS1002: Syntax error: }
(2241,3-4): run-time error JS1195: Expected expression: ,
(2242,31-32): run-time error JS1010: Expected identifier: (
(2244,3-4): run-time error JS1195: Expected expression: ,
(2245,29-30): run-time error JS1010: Expected identifier: (
(2251,1-2): run-time error JS1002: Syntax error: }
(14053,11-12): run-time error JS1010: Expected identifier: .
(14053,11-12): run-time error JS1195: Expected expression: .
 */
/** vim: et:ts=4:sw=4:sts=4
 * @license RequireJS 2.3.5 Copyright jQuery Foundation and other contributors.
 * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
 */
//Not using strict: uneven strict support in browsers, #392, and causes
//problems with requirejs.exec()/transpiler plugins that may not be strict.
/*jslint regexp: true, nomen: true, sloppy: true */
/*global window, navigator, document, importScripts, setTimeout, opera */

var requirejs, require, define;
(function (global, setTimeout) {
    var req, s, head, baseElement, dataMain, src,
        interactiveScript, currentlyAddingScript, mainScript, subPath,
        version = '2.3.5',
        commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg,
        cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
        jsSuffixRegExp = /\.js$/,
        currDirRegExp = /^\.\//,
        op = Object.prototype,
        ostring = op.toString,
        hasOwn = op.hasOwnProperty,
        isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
        isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
        //PS3 indicates loaded and complete, but need to wait for complete
        //specifically. Sequence is 'loading', 'loaded', execution,
        // then 'complete'. The UA check is unfortunate, but not sure how
        //to feature test w/o causing perf issues.
        readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
            /^complete$/ : /^(complete|loaded)$/,
        defContextName = '_',
        //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
        isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
        contexts = {},
        cfg = {},
        globalDefQueue = [],
        useInteractive = false;

    //Could match something like ')//comment', do not lose the prefix to comment.
    function commentReplace(match, singlePrefix) {
        return singlePrefix || '';
    }

    function isFunction(it) {
        return ostring.call(it) === '[object Function]';
    }

    function isArray(it) {
        return ostring.call(it) === '[object Array]';
    }

    /**
     * Helper function for iterating over an array. If the func returns
     * a true value, it will break out of the loop.
     */
    function each(ary, func) {
        if (ary) {
            var i;
            for (i = 0; i < ary.length; i += 1) {
                if (ary[i] && func(ary[i], i, ary)) {
                    break;
                }
            }
        }
    }

    /**
     * Helper function for iterating over an array backwards. If the func
     * returns a true value, it will break out of the loop.
     */
    function eachReverse(ary, func) {
        if (ary) {
            var i;
            for (i = ary.length - 1; i > -1; i -= 1) {
                if (ary[i] && func(ary[i], i, ary)) {
                    break;
                }
            }
        }
    }

    function hasProp(obj, prop) {
        return hasOwn.call(obj, prop);
    }

    function getOwn(obj, prop) {
        return hasProp(obj, prop) && obj[prop];
    }

    /**
     * Cycles over properties in an object and calls a function for each
     * property value. If the function returns a truthy value, then the
     * iteration is stopped.
     */
    function eachProp(obj, func) {
        var prop;
        for (prop in obj) {
            if (hasProp(obj, prop)) {
                if (func(obj[prop], prop)) {
                    break;
                }
            }
        }
    }

    /**
     * Simple function to mix in properties from source into target,
     * but only if target does not already have a property of the same name.
     */
    function mixin(target, source, force, deepStringMixin) {
        if (source) {
            eachProp(source, function (value, prop) {
                if (force || !hasProp(target, prop)) {
                    if (deepStringMixin && typeof value === 'object' && value &&
                        !isArray(value) && !isFunction(value) &&
                        !(value instanceof RegExp)) {

                        if (!target[prop]) {
                            target[prop] = {};
                        }
                        mixin(target[prop], value, force, deepStringMixin);
                    } else {
                        target[prop] = value;
                    }
                }
            });
        }
        return target;
    }

    //Similar to Function.prototype.bind, but the 'this' object is specified
    //first, since it is easier to read/figure out what 'this' will be.
    function bind(obj, fn) {
        return function () {
            return fn.apply(obj, arguments);
        };
    }

    function scripts() {
        return document.getElementsByTagName('script');
    }

    function defaultOnError(err) {
        throw err;
    }

    //Allow getting a global that is expressed in
    //dot notation, like 'a.b.c'.
    function getGlobal(value) {
        if (!value) {
            return value;
        }
        var g = global;
        console.log("row 153, param value => ", value);
        each(value.split('.'), function (part) {
            g = g[part];
        });
        return g;
    }

    /**
     * Constructs an error with a pointer to an URL with more information.
     * @param {String} id the error ID that maps to an ID on a web page.
     * @param {String} message human readable error.
     * @param {Error} [err] the original error, if there is one.
     *
     * @returns {Error}
     */
    function makeError(id, msg, err, requireModules) {
        var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
        e.requireType = id;
        e.requireModules = requireModules;
        if (err) {
            e.originalError = err;
        }
        return e;
    }

    if (typeof define !== 'undefined') {
        //If a define is already in play via another AMD loader,
        //do not overwrite.
        return;
    }

    if (typeof requirejs !== 'undefined') {
        if (isFunction(requirejs)) {
            //Do not overwrite an existing requirejs instance.
            return;
        }
        cfg = requirejs;
        requirejs = undefined;
    }

    //Allow for a require config object
    if (typeof require !== 'undefined' && !isFunction(require)) {
        //assume it is a config object.
        cfg = require;
        require = undefined;
    }

    function newContext(contextName) {
        var inCheckLoaded, Module, context, handlers,
            checkLoadedTimeoutId,
            config = {
                //Defaults. Do not set a default for map
                //config to speed up normalize(), which
                //will run faster if there is no default.
                waitSeconds: 7,
                baseUrl: './',
                paths: {},
                bundles: {},
                pkgs: {},
                shim: {},
                config: {}
            },
            registry = {},
            //registry of just enabled modules, to speed
            //cycle breaking code when lots of modules
            //are registered, but not activated.
            enabledRegistry = {},
            undefEvents = {},
            defQueue = [],
            defined = {},
            urlFetched = {},
            bundlesMap = {},
            requireCounter = 1,
            unnormalizedCounter = 1;

        /**
         * Trims the . and .. from an array of path segments.
         * It will keep a leading path segment if a .. will become
         * the first path segment, to help with module name lookups,
         * which act like paths, but can be remapped. But the end result,
         * all paths that use this function should look normalized.
         * NOTE: this method MODIFIES the input array.
         * @param {Array} ary the array of path segments.
         */
        function trimDots(ary) {
            var i, part;
            for (i = 0; i < ary.length; i++) {
                part = ary[i];
                if (part === '.') {
                    ary.splice(i, 1);
                    i -= 1;
                } else if (part === '..') {
                    // If at the start, or previous value is still ..,
                    // keep them so that when converted to a path it may
                    // still work when converted to a path, even though
                    // as an ID it is less than ideal. In larger point
                    // releases, may be better to just kick out an error.
                    if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') {
                        continue;
                    } else if (i > 0) {
                        ary.splice(i - 1, 2);
                        i -= 2;
                    }
                }
            }
        }

        /**
         * Given a relative module name, like ./something, normalize it to
         * a real name that can be mapped to a path.
         * @param {String} name the relative name
         * @param {String} baseName a real name that the name arg is relative
         * to.
         * @param {Boolean} applyMap apply the map config to the value. Should
         * only be done if this normalization is for a dependency ID.
         * @returns {String} normalized name
         */
        function normalize(name, baseName, applyMap) {

            //console.log("row 272");
            var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
                foundMap, foundI, foundStarMap, starI, normalizedBaseParts,
                baseParts = (baseName && baseName.split('/')),
                map = config.map,
                starMap = map && map['*'];

            //Adjust any relative paths.
            if (name) {
                //console.log("row 278");
                name = name.split('/');
                lastIndex = name.length - 1;

                // If wanting node ID compatibility, strip .js from end
                // of IDs. Have to do this here, and not in nameToUrl
                // because node allows either .js or non .js to map
                // to same file.
                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
                }

                // Starts with a '.' so need the baseName
                if (name[0].charAt(0) === '.' && baseParts) {
                    //Convert baseName to array, and lop off the last part,
                    //so that . matches that 'directory' and not name of the baseName's
                    //module. For instance, baseName of 'one/two/three', maps to
                    //'one/two/three.js', but we want the directory, 'one/two' for
                    //this normalization.
                    normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
                    name = normalizedBaseParts.concat(name);
                }

                trimDots(name);
                name = name.join('/');
            }

            //Apply map config if available.
            if (applyMap && map && (baseParts || starMap)) {
                //console.log("row 306");
                nameParts = name.split('/');

                outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
                    nameSegment = nameParts.slice(0, i).join('/');

                    if (baseParts) {
                        //Find the longest baseName segment match in the config.
                        //So, do joins on the biggest to smallest lengths of baseParts.
                        for (j = baseParts.length; j > 0; j -= 1) {
                            mapValue = getOwn(map, baseParts.slice(0, j).join('/'));

                            //baseName segment has config, find if it has one for
                            //this name.
                            if (mapValue) {
                                mapValue = getOwn(mapValue, nameSegment);
                                if (mapValue) {
                                    //Match, update name to the new value.
                                    foundMap = mapValue;
                                    foundI = i;
                                    break outerLoop;
                                }
                            }
                        }
                    }

                    //Check for a star map match, but just hold on to it,
                    //if there is a shorter segment match later in a matching
                    //config, then favor over this star map.
                    if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
                        foundStarMap = getOwn(starMap, nameSegment);
                        starI = i;
                    }
                }

                if (!foundMap && foundStarMap) {
                    foundMap = foundStarMap;
                    foundI = starI;
                }

                if (foundMap) {
                    nameParts.splice(0, foundI, foundMap);
                    name = nameParts.join('/');
                }
            }

            // If the name points to a package's name, use
            // the package main instead.
            pkgMain = getOwn(config.pkgs, name);

            return pkgMain ? pkgMain : name;
        }

        function removeScript(name) {
            if (isBrowser) {
                each(scripts(), function (scriptNode) {
                    if (scriptNode.getAttribute('data-requiremodule') === name &&
                        scriptNode.getAttribute('data-requirecontext') === context.contextName) {
                        scriptNode.parentNode.removeChild(scriptNode);
                        return true;
                    }
                });
            }
        }

        function hasPathFallback(id) {
            var pathConfig = getOwn(config.paths, id);
            if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
                //Pop off the first array value, since it failed, and
                //retry
                pathConfig.shift();
                context.require.undef(id);

                //Custom require that does not do map translation, since
                //ID is "absolute", already mapped/resolved.
                context.makeRequire(null, {
                    skipMap: true
                })([id]);

                return true;
            }
        }

        //Turns a plugin!resource to [plugin, resource]
        //with the plugin being undefined if the name
        //did not have a plugin prefix.
        function splitPrefix(name) {
            var prefix,
                index = name ? name.indexOf('!') : -1;
            if (index > -1) {
                prefix = name.substring(0, index);
                name = name.substring(index + 1, name.length);
            }
            return [prefix, name];
        }

        /**
         * Creates a module mapping that includes plugin prefix, module
         * name, and path. If parentModuleMap is provided it will
         * also normalize the name via require.normalize()
         *
         * @param {String} name the module name
         * @param {String} [parentModuleMap] parent module map
         * for the module name, used to resolve relative names.
         * @param {Boolean} isNormalized: is the ID already normalized.
         * This is true if this call is done for a define() module ID.
         * @param {Boolean} applyMap: apply the map config to the ID.
         * Should only be true if this map is for a dependency.
         *
         * @returns {Object}
         */
        function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
            var url, pluginModule, suffix, nameParts,
                prefix = null,
                parentName = parentModuleMap ? parentModuleMap.name : null,
                originalName = name,
                isDefine = true,
                normalizedName = '';

            //If no name, then it means it is a require call, generate an
            //internal name.
            if (!name) {
                isDefine = false;
                name = '_@r' + (requireCounter += 1);
            }
            //console.log("row 430");
            nameParts = splitPrefix(name);
            prefix = nameParts[0];
            name = nameParts[1];

            if (prefix) {
                prefix = normalize(prefix, parentName, applyMap);
                pluginModule = getOwn(defined, prefix);
            }

            //Account for relative paths if there is a base name.
            if (name) {
                if (prefix) {
                    if (isNormalized) {
                        normalizedName = name;
                    } else if (pluginModule && pluginModule.normalize) {
                        //Plugin is loaded, use its normalize method.
                        normalizedName = pluginModule.normalize(name, function (name) {
                            return normalize(name, parentName, applyMap);
                        });
                    } else {
                        // If nested plugin references, then do not try to
                        // normalize, as it will not normalize correctly. This
                        // places a restriction on resourceIds, and the longer
                        // term solution is not to normalize until plugins are
                        // loaded and all normalizations to allow for async
                        // loading of a loader plugin. But for now, fixes the
                        // common uses. Details in #1131
                        normalizedName = name.indexOf('!') === -1 ?
                            normalize(name, parentName, applyMap) :
                            name;
                    }
                } else {
                    //A regular module.
                    normalizedName = normalize(name, parentName, applyMap);

                    //Normalized name may be a plugin ID due to map config
                    //application in normalize. The map config values must
                    //already be normalized, so do not need to redo that part.
                    //console.log("row 469");
                    nameParts = splitPrefix(normalizedName);
                    prefix = nameParts[0];
                    normalizedName = nameParts[1];
                    isNormalized = true;

                    url = context.nameToUrl(normalizedName);
                }
            }

            //If the id is a plugin id that cannot be determined if it needs
            //normalization, stamp it with a unique ID so two matching relative
            //ids that may conflict can be separate.
            suffix = prefix && !pluginModule && !isNormalized ?
                '_unnormalized' + (unnormalizedCounter += 1) :
                '';

            return {
                prefix: prefix,
                name: normalizedName,
                parentMap: parentModuleMap,
                unnormalized: !!suffix,
                url: url,
                originalName: originalName,
                isDefine: isDefine,
                id: (prefix ?
                    prefix + '!' + normalizedName :
                    normalizedName) + suffix
            };
        }

        function getModule(depMap) {
            var id = depMap.id,
                mod = getOwn(registry, id);

            if (!mod) {
                mod = registry[id] = new context.Module(depMap);
            }

            return mod;
        }

        function on(depMap, name, fn) {
            var id = depMap.id,
                mod = getOwn(registry, id);

            if (hasProp(defined, id) &&
                (!mod || mod.defineEmitComplete)) {
                if (name === 'defined') {
                    fn(defined[id]);
                }
            } else {
                mod = getModule(depMap);
                if (mod.error && name === 'error') {
                    fn(mod.error);
                } else {
                    mod.on(name, fn);
                }
            }
        }

        function onError(err, errback) {
            var ids = err.requireModules,
                notified = false;

            if (errback) {
                errback(err);
            } else {
                each(ids, function (id) {
                    var mod = getOwn(registry, id);
                    if (mod) {
                        //Set error on module, so it skips timeout checks.
                        mod.error = err;
                        if (mod.events.error) {
                            notified = true;
                            mod.emit('error', err);
                        }
                    }
                });

                if (!notified) {
                    req.onError(err);
                }
            }
        }

        /**
         * Internal method to transfer globalQueue items to this context's
         * defQueue.
         */
        function takeGlobalQueue() {
            //Push all the globalDefQueue items into the context's defQueue
            if (globalDefQueue.length) {
                each(globalDefQueue, function (queueItem) {
                    var id = queueItem[0];
                    if (typeof id === 'string') {
                        context.defQueueMap[id] = true;
                    }
                    defQueue.push(queueItem);
                });
                globalDefQueue = [];
            }
        }

        handlers = {
            'require': function (mod) {
                if (mod.require) {
                    return mod.require;
                } else {
                    return (mod.require = context.makeRequire(mod.map));
                }
            },
            'exports': function (mod) {
                mod.usingExports = true;
                if (mod.map.isDefine) {
                    if (mod.exports) {
                        return (defined[mod.map.id] = mod.exports);
                    } else {
                        return (mod.exports = defined[mod.map.id] = {});
                    }
                }
            },
            'module': function (mod) {
                if (mod.module) {
                    return mod.module;
                } else {
                    return (mod.module = {
                        id: mod.map.id,
                        uri: mod.map.url,
                        config: function () {
                            return getOwn(config.config, mod.map.id) || {};
                        },
                        exports: mod.exports || (mod.exports = {})
                    });
                }
            }
        };

        function cleanRegistry(id) {
            //Clean up machinery used for waiting modules.
            delete registry[id];
            delete enabledRegistry[id];
        }

        function breakCycle(mod, traced, processed) {
            var id = mod.map.id;

            if (mod.error) {
                mod.emit('error', mod.error);
            } else {
                traced[id] = true;
                each(mod.depMaps, function (depMap, i) {
                    var depId = depMap.id,
                        dep = getOwn(registry, depId);

                    //Only force things that have not completed
                    //being defined, so still in the registry,
                    //and only if it has not been matched up
                    //in the module already.
                    if (dep && !mod.depMatched[i] && !processed[depId]) {
                        if (getOwn(traced, depId)) {
                            mod.defineDep(i, defined[depId]);
                            mod.check(); //pass false?
                        } else {
                            breakCycle(dep, traced, processed);
                        }
                    }
                });
                processed[id] = true;
            }
        }

        function checkLoaded() {
            var err, usingPathFallback,
                waitInterval = config.waitSeconds * 1000,
                //It is possible to disable the wait interval by using waitSeconds of 0.
                expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
                noLoads = [],
                reqCalls = [],
                stillLoading = false,
                needCycleCheck = true;

            //Do not bother if this call was a result of a cycle break.
            if (inCheckLoaded) {
                return;
            }

            inCheckLoaded = true;

            //Figure out the state of all the modules.
            eachProp(enabledRegistry, function (mod) {
                var map = mod.map,
                    modId = map.id;

                //Skip things that are not enabled or in error state.
                if (!mod.enabled) {
                    return;
                }

                if (!map.isDefine) {
                    reqCalls.push(mod);
                }

                if (!mod.error) {
                    //If the module should be executed, and it has not
                    //been inited and time is up, remember it.
                    if (!mod.inited && expired) {
                        if (hasPathFallback(modId)) {
                            usingPathFallback = true;
                            stillLoading = true;
                        } else {
                            noLoads.push(modId);
                            removeScript(modId);
                        }
                    } else if (!mod.inited && mod.fetched && map.isDefine) {
                        stillLoading = true;
                        if (!map.prefix) {
                            //No reason to keep looking for unfinished
                            //loading. If the only stillLoading is a
                            //plugin resource though, keep going,
                            //because it may be that a plugin resource
                            //is waiting on a non-plugin cycle.
                            return (needCycleCheck = false);
                        }
                    }
                }
            });

            if (expired && noLoads.length) {
                //If wait time expired, throw error of unloaded modules.
                err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
                err.contextName = context.contextName;
                return onError(err);
            }

            //Not expired, check for a cycle.
            if (needCycleCheck) {
                each(reqCalls, function (mod) {
                    breakCycle(mod, {}, {});
                });
            }

            //If still waiting on loads, and the waiting load is something
            //other than a plugin resource, or there are still outstanding
            //scripts, then just try back later.
            if ((!expired || usingPathFallback) && stillLoading) {
                //Something is still waiting to load. Wait for it, but only
                //if a timeout is not already in effect.
                if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
                    checkLoadedTimeoutId = setTimeout(function () {
                        checkLoadedTimeoutId = 0;
                        checkLoaded();
                    }, 50);
                }
            }

            inCheckLoaded = false;
        }

        Module = function (map) {
            this.events = getOwn(undefEvents, map.id) || {};
            this.map = map;
            this.shim = getOwn(config.shim, map.id);
            this.depExports = [];
            this.depMaps = [];
            this.depMatched = [];
            this.pluginMaps = {};
            this.depCount = 0;

            /* this.exports this.factory
               this.depMaps = [],
               this.enabled, this.fetched
            */
        };

        Module.prototype = {
            init: function (depMaps, factory, errback, options) {
                options = options || {};

                //Do not do more inits if already done. Can happen if there
                //are multiple define calls for the same module. That is not
                //a normal, common case, but it is also not unexpected.
                if (this.inited) {
                    return;
                }

                this.factory = factory;

                if (errback) {
                    //Register for errors on this module.
                    this.on('error', errback);
                } else if (this.events.error) {
                    //If no errback already, but there are error listeners
                    //on this module, set up an errback to pass to the deps.
                    errback = bind(this, function (err) {
                        this.emit('error', err);
                    });
                }

                //Do a copy of the dependency array, so that
                //source inputs are not modified. For example
                //"shim" deps are passed in here directly, and
                //doing a direct modification of the depMaps array
                //would affect that config.
                this.depMaps = depMaps && depMaps.slice(0);

                this.errback = errback;

                //Indicate this module has be initialized
                this.inited = true;

                this.ignore = options.ignore;

                //Could have option to init this module in enabled mode,
                //or could have been previously marked as enabled. However,
                //the dependencies are not known until init is called. So
                //if enabled previously, now trigger dependencies as enabled.
                if (options.enabled || this.enabled) {
                    //Enable this module and dependencies.
                    //Will call this.check()
                    this.enable();
                } else {
                    this.check();
                }
            },

            defineDep: function (i, depExports) {
                //Because of cycles, defined callback for a given
                //export can be called more than once.
                if (!this.depMatched[i]) {
                    this.depMatched[i] = true;
                    this.depCount -= 1;
                    this.depExports[i] = depExports;
                }
            },

            fetch: function () {
                if (this.fetched) {
                    return;
                }
                this.fetched = true;

                context.startTime = (new Date()).getTime();

                var map = this.map;

                //If the manager is for a plugin managed resource,
                //ask the plugin to load it now.
                if (this.shim) {
                    context.makeRequire(this.map, {
                        enableBuildCallback: true
                    })(this.shim.deps || [], bind(this, function () {
                        return map.prefix ? this.callPlugin() : this.load();
                    }));
                } else {
                    //Regular dependency.
                    return map.prefix ? this.callPlugin() : this.load();
                }
            },

            load: function () {
                var url = this.map.url;

                //Regular dependency.
                if (!urlFetched[url]) {
                    urlFetched[url] = true;
                    context.load(this.map.id, url);
                }
            },

            /**
             * Checks if the module is ready to define itself, and if so,
             * define it.
             */
            check: function () {
                if (!this.enabled || this.enabling) {
                    return;
                }

                var err, cjsModule,
                    id = this.map.id,
                    depExports = this.depExports,
                    exports = this.exports,
                    factory = this.factory;

                if (!this.inited) {
                    // Only fetch if not already in the defQueue.
                    if (!hasProp(context.defQueueMap, id)) {
                        this.fetch();
                    }
                } else if (this.error) {
                    this.emit('error', this.error);
                } else if (!this.defining) {
                    //The factory could trigger another require call
                    //that would result in checking this module to
                    //define itself again. If already in the process
                    //of doing that, skip this work.
                    this.defining = true;

                    if (this.depCount < 1 && !this.defined) {
                        if (isFunction(factory)) {
                            //If there is an error listener, favor passing
                            //to that instead of throwing an error. However,
                            //only do it for define()'d  modules. require
                            //errbacks should not be called for failures in
                            //their callbacks (#699). However if a global
                            //onError is set, use that.
                            if ((this.events.error && this.map.isDefine) ||
                                req.onError !== defaultOnError) {
                                try {
                                    exports = context.execCb(id, factory, depExports, exports);
                                } catch (e) {
                                    err = e;
                                }
                            } else {
                                exports = context.execCb(id, factory, depExports, exports);
                            }

                            // Favor return value over exports. If node/cjs in play,
                            // then will not have a return value anyway. Favor
                            // module.exports assignment over exports object.
                            if (this.map.isDefine && exports === undefined) {
                                cjsModule = this.module;
                                if (cjsModule) {
                                    exports = cjsModule.exports;
                                } else if (this.usingExports) {
                                    //exports already set the defined value.
                                    exports = this.exports;
                                }
                            }

                            if (err) {
                                err.requireMap = this.map;
                                err.requireModules = this.map.isDefine ? [this.map.id] : null;
                                err.requireType = this.map.isDefine ? 'define' : 'require';
                                return onError((this.error = err));
                            }

                        } else {
                            //Just a literal value
                            exports = factory;
                        }

                        this.exports = exports;

                        if (this.map.isDefine && !this.ignore) {
                            defined[id] = exports;

                            if (req.onResourceLoad) {
                                var resLoadMaps = [];
                                each(this.depMaps, function (depMap) {
                                    resLoadMaps.push(depMap.normalizedMap || depMap);
                                });
                                req.onResourceLoad(context, this.map, resLoadMaps);
                            }
                        }

                        //Clean up
                        cleanRegistry(id);

                        this.defined = true;
                    }

                    //Finished the define stage. Allow calling check again
                    //to allow define notifications below in the case of a
                    //cycle.
                    this.defining = false;

                    if (this.defined && !this.defineEmitted) {
                        this.defineEmitted = true;
                        this.emit('defined', this.exports);
                        this.defineEmitComplete = true;
                    }

                }
            },

            callPlugin: function () {
                var map = this.map,
                    id = map.id,
                    //Map already normalized the prefix.
                    pluginMap = makeModuleMap(map.prefix);

                //Mark this as a dependency for this plugin, so it
                //can be traced for cycles.
                this.depMaps.push(pluginMap);

                on(pluginMap, 'defined', bind(this, function (plugin) {
                    var load, normalizedMap, normalizedMod,
                        bundleId = getOwn(bundlesMap, this.map.id),
                        name = this.map.name,
                        parentName = this.map.parentMap ? this.map.parentMap.name : null,
                        localRequire = context.makeRequire(map.parentMap, {
                            enableBuildCallback: true
                        });

                    //If current map is not normalized, wait for that
                    //normalized name to load instead of continuing.
                    if (this.map.unnormalized) {
                        //Normalize the ID if the plugin allows it.
                        if (plugin.normalize) {
                            name = plugin.normalize(name, function (name) {
                                return normalize(name, parentName, true);
                            }) || '';
                        }

                        //prefix and name should already be normalized, no need
                        //for applying map config again either.
                        normalizedMap = makeModuleMap(map.prefix + '!' + name,
                            this.map.parentMap,
                            true);
                        on(normalizedMap,
                            'defined', bind(this, function (value) {
                                this.map.normalizedMap = normalizedMap;
                                this.init([], function () { return value; }, null, {
                                    enabled: true,
                                    ignore: true
                                });
                            }));

                        normalizedMod = getOwn(registry, normalizedMap.id);
                        if (normalizedMod) {
                            //Mark this as a dependency for this plugin, so it
                            //can be traced for cycles.
                            this.depMaps.push(normalizedMap);

                            if (this.events.error) {
                                normalizedMod.on('error', bind(this, function (err) {
                                    this.emit('error', err);
                                }));
                            }
                            normalizedMod.enable();
                        }

                        return;
                    }

                    //If a paths config, then just load that file instead to
                    //resolve the plugin, as it is built into that paths layer.
                    if (bundleId) {
                        this.map.url = context.nameToUrl(bundleId);
                        this.load();
                        return;
                    }

                    load = bind(this, function (value) {
                        this.init([], function () { return value; }, null, {
                            enabled: true
                        });
                    });

                    load.error = bind(this, function (err) {
                        this.inited = true;
                        this.error = err;
                        err.requireModules = [id];

                        //Remove temp unnormalized modules for this module,
                        //since they will never be resolved otherwise now.
                        eachProp(registry, function (mod) {
                            if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
                                cleanRegistry(mod.map.id);
                            }
                        });

                        onError(err);
                    });

                    //Allow plugins to load other code without having to know the
                    //context or how to 'complete' the load.
                    load.fromText = bind(this, function (text, textAlt) {
                        /*jslint evil: true */
                        var moduleName = map.name,
                            moduleMap = makeModuleMap(moduleName),
                            hasInteractive = useInteractive;

                        //As of 2.1.0, support just passing the text, to reinforce
                        //fromText only being called once per resource. Still
                        //support old style of passing moduleName but discard
                        //that moduleName in favor of the internal ref.
                        if (textAlt) {
                            text = textAlt;
                        }

                        //Turn off interactive script matching for IE for any define
                        //calls in the text, then turn it back on at the end.
                        if (hasInteractive) {
                            useInteractive = false;
                        }

                        //Prime the system by creating a module instance for
                        //it.
                        getModule(moduleMap);

                        //Transfer any config to this other module.
                        if (hasProp(config.config, id)) {
                            config.config[moduleName] = config.config[id];
                        }

                        try {
                            req.exec(text);
                        } catch (e) {
                            return onError(makeError('fromtexteval',
                                'fromText eval for ' + id +
                                ' failed: ' + e,
                                e,
                                [id]));
                        }

                        if (hasInteractive) {
                            useInteractive = true;
                        }

                        //Mark this as a dependency for the plugin
                        //resource
                        this.depMaps.push(moduleMap);

                        //Support anonymous modules.
                        context.completeLoad(moduleName);

                        //Bind the value of that module to the value for this
                        //resource ID.
                        localRequire([moduleName], load);
                    });

                    //Use parentName here since the plugin's name is not reliable,
                    //could be some weird string with no path that actually wants to
                    //reference the parentName's path.
                    plugin.load(map.name, localRequire, load, config);
                }));

                context.enable(pluginMap, this);
                this.pluginMaps[pluginMap.id] = pluginMap;
            },

            enable: function () {
                enabledRegistry[this.map.id] = this;
                this.enabled = true;

                //Set flag mentioning that the module is enabling,
                //so that immediate calls to the defined callbacks
                //for dependencies do not trigger inadvertent load
                //with the depCount still being zero.
                this.enabling = true;

                //Enable each dependency
                each(this.depMaps, bind(this, function (depMap, i) {
                    var id, mod, handler;

                    if (typeof depMap === 'string') {
                        //Dependency needs to be converted to a depMap
                        //and wired up to this module.
                        depMap = makeModuleMap(depMap,
                            (this.map.isDefine ? this.map : this.map.parentMap),
                            false,
                            !this.skipMap);
                        this.depMaps[i] = depMap;

                        handler = getOwn(handlers, depMap.id);

                        if (handler) {
                            this.depExports[i] = handler(this);
                            return;
                        }

                        this.depCount += 1;

                        on(depMap, 'defined', bind(this, function (depExports) {
                            if (this.undefed) {
                                return;
                            }
                            this.defineDep(i, depExports);
                            this.check();
                        }));

                        if (this.errback) {
                            on(depMap, 'error', bind(this, this.errback));
                        } else if (this.events.error) {
                            // No direct errback on this module, but something
                            // else is listening for errors, so be sure to
                            // propagate the error correctly.
                            on(depMap, 'error', bind(this, function (err) {
                                this.emit('error', err);
                            }));
                        }
                    }

                    id = depMap.id;
                    mod = registry[id];

                    //Skip special modules like 'require', 'exports', 'module'
                    //Also, don't call enable if it is already enabled,
                    //important in circular dependency cases.
                    if (!hasProp(handlers, id) && mod && !mod.enabled) {
                        context.enable(depMap, this);
                    }
                }));

                //Enable each plugin that is used in
                //a dependency
                eachProp(this.pluginMaps, bind(this, function (pluginMap) {
                    var mod = getOwn(registry, pluginMap.id);
                    if (mod && !mod.enabled) {
                        context.enable(pluginMap, this);
                    }
                }));

                this.enabling = false;

                this.check();
            },

            on: function (name, cb) {
                var cbs = this.events[name];
                if (!cbs) {
                    cbs = this.events[name] = [];
                }
                cbs.push(cb);
            },

            emit: function (name, evt) {
                each(this.events[name], function (cb) {
                    cb(evt);
                });
                if (name === 'error') {
                    //Now that the error handler was triggered, remove
                    //the listeners, since this broken Module instance
                    //can stay around for a while in the registry.
                    delete this.events[name];
                }
            }
        };

        function callGetModule(args) {
            //Skip modules already defined.
            if (!hasProp(defined, args[0])) {
                getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
            }
        }

        function removeListener(node, func, name, ieName) {
            //Favor detachEvent because of IE9
            //issue, see attachEvent/addEventListener comment elsewhere
            //in this file.
            if (node.detachEvent && !isOpera) {
                //Probably IE. If not it will throw an error, which will be
                //useful to know.
                if (ieName) {
                    node.detachEvent(ieName, func);
                }
            } else {
                node.removeEventListener(name, func, false);
            }
        }

        /**
         * Given an event from a script node, get the requirejs info from it,
         * and then removes the event listeners on the node.
         * @param {Event} evt
         * @returns {Object}
         */
        function getScriptData(evt) {
            //Using currentTarget instead of target for Firefox 2.0's sake. Not
            //all old browsers will be supported, but this one was easy enough
            //to support and still makes sense.
            var node = evt.currentTarget || evt.srcElement;

            //Remove the listeners once here.
            removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
            removeListener(node, context.onScriptError, 'error');

            return {
                node: node,
                id: node && node.getAttribute('data-requiremodule')
            };
        }

        function intakeDefines() {
            var args;

            //Any defined modules in the global queue, intake them now.
            takeGlobalQueue();

            //Make sure any remaining defQueue items get properly processed.
            while (defQueue.length) {
                args = defQueue.shift();
                if (args[0] === null) {
                    return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' +
                        args[args.length - 1]));
                } else {
                    //args are id, deps, factory. Should be normalized by the
                    //define() function.
                    callGetModule(args);
                }
            }
            context.defQueueMap = {};
        }

        context = {
            config: config,
            contextName: contextName,
            registry: registry,
            defined: defined,
            urlFetched: urlFetched,
            defQueue: defQueue,
            defQueueMap: {},
            Module: Module,
            makeModuleMap: makeModuleMap,
            nextTick: req.nextTick,
            onError: onError,

            /**
             * Set a configuration for the context.
             * @param {Object} cfg config object to integrate.
             */
            configure: function (cfg) {
                //Make sure the baseUrl ends in a slash.
                if (cfg.baseUrl) {
                    if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
                        cfg.baseUrl += '/';
                    }
                }

                // Convert old style urlArgs string to a function.
                if (typeof cfg.urlArgs === 'string') {
                    var urlArgs = cfg.urlArgs;
                    cfg.urlArgs = function (id, url) {
                        return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;
                    };
                }

                //Save off the paths since they require special processing,
                //they are additive.
                var shim = config.shim,
                    objs = {
                        paths: true,
                        bundles: true,
                        config: true,
                        map: true
                    };

                eachProp(cfg, function (value, prop) {
                    if (objs[prop]) {
                        if (!config[prop]) {
                            config[prop] = {};
                        }
                        mixin(config[prop], value, true, true);
                    } else {
                        config[prop] = value;
                    }
                });

                //Reverse map the bundles
                if (cfg.bundles) {
                    eachProp(cfg.bundles, function (value, prop) {
                        each(value, function (v) {
                            if (v !== prop) {
                                bundlesMap[v] = prop;
                            }
                        });
                    });
                }

                //Merge shim
                if (cfg.shim) {
                    eachProp(cfg.shim, function (value, id) {
                        //Normalize the structure
                        if (isArray(value)) {
                            value = {
                                deps: value
                            };
                        }
                        if ((value.exports || value.init) && !value.exportsFn) {
                            value.exportsFn = context.makeShimExports(value);
                        }
                        shim[id] = value;
                    });
                    config.shim = shim;
                }

                //Adjust packages if necessary.
                if (cfg.packages) {
                    each(cfg.packages, function (pkgObj) {
                        var location, name;

                        pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;

                        name = pkgObj.name;
                        location = pkgObj.location;
                        if (location) {
                            config.paths[name] = pkgObj.location;
                        }

                        //Save pointer to main module ID for pkg name.
                        //Remove leading dot in main, so main paths are normalized,
                        //and remove any trailing .js, since different package
                        //envs have different conventions: some use a module name,
                        //some use a file name.
                        config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
                            .replace(currDirRegExp, '')
                            .replace(jsSuffixRegExp, '');
                    });
                }

                //If there are any "waiting to execute" modules in the registry,
                //update the maps for them, since their info, like URLs to load,
                //may have changed.
                eachProp(registry, function (mod, id) {
                    //If module already has init called, since it is too
                    //late to modify them, and ignore unnormalized ones
                    //since they are transient.
                    if (!mod.inited && !mod.map.unnormalized) {
                        mod.map = makeModuleMap(id, null, true);
                    }
                });

                //If a deps array or a config callback is specified, then call
                //require with those args. This is useful when require is defined as a
                //config object before require.js is loaded.
                if (cfg.deps || cfg.callback) {
                    context.require(cfg.deps || [], cfg.callback);
                }
            },

            makeShimExports: function (value) {
                function fn() {
                    var ret;
                    if (value.init) {
                        ret = value.init.apply(global, arguments);
                    }
                    return ret || (value.exports && getGlobal(value.exports));
                }
                return fn;
            },

            makeRequire: function (relMap, options) {
                options = options || {};

                function localRequire(deps, callback, errback) {
                    var id, map, requireMod;

                    if (options.enableBuildCallback && callback && isFunction(callback)) {
                        callback.__requireJsBuild = true;
                    }

                    if (typeof deps === 'string') {
                        if (isFunction(callback)) {
                            //Invalid call
                            return onError(makeError('requireargs', 'Invalid require call'), errback);
                        }

                        //If require|exports|module are requested, get the
                        //value for them from the special handlers. Caveat:
                        //this only works while module is being defined.
                        if (relMap && hasProp(handlers, deps)) {
                            return handlers[deps](registry[relMap.id]);
                        }

                        //Synchronous access to one module. If require.get is
                        //available (as in the Node adapter), prefer that.
                        if (req.get) {
                            return req.get(context, deps, relMap, localRequire);
                        }

                        //Normalize module name, if it contains . or ..
                        map = makeModuleMap(deps, relMap, false, true);
                        id = map.id;

                        if (!hasProp(defined, id)) {
                            return onError(makeError('notloaded', 'Module name "' +
                                id +
                                '" has not been loaded yet for context: ' +
                                contextName +
                                (relMap ? '' : '. Use require([])')));
                        }
                        return defined[id];
                    }

                    //Grab defines waiting in the global queue.
                    intakeDefines();

                    //Mark all the dependencies as needing to be loaded.
                    context.nextTick(function () {
                        //Some defines could have been added since the
                        //require call, collect them.
                        intakeDefines();

                        requireMod = getModule(makeModuleMap(null, relMap));

                        //Store if map config should be applied to this require
                        //call for dependencies.
                        requireMod.skipMap = options.skipMap;

                        requireMod.init(deps, callback, errback, {
                            enabled: true
                        });

                        checkLoaded();
                    });

                    return localRequire;
                }

                mixin(localRequire, {
                    isBrowser: isBrowser,

                    /**
                     * Converts a module name + .extension into an URL path.
                     * *Requires* the use of a module name. It does not support using
                     * plain URLs like nameToUrl.
                     */
                    toUrl: function (moduleNamePlusExt) {

                        //console.log("row 1484");
                        var ext,
                            index = moduleNamePlusExt.lastIndexOf('.'),
                            segment = moduleNamePlusExt.split('/')[0],
                            isRelative = segment === '.' || segment === '..';

                        //Have a file extension alias, and it is not the
                        //dots from a relative path.
                        if (index !== -1 && (!isRelative || index > 1)) {
                            ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
                            moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
                        }

                        return context.nameToUrl(normalize(moduleNamePlusExt,
                            relMap && relMap.id, true), ext, true);
                    },

                    defined: function (id) {
                        return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
                    },

                    specified: function (id) {
                        id = makeModuleMap(id, relMap, false, true).id;
                        return hasProp(defined, id) || hasProp(registry, id);
                    }
                });

                //Only allow undef on top level require calls
                if (!relMap) {
                    localRequire.undef = function (id) {
                        //Bind any waiting define() calls to this context,
                        //fix for #408
                        takeGlobalQueue();

                        var map = makeModuleMap(id, relMap, true),
                            mod = getOwn(registry, id);

                        mod.undefed = true;
                        removeScript(id);

                        delete defined[id];
                        delete urlFetched[map.url];
                        delete undefEvents[id];

                        //Clean queued defines too. Go backwards
                        //in array so that the splices do not
                        //mess up the iteration.
                        eachReverse(defQueue, function (args, i) {
                            if (args[0] === id) {
                                defQueue.splice(i, 1);
                            }
                        });
                        delete context.defQueueMap[id];

                        if (mod) {
                            //Hold on to listeners in case the
                            //module will be attempted to be reloaded
                            //using a different config.
                            if (mod.events.defined) {
                                undefEvents[id] = mod.events;
                            }

                            cleanRegistry(id);
                        }
                    };
                }

                return localRequire;
            },

            /**
             * Called to enable a module if it is still in the registry
             * awaiting enablement. A second arg, parent, the parent module,
             * is passed in for context, when this method is overridden by
             * the optimizer. Not shown here to keep code compact.
             */
            enable: function (depMap) {
                var mod = getOwn(registry, depMap.id);
                if (mod) {
                    getModule(depMap).enable();
                }
            },

            /**
             * Internal method used by environment adapters to complete a load event.
             * A load event could be a script load or just a load pass from a synchronous
             * load call.
             * @param {String} moduleName the name of the module to potentially complete.
             */
            completeLoad: function (moduleName) {
                var found, args, mod,
                    shim = getOwn(config.shim, moduleName) || {},
                    shExports = shim.exports;

                takeGlobalQueue();

                while (defQueue.length) {
                    args = defQueue.shift();
                    if (args[0] === null) {
                        args[0] = moduleName;
                        //If already found an anonymous module and bound it
                        //to this name, then this is some other anon module
                        //waiting for its completeLoad to fire.
                        if (found) {
                            break;
                        }
                        found = true;
                    } else if (args[0] === moduleName) {
                        //Found matching define call for this script!
                        found = true;
                    }

                    callGetModule(args);
                }
                context.defQueueMap = {};

                //Do this after the cycle of callGetModule in case the result
                //of those calls/init calls changes the registry.
                mod = getOwn(registry, moduleName);

                if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
                    if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
                        if (hasPathFallback(moduleName)) {
                            return;
                        } else {
                            return onError(makeError('nodefine',
                                'No define call for ' + moduleName,
                                null,
                                [moduleName]));
                        }
                    } else {
                        //A script that does not call define(), so just simulate
                        //the call for it.
                        callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
                    }
                }

                checkLoaded();
            },

            /**
             * Converts a module name to a file path. Supports cases where
             * moduleName may actually be just an URL.
             * Note that it **does not** call normalize on the moduleName,
             * it is assumed to have already been normalized. This is an
             * internal API, not a public one. Use toUrl for the public API.
             */
            nameToUrl: function (moduleName, ext, skipExt) {
                var paths, syms, i, parentModule, url,
                    parentPath, bundleId,
                    pkgMain = getOwn(config.pkgs, moduleName);

                if (pkgMain) {
                    moduleName = pkgMain;
                }

                bundleId = getOwn(bundlesMap, moduleName);

                if (bundleId) {
                    return context.nameToUrl(bundleId, ext, skipExt);
                }

                //If a colon is in the URL, it indicates a protocol is used and it is just
                //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
                //or ends with .js, then assume the user meant to use an url and not a module id.
                //The slash is important for protocol-less URLs as well as full paths.
                if (req.jsExtRegExp.test(moduleName)) {
                    //Just a plain path, not module name lookup, so just return it.
                    //Add extension if it is included. This is a bit wonky, only non-.js things pass
                    //an extension, this method probably needs to be reworked.
                    url = moduleName + (ext || '');
                } else {
                    //A module that needs to be converted to a path.
                    paths = config.paths;
                    //console.log("row 1652");
                    syms = moduleName.split('/');
                    //For each module name segment, see if there is a path
                    //registered for it. Start with most specific name
                    //and work up from it.
                    for (i = syms.length; i > 0; i -= 1) {
                        parentModule = syms.slice(0, i).join('/');

                        parentPath = getOwn(paths, parentModule);
                        if (parentPath) {
                            //If an array, it means there are a few choices,
                            //Choose the one that is desired
                            if (isArray(parentPath)) {
                                parentPath = parentPath[0];
                            }
                            syms.splice(0, i, parentPath);
                            break;
                        }
                    }

                    //Join the path parts together, then figure out if baseUrl is needed.
                    url = syms.join('/');
                    url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js'));
                    url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
                }

                return config.urlArgs && !/^blob\:/.test(url) ?
                    url + config.urlArgs(moduleName, url) : url;
            },

            //Delegates to req.load. Broken out as a separate function to
            //allow overriding in the optimizer.
            load: function (id, url) {
                req.load(context, id, url);
            },

            /**
             * Executes a module callback function. Broken out as a separate function
             * solely to allow the build system to sequence the files in the built
             * layer in the right sequence.
             *
             * @private
             */
            execCb: function (name, callback, args, exports) {
                return callback.apply(exports, args);
            },

            /**
             * callback for script loads, used to check status of loading.
             *
             * @param {Event} evt the event from the browser for the script
             * that was loaded.
             */
            onScriptLoad: function (evt) {
                //Using currentTarget instead of target for Firefox 2.0's sake. Not
                //all old browsers will be supported, but this one was easy enough
                //to support and still makes sense.
                if (evt.type === 'load' ||
                    (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
                    //Reset interactive script so a script node is not held onto for
                    //to long.
                    interactiveScript = null;

                    //Pull out the name of the module and the context.
                    var data = getScriptData(evt);
                    context.completeLoad(data.id);
                }
            },

            /**
             * Callback for script errors.
             */
            onScriptError: function (evt) {
                var data = getScriptData(evt);
                if (!hasPathFallback(data.id)) {
                    var parents = [];
                    eachProp(registry, function (value, key) {
                        if (key.indexOf('_@r') !== 0) {
                            each(value.depMaps, function (depMap) {
                                if (depMap.id === data.id) {
                                    parents.push(key);
                                    return true;
                                }
                            });
                        }
                    });
                    return onError(makeError('scripterror', 'Script error for "' + data.id +
                        (parents.length ?
                            '", needed by: ' + parents.join(', ') :
                            '"'), evt, [data.id]));
                }
            }
        };

        context.require = context.makeRequire();
        return context;
    }

    /**
     * Main entry point.
     *
     * If the only argument to require is a string, then the module that
     * is represented by that string is fetched for the appropriate context.
     *
     * If the first argument is an array, then it will be treated as an array
     * of dependency string names to fetch. An optional function callback can
     * be specified to execute when all of those dependencies are available.
     *
     * Make a local req variable to help Caja compliance (it assumes things
     * on a require that are not standardized), and to give a short
     * name for minification/local scope use.
     */
    req = requirejs = function (deps, callback, errback, optional) {

        //Find the right context, use default
        var context, config,
            contextName = defContextName;

        // Determine if have config object in the call.
        if (!isArray(deps) && typeof deps !== 'string') {
            // deps is a config object
            config = deps;
            if (isArray(callback)) {
                // Adjust args if there are dependencies
                deps = callback;
                callback = errback;
                errback = optional;
            } else {
                deps = [];
            }
        }

        if (config && config.context) {
            contextName = config.context;
        }

        context = getOwn(contexts, contextName);
        if (!context) {
            context = contexts[contextName] = req.s.newContext(contextName);
        }

        if (config) {
            context.configure(config);
        }

        return context.require(deps, callback, errback);
    };

    /**
     * Support require.config() to make it easier to cooperate with other
     * AMD loaders on globally agreed names.
     */
    req.config = function (config) {
        return req(config);
    };

    /**
     * Execute something after the current tick
     * of the event loop. Override for other envs
     * that have a better solution than setTimeout.
     * @param  {Function} fn function to execute later.
     */
    req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
        setTimeout(fn, 4);
    } : function (fn) { fn(); };

    /**
     * Export require as a global, but only if it does not already exist.
     */
    if (!require) {
        require = req;
    }

    req.version = version;

    //Used to filter out dependencies that are already paths.
    req.jsExtRegExp = /^\/|:|\?|\.js$/;
    req.isBrowser = isBrowser;
    s = req.s = {
        contexts: contexts,
        newContext: newContext
    };

    //Create default context.
    req({});

    //Exports some context-sensitive methods on global require.
    each([
        'toUrl',
        'undef',
        'defined',
        'specified'
    ], function (prop) {
        //Reference from contexts instead of early binding to default context,
        //so that during builds, the latest instance of the default context
        //with its config gets used.
        req[prop] = function () {
            var ctx = contexts[defContextName];
            return ctx.require[prop].apply(ctx, arguments);
        };
    });

    if (isBrowser) {
        head = s.head = document.getElementsByTagName('head')[0];
        //If BASE tag is in play, using appendChild is a problem for IE6.
        //When that browser dies, this can be removed. Details in this jQuery bug:
        //http://dev.jquery.com/ticket/2709
        baseElement = document.getElementsByTagName('base')[0];
        if (baseElement) {
            head = s.head = baseElement.parentNode;
        }
    }

    /**
     * Any errors that require explicitly generates will be passed to this
     * function. Intercept/override it if you want custom error handling.
     * @param {Error} err the error object.
     */
    req.onError = defaultOnError;

    /**
     * Creates the node for the load command. Only used in browser envs.
     */
    req.createNode = function (config, moduleName, url) {
        var node = config.xhtml ?
            document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
            document.createElement('script');
        node.type = config.scriptType || 'text/javascript';
        node.charset = 'utf-8';
        node.async = true;
        return node;
    };

    /**
     * Does the request to load a module for the browser case.
     * Make this a separate function to allow other environments
     * to override it.
     *
     * @param {Object} context the require context to find state.
     * @param {String} moduleName the name of the module.
     * @param {Object} url the URL to the module.
     */
    req.load = function (context, moduleName, url) {
        var config = (context && context.config) || {},
            node;
        if (isBrowser) {
            //In the browser so use a script tag
            node = req.createNode(config, moduleName, url);

            node.setAttribute('data-requirecontext', context.contextName);
            node.setAttribute('data-requiremodule', moduleName);

            //Set up load listener. Test attachEvent first because IE9 has
            //a subtle issue in its addEventListener and script onload firings
            //that do not match the behavior of all other browsers with
            //addEventListener support, which fire the onload event for a
            //script right after the script execution. See:
            //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
            //UNFORTUNATELY Opera implements attachEvent but does not follow the script
            //script execution mode.
            if (node.attachEvent &&
                //Check if node.attachEvent is artificially added by custom script or
                //natively supported by browser
                //read https://github.com/requirejs/requirejs/issues/187
                //if we can NOT find [native code] then it must NOT natively supported.
                //in IE8, node.attachEvent does not have toString()
                //Note the test for "[native code" with no closing brace, see:
                //https://github.com/requirejs/requirejs/issues/273
                !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
                !isOpera) {
                //Probably IE. IE (at least 6-8) do not fire
                //script onload right after executing the script, so
                //we cannot tie the anonymous define call to a name.
                //However, IE reports the script as being in 'interactive'
                //readyState at the time of the define call.
                useInteractive = true;

                node.attachEvent('onreadystatechange', context.onScriptLoad);
                //It would be great to add an error handler here to catch
                //404s in IE9+. However, onreadystatechange will fire before
                //the error handler, so that does not help. If addEventListener
                //is used, then IE will fire error before load, but we cannot
                //use that pathway given the connect.microsoft.com issue
                //mentioned above about not doing the 'script execute,
                //then fire the script load event listener before execute
                //next script' that other browsers do.
                //Best hope: IE10 fixes the issues,
                //and then destroys all installs of IE 6-9.
                //node.attachEvent('onerror', context.onScriptError);
            } else {
                node.addEventListener('load', context.onScriptLoad, false);
                node.addEventListener('error', context.onScriptError, false);
            }
            node.src = url;

            //Calling onNodeCreated after all properties on the node have been
            //set, but before it is placed in the DOM.
            if (config.onNodeCreated) {
                config.onNodeCreated(node, config, moduleName, url);
            }

            //For some cache cases in IE 6-8, the script executes before the end
            //of the appendChild execution, so to tie an anonymous define
            //call to the module name (which is stored on the node), hold on
            //to a reference to this node, but clear after the DOM insertion.
            currentlyAddingScript = node;
            if (baseElement) {
                head.insertBefore(node, baseElement);
            } else {
                head.appendChild(node);
            }
            currentlyAddingScript = null;

            return node;
        } else if (isWebWorker) {
            try {
                //In a web worker, use importScripts. This is not a very
                //efficient use of importScripts, importScripts will block until
                //its script is downloaded and evaluated. However, if web workers
                //are in play, the expectation is that a build has been done so
                //that only one script needs to be loaded anyway. This may need
                //to be reevaluated if other use cases become common.

                // Post a task to the event loop to work around a bug in WebKit
                // where the worker gets garbage-collected after calling
                // importScripts(): https://webkit.org/b/153317
                setTimeout(function () { }, 0);
                importScripts(url);

                //Account for anonymous modules
                context.completeLoad(moduleName);
            } catch (e) {
                context.onError(makeError('importscripts',
                    'importScripts failed for ' +
                    moduleName + ' at ' + url,
                    e,
                    [moduleName]));
            }
        }
    };

    function getInteractiveScript() {
        if (interactiveScript && interactiveScript.readyState === 'interactive') {
            return interactiveScript;
        }

        eachReverse(scripts(), function (script) {
            if (script.readyState === 'interactive') {
                return (interactiveScript = script);
            }
        });
        return interactiveScript;
    }

    //Look for a data-main script attribute, which could also adjust the baseUrl.
    if (isBrowser && !cfg.skipDataMain) {
        //Figure out baseUrl. Get it from the script tag with require.js in it.
        eachReverse(scripts(), function (script) {
            //Set the 'head' where we can append children by
            //using the script's parent.
            if (!head) {
                head = script.parentNode;
            }

            //Look for a data-main attribute to set main script for the page
            //to load. If it is there, the path to data main becomes the
            //baseUrl, if it is not already set.
            dataMain = script.getAttribute('data-main');
            if (dataMain) {
                //Preserve dataMain in case it is a path (i.e. contains '?')
                mainScript = dataMain;

                //Set final baseUrl if there is not already an explicit one,
                //but only do so if the data-main value is not a loader plugin
                //module ID.
                if (!cfg.baseUrl && mainScript.indexOf('!') === -1) {
                    //Pull off the directory of data-main for use as the
                    //baseUrl.
                    //console.log("row 2030");
                    src = mainScript.split('/');
                    mainScript = src.pop();
                    subPath = src.length ? src.join('/') + '/' : './';

                    cfg.baseUrl = subPath;
                }

                //Strip off any trailing .js since mainScript is now
                //like a module name.
                mainScript = mainScript.replace(jsSuffixRegExp, '');

                //If mainScript is still a path, fall back to dataMain
                if (req.jsExtRegExp.test(mainScript)) {
                    mainScript = dataMain;
                }

                //Put the data-main script in the files to load.
                cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];

                return true;
            }
        });
    }

    /**
     * The function that handles definitions of modules. Differs from
     * require() in that a string for the module should be the first argument,
     * and the function to execute after dependencies are loaded should
     * return a value to define the module corresponding to the first argument's
     * name.
     */
    define = function (name, deps, callback) {
        var node, context;

        //Allow for anonymous modules
        if (typeof name !== 'string') {
            //Adjust args appropriately
            callback = deps;
            deps = name;
            name = null;
        }

        //This module may not have dependencies
        if (!isArray(deps)) {
            callback = deps;
            deps = null;
        }

        //If no name, and callback is a function, then figure out if it a
        //CommonJS thing with dependencies.
        if (!deps && isFunction(callback)) {
            deps = [];
            //Remove comments from the callback string,
            //look for require calls, and pull them into the dependencies,
            //but only if there are function args.
            if (callback.length) {
                callback
                    .toString()
                    .replace(commentRegExp, commentReplace)
                    .replace(cjsRequireRegExp, function (match, dep) {
                        deps.push(dep);
                    });

                //May be a CommonJS thing even without require calls, but still
                //could use exports, and module. Avoid doing exports and module
                //work though if it just needs require.
                //REQUIRES the function to expect the CommonJS variables in the
                //order listed below.
                deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
            }
        }

        //If in IE 6-8 and hit an anonymous define() call, do the interactive
        //work.
        if (useInteractive) {
            node = currentlyAddingScript || getInteractiveScript();
            if (node) {
                if (!name) {
                    name = node.getAttribute('data-requiremodule');
                }
                context = contexts[node.getAttribute('data-requirecontext')];
            }
        }

        //Always save off evaluating the def call until the script onload handler.
        //This allows multiple modules to be in a file without prematurely
        //tracing dependencies, and allows for anonymous module support,
        //where the module name is not known until the script onload event
        //occurs. If no context, use the global queue, and get it processed
        //in the onscript load callback.
        if (context) {
            context.defQueue.push([name, deps, callback]);
            context.defQueueMap[name] = true;
        } else {
            globalDefQueue.push([name, deps, callback]);
        }
    };

    define.amd = {
        jQuery: true
    };

    /**
     * Executes the text. Normally just uses eval, but can be modified
     * to use a better, environment-specific call. Only used for transpiling
     * loader plugins, not for plain JS modules.
     * @param {String} text the text to execute/evaluate.
     */
    req.exec = function (text) {
        /*jslint evil: true */
        return eval(text);
    };

    //Set up with config info.
    req(cfg);
}(this, (typeof setTimeout === 'undefined' ? undefined : setTimeout)));
;
require.config({
    baseUrl: '/includes/js',   
    paths: {
        // the left side is the module ID,
        // the right side is the path to
        // the jQuery file, relative to baseUrl.
        // Also, the path should NOT include
        // the '.js' file extension.
        jquery: ['Vendor/jquery-3-5-1.min'],
        underscore: ['Vendor/underscore-min'],
        magnificPopup: "Core/magnificPopup",
        popper: ["Vendor/popper"],
        bootstrap: ["Vendor/bootstrap.bundle.min"],
        "datatables.net": ["Vendor/jquery.dataTables.min"],
        "datatables.net-bs": ["Vendor/dataTables.bootstrap4.min"],
        "datatables.net-bs4": ["Vendor/dataTables.bootstrap4.min"],
        "datatables.net-responsive": ["Vendor/dataTables.responsive.min"],
        "datatables.net-responsive-bs": ["Vendor/responsive.bootstrap.min"],
        "datatables.net-fixedHeader": ["Vendor/dataTables.fixedHeader.min"],
        "datatables.net-fixedHeader-bs4": ["Vendor/fixedHeader.bootstrap4.min"],
        dataTableFinnish: "Core/dataTableFinnish",
        swipe: "Core/jqueryTouchSwipe",
        stick_in_parent: "Vendor/jquery.sticky-kit.min",
        slick: "Vendor/slick-1-7-1",
    },
    shim: {		
		"datatables.net": ['jquery'],
        stick_in_parent: ['jquery'],
        swipe: ['jquery'],
        bootstrap: ["jquery"]
    },
    waitSeconds: 0,
    optimize: "uglify2",
    urlArgs: "v=20230619v1"
});

// Need to add your own compile typescript file? Just add it here as the first item of this array.
let jsFiles = [
    "./Core/adminToolbar",
    "./Core/dataTableFinnish",
    "./Customer/solu-MOSAIC",
    "./Customer/solu-modals",
    "./Customer/solu-shoppingcart",
    "./Customer/solu-carousels",
    "./Customer/solu-images",
    "./Customer/product-page-filter",
    "./Customer/e21-custom-autocomplete",
    "./Customer/YoutubeVideo",
    "./Customer/components",
	"./Customer/utils",
    "./Customer/dealer-page"
];

requirejs(jsFiles);
;
"use strict";

window.E21 = window.E21 || {};
window.E21.SurveyPal = {
	setCookie: function (name, value, options = {}) {

		options = {
			path: '/',
			SameSite: 'Lax',
			// add other defaults here if necessary
			...options
		};

		if (options.expires instanceof Date) {
			options.expires = options.expires.toUTCString();
		}

		var updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);

		for (var optionKey in options) {
			if (Object.prototype.hasOwnProperty.call(options, optionKey)) {
				updatedCookie += "; " + optionKey;
				var optionValue = options[optionKey];
				if (optionValue !== true) {
					updatedCookie += "=" + optionValue;
				}
			}
		}

		document.cookie = updatedCookie;
	},
	closeParentElement: function (elem) {
		elem.parentNode.style.display = 'none';
	},
	getExpirationDate: function() {
		var now = new Date();
		now.setMonth(now.getMonth() + 6);

		return now;
	}
};
(function () {
  'use strict';

  /*!
   * Vue.js v2.6.12
   * (c) 2014-2020 Evan You
   * Released under the MIT License.
   */

  /*  */
  var emptyObject = Object.freeze({}); // These helpers produce better VM code in JS engines due to their
  // explicitness and function inlining.

  function isUndef(v) {
    return v === undefined || v === null;
  }

  function isDef(v) {
    return v !== undefined && v !== null;
  }

  function isTrue(v) {
    return v === true;
  }

  function isFalse(v) {
    return v === false;
  }
  /**
   * Check if value is primitive.
   */


  function isPrimitive(value) {
    return typeof value === 'string' || typeof value === 'number' || // $flow-disable-line
    typeof value === 'symbol' || typeof value === 'boolean';
  }
  /**
   * Quick object check - this is primarily used to tell
   * Objects from primitive values when we know the value
   * is a JSON-compliant type.
   */


  function isObject(obj) {
    return obj !== null && typeof obj === 'object';
  }
  /**
   * Get the raw type string of a value, e.g., [object Object].
   */


  var _toString = Object.prototype.toString;

  function toRawType(value) {
    return _toString.call(value).slice(8, -1);
  }
  /**
   * Strict object type check. Only returns true
   * for plain JavaScript objects.
   */


  function isPlainObject(obj) {
    return _toString.call(obj) === '[object Object]';
  }

  function isRegExp(v) {
    return _toString.call(v) === '[object RegExp]';
  }
  /**
   * Check if val is a valid array index.
   */


  function isValidArrayIndex(val) {
    var n = parseFloat(String(val));
    return n >= 0 && Math.floor(n) === n && isFinite(val);
  }

  function isPromise(val) {
    return isDef(val) && typeof val.then === 'function' && typeof val.catch === 'function';
  }
  /**
   * Convert a value to a string that is actually rendered.
   */


  function toString(val) {
    return val == null ? '' : Array.isArray(val) || isPlainObject(val) && val.toString === _toString ? JSON.stringify(val, null, 2) : String(val);
  }
  /**
   * Convert an input value to a number for persistence.
   * If the conversion fails, return original string.
   */


  function toNumber(val) {
    var n = parseFloat(val);
    return isNaN(n) ? val : n;
  }
  /**
   * Make a map and return a function for checking if a key
   * is in that map.
   */


  function makeMap(str, expectsLowerCase) {
    var map = Object.create(null);
    var list = str.split(',');

    for (var i = 0; i < list.length; i++) {
      map[list[i]] = true;
    }

    return expectsLowerCase ? function (val) {
      return map[val.toLowerCase()];
    } : function (val) {
      return map[val];
    };
  }
  /**
   * Check if a tag is a built-in tag.
   */


  var isBuiltInTag = makeMap('slot,component', true);
  /**
   * Check if an attribute is a reserved attribute.
   */

  var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  /**
   * Remove an item from an array.
   */

  function remove(arr, item) {
    if (arr.length) {
      var index = arr.indexOf(item);

      if (index > -1) {
        return arr.splice(index, 1);
      }
    }
  }
  /**
   * Check whether an object has the property.
   */


  var hasOwnProperty = Object.prototype.hasOwnProperty;

  function hasOwn(obj, key) {
    return hasOwnProperty.call(obj, key);
  }
  /**
   * Create a cached version of a pure function.
   */


  function cached(fn) {
    var cache = Object.create(null);
    return function cachedFn(str) {
      var hit = cache[str];
      return hit || (cache[str] = fn(str));
    };
  }
  /**
   * Camelize a hyphen-delimited string.
   */


  var camelizeRE = /-(\w)/g;
  var camelize = cached(function (str) {
    return str.replace(camelizeRE, function (_, c) {
      return c ? c.toUpperCase() : '';
    });
  });
  /**
   * Capitalize a string.
   */

  var capitalize = cached(function (str) {
    return str.charAt(0).toUpperCase() + str.slice(1);
  });
  /**
   * Hyphenate a camelCase string.
   */

  var hyphenateRE = /\B([A-Z])/g;
  var hyphenate = cached(function (str) {
    return str.replace(hyphenateRE, '-$1').toLowerCase();
  });
  /**
   * Simple bind polyfill for environments that do not support it,
   * e.g., PhantomJS 1.x. Technically, we don't need this anymore
   * since native bind is now performant enough in most browsers.
   * But removing it would mean breaking code that was able to run in
   * PhantomJS 1.x, so this must be kept for backward compatibility.
   */

  /* istanbul ignore next */

  function polyfillBind(fn, ctx) {
    function boundFn(a) {
      var l = arguments.length;
      return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
    }

    boundFn._length = fn.length;
    return boundFn;
  }

  function nativeBind(fn, ctx) {
    return fn.bind(ctx);
  }

  var bind = Function.prototype.bind ? nativeBind : polyfillBind;
  /**
   * Convert an Array-like object to a real Array.
   */

  function toArray(list, start) {
    start = start || 0;
    var i = list.length - start;
    var ret = new Array(i);

    while (i--) {
      ret[i] = list[i + start];
    }

    return ret;
  }
  /**
   * Mix properties into target object.
   */


  function extend(to, _from) {
    for (var key in _from) {
      to[key] = _from[key];
    }

    return to;
  }
  /**
   * Merge an Array of Objects into a single Object.
   */


  function toObject(arr) {
    var res = {};

    for (var i = 0; i < arr.length; i++) {
      if (arr[i]) {
        extend(res, arr[i]);
      }
    }

    return res;
  }
  /* eslint-disable no-unused-vars */

  /**
   * Perform no operation.
   * Stubbing args to make Flow happy without leaving useless transpiled code
   * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
   */


  function noop(a, b, c) {}
  /**
   * Always return false.
   */


  var no = function (a, b, c) {
    return false;
  };
  /* eslint-enable no-unused-vars */

  /**
   * Return the same value.
   */


  var identity = function (_) {
    return _;
  };
  /**
   * Check if two values are loosely equal - that is,
   * if they are plain objects, do they have the same shape?
   */


  function looseEqual(a, b) {
    if (a === b) {
      return true;
    }

    var isObjectA = isObject(a);
    var isObjectB = isObject(b);

    if (isObjectA && isObjectB) {
      try {
        var isArrayA = Array.isArray(a);
        var isArrayB = Array.isArray(b);

        if (isArrayA && isArrayB) {
          return a.length === b.length && a.every(function (e, i) {
            return looseEqual(e, b[i]);
          });
        } else if (a instanceof Date && b instanceof Date) {
          return a.getTime() === b.getTime();
        } else if (!isArrayA && !isArrayB) {
          var keysA = Object.keys(a);
          var keysB = Object.keys(b);
          return keysA.length === keysB.length && keysA.every(function (key) {
            return looseEqual(a[key], b[key]);
          });
        } else {
          /* istanbul ignore next */
          return false;
        }
      } catch (e) {
        /* istanbul ignore next */
        return false;
      }
    } else if (!isObjectA && !isObjectB) {
      return String(a) === String(b);
    } else {
      return false;
    }
  }
  /**
   * Return the first index at which a loosely equal value can be
   * found in the array (if value is a plain object, the array must
   * contain an object of the same shape), or -1 if it is not present.
   */


  function looseIndexOf(arr, val) {
    for (var i = 0; i < arr.length; i++) {
      if (looseEqual(arr[i], val)) {
        return i;
      }
    }

    return -1;
  }
  /**
   * Ensure a function is called only once.
   */


  function once(fn) {
    var called = false;
    return function () {
      if (!called) {
        called = true;
        fn.apply(this, arguments);
      }
    };
  }

  var SSR_ATTR = 'data-server-rendered';
  var ASSET_TYPES = ['component', 'directive', 'filter'];
  var LIFECYCLE_HOOKS = ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'activated', 'deactivated', 'errorCaptured', 'serverPrefetch'];
  /*  */

  var config = {
    /**
     * Option merge strategies (used in core/util/options)
     */
    // $flow-disable-line
    optionMergeStrategies: Object.create(null),

    /**
     * Whether to suppress warnings.
     */
    silent: false,

    /**
     * Show production mode tip message on boot?
     */
    productionTip: "production" !== 'production',

    /**
     * Whether to enable devtools
     */
    devtools: "production" !== 'production',

    /**
     * Whether to record perf
     */
    performance: false,

    /**
     * Error handler for watcher errors
     */
    errorHandler: null,

    /**
     * Warn handler for watcher warns
     */
    warnHandler: null,

    /**
     * Ignore certain custom elements
     */
    ignoredElements: [],

    /**
     * Custom user key aliases for v-on
     */
    // $flow-disable-line
    keyCodes: Object.create(null),

    /**
     * Check if a tag is reserved so that it cannot be registered as a
     * component. This is platform-dependent and may be overwritten.
     */
    isReservedTag: no,

    /**
     * Check if an attribute is reserved so that it cannot be used as a component
     * prop. This is platform-dependent and may be overwritten.
     */
    isReservedAttr: no,

    /**
     * Check if a tag is an unknown element.
     * Platform-dependent.
     */
    isUnknownElement: no,

    /**
     * Get the namespace of an element
     */
    getTagNamespace: noop,

    /**
     * Parse the real tag name for the specific platform.
     */
    parsePlatformTagName: identity,

    /**
     * Check if an attribute must be bound using property, e.g. value
     * Platform-dependent.
     */
    mustUseProp: no,

    /**
     * Perform updates asynchronously. Intended to be used by Vue Test Utils
     * This will significantly reduce performance if set to false.
     */
    async: true,

    /**
     * Exposed for legacy reasons
     */
    _lifecycleHooks: LIFECYCLE_HOOKS
  };
  /*  */

  /**
   * unicode letters used for parsing html tags, component names and property paths.
   * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
   * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
   */

  var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  /**
   * Check if a string starts with $ or _
   */

  function isReserved(str) {
    var c = (str + '').charCodeAt(0);
    return c === 0x24 || c === 0x5F;
  }
  /**
   * Define a property.
   */


  function def(obj, key, val, enumerable) {
    Object.defineProperty(obj, key, {
      value: val,
      enumerable: !!enumerable,
      writable: true,
      configurable: true
    });
  }
  /**
   * Parse simple path.
   */


  var bailRE = new RegExp("[^" + unicodeRegExp.source + ".$_\\d]");

  function parsePath(path) {
    if (bailRE.test(path)) {
      return;
    }

    var segments = path.split('.');
    return function (obj) {
      for (var i = 0; i < segments.length; i++) {
        if (!obj) {
          return;
        }

        obj = obj[segments[i]];
      }

      return obj;
    };
  }
  /*  */
  // can we use __proto__?


  var hasProto = ('__proto__' in {}); // Browser environment sniffing

  var inBrowser = typeof window !== 'undefined';
  var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  var isIE = UA && /msie|trident/.test(UA);
  var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  var isEdge = UA && UA.indexOf('edge/') > 0;
  var isAndroid = UA && UA.indexOf('android') > 0 || weexPlatform === 'android';
  var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA) || weexPlatform === 'ios';
  var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  var isPhantomJS = UA && /phantomjs/.test(UA);
  var isFF = UA && UA.match(/firefox\/(\d+)/); // Firefox has a "watch" function on Object.prototype...

  var nativeWatch = {}.watch;
  var supportsPassive = false;

  if (inBrowser) {
    try {
      var opts = {};
      Object.defineProperty(opts, 'passive', {
        get: function get() {
          /* istanbul ignore next */
          supportsPassive = true;
        }
      }); // https://github.com/facebook/flow/issues/285

      window.addEventListener('test-passive', null, opts);
    } catch (e) {}
  } // this needs to be lazy-evaled because vue may be required before
  // vue-server-renderer can set VUE_ENV


  var _isServer;

  var isServerRendering = function () {
    if (_isServer === undefined) {
      /* istanbul ignore if */
      if (!inBrowser && !inWeex && typeof global !== 'undefined') {
        // detect presence of vue-server-renderer and avoid
        // Webpack shimming the process
        _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
      } else {
        _isServer = false;
      }
    }

    return _isServer;
  }; // detect devtools


  var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  /* istanbul ignore next */

  function isNative(Ctor) {
    return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
  }

  var hasSymbol = typeof Symbol !== 'undefined' && isNative(Symbol) && typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);

  var _Set;
  /* istanbul ignore if */
  // $flow-disable-line


  if (typeof Set !== 'undefined' && isNative(Set)) {
    // use native Set when available.
    _Set = Set;
  } else {
    // a non-standard Set polyfill that only works with primitive keys.
    _Set = /*@__PURE__*/function () {
      function Set() {
        this.set = Object.create(null);
      }

      Set.prototype.has = function has(key) {
        return this.set[key] === true;
      };

      Set.prototype.add = function add(key) {
        this.set[key] = true;
      };

      Set.prototype.clear = function clear() {
        this.set = Object.create(null);
      };

      return Set;
    }();
  }
  /*  */


  var warn = noop;
  /*  */


  var uid = 0;
  /**
   * A dep is an observable that can have multiple
   * directives subscribing to it.
   */

  var Dep = function Dep() {
    this.id = uid++;
    this.subs = [];
  };

  Dep.prototype.addSub = function addSub(sub) {
    this.subs.push(sub);
  };

  Dep.prototype.removeSub = function removeSub(sub) {
    remove(this.subs, sub);
  };

  Dep.prototype.depend = function depend() {
    if (Dep.target) {
      Dep.target.addDep(this);
    }
  };

  Dep.prototype.notify = function notify() {
    // stabilize the subscriber list first
    var subs = this.subs.slice();

    for (var i = 0, l = subs.length; i < l; i++) {
      subs[i].update();
    }
  }; // The current target watcher being evaluated.
  // This is globally unique because only one watcher
  // can be evaluated at a time.


  Dep.target = null;
  var targetStack = [];

  function pushTarget(target) {
    targetStack.push(target);
    Dep.target = target;
  }

  function popTarget() {
    targetStack.pop();
    Dep.target = targetStack[targetStack.length - 1];
  }
  /*  */


  var VNode = function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
    this.tag = tag;
    this.data = data;
    this.children = children;
    this.text = text;
    this.elm = elm;
    this.ns = undefined;
    this.context = context;
    this.fnContext = undefined;
    this.fnOptions = undefined;
    this.fnScopeId = undefined;
    this.key = data && data.key;
    this.componentOptions = componentOptions;
    this.componentInstance = undefined;
    this.parent = undefined;
    this.raw = false;
    this.isStatic = false;
    this.isRootInsert = true;
    this.isComment = false;
    this.isCloned = false;
    this.isOnce = false;
    this.asyncFactory = asyncFactory;
    this.asyncMeta = undefined;
    this.isAsyncPlaceholder = false;
  };

  var prototypeAccessors = {
    child: {
      configurable: true
    }
  }; // DEPRECATED: alias for componentInstance for backwards compat.

  /* istanbul ignore next */

  prototypeAccessors.child.get = function () {
    return this.componentInstance;
  };

  Object.defineProperties(VNode.prototype, prototypeAccessors);

  var createEmptyVNode = function (text) {
    if (text === void 0) text = '';
    var node = new VNode();
    node.text = text;
    node.isComment = true;
    return node;
  };

  function createTextVNode(val) {
    return new VNode(undefined, undefined, undefined, String(val));
  } // optimized shallow clone
  // used for static nodes and slot nodes because they may be reused across
  // multiple renders, cloning them avoids errors when DOM manipulations rely
  // on their elm reference.


  function cloneVNode(vnode) {
    var cloned = new VNode(vnode.tag, vnode.data, // #7975
    // clone children array to avoid mutating original in case of cloning
    // a child.
    vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
    cloned.ns = vnode.ns;
    cloned.isStatic = vnode.isStatic;
    cloned.key = vnode.key;
    cloned.isComment = vnode.isComment;
    cloned.fnContext = vnode.fnContext;
    cloned.fnOptions = vnode.fnOptions;
    cloned.fnScopeId = vnode.fnScopeId;
    cloned.asyncMeta = vnode.asyncMeta;
    cloned.isCloned = true;
    return cloned;
  }
  /*
   * not type checking this file because flow doesn't play well with
   * dynamically accessing methods on Array prototype
   */


  var arrayProto = Array.prototype;
  var arrayMethods = Object.create(arrayProto);
  var methodsToPatch = ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'];
  /**
   * Intercept mutating methods and emit events
   */

  methodsToPatch.forEach(function (method) {
    // cache original method
    var original = arrayProto[method];
    def(arrayMethods, method, function mutator() {
      var args = [],
          len = arguments.length;

      while (len--) args[len] = arguments[len];

      var result = original.apply(this, args);
      var ob = this.__ob__;
      var inserted;

      switch (method) {
        case 'push':
        case 'unshift':
          inserted = args;
          break;

        case 'splice':
          inserted = args.slice(2);
          break;
      }

      if (inserted) {
        ob.observeArray(inserted);
      } // notify change


      ob.dep.notify();
      return result;
    });
  });
  /*  */

  var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  /**
   * In some cases we may want to disable observation inside a component's
   * update computation.
   */

  var shouldObserve = true;

  function toggleObserving(value) {
    shouldObserve = value;
  }
  /**
   * Observer class that is attached to each observed
   * object. Once attached, the observer converts the target
   * object's property keys into getter/setters that
   * collect dependencies and dispatch updates.
   */


  var Observer = function Observer(value) {
    this.value = value;
    this.dep = new Dep();
    this.vmCount = 0;
    def(value, '__ob__', this);

    if (Array.isArray(value)) {
      if (hasProto) {
        protoAugment(value, arrayMethods);
      } else {
        copyAugment(value, arrayMethods, arrayKeys);
      }

      this.observeArray(value);
    } else {
      this.walk(value);
    }
  };
  /**
   * Walk through all properties and convert them into
   * getter/setters. This method should only be called when
   * value type is Object.
   */


  Observer.prototype.walk = function walk(obj) {
    var keys = Object.keys(obj);

    for (var i = 0; i < keys.length; i++) {
      defineReactive$$1(obj, keys[i]);
    }
  };
  /**
   * Observe a list of Array items.
   */


  Observer.prototype.observeArray = function observeArray(items) {
    for (var i = 0, l = items.length; i < l; i++) {
      observe(items[i]);
    }
  }; // helpers

  /**
   * Augment a target Object or Array by intercepting
   * the prototype chain using __proto__
   */


  function protoAugment(target, src) {
    /* eslint-disable no-proto */
    target.__proto__ = src;
    /* eslint-enable no-proto */
  }
  /**
   * Augment a target Object or Array by defining
   * hidden properties.
   */

  /* istanbul ignore next */


  function copyAugment(target, src, keys) {
    for (var i = 0, l = keys.length; i < l; i++) {
      var key = keys[i];
      def(target, key, src[key]);
    }
  }
  /**
   * Attempt to create an observer instance for a value,
   * returns the new observer if successfully observed,
   * or the existing observer if the value already has one.
   */


  function observe(value, asRootData) {
    if (!isObject(value) || value instanceof VNode) {
      return;
    }

    var ob;

    if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
      ob = value.__ob__;
    } else if (shouldObserve && !isServerRendering() && (Array.isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
      ob = new Observer(value);
    }

    if (asRootData && ob) {
      ob.vmCount++;
    }

    return ob;
  }
  /**
   * Define a reactive property on an Object.
   */


  function defineReactive$$1(obj, key, val, customSetter, shallow) {
    var dep = new Dep();
    var property = Object.getOwnPropertyDescriptor(obj, key);

    if (property && property.configurable === false) {
      return;
    } // cater for pre-defined getter/setters


    var getter = property && property.get;
    var setter = property && property.set;

    if ((!getter || setter) && arguments.length === 2) {
      val = obj[key];
    }

    var childOb = !shallow && observe(val);
    Object.defineProperty(obj, key, {
      enumerable: true,
      configurable: true,
      get: function reactiveGetter() {
        var value = getter ? getter.call(obj) : val;

        if (Dep.target) {
          dep.depend();

          if (childOb) {
            childOb.dep.depend();

            if (Array.isArray(value)) {
              dependArray(value);
            }
          }
        }

        return value;
      },
      set: function reactiveSetter(newVal) {
        var value = getter ? getter.call(obj) : val;
        /* eslint-disable no-self-compare */

        if (newVal === value || newVal !== newVal && value !== value) {
          return;
        }


        if (getter && !setter) {
          return;
        }

        if (setter) {
          setter.call(obj, newVal);
        } else {
          val = newVal;
        }

        childOb = !shallow && observe(newVal);
        dep.notify();
      }
    });
  }
  /**
   * Set a property on an object. Adds the new property and
   * triggers change notification if the property doesn't
   * already exist.
   */


  function set(target, key, val) {

    if (Array.isArray(target) && isValidArrayIndex(key)) {
      target.length = Math.max(target.length, key);
      target.splice(key, 1, val);
      return val;
    }

    if (key in target && !(key in Object.prototype)) {
      target[key] = val;
      return val;
    }

    var ob = target.__ob__;

    if (target._isVue || ob && ob.vmCount) {
      return val;
    }

    if (!ob) {
      target[key] = val;
      return val;
    }

    defineReactive$$1(ob.value, key, val);
    ob.dep.notify();
    return val;
  }
  /**
   * Delete a property and trigger change if necessary.
   */


  function del(target, key) {

    if (Array.isArray(target) && isValidArrayIndex(key)) {
      target.splice(key, 1);
      return;
    }

    var ob = target.__ob__;

    if (target._isVue || ob && ob.vmCount) {
      return;
    }

    if (!hasOwn(target, key)) {
      return;
    }

    delete target[key];

    if (!ob) {
      return;
    }

    ob.dep.notify();
  }
  /**
   * Collect dependencies on array elements when the array is touched, since
   * we cannot intercept array element access like property getters.
   */


  function dependArray(value) {
    for (var e = void 0, i = 0, l = value.length; i < l; i++) {
      e = value[i];
      e && e.__ob__ && e.__ob__.dep.depend();

      if (Array.isArray(e)) {
        dependArray(e);
      }
    }
  }
  /*  */

  /**
   * Option overwriting strategies are functions that handle
   * how to merge a parent option value and a child option
   * value into the final value.
   */


  var strats = config.optionMergeStrategies;
  /**
   * Helper that recursively merges two data objects together.
   */


  function mergeData(to, from) {
    if (!from) {
      return to;
    }

    var key, toVal, fromVal;
    var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);

    for (var i = 0; i < keys.length; i++) {
      key = keys[i]; // in case the object is already observed...

      if (key === '__ob__') {
        continue;
      }

      toVal = to[key];
      fromVal = from[key];

      if (!hasOwn(to, key)) {
        set(to, key, fromVal);
      } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {
        mergeData(toVal, fromVal);
      }
    }

    return to;
  }
  /**
   * Data
   */


  function mergeDataOrFn(parentVal, childVal, vm) {
    if (!vm) {
      // in a Vue.extend merge, both should be functions
      if (!childVal) {
        return parentVal;
      }

      if (!parentVal) {
        return childVal;
      } // when parentVal & childVal are both present,
      // we need to return a function that returns the
      // merged result of both functions... no need to
      // check if parentVal is a function here because
      // it has to be a function to pass previous merges.


      return function mergedDataFn() {
        return mergeData(typeof childVal === 'function' ? childVal.call(this, this) : childVal, typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal);
      };
    } else {
      return function mergedInstanceDataFn() {
        // instance merge
        var instanceData = typeof childVal === 'function' ? childVal.call(vm, vm) : childVal;
        var defaultData = typeof parentVal === 'function' ? parentVal.call(vm, vm) : parentVal;

        if (instanceData) {
          return mergeData(instanceData, defaultData);
        } else {
          return defaultData;
        }
      };
    }
  }

  strats.data = function (parentVal, childVal, vm) {
    if (!vm) {
      if (childVal && typeof childVal !== 'function') {
        return parentVal;
      }

      return mergeDataOrFn(parentVal, childVal);
    }

    return mergeDataOrFn(parentVal, childVal, vm);
  };
  /**
   * Hooks and props are merged as arrays.
   */


  function mergeHook(parentVal, childVal) {
    var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
    return res ? dedupeHooks(res) : res;
  }

  function dedupeHooks(hooks) {
    var res = [];

    for (var i = 0; i < hooks.length; i++) {
      if (res.indexOf(hooks[i]) === -1) {
        res.push(hooks[i]);
      }
    }

    return res;
  }

  LIFECYCLE_HOOKS.forEach(function (hook) {
    strats[hook] = mergeHook;
  });
  /**
   * Assets
   *
   * When a vm is present (instance creation), we need to do
   * a three-way merge between constructor options, instance
   * options and parent options.
   */

  function mergeAssets(parentVal, childVal, vm, key) {
    var res = Object.create(parentVal || null);

    if (childVal) {
      return extend(res, childVal);
    } else {
      return res;
    }
  }

  ASSET_TYPES.forEach(function (type) {
    strats[type + 's'] = mergeAssets;
  });
  /**
   * Watchers.
   *
   * Watchers hashes should not overwrite one
   * another, so we merge them as arrays.
   */

  strats.watch = function (parentVal, childVal, vm, key) {
    // work around Firefox's Object.prototype.watch...
    if (parentVal === nativeWatch) {
      parentVal = undefined;
    }

    if (childVal === nativeWatch) {
      childVal = undefined;
    }
    /* istanbul ignore if */


    if (!childVal) {
      return Object.create(parentVal || null);
    }

    if (!parentVal) {
      return childVal;
    }

    var ret = {};
    extend(ret, parentVal);

    for (var key$1 in childVal) {
      var parent = ret[key$1];
      var child = childVal[key$1];

      if (parent && !Array.isArray(parent)) {
        parent = [parent];
      }

      ret[key$1] = parent ? parent.concat(child) : Array.isArray(child) ? child : [child];
    }

    return ret;
  };
  /**
   * Other object hashes.
   */


  strats.props = strats.methods = strats.inject = strats.computed = function (parentVal, childVal, vm, key) {
    if (childVal && "production" !== 'production') {
      assertObjectType(key, childVal);
    }

    if (!parentVal) {
      return childVal;
    }

    var ret = Object.create(null);
    extend(ret, parentVal);

    if (childVal) {
      extend(ret, childVal);
    }

    return ret;
  };

  strats.provide = mergeDataOrFn;
  /**
   * Default strategy.
   */

  var defaultStrat = function (parentVal, childVal) {
    return childVal === undefined ? parentVal : childVal;
  };
  /**
   * Ensure all props option syntax are normalized into the
   * Object-based format.
   */


  function normalizeProps(options, vm) {
    var props = options.props;

    if (!props) {
      return;
    }

    var res = {};
    var i, val, name;

    if (Array.isArray(props)) {
      i = props.length;

      while (i--) {
        val = props[i];

        if (typeof val === 'string') {
          name = camelize(val);
          res[name] = {
            type: null
          };
        }
      }
    } else if (isPlainObject(props)) {
      for (var key in props) {
        val = props[key];
        name = camelize(key);
        res[name] = isPlainObject(val) ? val : {
          type: val
        };
      }
    } else ;

    options.props = res;
  }
  /**
   * Normalize all injections into Object-based format
   */


  function normalizeInject(options, vm) {
    var inject = options.inject;

    if (!inject) {
      return;
    }

    var normalized = options.inject = {};

    if (Array.isArray(inject)) {
      for (var i = 0; i < inject.length; i++) {
        normalized[inject[i]] = {
          from: inject[i]
        };
      }
    } else if (isPlainObject(inject)) {
      for (var key in inject) {
        var val = inject[key];
        normalized[key] = isPlainObject(val) ? extend({
          from: key
        }, val) : {
          from: val
        };
      }
    } else ;
  }
  /**
   * Normalize raw function directives into object format.
   */


  function normalizeDirectives(options) {
    var dirs = options.directives;

    if (dirs) {
      for (var key in dirs) {
        var def$$1 = dirs[key];

        if (typeof def$$1 === 'function') {
          dirs[key] = {
            bind: def$$1,
            update: def$$1
          };
        }
      }
    }
  }

  function assertObjectType(name, value, vm) {
    if (!isPlainObject(value)) {
      warn("Invalid value for option \"" + name + "\": expected an Object, " + "but got " + toRawType(value) + ".");
    }
  }
  /**
   * Merge two option objects into a new one.
   * Core utility used in both instantiation and inheritance.
   */


  function mergeOptions(parent, child, vm) {

    if (typeof child === 'function') {
      child = child.options;
    }

    normalizeProps(child);
    normalizeInject(child);
    normalizeDirectives(child); // Apply extends and mixins on the child options,
    // but only if it is a raw options object that isn't
    // the result of another mergeOptions call.
    // Only merged options has the _base property.

    if (!child._base) {
      if (child.extends) {
        parent = mergeOptions(parent, child.extends, vm);
      }

      if (child.mixins) {
        for (var i = 0, l = child.mixins.length; i < l; i++) {
          parent = mergeOptions(parent, child.mixins[i], vm);
        }
      }
    }

    var options = {};
    var key;

    for (key in parent) {
      mergeField(key);
    }

    for (key in child) {
      if (!hasOwn(parent, key)) {
        mergeField(key);
      }
    }

    function mergeField(key) {
      var strat = strats[key] || defaultStrat;
      options[key] = strat(parent[key], child[key], vm, key);
    }

    return options;
  }
  /**
   * Resolve an asset.
   * This function is used because child instances need access
   * to assets defined in its ancestor chain.
   */


  function resolveAsset(options, type, id, warnMissing) {
    /* istanbul ignore if */
    if (typeof id !== 'string') {
      return;
    }

    var assets = options[type]; // check local registration variations first

    if (hasOwn(assets, id)) {
      return assets[id];
    }

    var camelizedId = camelize(id);

    if (hasOwn(assets, camelizedId)) {
      return assets[camelizedId];
    }

    var PascalCaseId = capitalize(camelizedId);

    if (hasOwn(assets, PascalCaseId)) {
      return assets[PascalCaseId];
    } // fallback to prototype chain


    var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];

    return res;
  }
  /*  */


  function validateProp(key, propOptions, propsData, vm) {
    var prop = propOptions[key];
    var absent = !hasOwn(propsData, key);
    var value = propsData[key]; // boolean casting

    var booleanIndex = getTypeIndex(Boolean, prop.type);

    if (booleanIndex > -1) {
      if (absent && !hasOwn(prop, 'default')) {
        value = false;
      } else if (value === '' || value === hyphenate(key)) {
        // only cast empty string / same name to boolean if
        // boolean has higher priority
        var stringIndex = getTypeIndex(String, prop.type);

        if (stringIndex < 0 || booleanIndex < stringIndex) {
          value = true;
        }
      }
    } // check default value


    if (value === undefined) {
      value = getPropDefaultValue(vm, prop, key); // since the default value is a fresh copy,
      // make sure to observe it.

      var prevShouldObserve = shouldObserve;
      toggleObserving(true);
      observe(value);
      toggleObserving(prevShouldObserve);
    }

    return value;
  }
  /**
   * Get the default value of a prop.
   */


  function getPropDefaultValue(vm, prop, key) {
    // no default, return undefined
    if (!hasOwn(prop, 'default')) {
      return undefined;
    }

    var def = prop.default; // warn against non-factory defaults for Object & Array
    // return previous default value to avoid unnecessary watcher trigger


    if (vm && vm.$options.propsData && vm.$options.propsData[key] === undefined && vm._props[key] !== undefined) {
      return vm._props[key];
    } // call factory function for non-Function types
    // a value is Function if its prototype is function even across different execution context


    return typeof def === 'function' && getType(prop.type) !== 'Function' ? def.call(vm) : def;
  }
  /**
   * Use function string name to check built-in types,
   * because a simple equality check will fail when running
   * across different vms / iframes.
   */


  function getType(fn) {
    var match = fn && fn.toString().match(/^\s*function (\w+)/);
    return match ? match[1] : '';
  }

  function isSameType(a, b) {
    return getType(a) === getType(b);
  }

  function getTypeIndex(type, expectedTypes) {
    if (!Array.isArray(expectedTypes)) {
      return isSameType(expectedTypes, type) ? 0 : -1;
    }

    for (var i = 0, len = expectedTypes.length; i < len; i++) {
      if (isSameType(expectedTypes[i], type)) {
        return i;
      }
    }

    return -1;
  }
  /*  */


  function handleError(err, vm, info) {
    // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
    // See: https://github.com/vuejs/vuex/issues/1505
    pushTarget();

    try {
      if (vm) {
        var cur = vm;

        while (cur = cur.$parent) {
          var hooks = cur.$options.errorCaptured;

          if (hooks) {
            for (var i = 0; i < hooks.length; i++) {
              try {
                var capture = hooks[i].call(cur, err, vm, info) === false;

                if (capture) {
                  return;
                }
              } catch (e) {
                globalHandleError(e, cur, 'errorCaptured hook');
              }
            }
          }
        }
      }

      globalHandleError(err, vm, info);
    } finally {
      popTarget();
    }
  }

  function invokeWithErrorHandling(handler, context, args, vm, info) {
    var res;

    try {
      res = args ? handler.apply(context, args) : handler.call(context);

      if (res && !res._isVue && isPromise(res) && !res._handled) {
        res.catch(function (e) {
          return handleError(e, vm, info + " (Promise/async)");
        }); // issue #9511
        // avoid catch triggering multiple times when nested calls

        res._handled = true;
      }
    } catch (e) {
      handleError(e, vm, info);
    }

    return res;
  }

  function globalHandleError(err, vm, info) {
    if (config.errorHandler) {
      try {
        return config.errorHandler.call(null, err, vm, info);
      } catch (e) {
        // if the user intentionally throws the original error in the handler,
        // do not log it twice
        if (e !== err) {
          logError(e);
        }
      }
    }

    logError(err);
  }

  function logError(err, vm, info) {
    /* istanbul ignore else */


    if ((inBrowser || inWeex) && typeof console !== 'undefined') {
      console.error(err);
    } else {
      throw err;
    }
  }
  /*  */


  var isUsingMicroTask = false;
  var callbacks = [];
  var pending = false;

  function flushCallbacks() {
    pending = false;
    var copies = callbacks.slice(0);
    callbacks.length = 0;

    for (var i = 0; i < copies.length; i++) {
      copies[i]();
    }
  } // Here we have async deferring wrappers using microtasks.
  // In 2.5 we used (macro) tasks (in combination with microtasks).
  // However, it has subtle problems when state is changed right before repaint
  // (e.g. #6813, out-in transitions).
  // Also, using (macro) tasks in event handler would cause some weird behaviors
  // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  // So we now use microtasks everywhere, again.
  // A major drawback of this tradeoff is that there are some scenarios
  // where microtasks have too high a priority and fire in between supposedly
  // sequential events (e.g. #4521, #6690, which have workarounds)
  // or even between bubbling of the same event (#6566).


  var timerFunc; // The nextTick behavior leverages the microtask queue, which can be accessed
  // via either native Promise.then or MutationObserver.
  // MutationObserver has wider support, however it is seriously bugged in
  // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  // completely stops working after triggering a few times... so, if native
  // Promise is available, we will use it:

  /* istanbul ignore next, $flow-disable-line */

  if (typeof Promise !== 'undefined' && isNative(Promise)) {
    var p = Promise.resolve();

    timerFunc = function () {
      p.then(flushCallbacks); // In problematic UIWebViews, Promise.then doesn't completely break, but
      // it can get stuck in a weird state where callbacks are pushed into the
      // microtask queue but the queue isn't being flushed, until the browser
      // needs to do some other work, e.g. handle a timer. Therefore we can
      // "force" the microtask queue to be flushed by adding an empty timer.

      if (isIOS) {
        setTimeout(noop);
      }
    };

    isUsingMicroTask = true;
  } else if (!isIE && typeof MutationObserver !== 'undefined' && (isNative(MutationObserver) || // PhantomJS and iOS 7.x
  MutationObserver.toString() === '[object MutationObserverConstructor]')) {
    // Use MutationObserver where native Promise is not available,
    // e.g. PhantomJS, iOS7, Android 4.4
    // (#6466 MutationObserver is unreliable in IE11)
    var counter = 1;
    var observer = new MutationObserver(flushCallbacks);
    var textNode = document.createTextNode(String(counter));
    observer.observe(textNode, {
      characterData: true
    });

    timerFunc = function () {
      counter = (counter + 1) % 2;
      textNode.data = String(counter);
    };

    isUsingMicroTask = true;
  } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
    // Fallback to setImmediate.
    // Technically it leverages the (macro) task queue,
    // but it is still a better choice than setTimeout.
    timerFunc = function () {
      setImmediate(flushCallbacks);
    };
  } else {
    // Fallback to setTimeout.
    timerFunc = function () {
      setTimeout(flushCallbacks, 0);
    };
  }

  function nextTick(cb, ctx) {
    var _resolve;

    callbacks.push(function () {
      if (cb) {
        try {
          cb.call(ctx);
        } catch (e) {
          handleError(e, ctx, 'nextTick');
        }
      } else if (_resolve) {
        _resolve(ctx);
      }
    });

    if (!pending) {
      pending = true;
      timerFunc();
    } // $flow-disable-line


    if (!cb && typeof Promise !== 'undefined') {
      return new Promise(function (resolve) {
        _resolve = resolve;
      });
    }
  }
  /*  */


  var seenObjects = new _Set();
  /**
   * Recursively traverse an object to evoke all converted
   * getters, so that every nested property inside the object
   * is collected as a "deep" dependency.
   */

  function traverse(val) {
    _traverse(val, seenObjects);

    seenObjects.clear();
  }

  function _traverse(val, seen) {
    var i, keys;
    var isA = Array.isArray(val);

    if (!isA && !isObject(val) || Object.isFrozen(val) || val instanceof VNode) {
      return;
    }

    if (val.__ob__) {
      var depId = val.__ob__.dep.id;

      if (seen.has(depId)) {
        return;
      }

      seen.add(depId);
    }

    if (isA) {
      i = val.length;

      while (i--) {
        _traverse(val[i], seen);
      }
    } else {
      keys = Object.keys(val);
      i = keys.length;

      while (i--) {
        _traverse(val[keys[i]], seen);
      }
    }
  }
  /*  */


  var normalizeEvent = cached(function (name) {
    var passive = name.charAt(0) === '&';
    name = passive ? name.slice(1) : name;
    var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first

    name = once$$1 ? name.slice(1) : name;
    var capture = name.charAt(0) === '!';
    name = capture ? name.slice(1) : name;
    return {
      name: name,
      once: once$$1,
      capture: capture,
      passive: passive
    };
  });

  function createFnInvoker(fns, vm) {
    function invoker() {
      var arguments$1 = arguments;
      var fns = invoker.fns;

      if (Array.isArray(fns)) {
        var cloned = fns.slice();

        for (var i = 0; i < cloned.length; i++) {
          invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
        }
      } else {
        // return handler return value for single handlers
        return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
      }
    }

    invoker.fns = fns;
    return invoker;
  }

  function updateListeners(on, oldOn, add, remove$$1, createOnceHandler, vm) {
    var name, def$$1, cur, old, event;

    for (name in on) {
      def$$1 = cur = on[name];
      old = oldOn[name];
      event = normalizeEvent(name);

      if (isUndef(cur)) ; else if (isUndef(old)) {
        if (isUndef(cur.fns)) {
          cur = on[name] = createFnInvoker(cur, vm);
        }

        if (isTrue(event.once)) {
          cur = on[name] = createOnceHandler(event.name, cur, event.capture);
        }

        add(event.name, cur, event.capture, event.passive, event.params);
      } else if (cur !== old) {
        old.fns = cur;
        on[name] = old;
      }
    }

    for (name in oldOn) {
      if (isUndef(on[name])) {
        event = normalizeEvent(name);
        remove$$1(event.name, oldOn[name], event.capture);
      }
    }
  }
  /*  */


  function mergeVNodeHook(def, hookKey, hook) {
    if (def instanceof VNode) {
      def = def.data.hook || (def.data.hook = {});
    }

    var invoker;
    var oldHook = def[hookKey];

    function wrappedHook() {
      hook.apply(this, arguments); // important: remove merged hook to ensure it's called only once
      // and prevent memory leak

      remove(invoker.fns, wrappedHook);
    }

    if (isUndef(oldHook)) {
      // no existing hook
      invoker = createFnInvoker([wrappedHook]);
    } else {
      /* istanbul ignore if */
      if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
        // already a merged invoker
        invoker = oldHook;
        invoker.fns.push(wrappedHook);
      } else {
        // existing plain hook
        invoker = createFnInvoker([oldHook, wrappedHook]);
      }
    }

    invoker.merged = true;
    def[hookKey] = invoker;
  }
  /*  */


  function extractPropsFromVNodeData(data, Ctor, tag) {
    // we are only extracting raw values here.
    // validation and default values are handled in the child
    // component itself.
    var propOptions = Ctor.options.props;

    if (isUndef(propOptions)) {
      return;
    }

    var res = {};
    var attrs = data.attrs;
    var props = data.props;

    if (isDef(attrs) || isDef(props)) {
      for (var key in propOptions) {
        var altKey = hyphenate(key);

        checkProp(res, props, key, altKey, true) || checkProp(res, attrs, key, altKey, false);
      }
    }

    return res;
  }

  function checkProp(res, hash, key, altKey, preserve) {
    if (isDef(hash)) {
      if (hasOwn(hash, key)) {
        res[key] = hash[key];

        if (!preserve) {
          delete hash[key];
        }

        return true;
      } else if (hasOwn(hash, altKey)) {
        res[key] = hash[altKey];

        if (!preserve) {
          delete hash[altKey];
        }

        return true;
      }
    }

    return false;
  }
  /*  */
  // The template compiler attempts to minimize the need for normalization by
  // statically analyzing the template at compile time.
  //
  // For plain HTML markup, normalization can be completely skipped because the
  // generated render function is guaranteed to return Array<VNode>. There are
  // two cases where extra normalization is needed:
  // 1. When the children contains components - because a functional component
  // may return an Array instead of a single root. In this case, just a simple
  // normalization is needed - if any child is an Array, we flatten the whole
  // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  // because functional components already normalize their own children.


  function simpleNormalizeChildren(children) {
    for (var i = 0; i < children.length; i++) {
      if (Array.isArray(children[i])) {
        return Array.prototype.concat.apply([], children);
      }
    }

    return children;
  } // 2. When the children contains constructs that always generated nested Arrays,
  // e.g. <template>, <slot>, v-for, or when the children is provided by user
  // with hand-written render functions / JSX. In such cases a full normalization
  // is needed to cater to all possible types of children values.


  function normalizeChildren(children) {
    return isPrimitive(children) ? [createTextVNode(children)] : Array.isArray(children) ? normalizeArrayChildren(children) : undefined;
  }

  function isTextNode(node) {
    return isDef(node) && isDef(node.text) && isFalse(node.isComment);
  }

  function normalizeArrayChildren(children, nestedIndex) {
    var res = [];
    var i, c, lastIndex, last;

    for (i = 0; i < children.length; i++) {
      c = children[i];

      if (isUndef(c) || typeof c === 'boolean') {
        continue;
      }

      lastIndex = res.length - 1;
      last = res[lastIndex]; //  nested

      if (Array.isArray(c)) {
        if (c.length > 0) {
          c = normalizeArrayChildren(c, (nestedIndex || '') + "_" + i); // merge adjacent text nodes

          if (isTextNode(c[0]) && isTextNode(last)) {
            res[lastIndex] = createTextVNode(last.text + c[0].text);
            c.shift();
          }

          res.push.apply(res, c);
        }
      } else if (isPrimitive(c)) {
        if (isTextNode(last)) {
          // merge adjacent text nodes
          // this is necessary for SSR hydration because text nodes are
          // essentially merged when rendered to HTML strings
          res[lastIndex] = createTextVNode(last.text + c);
        } else if (c !== '') {
          // convert primitive to vnode
          res.push(createTextVNode(c));
        }
      } else {
        if (isTextNode(c) && isTextNode(last)) {
          // merge adjacent text nodes
          res[lastIndex] = createTextVNode(last.text + c.text);
        } else {
          // default key for nested array children (likely generated by v-for)
          if (isTrue(children._isVList) && isDef(c.tag) && isUndef(c.key) && isDef(nestedIndex)) {
            c.key = "__vlist" + nestedIndex + "_" + i + "__";
          }

          res.push(c);
        }
      }
    }

    return res;
  }
  /*  */


  function initProvide(vm) {
    var provide = vm.$options.provide;

    if (provide) {
      vm._provided = typeof provide === 'function' ? provide.call(vm) : provide;
    }
  }

  function initInjections(vm) {
    var result = resolveInject(vm.$options.inject, vm);

    if (result) {
      toggleObserving(false);
      Object.keys(result).forEach(function (key) {
        /* istanbul ignore else */
        {
          defineReactive$$1(vm, key, result[key]);
        }
      });
      toggleObserving(true);
    }
  }

  function resolveInject(inject, vm) {
    if (inject) {
      // inject is :any because flow is not smart enough to figure out cached
      var result = Object.create(null);
      var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);

      for (var i = 0; i < keys.length; i++) {
        var key = keys[i]; // #6574 in case the inject object is observed...

        if (key === '__ob__') {
          continue;
        }

        var provideKey = inject[key].from;
        var source = vm;

        while (source) {
          if (source._provided && hasOwn(source._provided, provideKey)) {
            result[key] = source._provided[provideKey];
            break;
          }

          source = source.$parent;
        }

        if (!source) {
          if ('default' in inject[key]) {
            var provideDefault = inject[key].default;
            result[key] = typeof provideDefault === 'function' ? provideDefault.call(vm) : provideDefault;
          }
        }
      }

      return result;
    }
  }
  /*  */

  /**
   * Runtime helper for resolving raw children VNodes into a slot object.
   */


  function resolveSlots(children, context) {
    if (!children || !children.length) {
      return {};
    }

    var slots = {};

    for (var i = 0, l = children.length; i < l; i++) {
      var child = children[i];
      var data = child.data; // remove slot attribute if the node is resolved as a Vue slot node

      if (data && data.attrs && data.attrs.slot) {
        delete data.attrs.slot;
      } // named slots should only be respected if the vnode was rendered in the
      // same context.


      if ((child.context === context || child.fnContext === context) && data && data.slot != null) {
        var name = data.slot;
        var slot = slots[name] || (slots[name] = []);

        if (child.tag === 'template') {
          slot.push.apply(slot, child.children || []);
        } else {
          slot.push(child);
        }
      } else {
        (slots.default || (slots.default = [])).push(child);
      }
    } // ignore slots that contains only whitespace


    for (var name$1 in slots) {
      if (slots[name$1].every(isWhitespace)) {
        delete slots[name$1];
      }
    }

    return slots;
  }

  function isWhitespace(node) {
    return node.isComment && !node.asyncFactory || node.text === ' ';
  }
  /*  */


  function normalizeScopedSlots(slots, normalSlots, prevSlots) {
    var res;
    var hasNormalSlots = Object.keys(normalSlots).length > 0;
    var isStable = slots ? !!slots.$stable : !hasNormalSlots;
    var key = slots && slots.$key;

    if (!slots) {
      res = {};
    } else if (slots._normalized) {
      // fast path 1: child component re-render only, parent did not change
      return slots._normalized;
    } else if (isStable && prevSlots && prevSlots !== emptyObject && key === prevSlots.$key && !hasNormalSlots && !prevSlots.$hasNormal) {
      // fast path 2: stable scoped slots w/ no normal slots to proxy,
      // only need to normalize once
      return prevSlots;
    } else {
      res = {};

      for (var key$1 in slots) {
        if (slots[key$1] && key$1[0] !== '$') {
          res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
        }
      }
    } // expose normal slots on scopedSlots


    for (var key$2 in normalSlots) {
      if (!(key$2 in res)) {
        res[key$2] = proxyNormalSlot(normalSlots, key$2);
      }
    } // avoriaz seems to mock a non-extensible $scopedSlots object
    // and when that is passed down this would cause an error


    if (slots && Object.isExtensible(slots)) {
      slots._normalized = res;
    }

    def(res, '$stable', isStable);
    def(res, '$key', key);
    def(res, '$hasNormal', hasNormalSlots);
    return res;
  }

  function normalizeScopedSlot(normalSlots, key, fn) {
    var normalized = function () {
      var res = arguments.length ? fn.apply(null, arguments) : fn({});
      res = res && typeof res === 'object' && !Array.isArray(res) ? [res] // single vnode
      : normalizeChildren(res);
      return res && (res.length === 0 || res.length === 1 && res[0].isComment // #9658
      ) ? undefined : res;
    }; // this is a slot using the new v-slot syntax without scope. although it is
    // compiled as a scoped slot, render fn users would expect it to be present
    // on this.$slots because the usage is semantically a normal slot.


    if (fn.proxy) {
      Object.defineProperty(normalSlots, key, {
        get: normalized,
        enumerable: true,
        configurable: true
      });
    }

    return normalized;
  }

  function proxyNormalSlot(slots, key) {
    return function () {
      return slots[key];
    };
  }
  /*  */

  /**
   * Runtime helper for rendering v-for lists.
   */


  function renderList(val, render) {
    var ret, i, l, keys, key;

    if (Array.isArray(val) || typeof val === 'string') {
      ret = new Array(val.length);

      for (i = 0, l = val.length; i < l; i++) {
        ret[i] = render(val[i], i);
      }
    } else if (typeof val === 'number') {
      ret = new Array(val);

      for (i = 0; i < val; i++) {
        ret[i] = render(i + 1, i);
      }
    } else if (isObject(val)) {
      if (hasSymbol && val[Symbol.iterator]) {
        ret = [];
        var iterator = val[Symbol.iterator]();
        var result = iterator.next();

        while (!result.done) {
          ret.push(render(result.value, ret.length));
          result = iterator.next();
        }
      } else {
        keys = Object.keys(val);
        ret = new Array(keys.length);

        for (i = 0, l = keys.length; i < l; i++) {
          key = keys[i];
          ret[i] = render(val[key], key, i);
        }
      }
    }

    if (!isDef(ret)) {
      ret = [];
    }

    ret._isVList = true;
    return ret;
  }
  /*  */

  /**
   * Runtime helper for rendering <slot>
   */


  function renderSlot(name, fallback, props, bindObject) {
    var scopedSlotFn = this.$scopedSlots[name];
    var nodes;

    if (scopedSlotFn) {
      // scoped slot
      props = props || {};

      if (bindObject) {

        props = extend(extend({}, bindObject), props);
      }

      nodes = scopedSlotFn(props) || fallback;
    } else {
      nodes = this.$slots[name] || fallback;
    }

    var target = props && props.slot;

    if (target) {
      return this.$createElement('template', {
        slot: target
      }, nodes);
    } else {
      return nodes;
    }
  }
  /*  */

  /**
   * Runtime helper for resolving filters
   */


  function resolveFilter(id) {
    return resolveAsset(this.$options, 'filters', id) || identity;
  }
  /*  */


  function isKeyNotMatch(expect, actual) {
    if (Array.isArray(expect)) {
      return expect.indexOf(actual) === -1;
    } else {
      return expect !== actual;
    }
  }
  /**
   * Runtime helper for checking keyCodes from config.
   * exposed as Vue.prototype._k
   * passing in eventKeyName as last argument separately for backwards compat
   */


  function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
    var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;

    if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
      return isKeyNotMatch(builtInKeyName, eventKeyName);
    } else if (mappedKeyCode) {
      return isKeyNotMatch(mappedKeyCode, eventKeyCode);
    } else if (eventKeyName) {
      return hyphenate(eventKeyName) !== key;
    }
  }
  /*  */

  /**
   * Runtime helper for merging v-bind="object" into a VNode's data.
   */


  function bindObjectProps(data, tag, value, asProp, isSync) {
    if (value) {
      if (!isObject(value)) ; else {
        if (Array.isArray(value)) {
          value = toObject(value);
        }

        var hash;

        var loop = function (key) {
          if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
            hash = data;
          } else {
            var type = data.attrs && data.attrs.type;
            hash = asProp || config.mustUseProp(tag, type, key) ? data.domProps || (data.domProps = {}) : data.attrs || (data.attrs = {});
          }

          var camelizedKey = camelize(key);
          var hyphenatedKey = hyphenate(key);

          if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
            hash[key] = value[key];

            if (isSync) {
              var on = data.on || (data.on = {});

              on["update:" + key] = function ($event) {
                value[key] = $event;
              };
            }
          }
        };

        for (var key in value) loop(key);
      }
    }

    return data;
  }
  /*  */

  /**
   * Runtime helper for rendering static trees.
   */


  function renderStatic(index, isInFor) {
    var cached = this._staticTrees || (this._staticTrees = []);
    var tree = cached[index]; // if has already-rendered static tree and not inside v-for,
    // we can reuse the same tree.

    if (tree && !isInFor) {
      return tree;
    } // otherwise, render a fresh tree.


    tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, null, this // for render fns generated for functional component templates
    );
    markStatic(tree, "__static__" + index, false);
    return tree;
  }
  /**
   * Runtime helper for v-once.
   * Effectively it means marking the node as static with a unique key.
   */


  function markOnce(tree, index, key) {
    markStatic(tree, "__once__" + index + (key ? "_" + key : ""), true);
    return tree;
  }

  function markStatic(tree, key, isOnce) {
    if (Array.isArray(tree)) {
      for (var i = 0; i < tree.length; i++) {
        if (tree[i] && typeof tree[i] !== 'string') {
          markStaticNode(tree[i], key + "_" + i, isOnce);
        }
      }
    } else {
      markStaticNode(tree, key, isOnce);
    }
  }

  function markStaticNode(node, key, isOnce) {
    node.isStatic = true;
    node.key = key;
    node.isOnce = isOnce;
  }
  /*  */


  function bindObjectListeners(data, value) {
    if (value) {
      if (!isPlainObject(value)) ; else {
        var on = data.on = data.on ? extend({}, data.on) : {};

        for (var key in value) {
          var existing = on[key];
          var ours = value[key];
          on[key] = existing ? [].concat(existing, ours) : ours;
        }
      }
    }

    return data;
  }
  /*  */


  function resolveScopedSlots(fns, // see flow/vnode
  res, // the following are added in 2.6
  hasDynamicKeys, contentHashKey) {
    res = res || {
      $stable: !hasDynamicKeys
    };

    for (var i = 0; i < fns.length; i++) {
      var slot = fns[i];

      if (Array.isArray(slot)) {
        resolveScopedSlots(slot, res, hasDynamicKeys);
      } else if (slot) {
        // marker for reverse proxying v-slot without scope on this.$slots
        if (slot.proxy) {
          slot.fn.proxy = true;
        }

        res[slot.key] = slot.fn;
      }
    }

    if (contentHashKey) {
      res.$key = contentHashKey;
    }

    return res;
  }
  /*  */


  function bindDynamicKeys(baseObj, values) {
    for (var i = 0; i < values.length; i += 2) {
      var key = values[i];

      if (typeof key === 'string' && key) {
        baseObj[values[i]] = values[i + 1];
      }
    }

    return baseObj;
  } // helper to dynamically append modifier runtime markers to event names.
  // ensure only append when value is already string, otherwise it will be cast
  // to string and cause the type check to miss.


  function prependModifier(value, symbol) {
    return typeof value === 'string' ? symbol + value : value;
  }
  /*  */


  function installRenderHelpers(target) {
    target._o = markOnce;
    target._n = toNumber;
    target._s = toString;
    target._l = renderList;
    target._t = renderSlot;
    target._q = looseEqual;
    target._i = looseIndexOf;
    target._m = renderStatic;
    target._f = resolveFilter;
    target._k = checkKeyCodes;
    target._b = bindObjectProps;
    target._v = createTextVNode;
    target._e = createEmptyVNode;
    target._u = resolveScopedSlots;
    target._g = bindObjectListeners;
    target._d = bindDynamicKeys;
    target._p = prependModifier;
  }
  /*  */


  function FunctionalRenderContext(data, props, children, parent, Ctor) {
    var this$1 = this;
    var options = Ctor.options; // ensure the createElement function in functional components
    // gets a unique context - this is necessary for correct named slot check

    var contextVm;

    if (hasOwn(parent, '_uid')) {
      contextVm = Object.create(parent); // $flow-disable-line

      contextVm._original = parent;
    } else {
      // the context vm passed in is a functional context as well.
      // in this case we want to make sure we are able to get a hold to the
      // real context instance.
      contextVm = parent; // $flow-disable-line

      parent = parent._original;
    }

    var isCompiled = isTrue(options._compiled);
    var needNormalization = !isCompiled;
    this.data = data;
    this.props = props;
    this.children = children;
    this.parent = parent;
    this.listeners = data.on || emptyObject;
    this.injections = resolveInject(options.inject, parent);

    this.slots = function () {
      if (!this$1.$slots) {
        normalizeScopedSlots(data.scopedSlots, this$1.$slots = resolveSlots(children, parent));
      }

      return this$1.$slots;
    };

    Object.defineProperty(this, 'scopedSlots', {
      enumerable: true,
      get: function get() {
        return normalizeScopedSlots(data.scopedSlots, this.slots());
      }
    }); // support for compiled functional template

    if (isCompiled) {
      // exposing $options for renderStatic()
      this.$options = options; // pre-resolve slots for renderSlot()

      this.$slots = this.slots();
      this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
    }

    if (options._scopeId) {
      this._c = function (a, b, c, d) {
        var vnode = createElement(contextVm, a, b, c, d, needNormalization);

        if (vnode && !Array.isArray(vnode)) {
          vnode.fnScopeId = options._scopeId;
          vnode.fnContext = parent;
        }

        return vnode;
      };
    } else {
      this._c = function (a, b, c, d) {
        return createElement(contextVm, a, b, c, d, needNormalization);
      };
    }
  }

  installRenderHelpers(FunctionalRenderContext.prototype);

  function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
    var options = Ctor.options;
    var props = {};
    var propOptions = options.props;

    if (isDef(propOptions)) {
      for (var key in propOptions) {
        props[key] = validateProp(key, propOptions, propsData || emptyObject);
      }
    } else {
      if (isDef(data.attrs)) {
        mergeProps(props, data.attrs);
      }

      if (isDef(data.props)) {
        mergeProps(props, data.props);
      }
    }

    var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
    var vnode = options.render.call(null, renderContext._c, renderContext);

    if (vnode instanceof VNode) {
      return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options);
    } else if (Array.isArray(vnode)) {
      var vnodes = normalizeChildren(vnode) || [];
      var res = new Array(vnodes.length);

      for (var i = 0; i < vnodes.length; i++) {
        res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options);
      }

      return res;
    }
  }

  function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
    // #7817 clone node before setting fnContext, otherwise if the node is reused
    // (e.g. it was from a cached normal slot) the fnContext causes named slots
    // that should not be matched to match.
    var clone = cloneVNode(vnode);
    clone.fnContext = contextVm;
    clone.fnOptions = options;

    if (data.slot) {
      (clone.data || (clone.data = {})).slot = data.slot;
    }

    return clone;
  }

  function mergeProps(to, from) {
    for (var key in from) {
      to[camelize(key)] = from[key];
    }
  }
  /*  */

  /*  */

  /*  */

  /*  */
  // inline hooks to be invoked on component VNodes during patch


  var componentVNodeHooks = {
    init: function init(vnode, hydrating) {
      if (vnode.componentInstance && !vnode.componentInstance._isDestroyed && vnode.data.keepAlive) {
        // kept-alive components, treat as a patch
        var mountedNode = vnode; // work around flow

        componentVNodeHooks.prepatch(mountedNode, mountedNode);
      } else {
        var child = vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance);
        child.$mount(hydrating ? vnode.elm : undefined, hydrating);
      }
    },
    prepatch: function prepatch(oldVnode, vnode) {
      var options = vnode.componentOptions;
      var child = vnode.componentInstance = oldVnode.componentInstance;
      updateChildComponent(child, options.propsData, // updated props
      options.listeners, // updated listeners
      vnode, // new parent vnode
      options.children // new children
      );
    },
    insert: function insert(vnode) {
      var context = vnode.context;
      var componentInstance = vnode.componentInstance;

      if (!componentInstance._isMounted) {
        componentInstance._isMounted = true;
        callHook(componentInstance, 'mounted');
      }

      if (vnode.data.keepAlive) {
        if (context._isMounted) {
          // vue-router#1212
          // During updates, a kept-alive component's child components may
          // change, so directly walking the tree here may call activated hooks
          // on incorrect children. Instead we push them into a queue which will
          // be processed after the whole patch process ended.
          queueActivatedComponent(componentInstance);
        } else {
          activateChildComponent(componentInstance, true
          /* direct */
          );
        }
      }
    },
    destroy: function destroy(vnode) {
      var componentInstance = vnode.componentInstance;

      if (!componentInstance._isDestroyed) {
        if (!vnode.data.keepAlive) {
          componentInstance.$destroy();
        } else {
          deactivateChildComponent(componentInstance, true
          /* direct */
          );
        }
      }
    }
  };
  var hooksToMerge = Object.keys(componentVNodeHooks);

  function createComponent(Ctor, data, context, children, tag) {
    if (isUndef(Ctor)) {
      return;
    }

    var baseCtor = context.$options._base; // plain options object: turn it into a constructor

    if (isObject(Ctor)) {
      Ctor = baseCtor.extend(Ctor);
    } // if at this stage it's not a constructor or an async component factory,
    // reject.


    if (typeof Ctor !== 'function') {

      return;
    } // async component


    var asyncFactory;

    if (isUndef(Ctor.cid)) {
      asyncFactory = Ctor;
      Ctor = resolveAsyncComponent(asyncFactory, baseCtor);

      if (Ctor === undefined) {
        // return a placeholder node for async component, which is rendered
        // as a comment node but preserves all the raw information for the node.
        // the information will be used for async server-rendering and hydration.
        return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
      }
    }

    data = data || {}; // resolve constructor options in case global mixins are applied after
    // component constructor creation

    resolveConstructorOptions(Ctor); // transform component v-model data into props & events

    if (isDef(data.model)) {
      transformModel(Ctor.options, data);
    } // extract props


    var propsData = extractPropsFromVNodeData(data, Ctor); // functional component

    if (isTrue(Ctor.options.functional)) {
      return createFunctionalComponent(Ctor, propsData, data, context, children);
    } // extract listeners, since these needs to be treated as
    // child component listeners instead of DOM listeners


    var listeners = data.on; // replace with listeners with .native modifier
    // so it gets processed during parent component patch.

    data.on = data.nativeOn;

    if (isTrue(Ctor.options.abstract)) {
      // abstract components do not keep anything
      // other than props & listeners & slot
      // work around flow
      var slot = data.slot;
      data = {};

      if (slot) {
        data.slot = slot;
      }
    } // install component management hooks onto the placeholder node


    installComponentHooks(data); // return a placeholder vnode

    var name = Ctor.options.name || tag;
    var vnode = new VNode("vue-component-" + Ctor.cid + (name ? "-" + name : ''), data, undefined, undefined, undefined, context, {
      Ctor: Ctor,
      propsData: propsData,
      listeners: listeners,
      tag: tag,
      children: children
    }, asyncFactory);
    return vnode;
  }

  function createComponentInstanceForVnode(vnode, // we know it's MountedComponentVNode but flow doesn't
  parent // activeInstance in lifecycle state
  ) {
    var options = {
      _isComponent: true,
      _parentVnode: vnode,
      parent: parent
    }; // check inline-template render functions

    var inlineTemplate = vnode.data.inlineTemplate;

    if (isDef(inlineTemplate)) {
      options.render = inlineTemplate.render;
      options.staticRenderFns = inlineTemplate.staticRenderFns;
    }

    return new vnode.componentOptions.Ctor(options);
  }

  function installComponentHooks(data) {
    var hooks = data.hook || (data.hook = {});

    for (var i = 0; i < hooksToMerge.length; i++) {
      var key = hooksToMerge[i];
      var existing = hooks[key];
      var toMerge = componentVNodeHooks[key];

      if (existing !== toMerge && !(existing && existing._merged)) {
        hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
      }
    }
  }

  function mergeHook$1(f1, f2) {
    var merged = function (a, b) {
      // flow complains about extra args which is why we use any
      f1(a, b);
      f2(a, b);
    };

    merged._merged = true;
    return merged;
  } // transform component v-model info (value and callback) into
  // prop and event handler respectively.


  function transformModel(options, data) {
    var prop = options.model && options.model.prop || 'value';
    var event = options.model && options.model.event || 'input';
    (data.attrs || (data.attrs = {}))[prop] = data.model.value;
    var on = data.on || (data.on = {});
    var existing = on[event];
    var callback = data.model.callback;

    if (isDef(existing)) {
      if (Array.isArray(existing) ? existing.indexOf(callback) === -1 : existing !== callback) {
        on[event] = [callback].concat(existing);
      }
    } else {
      on[event] = callback;
    }
  }
  /*  */


  var SIMPLE_NORMALIZE = 1;
  var ALWAYS_NORMALIZE = 2; // wrapper function for providing a more flexible interface
  // without getting yelled at by flow

  function createElement(context, tag, data, children, normalizationType, alwaysNormalize) {
    if (Array.isArray(data) || isPrimitive(data)) {
      normalizationType = children;
      children = data;
      data = undefined;
    }

    if (isTrue(alwaysNormalize)) {
      normalizationType = ALWAYS_NORMALIZE;
    }

    return _createElement(context, tag, data, children, normalizationType);
  }

  function _createElement(context, tag, data, children, normalizationType) {
    if (isDef(data) && isDef(data.__ob__)) {
      return createEmptyVNode();
    } // object syntax in v-bind


    if (isDef(data) && isDef(data.is)) {
      tag = data.is;
    }

    if (!tag) {
      // in case of component :is set to falsy value
      return createEmptyVNode();
    } // warn against non-primitive key


    if (Array.isArray(children) && typeof children[0] === 'function') {
      data = data || {};
      data.scopedSlots = {
        default: children[0]
      };
      children.length = 0;
    }

    if (normalizationType === ALWAYS_NORMALIZE) {
      children = normalizeChildren(children);
    } else if (normalizationType === SIMPLE_NORMALIZE) {
      children = simpleNormalizeChildren(children);
    }

    var vnode, ns;

    if (typeof tag === 'string') {
      var Ctor;
      ns = context.$vnode && context.$vnode.ns || config.getTagNamespace(tag);

      if (config.isReservedTag(tag)) {

        vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
      } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
        // component
        vnode = createComponent(Ctor, data, context, children, tag);
      } else {
        // unknown or unlisted namespaced elements
        // check at runtime because it may get assigned a namespace when its
        // parent normalizes children
        vnode = new VNode(tag, data, children, undefined, undefined, context);
      }
    } else {
      // direct component options / constructor
      vnode = createComponent(tag, data, context, children);
    }

    if (Array.isArray(vnode)) {
      return vnode;
    } else if (isDef(vnode)) {
      if (isDef(ns)) {
        applyNS(vnode, ns);
      }

      if (isDef(data)) {
        registerDeepBindings(data);
      }

      return vnode;
    } else {
      return createEmptyVNode();
    }
  }

  function applyNS(vnode, ns, force) {
    vnode.ns = ns;

    if (vnode.tag === 'foreignObject') {
      // use default namespace inside foreignObject
      ns = undefined;
      force = true;
    }

    if (isDef(vnode.children)) {
      for (var i = 0, l = vnode.children.length; i < l; i++) {
        var child = vnode.children[i];

        if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force) && child.tag !== 'svg')) {
          applyNS(child, ns, force);
        }
      }
    }
  } // ref #5318
  // necessary to ensure parent re-render when deep bindings like :style and
  // :class are used on slot nodes


  function registerDeepBindings(data) {
    if (isObject(data.style)) {
      traverse(data.style);
    }

    if (isObject(data.class)) {
      traverse(data.class);
    }
  }
  /*  */


  function initRender(vm) {
    vm._vnode = null; // the root of the child tree

    vm._staticTrees = null; // v-once cached trees

    var options = vm.$options;
    var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree

    var renderContext = parentVnode && parentVnode.context;
    vm.$slots = resolveSlots(options._renderChildren, renderContext);
    vm.$scopedSlots = emptyObject; // bind the createElement fn to this instance
    // so that we get proper render context inside it.
    // args order: tag, data, children, normalizationType, alwaysNormalize
    // internal version is used by render functions compiled from templates

    vm._c = function (a, b, c, d) {
      return createElement(vm, a, b, c, d, false);
    }; // normalization is always applied for the public version, used in
    // user-written render functions.


    vm.$createElement = function (a, b, c, d) {
      return createElement(vm, a, b, c, d, true);
    }; // $attrs & $listeners are exposed for easier HOC creation.
    // they need to be reactive so that HOCs using them are always updated


    var parentData = parentVnode && parentVnode.data;
    /* istanbul ignore else */

    {
      defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
      defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
    }
  }

  var currentRenderingInstance = null;

  function renderMixin(Vue) {
    // install runtime convenience helpers
    installRenderHelpers(Vue.prototype);

    Vue.prototype.$nextTick = function (fn) {
      return nextTick(fn, this);
    };

    Vue.prototype._render = function () {
      var vm = this;
      var ref = vm.$options;
      var render = ref.render;
      var _parentVnode = ref._parentVnode;

      if (_parentVnode) {
        vm.$scopedSlots = normalizeScopedSlots(_parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
      } // set parent vnode. this allows render functions to have access
      // to the data on the placeholder node.


      vm.$vnode = _parentVnode; // render self

      var vnode;

      try {
        // There's no need to maintain a stack because all render fns are called
        // separately from one another. Nested component's render fns are called
        // when parent component is patched.
        currentRenderingInstance = vm;
        vnode = render.call(vm._renderProxy, vm.$createElement);
      } catch (e) {
        handleError(e, vm, "render"); // return error render result,
        // or previous vnode to prevent render error causing blank component

        /* istanbul ignore else */

        {
          vnode = vm._vnode;
        }
      } finally {
        currentRenderingInstance = null;
      } // if the returned array contains only a single node, allow it


      if (Array.isArray(vnode) && vnode.length === 1) {
        vnode = vnode[0];
      } // return empty vnode in case the render function errored out


      if (!(vnode instanceof VNode)) {

        vnode = createEmptyVNode();
      } // set parent


      vnode.parent = _parentVnode;
      return vnode;
    };
  }
  /*  */


  function ensureCtor(comp, base) {
    if (comp.__esModule || hasSymbol && comp[Symbol.toStringTag] === 'Module') {
      comp = comp.default;
    }

    return isObject(comp) ? base.extend(comp) : comp;
  }

  function createAsyncPlaceholder(factory, data, context, children, tag) {
    var node = createEmptyVNode();
    node.asyncFactory = factory;
    node.asyncMeta = {
      data: data,
      context: context,
      children: children,
      tag: tag
    };
    return node;
  }

  function resolveAsyncComponent(factory, baseCtor) {
    if (isTrue(factory.error) && isDef(factory.errorComp)) {
      return factory.errorComp;
    }

    if (isDef(factory.resolved)) {
      return factory.resolved;
    }

    var owner = currentRenderingInstance;

    if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
      // already pending
      factory.owners.push(owner);
    }

    if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
      return factory.loadingComp;
    }

    if (owner && !isDef(factory.owners)) {
      var owners = factory.owners = [owner];
      var sync = true;
      var timerLoading = null;
      var timerTimeout = null;
      owner.$on('hook:destroyed', function () {
        return remove(owners, owner);
      });

      var forceRender = function (renderCompleted) {
        for (var i = 0, l = owners.length; i < l; i++) {
          owners[i].$forceUpdate();
        }

        if (renderCompleted) {
          owners.length = 0;

          if (timerLoading !== null) {
            clearTimeout(timerLoading);
            timerLoading = null;
          }

          if (timerTimeout !== null) {
            clearTimeout(timerTimeout);
            timerTimeout = null;
          }
        }
      };

      var resolve = once(function (res) {
        // cache resolved
        factory.resolved = ensureCtor(res, baseCtor); // invoke callbacks only if this is not a synchronous resolve
        // (async resolves are shimmed as synchronous during SSR)

        if (!sync) {
          forceRender(true);
        } else {
          owners.length = 0;
        }
      });
      var reject = once(function (reason) {

        if (isDef(factory.errorComp)) {
          factory.error = true;
          forceRender(true);
        }
      });
      var res = factory(resolve, reject);

      if (isObject(res)) {
        if (isPromise(res)) {
          // () => Promise
          if (isUndef(factory.resolved)) {
            res.then(resolve, reject);
          }
        } else if (isPromise(res.component)) {
          res.component.then(resolve, reject);

          if (isDef(res.error)) {
            factory.errorComp = ensureCtor(res.error, baseCtor);
          }

          if (isDef(res.loading)) {
            factory.loadingComp = ensureCtor(res.loading, baseCtor);

            if (res.delay === 0) {
              factory.loading = true;
            } else {
              timerLoading = setTimeout(function () {
                timerLoading = null;

                if (isUndef(factory.resolved) && isUndef(factory.error)) {
                  factory.loading = true;
                  forceRender(false);
                }
              }, res.delay || 200);
            }
          }

          if (isDef(res.timeout)) {
            timerTimeout = setTimeout(function () {
              timerTimeout = null;

              if (isUndef(factory.resolved)) {
                reject( null);
              }
            }, res.timeout);
          }
        }
      }

      sync = false; // return in case resolved synchronously

      return factory.loading ? factory.loadingComp : factory.resolved;
    }
  }
  /*  */


  function isAsyncPlaceholder(node) {
    return node.isComment && node.asyncFactory;
  }
  /*  */


  function getFirstComponentChild(children) {
    if (Array.isArray(children)) {
      for (var i = 0; i < children.length; i++) {
        var c = children[i];

        if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
          return c;
        }
      }
    }
  }
  /*  */

  /*  */


  function initEvents(vm) {
    vm._events = Object.create(null);
    vm._hasHookEvent = false; // init parent attached events

    var listeners = vm.$options._parentListeners;

    if (listeners) {
      updateComponentListeners(vm, listeners);
    }
  }

  var target;

  function add(event, fn) {
    target.$on(event, fn);
  }

  function remove$1(event, fn) {
    target.$off(event, fn);
  }

  function createOnceHandler(event, fn) {
    var _target = target;
    return function onceHandler() {
      var res = fn.apply(null, arguments);

      if (res !== null) {
        _target.$off(event, onceHandler);
      }
    };
  }

  function updateComponentListeners(vm, listeners, oldListeners) {
    target = vm;
    updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
    target = undefined;
  }

  function eventsMixin(Vue) {
    var hookRE = /^hook:/;

    Vue.prototype.$on = function (event, fn) {
      var vm = this;

      if (Array.isArray(event)) {
        for (var i = 0, l = event.length; i < l; i++) {
          vm.$on(event[i], fn);
        }
      } else {
        (vm._events[event] || (vm._events[event] = [])).push(fn); // optimize hook:event cost by using a boolean flag marked at registration
        // instead of a hash lookup

        if (hookRE.test(event)) {
          vm._hasHookEvent = true;
        }
      }

      return vm;
    };

    Vue.prototype.$once = function (event, fn) {
      var vm = this;

      function on() {
        vm.$off(event, on);
        fn.apply(vm, arguments);
      }

      on.fn = fn;
      vm.$on(event, on);
      return vm;
    };

    Vue.prototype.$off = function (event, fn) {
      var vm = this; // all

      if (!arguments.length) {
        vm._events = Object.create(null);
        return vm;
      } // array of events


      if (Array.isArray(event)) {
        for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
          vm.$off(event[i$1], fn);
        }

        return vm;
      } // specific event


      var cbs = vm._events[event];

      if (!cbs) {
        return vm;
      }

      if (!fn) {
        vm._events[event] = null;
        return vm;
      } // specific handler


      var cb;
      var i = cbs.length;

      while (i--) {
        cb = cbs[i];

        if (cb === fn || cb.fn === fn) {
          cbs.splice(i, 1);
          break;
        }
      }

      return vm;
    };

    Vue.prototype.$emit = function (event) {
      var vm = this;

      var cbs = vm._events[event];

      if (cbs) {
        cbs = cbs.length > 1 ? toArray(cbs) : cbs;
        var args = toArray(arguments, 1);
        var info = "event handler for \"" + event + "\"";

        for (var i = 0, l = cbs.length; i < l; i++) {
          invokeWithErrorHandling(cbs[i], vm, args, vm, info);
        }
      }

      return vm;
    };
  }
  /*  */


  var activeInstance = null;

  function setActiveInstance(vm) {
    var prevActiveInstance = activeInstance;
    activeInstance = vm;
    return function () {
      activeInstance = prevActiveInstance;
    };
  }

  function initLifecycle(vm) {
    var options = vm.$options; // locate first non-abstract parent

    var parent = options.parent;

    if (parent && !options.abstract) {
      while (parent.$options.abstract && parent.$parent) {
        parent = parent.$parent;
      }

      parent.$children.push(vm);
    }

    vm.$parent = parent;
    vm.$root = parent ? parent.$root : vm;
    vm.$children = [];
    vm.$refs = {};
    vm._watcher = null;
    vm._inactive = null;
    vm._directInactive = false;
    vm._isMounted = false;
    vm._isDestroyed = false;
    vm._isBeingDestroyed = false;
  }

  function lifecycleMixin(Vue) {
    Vue.prototype._update = function (vnode, hydrating) {
      var vm = this;
      var prevEl = vm.$el;
      var prevVnode = vm._vnode;
      var restoreActiveInstance = setActiveInstance(vm);
      vm._vnode = vnode; // Vue.prototype.__patch__ is injected in entry points
      // based on the rendering backend used.

      if (!prevVnode) {
        // initial render
        vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false
        /* removeOnly */
        );
      } else {
        // updates
        vm.$el = vm.__patch__(prevVnode, vnode);
      }

      restoreActiveInstance(); // update __vue__ reference

      if (prevEl) {
        prevEl.__vue__ = null;
      }

      if (vm.$el) {
        vm.$el.__vue__ = vm;
      } // if parent is an HOC, update its $el as well


      if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
        vm.$parent.$el = vm.$el;
      } // updated hook is called by the scheduler to ensure that children are
      // updated in a parent's updated hook.

    };

    Vue.prototype.$forceUpdate = function () {
      var vm = this;

      if (vm._watcher) {
        vm._watcher.update();
      }
    };

    Vue.prototype.$destroy = function () {
      var vm = this;

      if (vm._isBeingDestroyed) {
        return;
      }

      callHook(vm, 'beforeDestroy');
      vm._isBeingDestroyed = true; // remove self from parent

      var parent = vm.$parent;

      if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
        remove(parent.$children, vm);
      } // teardown watchers


      if (vm._watcher) {
        vm._watcher.teardown();
      }

      var i = vm._watchers.length;

      while (i--) {
        vm._watchers[i].teardown();
      } // remove reference from data ob
      // frozen object may not have observer.


      if (vm._data.__ob__) {
        vm._data.__ob__.vmCount--;
      } // call the last hook...


      vm._isDestroyed = true; // invoke destroy hooks on current rendered tree

      vm.__patch__(vm._vnode, null); // fire destroyed hook


      callHook(vm, 'destroyed'); // turn off all instance listeners.

      vm.$off(); // remove __vue__ reference

      if (vm.$el) {
        vm.$el.__vue__ = null;
      } // release circular reference (#6759)


      if (vm.$vnode) {
        vm.$vnode.parent = null;
      }
    };
  }

  function mountComponent(vm, el, hydrating) {
    vm.$el = el;

    if (!vm.$options.render) {
      vm.$options.render = createEmptyVNode;
    }

    callHook(vm, 'beforeMount');
    var updateComponent;
    /* istanbul ignore if */

    {
      updateComponent = function () {
        vm._update(vm._render(), hydrating);
      };
    } // we set this to vm._watcher inside the watcher's constructor
    // since the watcher's initial patch may call $forceUpdate (e.g. inside child
    // component's mounted hook), which relies on vm._watcher being already defined


    new Watcher(vm, updateComponent, noop, {
      before: function before() {
        if (vm._isMounted && !vm._isDestroyed) {
          callHook(vm, 'beforeUpdate');
        }
      }
    }, true
    /* isRenderWatcher */
    );
    hydrating = false; // manually mounted instance, call mounted on self
    // mounted is called for render-created child components in its inserted hook

    if (vm.$vnode == null) {
      vm._isMounted = true;
      callHook(vm, 'mounted');
    }

    return vm;
  }

  function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
    // we need to do this before overwriting $options._renderChildren.
    // check if there are dynamic scopedSlots (hand-written or compiled but with
    // dynamic slot names). Static scoped slots compiled from template has the
    // "$stable" marker.


    var newScopedSlots = parentVnode.data.scopedSlots;
    var oldScopedSlots = vm.$scopedSlots;
    var hasDynamicScopedSlot = !!(newScopedSlots && !newScopedSlots.$stable || oldScopedSlots !== emptyObject && !oldScopedSlots.$stable || newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key); // Any static slot children from the parent may have changed during parent's
    // update. Dynamic scoped slots may also have changed. In such cases, a forced
    // update is necessary to ensure correctness.

    var needsForceUpdate = !!(renderChildren || // has new static slots
    vm.$options._renderChildren || // has old static slots
    hasDynamicScopedSlot);
    vm.$options._parentVnode = parentVnode;
    vm.$vnode = parentVnode; // update vm's placeholder node without re-render

    if (vm._vnode) {
      // update child tree's parent
      vm._vnode.parent = parentVnode;
    }

    vm.$options._renderChildren = renderChildren; // update $attrs and $listeners hash
    // these are also reactive so they may trigger child update if the child
    // used them during render

    vm.$attrs = parentVnode.data.attrs || emptyObject;
    vm.$listeners = listeners || emptyObject; // update props

    if (propsData && vm.$options.props) {
      toggleObserving(false);
      var props = vm._props;
      var propKeys = vm.$options._propKeys || [];

      for (var i = 0; i < propKeys.length; i++) {
        var key = propKeys[i];
        var propOptions = vm.$options.props; // wtf flow?

        props[key] = validateProp(key, propOptions, propsData, vm);
      }

      toggleObserving(true); // keep a copy of raw propsData

      vm.$options.propsData = propsData;
    } // update listeners


    listeners = listeners || emptyObject;
    var oldListeners = vm.$options._parentListeners;
    vm.$options._parentListeners = listeners;
    updateComponentListeners(vm, listeners, oldListeners); // resolve slots + force update if has children

    if (needsForceUpdate) {
      vm.$slots = resolveSlots(renderChildren, parentVnode.context);
      vm.$forceUpdate();
    }
  }

  function isInInactiveTree(vm) {
    while (vm && (vm = vm.$parent)) {
      if (vm._inactive) {
        return true;
      }
    }

    return false;
  }

  function activateChildComponent(vm, direct) {
    if (direct) {
      vm._directInactive = false;

      if (isInInactiveTree(vm)) {
        return;
      }
    } else if (vm._directInactive) {
      return;
    }

    if (vm._inactive || vm._inactive === null) {
      vm._inactive = false;

      for (var i = 0; i < vm.$children.length; i++) {
        activateChildComponent(vm.$children[i]);
      }

      callHook(vm, 'activated');
    }
  }

  function deactivateChildComponent(vm, direct) {
    if (direct) {
      vm._directInactive = true;

      if (isInInactiveTree(vm)) {
        return;
      }
    }

    if (!vm._inactive) {
      vm._inactive = true;

      for (var i = 0; i < vm.$children.length; i++) {
        deactivateChildComponent(vm.$children[i]);
      }

      callHook(vm, 'deactivated');
    }
  }

  function callHook(vm, hook) {
    // #7573 disable dep collection when invoking lifecycle hooks
    pushTarget();
    var handlers = vm.$options[hook];
    var info = hook + " hook";

    if (handlers) {
      for (var i = 0, j = handlers.length; i < j; i++) {
        invokeWithErrorHandling(handlers[i], vm, null, vm, info);
      }
    }

    if (vm._hasHookEvent) {
      vm.$emit('hook:' + hook);
    }

    popTarget();
  }
  var queue = [];
  var activatedChildren = [];
  var has = {};
  var waiting = false;
  var flushing = false;
  var index = 0;
  /**
   * Reset the scheduler's state.
   */

  function resetSchedulerState() {
    index = queue.length = activatedChildren.length = 0;
    has = {};

    waiting = flushing = false;
  } // Async edge case #6566 requires saving the timestamp when event listeners are
  // attached. However, calling performance.now() has a perf overhead especially
  // if the page has thousands of event listeners. Instead, we take a timestamp
  // every time the scheduler flushes and use that for all event listeners
  // attached during that flush.


  var currentFlushTimestamp = 0; // Async edge case fix requires storing an event listener's attach timestamp.

  var getNow = Date.now; // Determine what event timestamp the browser is using. Annoyingly, the
  // timestamp can either be hi-res (relative to page load) or low-res
  // (relative to UNIX epoch), so in order to compare time we have to use the
  // same timestamp type when saving the flush timestamp.
  // All IE versions use low-res event timestamps, and have problematic clock
  // implementations (#9632)

  if (inBrowser && !isIE) {
    var performance = window.performance;

    if (performance && typeof performance.now === 'function' && getNow() > document.createEvent('Event').timeStamp) {
      // if the event timestamp, although evaluated AFTER the Date.now(), is
      // smaller than it, it means the event is using a hi-res timestamp,
      // and we need to use the hi-res version for event listener timestamps as
      // well.
      getNow = function () {
        return performance.now();
      };
    }
  }
  /**
   * Flush both queues and run the watchers.
   */


  function flushSchedulerQueue() {
    currentFlushTimestamp = getNow();
    flushing = true;
    var watcher, id; // Sort queue before flush.
    // This ensures that:
    // 1. Components are updated from parent to child. (because parent is always
    //    created before the child)
    // 2. A component's user watchers are run before its render watcher (because
    //    user watchers are created before the render watcher)
    // 3. If a component is destroyed during a parent component's watcher run,
    //    its watchers can be skipped.

    queue.sort(function (a, b) {
      return a.id - b.id;
    }); // do not cache length because more watchers might be pushed
    // as we run existing watchers

    for (index = 0; index < queue.length; index++) {
      watcher = queue[index];

      if (watcher.before) {
        watcher.before();
      }

      id = watcher.id;
      has[id] = null;
      watcher.run(); // in dev build, check and stop circular updates.
    } // keep copies of post queues before resetting state


    var activatedQueue = activatedChildren.slice();
    var updatedQueue = queue.slice();
    resetSchedulerState(); // call component updated and activated hooks

    callActivatedHooks(activatedQueue);
    callUpdatedHooks(updatedQueue); // devtool hook

    /* istanbul ignore if */

    if (devtools && config.devtools) {
      devtools.emit('flush');
    }
  }

  function callUpdatedHooks(queue) {
    var i = queue.length;

    while (i--) {
      var watcher = queue[i];
      var vm = watcher.vm;

      if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
        callHook(vm, 'updated');
      }
    }
  }
  /**
   * Queue a kept-alive component that was activated during patch.
   * The queue will be processed after the entire tree has been patched.
   */


  function queueActivatedComponent(vm) {
    // setting _inactive to false here so that a render function can
    // rely on checking whether it's in an inactive tree (e.g. router-view)
    vm._inactive = false;
    activatedChildren.push(vm);
  }

  function callActivatedHooks(queue) {
    for (var i = 0; i < queue.length; i++) {
      queue[i]._inactive = true;
      activateChildComponent(queue[i], true
      /* true */
      );
    }
  }
  /**
   * Push a watcher into the watcher queue.
   * Jobs with duplicate IDs will be skipped unless it's
   * pushed when the queue is being flushed.
   */


  function queueWatcher(watcher) {
    var id = watcher.id;

    if (has[id] == null) {
      has[id] = true;

      if (!flushing) {
        queue.push(watcher);
      } else {
        // if already flushing, splice the watcher based on its id
        // if already past its id, it will be run next immediately.
        var i = queue.length - 1;

        while (i > index && queue[i].id > watcher.id) {
          i--;
        }

        queue.splice(i + 1, 0, watcher);
      } // queue the flush


      if (!waiting) {
        waiting = true;

        nextTick(flushSchedulerQueue);
      }
    }
  }
  /*  */


  var uid$2 = 0;
  /**
   * A watcher parses an expression, collects dependencies,
   * and fires callback when the expression value changes.
   * This is used for both the $watch() api and directives.
   */

  var Watcher = function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
    this.vm = vm;

    if (isRenderWatcher) {
      vm._watcher = this;
    }

    vm._watchers.push(this); // options


    if (options) {
      this.deep = !!options.deep;
      this.user = !!options.user;
      this.lazy = !!options.lazy;
      this.sync = !!options.sync;
      this.before = options.before;
    } else {
      this.deep = this.user = this.lazy = this.sync = false;
    }

    this.cb = cb;
    this.id = ++uid$2; // uid for batching

    this.active = true;
    this.dirty = this.lazy; // for lazy watchers

    this.deps = [];
    this.newDeps = [];
    this.depIds = new _Set();
    this.newDepIds = new _Set();
    this.expression =  ''; // parse expression for getter

    if (typeof expOrFn === 'function') {
      this.getter = expOrFn;
    } else {
      this.getter = parsePath(expOrFn);

      if (!this.getter) {
        this.getter = noop;
      }
    }

    this.value = this.lazy ? undefined : this.get();
  };
  /**
   * Evaluate the getter, and re-collect dependencies.
   */


  Watcher.prototype.get = function get() {
    pushTarget(this);
    var value;
    var vm = this.vm;

    try {
      value = this.getter.call(vm, vm);
    } catch (e) {
      if (this.user) {
        handleError(e, vm, "getter for watcher \"" + this.expression + "\"");
      } else {
        throw e;
      }
    } finally {
      // "touch" every property so they are all tracked as
      // dependencies for deep watching
      if (this.deep) {
        traverse(value);
      }

      popTarget();
      this.cleanupDeps();
    }

    return value;
  };
  /**
   * Add a dependency to this directive.
   */


  Watcher.prototype.addDep = function addDep(dep) {
    var id = dep.id;

    if (!this.newDepIds.has(id)) {
      this.newDepIds.add(id);
      this.newDeps.push(dep);

      if (!this.depIds.has(id)) {
        dep.addSub(this);
      }
    }
  };
  /**
   * Clean up for dependency collection.
   */


  Watcher.prototype.cleanupDeps = function cleanupDeps() {
    var i = this.deps.length;

    while (i--) {
      var dep = this.deps[i];

      if (!this.newDepIds.has(dep.id)) {
        dep.removeSub(this);
      }
    }

    var tmp = this.depIds;
    this.depIds = this.newDepIds;
    this.newDepIds = tmp;
    this.newDepIds.clear();
    tmp = this.deps;
    this.deps = this.newDeps;
    this.newDeps = tmp;
    this.newDeps.length = 0;
  };
  /**
   * Subscriber interface.
   * Will be called when a dependency changes.
   */


  Watcher.prototype.update = function update() {
    /* istanbul ignore else */
    if (this.lazy) {
      this.dirty = true;
    } else if (this.sync) {
      this.run();
    } else {
      queueWatcher(this);
    }
  };
  /**
   * Scheduler job interface.
   * Will be called by the scheduler.
   */


  Watcher.prototype.run = function run() {
    if (this.active) {
      var value = this.get();

      if (value !== this.value || // Deep watchers and watchers on Object/Arrays should fire even
      // when the value is the same, because the value may
      // have mutated.
      isObject(value) || this.deep) {
        // set new value
        var oldValue = this.value;
        this.value = value;

        if (this.user) {
          try {
            this.cb.call(this.vm, value, oldValue);
          } catch (e) {
            handleError(e, this.vm, "callback for watcher \"" + this.expression + "\"");
          }
        } else {
          this.cb.call(this.vm, value, oldValue);
        }
      }
    }
  };
  /**
   * Evaluate the value of the watcher.
   * This only gets called for lazy watchers.
   */


  Watcher.prototype.evaluate = function evaluate() {
    this.value = this.get();
    this.dirty = false;
  };
  /**
   * Depend on all deps collected by this watcher.
   */


  Watcher.prototype.depend = function depend() {
    var i = this.deps.length;

    while (i--) {
      this.deps[i].depend();
    }
  };
  /**
   * Remove self from all dependencies' subscriber list.
   */


  Watcher.prototype.teardown = function teardown() {
    if (this.active) {
      // remove self from vm's watcher list
      // this is a somewhat expensive operation so we skip it
      // if the vm is being destroyed.
      if (!this.vm._isBeingDestroyed) {
        remove(this.vm._watchers, this);
      }

      var i = this.deps.length;

      while (i--) {
        this.deps[i].removeSub(this);
      }

      this.active = false;
    }
  };
  /*  */


  var sharedPropertyDefinition = {
    enumerable: true,
    configurable: true,
    get: noop,
    set: noop
  };

  function proxy(target, sourceKey, key) {
    sharedPropertyDefinition.get = function proxyGetter() {
      return this[sourceKey][key];
    };

    sharedPropertyDefinition.set = function proxySetter(val) {
      this[sourceKey][key] = val;
    };

    Object.defineProperty(target, key, sharedPropertyDefinition);
  }

  function initState(vm) {
    vm._watchers = [];
    var opts = vm.$options;

    if (opts.props) {
      initProps(vm, opts.props);
    }

    if (opts.methods) {
      initMethods(vm, opts.methods);
    }

    if (opts.data) {
      initData(vm);
    } else {
      observe(vm._data = {}, true
      /* asRootData */
      );
    }

    if (opts.computed) {
      initComputed(vm, opts.computed);
    }

    if (opts.watch && opts.watch !== nativeWatch) {
      initWatch(vm, opts.watch);
    }
  }

  function initProps(vm, propsOptions) {
    var propsData = vm.$options.propsData || {};
    var props = vm._props = {}; // cache prop keys so that future props updates can iterate using Array
    // instead of dynamic object key enumeration.

    var keys = vm.$options._propKeys = [];
    var isRoot = !vm.$parent; // root instance props should be converted

    if (!isRoot) {
      toggleObserving(false);
    }

    var loop = function (key) {
      keys.push(key);
      var value = validateProp(key, propsOptions, propsData, vm);
      /* istanbul ignore else */

      {
        defineReactive$$1(props, key, value);
      } // static props are already proxied on the component's prototype
      // during Vue.extend(). We only need to proxy props defined at
      // instantiation here.


      if (!(key in vm)) {
        proxy(vm, "_props", key);
      }
    };

    for (var key in propsOptions) loop(key);

    toggleObserving(true);
  }

  function initData(vm) {
    var data = vm.$options.data;
    data = vm._data = typeof data === 'function' ? getData(data, vm) : data || {};

    if (!isPlainObject(data)) {
      data = {};
    } // proxy data on instance


    var keys = Object.keys(data);
    var props = vm.$options.props;
    var methods = vm.$options.methods;
    var i = keys.length;

    while (i--) {
      var key = keys[i];

      if (props && hasOwn(props, key)) ; else if (!isReserved(key)) {
        proxy(vm, "_data", key);
      }
    } // observe data


    observe(data, true
    /* asRootData */
    );
  }

  function getData(data, vm) {
    // #7573 disable dep collection when invoking data getters
    pushTarget();

    try {
      return data.call(vm, vm);
    } catch (e) {
      handleError(e, vm, "data()");
      return {};
    } finally {
      popTarget();
    }
  }

  var computedWatcherOptions = {
    lazy: true
  };

  function initComputed(vm, computed) {
    // $flow-disable-line
    var watchers = vm._computedWatchers = Object.create(null); // computed properties are just getters during SSR

    var isSSR = isServerRendering();

    for (var key in computed) {
      var userDef = computed[key];
      var getter = typeof userDef === 'function' ? userDef : userDef.get;

      if (!isSSR) {
        // create internal watcher for the computed property.
        watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
      } // component-defined computed properties are already defined on the
      // component prototype. We only need to define computed properties defined
      // at instantiation here.


      if (!(key in vm)) {
        defineComputed(vm, key, userDef);
      }
    }
  }

  function defineComputed(target, key, userDef) {
    var shouldCache = !isServerRendering();

    if (typeof userDef === 'function') {
      sharedPropertyDefinition.get = shouldCache ? createComputedGetter(key) : createGetterInvoker(userDef);
      sharedPropertyDefinition.set = noop;
    } else {
      sharedPropertyDefinition.get = userDef.get ? shouldCache && userDef.cache !== false ? createComputedGetter(key) : createGetterInvoker(userDef.get) : noop;
      sharedPropertyDefinition.set = userDef.set || noop;
    }

    Object.defineProperty(target, key, sharedPropertyDefinition);
  }

  function createComputedGetter(key) {
    return function computedGetter() {
      var watcher = this._computedWatchers && this._computedWatchers[key];

      if (watcher) {
        if (watcher.dirty) {
          watcher.evaluate();
        }

        if (Dep.target) {
          watcher.depend();
        }

        return watcher.value;
      }
    };
  }

  function createGetterInvoker(fn) {
    return function computedGetter() {
      return fn.call(this, this);
    };
  }

  function initMethods(vm, methods) {
    var props = vm.$options.props;

    for (var key in methods) {

      vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
    }
  }

  function initWatch(vm, watch) {
    for (var key in watch) {
      var handler = watch[key];

      if (Array.isArray(handler)) {
        for (var i = 0; i < handler.length; i++) {
          createWatcher(vm, key, handler[i]);
        }
      } else {
        createWatcher(vm, key, handler);
      }
    }
  }

  function createWatcher(vm, expOrFn, handler, options) {
    if (isPlainObject(handler)) {
      options = handler;
      handler = handler.handler;
    }

    if (typeof handler === 'string') {
      handler = vm[handler];
    }

    return vm.$watch(expOrFn, handler, options);
  }

  function stateMixin(Vue) {
    // flow somehow has problems with directly declared definition object
    // when using Object.defineProperty, so we have to procedurally build up
    // the object here.
    var dataDef = {};

    dataDef.get = function () {
      return this._data;
    };

    var propsDef = {};

    propsDef.get = function () {
      return this._props;
    };

    Object.defineProperty(Vue.prototype, '$data', dataDef);
    Object.defineProperty(Vue.prototype, '$props', propsDef);
    Vue.prototype.$set = set;
    Vue.prototype.$delete = del;

    Vue.prototype.$watch = function (expOrFn, cb, options) {
      var vm = this;

      if (isPlainObject(cb)) {
        return createWatcher(vm, expOrFn, cb, options);
      }

      options = options || {};
      options.user = true;
      var watcher = new Watcher(vm, expOrFn, cb, options);

      if (options.immediate) {
        try {
          cb.call(vm, watcher.value);
        } catch (error) {
          handleError(error, vm, "callback for immediate watcher \"" + watcher.expression + "\"");
        }
      }

      return function unwatchFn() {
        watcher.teardown();
      };
    };
  }
  /*  */


  var uid$3 = 0;

  function initMixin(Vue) {
    Vue.prototype._init = function (options) {
      var vm = this; // a uid

      vm._uid = uid$3++;


      vm._isVue = true; // merge options

      if (options && options._isComponent) {
        // optimize internal component instantiation
        // since dynamic options merging is pretty slow, and none of the
        // internal component options needs special treatment.
        initInternalComponent(vm, options);
      } else {
        vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
      }
      /* istanbul ignore else */


      {
        vm._renderProxy = vm;
      } // expose real self


      vm._self = vm;
      initLifecycle(vm);
      initEvents(vm);
      initRender(vm);
      callHook(vm, 'beforeCreate');
      initInjections(vm); // resolve injections before data/props

      initState(vm);
      initProvide(vm); // resolve provide after data/props

      callHook(vm, 'created');

      if (vm.$options.el) {
        vm.$mount(vm.$options.el);
      }
    };
  }

  function initInternalComponent(vm, options) {
    var opts = vm.$options = Object.create(vm.constructor.options); // doing this because it's faster than dynamic enumeration.

    var parentVnode = options._parentVnode;
    opts.parent = options.parent;
    opts._parentVnode = parentVnode;
    var vnodeComponentOptions = parentVnode.componentOptions;
    opts.propsData = vnodeComponentOptions.propsData;
    opts._parentListeners = vnodeComponentOptions.listeners;
    opts._renderChildren = vnodeComponentOptions.children;
    opts._componentTag = vnodeComponentOptions.tag;

    if (options.render) {
      opts.render = options.render;
      opts.staticRenderFns = options.staticRenderFns;
    }
  }

  function resolveConstructorOptions(Ctor) {
    var options = Ctor.options;

    if (Ctor.super) {
      var superOptions = resolveConstructorOptions(Ctor.super);
      var cachedSuperOptions = Ctor.superOptions;

      if (superOptions !== cachedSuperOptions) {
        // super option changed,
        // need to resolve new options.
        Ctor.superOptions = superOptions; // check if there are any late-modified/attached options (#4976)

        var modifiedOptions = resolveModifiedOptions(Ctor); // update base extend options

        if (modifiedOptions) {
          extend(Ctor.extendOptions, modifiedOptions);
        }

        options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);

        if (options.name) {
          options.components[options.name] = Ctor;
        }
      }
    }

    return options;
  }

  function resolveModifiedOptions(Ctor) {
    var modified;
    var latest = Ctor.options;
    var sealed = Ctor.sealedOptions;

    for (var key in latest) {
      if (latest[key] !== sealed[key]) {
        if (!modified) {
          modified = {};
        }

        modified[key] = latest[key];
      }
    }

    return modified;
  }

  function Vue(options) {

    this._init(options);
  }

  initMixin(Vue);
  stateMixin(Vue);
  eventsMixin(Vue);
  lifecycleMixin(Vue);
  renderMixin(Vue);
  /*  */

  function initUse(Vue) {
    Vue.use = function (plugin) {
      var installedPlugins = this._installedPlugins || (this._installedPlugins = []);

      if (installedPlugins.indexOf(plugin) > -1) {
        return this;
      } // additional parameters


      var args = toArray(arguments, 1);
      args.unshift(this);

      if (typeof plugin.install === 'function') {
        plugin.install.apply(plugin, args);
      } else if (typeof plugin === 'function') {
        plugin.apply(null, args);
      }

      installedPlugins.push(plugin);
      return this;
    };
  }
  /*  */


  function initMixin$1(Vue) {
    Vue.mixin = function (mixin) {
      this.options = mergeOptions(this.options, mixin);
      return this;
    };
  }
  /*  */


  function initExtend(Vue) {
    /**
     * Each instance constructor, including Vue, has a unique
     * cid. This enables us to create wrapped "child
     * constructors" for prototypal inheritance and cache them.
     */
    Vue.cid = 0;
    var cid = 1;
    /**
     * Class inheritance
     */

    Vue.extend = function (extendOptions) {
      extendOptions = extendOptions || {};
      var Super = this;
      var SuperId = Super.cid;
      var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});

      if (cachedCtors[SuperId]) {
        return cachedCtors[SuperId];
      }

      var name = extendOptions.name || Super.options.name;

      var Sub = function VueComponent(options) {
        this._init(options);
      };

      Sub.prototype = Object.create(Super.prototype);
      Sub.prototype.constructor = Sub;
      Sub.cid = cid++;
      Sub.options = mergeOptions(Super.options, extendOptions);
      Sub['super'] = Super; // For props and computed properties, we define the proxy getters on
      // the Vue instances at extension time, on the extended prototype. This
      // avoids Object.defineProperty calls for each instance created.

      if (Sub.options.props) {
        initProps$1(Sub);
      }

      if (Sub.options.computed) {
        initComputed$1(Sub);
      } // allow further extension/mixin/plugin usage


      Sub.extend = Super.extend;
      Sub.mixin = Super.mixin;
      Sub.use = Super.use; // create asset registers, so extended classes
      // can have their private assets too.

      ASSET_TYPES.forEach(function (type) {
        Sub[type] = Super[type];
      }); // enable recursive self-lookup

      if (name) {
        Sub.options.components[name] = Sub;
      } // keep a reference to the super options at extension time.
      // later at instantiation we can check if Super's options have
      // been updated.


      Sub.superOptions = Super.options;
      Sub.extendOptions = extendOptions;
      Sub.sealedOptions = extend({}, Sub.options); // cache constructor

      cachedCtors[SuperId] = Sub;
      return Sub;
    };
  }

  function initProps$1(Comp) {
    var props = Comp.options.props;

    for (var key in props) {
      proxy(Comp.prototype, "_props", key);
    }
  }

  function initComputed$1(Comp) {
    var computed = Comp.options.computed;

    for (var key in computed) {
      defineComputed(Comp.prototype, key, computed[key]);
    }
  }
  /*  */


  function initAssetRegisters(Vue) {
    /**
     * Create asset registration methods.
     */
    ASSET_TYPES.forEach(function (type) {
      Vue[type] = function (id, definition) {
        if (!definition) {
          return this.options[type + 's'][id];
        } else {

          if (type === 'component' && isPlainObject(definition)) {
            definition.name = definition.name || id;
            definition = this.options._base.extend(definition);
          }

          if (type === 'directive' && typeof definition === 'function') {
            definition = {
              bind: definition,
              update: definition
            };
          }

          this.options[type + 's'][id] = definition;
          return definition;
        }
      };
    });
  }
  /*  */


  function getComponentName(opts) {
    return opts && (opts.Ctor.options.name || opts.tag);
  }

  function matches(pattern, name) {
    if (Array.isArray(pattern)) {
      return pattern.indexOf(name) > -1;
    } else if (typeof pattern === 'string') {
      return pattern.split(',').indexOf(name) > -1;
    } else if (isRegExp(pattern)) {
      return pattern.test(name);
    }
    /* istanbul ignore next */


    return false;
  }

  function pruneCache(keepAliveInstance, filter) {
    var cache = keepAliveInstance.cache;
    var keys = keepAliveInstance.keys;
    var _vnode = keepAliveInstance._vnode;

    for (var key in cache) {
      var cachedNode = cache[key];

      if (cachedNode) {
        var name = getComponentName(cachedNode.componentOptions);

        if (name && !filter(name)) {
          pruneCacheEntry(cache, key, keys, _vnode);
        }
      }
    }
  }

  function pruneCacheEntry(cache, key, keys, current) {
    var cached$$1 = cache[key];

    if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
      cached$$1.componentInstance.$destroy();
    }

    cache[key] = null;
    remove(keys, key);
  }

  var patternTypes = [String, RegExp, Array];
  var KeepAlive = {
    name: 'keep-alive',
    abstract: true,
    props: {
      include: patternTypes,
      exclude: patternTypes,
      max: [String, Number]
    },
    created: function created() {
      this.cache = Object.create(null);
      this.keys = [];
    },
    destroyed: function destroyed() {
      for (var key in this.cache) {
        pruneCacheEntry(this.cache, key, this.keys);
      }
    },
    mounted: function mounted() {
      var this$1 = this;
      this.$watch('include', function (val) {
        pruneCache(this$1, function (name) {
          return matches(val, name);
        });
      });
      this.$watch('exclude', function (val) {
        pruneCache(this$1, function (name) {
          return !matches(val, name);
        });
      });
    },
    render: function render() {
      var slot = this.$slots.default;
      var vnode = getFirstComponentChild(slot);
      var componentOptions = vnode && vnode.componentOptions;

      if (componentOptions) {
        // check pattern
        var name = getComponentName(componentOptions);
        var ref = this;
        var include = ref.include;
        var exclude = ref.exclude;

        if ( // not included
        include && (!name || !matches(include, name)) || // excluded
        exclude && name && matches(exclude, name)) {
          return vnode;
        }

        var ref$1 = this;
        var cache = ref$1.cache;
        var keys = ref$1.keys;
        var key = vnode.key == null // same constructor may get registered as different local components
        // so cid alone is not enough (#3269)
        ? componentOptions.Ctor.cid + (componentOptions.tag ? "::" + componentOptions.tag : '') : vnode.key;

        if (cache[key]) {
          vnode.componentInstance = cache[key].componentInstance; // make current key freshest

          remove(keys, key);
          keys.push(key);
        } else {
          cache[key] = vnode;
          keys.push(key); // prune oldest entry

          if (this.max && keys.length > parseInt(this.max)) {
            pruneCacheEntry(cache, keys[0], keys, this._vnode);
          }
        }

        vnode.data.keepAlive = true;
      }

      return vnode || slot && slot[0];
    }
  };
  var builtInComponents = {
    KeepAlive: KeepAlive
  };
  /*  */

  function initGlobalAPI(Vue) {
    // config
    var configDef = {};

    configDef.get = function () {
      return config;
    };

    Object.defineProperty(Vue, 'config', configDef); // exposed util methods.
    // NOTE: these are not considered part of the public API - avoid relying on
    // them unless you are aware of the risk.

    Vue.util = {
      warn: warn,
      extend: extend,
      mergeOptions: mergeOptions,
      defineReactive: defineReactive$$1
    };
    Vue.set = set;
    Vue.delete = del;
    Vue.nextTick = nextTick; // 2.6 explicit observable API

    Vue.observable = function (obj) {
      observe(obj);
      return obj;
    };

    Vue.options = Object.create(null);
    ASSET_TYPES.forEach(function (type) {
      Vue.options[type + 's'] = Object.create(null);
    }); // this is used to identify the "base" constructor to extend all plain-object
    // components with in Weex's multi-instance scenarios.

    Vue.options._base = Vue;
    extend(Vue.options.components, builtInComponents);
    initUse(Vue);
    initMixin$1(Vue);
    initExtend(Vue);
    initAssetRegisters(Vue);
  }

  initGlobalAPI(Vue);
  Object.defineProperty(Vue.prototype, '$isServer', {
    get: isServerRendering
  });
  Object.defineProperty(Vue.prototype, '$ssrContext', {
    get: function get() {
      /* istanbul ignore next */
      return this.$vnode && this.$vnode.ssrContext;
    }
  }); // expose FunctionalRenderContext for ssr runtime helper installation

  Object.defineProperty(Vue, 'FunctionalRenderContext', {
    value: FunctionalRenderContext
  });
  Vue.version = '2.6.12';
  /*  */
  // these are reserved for web because they are directly compiled away
  // during template compilation

  var isReservedAttr = makeMap('style,class'); // attributes that should be using props for binding

  var acceptValue = makeMap('input,textarea,option,select,progress');

  var mustUseProp = function (tag, type, attr) {
    return attr === 'value' && acceptValue(tag) && type !== 'button' || attr === 'selected' && tag === 'option' || attr === 'checked' && tag === 'input' || attr === 'muted' && tag === 'video';
  };

  var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');

  var convertEnumeratedValue = function (key, value) {
    return isFalsyAttrValue(value) || value === 'false' ? 'false' // allow arbitrary string value for contenteditable
    : key === 'contenteditable' && isValidContentEditableValue(value) ? value : 'true';
  };

  var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + 'required,reversed,scoped,seamless,selected,sortable,translate,' + 'truespeed,typemustmatch,visible');
  var xlinkNS = 'http://www.w3.org/1999/xlink';

  var isXlink = function (name) {
    return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
  };

  var getXlinkProp = function (name) {
    return isXlink(name) ? name.slice(6, name.length) : '';
  };

  var isFalsyAttrValue = function (val) {
    return val == null || val === false;
  };
  /*  */


  function genClassForVnode(vnode) {
    var data = vnode.data;
    var parentNode = vnode;
    var childNode = vnode;

    while (isDef(childNode.componentInstance)) {
      childNode = childNode.componentInstance._vnode;

      if (childNode && childNode.data) {
        data = mergeClassData(childNode.data, data);
      }
    }

    while (isDef(parentNode = parentNode.parent)) {
      if (parentNode && parentNode.data) {
        data = mergeClassData(data, parentNode.data);
      }
    }

    return renderClass(data.staticClass, data.class);
  }

  function mergeClassData(child, parent) {
    return {
      staticClass: concat(child.staticClass, parent.staticClass),
      class: isDef(child.class) ? [child.class, parent.class] : parent.class
    };
  }

  function renderClass(staticClass, dynamicClass) {
    if (isDef(staticClass) || isDef(dynamicClass)) {
      return concat(staticClass, stringifyClass(dynamicClass));
    }
    /* istanbul ignore next */


    return '';
  }

  function concat(a, b) {
    return a ? b ? a + ' ' + b : a : b || '';
  }

  function stringifyClass(value) {
    if (Array.isArray(value)) {
      return stringifyArray(value);
    }

    if (isObject(value)) {
      return stringifyObject(value);
    }

    if (typeof value === 'string') {
      return value;
    }
    /* istanbul ignore next */


    return '';
  }

  function stringifyArray(value) {
    var res = '';
    var stringified;

    for (var i = 0, l = value.length; i < l; i++) {
      if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
        if (res) {
          res += ' ';
        }

        res += stringified;
      }
    }

    return res;
  }

  function stringifyObject(value) {
    var res = '';

    for (var key in value) {
      if (value[key]) {
        if (res) {
          res += ' ';
        }

        res += key;
      }
    }

    return res;
  }
  /*  */


  var namespaceMap = {
    svg: 'http://www.w3.org/2000/svg',
    math: 'http://www.w3.org/1998/Math/MathML'
  };
  var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' + 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' + 'embed,object,param,source,canvas,script,noscript,del,ins,' + 'caption,col,colgroup,table,thead,tbody,td,th,tr,' + 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + 'output,progress,select,textarea,' + 'details,dialog,menu,menuitem,summary,' + 'content,element,shadow,template,blockquote,iframe,tfoot'); // this map is intentionally selective, only covering SVG elements that may
  // contain child elements.

  var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);

  var isReservedTag = function (tag) {
    return isHTMLTag(tag) || isSVG(tag);
  };

  function getTagNamespace(tag) {
    if (isSVG(tag)) {
      return 'svg';
    } // basic support for MathML
    // note it doesn't support other MathML elements being component roots


    if (tag === 'math') {
      return 'math';
    }
  }

  var unknownElementCache = Object.create(null);

  function isUnknownElement(tag) {
    /* istanbul ignore if */
    if (!inBrowser) {
      return true;
    }

    if (isReservedTag(tag)) {
      return false;
    }

    tag = tag.toLowerCase();
    /* istanbul ignore if */

    if (unknownElementCache[tag] != null) {
      return unknownElementCache[tag];
    }

    var el = document.createElement(tag);

    if (tag.indexOf('-') > -1) {
      // http://stackoverflow.com/a/28210364/1070244
      return unknownElementCache[tag] = el.constructor === window.HTMLUnknownElement || el.constructor === window.HTMLElement;
    } else {
      return unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString());
    }
  }

  var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  /*  */

  /**
   * Query an element selector if it's not an element already.
   */

  function query(el) {
    if (typeof el === 'string') {
      var selected = document.querySelector(el);

      if (!selected) {
        return document.createElement('div');
      }

      return selected;
    } else {
      return el;
    }
  }
  /*  */


  function createElement$1(tagName, vnode) {
    var elm = document.createElement(tagName);

    if (tagName !== 'select') {
      return elm;
    } // false or null will remove the attribute but undefined will not


    if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
      elm.setAttribute('multiple', 'multiple');
    }

    return elm;
  }

  function createElementNS(namespace, tagName) {
    return document.createElementNS(namespaceMap[namespace], tagName);
  }

  function createTextNode(text) {
    return document.createTextNode(text);
  }

  function createComment(text) {
    return document.createComment(text);
  }

  function insertBefore(parentNode, newNode, referenceNode) {
    parentNode.insertBefore(newNode, referenceNode);
  }

  function removeChild(node, child) {
    node.removeChild(child);
  }

  function appendChild(node, child) {
    node.appendChild(child);
  }

  function parentNode(node) {
    return node.parentNode;
  }

  function nextSibling(node) {
    return node.nextSibling;
  }

  function tagName(node) {
    return node.tagName;
  }

  function setTextContent(node, text) {
    node.textContent = text;
  }

  function setStyleScope(node, scopeId) {
    node.setAttribute(scopeId, '');
  }

  var nodeOps = /*#__PURE__*/Object.freeze({
    createElement: createElement$1,
    createElementNS: createElementNS,
    createTextNode: createTextNode,
    createComment: createComment,
    insertBefore: insertBefore,
    removeChild: removeChild,
    appendChild: appendChild,
    parentNode: parentNode,
    nextSibling: nextSibling,
    tagName: tagName,
    setTextContent: setTextContent,
    setStyleScope: setStyleScope
  });
  /*  */

  var ref = {
    create: function create(_, vnode) {
      registerRef(vnode);
    },
    update: function update(oldVnode, vnode) {
      if (oldVnode.data.ref !== vnode.data.ref) {
        registerRef(oldVnode, true);
        registerRef(vnode);
      }
    },
    destroy: function destroy(vnode) {
      registerRef(vnode, true);
    }
  };

  function registerRef(vnode, isRemoval) {
    var key = vnode.data.ref;

    if (!isDef(key)) {
      return;
    }

    var vm = vnode.context;
    var ref = vnode.componentInstance || vnode.elm;
    var refs = vm.$refs;

    if (isRemoval) {
      if (Array.isArray(refs[key])) {
        remove(refs[key], ref);
      } else if (refs[key] === ref) {
        refs[key] = undefined;
      }
    } else {
      if (vnode.data.refInFor) {
        if (!Array.isArray(refs[key])) {
          refs[key] = [ref];
        } else if (refs[key].indexOf(ref) < 0) {
          // $flow-disable-line
          refs[key].push(ref);
        }
      } else {
        refs[key] = ref;
      }
    }
  }
  /**
   * Virtual DOM patching algorithm based on Snabbdom by
   * Simon Friis Vindum (@paldepind)
   * Licensed under the MIT License
   * https://github.com/paldepind/snabbdom/blob/master/LICENSE
   *
   * modified by Evan You (@yyx990803)
   *
   * Not type-checking this because this file is perf-critical and the cost
   * of making flow understand it is not worth it.
   */


  var emptyNode = new VNode('', {}, []);
  var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];

  function sameVnode(a, b) {
    return a.key === b.key && (a.tag === b.tag && a.isComment === b.isComment && isDef(a.data) === isDef(b.data) && sameInputType(a, b) || isTrue(a.isAsyncPlaceholder) && a.asyncFactory === b.asyncFactory && isUndef(b.asyncFactory.error));
  }

  function sameInputType(a, b) {
    if (a.tag !== 'input') {
      return true;
    }

    var i;
    var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
    var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
    return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB);
  }

  function createKeyToOldIdx(children, beginIdx, endIdx) {
    var i, key;
    var map = {};

    for (i = beginIdx; i <= endIdx; ++i) {
      key = children[i].key;

      if (isDef(key)) {
        map[key] = i;
      }
    }

    return map;
  }

  function createPatchFunction(backend) {
    var i, j;
    var cbs = {};
    var modules = backend.modules;
    var nodeOps = backend.nodeOps;

    for (i = 0; i < hooks.length; ++i) {
      cbs[hooks[i]] = [];

      for (j = 0; j < modules.length; ++j) {
        if (isDef(modules[j][hooks[i]])) {
          cbs[hooks[i]].push(modules[j][hooks[i]]);
        }
      }
    }

    function emptyNodeAt(elm) {
      return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
    }

    function createRmCb(childElm, listeners) {
      function remove$$1() {
        if (--remove$$1.listeners === 0) {
          removeNode(childElm);
        }
      }

      remove$$1.listeners = listeners;
      return remove$$1;
    }

    function removeNode(el) {
      var parent = nodeOps.parentNode(el); // element may have already been removed due to v-html / v-text

      if (isDef(parent)) {
        nodeOps.removeChild(parent, el);
      }
    }

    function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
      if (isDef(vnode.elm) && isDef(ownerArray)) {
        // This vnode was used in a previous render!
        // now it's used as a new node, overwriting its elm would cause
        // potential patch errors down the road when it's used as an insertion
        // reference node. Instead, we clone the node on-demand before creating
        // associated DOM element for it.
        vnode = ownerArray[index] = cloneVNode(vnode);
      }

      vnode.isRootInsert = !nested; // for transition enter check

      if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
        return;
      }

      var data = vnode.data;
      var children = vnode.children;
      var tag = vnode.tag;

      if (isDef(tag)) {

        vnode.elm = vnode.ns ? nodeOps.createElementNS(vnode.ns, tag) : nodeOps.createElement(tag, vnode);
        setScope(vnode);
        /* istanbul ignore if */

        {
          createChildren(vnode, children, insertedVnodeQueue);

          if (isDef(data)) {
            invokeCreateHooks(vnode, insertedVnodeQueue);
          }

          insert(parentElm, vnode.elm, refElm);
        }
      } else if (isTrue(vnode.isComment)) {
        vnode.elm = nodeOps.createComment(vnode.text);
        insert(parentElm, vnode.elm, refElm);
      } else {
        vnode.elm = nodeOps.createTextNode(vnode.text);
        insert(parentElm, vnode.elm, refElm);
      }
    }

    function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
      var i = vnode.data;

      if (isDef(i)) {
        var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;

        if (isDef(i = i.hook) && isDef(i = i.init)) {
          i(vnode, false
          /* hydrating */
          );
        } // after calling the init hook, if the vnode is a child component
        // it should've created a child instance and mounted it. the child
        // component also has set the placeholder vnode's elm.
        // in that case we can just return the element and be done.


        if (isDef(vnode.componentInstance)) {
          initComponent(vnode, insertedVnodeQueue);
          insert(parentElm, vnode.elm, refElm);

          if (isTrue(isReactivated)) {
            reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
          }

          return true;
        }
      }
    }

    function initComponent(vnode, insertedVnodeQueue) {
      if (isDef(vnode.data.pendingInsert)) {
        insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
        vnode.data.pendingInsert = null;
      }

      vnode.elm = vnode.componentInstance.$el;

      if (isPatchable(vnode)) {
        invokeCreateHooks(vnode, insertedVnodeQueue);
        setScope(vnode);
      } else {
        // empty component root.
        // skip all element-related modules except for ref (#3455)
        registerRef(vnode); // make sure to invoke the insert hook

        insertedVnodeQueue.push(vnode);
      }
    }

    function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
      var i; // hack for #4339: a reactivated component with inner transition
      // does not trigger because the inner node's created hooks are not called
      // again. It's not ideal to involve module-specific logic in here but
      // there doesn't seem to be a better way to do it.

      var innerNode = vnode;

      while (innerNode.componentInstance) {
        innerNode = innerNode.componentInstance._vnode;

        if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
          for (i = 0; i < cbs.activate.length; ++i) {
            cbs.activate[i](emptyNode, innerNode);
          }

          insertedVnodeQueue.push(innerNode);
          break;
        }
      } // unlike a newly created component,
      // a reactivated keep-alive component doesn't insert itself


      insert(parentElm, vnode.elm, refElm);
    }

    function insert(parent, elm, ref$$1) {
      if (isDef(parent)) {
        if (isDef(ref$$1)) {
          if (nodeOps.parentNode(ref$$1) === parent) {
            nodeOps.insertBefore(parent, elm, ref$$1);
          }
        } else {
          nodeOps.appendChild(parent, elm);
        }
      }
    }

    function createChildren(vnode, children, insertedVnodeQueue) {
      if (Array.isArray(children)) {

        for (var i = 0; i < children.length; ++i) {
          createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
        }
      } else if (isPrimitive(vnode.text)) {
        nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
      }
    }

    function isPatchable(vnode) {
      while (vnode.componentInstance) {
        vnode = vnode.componentInstance._vnode;
      }

      return isDef(vnode.tag);
    }

    function invokeCreateHooks(vnode, insertedVnodeQueue) {
      for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
        cbs.create[i$1](emptyNode, vnode);
      }

      i = vnode.data.hook; // Reuse variable

      if (isDef(i)) {
        if (isDef(i.create)) {
          i.create(emptyNode, vnode);
        }

        if (isDef(i.insert)) {
          insertedVnodeQueue.push(vnode);
        }
      }
    } // set scope id attribute for scoped CSS.
    // this is implemented as a special case to avoid the overhead
    // of going through the normal attribute patching process.


    function setScope(vnode) {
      var i;

      if (isDef(i = vnode.fnScopeId)) {
        nodeOps.setStyleScope(vnode.elm, i);
      } else {
        var ancestor = vnode;

        while (ancestor) {
          if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
            nodeOps.setStyleScope(vnode.elm, i);
          }

          ancestor = ancestor.parent;
        }
      } // for slot content they should also get the scopeId from the host instance.


      if (isDef(i = activeInstance) && i !== vnode.context && i !== vnode.fnContext && isDef(i = i.$options._scopeId)) {
        nodeOps.setStyleScope(vnode.elm, i);
      }
    }

    function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
      for (; startIdx <= endIdx; ++startIdx) {
        createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
      }
    }

    function invokeDestroyHook(vnode) {
      var i, j;
      var data = vnode.data;

      if (isDef(data)) {
        if (isDef(i = data.hook) && isDef(i = i.destroy)) {
          i(vnode);
        }

        for (i = 0; i < cbs.destroy.length; ++i) {
          cbs.destroy[i](vnode);
        }
      }

      if (isDef(i = vnode.children)) {
        for (j = 0; j < vnode.children.length; ++j) {
          invokeDestroyHook(vnode.children[j]);
        }
      }
    }

    function removeVnodes(vnodes, startIdx, endIdx) {
      for (; startIdx <= endIdx; ++startIdx) {
        var ch = vnodes[startIdx];

        if (isDef(ch)) {
          if (isDef(ch.tag)) {
            removeAndInvokeRemoveHook(ch);
            invokeDestroyHook(ch);
          } else {
            // Text node
            removeNode(ch.elm);
          }
        }
      }
    }

    function removeAndInvokeRemoveHook(vnode, rm) {
      if (isDef(rm) || isDef(vnode.data)) {
        var i;
        var listeners = cbs.remove.length + 1;

        if (isDef(rm)) {
          // we have a recursively passed down rm callback
          // increase the listeners count
          rm.listeners += listeners;
        } else {
          // directly removing
          rm = createRmCb(vnode.elm, listeners);
        } // recursively invoke hooks on child component root node


        if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
          removeAndInvokeRemoveHook(i, rm);
        }

        for (i = 0; i < cbs.remove.length; ++i) {
          cbs.remove[i](vnode, rm);
        }

        if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
          i(vnode, rm);
        } else {
          rm();
        }
      } else {
        removeNode(vnode.elm);
      }
    }

    function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
      var oldStartIdx = 0;
      var newStartIdx = 0;
      var oldEndIdx = oldCh.length - 1;
      var oldStartVnode = oldCh[0];
      var oldEndVnode = oldCh[oldEndIdx];
      var newEndIdx = newCh.length - 1;
      var newStartVnode = newCh[0];
      var newEndVnode = newCh[newEndIdx];
      var oldKeyToIdx, idxInOld, vnodeToMove, refElm; // removeOnly is a special flag used only by <transition-group>
      // to ensure removed elements stay in correct relative positions
      // during leaving transitions

      var canMove = !removeOnly;

      while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
        if (isUndef(oldStartVnode)) {
          oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
        } else if (isUndef(oldEndVnode)) {
          oldEndVnode = oldCh[--oldEndIdx];
        } else if (sameVnode(oldStartVnode, newStartVnode)) {
          patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
          oldStartVnode = oldCh[++oldStartIdx];
          newStartVnode = newCh[++newStartIdx];
        } else if (sameVnode(oldEndVnode, newEndVnode)) {
          patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
          oldEndVnode = oldCh[--oldEndIdx];
          newEndVnode = newCh[--newEndIdx];
        } else if (sameVnode(oldStartVnode, newEndVnode)) {
          // Vnode moved right
          patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
          canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
          oldStartVnode = oldCh[++oldStartIdx];
          newEndVnode = newCh[--newEndIdx];
        } else if (sameVnode(oldEndVnode, newStartVnode)) {
          // Vnode moved left
          patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
          canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
          oldEndVnode = oldCh[--oldEndIdx];
          newStartVnode = newCh[++newStartIdx];
        } else {
          if (isUndef(oldKeyToIdx)) {
            oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
          }

          idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);

          if (isUndef(idxInOld)) {
            // New element
            createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
          } else {
            vnodeToMove = oldCh[idxInOld];

            if (sameVnode(vnodeToMove, newStartVnode)) {
              patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
              oldCh[idxInOld] = undefined;
              canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
            } else {
              // same key but different element. treat as new element
              createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
            }
          }

          newStartVnode = newCh[++newStartIdx];
        }
      }

      if (oldStartIdx > oldEndIdx) {
        refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
        addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
      } else if (newStartIdx > newEndIdx) {
        removeVnodes(oldCh, oldStartIdx, oldEndIdx);
      }
    }

    function findIdxInOld(node, oldCh, start, end) {
      for (var i = start; i < end; i++) {
        var c = oldCh[i];

        if (isDef(c) && sameVnode(node, c)) {
          return i;
        }
      }
    }

    function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
      if (oldVnode === vnode) {
        return;
      }

      if (isDef(vnode.elm) && isDef(ownerArray)) {
        // clone reused vnode
        vnode = ownerArray[index] = cloneVNode(vnode);
      }

      var elm = vnode.elm = oldVnode.elm;

      if (isTrue(oldVnode.isAsyncPlaceholder)) {
        if (isDef(vnode.asyncFactory.resolved)) {
          hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
        } else {
          vnode.isAsyncPlaceholder = true;
        }

        return;
      } // reuse element for static trees.
      // note we only do this if the vnode is cloned -
      // if the new node is not cloned it means the render functions have been
      // reset by the hot-reload-api and we need to do a proper re-render.


      if (isTrue(vnode.isStatic) && isTrue(oldVnode.isStatic) && vnode.key === oldVnode.key && (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
        vnode.componentInstance = oldVnode.componentInstance;
        return;
      }

      var i;
      var data = vnode.data;

      if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
        i(oldVnode, vnode);
      }

      var oldCh = oldVnode.children;
      var ch = vnode.children;

      if (isDef(data) && isPatchable(vnode)) {
        for (i = 0; i < cbs.update.length; ++i) {
          cbs.update[i](oldVnode, vnode);
        }

        if (isDef(i = data.hook) && isDef(i = i.update)) {
          i(oldVnode, vnode);
        }
      }

      if (isUndef(vnode.text)) {
        if (isDef(oldCh) && isDef(ch)) {
          if (oldCh !== ch) {
            updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
          }
        } else if (isDef(ch)) {

          if (isDef(oldVnode.text)) {
            nodeOps.setTextContent(elm, '');
          }

          addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
        } else if (isDef(oldCh)) {
          removeVnodes(oldCh, 0, oldCh.length - 1);
        } else if (isDef(oldVnode.text)) {
          nodeOps.setTextContent(elm, '');
        }
      } else if (oldVnode.text !== vnode.text) {
        nodeOps.setTextContent(elm, vnode.text);
      }

      if (isDef(data)) {
        if (isDef(i = data.hook) && isDef(i = i.postpatch)) {
          i(oldVnode, vnode);
        }
      }
    }

    function invokeInsertHook(vnode, queue, initial) {
      // delay insert hooks for component root nodes, invoke them after the
      // element is really inserted
      if (isTrue(initial) && isDef(vnode.parent)) {
        vnode.parent.data.pendingInsert = queue;
      } else {
        for (var i = 0; i < queue.length; ++i) {
          queue[i].data.hook.insert(queue[i]);
        }
      }
    }
    // are already rendered on the client or has no need for initialization
    // Note: style is excluded because it relies on initial clone for future
    // deep updates (#7063).

    var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key'); // Note: this is a browser-only function so we can assume elms are DOM nodes.

    function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
      var i;
      var tag = vnode.tag;
      var data = vnode.data;
      var children = vnode.children;
      inVPre = inVPre || data && data.pre;
      vnode.elm = elm;

      if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
        vnode.isAsyncPlaceholder = true;
        return true;
      } // assert node match

      if (isDef(data)) {
        if (isDef(i = data.hook) && isDef(i = i.init)) {
          i(vnode, true
          /* hydrating */
          );
        }

        if (isDef(i = vnode.componentInstance)) {
          // child component. it should have hydrated its own tree.
          initComponent(vnode, insertedVnodeQueue);
          return true;
        }
      }

      if (isDef(tag)) {
        if (isDef(children)) {
          // empty element, allow client to pick up and populate children
          if (!elm.hasChildNodes()) {
            createChildren(vnode, children, insertedVnodeQueue);
          } else {
            // v-html and domProps: innerHTML
            if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
              if (i !== elm.innerHTML) {

                return false;
              }
            } else {
              // iterate and compare children lists
              var childrenMatch = true;
              var childNode = elm.firstChild;

              for (var i$1 = 0; i$1 < children.length; i$1++) {
                if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
                  childrenMatch = false;
                  break;
                }

                childNode = childNode.nextSibling;
              } // if childNode is not null, it means the actual childNodes list is
              // longer than the virtual children list.


              if (!childrenMatch || childNode) {

                return false;
              }
            }
          }
        }

        if (isDef(data)) {
          var fullInvoke = false;

          for (var key in data) {
            if (!isRenderedModule(key)) {
              fullInvoke = true;
              invokeCreateHooks(vnode, insertedVnodeQueue);
              break;
            }
          }

          if (!fullInvoke && data['class']) {
            // ensure collecting deps for deep class bindings for future updates
            traverse(data['class']);
          }
        }
      } else if (elm.data !== vnode.text) {
        elm.data = vnode.text;
      }

      return true;
    }

    return function patch(oldVnode, vnode, hydrating, removeOnly) {
      if (isUndef(vnode)) {
        if (isDef(oldVnode)) {
          invokeDestroyHook(oldVnode);
        }

        return;
      }

      var isInitialPatch = false;
      var insertedVnodeQueue = [];

      if (isUndef(oldVnode)) {
        // empty mount (likely as component), create new root element
        isInitialPatch = true;
        createElm(vnode, insertedVnodeQueue);
      } else {
        var isRealElement = isDef(oldVnode.nodeType);

        if (!isRealElement && sameVnode(oldVnode, vnode)) {
          // patch existing root node
          patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
        } else {
          if (isRealElement) {
            // mounting to a real element
            // check if this is server-rendered content and if we can perform
            // a successful hydration.
            if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
              oldVnode.removeAttribute(SSR_ATTR);
              hydrating = true;
            }

            if (isTrue(hydrating)) {
              if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
                invokeInsertHook(vnode, insertedVnodeQueue, true);
                return oldVnode;
              }
            } // either not server-rendered, or hydration failed.
            // create an empty node and replace it


            oldVnode = emptyNodeAt(oldVnode);
          } // replacing existing element


          var oldElm = oldVnode.elm;
          var parentElm = nodeOps.parentNode(oldElm); // create new node

          createElm(vnode, insertedVnodeQueue, // extremely rare edge case: do not insert if old element is in a
          // leaving transition. Only happens when combining transition +
          // keep-alive + HOCs. (#4590)
          oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm)); // update parent placeholder node element, recursively

          if (isDef(vnode.parent)) {
            var ancestor = vnode.parent;
            var patchable = isPatchable(vnode);

            while (ancestor) {
              for (var i = 0; i < cbs.destroy.length; ++i) {
                cbs.destroy[i](ancestor);
              }

              ancestor.elm = vnode.elm;

              if (patchable) {
                for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
                  cbs.create[i$1](emptyNode, ancestor);
                } // #6513
                // invoke insert hooks that may have been merged by create hooks.
                // e.g. for directives that uses the "inserted" hook.


                var insert = ancestor.data.hook.insert;

                if (insert.merged) {
                  // start at index 1 to avoid re-invoking component mounted hook
                  for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
                    insert.fns[i$2]();
                  }
                }
              } else {
                registerRef(ancestor);
              }

              ancestor = ancestor.parent;
            }
          } // destroy old node


          if (isDef(parentElm)) {
            removeVnodes([oldVnode], 0, 0);
          } else if (isDef(oldVnode.tag)) {
            invokeDestroyHook(oldVnode);
          }
        }
      }

      invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
      return vnode.elm;
    };
  }
  /*  */


  var directives = {
    create: updateDirectives,
    update: updateDirectives,
    destroy: function unbindDirectives(vnode) {
      updateDirectives(vnode, emptyNode);
    }
  };

  function updateDirectives(oldVnode, vnode) {
    if (oldVnode.data.directives || vnode.data.directives) {
      _update(oldVnode, vnode);
    }
  }

  function _update(oldVnode, vnode) {
    var isCreate = oldVnode === emptyNode;
    var isDestroy = vnode === emptyNode;
    var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
    var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
    var dirsWithInsert = [];
    var dirsWithPostpatch = [];
    var key, oldDir, dir;

    for (key in newDirs) {
      oldDir = oldDirs[key];
      dir = newDirs[key];

      if (!oldDir) {
        // new directive, bind
        callHook$1(dir, 'bind', vnode, oldVnode);

        if (dir.def && dir.def.inserted) {
          dirsWithInsert.push(dir);
        }
      } else {
        // existing directive, update
        dir.oldValue = oldDir.value;
        dir.oldArg = oldDir.arg;
        callHook$1(dir, 'update', vnode, oldVnode);

        if (dir.def && dir.def.componentUpdated) {
          dirsWithPostpatch.push(dir);
        }
      }
    }

    if (dirsWithInsert.length) {
      var callInsert = function () {
        for (var i = 0; i < dirsWithInsert.length; i++) {
          callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
        }
      };

      if (isCreate) {
        mergeVNodeHook(vnode, 'insert', callInsert);
      } else {
        callInsert();
      }
    }

    if (dirsWithPostpatch.length) {
      mergeVNodeHook(vnode, 'postpatch', function () {
        for (var i = 0; i < dirsWithPostpatch.length; i++) {
          callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
        }
      });
    }

    if (!isCreate) {
      for (key in oldDirs) {
        if (!newDirs[key]) {
          // no longer present, unbind
          callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
        }
      }
    }
  }

  var emptyModifiers = Object.create(null);

  function normalizeDirectives$1(dirs, vm) {
    var res = Object.create(null);

    if (!dirs) {
      // $flow-disable-line
      return res;
    }

    var i, dir;

    for (i = 0; i < dirs.length; i++) {
      dir = dirs[i];

      if (!dir.modifiers) {
        // $flow-disable-line
        dir.modifiers = emptyModifiers;
      }

      res[getRawDirName(dir)] = dir;
      dir.def = resolveAsset(vm.$options, 'directives', dir.name);
    } // $flow-disable-line


    return res;
  }

  function getRawDirName(dir) {
    return dir.rawName || dir.name + "." + Object.keys(dir.modifiers || {}).join('.');
  }

  function callHook$1(dir, hook, vnode, oldVnode, isDestroy) {
    var fn = dir.def && dir.def[hook];

    if (fn) {
      try {
        fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
      } catch (e) {
        handleError(e, vnode.context, "directive " + dir.name + " " + hook + " hook");
      }
    }
  }

  var baseModules = [ref, directives];
  /*  */

  function updateAttrs(oldVnode, vnode) {
    var opts = vnode.componentOptions;

    if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
      return;
    }

    if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
      return;
    }

    var key, cur, old;
    var elm = vnode.elm;
    var oldAttrs = oldVnode.data.attrs || {};
    var attrs = vnode.data.attrs || {}; // clone observed objects, as the user probably wants to mutate it

    if (isDef(attrs.__ob__)) {
      attrs = vnode.data.attrs = extend({}, attrs);
    }

    for (key in attrs) {
      cur = attrs[key];
      old = oldAttrs[key];

      if (old !== cur) {
        setAttr(elm, key, cur);
      }
    } // #4391: in IE9, setting type can reset value for input[type=radio]
    // #6666: IE/Edge forces progress value down to 1 before setting a max

    /* istanbul ignore if */


    if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
      setAttr(elm, 'value', attrs.value);
    }

    for (key in oldAttrs) {
      if (isUndef(attrs[key])) {
        if (isXlink(key)) {
          elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
        } else if (!isEnumeratedAttr(key)) {
          elm.removeAttribute(key);
        }
      }
    }
  }

  function setAttr(el, key, value) {
    if (el.tagName.indexOf('-') > -1) {
      baseSetAttr(el, key, value);
    } else if (isBooleanAttr(key)) {
      // set attribute for blank value
      // e.g. <option disabled>Select one</option>
      if (isFalsyAttrValue(value)) {
        el.removeAttribute(key);
      } else {
        // technically allowfullscreen is a boolean attribute for <iframe>,
        // but Flash expects a value of "true" when used on <embed> tag
        value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
        el.setAttribute(key, value);
      }
    } else if (isEnumeratedAttr(key)) {
      el.setAttribute(key, convertEnumeratedValue(key, value));
    } else if (isXlink(key)) {
      if (isFalsyAttrValue(value)) {
        el.removeAttributeNS(xlinkNS, getXlinkProp(key));
      } else {
        el.setAttributeNS(xlinkNS, key, value);
      }
    } else {
      baseSetAttr(el, key, value);
    }
  }

  function baseSetAttr(el, key, value) {
    if (isFalsyAttrValue(value)) {
      el.removeAttribute(key);
    } else {
      // #7138: IE10 & 11 fires input event when setting placeholder on
      // <textarea>... block the first input event and remove the blocker
      // immediately.

      /* istanbul ignore if */
      if (isIE && !isIE9 && el.tagName === 'TEXTAREA' && key === 'placeholder' && value !== '' && !el.__ieph) {
        var blocker = function (e) {
          e.stopImmediatePropagation();
          el.removeEventListener('input', blocker);
        };

        el.addEventListener('input', blocker); // $flow-disable-line

        el.__ieph = true;
        /* IE placeholder patched */
      }

      el.setAttribute(key, value);
    }
  }

  var attrs = {
    create: updateAttrs,
    update: updateAttrs
  };
  /*  */

  function updateClass(oldVnode, vnode) {
    var el = vnode.elm;
    var data = vnode.data;
    var oldData = oldVnode.data;

    if (isUndef(data.staticClass) && isUndef(data.class) && (isUndef(oldData) || isUndef(oldData.staticClass) && isUndef(oldData.class))) {
      return;
    }

    var cls = genClassForVnode(vnode); // handle transition classes

    var transitionClass = el._transitionClasses;

    if (isDef(transitionClass)) {
      cls = concat(cls, stringifyClass(transitionClass));
    } // set the class


    if (cls !== el._prevClass) {
      el.setAttribute('class', cls);
      el._prevClass = cls;
    }
  }

  var klass = {
    create: updateClass,
    update: updateClass
  };
  /*  */

  /*  */

  /*  */

  /*  */
  // in some cases, the event used has to be determined at runtime
  // so we used some reserved tokens during compile.

  var RANGE_TOKEN = '__r';
  var CHECKBOX_RADIO_TOKEN = '__c';
  /*  */
  // normalize v-model event tokens that can only be determined at runtime.
  // it's important to place the event as the first in the array because
  // the whole point is ensuring the v-model callback gets called before
  // user-attached handlers.

  function normalizeEvents(on) {
    /* istanbul ignore if */
    if (isDef(on[RANGE_TOKEN])) {
      // IE input[type=range] only supports `change` event
      var event = isIE ? 'change' : 'input';
      on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
      delete on[RANGE_TOKEN];
    } // This was originally intended to fix #4521 but no longer necessary
    // after 2.5. Keeping it for backwards compat with generated code from < 2.4

    /* istanbul ignore if */


    if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
      on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
      delete on[CHECKBOX_RADIO_TOKEN];
    }
  }

  var target$1;

  function createOnceHandler$1(event, handler, capture) {
    var _target = target$1; // save current target element in closure

    return function onceHandler() {
      var res = handler.apply(null, arguments);

      if (res !== null) {
        remove$2(event, onceHandler, capture, _target);
      }
    };
  } // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  // implementation and does not fire microtasks in between event propagation, so
  // safe to exclude.


  var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);

  function add$1(name, handler, capture, passive) {
    // async edge case #6566: inner click event triggers patch, event handler
    // attached to outer element during patch, and triggered again. This
    // happens because browsers fire microtask ticks between event propagation.
    // the solution is simple: we save the timestamp when a handler is attached,
    // and the handler would only fire if the event passed to it was fired
    // AFTER it was attached.
    if (useMicrotaskFix) {
      var attachedTimestamp = currentFlushTimestamp;
      var original = handler;

      handler = original._wrapper = function (e) {
        if ( // no bubbling, should always fire.
        // this is just a safety net in case event.timeStamp is unreliable in
        // certain weird environments...
        e.target === e.currentTarget || // event is fired after handler attachment
        e.timeStamp >= attachedTimestamp || // bail for environments that have buggy event.timeStamp implementations
        // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
        // #9681 QtWebEngine event.timeStamp is negative value
        e.timeStamp <= 0 || // #9448 bail if event is fired in another document in a multi-page
        // electron/nw.js app, since event.timeStamp will be using a different
        // starting reference
        e.target.ownerDocument !== document) {
          return original.apply(this, arguments);
        }
      };
    }

    target$1.addEventListener(name, handler, supportsPassive ? {
      capture: capture,
      passive: passive
    } : capture);
  }

  function remove$2(name, handler, capture, _target) {
    (_target || target$1).removeEventListener(name, handler._wrapper || handler, capture);
  }

  function updateDOMListeners(oldVnode, vnode) {
    if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
      return;
    }

    var on = vnode.data.on || {};
    var oldOn = oldVnode.data.on || {};
    target$1 = vnode.elm;
    normalizeEvents(on);
    updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
    target$1 = undefined;
  }

  var events = {
    create: updateDOMListeners,
    update: updateDOMListeners
  };
  /*  */

  var svgContainer;

  function updateDOMProps(oldVnode, vnode) {
    if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
      return;
    }

    var key, cur;
    var elm = vnode.elm;
    var oldProps = oldVnode.data.domProps || {};
    var props = vnode.data.domProps || {}; // clone observed objects, as the user probably wants to mutate it

    if (isDef(props.__ob__)) {
      props = vnode.data.domProps = extend({}, props);
    }

    for (key in oldProps) {
      if (!(key in props)) {
        elm[key] = '';
      }
    }

    for (key in props) {
      cur = props[key]; // ignore children if the node has textContent or innerHTML,
      // as these will throw away existing DOM nodes and cause removal errors
      // on subsequent patches (#3360)

      if (key === 'textContent' || key === 'innerHTML') {
        if (vnode.children) {
          vnode.children.length = 0;
        }

        if (cur === oldProps[key]) {
          continue;
        } // #6601 work around Chrome version <= 55 bug where single textNode
        // replaced by innerHTML/textContent retains its parentNode property


        if (elm.childNodes.length === 1) {
          elm.removeChild(elm.childNodes[0]);
        }
      }

      if (key === 'value' && elm.tagName !== 'PROGRESS') {
        // store value as _value as well since
        // non-string values will be stringified
        elm._value = cur; // avoid resetting cursor position when value is the same

        var strCur = isUndef(cur) ? '' : String(cur);

        if (shouldUpdateValue(elm, strCur)) {
          elm.value = strCur;
        }
      } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
        // IE doesn't support innerHTML for SVG elements
        svgContainer = svgContainer || document.createElement('div');
        svgContainer.innerHTML = "<svg>" + cur + "</svg>";
        var svg = svgContainer.firstChild;

        while (elm.firstChild) {
          elm.removeChild(elm.firstChild);
        }

        while (svg.firstChild) {
          elm.appendChild(svg.firstChild);
        }
      } else if ( // skip the update if old and new VDOM state is the same.
      // `value` is handled separately because the DOM value may be temporarily
      // out of sync with VDOM state due to focus, composition and modifiers.
      // This  #4521 by skipping the unnecessary `checked` update.
      cur !== oldProps[key]) {
        // some property updates can throw
        // e.g. `value` on <progress> w/ non-finite value
        try {
          elm[key] = cur;
        } catch (e) {}
      }
    }
  } // check platforms/web/util/attrs.js acceptValue


  function shouldUpdateValue(elm, checkVal) {
    return !elm.composing && (elm.tagName === 'OPTION' || isNotInFocusAndDirty(elm, checkVal) || isDirtyWithModifiers(elm, checkVal));
  }

  function isNotInFocusAndDirty(elm, checkVal) {
    // return true when textbox (.number and .trim) loses focus and its value is
    // not equal to the updated value
    var notInFocus = true; // #6157
    // work around IE bug when accessing document.activeElement in an iframe

    try {
      notInFocus = document.activeElement !== elm;
    } catch (e) {}

    return notInFocus && elm.value !== checkVal;
  }

  function isDirtyWithModifiers(elm, newVal) {
    var value = elm.value;
    var modifiers = elm._vModifiers; // injected by v-model runtime

    if (isDef(modifiers)) {
      if (modifiers.number) {
        return toNumber(value) !== toNumber(newVal);
      }

      if (modifiers.trim) {
        return value.trim() !== newVal.trim();
      }
    }

    return value !== newVal;
  }

  var domProps = {
    create: updateDOMProps,
    update: updateDOMProps
  };
  /*  */

  var parseStyleText = cached(function (cssText) {
    var res = {};
    var listDelimiter = /;(?![^(]*\))/g;
    var propertyDelimiter = /:(.+)/;
    cssText.split(listDelimiter).forEach(function (item) {
      if (item) {
        var tmp = item.split(propertyDelimiter);
        tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
      }
    });
    return res;
  }); // merge static and dynamic style data on the same vnode

  function normalizeStyleData(data) {
    var style = normalizeStyleBinding(data.style); // static style is pre-processed into an object during compilation
    // and is always a fresh object, so it's safe to merge into it

    return data.staticStyle ? extend(data.staticStyle, style) : style;
  } // normalize possible array / string values into Object


  function normalizeStyleBinding(bindingStyle) {
    if (Array.isArray(bindingStyle)) {
      return toObject(bindingStyle);
    }

    if (typeof bindingStyle === 'string') {
      return parseStyleText(bindingStyle);
    }

    return bindingStyle;
  }
  /**
   * parent component style should be after child's
   * so that parent component's style could override it
   */


  function getStyle(vnode, checkChild) {
    var res = {};
    var styleData;

    if (checkChild) {
      var childNode = vnode;

      while (childNode.componentInstance) {
        childNode = childNode.componentInstance._vnode;

        if (childNode && childNode.data && (styleData = normalizeStyleData(childNode.data))) {
          extend(res, styleData);
        }
      }
    }

    if (styleData = normalizeStyleData(vnode.data)) {
      extend(res, styleData);
    }

    var parentNode = vnode;

    while (parentNode = parentNode.parent) {
      if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
        extend(res, styleData);
      }
    }

    return res;
  }
  /*  */


  var cssVarRE = /^--/;
  var importantRE = /\s*!important$/;

  var setProp = function (el, name, val) {
    /* istanbul ignore if */
    if (cssVarRE.test(name)) {
      el.style.setProperty(name, val);
    } else if (importantRE.test(val)) {
      el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
    } else {
      var normalizedName = normalize(name);

      if (Array.isArray(val)) {
        // Support values array created by autoprefixer, e.g.
        // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
        // Set them one by one, and the browser will only set those it can recognize
        for (var i = 0, len = val.length; i < len; i++) {
          el.style[normalizedName] = val[i];
        }
      } else {
        el.style[normalizedName] = val;
      }
    }
  };

  var vendorNames = ['Webkit', 'Moz', 'ms'];
  var emptyStyle;
  var normalize = cached(function (prop) {
    emptyStyle = emptyStyle || document.createElement('div').style;
    prop = camelize(prop);

    if (prop !== 'filter' && prop in emptyStyle) {
      return prop;
    }

    var capName = prop.charAt(0).toUpperCase() + prop.slice(1);

    for (var i = 0; i < vendorNames.length; i++) {
      var name = vendorNames[i] + capName;

      if (name in emptyStyle) {
        return name;
      }
    }
  });

  function updateStyle(oldVnode, vnode) {
    var data = vnode.data;
    var oldData = oldVnode.data;

    if (isUndef(data.staticStyle) && isUndef(data.style) && isUndef(oldData.staticStyle) && isUndef(oldData.style)) {
      return;
    }

    var cur, name;
    var el = vnode.elm;
    var oldStaticStyle = oldData.staticStyle;
    var oldStyleBinding = oldData.normalizedStyle || oldData.style || {}; // if static style exists, stylebinding already merged into it when doing normalizeStyleData

    var oldStyle = oldStaticStyle || oldStyleBinding;
    var style = normalizeStyleBinding(vnode.data.style) || {}; // store normalized style under a different key for next diff
    // make sure to clone it if it's reactive, since the user likely wants
    // to mutate it.

    vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
    var newStyle = getStyle(vnode, true);

    for (name in oldStyle) {
      if (isUndef(newStyle[name])) {
        setProp(el, name, '');
      }
    }

    for (name in newStyle) {
      cur = newStyle[name];

      if (cur !== oldStyle[name]) {
        // ie9 setting to null has no effect, must use empty string
        setProp(el, name, cur == null ? '' : cur);
      }
    }
  }

  var style = {
    create: updateStyle,
    update: updateStyle
  };
  /*  */

  var whitespaceRE = /\s+/;
  /**
   * Add class with compatibility for SVG since classList is not supported on
   * SVG elements in IE
   */

  function addClass(el, cls) {
    /* istanbul ignore if */
    if (!cls || !(cls = cls.trim())) {
      return;
    }
    /* istanbul ignore else */


    if (el.classList) {
      if (cls.indexOf(' ') > -1) {
        cls.split(whitespaceRE).forEach(function (c) {
          return el.classList.add(c);
        });
      } else {
        el.classList.add(cls);
      }
    } else {
      var cur = " " + (el.getAttribute('class') || '') + " ";

      if (cur.indexOf(' ' + cls + ' ') < 0) {
        el.setAttribute('class', (cur + cls).trim());
      }
    }
  }
  /**
   * Remove class with compatibility for SVG since classList is not supported on
   * SVG elements in IE
   */


  function removeClass(el, cls) {
    /* istanbul ignore if */
    if (!cls || !(cls = cls.trim())) {
      return;
    }
    /* istanbul ignore else */


    if (el.classList) {
      if (cls.indexOf(' ') > -1) {
        cls.split(whitespaceRE).forEach(function (c) {
          return el.classList.remove(c);
        });
      } else {
        el.classList.remove(cls);
      }

      if (!el.classList.length) {
        el.removeAttribute('class');
      }
    } else {
      var cur = " " + (el.getAttribute('class') || '') + " ";
      var tar = ' ' + cls + ' ';

      while (cur.indexOf(tar) >= 0) {
        cur = cur.replace(tar, ' ');
      }

      cur = cur.trim();

      if (cur) {
        el.setAttribute('class', cur);
      } else {
        el.removeAttribute('class');
      }
    }
  }
  /*  */


  function resolveTransition(def$$1) {
    if (!def$$1) {
      return;
    }
    /* istanbul ignore else */


    if (typeof def$$1 === 'object') {
      var res = {};

      if (def$$1.css !== false) {
        extend(res, autoCssTransition(def$$1.name || 'v'));
      }

      extend(res, def$$1);
      return res;
    } else if (typeof def$$1 === 'string') {
      return autoCssTransition(def$$1);
    }
  }

  var autoCssTransition = cached(function (name) {
    return {
      enterClass: name + "-enter",
      enterToClass: name + "-enter-to",
      enterActiveClass: name + "-enter-active",
      leaveClass: name + "-leave",
      leaveToClass: name + "-leave-to",
      leaveActiveClass: name + "-leave-active"
    };
  });
  var hasTransition = inBrowser && !isIE9;
  var TRANSITION = 'transition';
  var ANIMATION = 'animation'; // Transition property/event sniffing

  var transitionProp = 'transition';
  var transitionEndEvent = 'transitionend';
  var animationProp = 'animation';
  var animationEndEvent = 'animationend';

  if (hasTransition) {
    /* istanbul ignore if */
    if (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {
      transitionProp = 'WebkitTransition';
      transitionEndEvent = 'webkitTransitionEnd';
    }

    if (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {
      animationProp = 'WebkitAnimation';
      animationEndEvent = 'webkitAnimationEnd';
    }
  } // binding to window is necessary to make hot reload work in IE in strict mode


  var raf = inBrowser ? window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : setTimeout :
  /* istanbul ignore next */
  function (fn) {
    return fn();
  };

  function nextFrame(fn) {
    raf(function () {
      raf(fn);
    });
  }

  function addTransitionClass(el, cls) {
    var transitionClasses = el._transitionClasses || (el._transitionClasses = []);

    if (transitionClasses.indexOf(cls) < 0) {
      transitionClasses.push(cls);
      addClass(el, cls);
    }
  }

  function removeTransitionClass(el, cls) {
    if (el._transitionClasses) {
      remove(el._transitionClasses, cls);
    }

    removeClass(el, cls);
  }

  function whenTransitionEnds(el, expectedType, cb) {
    var ref = getTransitionInfo(el, expectedType);
    var type = ref.type;
    var timeout = ref.timeout;
    var propCount = ref.propCount;

    if (!type) {
      return cb();
    }

    var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
    var ended = 0;

    var end = function () {
      el.removeEventListener(event, onEnd);
      cb();
    };

    var onEnd = function (e) {
      if (e.target === el) {
        if (++ended >= propCount) {
          end();
        }
      }
    };

    setTimeout(function () {
      if (ended < propCount) {
        end();
      }
    }, timeout + 1);
    el.addEventListener(event, onEnd);
  }

  var transformRE = /\b(transform|all)(,|$)/;

  function getTransitionInfo(el, expectedType) {
    var styles = window.getComputedStyle(el); // JSDOM may return undefined for transition properties

    var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
    var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
    var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
    var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
    var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
    var animationTimeout = getTimeout(animationDelays, animationDurations);
    var type;
    var timeout = 0;
    var propCount = 0;
    /* istanbul ignore if */

    if (expectedType === TRANSITION) {
      if (transitionTimeout > 0) {
        type = TRANSITION;
        timeout = transitionTimeout;
        propCount = transitionDurations.length;
      }
    } else if (expectedType === ANIMATION) {
      if (animationTimeout > 0) {
        type = ANIMATION;
        timeout = animationTimeout;
        propCount = animationDurations.length;
      }
    } else {
      timeout = Math.max(transitionTimeout, animationTimeout);
      type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
      propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
    }

    var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
    return {
      type: type,
      timeout: timeout,
      propCount: propCount,
      hasTransform: hasTransform
    };
  }

  function getTimeout(delays, durations) {
    /* istanbul ignore next */
    while (delays.length < durations.length) {
      delays = delays.concat(delays);
    }

    return Math.max.apply(null, durations.map(function (d, i) {
      return toMs(d) + toMs(delays[i]);
    }));
  } // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  // in a locale-dependent way, using a comma instead of a dot.
  // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  // as a floor function) causing unexpected behaviors


  function toMs(s) {
    return Number(s.slice(0, -1).replace(',', '.')) * 1000;
  }
  /*  */


  function enter(vnode, toggleDisplay) {
    var el = vnode.elm; // call leave callback now

    if (isDef(el._leaveCb)) {
      el._leaveCb.cancelled = true;

      el._leaveCb();
    }

    var data = resolveTransition(vnode.data.transition);

    if (isUndef(data)) {
      return;
    }
    /* istanbul ignore if */


    if (isDef(el._enterCb) || el.nodeType !== 1) {
      return;
    }

    var css = data.css;
    var type = data.type;
    var enterClass = data.enterClass;
    var enterToClass = data.enterToClass;
    var enterActiveClass = data.enterActiveClass;
    var appearClass = data.appearClass;
    var appearToClass = data.appearToClass;
    var appearActiveClass = data.appearActiveClass;
    var beforeEnter = data.beforeEnter;
    var enter = data.enter;
    var afterEnter = data.afterEnter;
    var enterCancelled = data.enterCancelled;
    var beforeAppear = data.beforeAppear;
    var appear = data.appear;
    var afterAppear = data.afterAppear;
    var appearCancelled = data.appearCancelled;
    var duration = data.duration; // activeInstance will always be the <transition> component managing this
    // transition. One edge case to check is when the <transition> is placed
    // as the root node of a child component. In that case we need to check
    // <transition>'s parent for appear check.

    var context = activeInstance;
    var transitionNode = activeInstance.$vnode;

    while (transitionNode && transitionNode.parent) {
      context = transitionNode.context;
      transitionNode = transitionNode.parent;
    }

    var isAppear = !context._isMounted || !vnode.isRootInsert;

    if (isAppear && !appear && appear !== '') {
      return;
    }

    var startClass = isAppear && appearClass ? appearClass : enterClass;
    var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
    var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
    var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
    var enterHook = isAppear ? typeof appear === 'function' ? appear : enter : enter;
    var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
    var enterCancelledHook = isAppear ? appearCancelled || enterCancelled : enterCancelled;
    var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);

    var expectsCSS = css !== false && !isIE9;
    var userWantsControl = getHookArgumentsLength(enterHook);
    var cb = el._enterCb = once(function () {
      if (expectsCSS) {
        removeTransitionClass(el, toClass);
        removeTransitionClass(el, activeClass);
      }

      if (cb.cancelled) {
        if (expectsCSS) {
          removeTransitionClass(el, startClass);
        }

        enterCancelledHook && enterCancelledHook(el);
      } else {
        afterEnterHook && afterEnterHook(el);
      }

      el._enterCb = null;
    });

    if (!vnode.data.show) {
      // remove pending leave element on enter by injecting an insert hook
      mergeVNodeHook(vnode, 'insert', function () {
        var parent = el.parentNode;
        var pendingNode = parent && parent._pending && parent._pending[vnode.key];

        if (pendingNode && pendingNode.tag === vnode.tag && pendingNode.elm._leaveCb) {
          pendingNode.elm._leaveCb();
        }

        enterHook && enterHook(el, cb);
      });
    } // start enter transition


    beforeEnterHook && beforeEnterHook(el);

    if (expectsCSS) {
      addTransitionClass(el, startClass);
      addTransitionClass(el, activeClass);
      nextFrame(function () {
        removeTransitionClass(el, startClass);

        if (!cb.cancelled) {
          addTransitionClass(el, toClass);

          if (!userWantsControl) {
            if (isValidDuration(explicitEnterDuration)) {
              setTimeout(cb, explicitEnterDuration);
            } else {
              whenTransitionEnds(el, type, cb);
            }
          }
        }
      });
    }

    if (vnode.data.show) {
      toggleDisplay && toggleDisplay();
      enterHook && enterHook(el, cb);
    }

    if (!expectsCSS && !userWantsControl) {
      cb();
    }
  }

  function leave(vnode, rm) {
    var el = vnode.elm; // call enter callback now

    if (isDef(el._enterCb)) {
      el._enterCb.cancelled = true;

      el._enterCb();
    }

    var data = resolveTransition(vnode.data.transition);

    if (isUndef(data) || el.nodeType !== 1) {
      return rm();
    }
    /* istanbul ignore if */


    if (isDef(el._leaveCb)) {
      return;
    }

    var css = data.css;
    var type = data.type;
    var leaveClass = data.leaveClass;
    var leaveToClass = data.leaveToClass;
    var leaveActiveClass = data.leaveActiveClass;
    var beforeLeave = data.beforeLeave;
    var leave = data.leave;
    var afterLeave = data.afterLeave;
    var leaveCancelled = data.leaveCancelled;
    var delayLeave = data.delayLeave;
    var duration = data.duration;
    var expectsCSS = css !== false && !isIE9;
    var userWantsControl = getHookArgumentsLength(leave);
    var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);

    var cb = el._leaveCb = once(function () {
      if (el.parentNode && el.parentNode._pending) {
        el.parentNode._pending[vnode.key] = null;
      }

      if (expectsCSS) {
        removeTransitionClass(el, leaveToClass);
        removeTransitionClass(el, leaveActiveClass);
      }

      if (cb.cancelled) {
        if (expectsCSS) {
          removeTransitionClass(el, leaveClass);
        }

        leaveCancelled && leaveCancelled(el);
      } else {
        rm();
        afterLeave && afterLeave(el);
      }

      el._leaveCb = null;
    });

    if (delayLeave) {
      delayLeave(performLeave);
    } else {
      performLeave();
    }

    function performLeave() {
      // the delayed leave may have already been cancelled
      if (cb.cancelled) {
        return;
      } // record leaving element


      if (!vnode.data.show && el.parentNode) {
        (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
      }

      beforeLeave && beforeLeave(el);

      if (expectsCSS) {
        addTransitionClass(el, leaveClass);
        addTransitionClass(el, leaveActiveClass);
        nextFrame(function () {
          removeTransitionClass(el, leaveClass);

          if (!cb.cancelled) {
            addTransitionClass(el, leaveToClass);

            if (!userWantsControl) {
              if (isValidDuration(explicitLeaveDuration)) {
                setTimeout(cb, explicitLeaveDuration);
              } else {
                whenTransitionEnds(el, type, cb);
              }
            }
          }
        });
      }

      leave && leave(el, cb);

      if (!expectsCSS && !userWantsControl) {
        cb();
      }
    }
  } // only used in dev mode

  function isValidDuration(val) {
    return typeof val === 'number' && !isNaN(val);
  }
  /**
   * Normalize a transition hook's argument length. The hook may be:
   * - a merged hook (invoker) with the original in .fns
   * - a wrapped component method (check ._length)
   * - a plain function (.length)
   */


  function getHookArgumentsLength(fn) {
    if (isUndef(fn)) {
      return false;
    }

    var invokerFns = fn.fns;

    if (isDef(invokerFns)) {
      // invoker
      return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
    } else {
      return (fn._length || fn.length) > 1;
    }
  }

  function _enter(_, vnode) {
    if (vnode.data.show !== true) {
      enter(vnode);
    }
  }

  var transition = inBrowser ? {
    create: _enter,
    activate: _enter,
    remove: function remove$$1(vnode, rm) {
      /* istanbul ignore else */
      if (vnode.data.show !== true) {
        leave(vnode, rm);
      } else {
        rm();
      }
    }
  } : {};
  var platformModules = [attrs, klass, events, domProps, style, transition];
  /*  */
  // the directive module should be applied last, after all
  // built-in modules have been applied.

  var modules = platformModules.concat(baseModules);
  var patch = createPatchFunction({
    nodeOps: nodeOps,
    modules: modules
  });
  /**
   * Not type checking this file because flow doesn't like attaching
   * properties to Elements.
   */

  /* istanbul ignore if */

  if (isIE9) {
    // http://www.matts411.com/post/internet-explorer-9-oninput/
    document.addEventListener('selectionchange', function () {
      var el = document.activeElement;

      if (el && el.vmodel) {
        trigger(el, 'input');
      }
    });
  }

  var directive = {
    inserted: function inserted(el, binding, vnode, oldVnode) {
      if (vnode.tag === 'select') {
        // #6903
        if (oldVnode.elm && !oldVnode.elm._vOptions) {
          mergeVNodeHook(vnode, 'postpatch', function () {
            directive.componentUpdated(el, binding, vnode);
          });
        } else {
          setSelected(el, binding, vnode.context);
        }

        el._vOptions = [].map.call(el.options, getValue);
      } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
        el._vModifiers = binding.modifiers;

        if (!binding.modifiers.lazy) {
          el.addEventListener('compositionstart', onCompositionStart);
          el.addEventListener('compositionend', onCompositionEnd); // Safari < 10.2 & UIWebView doesn't fire compositionend when
          // switching focus before confirming composition choice
          // this also fixes the issue where some browsers e.g. iOS Chrome
          // fires "change" instead of "input" on autocomplete.

          el.addEventListener('change', onCompositionEnd);
          /* istanbul ignore if */

          if (isIE9) {
            el.vmodel = true;
          }
        }
      }
    },
    componentUpdated: function componentUpdated(el, binding, vnode) {
      if (vnode.tag === 'select') {
        setSelected(el, binding, vnode.context); // in case the options rendered by v-for have changed,
        // it's possible that the value is out-of-sync with the rendered options.
        // detect such cases and filter out values that no longer has a matching
        // option in the DOM.

        var prevOptions = el._vOptions;
        var curOptions = el._vOptions = [].map.call(el.options, getValue);

        if (curOptions.some(function (o, i) {
          return !looseEqual(o, prevOptions[i]);
        })) {
          // trigger change event if
          // no matching option found for at least one value
          var needReset = el.multiple ? binding.value.some(function (v) {
            return hasNoMatchingOption(v, curOptions);
          }) : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);

          if (needReset) {
            trigger(el, 'change');
          }
        }
      }
    }
  };

  function setSelected(el, binding, vm) {
    actuallySetSelected(el, binding);
    /* istanbul ignore if */

    if (isIE || isEdge) {
      setTimeout(function () {
        actuallySetSelected(el, binding);
      }, 0);
    }
  }

  function actuallySetSelected(el, binding, vm) {
    var value = binding.value;
    var isMultiple = el.multiple;

    if (isMultiple && !Array.isArray(value)) {
      return;
    }

    var selected, option;

    for (var i = 0, l = el.options.length; i < l; i++) {
      option = el.options[i];

      if (isMultiple) {
        selected = looseIndexOf(value, getValue(option)) > -1;

        if (option.selected !== selected) {
          option.selected = selected;
        }
      } else {
        if (looseEqual(getValue(option), value)) {
          if (el.selectedIndex !== i) {
            el.selectedIndex = i;
          }

          return;
        }
      }
    }

    if (!isMultiple) {
      el.selectedIndex = -1;
    }
  }

  function hasNoMatchingOption(value, options) {
    return options.every(function (o) {
      return !looseEqual(o, value);
    });
  }

  function getValue(option) {
    return '_value' in option ? option._value : option.value;
  }

  function onCompositionStart(e) {
    e.target.composing = true;
  }

  function onCompositionEnd(e) {
    // prevent triggering an input event for no reason
    if (!e.target.composing) {
      return;
    }

    e.target.composing = false;
    trigger(e.target, 'input');
  }

  function trigger(el, type) {
    var e = document.createEvent('HTMLEvents');
    e.initEvent(type, true, true);
    el.dispatchEvent(e);
  }
  /*  */
  // recursively search for possible transition defined inside the component root


  function locateNode(vnode) {
    return vnode.componentInstance && (!vnode.data || !vnode.data.transition) ? locateNode(vnode.componentInstance._vnode) : vnode;
  }

  var show = {
    bind: function bind(el, ref, vnode) {
      var value = ref.value;
      vnode = locateNode(vnode);
      var transition$$1 = vnode.data && vnode.data.transition;
      var originalDisplay = el.__vOriginalDisplay = el.style.display === 'none' ? '' : el.style.display;

      if (value && transition$$1) {
        vnode.data.show = true;
        enter(vnode, function () {
          el.style.display = originalDisplay;
        });
      } else {
        el.style.display = value ? originalDisplay : 'none';
      }
    },
    update: function update(el, ref, vnode) {
      var value = ref.value;
      var oldValue = ref.oldValue;
      /* istanbul ignore if */

      if (!value === !oldValue) {
        return;
      }

      vnode = locateNode(vnode);
      var transition$$1 = vnode.data && vnode.data.transition;

      if (transition$$1) {
        vnode.data.show = true;

        if (value) {
          enter(vnode, function () {
            el.style.display = el.__vOriginalDisplay;
          });
        } else {
          leave(vnode, function () {
            el.style.display = 'none';
          });
        }
      } else {
        el.style.display = value ? el.__vOriginalDisplay : 'none';
      }
    },
    unbind: function unbind(el, binding, vnode, oldVnode, isDestroy) {
      if (!isDestroy) {
        el.style.display = el.__vOriginalDisplay;
      }
    }
  };
  var platformDirectives = {
    model: directive,
    show: show
  };
  /*  */

  var transitionProps = {
    name: String,
    appear: Boolean,
    css: Boolean,
    mode: String,
    type: String,
    enterClass: String,
    leaveClass: String,
    enterToClass: String,
    leaveToClass: String,
    enterActiveClass: String,
    leaveActiveClass: String,
    appearClass: String,
    appearActiveClass: String,
    appearToClass: String,
    duration: [Number, String, Object]
  }; // in case the child is also an abstract component, e.g. <keep-alive>
  // we want to recursively retrieve the real component to be rendered

  function getRealChild(vnode) {
    var compOptions = vnode && vnode.componentOptions;

    if (compOptions && compOptions.Ctor.options.abstract) {
      return getRealChild(getFirstComponentChild(compOptions.children));
    } else {
      return vnode;
    }
  }

  function extractTransitionData(comp) {
    var data = {};
    var options = comp.$options; // props

    for (var key in options.propsData) {
      data[key] = comp[key];
    } // events.
    // extract listeners and pass them directly to the transition methods


    var listeners = options._parentListeners;

    for (var key$1 in listeners) {
      data[camelize(key$1)] = listeners[key$1];
    }

    return data;
  }

  function placeholder(h, rawChild) {
    if (/\d-keep-alive$/.test(rawChild.tag)) {
      return h('keep-alive', {
        props: rawChild.componentOptions.propsData
      });
    }
  }

  function hasParentTransition(vnode) {
    while (vnode = vnode.parent) {
      if (vnode.data.transition) {
        return true;
      }
    }
  }

  function isSameChild(child, oldChild) {
    return oldChild.key === child.key && oldChild.tag === child.tag;
  }

  var isNotTextNode = function (c) {
    return c.tag || isAsyncPlaceholder(c);
  };

  var isVShowDirective = function (d) {
    return d.name === 'show';
  };

  var Transition = {
    name: 'transition',
    props: transitionProps,
    abstract: true,
    render: function render(h) {
      var this$1 = this;
      var children = this.$slots.default;

      if (!children) {
        return;
      } // filter out text nodes (possible whitespaces)


      children = children.filter(isNotTextNode);
      /* istanbul ignore if */

      if (!children.length) {
        return;
      } // warn multiple elements

      var mode = this.mode; // warn invalid mode

      var rawChild = children[0]; // if this is a component root node and the component's
      // parent container node also has transition, skip.

      if (hasParentTransition(this.$vnode)) {
        return rawChild;
      } // apply transition data to child
      // use getRealChild() to ignore abstract components e.g. keep-alive


      var child = getRealChild(rawChild);
      /* istanbul ignore if */

      if (!child) {
        return rawChild;
      }

      if (this._leaving) {
        return placeholder(h, rawChild);
      } // ensure a key that is unique to the vnode type and to this transition
      // component instance. This key will be used to remove pending leaving nodes
      // during entering.


      var id = "__transition-" + this._uid + "-";
      child.key = child.key == null ? child.isComment ? id + 'comment' : id + child.tag : isPrimitive(child.key) ? String(child.key).indexOf(id) === 0 ? child.key : id + child.key : child.key;
      var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
      var oldRawChild = this._vnode;
      var oldChild = getRealChild(oldRawChild); // mark v-show
      // so that the transition module can hand over the control to the directive

      if (child.data.directives && child.data.directives.some(isVShowDirective)) {
        child.data.show = true;
      }

      if (oldChild && oldChild.data && !isSameChild(child, oldChild) && !isAsyncPlaceholder(oldChild) && // #6687 component root is a comment node
      !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)) {
        // replace old child transition data with fresh one
        // important for dynamic transitions!
        var oldData = oldChild.data.transition = extend({}, data); // handle transition mode

        if (mode === 'out-in') {
          // return placeholder node and queue update when leave finishes
          this._leaving = true;
          mergeVNodeHook(oldData, 'afterLeave', function () {
            this$1._leaving = false;
            this$1.$forceUpdate();
          });
          return placeholder(h, rawChild);
        } else if (mode === 'in-out') {
          if (isAsyncPlaceholder(child)) {
            return oldRawChild;
          }

          var delayedLeave;

          var performLeave = function () {
            delayedLeave();
          };

          mergeVNodeHook(data, 'afterEnter', performLeave);
          mergeVNodeHook(data, 'enterCancelled', performLeave);
          mergeVNodeHook(oldData, 'delayLeave', function (leave) {
            delayedLeave = leave;
          });
        }
      }

      return rawChild;
    }
  };
  /*  */

  var props = extend({
    tag: String,
    moveClass: String
  }, transitionProps);
  delete props.mode;
  var TransitionGroup = {
    props: props,
    beforeMount: function beforeMount() {
      var this$1 = this;
      var update = this._update;

      this._update = function (vnode, hydrating) {
        var restoreActiveInstance = setActiveInstance(this$1); // force removing pass

        this$1.__patch__(this$1._vnode, this$1.kept, false, // hydrating
        true // removeOnly (!important, avoids unnecessary moves)
        );

        this$1._vnode = this$1.kept;
        restoreActiveInstance();
        update.call(this$1, vnode, hydrating);
      };
    },
    render: function render(h) {
      var tag = this.tag || this.$vnode.data.tag || 'span';
      var map = Object.create(null);
      var prevChildren = this.prevChildren = this.children;
      var rawChildren = this.$slots.default || [];
      var children = this.children = [];
      var transitionData = extractTransitionData(this);

      for (var i = 0; i < rawChildren.length; i++) {
        var c = rawChildren[i];

        if (c.tag) {
          if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
            children.push(c);
            map[c.key] = c;
            (c.data || (c.data = {})).transition = transitionData;
          }
        }
      }

      if (prevChildren) {
        var kept = [];
        var removed = [];

        for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
          var c$1 = prevChildren[i$1];
          c$1.data.transition = transitionData;
          c$1.data.pos = c$1.elm.getBoundingClientRect();

          if (map[c$1.key]) {
            kept.push(c$1);
          } else {
            removed.push(c$1);
          }
        }

        this.kept = h(tag, null, kept);
        this.removed = removed;
      }

      return h(tag, null, children);
    },
    updated: function updated() {
      var children = this.prevChildren;
      var moveClass = this.moveClass || (this.name || 'v') + '-move';

      if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
        return;
      } // we divide the work into three loops to avoid mixing DOM reads and writes
      // in each iteration - which helps prevent layout thrashing.


      children.forEach(callPendingCbs);
      children.forEach(recordPosition);
      children.forEach(applyTranslation); // force reflow to put everything in position
      // assign to this to avoid being removed in tree-shaking
      // $flow-disable-line

      this._reflow = document.body.offsetHeight;
      children.forEach(function (c) {
        if (c.data.moved) {
          var el = c.elm;
          var s = el.style;
          addTransitionClass(el, moveClass);
          s.transform = s.WebkitTransform = s.transitionDuration = '';
          el.addEventListener(transitionEndEvent, el._moveCb = function cb(e) {
            if (e && e.target !== el) {
              return;
            }

            if (!e || /transform$/.test(e.propertyName)) {
              el.removeEventListener(transitionEndEvent, cb);
              el._moveCb = null;
              removeTransitionClass(el, moveClass);
            }
          });
        }
      });
    },
    methods: {
      hasMove: function hasMove(el, moveClass) {
        /* istanbul ignore if */
        if (!hasTransition) {
          return false;
        }
        /* istanbul ignore if */


        if (this._hasMove) {
          return this._hasMove;
        } // Detect whether an element with the move class applied has
        // CSS transitions. Since the element may be inside an entering
        // transition at this very moment, we make a clone of it and remove
        // all other transition classes applied to ensure only the move class
        // is applied.


        var clone = el.cloneNode();

        if (el._transitionClasses) {
          el._transitionClasses.forEach(function (cls) {
            removeClass(clone, cls);
          });
        }

        addClass(clone, moveClass);
        clone.style.display = 'none';
        this.$el.appendChild(clone);
        var info = getTransitionInfo(clone);
        this.$el.removeChild(clone);
        return this._hasMove = info.hasTransform;
      }
    }
  };

  function callPendingCbs(c) {
    /* istanbul ignore if */
    if (c.elm._moveCb) {
      c.elm._moveCb();
    }
    /* istanbul ignore if */


    if (c.elm._enterCb) {
      c.elm._enterCb();
    }
  }

  function recordPosition(c) {
    c.data.newPos = c.elm.getBoundingClientRect();
  }

  function applyTranslation(c) {
    var oldPos = c.data.pos;
    var newPos = c.data.newPos;
    var dx = oldPos.left - newPos.left;
    var dy = oldPos.top - newPos.top;

    if (dx || dy) {
      c.data.moved = true;
      var s = c.elm.style;
      s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
      s.transitionDuration = '0s';
    }
  }

  var platformComponents = {
    Transition: Transition,
    TransitionGroup: TransitionGroup
  };
  /*  */
  // install platform specific utils

  Vue.config.mustUseProp = mustUseProp;
  Vue.config.isReservedTag = isReservedTag;
  Vue.config.isReservedAttr = isReservedAttr;
  Vue.config.getTagNamespace = getTagNamespace;
  Vue.config.isUnknownElement = isUnknownElement; // install platform runtime directives & components

  extend(Vue.options.directives, platformDirectives);
  extend(Vue.options.components, platformComponents); // install platform patch function

  Vue.prototype.__patch__ = inBrowser ? patch : noop; // public mount method

  Vue.prototype.$mount = function (el, hydrating) {
    el = el && inBrowser ? query(el) : undefined;
    return mountComponent(this, el, hydrating);
  }; // devtools global hook

  /* istanbul ignore next */


  if (inBrowser) {
    setTimeout(function () {
      if (config.devtools) {
        if (devtools) {
          devtools.emit('init', Vue);
        }
      }
    }, 0);
  }

  var bind$1 = function bind(fn, thisArg) {
    return function wrap() {
      var args = new Array(arguments.length);

      for (var i = 0; i < args.length; i++) {
        args[i] = arguments[i];
      }

      return fn.apply(thisArg, args);
    };
  };

  /*global toString:true*/
  // utils is a library of generic helper functions non-specific to axios


  var toString$1 = Object.prototype.toString;
  /**
   * Determine if a value is an Array
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is an Array, otherwise false
   */

  function isArray(val) {
    return toString$1.call(val) === '[object Array]';
  }
  /**
   * Determine if a value is undefined
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if the value is undefined, otherwise false
   */


  function isUndefined(val) {
    return typeof val === 'undefined';
  }
  /**
   * Determine if a value is a Buffer
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Buffer, otherwise false
   */


  function isBuffer(val) {
    return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  }
  /**
   * Determine if a value is an ArrayBuffer
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is an ArrayBuffer, otherwise false
   */


  function isArrayBuffer(val) {
    return toString$1.call(val) === '[object ArrayBuffer]';
  }
  /**
   * Determine if a value is a FormData
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is an FormData, otherwise false
   */


  function isFormData(val) {
    return typeof FormData !== 'undefined' && val instanceof FormData;
  }
  /**
   * Determine if a value is a view on an ArrayBuffer
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
   */


  function isArrayBufferView(val) {
    var result;

    if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
      result = ArrayBuffer.isView(val);
    } else {
      result = val && val.buffer && val.buffer instanceof ArrayBuffer;
    }

    return result;
  }
  /**
   * Determine if a value is a String
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a String, otherwise false
   */


  function isString(val) {
    return typeof val === 'string';
  }
  /**
   * Determine if a value is a Number
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Number, otherwise false
   */


  function isNumber(val) {
    return typeof val === 'number';
  }
  /**
   * Determine if a value is an Object
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is an Object, otherwise false
   */


  function isObject$1(val) {
    return val !== null && typeof val === 'object';
  }
  /**
   * Determine if a value is a Date
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Date, otherwise false
   */


  function isDate(val) {
    return toString$1.call(val) === '[object Date]';
  }
  /**
   * Determine if a value is a File
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a File, otherwise false
   */


  function isFile(val) {
    return toString$1.call(val) === '[object File]';
  }
  /**
   * Determine if a value is a Blob
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Blob, otherwise false
   */


  function isBlob(val) {
    return toString$1.call(val) === '[object Blob]';
  }
  /**
   * Determine if a value is a Function
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Function, otherwise false
   */


  function isFunction(val) {
    return toString$1.call(val) === '[object Function]';
  }
  /**
   * Determine if a value is a Stream
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a Stream, otherwise false
   */


  function isStream(val) {
    return isObject$1(val) && isFunction(val.pipe);
  }
  /**
   * Determine if a value is a URLSearchParams object
   *
   * @param {Object} val The value to test
   * @returns {boolean} True if value is a URLSearchParams object, otherwise false
   */


  function isURLSearchParams(val) {
    return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  }
  /**
   * Trim excess whitespace off the beginning and end of a string
   *
   * @param {String} str The String to trim
   * @returns {String} The String freed of excess whitespace
   */


  function trim(str) {
    return str.replace(/^\s*/, '').replace(/\s*$/, '');
  }
  /**
   * Determine if we're running in a standard browser environment
   *
   * This allows axios to run in a web worker, and react-native.
   * Both environments support XMLHttpRequest, but not fully standard globals.
   *
   * web workers:
   *  typeof window -> undefined
   *  typeof document -> undefined
   *
   * react-native:
   *  navigator.product -> 'ReactNative'
   * nativescript
   *  navigator.product -> 'NativeScript' or 'NS'
   */


  function isStandardBrowserEnv() {
    if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) {
      return false;
    }

    return typeof window !== 'undefined' && typeof document !== 'undefined';
  }
  /**
   * Iterate over an Array or an Object invoking a function for each item.
   *
   * If `obj` is an Array callback will be called passing
   * the value, index, and complete array for each item.
   *
   * If 'obj' is an Object callback will be called passing
   * the value, key, and complete object for each property.
   *
   * @param {Object|Array} obj The object to iterate
   * @param {Function} fn The callback to invoke for each item
   */


  function forEach(obj, fn) {
    // Don't bother if no value provided
    if (obj === null || typeof obj === 'undefined') {
      return;
    } // Force an array if not already something iterable


    if (typeof obj !== 'object') {
      /*eslint no-param-reassign:0*/
      obj = [obj];
    }

    if (isArray(obj)) {
      // Iterate over array values
      for (var i = 0, l = obj.length; i < l; i++) {
        fn.call(null, obj[i], i, obj);
      }
    } else {
      // Iterate over object keys
      for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          fn.call(null, obj[key], key, obj);
        }
      }
    }
  }
  /**
   * Accepts varargs expecting each argument to be an object, then
   * immutably merges the properties of each object and returns result.
   *
   * When multiple objects contain the same key the later object in
   * the arguments list will take precedence.
   *
   * Example:
   *
   * ```js
   * var result = merge({foo: 123}, {foo: 456});
   * console.log(result.foo); // outputs 456
   * ```
   *
   * @param {Object} obj1 Object to merge
   * @returns {Object} Result of all merge properties
   */


  function merge()
  /* obj1, obj2, obj3, ... */
  {
    var result = {};

    function assignValue(val, key) {
      if (typeof result[key] === 'object' && typeof val === 'object') {
        result[key] = merge(result[key], val);
      } else {
        result[key] = val;
      }
    }

    for (var i = 0, l = arguments.length; i < l; i++) {
      forEach(arguments[i], assignValue);
    }

    return result;
  }
  /**
   * Function equal to merge with the difference being that no reference
   * to original objects is kept.
   *
   * @see merge
   * @param {Object} obj1 Object to merge
   * @returns {Object} Result of all merge properties
   */


  function deepMerge()
  /* obj1, obj2, obj3, ... */
  {
    var result = {};

    function assignValue(val, key) {
      if (typeof result[key] === 'object' && typeof val === 'object') {
        result[key] = deepMerge(result[key], val);
      } else if (typeof val === 'object') {
        result[key] = deepMerge({}, val);
      } else {
        result[key] = val;
      }
    }

    for (var i = 0, l = arguments.length; i < l; i++) {
      forEach(arguments[i], assignValue);
    }

    return result;
  }
  /**
   * Extends object a by mutably adding to it the properties of object b.
   *
   * @param {Object} a The object to be extended
   * @param {Object} b The object to copy properties from
   * @param {Object} thisArg The object to bind function to
   * @return {Object} The resulting value of object a
   */


  function extend$1(a, b, thisArg) {
    forEach(b, function assignValue(val, key) {
      if (thisArg && typeof val === 'function') {
        a[key] = bind$1(val, thisArg);
      } else {
        a[key] = val;
      }
    });
    return a;
  }

  var utils = {
    isArray: isArray,
    isArrayBuffer: isArrayBuffer,
    isBuffer: isBuffer,
    isFormData: isFormData,
    isArrayBufferView: isArrayBufferView,
    isString: isString,
    isNumber: isNumber,
    isObject: isObject$1,
    isUndefined: isUndefined,
    isDate: isDate,
    isFile: isFile,
    isBlob: isBlob,
    isFunction: isFunction,
    isStream: isStream,
    isURLSearchParams: isURLSearchParams,
    isStandardBrowserEnv: isStandardBrowserEnv,
    forEach: forEach,
    merge: merge,
    deepMerge: deepMerge,
    extend: extend$1,
    trim: trim
  };

  function encode(val) {
    return encodeURIComponent(val).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
  }
  /**
   * Build a URL by appending params to the end
   *
   * @param {string} url The base of the url (e.g., http://www.google.com)
   * @param {object} [params] The params to be appended
   * @returns {string} The formatted url
   */


  var buildURL = function buildURL(url, params, paramsSerializer) {
    /*eslint no-param-reassign:0*/
    if (!params) {
      return url;
    }

    var serializedParams;

    if (paramsSerializer) {
      serializedParams = paramsSerializer(params);
    } else if (utils.isURLSearchParams(params)) {
      serializedParams = params.toString();
    } else {
      var parts = [];
      utils.forEach(params, function serialize(val, key) {
        if (val === null || typeof val === 'undefined') {
          return;
        }

        if (utils.isArray(val)) {
          key = key + '[]';
        } else {
          val = [val];
        }

        utils.forEach(val, function parseValue(v) {
          if (utils.isDate(v)) {
            v = v.toISOString();
          } else if (utils.isObject(v)) {
            v = JSON.stringify(v);
          }

          parts.push(encode(key) + '=' + encode(v));
        });
      });
      serializedParams = parts.join('&');
    }

    if (serializedParams) {
      var hashmarkIndex = url.indexOf('#');

      if (hashmarkIndex !== -1) {
        url = url.slice(0, hashmarkIndex);
      }

      url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
    }

    return url;
  };

  function InterceptorManager() {
    this.handlers = [];
  }
  /**
   * Add a new interceptor to the stack
   *
   * @param {Function} fulfilled The function to handle `then` for a `Promise`
   * @param {Function} rejected The function to handle `reject` for a `Promise`
   *
   * @return {Number} An ID used to remove interceptor later
   */


  InterceptorManager.prototype.use = function use(fulfilled, rejected) {
    this.handlers.push({
      fulfilled: fulfilled,
      rejected: rejected
    });
    return this.handlers.length - 1;
  };
  /**
   * Remove an interceptor from the stack
   *
   * @param {Number} id The ID that was returned by `use`
   */


  InterceptorManager.prototype.eject = function eject(id) {
    if (this.handlers[id]) {
      this.handlers[id] = null;
    }
  };
  /**
   * Iterate over all the registered interceptors
   *
   * This method is particularly useful for skipping over any
   * interceptors that may have become `null` calling `eject`.
   *
   * @param {Function} fn The function to call for each interceptor
   */


  InterceptorManager.prototype.forEach = function forEach(fn) {
    utils.forEach(this.handlers, function forEachHandler(h) {
      if (h !== null) {
        fn(h);
      }
    });
  };

  var InterceptorManager_1 = InterceptorManager;

  /**
   * Transform the data for a request or a response
   *
   * @param {Object|String} data The data to be transformed
   * @param {Array} headers The headers for the request or response
   * @param {Array|Function} fns A single function or Array of functions
   * @returns {*} The resulting transformed data
   */


  var transformData = function transformData(data, headers, fns) {
    /*eslint no-param-reassign:0*/
    utils.forEach(fns, function transform(fn) {
      data = fn(data, headers);
    });
    return data;
  };

  var isCancel = function isCancel(value) {
    return !!(value && value.__CANCEL__);
  };

  var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
    utils.forEach(headers, function processHeader(value, name) {
      if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
        headers[normalizedName] = value;
        delete headers[name];
      }
    });
  };

  /**
   * Update an Error with the specified config, error code, and response.
   *
   * @param {Error} error The error to update.
   * @param {Object} config The config.
   * @param {string} [code] The error code (for example, 'ECONNABORTED').
   * @param {Object} [request] The request.
   * @param {Object} [response] The response.
   * @returns {Error} The error.
   */

  var enhanceError = function enhanceError(error, config, code, request, response) {
    error.config = config;

    if (code) {
      error.code = code;
    }

    error.request = request;
    error.response = response;
    error.isAxiosError = true;

    error.toJSON = function () {
      return {
        // Standard
        message: this.message,
        name: this.name,
        // Microsoft
        description: this.description,
        number: this.number,
        // Mozilla
        fileName: this.fileName,
        lineNumber: this.lineNumber,
        columnNumber: this.columnNumber,
        stack: this.stack,
        // Axios
        config: this.config,
        code: this.code
      };
    };

    return error;
  };

  /**
   * Create an Error with the specified message, config, error code, request and response.
   *
   * @param {string} message The error message.
   * @param {Object} config The config.
   * @param {string} [code] The error code (for example, 'ECONNABORTED').
   * @param {Object} [request] The request.
   * @param {Object} [response] The response.
   * @returns {Error} The created error.
   */


  var createError = function createError(message, config, code, request, response) {
    var error = new Error(message);
    return enhanceError(error, config, code, request, response);
  };

  /**
   * Resolve or reject a Promise based on response status.
   *
   * @param {Function} resolve A function that resolves the promise.
   * @param {Function} reject A function that rejects the promise.
   * @param {object} response The response.
   */


  var settle = function settle(resolve, reject, response) {
    var validateStatus = response.config.validateStatus;

    if (!validateStatus || validateStatus(response.status)) {
      resolve(response);
    } else {
      reject(createError('Request failed with status code ' + response.status, response.config, null, response.request, response));
    }
  };

  /**
   * Determines whether the specified URL is absolute
   *
   * @param {string} url The URL to test
   * @returns {boolean} True if the specified URL is absolute, otherwise false
   */

  var isAbsoluteURL = function isAbsoluteURL(url) {
    // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
    // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
    // by any combination of letters, digits, plus, period, or hyphen.
    return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  };

  /**
   * Creates a new URL by combining the specified URLs
   *
   * @param {string} baseURL The base URL
   * @param {string} relativeURL The relative URL
   * @returns {string} The combined URL
   */

  var combineURLs = function combineURLs(baseURL, relativeURL) {
    return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
  };

  /**
   * Creates a new URL by combining the baseURL with the requestedURL,
   * only when the requestedURL is not already an absolute URL.
   * If the requestURL is absolute, this function returns the requestedURL untouched.
   *
   * @param {string} baseURL The base URL
   * @param {string} requestedURL Absolute or relative URL to combine
   * @returns {string} The combined full path
   */


  var buildFullPath = function buildFullPath(baseURL, requestedURL) {
    if (baseURL && !isAbsoluteURL(requestedURL)) {
      return combineURLs(baseURL, requestedURL);
    }

    return requestedURL;
  };

  // c.f. https://nodejs.org/api/http.html#http_message_headers


  var ignoreDuplicateOf = ['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent'];
  /**
   * Parse headers into an object
   *
   * ```
   * Date: Wed, 27 Aug 2014 08:58:49 GMT
   * Content-Type: application/json
   * Connection: keep-alive
   * Transfer-Encoding: chunked
   * ```
   *
   * @param {String} headers Headers needing to be parsed
   * @returns {Object} Headers parsed into an object
   */

  var parseHeaders = function parseHeaders(headers) {
    var parsed = {};
    var key;
    var val;
    var i;

    if (!headers) {
      return parsed;
    }

    utils.forEach(headers.split('\n'), function parser(line) {
      i = line.indexOf(':');
      key = utils.trim(line.substr(0, i)).toLowerCase();
      val = utils.trim(line.substr(i + 1));

      if (key) {
        if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
          return;
        }

        if (key === 'set-cookie') {
          parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
        } else {
          parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
        }
      }
    });
    return parsed;
  };

  var isURLSameOrigin = utils.isStandardBrowserEnv() ? // Standard browser envs have full support of the APIs needed to test
  // whether the request URL is of the same origin as current location.
  function standardBrowserEnv() {
    var msie = /(msie|trident)/i.test(navigator.userAgent);
    var urlParsingNode = document.createElement('a');
    var originURL;
    /**
    * Parse a URL to discover it's components
    *
    * @param {String} url The URL to be parsed
    * @returns {Object}
    */

    function resolveURL(url) {
      var href = url;

      if (msie) {
        // IE needs attribute set twice to normalize properties
        urlParsingNode.setAttribute('href', href);
        href = urlParsingNode.href;
      }

      urlParsingNode.setAttribute('href', href); // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils

      return {
        href: urlParsingNode.href,
        protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
        host: urlParsingNode.host,
        search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
        hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
        hostname: urlParsingNode.hostname,
        port: urlParsingNode.port,
        pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
      };
    }

    originURL = resolveURL(window.location.href);
    /**
    * Determine if a URL shares the same origin as the current location
    *
    * @param {String} requestURL The URL to test
    * @returns {boolean} True if URL shares the same origin, otherwise false
    */

    return function isURLSameOrigin(requestURL) {
      var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
      return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
    };
  }() : // Non standard browser envs (web workers, react-native) lack needed support.
  function nonStandardBrowserEnv() {
    return function isURLSameOrigin() {
      return true;
    };
  }();

  var cookies = utils.isStandardBrowserEnv() ? // Standard browser envs support document.cookie
  function standardBrowserEnv() {
    return {
      write: function write(name, value, expires, path, domain, secure) {
        var cookie = [];
        cookie.push(name + '=' + encodeURIComponent(value));

        if (utils.isNumber(expires)) {
          cookie.push('expires=' + new Date(expires).toGMTString());
        }

        if (utils.isString(path)) {
          cookie.push('path=' + path);
        }

        if (utils.isString(domain)) {
          cookie.push('domain=' + domain);
        }

        if (secure === true) {
          cookie.push('secure');
        }

        document.cookie = cookie.join('; ');
      },
      read: function read(name) {
        var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
        return match ? decodeURIComponent(match[3]) : null;
      },
      remove: function remove(name) {
        this.write(name, '', Date.now() - 86400000);
      }
    };
  }() : // Non standard browser env (web workers, react-native) lack needed support.
  function nonStandardBrowserEnv() {
    return {
      write: function write() {},
      read: function read() {
        return null;
      },
      remove: function remove() {}
    };
  }();

  var xhr = function xhrAdapter(config) {
    return new Promise(function dispatchXhrRequest(resolve, reject) {
      var requestData = config.data;
      var requestHeaders = config.headers;

      if (utils.isFormData(requestData)) {
        delete requestHeaders['Content-Type']; // Let the browser set it
      }

      var request = new XMLHttpRequest(); // HTTP basic authentication

      if (config.auth) {
        var username = config.auth.username || '';
        var password = config.auth.password || '';
        requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
      }

      var fullPath = buildFullPath(config.baseURL, config.url);
      request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); // Set the request timeout in MS

      request.timeout = config.timeout; // Listen for ready state

      request.onreadystatechange = function handleLoad() {
        if (!request || request.readyState !== 4) {
          return;
        } // The request errored out and we didn't get a response, this will be
        // handled by onerror instead
        // With one exception: request that using file: protocol, most browsers
        // will return status as 0 even though it's a successful request


        if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
          return;
        } // Prepare the response


        var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
        var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
        var response = {
          data: responseData,
          status: request.status,
          statusText: request.statusText,
          headers: responseHeaders,
          config: config,
          request: request
        };
        settle(resolve, reject, response); // Clean up request

        request = null;
      }; // Handle browser request cancellation (as opposed to a manual cancellation)


      request.onabort = function handleAbort() {
        if (!request) {
          return;
        }

        reject(createError('Request aborted', config, 'ECONNABORTED', request)); // Clean up request

        request = null;
      }; // Handle low level network errors


      request.onerror = function handleError() {
        // Real errors are hidden from us by the browser
        // onerror should only fire if it's a network error
        reject(createError('Network Error', config, null, request)); // Clean up request

        request = null;
      }; // Handle timeout


      request.ontimeout = function handleTimeout() {
        var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';

        if (config.timeoutErrorMessage) {
          timeoutErrorMessage = config.timeoutErrorMessage;
        }

        reject(createError(timeoutErrorMessage, config, 'ECONNABORTED', request)); // Clean up request

        request = null;
      }; // Add xsrf header
      // This is only done if running in a standard browser environment.
      // Specifically not if we're in a web worker, or react-native.


      if (utils.isStandardBrowserEnv()) {
        var cookies$1 = cookies; // Add xsrf header

        var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies$1.read(config.xsrfCookieName) : undefined;

        if (xsrfValue) {
          requestHeaders[config.xsrfHeaderName] = xsrfValue;
        }
      } // Add headers to the request


      if ('setRequestHeader' in request) {
        utils.forEach(requestHeaders, function setRequestHeader(val, key) {
          if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
            // Remove Content-Type if data is undefined
            delete requestHeaders[key];
          } else {
            // Otherwise add header to the request
            request.setRequestHeader(key, val);
          }
        });
      } // Add withCredentials to request if needed


      if (!utils.isUndefined(config.withCredentials)) {
        request.withCredentials = !!config.withCredentials;
      } // Add responseType to request if needed


      if (config.responseType) {
        try {
          request.responseType = config.responseType;
        } catch (e) {
          // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
          // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
          if (config.responseType !== 'json') {
            throw e;
          }
        }
      } // Handle progress if needed


      if (typeof config.onDownloadProgress === 'function') {
        request.addEventListener('progress', config.onDownloadProgress);
      } // Not all browsers support upload events


      if (typeof config.onUploadProgress === 'function' && request.upload) {
        request.upload.addEventListener('progress', config.onUploadProgress);
      }

      if (config.cancelToken) {
        // Handle cancellation
        config.cancelToken.promise.then(function onCanceled(cancel) {
          if (!request) {
            return;
          }

          request.abort();
          reject(cancel); // Clean up request

          request = null;
        });
      }

      if (requestData === undefined) {
        requestData = null;
      } // Send the request


      request.send(requestData);
    });
  };

  var DEFAULT_CONTENT_TYPE = {
    'Content-Type': 'application/x-www-form-urlencoded'
  };

  function setContentTypeIfUnset(headers, value) {
    if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
      headers['Content-Type'] = value;
    }
  }

  function getDefaultAdapter() {
    var adapter;

    if (typeof XMLHttpRequest !== 'undefined') {
      // For browsers use XHR adapter
      adapter = xhr;
    } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
      // For node use HTTP adapter
      adapter = xhr;
    }

    return adapter;
  }

  var defaults = {
    adapter: getDefaultAdapter(),
    transformRequest: [function transformRequest(data, headers) {
      normalizeHeaderName(headers, 'Accept');
      normalizeHeaderName(headers, 'Content-Type');

      if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
        return data;
      }

      if (utils.isArrayBufferView(data)) {
        return data.buffer;
      }

      if (utils.isURLSearchParams(data)) {
        setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
        return data.toString();
      }

      if (utils.isObject(data)) {
        setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
        return JSON.stringify(data);
      }

      return data;
    }],
    transformResponse: [function transformResponse(data) {
      /*eslint no-param-reassign:0*/
      if (typeof data === 'string') {
        try {
          data = JSON.parse(data);
        } catch (e) {
          /* Ignore */
        }
      }

      return data;
    }],

    /**
     * A timeout in milliseconds to abort a request. If set to 0 (default) a
     * timeout is not created.
     */
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    validateStatus: function validateStatus(status) {
      return status >= 200 && status < 300;
    }
  };
  defaults.headers = {
    common: {
      'Accept': 'application/json, text/plain, */*'
    }
  };
  utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
    defaults.headers[method] = {};
  });
  utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
    defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  });
  var defaults_1 = defaults;

  /**
   * Throws a `Cancel` if cancellation has been requested.
   */


  function throwIfCancellationRequested(config) {
    if (config.cancelToken) {
      config.cancelToken.throwIfRequested();
    }
  }
  /**
   * Dispatch a request to the server using the configured adapter.
   *
   * @param {object} config The config that is to be used for the request
   * @returns {Promise} The Promise to be fulfilled
   */


  var dispatchRequest = function dispatchRequest(config) {
    throwIfCancellationRequested(config); // Ensure headers exist

    config.headers = config.headers || {}; // Transform request data

    config.data = transformData(config.data, config.headers, config.transformRequest); // Flatten headers

    config.headers = utils.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers);
    utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) {
      delete config.headers[method];
    });
    var adapter = config.adapter || defaults_1.adapter;
    return adapter(config).then(function onAdapterResolution(response) {
      throwIfCancellationRequested(config); // Transform response data

      response.data = transformData(response.data, response.headers, config.transformResponse);
      return response;
    }, function onAdapterRejection(reason) {
      if (!isCancel(reason)) {
        throwIfCancellationRequested(config); // Transform response data

        if (reason && reason.response) {
          reason.response.data = transformData(reason.response.data, reason.response.headers, config.transformResponse);
        }
      }

      return Promise.reject(reason);
    });
  };

  /**
   * Config-specific merge-function which creates a new config-object
   * by merging two configuration objects together.
   *
   * @param {Object} config1
   * @param {Object} config2
   * @returns {Object} New object resulting from merging config2 to config1
   */


  var mergeConfig = function mergeConfig(config1, config2) {
    // eslint-disable-next-line no-param-reassign
    config2 = config2 || {};
    var config = {};
    var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
    var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
    var defaultToConfig2Keys = ['baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer', 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent', 'httpsAgent', 'cancelToken', 'socketPath'];
    utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
      if (typeof config2[prop] !== 'undefined') {
        config[prop] = config2[prop];
      }
    });
    utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
      if (utils.isObject(config2[prop])) {
        config[prop] = utils.deepMerge(config1[prop], config2[prop]);
      } else if (typeof config2[prop] !== 'undefined') {
        config[prop] = config2[prop];
      } else if (utils.isObject(config1[prop])) {
        config[prop] = utils.deepMerge(config1[prop]);
      } else if (typeof config1[prop] !== 'undefined') {
        config[prop] = config1[prop];
      }
    });
    utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
      if (typeof config2[prop] !== 'undefined') {
        config[prop] = config2[prop];
      } else if (typeof config1[prop] !== 'undefined') {
        config[prop] = config1[prop];
      }
    });
    var axiosKeys = valueFromConfig2Keys.concat(mergeDeepPropertiesKeys).concat(defaultToConfig2Keys);
    var otherKeys = Object.keys(config2).filter(function filterAxiosKeys(key) {
      return axiosKeys.indexOf(key) === -1;
    });
    utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
      if (typeof config2[prop] !== 'undefined') {
        config[prop] = config2[prop];
      } else if (typeof config1[prop] !== 'undefined') {
        config[prop] = config1[prop];
      }
    });
    return config;
  };

  /**
   * Create a new instance of Axios
   *
   * @param {Object} instanceConfig The default config for the instance
   */


  function Axios(instanceConfig) {
    this.defaults = instanceConfig;
    this.interceptors = {
      request: new InterceptorManager_1(),
      response: new InterceptorManager_1()
    };
  }
  /**
   * Dispatch a request
   *
   * @param {Object} config The config specific for this request (merged with this.defaults)
   */


  Axios.prototype.request = function request(config) {
    /*eslint no-param-reassign:0*/
    // Allow for axios('example/url'[, config]) a la fetch API
    if (typeof config === 'string') {
      config = arguments[1] || {};
      config.url = arguments[0];
    } else {
      config = config || {};
    }

    config = mergeConfig(this.defaults, config); // Set config.method

    if (config.method) {
      config.method = config.method.toLowerCase();
    } else if (this.defaults.method) {
      config.method = this.defaults.method.toLowerCase();
    } else {
      config.method = 'get';
    } // Hook up interceptors middleware


    var chain = [dispatchRequest, undefined];
    var promise = Promise.resolve(config);
    this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
      chain.unshift(interceptor.fulfilled, interceptor.rejected);
    });
    this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
      chain.push(interceptor.fulfilled, interceptor.rejected);
    });

    while (chain.length) {
      promise = promise.then(chain.shift(), chain.shift());
    }

    return promise;
  };

  Axios.prototype.getUri = function getUri(config) {
    config = mergeConfig(this.defaults, config);
    return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  }; // Provide aliases for supported request methods


  utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
    /*eslint func-names:0*/
    Axios.prototype[method] = function (url, config) {
      return this.request(utils.merge(config || {}, {
        method: method,
        url: url
      }));
    };
  });
  utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
    /*eslint func-names:0*/
    Axios.prototype[method] = function (url, data, config) {
      return this.request(utils.merge(config || {}, {
        method: method,
        url: url,
        data: data
      }));
    };
  });
  var Axios_1 = Axios;

  /**
   * A `Cancel` is an object that is thrown when an operation is canceled.
   *
   * @class
   * @param {string=} message The message.
   */

  function Cancel(message) {
    this.message = message;
  }

  Cancel.prototype.toString = function toString() {
    return 'Cancel' + (this.message ? ': ' + this.message : '');
  };

  Cancel.prototype.__CANCEL__ = true;
  var Cancel_1 = Cancel;

  /**
   * A `CancelToken` is an object that can be used to request cancellation of an operation.
   *
   * @class
   * @param {Function} executor The executor function.
   */


  function CancelToken(executor) {
    if (typeof executor !== 'function') {
      throw new TypeError('executor must be a function.');
    }

    var resolvePromise;
    this.promise = new Promise(function promiseExecutor(resolve) {
      resolvePromise = resolve;
    });
    var token = this;
    executor(function cancel(message) {
      if (token.reason) {
        // Cancellation has already been requested
        return;
      }

      token.reason = new Cancel_1(message);
      resolvePromise(token.reason);
    });
  }
  /**
   * Throws a `Cancel` if cancellation has been requested.
   */


  CancelToken.prototype.throwIfRequested = function throwIfRequested() {
    if (this.reason) {
      throw this.reason;
    }
  };
  /**
   * Returns an object that contains a new `CancelToken` and a function that, when called,
   * cancels the `CancelToken`.
   */


  CancelToken.source = function source() {
    var cancel;
    var token = new CancelToken(function executor(c) {
      cancel = c;
    });
    return {
      token: token,
      cancel: cancel
    };
  };

  var CancelToken_1 = CancelToken;

  /**
   * Syntactic sugar for invoking a function and expanding an array for arguments.
   *
   * Common use case would be to use `Function.prototype.apply`.
   *
   *  ```js
   *  function f(x, y, z) {}
   *  var args = [1, 2, 3];
   *  f.apply(null, args);
   *  ```
   *
   * With `spread` this example can be re-written.
   *
   *  ```js
   *  spread(function(x, y, z) {})([1, 2, 3]);
   *  ```
   *
   * @param {Function} callback
   * @returns {Function}
   */

  var spread = function spread(callback) {
    return function wrap(arr) {
      return callback.apply(null, arr);
    };
  };

  /**
   * Create an instance of Axios
   *
   * @param {Object} defaultConfig The default config for the instance
   * @return {Axios} A new instance of Axios
   */


  function createInstance(defaultConfig) {
    var context = new Axios_1(defaultConfig);
    var instance = bind$1(Axios_1.prototype.request, context); // Copy axios.prototype to instance

    utils.extend(instance, Axios_1.prototype, context); // Copy context to instance

    utils.extend(instance, context);
    return instance;
  } // Create the default instance to be exported


  var axios = createInstance(defaults_1); // Expose Axios class to allow class inheritance

  axios.Axios = Axios_1; // Factory for creating new instances

  axios.create = function create(instanceConfig) {
    return createInstance(mergeConfig(axios.defaults, instanceConfig));
  }; // Expose Cancel & CancelToken


  axios.Cancel = Cancel_1;
  axios.CancelToken = CancelToken_1;
  axios.isCancel = isCancel; // Expose all/spread

  axios.all = function all(promises) {
    return Promise.all(promises);
  };

  axios.spread = spread;
  var axios_1 = axios; // Allow use of default import syntax in TypeScript

  var _default = axios;
  axios_1.default = _default;

  var axios$1 = axios_1;

  //
  var script = Vue.extend({
    name: "LinkWithImageInTitle",
    props: {
      itemName: String,
      itemPictureUrl: String
    },
    computed: {
      GetTitleImage: function GetTitleImage() {
        return "<img src='" + this.itemPictureUrl + "' class='img-responsive' alt='" + this.itemName + "' />";
      }
    }
  });

  function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
  /* server only */
  , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
    if (typeof shadowMode !== 'boolean') {
      createInjectorSSR = createInjector;
      createInjector = shadowMode;
      shadowMode = false;
    } // Vue.extend constructor export interop.


    const options = typeof script === 'function' ? script.options : script; // render functions

    if (template && template.render) {
      options.render = template.render;
      options.staticRenderFns = template.staticRenderFns;
      options._compiled = true; // functional template

      if (isFunctionalTemplate) {
        options.functional = true;
      }
    } // scopedId


    if (scopeId) {
      options._scopeId = scopeId;
    }

    let hook;

    if (moduleIdentifier) {
      // server build
      hook = function (context) {
        // 2.3 injection
        context = context || // cached call
        this.$vnode && this.$vnode.ssrContext || // stateful
        this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
        // 2.2 with runInNewContext: true

        if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
          context = __VUE_SSR_CONTEXT__;
        } // inject component styles


        if (style) {
          style.call(this, createInjectorSSR(context));
        } // register component module identifier for async chunk inference


        if (context && context._registeredComponents) {
          context._registeredComponents.add(moduleIdentifier);
        }
      }; // used by ssr in case component is cached and beforeCreate
      // never gets called


      options._ssrRegister = hook;
    } else if (style) {
      hook = shadowMode ? function (context) {
        style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
      } : function (context) {
        style.call(this, createInjector(context));
      };
    }

    if (hook) {
      if (options.functional) {
        // register for functional component in vue file
        const originalRender = options.render;

        options.render = function renderWithStyleInjection(h, context) {
          hook.call(context);
          return originalRender(h, context);
        };
      } else {
        // inject component registration as beforeCreate hook
        const existing = options.beforeCreate;
        options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
      }
    }

    return script;
  }

  /* script */
  const __vue_script__ = script;

  /* template */
  var __vue_render__ = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c(
      "a",
      {
        staticClass: "tooltip-image",
        attrs: {
          "data-toggle": "tooltip",
          "data-placement": "bottom",
          title: _vm.GetTitleImage
        }
      },
      [_vm._v(_vm._s(_vm.itemName))]
    )
  };
  var __vue_staticRenderFns__ = [];
  __vue_render__._withStripped = true;

    /* style */
    const __vue_inject_styles__ = undefined;
    /* scoped */
    const __vue_scope_id__ = undefined;
    /* module identifier */
    const __vue_module_identifier__ = undefined;
    /* functional template */
    const __vue_is_functional_template__ = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__ = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
      __vue_inject_styles__,
      __vue_script__,
      __vue_scope_id__,
      __vue_is_functional_template__,
      __vue_module_identifier__,
      false,
      undefined,
      undefined,
      undefined
    );

  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  function ownKeys(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      if (enumerableOnly) symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      });
      keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread2(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i] != null ? arguments[i] : {};

      if (i % 2) {
        ownKeys(Object(source), true).forEach(function (key) {
          _defineProperty(target, key, source[key]);
        });
      } else if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
      } else {
        ownKeys(Object(source)).forEach(function (key) {
          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
      }
    }

    return target;
  }

  var _props;
  var script$1 = Vue.extend({
    name: "ValidatingInput",
    props: (_props = {
      value: String,
      required: Boolean,
      requiredErrorMessage: String,
      invalid: Boolean,
      invalidErrorMessage: String,
      valueTooLong: Boolean,
      valueTooLongErrorMessage: String
    }, _defineProperty(_props, 'inputType', String), _defineProperty(_props, 'extraClass', String), _defineProperty(_props, 'placeholder', String), _defineProperty(_props, "shoppingCart", {}), _defineProperty(_props, "requiredPropName", String), _defineProperty(_props, "invalidPropName", String), _defineProperty(_props, "valueTooLongPropName", String), _defineProperty(_props, "inputId", String), _defineProperty(_props, "maxLength", Number), _defineProperty(_props, "disabled", Boolean), _props),
    data: function data() {
      return _objectSpread2({}, this.shoppingCart);
    },
    methods: {
      inputChanged: function inputChanged() {
        this.shoppingCart[this.requiredPropName] = false;
        this.shoppingCart[this.invalidPropName] = false;
        this.shoppingCart[this.valueTooLongPropName] = false;
      }
    }
  });

  /* script */
  const __vue_script__$1 = script$1;

  /* template */
  var __vue_render__$1 = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", [
      _c("input", {
        staticClass: "form-control",
        class: _vm.extraClass,
        attrs: {
          id: _vm.inputId,
          disabled: _vm.disabled,
          type: _vm.inputType,
          placeholder: _vm.placeholder,
          maxLength: _vm.maxLength
        },
        domProps: { value: _vm.value },
        on: {
          input: function($event) {
            return _vm.$emit("input", $event.target.value)
          },
          change: _vm.inputChanged
        }
      }),
      _vm._v(" "),
      _vm.required
        ? _c("p", { staticClass: "alert alert-warning d-block text-sm" }, [
            _vm._v(_vm._s(_vm.requiredErrorMessage))
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.invalid
        ? _c("p", { staticClass: "alert alert-warning d-block text-sm" }, [
            _vm._v(_vm._s(_vm.invalidErrorMessage))
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.valueTooLong
        ? _c("p", { staticClass: "alert alert-warning d-block text-sm" }, [
            _vm._v(_vm._s(_vm.valueTooLongErrorMessage))
          ])
        : _vm._e()
    ])
  };
  var __vue_staticRenderFns__$1 = [];
  __vue_render__$1._withStripped = true;

    /* style */
    const __vue_inject_styles__$1 = undefined;
    /* scoped */
    const __vue_scope_id__$1 = undefined;
    /* module identifier */
    const __vue_module_identifier__$1 = undefined;
    /* functional template */
    const __vue_is_functional_template__$1 = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
      __vue_inject_styles__$1,
      __vue_script__$1,
      __vue_scope_id__$1,
      __vue_is_functional_template__$1,
      __vue_module_identifier__$1,
      false,
      undefined,
      undefined,
      undefined
    );

  var script$2 = Vue.extend({
    name: "PublicOfferRequest",
    components: {
      LinkWithImageInTitle: __vue_component__,
      ValidatingInput: __vue_component__$1
    },
    directives: {},
    data: function data() {
      return {
        cartIsLoading: false,
        translations: [],
        shoppingCart: {},
        search: "",
        resultSelect: false,
        selectedProductToAdd: [],
        productsSearchResults: [],
        isProductSearchOpen: false,
        isProductSearchLoading: false,
        currentIndex: -1,
        searchInput: "",
        noSearchResults: false,
        suggestionsList: null
      };
    },
    watch: {},
    created: function created() {
      var _this = this;

      this.cartIsLoading = true;
      this.translations = window['CustomerTranslations'];
      axios$1.get("/api/" + this.getPageID() + "/EditPublicOfferRequestForm").then(function (result) {
        _this.shoppingCart = result.data;
        _this.cartIsLoading = false;
      });
    },
    methods: {
      getPageID: function getPageID() {
        if (typeof window['E21PageData'] == "undefined") {
          return $("body > form").attr("data-pageid").toString();
        } else {
          return window['E21PageData'].PageID;
        }
      },
      getSuggestionList: function getSuggestionList() {
        return $('.autocomplete-dropdown')[0];
      },
      refreshShoppingCart: function refreshShoppingCart() {
        var _this2 = this;

        axios$1.get("/api/" + this.getPageID() + "/EditPublicOfferRequestForm").then(function (response) {
          _this2.shoppingCart = response.data;

          if (_this2.shoppingCart.ItemModels.length > 0) {
            $('header .amount').html(_this2.shoppingCart.ItemModels.length).show();
          } else {
            $('header .amount').html("");
          }
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("refreshShoppingCart function error: ", error);
          console.error("errorMessage: ", errorMessage);
        }).then(function () {// Re-initializing tooltip because the element's are regenerated and previous events are disgarded.
          // Using timeout because the content is generated slower than what this whole function
          // And there's no after-repeat-do-this functionality in angular.
          //debounce($('[data-toggle="tooltip"]').tooltip({ container: 'table', html: true }), 200);
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("tooltip reinitializing failed: ", error);
          console.error("errorMessage: ", errorMessage);
        });
      },
      updateAmount: function updateAmount(item, index) {
        var _this3 = this;

        //alert('updateAmount: ' + item.ProductID + ', index: ' + index)
        var amount = parseInt(item.SalesQtyUnitAmount, 10);

        if (item.SalesQtyUnitAmount !== null && /^(?!\-)\d+$/.test(item.SalesQtyUnitAmount) == true && amount > 0 && amount.toString() !== "0") {
          //alert('updateAmount: ' + item.ProductID + ', Amount: ' + item.Amount)
          this.shoppingCart.ItemModels[index].Loading = true;
          axios$1.post("/api/" + this.getPageID() + "/EditPublicOfferRequestProducts/UpdateAmount/" + item.ProductID + "?newAmount=" + amount, this.shoppingCart).then(function (response) {
            _this3.shoppingCart.ItemModels[index].Loading = false;

            _this3.refreshShoppingCart();
          }, function (error) {
            var errorMessage = error.data.Message || error.statusText;
            console.error("updateAmount: bug has been caught!");
            console.error("errorMessage: ", errorMessage);
          });
        }
      },
      removeItemFromCart: function removeItemFromCart(item, event) {
        var _this4 = this;

        event.preventDefault;
        axios$1.post("/api/" + this.getPageID() + "/EditPublicOfferRequestProducts/DeleteRow/" + item.ProductID, this.shoppingCart).then(function (response) {
          _this4.refreshShoppingCart();
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("removeItemFromCart: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      acceptOfferRequest: function acceptOfferRequest(event) {
        var _this5 = this;

        event.preventDefault;
        axios$1.post("/api/" + this.getPageID() + "/EditPublicOfferRequestForm/AcceptCart", this.shoppingCart).then(function (response) {
          var hbFeedbackFieldVal = $('#hb-feedback-field').val();
          var URLtoAcceptedPage = "";

          var windowE21 = _.property('E21')(window);

          URLtoAcceptedPage = windowE21.Mercamer.Redirect.UrlToAcceptedView;

          if (hbFeedbackFieldVal === "" && response.data.CartIsValid) {
            window.location.href = URLtoAcceptedPage;
          } else {
            _this5.shoppingCart = response.data;
          }
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("acceptOfferRequest functions error: ");
          console.error("errorMessage: ", errorMessage);
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("acceptOfferRequest: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      quickProductAdd: function quickProductAdd() {
        var _this6 = this;

        if (this.selectedProductToAdd && this.selectedProductToAdd.value) {
          var productId = this.selectedProductToAdd.value;
          this.selectedProductToAdd.value = null;
          axios$1.post("/api/" + this.getPageID() + "/EditPublicOfferRequestProducts/AddToCart/" + productId, this.shoppingCart).then(function (response) {
            _this6.refreshShoppingCart();

            _this6.search = "";
            _this6.searchInput = "";
            _this6.selectedProductToAdd = null;
          }, function (error) {
            var errorMessage = error.data.Message || error.statusText;
            console.error("$scope.quickProductAdd.add functions error:");
            console.error("errorMessage: ", errorMessage);
          }).then(function () {
            $(".autocomplete-text.toolbarProp").val("");
          });
        }
      },
      searchProducts: function searchProducts() {
        var _this7 = this;

        if (this.search) {
          this.noSearchResults = false;
          this.searchInput = this.search;
          this.isProductSearchLoading = true;
          this.isProductSearchOpen = true;
          axios$1.get("/api/ProductsQuickSearch?search=" + this.search).then(function (response) {
            if (response.data && response.data.length) {
              _this7.resultSelect = false;
              _this7.productsSearchResults = response.data;
            } else {
              _this7.noSearchResults = true;
              _this7.productsSearchResults = [];
            }

            _this7.isProductSearchLoading = false;
          });
        } else {
          this.isProductSearchLoading = false;
          this.searchInput = null;
          this.isProductSearchOpen = false;
          this.productsSearchResults = [];
          this.selectedProductToAdd = null;
          this.currentIndex = -1;
        }
      },
      setProductSearchResult: function setProductSearchResult(result) {
        if (result) {
          //alert('setProductSearchResult');
          this.search = result.label;
          this.searchInput = this.search;
          this.resultSelect = true;
          this.selectedProductToAdd = result;
          this.isProductSearchOpen = false;
          this.isProductSearchLoading = false;
          this.clearResults();
          this.currentIndex = -1;
        }
      },
      highlightProductSearchResult: function highlightProductSearchResult(searchResultLabel, searchWord) {
        var result;
        var matcher = new RegExp(searchWord.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), "i");
        var match = searchResultLabel.match(matcher);

        if (match) {
          result = searchResultLabel.replace(matcher, '<span class="matched-text">' + match[0] + '</span>');
        } else {
          result = searchResultLabel;
        }

        return result;
      },
      hoverRowProductSearch: function hoverRowProductSearch(index) {
        this.currentIndex = index;

        if (this.productsSearchResults) {
          this.selectedProductToAdd = this.productsSearchResults[this.currentIndex];
        }
      },
      hoverOutProductSearch: function hoverOutProductSearch(index) {
        this.selectedProductToAdd = null;
        this.currentIndex = -1;
      },
      hideProductSearchResults: function hideProductSearchResults(event) {
        if (this.resultSelect === false) {
          //this.search = this.searchInput;
          this.clearResults();

          if (this.selectedProductToAdd) {
            this.setProductSearchResult(this.selectedProductToAdd);
          }

          this.isProductSearchLoading = false;
          this.isProductSearchOpen = false;
          this.noSearchResults = false;
        }
      },
      clearResults: function clearResults() {
        this.isProductSearchOpen = false;
        this.productsSearchResults = [];
      },
      onArrowDown: function onArrowDown(event) {
        if (this.productsSearchResults) {
          event.preventDefault();

          if (this.currentIndex + 1 < this.productsSearchResults.length) {
            this.currentIndex++;
            this.search = this.productsSearchResults[this.currentIndex].label;
            this.adjustddHeight();
          } else if (this.currentIndex + 1 === this.productsSearchResults.length) {
            this.currentIndex = -1;
            this.search = this.searchInput;
            this.scrollToTop();
          }
        }
      },
      onArrowUp: function onArrowUp(event) {
        if (this.productsSearchResults) {
          event.preventDefault();

          if (this.currentIndex >= 1) {
            this.currentIndex--;
            this.search = this.productsSearchResults[this.currentIndex].label;
            this.adjustddHeight();
          } else if (this.currentIndex === 0) {
            this.currentIndex = -1;
            this.search = this.searchInput;
          } else if (this.currentIndex === -1) {
            this.currentIndex = this.productsSearchResults.length - 1;
            this.search = this.productsSearchResults[this.currentIndex].label;
            this.scrollToBottom();
          }
        }
      },
      adjustddHeight: function adjustddHeight() {
        if (this.isScrollNeeded()) {
          var ddCSS = getComputedStyle(this.getSuggestionList());
          var borderTop, paddingTop, offset, scroll, ddHeight, rowHeight;
          var row = $('.autocomplete-row')[this.currentIndex];
          borderTop = parseInt(ddCSS.borderTopWidth, 10) || 0;
          paddingTop = parseInt(ddCSS.paddingTop, 10) || 0;
          offset = row.getBoundingClientRect().top - this.getSuggestionList().getBoundingClientRect().top - borderTop - paddingTop;
          scroll = this.getSuggestionList().scrollTop;
          ddHeight = this.getSuggestionList().offsetHeight;
          rowHeight = row.offsetHeight;

          if (offset < 0) {
            this.getSuggestionList().scrollTop = scroll + offset;
          } else if (offset + rowHeight > ddHeight) {
            this.getSuggestionList().scrollTop = scroll + offset - ddHeight + rowHeight;
          }
        }
      },
      scrollToTop: function scrollToTop() {
        if (this.isScrollNeeded()) {
          var row = $('.autocomplete-row')[0];
          this.getSuggestionList().scrollTop = -1 * row.offsetHeight;
        }
      },
      scrollToBottom: function scrollToBottom() {
        if (this.isScrollNeeded()) {
          var row = $('.autocomplete-row')[this.productsSearchResults.length - 1];
          this.getSuggestionList().scrollTop = row.getBoundingClientRect().top;
        }
      },
      isScrollNeeded: function isScrollNeeded() {
        var ddCSS = getComputedStyle(this.getSuggestionList());
        return this.getSuggestionList().scrollHeight > this.getSuggestionList().clientHeight && (ddCSS.overflowY === 'auto' || ddCSS.overflowY === 'visible' || ddCSS.overflowY === 'scroll');
      },
      onEnter: function onEnter(event) {
        if (this.productsSearchResults) {
          if (this.currentIndex >= 0 && this.currentIndex < this.productsSearchResults.length) {
            event.preventDefault();
            this.setProductSearchResult(this.productsSearchResults[this.currentIndex]);
          } else {
            this.clearResults();
            this.isProductSearchOpen = false;
            this.isProductSearchLoading = false;
          }

          this.quickProductAdd();
        }
      }
    },
    computed: {
      itemsEmpty: function itemsEmpty() {
        return this.shoppingCart.ItemModels && this.shoppingCart.ItemModels.length < 1;
      }
    }
  });

  /* script */
  const __vue_script__$2 = script$2;

  /* template */
  var __vue_render__$2 = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "offer-request-cart-view" }, [
      _c("div", { staticClass: "add-by-product-no" }, [
        _c("div", { staticClass: "add-product-container" }, [
          _c("div", { staticClass: "autocomplete-content w-100" }, [
            _c("div", { staticClass: "input-group" }, [
              _c("input", {
                directives: [
                  {
                    name: "model",
                    rawName: "v-model",
                    value: _vm.search,
                    expression: "search"
                  }
                ],
                staticClass: "autocomplete-text toolbarProp form-control",
                class: { loading: _vm.isProductSearchLoading },
                attrs: {
                  type: "text",
                  placeholder: "Hae tuotenumerolla tai -nimellä",
                  autocapitalize: "off",
                  autocorrect: "off",
                  autocomplete: "off"
                },
                domProps: { value: _vm.search },
                on: {
                  keyup: [
                    _vm.searchProducts,
                    function($event) {
                      if (
                        !$event.type.indexOf("key") &&
                        _vm._k($event.keyCode, "down", 40, $event.key, [
                          "Down",
                          "ArrowDown"
                        ])
                      ) {
                        return null
                      }
                      return _vm.onArrowDown($event)
                    },
                    function($event) {
                      if (
                        !$event.type.indexOf("key") &&
                        _vm._k($event.keyCode, "up", 38, $event.key, [
                          "Up",
                          "ArrowUp"
                        ])
                      ) {
                        return null
                      }
                      return _vm.onArrowUp($event)
                    },
                    function($event) {
                      if (
                        !$event.type.indexOf("key") &&
                        _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
                      ) {
                        return null
                      }
                      return _vm.onEnter($event)
                    }
                  ],
                  focus: _vm.searchProducts,
                  blur: function($event) {
                    $event.preventDefault();
                    return _vm.hideProductSearchResults($event)
                  },
                  input: function($event) {
                    if ($event.target.composing) {
                      return
                    }
                    _vm.search = $event.target.value;
                  }
                }
              }),
              _vm._v(" "),
              _c("div", { staticClass: "input-group-append" }, [
                _c(
                  "a",
                  {
                    staticClass: "btn btn-primary",
                    attrs: { href: "#" },
                    on: {
                      click: function($event) {
                        return _vm.quickProductAdd()
                      }
                    }
                  },
                  [_vm._v("Lisää tarjouspyyntöön")]
                )
              ])
            ]),
            _vm._v(" "),
            _c(
              "div",
              {
                directives: [
                  {
                    name: "show",
                    rawName: "v-show",
                    value: _vm.isProductSearchOpen,
                    expression: "isProductSearchOpen"
                  }
                ],
                staticClass: "autocomplete-dropdown"
              },
              [
                _c(
                  "ul",
                  { staticClass: "autocomplete-list results list-unstyled mb-0" },
                  _vm._l(_vm.productsSearchResults, function(result, i) {
                    return _c(
                      "li",
                      {
                        key: i,
                        staticClass: "autocomplete-row",
                        class: {
                          "autocomplete-highlight-row": i === _vm.currentIndex
                        },
                        on: {
                          click: function($event) {
                            return _vm.setProductSearchResult(result)
                          },
                          mouseenter: function($event) {
                            return _vm.hoverRowProductSearch(i)
                          },
                          mouseleave: function($event) {
                            return _vm.hoverOutProductSearch(i)
                          }
                        }
                      },
                      [
                        _c("span", {
                          staticClass: "autocomplete-title",
                          domProps: {
                            innerHTML: _vm._s(
                              _vm.highlightProductSearchResult(
                                result.label,
                                _vm.search
                              )
                            )
                          }
                        })
                      ]
                    )
                  }),
                  0
                )
              ]
            ),
            _vm._v(" "),
            _vm.isProductSearchLoading
              ? _c("div", { staticClass: "autocomplete-search-text" }, [
                  _vm._v("Haetaan...")
                ])
              : _vm._e(),
            _vm._v(" "),
            _vm.noSearchResults
              ? _c(
                  "div",
                  {
                    staticClass:
                      "autocomplete-search-text alert alert-warning mb-0"
                  },
                  [_vm._v("Emme löytäneet tuloksia käyttämälläsi hakusanalla.")]
                )
              : _vm._e()
          ])
        ])
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "table-responsive" }, [
        _c("table", { staticClass: "table table-striped table offer-table" }, [
          _vm._m(0),
          _vm._v(" "),
          _c(
            "tbody",
            _vm._l(_vm.shoppingCart.ItemModels, function(item, index) {
              return _c("tr", { key: item.ProductID }, [
                _c(
                  "td",
                  {
                    staticClass: "align-middle text-muted",
                    attrs: { "data-label": "Tuotenumero" }
                  },
                  [_vm._v(_vm._s(item.ProductNumber))]
                ),
                _vm._v(" "),
                _c(
                  "td",
                  {
                    staticClass: "align-middle",
                    attrs: { "data-label": "Nimi" }
                  },
                  [_vm._v("\n\t\t\t\t\t\t" + _vm._s(item.Name) + "\n\t\t\t\t\t")]
                ),
                _vm._v(" "),
                _c(
                  "td",
                  {
                    staticClass: "add-to-cart-row align-middle",
                    attrs: { "data-label": "Määrä" }
                  },
                  [
                    _c(
                      "div",
                      { staticClass: "form-inline add-to-cart-container" },
                      [
                        _c("div", { staticClass: "input-group update-amount" }, [
                          _c("input", {
                            directives: [
                              {
                                name: "model",
                                rawName: "v-model.number",
                                value: item.SalesQtyUnitAmount,
                                expression: "item.SalesQtyUnitAmount",
                                modifiers: { number: true }
                              }
                            ],
                            staticClass: "form-control amount input-amount",
                            class: {
                              "amount-invalid": item.SalesQtyUnitAmount < 1
                            },
                            attrs: {
                              type: "number",
                              "data-product-id": item.ProductID
                            },
                            domProps: { value: item.SalesQtyUnitAmount },
                            on: {
                              change: function($event) {
                                return _vm.updateAmount(item, index)
                              },
                              input: function($event) {
                                if ($event.target.composing) {
                                  return
                                }
                                _vm.$set(
                                  item,
                                  "SalesQtyUnitAmount",
                                  _vm._n($event.target.value)
                                );
                              },
                              blur: function($event) {
                                return _vm.$forceUpdate()
                              }
                            }
                          }),
                          _vm._v(" "),
                          _c("div", { staticClass: "input-group-append" }, [
                            _c("div", { staticClass: "input-group-text" }, [
                              _vm._v(
                                "\n\t\t\t\t\t\t\t\t\t\t" +
                                  _vm._s(item.SalesQtyUnit) +
                                  "\n\t\t\t\t\t\t\t\t\t\t"
                              ),
                              item.Loading
                                ? _c("i", {
                                    staticClass:
                                      "fa fa-cog fa-spin loading-icon fa2x"
                                  })
                                : _vm._e()
                            ])
                          ])
                        ])
                      ]
                    )
                  ]
                ),
                _vm._v(" "),
                _c("td", { staticClass: "align-middle text-right" }, [
                  _c(
                    "a",
                    {
                      staticClass: "remove-item btn btn-link",
                      attrs: { href: "#", "data-product-id": item.ProductID },
                      on: {
                        click: function($event) {
                          return _vm.removeItemFromCart(item, $event)
                        }
                      }
                    },
                    [_c("i", { staticClass: "fal fa-trash-alt" })]
                  )
                ])
              ])
            }),
            0
          ),
          _vm._v(" "),
          _vm.cartIsLoading ? _c("tbody", [_vm._m(1)]) : _vm._e()
        ])
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "row add-margin-top" }, [
        _c("div", { staticClass: "col-md-12" }, [
          _c("div", { staticClass: "card shadow customer-info" }, [
            _c("div", { staticClass: "card-body" }, [
              _c("h2", { staticClass: "card-title" }, [_vm._v("Yhteystiedot")]),
              _vm._v(" "),
              _c("div", { staticClass: "row" }, [
                _c("div", { staticClass: "col-md-7" }, [
                  _c("div", { staticClass: "form-row" }, [
                    _c("div", { staticClass: "col-md-6" }, [
                      _c(
                        "div",
                        { staticClass: "form-group" },
                        [
                          _c("label", [_vm._v("Etunimi*")]),
                          _vm._v(" "),
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.shoppingCart,
                              requiredPropName: "UserFirstNameRequired",
                              inputType: "text",
                              required: _vm.shoppingCart.UserFirstNameRequired,
                              requiredErrorMessage: "Etunimi on pakollinen"
                            },
                            model: {
                              value: _vm.shoppingCart.UserFirstName,
                              callback: function($$v) {
                                _vm.$set(_vm.shoppingCart, "UserFirstName", $$v);
                              },
                              expression: "shoppingCart.UserFirstName"
                            }
                          })
                        ],
                        1
                      )
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6" }, [
                      _c(
                        "div",
                        { staticClass: "form-group" },
                        [
                          _c("label", [_vm._v("Sukunimi*")]),
                          _vm._v(" "),
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.shoppingCart,
                              requiredPropName: "UserLastnameRequired",
                              inputType: "text",
                              required: _vm.shoppingCart.UserLastnameRequired,
                              requiredErrorMessage: "Sukunimi on pakollinen"
                            },
                            model: {
                              value: _vm.shoppingCart.UserLastname,
                              callback: function($$v) {
                                _vm.$set(_vm.shoppingCart, "UserLastname", $$v);
                              },
                              expression: "shoppingCart.UserLastname"
                            }
                          })
                        ],
                        1
                      )
                    ])
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "form-row" }, [
                    _c("div", { staticClass: "col-md-6" }, [
                      _c(
                        "div",
                        { staticClass: "form-group" },
                        [
                          _c("label", [_vm._v("Sähköposti*")]),
                          _vm._v(" "),
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.shoppingCart,
                              requiredPropName: "UserEmailRequired",
                              invalidPropName: "UserEmailInvalid",
                              inputType: "email",
                              required: _vm.shoppingCart.UserEmailRequired,
                              requiredErrorMessage: "Sähköposti on pakollinen",
                              invalid: _vm.shoppingCart.UserEmailInvalid,
                              invalidErrorMessage: "Sähköposti on väärää muotoa"
                            },
                            model: {
                              value: _vm.shoppingCart.UserEmail,
                              callback: function($$v) {
                                _vm.$set(_vm.shoppingCart, "UserEmail", $$v);
                              },
                              expression: "shoppingCart.UserEmail"
                            }
                          })
                        ],
                        1
                      )
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6" }, [
                      _c("div", { staticClass: "form-group" }, [
                        _c("label", [_vm._v("Puhelin")]),
                        _vm._v(" "),
                        _c("input", {
                          directives: [
                            {
                              name: "model",
                              rawName: "v-model",
                              value: _vm.shoppingCart.Phone,
                              expression: "shoppingCart.Phone"
                            }
                          ],
                          staticClass: "form-control",
                          domProps: { value: _vm.shoppingCart.Phone },
                          on: {
                            input: function($event) {
                              if ($event.target.composing) {
                                return
                              }
                              _vm.$set(
                                _vm.shoppingCart,
                                "Phone",
                                $event.target.value
                              );
                            }
                          }
                        })
                      ])
                    ])
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "form-row" }, [
                    _c("div", { staticClass: "col-md-6" }, [
                      _c(
                        "div",
                        { staticClass: "form-group" },
                        [
                          _c("label", [_vm._v("Yritys*")]),
                          _vm._v(" "),
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.shoppingCart,
                              requiredPropName: "CompanyNameRequired",
                              inputType: "text",
                              required: _vm.shoppingCart.CompanyNameRequired,
                              requiredErrorMessage: "Yritys on pakollinen"
                            },
                            model: {
                              value: _vm.shoppingCart.CompanyName,
                              callback: function($$v) {
                                _vm.$set(_vm.shoppingCart, "CompanyName", $$v);
                              },
                              expression: "shoppingCart.CompanyName"
                            }
                          })
                        ],
                        1
                      )
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6" }, [
                      _c(
                        "div",
                        { staticClass: "form-group" },
                        [
                          _c("label", [_vm._v("Y-tunnus*")]),
                          _vm._v(" "),
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.shoppingCart,
                              requiredPropName: "CompanyVATRequired",
                              inputType: "text",
                              required: _vm.shoppingCart.CompanyVATRequired,
                              requiredErrorMessage: "Y-tunnus on pakollinen"
                            },
                            model: {
                              value: _vm.shoppingCart.CompanyVAT,
                              callback: function($$v) {
                                _vm.$set(_vm.shoppingCart, "CompanyVAT", $$v);
                              },
                              expression: "shoppingCart.CompanyVAT"
                            }
                          })
                        ],
                        1
                      )
                    ])
                  ])
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "col-md-5" }, [
                  _c("div", { staticClass: "form-row" }, [
                    _c("div", { staticClass: "col-md-12" }, [
                      _c("div", { staticClass: "form-group additional" }, [
                        _c("label", [_vm._v("Lisätiedot")]),
                        _vm._v(" "),
                        _c("textarea", {
                          directives: [
                            {
                              name: "model",
                              rawName: "v-model",
                              value: _vm.shoppingCart.AdditionalInfo,
                              expression: "shoppingCart.AdditionalInfo"
                            }
                          ],
                          staticClass: "form-control",
                          attrs: { rows: "4", cols: "20" },
                          domProps: { value: _vm.shoppingCart.AdditionalInfo },
                          on: {
                            input: function($event) {
                              if ($event.target.composing) {
                                return
                              }
                              _vm.$set(
                                _vm.shoppingCart,
                                "AdditionalInfo",
                                $event.target.value
                              );
                            }
                          }
                        })
                      ])
                    ])
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "form-row" }, [
                    _c("div", { staticClass: "col-md-12" }, [
                      _c("div", { staticClass: "form-check vertical-rythm" }, [
                        _c("input", {
                          directives: [
                            {
                              name: "model",
                              rawName: "v-model",
                              value: _vm.shoppingCart.AcceptTerms,
                              expression: "shoppingCart.AcceptTerms"
                            }
                          ],
                          staticClass: "form-check-input",
                          attrs: { type: "checkbox" },
                          domProps: {
                            checked: Array.isArray(_vm.shoppingCart.AcceptTerms)
                              ? _vm._i(_vm.shoppingCart.AcceptTerms, null) > -1
                              : _vm.shoppingCart.AcceptTerms
                          },
                          on: {
                            change: function($event) {
                              var $$a = _vm.shoppingCart.AcceptTerms,
                                $$el = $event.target,
                                $$c = $$el.checked ? true : false;
                              if (Array.isArray($$a)) {
                                var $$v = null,
                                  $$i = _vm._i($$a, $$v);
                                if ($$el.checked) {
                                  $$i < 0 &&
                                    _vm.$set(
                                      _vm.shoppingCart,
                                      "AcceptTerms",
                                      $$a.concat([$$v])
                                    );
                                } else {
                                  $$i > -1 &&
                                    _vm.$set(
                                      _vm.shoppingCart,
                                      "AcceptTerms",
                                      $$a.slice(0, $$i).concat($$a.slice($$i + 1))
                                    );
                                }
                              } else {
                                _vm.$set(_vm.shoppingCart, "AcceptTerms", $$c);
                              }
                            }
                          }
                        }),
                        _vm._v(" "),
                        _c("label", { staticClass: "form-check-label" }, [
                          _vm._v(
                            "\n\t\t\t\t\t\t\t\t\t\t\tHyväksyn tietojeni tallentamisen kaupankäyntiä varten. Lue lisää "
                          ),
                          _c(
                            "a",
                            {
                              attrs: {
                                href: "/kayttoehdot/tarjouspyynto",
                                target: "_blank"
                              }
                            },
                            [_vm._v("käyttöehdoista")]
                          ),
                          _vm._v(" ja "),
                          _c(
                            "a",
                            {
                              attrs: {
                                href: "/tietosuojaseloste",
                                target: "_blank"
                              }
                            },
                            [_vm._v("tietosuojapolitiikasta")]
                          ),
                          _vm._v(". *\n\t\t\t\t\t\t\t\t\t\t\t"),
                          _vm.shoppingCart.AcceptTermsRequired &&
                          !_vm.shoppingCart.AcceptTerms
                            ? _c("span", { staticClass: "bg-warning" }, [
                                _vm._v(
                                  "Kaupankäynnin käyttöehdot on hyväksyttävä."
                                )
                              ])
                            : _vm._e()
                        ])
                      ]),
                      _vm._v(" "),
                      _c("div", { staticClass: "form-check" }, [
                        _c("input", {
                          directives: [
                            {
                              name: "model",
                              rawName: "v-model",
                              value: _vm.shoppingCart.AllowMarketing,
                              expression: "shoppingCart.AllowMarketing"
                            }
                          ],
                          staticClass: "form-check-input",
                          attrs: { type: "checkbox" },
                          domProps: {
                            checked: Array.isArray(
                              _vm.shoppingCart.AllowMarketing
                            )
                              ? _vm._i(_vm.shoppingCart.AllowMarketing, null) > -1
                              : _vm.shoppingCart.AllowMarketing
                          },
                          on: {
                            change: function($event) {
                              var $$a = _vm.shoppingCart.AllowMarketing,
                                $$el = $event.target,
                                $$c = $$el.checked ? true : false;
                              if (Array.isArray($$a)) {
                                var $$v = null,
                                  $$i = _vm._i($$a, $$v);
                                if ($$el.checked) {
                                  $$i < 0 &&
                                    _vm.$set(
                                      _vm.shoppingCart,
                                      "AllowMarketing",
                                      $$a.concat([$$v])
                                    );
                                } else {
                                  $$i > -1 &&
                                    _vm.$set(
                                      _vm.shoppingCart,
                                      "AllowMarketing",
                                      $$a.slice(0, $$i).concat($$a.slice($$i + 1))
                                    );
                                }
                              } else {
                                _vm.$set(_vm.shoppingCart, "AllowMarketing", $$c);
                              }
                            }
                          }
                        }),
                        _vm._v(" "),
                        _vm._m(2)
                      ])
                    ])
                  ])
                ])
              ])
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "card-footer" }, [
              _c("div", { staticClass: "row" }, [
                _vm._m(3),
                _vm._v(" "),
                _c("div", { staticClass: "col-md-4 text-right" }, [
                  _c("input", {
                    staticStyle: { display: "none" },
                    attrs: {
                      id: "hb-feedback-field",
                      type: "text",
                      autocomplete: "off"
                    }
                  }),
                  _vm._v(" "),
                  _c(
                    "a",
                    {
                      staticClass:
                        "btn btn-lg btn-success btn-block tagmngr-offer-request",
                      class: { disabled: _vm.itemsEmpty },
                      on: {
                        click: function($event) {
                          return _vm.acceptOfferRequest($event)
                        }
                      }
                    },
                    [
                      _c("i", { staticClass: "fal fa-paper-plane mr-1" }),
                      _vm._v("Lähetä tarjouspyyntö")
                    ]
                  )
                ])
              ])
            ])
          ])
        ])
      ])
    ])
  };
  var __vue_staticRenderFns__$2 = [
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("thead", [
        _c("tr", [
          _c(
            "th",
            {
              staticClass: "product-number-row align-middle",
              attrs: { "data-priority": "1" }
            },
            [_vm._v("Tuotenro.")]
          ),
          _vm._v(" "),
          _c("th", { staticClass: "product-name-row align-middle" }, [
            _vm._v("Nimi")
          ]),
          _vm._v(" "),
          _c(
            "th",
            {
              staticClass: "add-to-cart-row align-middle",
              staticStyle: { width: "150px" }
            },
            [_vm._v("Määrä")]
          ),
          _vm._v(" "),
          _c("th", {
            staticClass: "remove-from-cart-row",
            staticStyle: { width: "20px" }
          })
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("tr", [
        _c("td", { attrs: { colspan: "5" } }, [_vm._v("Ladataan tuotteita...")])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("label", { staticClass: "form-check-label" }, [
        _vm._v(
          "\n\t\t\t\t\t\t\t\t\t\t\tHaluan tietoa uutuuksista ja kampanjoista. "
        ),
        _c("a", { attrs: { href: "/kayttoehdot", target: "_blank" } }, [
          _vm._v("Lue lisää käyttöehdoista")
        ]),
        _vm._v(".\n\t\t\t\t\t\t\t\t\t\t")
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8 text-muted" }, [
        _c("span", { staticClass: "text-sm" }, [
          _vm._v(
            "\n\t\t\t\t\t\t\t\tSaat ilmoituksen Tarjouspyynnön vastaanotosta sähköpostiisi. Vastaamme sinulle mahdollisimman pian. Tutustuthan myös "
          ),
          _c("a", { attrs: { href: "/toimitusehdot", target: "_blank" } }, [
            _vm._v("toimitusehtoihin.")
          ])
        ])
      ])
    }
  ];
  __vue_render__$2._withStripped = true;

    /* style */
    const __vue_inject_styles__$2 = undefined;
    /* scoped */
    const __vue_scope_id__$2 = undefined;
    /* module identifier */
    const __vue_module_identifier__$2 = undefined;
    /* functional template */
    const __vue_is_functional_template__$2 = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$2 = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
      __vue_inject_styles__$2,
      __vue_script__$2,
      __vue_scope_id__$2,
      __vue_is_functional_template__$2,
      __vue_module_identifier__$2,
      false,
      undefined,
      undefined,
      undefined
    );

  //
  var script$3 = Vue.extend({
    name: "LinkWithImageInTitle",
    props: {
      itemName: String,
      itemPictureUrl: String
    },
    computed: {
      GetTitleImage: function GetTitleImage() {
        return "<img src='" + this.itemPictureUrl + "' class='img-responsive' alt='" + this.itemName + "' />";
      }
    }
  });

  /* script */
  const __vue_script__$3 = script$3;

  /* template */
  var __vue_render__$3 = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c(
      "a",
      {
        staticClass: "tooltip-image",
        attrs: {
          "data-toggle": "tooltip",
          "data-placement": "bottom",
          title: _vm.GetTitleImage
        }
      },
      [_vm._v(_vm._s(_vm.itemName))]
    )
  };
  var __vue_staticRenderFns__$3 = [];
  __vue_render__$3._withStripped = true;

    /* style */
    const __vue_inject_styles__$3 = undefined;
    /* scoped */
    const __vue_scope_id__$3 = undefined;
    /* module identifier */
    const __vue_module_identifier__$3 = undefined;
    /* functional template */
    const __vue_is_functional_template__$3 = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$3 = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },
      __vue_inject_styles__$3,
      __vue_script__$3,
      __vue_scope_id__$3,
      __vue_is_functional_template__$3,
      __vue_module_identifier__$3,
      false,
      undefined,
      undefined,
      undefined
    );

  var _props$1;
  var script$4 = Vue.extend({
    name: "ValidatingInput",
    props: (_props$1 = {
      value: String,
      required: Boolean,
      requiredErrorMessage: String,
      invalid: Boolean,
      invalidErrorMessage: String,
      valueTooLong: Boolean,
      valueTooLongErrorMessage: String
    }, _defineProperty(_props$1, 'inputType', String), _defineProperty(_props$1, 'extraClass', String), _defineProperty(_props$1, 'placeholder', String), _defineProperty(_props$1, "shoppingCart", {}), _defineProperty(_props$1, "requiredPropName", String), _defineProperty(_props$1, "invalidPropName", String), _defineProperty(_props$1, "valueTooLongPropName", String), _defineProperty(_props$1, "inputId", String), _defineProperty(_props$1, "maxLength", Number), _props$1),
    data: function data() {
      return _objectSpread2({}, this.shoppingCart);
    },
    methods: {
      inputChanged: function inputChanged() {
        this.shoppingCart[this.requiredPropName] = false;
        this.shoppingCart[this.invalidPropName] = false;
        this.shoppingCart[this.valueTooLongPropName] = false;
      }
    }
  });

  /* script */
  const __vue_script__$4 = script$4;

  /* template */
  var __vue_render__$4 = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", [
      _c("input", {
        staticClass: "form-control",
        class: _vm.extraClass,
        attrs: {
          id: _vm.inputId,
          type: _vm.inputType,
          placeholder: _vm.placeholder,
          maxLength: _vm.maxLength
        },
        domProps: { value: _vm.value },
        on: {
          input: function($event) {
            return _vm.$emit("input", $event.target.value)
          },
          change: _vm.inputChanged
        }
      }),
      _vm._v(" "),
      _vm.required
        ? _c("span", { staticClass: "alert alert-warning d-block text-sm" }, [
            _vm._v(_vm._s(_vm.requiredErrorMessage))
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.invalid
        ? _c("span", { staticClass: "alert alert-warning d-block text-sm" }, [
            _vm._v(_vm._s(_vm.invalidErrorMessage))
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.valueTooLong
        ? _c("span", { staticClass: "alert alert-warning d-block text-sm" }, [
            _vm._v(_vm._s(_vm.valueTooLongErrorMessage))
          ])
        : _vm._e()
    ])
  };
  var __vue_staticRenderFns__$4 = [];
  __vue_render__$4._withStripped = true;

    /* style */
    const __vue_inject_styles__$4 = undefined;
    /* scoped */
    const __vue_scope_id__$4 = undefined;
    /* module identifier */
    const __vue_module_identifier__$4 = undefined;
    /* functional template */
    const __vue_is_functional_template__$4 = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$4 = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 },
      __vue_inject_styles__$4,
      __vue_script__$4,
      __vue_scope_id__$4,
      __vue_is_functional_template__$4,
      __vue_module_identifier__$4,
      false,
      undefined,
      undefined,
      undefined
    );

  function isDate$1(value) {
    return value instanceof Date || Object.prototype.toString.call(value) === '[object Date]';
  }
  function toDate(value) {
    if (isDate$1(value)) {
      return new Date(value.getTime());
    }

    if (value == null) {
      return new Date(NaN);
    }

    return new Date(value);
  }
  function isValidDate(value) {
    return isDate$1(value) && !isNaN(value.getTime());
  }
  function startOfWeek(value) {
    var firstDayOfWeek = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

    if (!(firstDayOfWeek >= 0 && firstDayOfWeek <= 6)) {
      throw new RangeError('weekStartsOn must be between 0 and 6');
    }

    var date = toDate(value);
    var day = date.getDay();
    var diff = (day + 7 - firstDayOfWeek) % 7;
    date.setDate(date.getDate() - diff);
    date.setHours(0, 0, 0, 0);
    return date;
  }
  function startOfWeekYear(value) {
    var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        _ref$firstDayOfWeek = _ref.firstDayOfWeek,
        firstDayOfWeek = _ref$firstDayOfWeek === void 0 ? 0 : _ref$firstDayOfWeek,
        _ref$firstWeekContain = _ref.firstWeekContainsDate,
        firstWeekContainsDate = _ref$firstWeekContain === void 0 ? 1 : _ref$firstWeekContain;

    if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
      throw new RangeError('firstWeekContainsDate must be between 1 and 7');
    }

    var date = toDate(value);
    var year = date.getFullYear();
    var firstDateOfFirstWeek = new Date(0);

    for (var i = year + 1; i >= year - 1; i--) {
      firstDateOfFirstWeek.setFullYear(i, 0, firstWeekContainsDate);
      firstDateOfFirstWeek.setHours(0, 0, 0, 0);
      firstDateOfFirstWeek = startOfWeek(firstDateOfFirstWeek, firstDayOfWeek);

      if (date.getTime() >= firstDateOfFirstWeek.getTime()) {
        break;
      }
    }

    return firstDateOfFirstWeek;
  }
  function getWeek(value) {
    var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        _ref2$firstDayOfWeek = _ref2.firstDayOfWeek,
        firstDayOfWeek = _ref2$firstDayOfWeek === void 0 ? 0 : _ref2$firstDayOfWeek,
        _ref2$firstWeekContai = _ref2.firstWeekContainsDate,
        firstWeekContainsDate = _ref2$firstWeekContai === void 0 ? 1 : _ref2$firstWeekContai;

    var date = toDate(value);
    var firstDateOfThisWeek = startOfWeek(date, firstDayOfWeek);
    var firstDateOfFirstWeek = startOfWeekYear(date, {
      firstDayOfWeek: firstDayOfWeek,
      firstWeekContainsDate: firstWeekContainsDate
    });
    var diff = firstDateOfThisWeek.getTime() - firstDateOfFirstWeek.getTime();
    return Math.round(diff / (7 * 24 * 3600 * 1000)) + 1;
  }

  var locale = {
    months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
    monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
    weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
    weekdaysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
    firstDayOfWeek: 0,
    firstWeekContainsDate: 1
  };

  var REGEX_FORMAT = /\[([^\]]+)]|YYYY|YY?|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|Z{1,2}|S{1,3}|w{1,2}|x|X|a|A/g;

  function pad(val) {
    var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
    var output = "".concat(Math.abs(val));
    var sign = val < 0 ? '-' : '';

    while (output.length < len) {
      output = "0".concat(output);
    }

    return sign + output;
  }

  function formatTimezone(offset) {
    var delimeter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
    var sign = offset > 0 ? '-' : '+';
    var absOffset = Math.abs(offset);
    var hours = Math.floor(absOffset / 60);
    var minutes = absOffset % 60;
    return sign + pad(hours, 2) + delimeter + pad(minutes, 2);
  }

  var meridiem = function meridiem(h, _, isLowercase) {
    var word = h < 12 ? 'AM' : 'PM';
    return isLowercase ? word.toLocaleLowerCase() : word;
  };

  var formatFlags = {
    Y: function Y(date) {
      var y = date.getFullYear();
      return y <= 9999 ? "".concat(y) : "+".concat(y);
    },
    // Year: 00, 01, ..., 99
    YY: function YY(date) {
      return pad(date.getFullYear(), 4).substr(2);
    },
    // Year: 1900, 1901, ..., 2099
    YYYY: function YYYY(date) {
      return pad(date.getFullYear(), 4);
    },
    // Month: 1, 2, ..., 12
    M: function M(date) {
      return date.getMonth() + 1;
    },
    // Month: 01, 02, ..., 12
    MM: function MM(date) {
      return pad(date.getMonth() + 1, 2);
    },
    MMM: function MMM(date, locale) {
      return locale.monthsShort[date.getMonth()];
    },
    MMMM: function MMMM(date, locale) {
      return locale.months[date.getMonth()];
    },
    // Day of month: 1, 2, ..., 31
    D: function D(date) {
      return date.getDate();
    },
    // Day of month: 01, 02, ..., 31
    DD: function DD(date) {
      return pad(date.getDate(), 2);
    },
    // Hour: 0, 1, ... 23
    H: function H(date) {
      return date.getHours();
    },
    // Hour: 00, 01, ..., 23
    HH: function HH(date) {
      return pad(date.getHours(), 2);
    },
    // Hour: 1, 2, ..., 12
    h: function h(date) {
      var hours = date.getHours();

      if (hours === 0) {
        return 12;
      }

      if (hours > 12) {
        return hours % 12;
      }

      return hours;
    },
    // Hour: 01, 02, ..., 12
    hh: function hh() {
      var hours = formatFlags.h.apply(formatFlags, arguments);
      return pad(hours, 2);
    },
    // Minute: 0, 1, ..., 59
    m: function m(date) {
      return date.getMinutes();
    },
    // Minute: 00, 01, ..., 59
    mm: function mm(date) {
      return pad(date.getMinutes(), 2);
    },
    // Second: 0, 1, ..., 59
    s: function s(date) {
      return date.getSeconds();
    },
    // Second: 00, 01, ..., 59
    ss: function ss(date) {
      return pad(date.getSeconds(), 2);
    },
    // 1/10 of second: 0, 1, ..., 9
    S: function S(date) {
      return Math.floor(date.getMilliseconds() / 100);
    },
    // 1/100 of second: 00, 01, ..., 99
    SS: function SS(date) {
      return pad(Math.floor(date.getMilliseconds() / 10), 2);
    },
    // Millisecond: 000, 001, ..., 999
    SSS: function SSS(date) {
      return pad(date.getMilliseconds(), 3);
    },
    // Day of week: 0, 1, ..., 6
    d: function d(date) {
      return date.getDay();
    },
    // Day of week: 'Su', 'Mo', ..., 'Sa'
    dd: function dd(date, locale) {
      return locale.weekdaysMin[date.getDay()];
    },
    // Day of week: 'Sun', 'Mon',..., 'Sat'
    ddd: function ddd(date, locale) {
      return locale.weekdaysShort[date.getDay()];
    },
    // Day of week: 'Sunday', 'Monday', ...,'Saturday'
    dddd: function dddd(date, locale) {
      return locale.weekdays[date.getDay()];
    },
    // AM, PM
    A: function A(date, locale) {
      var meridiemFunc = locale.meridiem || meridiem;
      return meridiemFunc(date.getHours(), date.getMinutes(), false);
    },
    // am, pm
    a: function a(date, locale) {
      var meridiemFunc = locale.meridiem || meridiem;
      return meridiemFunc(date.getHours(), date.getMinutes(), true);
    },
    // Timezone: -01:00, +00:00, ... +12:00
    Z: function Z(date) {
      return formatTimezone(date.getTimezoneOffset(), ':');
    },
    // Timezone: -0100, +0000, ... +1200
    ZZ: function ZZ(date) {
      return formatTimezone(date.getTimezoneOffset());
    },
    // Seconds timestamp: 512969520
    X: function X(date) {
      return Math.floor(date.getTime() / 1000);
    },
    // Milliseconds timestamp: 512969520900
    x: function x(date) {
      return date.getTime();
    },
    w: function w(date, locale) {
      return getWeek(date, {
        firstDayOfWeek: locale.firstDayOfWeek,
        firstWeekContainsDate: locale.firstWeekContainsDate
      });
    },
    ww: function ww(date, locale) {
      return pad(formatFlags.w(date, locale), 2);
    }
  };

  function format(val, str) {
    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    var formatStr = str ? String(str) : 'YYYY-MM-DDTHH:mm:ss.SSSZ';
    var date = toDate(val);

    if (!isValidDate(date)) {
      return 'Invalid Date';
    }

    var locale$1 = options.locale || locale;
    return formatStr.replace(REGEX_FORMAT, function (match, p1) {
      if (p1) {
        return p1;
      }

      if (typeof formatFlags[match] === 'function') {
        return "".concat(formatFlags[match](date, locale$1));
      }

      return match;
    });
  }

  function _toConsumableArray(arr) {
    return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
  }

  function _nonIterableSpread() {
    throw new TypeError("Invalid attempt to spread non-iterable instance");
  }

  function _iterableToArray(iter) {
    if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
  }

  function _arrayWithoutHoles(arr) {
    if (Array.isArray(arr)) {
      for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
        arr2[i] = arr[i];
      }

      return arr2;
    }
  }

  function ownKeys$1(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      if (enumerableOnly) symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      });
      keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i] != null ? arguments[i] : {};

      if (i % 2) {
        ownKeys$1(source, true).forEach(function (key) {
          _defineProperty$1(target, key, source[key]);
        });
      } else if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
      } else {
        ownKeys$1(source).forEach(function (key) {
          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
      }
    }

    return target;
  }

  function _slicedToArray(arr, i) {
    return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
  }

  function _nonIterableRest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance");
  }

  function _iterableToArrayLimit(arr, i) {
    if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
      return;
    }

    var _arr = [];
    var _n = true;
    var _d = false;
    var _e = undefined;

    try {
      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
        _arr.push(_s.value);

        if (i && _arr.length === i) break;
      }
    } catch (err) {
      _d = true;
      _e = err;
    } finally {
      try {
        if (!_n && _i["return"] != null) _i["return"]();
      } finally {
        if (_d) throw _e;
      }
    }

    return _arr;
  }

  function _arrayWithHoles(arr) {
    if (Array.isArray(arr)) return arr;
  }

  function _defineProperty$1(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }
  var formattingTokens = /(\[[^\[]*\])|(MM?M?M?|Do|DD?|ddd?d?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|S{1,3}|x|X|ZZ?|.)/g;
  var match1 = /\d/; // 0 - 9

  var match2 = /\d\d/; // 00 - 99

  var match3 = /\d{3}/; // 000 - 999

  var match4 = /\d{4}/; // 0000 - 9999

  var match1to2 = /\d\d?/; // 0 - 99

  var matchShortOffset = /[+-]\d\d:?\d\d/; // +00:00 -00:00 +0000 or -0000

  var matchSigned = /[+-]?\d+/; // -inf - inf

  var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  // const matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; // Word

  var YEAR = 'year';
  var MONTH = 'month';
  var DAY = 'day';
  var HOUR = 'hour';
  var MINUTE = 'minute';
  var SECOND = 'second';
  var MILLISECOND = 'millisecond';
  var parseFlags = {};

  var addParseFlag = function addParseFlag(token, regex, callback) {
    var tokens = Array.isArray(token) ? token : [token];
    var func;

    if (typeof callback === 'string') {
      func = function func(input) {
        var value = parseInt(input, 10);
        return _defineProperty$1({}, callback, value);
      };
    } else {
      func = callback;
    }

    tokens.forEach(function (key) {
      parseFlags[key] = [regex, func];
    });
  };

  var escapeStringRegExp = function escapeStringRegExp(str) {
    return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
  };

  var matchWordRegExp = function matchWordRegExp(localeKey) {
    return function (locale) {
      var array = locale[localeKey];

      if (!Array.isArray(array)) {
        throw new Error("Locale[".concat(localeKey, "] need an array"));
      }

      return new RegExp(array.map(escapeStringRegExp).join('|'));
    };
  };

  var matchWordCallback = function matchWordCallback(localeKey, key) {
    return function (input, locale) {
      var array = locale[localeKey];

      if (!Array.isArray(array)) {
        throw new Error("Locale[".concat(localeKey, "] need an array"));
      }

      var index = array.indexOf(input);

      if (index < 0) {
        throw new Error('Invalid Word');
      }

      return _defineProperty$1({}, key, index);
    };
  };

  addParseFlag('Y', matchSigned, YEAR);
  addParseFlag('YY', match2, function (input) {
    var year = new Date().getFullYear();
    var cent = Math.floor(year / 100);
    var value = parseInt(input, 10);
    value = (value > 68 ? cent - 1 : cent) * 100 + value;
    return _defineProperty$1({}, YEAR, value);
  });
  addParseFlag('YYYY', match4, YEAR);
  addParseFlag('M', match1to2, function (input) {
    return _defineProperty$1({}, MONTH, parseInt(input, 10) - 1);
  });
  addParseFlag('MM', match2, function (input) {
    return _defineProperty$1({}, MONTH, parseInt(input, 10) - 1);
  });
  addParseFlag('MMM', matchWordRegExp('monthsShort'), matchWordCallback('monthsShort', MONTH));
  addParseFlag('MMMM', matchWordRegExp('months'), matchWordCallback('months', MONTH));
  addParseFlag('D', match1to2, DAY);
  addParseFlag('DD', match2, DAY);
  addParseFlag(['H', 'h'], match1to2, HOUR);
  addParseFlag(['HH', 'hh'], match2, HOUR);
  addParseFlag('m', match1to2, MINUTE);
  addParseFlag('mm', match2, MINUTE);
  addParseFlag('s', match1to2, SECOND);
  addParseFlag('ss', match2, SECOND);
  addParseFlag('S', match1, function (input) {
    return _defineProperty$1({}, MILLISECOND, parseInt(input, 10) * 100);
  });
  addParseFlag('SS', match2, function (input) {
    return _defineProperty$1({}, MILLISECOND, parseInt(input, 10) * 10);
  });
  addParseFlag('SSS', match3, MILLISECOND);

  function matchMeridiem(locale) {
    return locale.meridiemParse || /[ap]\.?m?\.?/i;
  }

  function defaultIsPM(input) {
    return "".concat(input).toLowerCase().charAt(0) === 'p';
  }

  addParseFlag(['A', 'a'], matchMeridiem, function (input, locale) {
    var isPM = typeof locale.isPM === 'function' ? locale.isPM(input) : defaultIsPM(input);
    return {
      isPM: isPM
    };
  });

  function offsetFromString(str) {
    var _ref8 = str.match(/([+-]|\d\d)/g) || ['-', '0', '0'],
        _ref9 = _slicedToArray(_ref8, 3),
        symbol = _ref9[0],
        hour = _ref9[1],
        minute = _ref9[2];

    var minutes = parseInt(hour, 10) * 60 + parseInt(minute, 10);

    if (minutes === 0) {
      return 0;
    }

    return symbol === '+' ? -minutes : +minutes;
  }

  addParseFlag(['Z', 'ZZ'], matchShortOffset, function (input) {
    return {
      offset: offsetFromString(input)
    };
  });
  addParseFlag('x', matchSigned, function (input) {
    return {
      date: new Date(parseInt(input, 10))
    };
  });
  addParseFlag('X', matchTimestamp, function (input) {
    return {
      date: new Date(parseFloat(input) * 1000)
    };
  });
  addParseFlag('d', match1, 'weekday');
  addParseFlag('dd', matchWordRegExp('weekdaysMin'), matchWordCallback('weekdaysMin', 'weekday'));
  addParseFlag('ddd', matchWordRegExp('weekdaysShort'), matchWordCallback('weekdaysShort', 'weekday'));
  addParseFlag('dddd', matchWordRegExp('weekdays'), matchWordCallback('weekdays', 'weekday'));
  addParseFlag('w', match1to2, 'week');
  addParseFlag('ww', match2, 'week');

  function to24hour(hour, isPM) {
    if (hour !== undefined && isPM !== undefined) {
      if (isPM) {
        if (hour < 12) {
          return hour + 12;
        }
      } else if (hour === 12) {
        return 0;
      }
    }

    return hour;
  }

  function getFullInputArray(input) {
    var backupDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
    var result = [0, 0, 1, 0, 0, 0, 0];
    var backupArr = [backupDate.getFullYear(), backupDate.getMonth(), backupDate.getDate(), backupDate.getHours(), backupDate.getMinutes(), backupDate.getSeconds(), backupDate.getMilliseconds()];
    var useBackup = true;

    for (var i = 0; i < 7; i++) {
      if (input[i] === undefined) {
        result[i] = useBackup ? backupArr[i] : result[i];
      } else {
        result[i] = input[i];
        useBackup = false;
      }
    }

    return result;
  }

  function createUTCDate() {
    var date;

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var y = args[0];

    if (y < 100 && y >= 0) {
      args[0] += 400;
      date = new Date(Date.UTC.apply(Date, args)); // eslint-disable-next-line no-restricted-globals

      if (isFinite(date.getUTCFullYear())) {
        date.setUTCFullYear(y);
      }
    } else {
      date = new Date(Date.UTC.apply(Date, args));
    }

    return date;
  }

  function makeParser(dateString, format, locale) {
    var tokens = format.match(formattingTokens);

    if (!tokens) {
      throw new Error();
    }

    var length = tokens.length;
    var mark = {};

    for (var i = 0; i < length; i += 1) {
      var token = tokens[i];
      var parseTo = parseFlags[token];

      if (!parseTo) {
        var word = token.replace(/^\[|\]$/g, '');

        if (dateString.indexOf(word) === 0) {
          dateString = dateString.substr(word.length);
        } else {
          throw new Error('not match');
        }
      } else {
        var regex = typeof parseTo[0] === 'function' ? parseTo[0](locale) : parseTo[0];
        var parser = parseTo[1];
        var value = (regex.exec(dateString) || [])[0];
        var obj = parser(value, locale);
        mark = _objectSpread({}, mark, {}, obj);
        dateString = dateString.replace(value, '');
      }
    }

    return mark;
  }

  function parse(str, format) {
    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

    try {
      var _options$locale = options.locale,
          _locale = _options$locale === void 0 ? locale : _options$locale,
          _options$backupDate = options.backupDate,
          backupDate = _options$backupDate === void 0 ? new Date() : _options$backupDate;

      var parseResult = makeParser(str, format, _locale);
      var year = parseResult.year,
          month = parseResult.month,
          day = parseResult.day,
          hour = parseResult.hour,
          minute = parseResult.minute,
          second = parseResult.second,
          millisecond = parseResult.millisecond,
          isPM = parseResult.isPM,
          date = parseResult.date,
          offset = parseResult.offset,
          weekday = parseResult.weekday,
          week = parseResult.week;

      if (date) {
        return date;
      }

      var inputArray = [year, month, day, hour, minute, second, millisecond];
      inputArray[3] = to24hour(inputArray[3], isPM); // check week

      if (week !== undefined && month === undefined && day === undefined) {
        // new Date(year, 3) make sure in current year
        var firstDate = startOfWeekYear(year === undefined ? backupDate : new Date(year, 3), {
          firstDayOfWeek: _locale.firstDayOfWeek,
          firstWeekContainsDate: _locale.firstWeekContainsDate
        });
        return new Date(firstDate.getTime() + (week - 1) * 7 * 24 * 3600 * 1000);
      }

      var utcDate = createUTCDate.apply(void 0, _toConsumableArray(getFullInputArray(inputArray, backupDate)));
      var offsetMilliseconds = (offset === undefined ? utcDate.getTimezoneOffset() : offset) * 60 * 1000;
      var parsedDate = new Date(utcDate.getTime() + offsetMilliseconds); // check weekday

      if (weekday !== undefined && parsedDate.getDay() !== weekday) {
        return new Date(NaN);
      }

      return parsedDate;
    } catch (e) {
      return new Date(NaN);
    }
  }

  function _typeof(obj) {
    "@babel/helpers - typeof";

    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
      _typeof = function (obj) {
        return typeof obj;
      };
    } else {
      _typeof = function (obj) {
        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
      };
    }

    return _typeof(obj);
  }

  function _defineProperty$2(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  function _extends() {
    _extends = Object.assign || function (target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i];

        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
      }

      return target;
    };

    return _extends.apply(this, arguments);
  }

  function ownKeys$2(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      if (enumerableOnly) symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      });
      keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread2$1(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i] != null ? arguments[i] : {};

      if (i % 2) {
        ownKeys$2(Object(source), true).forEach(function (key) {
          _defineProperty$2(target, key, source[key]);
        });
      } else if (Object.getOwnPropertyDescriptors) {
        Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
      } else {
        ownKeys$2(Object(source)).forEach(function (key) {
          Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
        });
      }
    }

    return target;
  }

  function _objectWithoutPropertiesLoose(source, excluded) {
    if (source == null) return {};
    var target = {};
    var sourceKeys = Object.keys(source);
    var key, i;

    for (i = 0; i < sourceKeys.length; i++) {
      key = sourceKeys[i];
      if (excluded.indexOf(key) >= 0) continue;
      target[key] = source[key];
    }

    return target;
  }

  function _objectWithoutProperties(source, excluded) {
    if (source == null) return {};

    var target = _objectWithoutPropertiesLoose(source, excluded);

    var key, i;

    if (Object.getOwnPropertySymbols) {
      var sourceSymbolKeys = Object.getOwnPropertySymbols(source);

      for (i = 0; i < sourceSymbolKeys.length; i++) {
        key = sourceSymbolKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
        target[key] = source[key];
      }
    }

    return target;
  }

  function _slicedToArray$1(arr, i) {
    return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest$1();
  }

  function _arrayWithHoles$1(arr) {
    if (Array.isArray(arr)) return arr;
  }

  function _iterableToArrayLimit$1(arr, i) {
    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _e = undefined;

    try {
      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
        _arr.push(_s.value);

        if (i && _arr.length === i) break;
      }
    } catch (err) {
      _d = true;
      _e = err;
    } finally {
      try {
        if (!_n && _i["return"] != null) _i["return"]();
      } finally {
        if (_d) throw _e;
      }
    }

    return _arr;
  }

  function _unsupportedIterableToArray(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _arrayLikeToArray(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  }

  function _arrayLikeToArray(arr, len) {
    if (len == null || len > arr.length) len = arr.length;

    for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];

    return arr2;
  }

  function _nonIterableRest$1() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }

  function _extends$1() {
    return _extends$1 = Object.assign || function (a) {
      for (var b, c = 1; c < arguments.length; c++) {
        for (var d in b = arguments[c], b) {
          Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d]);
        }
      }

      return a;
    }, _extends$1.apply(this, arguments);
  }

  var normalMerge = ["attrs", "props", "domProps"],
      toArrayMerge = ["class", "style", "directives"],
      functionalMerge = ["on", "nativeOn"],
      mergeJsxProps = function mergeJsxProps(a) {
    return a.reduce(function (c, a) {
      for (var b in a) {
        if (!c[b]) c[b] = a[b];else if (-1 !== normalMerge.indexOf(b)) c[b] = _extends$1({}, c[b], a[b]);else if (-1 !== toArrayMerge.indexOf(b)) {
          var d = c[b] instanceof Array ? c[b] : [c[b]],
              e = a[b] instanceof Array ? a[b] : [a[b]];
          c[b] = d.concat(e);
        } else if (-1 !== functionalMerge.indexOf(b)) {
          for (var f in a[b]) {
            if (c[b][f]) {
              var g = c[b][f] instanceof Array ? c[b][f] : [c[b][f]],
                  h = a[b][f] instanceof Array ? a[b][f] : [a[b][f]];
              c[b][f] = g.concat(h);
            } else c[b][f] = a[b][f];
          }
        } else if ("hook" == b) for (var i in a[b]) {
          c[b][i] = c[b][i] ? mergeFn(c[b][i], a[b][i]) : a[b][i];
        } else c[b] = a[b];
      }

      return c;
    }, {});
  },
      mergeFn = function mergeFn(a, b) {
    return function () {
      a && a.apply(this, arguments), b && b.apply(this, arguments);
    };
  };

  var helper = mergeJsxProps; // new Date(10, 0, 1) The year from 0 to 99 will be incremented by 1900 automatically.

  function createDate(y) {
    var M = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var d = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
    var h = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
    var m = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
    var s = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
    var ms = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
    var date = new Date(y, M, d, h, m, s, ms);

    if (y < 100 && y >= 0) {
      date.setFullYear(y);
    }

    return date;
  }

  function isValidDate$1(date) {
    return date instanceof Date && !isNaN(date);
  }

  function isValidRangeDate(date) {
    return Array.isArray(date) && date.length === 2 && date.every(isValidDate$1) && date[0] <= date[1];
  }

  function isValidDates(dates) {
    return Array.isArray(dates) && dates.every(isValidDate$1);
  }

  function getValidDate(value) {
    var date = new Date(value);

    if (isValidDate$1(date)) {
      return date;
    }

    for (var _len = arguments.length, backup = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      backup[_key - 1] = arguments[_key];
    }

    if (backup.length) {
      return getValidDate.apply(void 0, backup);
    }

    return new Date();
  }

  function startOfYear(value) {
    var date = new Date(value);
    date.setMonth(0, 1);
    date.setHours(0, 0, 0, 0);
    return date;
  }

  function startOfMonth(value) {
    var date = new Date(value);
    date.setDate(1);
    date.setHours(0, 0, 0, 0);
    return date;
  }

  function startOfDay(value) {
    var date = new Date(value);
    date.setHours(0, 0, 0, 0);
    return date;
  }

  function getCalendar(_ref) {
    var firstDayOfWeek = _ref.firstDayOfWeek,
        year = _ref.year,
        month = _ref.month;
    var arr = []; // change to the last day of the last month

    var calendar = createDate(year, month, 0);
    var lastDayInLastMonth = calendar.getDate(); // getDay() 0 is Sunday, 1 is Monday

    var firstDayInLastMonth = lastDayInLastMonth - (calendar.getDay() + 7 - firstDayOfWeek) % 7;

    for (var i = firstDayInLastMonth; i <= lastDayInLastMonth; i++) {
      arr.push(createDate(year, month, i - lastDayInLastMonth));
    } // change to the last day of the current month


    calendar.setMonth(month + 1, 0);
    var lastDayInCurrentMonth = calendar.getDate();

    for (var _i = 1; _i <= lastDayInCurrentMonth; _i++) {
      arr.push(createDate(year, month, _i));
    }

    var lastMonthLength = lastDayInLastMonth - firstDayInLastMonth + 1;
    var nextMonthLength = 6 * 7 - lastMonthLength - lastDayInCurrentMonth;

    for (var _i2 = 1; _i2 <= nextMonthLength; _i2++) {
      arr.push(createDate(year, month, lastDayInCurrentMonth + _i2));
    }

    return arr;
  }

  function setMonth(dirtyDate, dirtyMonth) {
    var date = new Date(dirtyDate);
    var month = Number(dirtyMonth);
    var year = date.getFullYear();
    var daysInMonth = createDate(year, month + 1, 0).getDate();
    var day = date.getDate();
    date.setMonth(month, Math.min(day, daysInMonth));
    return date;
  }

  function assignTime(target, source) {
    var date = new Date(target);
    var time = new Date(source);
    date.setHours(time.getHours(), time.getMinutes(), time.getSeconds());
    return date;
  }
  /**
   * chunk the array
   * @param {Array} arr
   * @param {Number} size
   */


  function chunk(arr, size) {
    if (!Array.isArray(arr)) {
      return [];
    }

    var result = [];
    var len = arr.length;
    var i = 0;
    size = size || len;

    while (i < len) {
      result.push(arr.slice(i, i += size));
    }

    return result;
  }
  /**
   * isObject
   * @param {*} obj
   * @returns {Boolean}
   */


  function isObject$2(obj) {
    return Object.prototype.toString.call(obj) === '[object Object]';
  }
  /**
   * pick object
   * @param {Object} obj
   * @param {Array|String} props
   */


  function pick(obj, props) {
    if (!isObject$2(obj)) return {};

    if (!Array.isArray(props)) {
      props = [props];
    }

    var res = {};
    props.forEach(function (prop) {
      if (prop in obj) {
        res[prop] = obj[prop];
      }
    });
    return res;
  }
  /**
   * deep merge two object without merging array
   * @param {object} target
   * @param {object} source
   */


  function mergeDeep(target, source) {
    if (!isObject$2(target)) {
      return {};
    }

    var result = target;

    if (isObject$2(source)) {
      Object.keys(source).forEach(function (key) {
        var value = source[key];

        if (isObject$2(value) && isObject$2(target[key])) {
          value = mergeDeep(target[key], value);
        }

        result = _objectSpread2$1({}, result, _defineProperty$2({}, key, value));
      });
    }

    return result;
  }

  function unwrapExports(x) {
    return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  }

  function createCommonjsModule(fn, module) {
    return module = {
      exports: {}
    }, fn(module, module.exports), module.exports;
  }

  var en = createCommonjsModule(function (module, exports) {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports["default"] = void 0;
    var locale = {
      months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
      monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
      weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
      weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
      weekdaysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
      firstDayOfWeek: 0,
      firstWeekContainsDate: 1
    };
    var _default = locale;
    exports["default"] = _default;
    module.exports = exports.default;
  });
  var en$1 = unwrapExports(en);
  var lang = {
    formatLocale: en$1,
    yearFormat: 'YYYY',
    monthFormat: 'MMM',
    monthBeforeYear: true
  };
  var defaultLocale = 'en';
  var locales = {};
  locales[defaultLocale] = lang;

  function locale$1(name, object, isLocal) {
    if (typeof name !== 'string') return locales[defaultLocale];
    var l = defaultLocale;

    if (locales[name]) {
      l = name;
    }

    if (object) {
      locales[name] = object;
      l = name;
    }

    if (!isLocal) {
      defaultLocale = l;
    }

    return locales[name] || locales[defaultLocale];
  }
  /**
   * get locale object
   * @param {string} name lang
   */


  function getLocale(name) {
    return locale$1(name, null, true);
  }
  /* istanbul ignore file */


  function rafThrottle(fn) {
    var isRunning = false;
    return function fnBinfRaf() {
      var _this = this;

      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }

      if (isRunning) return;
      isRunning = true;
      requestAnimationFrame(function () {
        isRunning = false;
        fn.apply(_this, args);
      });
    };
  }
  /**
   * get the hidden element width, height
   * @param {HTMLElement} element dom
   */


  function getPopupElementSize(element) {
    var originalDisplay = element.style.display;
    var originalVisibility = element.style.visibility;
    element.style.display = 'block';
    element.style.visibility = 'hidden';
    var styles = window.getComputedStyle(element);
    var width = element.offsetWidth + parseInt(styles.marginLeft, 10) + parseInt(styles.marginRight, 10);
    var height = element.offsetHeight + parseInt(styles.marginTop, 10) + parseInt(styles.marginBottom, 10);
    element.style.display = originalDisplay;
    element.style.visibility = originalVisibility;
    return {
      width: width,
      height: height
    };
  }
  /**
   * get the popup position
   * @param {HTMLElement} el relative element
   * @param {Number} targetWidth target element's width
   * @param {Number} targetHeight target element's height
   * @param {Boolean} fixed
   */


  function getRelativePosition(el, targetWidth, targetHeight, fixed) {
    var left = 0;
    var top = 0;
    var offsetX = 0;
    var offsetY = 0;
    var relativeRect = el.getBoundingClientRect();
    var dw = document.documentElement.clientWidth;
    var dh = document.documentElement.clientHeight;

    if (fixed) {
      offsetX = window.pageXOffset + relativeRect.left;
      offsetY = window.pageYOffset + relativeRect.top;
    }

    if (dw - relativeRect.left < targetWidth && relativeRect.right < targetWidth) {
      left = offsetX - relativeRect.left + 1;
    } else if (relativeRect.left + relativeRect.width / 2 <= dw / 2) {
      left = offsetX;
    } else {
      left = offsetX + relativeRect.width - targetWidth;
    }

    if (relativeRect.top <= targetHeight && dh - relativeRect.bottom <= targetHeight) {
      top = offsetY + dh - relativeRect.top - targetHeight;
    } else if (relativeRect.top + relativeRect.height / 2 <= dh / 2) {
      top = offsetY + relativeRect.height;
    } else {
      top = offsetY - targetHeight;
    }

    return {
      left: "".concat(left, "px"),
      top: "".concat(top, "px")
    };
  }

  function getScrollParent(node) {
    var until = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.body;

    if (!node || node === until) {
      return null;
    }

    var style = function style(value, prop) {
      return getComputedStyle(value, null).getPropertyValue(prop);
    };

    var regex = /(auto|scroll)/;
    var scroll = regex.test(style(node, 'overflow') + style(node, 'overflow-y') + style(node, 'overflow-x'));
    return scroll ? node : getScrollParent(node.parentNode, until);
  } //


  var script$5 = {
    name: 'Popup',
    inject: {
      prefixClass: {
        default: 'mx'
      }
    },
    props: {
      visible: {
        type: Boolean,
        default: false
      },
      appendToBody: {
        type: Boolean,
        default: true
      }
    },
    data: function data() {
      return {
        top: '',
        left: ''
      };
    },
    watch: {
      visible: {
        immediate: true,
        handler: function handler(val) {
          var _this = this;

          this.$nextTick(function () {
            if (val) {
              _this.displayPopup();
            }
          });
        }
      }
    },
    mounted: function mounted() {
      var _this2 = this;

      if (this.appendToBody) {
        document.body.appendChild(this.$el);
      }

      this._clickoutEvent = 'ontouchend' in document ? 'touchstart' : 'mousedown';
      document.addEventListener(this._clickoutEvent, this.handleClickOutside); // change the popup position when resize or scroll

      var relativeElement = this.$parent.$el;
      this._displayPopup = rafThrottle(function () {
        return _this2.displayPopup();
      });
      this._scrollParent = getScrollParent(relativeElement) || window;

      this._scrollParent.addEventListener('scroll', this._displayPopup);

      window.addEventListener('resize', this._displayPopup);
    },
    beforeDestroy: function beforeDestroy() {
      if (this.appendToBody && this.$el.parentNode) {
        this.$el.parentNode.removeChild(this.$el);
      }

      document.removeEventListener(this._clickoutEvent, this.handleClickOutside);

      this._scrollParent.removeEventListener('scroll', this._displayPopup);

      window.removeEventListener('resize', this._displayPopup);
    },
    methods: {
      handleClickOutside: function handleClickOutside(evt) {
        if (!this.visible) return;
        var target = evt.target;
        var el = this.$el;

        if (el && !el.contains(target)) {
          this.$emit('clickoutside', evt);
        }
      },
      displayPopup: function displayPopup() {
        if (!this.visible) return;
        var popup = this.$el;
        var relativeElement = this.$parent.$el;
        var appendToBody = this.appendToBody;

        if (!this._popupRect) {
          this._popupRect = getPopupElementSize(popup);
        }

        var _this$_popupRect = this._popupRect,
            width = _this$_popupRect.width,
            height = _this$_popupRect.height;

        var _getRelativePosition = getRelativePosition(relativeElement, width, height, appendToBody),
            left = _getRelativePosition.left,
            top = _getRelativePosition.top;

        this.left = left;
        this.top = top;
      }
    }
  };

  function normalizeComponent$1(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
  /* server only */
  , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
    if (typeof shadowMode !== 'boolean') {
      createInjectorSSR = createInjector;
      createInjector = shadowMode;
      shadowMode = false;
    } // Vue.extend constructor export interop.


    var options = typeof script === 'function' ? script.options : script; // render functions

    if (template && template.render) {
      options.render = template.render;
      options.staticRenderFns = template.staticRenderFns;
      options._compiled = true; // functional template

      if (isFunctionalTemplate) {
        options.functional = true;
      }
    } // scopedId


    if (scopeId) {
      options._scopeId = scopeId;
    }

    var hook;

    if (moduleIdentifier) {
      // server build
      hook = function hook(context) {
        // 2.3 injection
        context = context || // cached call
        this.$vnode && this.$vnode.ssrContext || // stateful
        this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
        // 2.2 with runInNewContext: true

        if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
          context = __VUE_SSR_CONTEXT__;
        } // inject component styles


        if (style) {
          style.call(this, createInjectorSSR(context));
        } // register component module identifier for async chunk inference


        if (context && context._registeredComponents) {
          context._registeredComponents.add(moduleIdentifier);
        }
      }; // used by ssr in case component is cached and beforeCreate
      // never gets called


      options._ssrRegister = hook;
    } else if (style) {
      hook = shadowMode ? function (context) {
        style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
      } : function (context) {
        style.call(this, createInjector(context));
      };
    }

    if (hook) {
      if (options.functional) {
        // register for functional component in vue file
        var originalRender = options.render;

        options.render = function renderWithStyleInjection(h, context) {
          hook.call(context);
          return originalRender(h, context);
        };
      } else {
        // inject component registration as beforeCreate hook
        var existing = options.beforeCreate;
        options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
      }
    }

    return script;
  }
  /* script */


  var __vue_script__$5 = script$5;
  /* template */

  var __vue_render__$5 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('transition', {
      attrs: {
        "name": _vm.prefixClass + "-zoom-in-down"
      }
    }, [_vm.visible ? _c('div', {
      class: _vm.prefixClass + "-datepicker-main " + _vm.prefixClass + "-datepicker-popup",
      style: {
        top: _vm.top,
        left: _vm.left,
        position: 'absolute'
      }
    }, [_vm._t("default")], 2) : _vm._e()]);
  };

  var __vue_staticRenderFns__$5 = [];
  /* style */

  var __vue_inject_styles__$5 = undefined;
  /* scoped */

  var __vue_scope_id__$5 = undefined;
  /* module identifier */

  var __vue_module_identifier__$5 = undefined;
  /* functional template */

  var __vue_is_functional_template__$5 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$5 = normalizeComponent$1({
    render: __vue_render__$5,
    staticRenderFns: __vue_staticRenderFns__$5
  }, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
  /* script */

  /* template */


  var __vue_render__$1$1 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('svg', {
      attrs: {
        "xmlns": "http://www.w3.org/2000/svg",
        "viewBox": "0 0 1024 1024",
        "width": "1em",
        "height": "1em"
      }
    }, [_c('path', {
      attrs: {
        "d": "M940.218182 107.054545h-209.454546V46.545455h-65.163636v60.50909H363.054545V46.545455H297.890909v60.50909H83.781818c-18.618182 0-32.581818 13.963636-32.581818 32.581819v805.236363c0 18.618182 13.963636 32.581818 32.581818 32.581818h861.090909c18.618182 0 32.581818-13.963636 32.581818-32.581818V139.636364c-4.654545-18.618182-18.618182-32.581818-37.236363-32.581819zM297.890909 172.218182V232.727273h65.163636V172.218182h307.2V232.727273h65.163637V172.218182h176.872727v204.8H116.363636V172.218182h181.527273zM116.363636 912.290909V442.181818h795.927273v470.109091H116.363636z"
      }
    })]);
  };

  var __vue_staticRenderFns__$1$1 = [];
  /* style */

  var __vue_inject_styles__$1$1 = undefined;
  /* scoped */

  var __vue_scope_id__$1$1 = undefined;
  /* module identifier */

  var __vue_module_identifier__$1$1 = undefined;
  /* functional template */

  var __vue_is_functional_template__$1$1 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$1$1 = normalizeComponent$1({
    render: __vue_render__$1$1,
    staticRenderFns: __vue_staticRenderFns__$1$1
  }, __vue_inject_styles__$1$1, {}, __vue_scope_id__$1$1, __vue_is_functional_template__$1$1, __vue_module_identifier__$1$1, false, undefined, undefined, undefined);
  /* script */

  /* template */


  var __vue_render__$2$1 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('svg', {
      attrs: {
        "xmlns": "http://www.w3.org/2000/svg",
        "viewBox": "0 0 1024 1024",
        "width": "1em",
        "height": "1em"
      }
    }, [_c('path', {
      attrs: {
        "d": "M810.005333 274.005333l-237.994667 237.994667 237.994667 237.994667-60.010667 60.010667-237.994667-237.994667-237.994667 237.994667-60.010667-60.010667 237.994667-237.994667-237.994667-237.994667 60.010667-60.010667 237.994667 237.994667 237.994667-237.994667z"
      }
    })]);
  };

  var __vue_staticRenderFns__$2$1 = [];
  /* style */

  var __vue_inject_styles__$2$1 = undefined;
  /* scoped */

  var __vue_scope_id__$2$1 = undefined;
  /* module identifier */

  var __vue_module_identifier__$2$1 = undefined;
  /* functional template */

  var __vue_is_functional_template__$2$1 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$2$1 = normalizeComponent$1({
    render: __vue_render__$2$1,
    staticRenderFns: __vue_staticRenderFns__$2$1
  }, __vue_inject_styles__$2$1, {}, __vue_scope_id__$2$1, __vue_is_functional_template__$2$1, __vue_module_identifier__$2$1, false, undefined, undefined, undefined); //
  //
  //
  //
  //
  //
  //
  //
  //
  //


  var script$1$1 = {
    props: {
      type: String
    },
    inject: {
      prefixClass: {
        default: 'mx'
      }
    }
  };
  /* script */

  var __vue_script__$1$1 = script$1$1;
  /* template */

  var __vue_render__$3$1 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('button', _vm._g({
      class: _vm.prefixClass + "-btn " + _vm.prefixClass + "-btn-text " + _vm.prefixClass + "-btn-icon-" + _vm.type,
      attrs: {
        "type": "button"
      }
    }, _vm.$listeners), [_c('i', {
      class: _vm.prefixClass + "-icon-" + _vm.type
    })]);
  };

  var __vue_staticRenderFns__$3$1 = [];
  /* style */

  var __vue_inject_styles__$3$1 = undefined;
  /* scoped */

  var __vue_scope_id__$3$1 = undefined;
  /* module identifier */

  var __vue_module_identifier__$3$1 = undefined;
  /* functional template */

  var __vue_is_functional_template__$3$1 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$3$1 = normalizeComponent$1({
    render: __vue_render__$3$1,
    staticRenderFns: __vue_staticRenderFns__$3$1
  }, __vue_inject_styles__$3$1, __vue_script__$1$1, __vue_scope_id__$3$1, __vue_is_functional_template__$3$1, __vue_module_identifier__$3$1, false, undefined, undefined, undefined);

  var script$2$1 = {
    name: 'TableDate',
    components: {
      IconButton: __vue_component__$3$1
    },
    inject: {
      getLocale: {
        default: function _default() {
          return getLocale;
        }
      },
      getWeek: {
        default: function _default() {
          return getWeek;
        }
      },
      prefixClass: {
        default: 'mx'
      },
      onDateMouseEnter: {
        default: undefined
      },
      onDateMouseLeave: {
        default: undefined
      }
    },
    props: {
      calendar: {
        type: Date,
        default: function _default() {
          return new Date();
        }
      },
      showWeekNumber: {
        type: Boolean,
        default: false
      },
      titleFormat: {
        type: String,
        default: 'YYYY-MM-DD'
      },
      getRowClasses: {
        type: Function,
        default: function _default() {
          return [];
        }
      },
      getCellClasses: {
        type: Function,
        default: function _default() {
          return [];
        }
      }
    },
    computed: {
      firstDayOfWeek: function firstDayOfWeek() {
        return this.getLocale().formatLocale.firstDayOfWeek || 0;
      },
      yearMonth: function yearMonth() {
        var _this$getLocale = this.getLocale(),
            yearFormat = _this$getLocale.yearFormat,
            monthBeforeYear = _this$getLocale.monthBeforeYear,
            _this$getLocale$month = _this$getLocale.monthFormat,
            monthFormat = _this$getLocale$month === void 0 ? 'MMM' : _this$getLocale$month;

        var yearLabel = {
          panel: 'year',
          label: this.formatDate(this.calendar, yearFormat)
        };
        var monthLabel = {
          panel: 'month',
          label: this.formatDate(this.calendar, monthFormat)
        };
        return monthBeforeYear ? [monthLabel, yearLabel] : [yearLabel, monthLabel];
      },
      days: function days() {
        var locale = this.getLocale();
        var days = locale.days || locale.formatLocale.weekdaysMin;
        return days.concat(days).slice(this.firstDayOfWeek, this.firstDayOfWeek + 7);
      },
      dates: function dates() {
        var year = this.calendar.getFullYear();
        var month = this.calendar.getMonth();
        var arr = getCalendar({
          firstDayOfWeek: this.firstDayOfWeek,
          year: year,
          month: month
        });
        return chunk(arr, 7);
      }
    },
    methods: {
      getNextCalendar: function getNextCalendar(diffMonth) {
        var year = this.calendar.getFullYear();
        var month = this.calendar.getMonth();
        return createDate(year, month + diffMonth);
      },
      handleIconLeftClick: function handleIconLeftClick() {
        this.$emit('changecalendar', this.getNextCalendar(-1), 'last-month');
      },
      handleIconRightClick: function handleIconRightClick() {
        this.$emit('changecalendar', this.getNextCalendar(1), 'next-month');
      },
      handleIconDoubleLeftClick: function handleIconDoubleLeftClick() {
        this.$emit('changecalendar', this.getNextCalendar(-12), 'last-year');
      },
      handleIconDoubleRightClick: function handleIconDoubleRightClick() {
        this.$emit('changecalendar', this.getNextCalendar(12), 'next-year');
      },
      handlePanelChange: function handlePanelChange(panel) {
        this.$emit('changepanel', panel);
      },
      handleMouseEnter: function handleMouseEnter(cell) {
        if (typeof this.onDateMouseEnter === 'function') {
          this.onDateMouseEnter(cell);
        }
      },
      handleMouseLeave: function handleMouseLeave(cell) {
        if (typeof this.onDateMouseLeave === 'function') {
          this.onDateMouseLeave(cell);
        }
      },
      handleCellClick: function handleCellClick(evt) {
        var target = evt.target;

        if (target.tagName.toUpperCase() === 'DIV') {
          target = target.parentNode;
        }

        var index = target.getAttribute('data-row-col');

        if (index) {
          var _index$split$map = index.split(',').map(function (v) {
            return parseInt(v, 10);
          }),
              _index$split$map2 = _slicedToArray$1(_index$split$map, 2),
              row = _index$split$map2[0],
              col = _index$split$map2[1];

          var date = this.dates[row][col];
          this.$emit('select', new Date(date));
        }
      },
      formatDate: function formatDate(date, fmt) {
        return format(date, fmt, {
          locale: this.getLocale().formatLocale
        });
      },
      getCellTitle: function getCellTitle(date) {
        var fmt = this.titleFormat;
        return this.formatDate(date, fmt);
      },
      getWeekNumber: function getWeekNumber(date) {
        return this.getWeek(date, this.getLocale().formatLocale);
      }
    }
  };
  /* script */

  var __vue_script__$2$1 = script$2$1;
  /* template */

  var __vue_render__$4$1 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('div', {
      class: _vm.prefixClass + "-calendar " + _vm.prefixClass + "-calendar-panel-date"
    }, [_c('div', {
      class: _vm.prefixClass + "-calendar-header"
    }, [_c('icon-button', {
      attrs: {
        "type": "double-left"
      },
      on: {
        "click": _vm.handleIconDoubleLeftClick
      }
    }), _vm._v(" "), _c('icon-button', {
      attrs: {
        "type": "left"
      },
      on: {
        "click": _vm.handleIconLeftClick
      }
    }), _vm._v(" "), _c('icon-button', {
      attrs: {
        "type": "double-right"
      },
      on: {
        "click": _vm.handleIconDoubleRightClick
      }
    }), _vm._v(" "), _c('icon-button', {
      attrs: {
        "type": "right"
      },
      on: {
        "click": _vm.handleIconRightClick
      }
    }), _vm._v(" "), _c('span', {
      class: _vm.prefixClass + "-calendar-header-label"
    }, _vm._l(_vm.yearMonth, function (item) {
      return _c('button', {
        key: item.panel,
        class: _vm.prefixClass + "-btn " + _vm.prefixClass + "-btn-text " + _vm.prefixClass + "-btn-current-" + item.panel,
        attrs: {
          "type": "button"
        },
        on: {
          "click": function click($event) {
            return _vm.handlePanelChange(item.panel);
          }
        }
      }, [_vm._v("\n        " + _vm._s(item.label) + "\n      ")]);
    }), 0)], 1), _vm._v(" "), _c('div', {
      class: _vm.prefixClass + "-calendar-content"
    }, [_c('table', {
      class: _vm.prefixClass + "-table " + _vm.prefixClass + "-table-date"
    }, [_c('thead', [_c('tr', [_vm.showWeekNumber ? _c('th', {
      class: _vm.prefixClass + "-week-number-header"
    }) : _vm._e(), _vm._v(" "), _vm._l(_vm.days, function (day) {
      return _c('th', {
        key: day
      }, [_vm._v(_vm._s(day))]);
    })], 2)]), _vm._v(" "), _c('tbody', {
      on: {
        "click": _vm.handleCellClick
      }
    }, _vm._l(_vm.dates, function (row, i) {
      return _c('tr', {
        key: i,
        class: [_vm.prefixClass + "-date-row", _vm.getRowClasses(row)]
      }, [_vm.showWeekNumber ? _c('td', {
        class: _vm.prefixClass + "-week-number",
        attrs: {
          "data-row-col": i + ",0"
        }
      }, [_vm._v("\n            " + _vm._s(_vm.getWeekNumber(row[0])) + "\n          ")]) : _vm._e(), _vm._v(" "), _vm._l(row, function (cell, j) {
        return _c('td', {
          key: j,
          staticClass: "cell",
          class: _vm.getCellClasses(cell),
          attrs: {
            "data-row-col": i + "," + j,
            "title": _vm.getCellTitle(cell)
          },
          on: {
            "mouseenter": function mouseenter($event) {
              return _vm.handleMouseEnter(cell);
            },
            "mouseleave": function mouseleave($event) {
              return _vm.handleMouseLeave(cell);
            }
          }
        }, [_c('div', [_vm._v(_vm._s(cell.getDate()))])]);
      })], 2);
    }), 0)])])]);
  };

  var __vue_staticRenderFns__$4$1 = [];
  /* style */

  var __vue_inject_styles__$4$1 = undefined;
  /* scoped */

  var __vue_scope_id__$4$1 = undefined;
  /* module identifier */

  var __vue_module_identifier__$4$1 = undefined;
  /* functional template */

  var __vue_is_functional_template__$4$1 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$4$1 = normalizeComponent$1({
    render: __vue_render__$4$1,
    staticRenderFns: __vue_staticRenderFns__$4$1
  }, __vue_inject_styles__$4$1, __vue_script__$2$1, __vue_scope_id__$4$1, __vue_is_functional_template__$4$1, __vue_module_identifier__$4$1, false, undefined, undefined, undefined); //


  var script$3$1 = {
    name: 'TableMonth',
    components: {
      IconButton: __vue_component__$3$1
    },
    inject: {
      getLocale: {
        default: function _default() {
          return getLocale;
        }
      },
      prefixClass: {
        default: 'mx'
      }
    },
    props: {
      calendar: {
        type: Date,
        default: function _default() {
          return new Date();
        }
      },
      getCellClasses: {
        type: Function,
        default: function _default() {
          return [];
        }
      }
    },
    computed: {
      calendarYear: function calendarYear() {
        return this.calendar.getFullYear();
      },
      months: function months() {
        var locale = this.getLocale();
        var monthsLocale = locale.months || locale.formatLocale.monthsShort;
        var months = monthsLocale.map(function (text, month) {
          return {
            text: text,
            month: month
          };
        });
        return chunk(months, 3);
      }
    },
    methods: {
      getNextCalendar: function getNextCalendar(diffYear) {
        var year = this.calendar.getFullYear();
        var month = this.calendar.getMonth();
        return createDate(year + diffYear, month);
      },
      handleIconDoubleLeftClick: function handleIconDoubleLeftClick() {
        this.$emit('changecalendar', this.getNextCalendar(-1), 'last-year');
      },
      handleIconDoubleRightClick: function handleIconDoubleRightClick() {
        this.$emit('changecalendar', this.getNextCalendar(1), 'next-year');
      },
      handlePanelChange: function handlePanelChange() {
        this.$emit('changepanel', 'year');
      },
      handleClick: function handleClick(evt) {
        var target = evt.target;

        if (target.tagName.toUpperCase() === 'DIV') {
          target = target.parentNode;
        }

        var month = target.getAttribute('data-month');

        if (month) {
          this.$emit('select', parseInt(month, 10));
        }
      }
    }
  };
  /* script */

  var __vue_script__$3$1 = script$3$1;
  /* template */

  var __vue_render__$5$1 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('div', {
      class: _vm.prefixClass + "-calendar " + _vm.prefixClass + "-calendar-panel-month"
    }, [_c('div', {
      class: _vm.prefixClass + "-calendar-header"
    }, [_c('icon-button', {
      attrs: {
        "type": "double-left"
      },
      on: {
        "click": _vm.handleIconDoubleLeftClick
      }
    }), _vm._v(" "), _c('icon-button', {
      attrs: {
        "type": "double-right"
      },
      on: {
        "click": _vm.handleIconDoubleRightClick
      }
    }), _vm._v(" "), _c('span', {
      class: _vm.prefixClass + "-calendar-header-label"
    }, [_c('button', {
      class: _vm.prefixClass + "-btn " + _vm.prefixClass + "-btn-text",
      attrs: {
        "type": "button"
      },
      on: {
        "click": _vm.handlePanelChange
      }
    }, [_vm._v("\n        " + _vm._s(_vm.calendarYear) + "\n      ")])])], 1), _vm._v(" "), _c('div', {
      class: _vm.prefixClass + "-calendar-content"
    }, [_c('table', {
      class: _vm.prefixClass + "-table " + _vm.prefixClass + "-table-month",
      on: {
        "click": _vm.handleClick
      }
    }, _vm._l(_vm.months, function (row, i) {
      return _c('tr', {
        key: i
      }, _vm._l(row, function (cell, j) {
        return _c('td', {
          key: j,
          staticClass: "cell",
          class: _vm.getCellClasses(cell.month),
          attrs: {
            "data-month": cell.month
          }
        }, [_c('div', [_vm._v(_vm._s(cell.text))])]);
      }), 0);
    }), 0)])]);
  };

  var __vue_staticRenderFns__$5$1 = [];
  /* style */

  var __vue_inject_styles__$5$1 = undefined;
  /* scoped */

  var __vue_scope_id__$5$1 = undefined;
  /* module identifier */

  var __vue_module_identifier__$5$1 = undefined;
  /* functional template */

  var __vue_is_functional_template__$5$1 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$5$1 = normalizeComponent$1({
    render: __vue_render__$5$1,
    staticRenderFns: __vue_staticRenderFns__$5$1
  }, __vue_inject_styles__$5$1, __vue_script__$3$1, __vue_scope_id__$5$1, __vue_is_functional_template__$5$1, __vue_module_identifier__$5$1, false, undefined, undefined, undefined); //


  var script$4$1 = {
    name: 'TableYear',
    components: {
      IconButton: __vue_component__$3$1
    },
    inject: {
      prefixClass: {
        default: 'mx'
      }
    },
    props: {
      calendar: {
        type: Date,
        default: function _default() {
          return new Date();
        }
      },
      getCellClasses: {
        type: Function,
        default: function _default() {
          return [];
        }
      },
      getYearPanel: {
        type: Function
      }
    },
    computed: {
      years: function years() {
        var calendar = new Date(this.calendar);

        if (typeof this.getYearPanel === 'function') {
          return this.getYearPanel(calendar);
        }

        return this.getYears(calendar);
      },
      firstYear: function firstYear() {
        return this.years[0][0];
      },
      lastYear: function lastYear() {
        var last = function last(arr) {
          return arr[arr.length - 1];
        };

        return last(last(this.years));
      }
    },
    methods: {
      getYears: function getYears(calendar) {
        var firstYear = Math.floor(calendar.getFullYear() / 10) * 10;
        var years = [];

        for (var i = 0; i < 10; i++) {
          years.push(firstYear + i);
        }

        return chunk(years, 2);
      },
      getNextCalendar: function getNextCalendar(diffYear) {
        var year = this.calendar.getFullYear();
        var month = this.calendar.getMonth();
        return createDate(year + diffYear, month);
      },
      handleIconDoubleLeftClick: function handleIconDoubleLeftClick() {
        this.$emit('changecalendar', this.getNextCalendar(-10), 'last-decade');
      },
      handleIconDoubleRightClick: function handleIconDoubleRightClick() {
        this.$emit('changecalendar', this.getNextCalendar(10), 'next-decade');
      },
      handleClick: function handleClick(evt) {
        var target = evt.target;

        if (target.tagName.toUpperCase() === 'DIV') {
          target = target.parentNode;
        }

        var year = target.getAttribute('data-year');

        if (year) {
          this.$emit('select', parseInt(year, 10));
        }
      }
    }
  };
  /* script */

  var __vue_script__$4$1 = script$4$1;
  /* template */

  var __vue_render__$6 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('div', {
      class: _vm.prefixClass + "-calendar " + _vm.prefixClass + "-calendar-panel-year"
    }, [_c('div', {
      class: _vm.prefixClass + "-calendar-header"
    }, [_c('icon-button', {
      attrs: {
        "type": "double-left"
      },
      on: {
        "click": _vm.handleIconDoubleLeftClick
      }
    }), _vm._v(" "), _c('icon-button', {
      attrs: {
        "type": "double-right"
      },
      on: {
        "click": _vm.handleIconDoubleRightClick
      }
    }), _vm._v(" "), _c('span', {
      class: _vm.prefixClass + "-calendar-header-label"
    }, [_c('span', [_vm._v(_vm._s(_vm.firstYear))]), _vm._v(" "), _c('span', {
      class: _vm.prefixClass + "-calendar-decade-separator"
    }), _vm._v(" "), _c('span', [_vm._v(_vm._s(_vm.lastYear))])])], 1), _vm._v(" "), _c('div', {
      class: _vm.prefixClass + "-calendar-content"
    }, [_c('table', {
      class: _vm.prefixClass + "-table " + _vm.prefixClass + "-table-year",
      on: {
        "click": _vm.handleClick
      }
    }, _vm._l(_vm.years, function (row, i) {
      return _c('tr', {
        key: i
      }, _vm._l(row, function (cell, j) {
        return _c('td', {
          key: j,
          staticClass: "cell",
          class: _vm.getCellClasses(cell),
          attrs: {
            "data-year": cell
          }
        }, [_c('div', [_vm._v(_vm._s(cell))])]);
      }), 0);
    }), 0)])]);
  };

  var __vue_staticRenderFns__$6 = [];
  /* style */

  var __vue_inject_styles__$6 = undefined;
  /* scoped */

  var __vue_scope_id__$6 = undefined;
  /* module identifier */

  var __vue_module_identifier__$6 = undefined;
  /* functional template */

  var __vue_is_functional_template__$6 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$6 = normalizeComponent$1({
    render: __vue_render__$6,
    staticRenderFns: __vue_staticRenderFns__$6
  }, __vue_inject_styles__$6, __vue_script__$4$1, __vue_scope_id__$6, __vue_is_functional_template__$6, __vue_module_identifier__$6, false, undefined, undefined, undefined);

  var CalendarPanel = {
    name: 'CalendarPanel',
    inject: {
      prefixClass: {
        default: 'mx'
      },
      dispatchDatePicker: {
        default: function _default() {
          return function () {};
        }
      }
    },
    props: {
      value: {},
      defaultValue: {
        default: function _default() {
          var date = new Date();
          date.setHours(0, 0, 0, 0);
          return date;
        }
      },
      defaultPanel: {
        type: String
      },
      disabledDate: {
        type: Function,
        default: function _default() {
          return false;
        }
      },
      type: {
        type: String,
        default: 'date'
      },
      getClasses: {
        type: Function,
        default: function _default() {
          return [];
        }
      },
      showWeekNumber: {
        type: Boolean,
        default: undefined
      },
      getYearPanel: {
        type: Function
      },
      titleFormat: {
        type: String,
        default: 'YYYY-MM-DD'
      },
      calendar: Date,
      // update date when select year or month
      partialUpdate: {
        type: Boolean,
        default: false
      }
    },
    data: function data() {
      var panels = ['date', 'month', 'year'];
      var index = Math.max(panels.indexOf(this.type), panels.indexOf(this.defaultPanel));
      var panel = index !== -1 ? panels[index] : 'date';
      return {
        panel: panel,
        innerCalendar: new Date()
      };
    },
    computed: {
      innerValue: function innerValue() {
        var value = Array.isArray(this.value) ? this.value : [this.value];
        var map = {
          year: startOfYear,
          month: startOfMonth,
          date: startOfDay
        };
        var start = map[this.type] || map.date;
        return value.filter(isValidDate$1).map(function (v) {
          return start(v);
        });
      },
      calendarYear: function calendarYear() {
        return this.innerCalendar.getFullYear();
      },
      calendarMonth: function calendarMonth() {
        return this.innerCalendar.getMonth();
      }
    },
    watch: {
      value: {
        immediate: true,
        handler: 'initCalendar'
      },
      calendar: {
        handler: 'initCalendar'
      },
      defaultValue: {
        handler: 'initCalendar'
      }
    },
    methods: {
      initCalendar: function initCalendar() {
        var calendarDate = this.calendar;

        if (!isValidDate$1(calendarDate)) {
          var length = this.innerValue.length;
          calendarDate = getValidDate(length > 0 ? this.innerValue[length - 1] : this.defaultValue);
        }

        this.innerCalendar = startOfMonth(calendarDate);
      },
      isDisabled: function isDisabled(date) {
        return this.disabledDate(new Date(date), this.innerValue);
      },
      emitDate: function emitDate(date, type) {
        if (!this.isDisabled(date)) {
          this.$emit('select', date, type, this.innerValue); // someone need get the first selected date to set range value. (#429)

          this.dispatchDatePicker('pick', date, type);
        }
      },
      handleCalendarChange: function handleCalendarChange(calendar, type) {
        var oldCalendar = new Date(this.innerCalendar);
        this.innerCalendar = calendar;
        this.$emit('update:calendar', calendar);
        this.dispatchDatePicker('calendar-change', calendar, oldCalendar, type);
      },
      handelPanelChange: function handelPanelChange(panel) {
        var oldPanel = this.panel;
        this.panel = panel;
        this.dispatchDatePicker('panel-change', panel, oldPanel);
      },
      handleSelectYear: function handleSelectYear(year) {
        if (this.type === 'year') {
          var date = this.getYearCellDate(year);
          this.emitDate(date, 'year');
        } else {
          this.handleCalendarChange(createDate(year, this.calendarMonth), 'year');
          this.handelPanelChange('month');

          if (this.partialUpdate && this.innerValue.length === 1) {
            var _date = new Date(this.innerValue[0]);

            _date.setFullYear(year);

            this.emitDate(_date, 'year');
          }
        }
      },
      handleSelectMonth: function handleSelectMonth(month) {
        if (this.type === 'month') {
          var date = this.getMonthCellDate(month);
          this.emitDate(date, 'month');
        } else {
          this.handleCalendarChange(createDate(this.calendarYear, month), 'month');
          this.handelPanelChange('date');

          if (this.partialUpdate && this.innerValue.length === 1) {
            var _date2 = new Date(this.innerValue[0]);

            _date2.setFullYear(this.calendarYear);

            this.emitDate(setMonth(_date2, month), 'month');
          }
        }
      },
      handleSelectDate: function handleSelectDate(date) {
        this.emitDate(date, this.type === 'week' ? 'week' : 'date');
      },
      getMonthCellDate: function getMonthCellDate(month) {
        return createDate(this.calendarYear, month);
      },
      getYearCellDate: function getYearCellDate(year) {
        return createDate(year, 0);
      },
      getDateClasses: function getDateClasses(cellDate) {
        var notCurrentMonth = cellDate.getMonth() !== this.calendarMonth;
        var classes = [];

        if (cellDate.getTime() === new Date().setHours(0, 0, 0, 0)) {
          classes.push('today');
        }

        if (notCurrentMonth) {
          classes.push('not-current-month');
        }

        var state = this.getStateClass(cellDate);

        if (!(state === 'active' && notCurrentMonth)) {
          classes.push(state);
        }

        return classes.concat(this.getClasses(cellDate, this.innerValue, classes.join(' ')));
      },
      getMonthClasses: function getMonthClasses(month) {
        if (this.type !== 'month') {
          return this.calendarMonth === month ? 'active' : '';
        }

        var classes = [];
        var cellDate = this.getMonthCellDate(month);
        classes.push(this.getStateClass(cellDate));
        return classes.concat(this.getClasses(cellDate, this.innerValue, classes.join(' ')));
      },
      getYearClasses: function getYearClasses(year) {
        if (this.type !== 'year') {
          return this.calendarYear === year ? 'active' : '';
        }

        var classes = [];
        var cellDate = this.getYearCellDate(year);
        classes.push(this.getStateClass(cellDate));
        return classes.concat(this.getClasses(cellDate, this.innerValue, classes.join(' ')));
      },
      getStateClass: function getStateClass(cellDate) {
        if (this.isDisabled(cellDate)) {
          return 'disabled';
        }

        if (this.innerValue.some(function (v) {
          return v.getTime() === cellDate.getTime();
        })) {
          return 'active';
        }

        return '';
      },
      getWeekState: function getWeekState(row) {
        if (this.type !== 'week') return '';
        var start = row[0].getTime();
        var end = row[6].getTime();
        var active = this.innerValue.some(function (v) {
          var time = v.getTime();
          return time >= start && time <= end;
        });
        return active ? "".concat(this.prefixClass, "-active-week") : '';
      }
    },
    render: function render() {
      var h = arguments[0];
      var panel = this.panel,
          innerCalendar = this.innerCalendar;

      if (panel === 'year') {
        return h(__vue_component__$6, {
          "attrs": {
            "calendar": innerCalendar,
            "getCellClasses": this.getYearClasses,
            "getYearPanel": this.getYearPanel
          },
          "on": {
            "select": this.handleSelectYear,
            "changecalendar": this.handleCalendarChange
          }
        });
      }

      if (panel === 'month') {
        return h(__vue_component__$5$1, {
          "attrs": {
            "calendar": innerCalendar,
            "getCellClasses": this.getMonthClasses
          },
          "on": {
            "select": this.handleSelectMonth,
            "changepanel": this.handelPanelChange,
            "changecalendar": this.handleCalendarChange
          }
        });
      }

      return h(__vue_component__$4$1, {
        "class": _defineProperty$2({}, "".concat(this.prefixClass, "-calendar-week-mode"), this.type === 'week'),
        "attrs": {
          "calendar": innerCalendar,
          "getCellClasses": this.getDateClasses,
          "getRowClasses": this.getWeekState,
          "titleFormat": this.titleFormat,
          "showWeekNumber": typeof this.showWeekNumber === 'boolean' ? this.showWeekNumber : this.type === 'week'
        },
        "on": {
          "select": this.handleSelectDate,
          "changepanel": this.handelPanelChange,
          "changecalendar": this.handleCalendarChange
        }
      });
    }
  };
  var CalendarRange = {
    name: 'CalendarRange',
    components: {
      CalendarPanel: CalendarPanel
    },
    provide: function provide() {
      return {
        onDateMouseEnter: this.onDateMouseEnter,
        onDateMouseLeave: this.onDateMouseLeave
      };
    },
    inject: {
      prefixClass: {
        default: 'mx'
      }
    },
    props: _objectSpread2$1({}, CalendarPanel.props),
    data: function data() {
      return {
        innerValue: [],
        calendars: [],
        hoveredValue: null
      };
    },
    computed: {
      // Minimum difference between start and end calendars
      calendarMinDiff: function calendarMinDiff() {
        var map = {
          date: 1,
          // type:date  min 1 month
          month: 1 * 12,
          // type:month min 1 year
          year: 10 * 12 // type:year  min 10 year

        };
        return map[this.type] || map.date;
      },
      calendarMaxDiff: function calendarMaxDiff() {
        return Infinity;
      },
      defaultValues: function defaultValues() {
        return Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue, this.defaultValue];
      }
    },
    watch: {
      value: {
        immediate: true,
        handler: function handler() {
          var _this = this;

          this.innerValue = isValidRangeDate(this.value) ? this.value : [new Date(NaN), new Date(NaN)];
          var calendars = this.innerValue.map(function (v, i) {
            return startOfMonth(getValidDate(v, _this.defaultValues[i]));
          });
          this.updateCalendars(calendars);
        }
      }
    },
    methods: {
      handleSelect: function handleSelect(date, type) {
        var _this$innerValue = _slicedToArray$1(this.innerValue, 2),
            startValue = _this$innerValue[0],
            endValue = _this$innerValue[1];

        if (isValidDate$1(startValue) && !isValidDate$1(endValue)) {
          if (startValue.getTime() > date.getTime()) {
            this.innerValue = [date, startValue];
          } else {
            this.innerValue = [startValue, date];
          }

          this.emitDate(this.innerValue, type);
        } else {
          this.innerValue = [date, new Date(NaN)];
        }
      },
      onDateMouseEnter: function onDateMouseEnter(cell) {
        this.hoveredValue = cell;
      },
      onDateMouseLeave: function onDateMouseLeave() {
        this.hoveredValue = null;
      },
      emitDate: function emitDate(dates, type) {
        this.$emit('select', dates, type);
      },
      updateStartCalendar: function updateStartCalendar(value) {
        this.updateCalendars([value, this.calendars[1]], 1);
      },
      updateEndCalendar: function updateEndCalendar(value) {
        this.updateCalendars([this.calendars[0], value], 0);
      },
      updateCalendars: function updateCalendars(calendars) {
        var adjustIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
        var gap = this.getCalendarGap(calendars);

        if (gap) {
          var calendar = new Date(calendars[adjustIndex]);
          calendar.setMonth(calendar.getMonth() + (adjustIndex === 0 ? -gap : gap));
          calendars[adjustIndex] = calendar;
        }

        this.calendars = calendars;
      },
      getCalendarGap: function getCalendarGap(calendars) {
        var _calendars = _slicedToArray$1(calendars, 2),
            calendarLeft = _calendars[0],
            calendarRight = _calendars[1];

        var yearDiff = calendarRight.getFullYear() - calendarLeft.getFullYear();
        var monthDiff = calendarRight.getMonth() - calendarLeft.getMonth();
        var diff = yearDiff * 12 + monthDiff;
        var min = this.calendarMinDiff;
        var max = this.calendarMaxDiff;

        if (diff < min) {
          return min - diff;
        }

        if (diff > max) {
          return max - diff;
        }

        return 0;
      },
      getRangeClasses: function getRangeClasses(cellDate, currentDates, classnames) {
        var classes = [].concat(this.getClasses(cellDate, currentDates, classnames));
        if (/disabled|active/.test(classnames)) return classes;

        var inRange = function inRange(data, range) {
          var fn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (v) {
            return v.getTime();
          };
          var value = fn(data);

          var _range$map = range.map(fn),
              _range$map2 = _slicedToArray$1(_range$map, 2),
              min = _range$map2[0],
              max = _range$map2[1];

          if (min > max) {
            var _ref = [max, min];
            min = _ref[0];
            max = _ref[1];
          }

          return value > min && value < max;
        };

        if (currentDates.length === 2 && inRange(cellDate, currentDates)) {
          return classes.concat('in-range');
        }

        if (currentDates.length === 1 && this.hoveredValue && inRange(cellDate, [currentDates[0], this.hoveredValue])) {
          return classes.concat('hover-in-range');
        }

        return classes;
      }
    },
    render: function render() {
      var _this2 = this;

      var h = arguments[0];
      var calendarRange = this.calendars.map(function (calendar, index) {
        var props = _objectSpread2$1({}, _this2.$props, {
          calendar: calendar,
          value: _this2.innerValue,
          defaultValue: _this2.defaultValues[index],
          getClasses: _this2.getRangeClasses,
          // don't update when range is true
          partialUpdate: false
        });

        var on = {
          select: _this2.handleSelect,
          'update:calendar': index === 0 ? _this2.updateStartCalendar : _this2.updateEndCalendar
        };
        return h("calendar-panel", {
          "props": _objectSpread2$1({}, props),
          "on": _objectSpread2$1({}, on)
        });
      });
      var prefixClass = this.prefixClass;
      return h("div", {
        "class": "".concat(prefixClass, "-range-wrapper")
      }, [calendarRange]);
    }
  };
  var scrollBarWidth;

  function getScrollbarWidth() {
    if (typeof window === 'undefined') return 0;
    if (scrollBarWidth !== undefined) return scrollBarWidth;
    var outer = document.createElement('div');
    outer.style.visibility = 'hidden';
    outer.style.overflow = 'scroll';
    outer.style.width = '100px';
    outer.style.position = 'absolute';
    outer.style.top = '-9999px';
    document.body.appendChild(outer);
    var inner = document.createElement('div');
    inner.style.width = '100%';
    outer.appendChild(inner);
    scrollBarWidth = outer.offsetWidth - inner.offsetWidth;
    outer.parentNode.removeChild(outer);
    return scrollBarWidth;
  } //


  var script$5$1 = {
    inject: {
      prefixClass: {
        default: 'mx'
      }
    },
    data: function data() {
      return {
        scrollbarWidth: 0,
        thumbTop: '',
        thumbHeight: ''
      };
    },
    created: function created() {
      this.scrollbarWidth = getScrollbarWidth();
      document.addEventListener('mouseup', this.handleDragend);
    },
    beforeDestroy: function beforeDestroy() {
      document.addEventListener('mouseup', this.handleDragend);
    },
    mounted: function mounted() {
      this.$nextTick(this.getThumbSize);
    },
    methods: {
      getThumbSize: function getThumbSize() {
        var wrap = this.$refs.wrap;
        if (!wrap) return;
        var heightPercentage = wrap.clientHeight * 100 / wrap.scrollHeight;
        this.thumbHeight = heightPercentage < 100 ? "".concat(heightPercentage, "%") : '';
      },
      handleScroll: function handleScroll(evt) {
        var el = evt.currentTarget;
        var scrollHeight = el.scrollHeight,
            scrollTop = el.scrollTop;
        this.thumbTop = "".concat(scrollTop * 100 / scrollHeight, "%");
      },
      handleDragstart: function handleDragstart(evt) {
        evt.stopImmediatePropagation();
        this._draggable = true;
        var offsetTop = this.$refs.thumb.offsetTop;
        this._prevY = evt.clientY - offsetTop;
        document.addEventListener('mousemove', this.handleDraging);
      },
      handleDraging: function handleDraging(evt) {
        if (!this._draggable) return;
        var clientY = evt.clientY;
        var wrap = this.$refs.wrap;
        var scrollHeight = wrap.scrollHeight,
            clientHeight = wrap.clientHeight;
        var offsetY = clientY - this._prevY;
        var top = offsetY * scrollHeight / clientHeight;
        wrap.scrollTop = top;
      },
      handleDragend: function handleDragend() {
        if (this._draggable) {
          this._draggable = false;
          document.removeEventListener('mousemove', this.handleDraging);
        }
      }
    }
  };
  /* script */

  var __vue_script__$5$1 = script$5$1;
  /* template */

  var __vue_render__$7 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('div', {
      class: _vm.prefixClass + "-scrollbar",
      style: {
        position: 'relative',
        overflow: 'hidden'
      }
    }, [_c('div', {
      ref: "wrap",
      class: _vm.prefixClass + "-scrollbar-wrap",
      style: {
        marginRight: "-" + _vm.scrollbarWidth + "px"
      },
      on: {
        "scroll": _vm.handleScroll
      }
    }, [_vm._t("default")], 2), _vm._v(" "), _c('div', {
      class: _vm.prefixClass + "-scrollbar-track"
    }, [_c('div', {
      ref: "thumb",
      class: _vm.prefixClass + "-scrollbar-thumb",
      style: {
        height: _vm.thumbHeight,
        top: _vm.thumbTop
      },
      on: {
        "mousedown": _vm.handleDragstart
      }
    })])]);
  };

  var __vue_staticRenderFns__$7 = [];
  /* style */

  var __vue_inject_styles__$7 = undefined;
  /* scoped */

  var __vue_scope_id__$7 = undefined;
  /* module identifier */

  var __vue_module_identifier__$7 = undefined;
  /* functional template */

  var __vue_is_functional_template__$7 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$7 = normalizeComponent$1({
    render: __vue_render__$7,
    staticRenderFns: __vue_staticRenderFns__$7
  }, __vue_inject_styles__$7, __vue_script__$5$1, __vue_scope_id__$7, __vue_is_functional_template__$7, __vue_module_identifier__$7, false, undefined, undefined, undefined); //


  var padNumber = function padNumber(value) {
    value = parseInt(value, 10);
    return value < 10 ? "0".concat(value) : "".concat(value);
  };

  var generateOptions = function generateOptions(length, step, options) {
    if (Array.isArray(options)) {
      return options.filter(function (v) {
        return v >= 0 && v < length;
      });
    }

    if (step <= 0) {
      step = 1;
    }

    var arr = [];

    for (var i = 0; i < length; i += step) {
      arr.push(i);
    }

    return arr;
  };

  var scrollTo = function scrollTo(element, to) {
    var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; // jump to target if duration zero

    if (duration <= 0) {
      requestAnimationFrame(function () {
        element.scrollTop = to;
      });
      return;
    }

    var difference = to - element.scrollTop;
    var tick = difference / duration * 10;
    requestAnimationFrame(function () {
      var scrollTop = element.scrollTop + tick;

      if (scrollTop >= to) {
        element.scrollTop = to;
        return;
      }

      element.scrollTop = scrollTop;
      scrollTo(element, to, duration - 10);
    });
  };

  var script$6 = {
    name: 'ListColumns',
    components: {
      ScrollbarVertical: __vue_component__$7
    },
    inject: {
      prefixClass: {
        default: 'mx'
      }
    },
    props: {
      date: Date,
      scrollDuration: {
        type: Number,
        default: 100
      },
      getClasses: {
        type: Function,
        default: function _default() {
          return [];
        }
      },
      hourOptions: Array,
      minuteOptions: Array,
      secondOptions: Array,
      showHour: {
        type: Boolean,
        default: true
      },
      showMinute: {
        type: Boolean,
        default: true
      },
      showSecond: {
        type: Boolean,
        default: true
      },
      hourStep: {
        type: Number,
        default: 1
      },
      minuteStep: {
        type: Number,
        default: 1
      },
      secondStep: {
        type: Number,
        default: 1
      },
      use12h: {
        type: Boolean,
        default: false
      }
    },
    computed: {
      columns: function columns() {
        var cols = [];
        if (this.showHour) cols.push({
          type: 'hour',
          list: this.getHoursList()
        });
        if (this.showMinute) cols.push({
          type: 'minute',
          list: this.getMinutesList()
        });
        if (this.showSecond) cols.push({
          type: 'second',
          list: this.getSecondsList()
        });
        if (this.use12h) cols.push({
          type: 'ampm',
          list: this.getAMPMList()
        });
        return cols.filter(function (v) {
          return v.list.length > 0;
        });
      }
    },
    watch: {
      date: {
        handler: function handler() {
          var _this = this;

          this.$nextTick(function () {
            _this.scrollToSelected(_this.scrollDuration);
          });
        }
      }
    },
    mounted: function mounted() {
      this.scrollToSelected(0);
    },
    methods: {
      getHoursList: function getHoursList() {
        var _this2 = this;

        return generateOptions(this.use12h ? 12 : 24, this.hourStep, this.hourOptions).map(function (num) {
          var date = new Date(_this2.date);
          var text = padNumber(num);

          if (_this2.use12h) {
            if (num === 0) {
              text = '12';
            }

            if (date.getHours() >= 12) {
              num += 12;
            }
          }

          var value = date.setHours(num);
          return {
            value: value,
            text: text
          };
        });
      },
      getMinutesList: function getMinutesList() {
        var _this3 = this;

        return generateOptions(60, this.minuteStep, this.minuteOptions).map(function (num) {
          var value = new Date(_this3.date).setMinutes(num);
          return {
            value: value,
            text: padNumber(num)
          };
        });
      },
      getSecondsList: function getSecondsList() {
        var _this4 = this;

        return generateOptions(60, this.secondStep, this.secondOptions).map(function (num) {
          var value = new Date(_this4.date).setSeconds(num);
          return {
            value: value,
            text: padNumber(num)
          };
        });
      },
      getAMPMList: function getAMPMList() {
        var _this5 = this;

        return ['AM', 'PM'].map(function (text, i) {
          var date = new Date(_this5.date);
          var value = date.setHours(date.getHours() % 12 + i * 12);
          return {
            text: text,
            value: value
          };
        });
      },
      scrollToSelected: function scrollToSelected(duration) {
        var elements = this.$el.querySelectorAll('.active');

        for (var i = 0; i < elements.length; i++) {
          var element = elements[i];
          var scrollElement = getScrollParent(element, this.$el);

          if (scrollElement) {
            var to = element.offsetTop;
            scrollTo(scrollElement, to, duration);
          }
        }
      },
      handleSelect: function handleSelect(evt) {
        var target = evt.target,
            currentTarget = evt.currentTarget;
        if (target.tagName.toUpperCase() !== 'LI') return;
        var type = currentTarget.getAttribute('data-type');
        var colIndex = parseInt(currentTarget.getAttribute('data-index'), 10);
        var cellIndex = parseInt(target.getAttribute('data-index'), 10);
        var value = this.columns[colIndex].list[cellIndex].value;
        this.$emit('select', value, type);
      }
    }
  };
  /* script */

  var __vue_script__$6 = script$6;
  /* template */

  var __vue_render__$8 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('div', {
      class: _vm.prefixClass + "-time-columns"
    }, _vm._l(_vm.columns, function (col, i) {
      return _c('scrollbar-vertical', {
        key: i,
        class: _vm.prefixClass + "-time-column"
      }, [_c('ul', {
        class: _vm.prefixClass + "-time-list",
        attrs: {
          "data-type": col.type,
          "data-index": i
        },
        on: {
          "click": _vm.handleSelect
        }
      }, _vm._l(col.list, function (item, j) {
        return _c('li', {
          key: item.value,
          class: [_vm.prefixClass + "-time-item", _vm.getClasses(item.value)],
          attrs: {
            "data-index": j
          }
        }, [_vm._v("\n        " + _vm._s(item.text) + "\n      ")]);
      }), 0)]);
    }), 1);
  };

  var __vue_staticRenderFns__$8 = [];
  /* style */

  var __vue_inject_styles__$8 = undefined;
  /* scoped */

  var __vue_scope_id__$8 = undefined;
  /* module identifier */

  var __vue_module_identifier__$8 = undefined;
  /* functional template */

  var __vue_is_functional_template__$8 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$8 = normalizeComponent$1({
    render: __vue_render__$8,
    staticRenderFns: __vue_staticRenderFns__$8
  }, __vue_inject_styles__$8, __vue_script__$6, __vue_scope_id__$8, __vue_is_functional_template__$8, __vue_module_identifier__$8, false, undefined, undefined, undefined); //


  function parseOption() {
    var time = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
    var values = time.split(':');

    if (values.length >= 2) {
      var hours = parseInt(values[0], 10);
      var minutes = parseInt(values[1], 10);
      return {
        hours: hours,
        minutes: minutes
      };
    }

    return null;
  }

  var scrollTo$1 = function scrollTo(element, to) {
    if (element) {
      element.scrollTop = to;
    }
  };

  var script$7 = {
    name: 'ListOptions',
    components: {
      ScrollbarVertical: __vue_component__$7
    },
    inject: {
      getLocale: {
        default: function _default() {
          return getLocale;
        }
      },
      prefixClass: {
        default: 'mx'
      }
    },
    props: {
      date: Date,
      options: {
        type: [Object, Function],
        default: function _default() {
          return [];
        }
      },
      format: {
        type: String,
        default: 'HH:mm:ss'
      },
      getClasses: {
        type: Function,
        default: function _default() {
          return [];
        }
      }
    },
    computed: {
      list: function list() {
        var result = [];
        var options = this.options;

        if (typeof options === 'function') {
          return options() || [];
        }

        var start = parseOption(options.start);
        var end = parseOption(options.end);
        var step = parseOption(options.step);
        var fmt = options.format || this.format;

        if (start && end && step) {
          var startMinutes = start.minutes + start.hours * 60;
          var endMinutes = end.minutes + end.hours * 60;
          var stepMinutes = step.minutes + step.hours * 60;
          var len = Math.floor((endMinutes - startMinutes) / stepMinutes);

          for (var i = 0; i <= len; i++) {
            var timeMinutes = startMinutes + i * stepMinutes;
            var hours = Math.floor(timeMinutes / 60);
            var minutes = timeMinutes % 60;
            var value = new Date(this.date).setHours(hours, minutes, 0);
            result.push({
              value: value,
              text: this.formatDate(value, fmt)
            });
          }
        }

        return result;
      }
    },
    mounted: function mounted() {
      this.scrollToSelected();
    },
    methods: {
      formatDate: function formatDate(date, fmt) {
        return format(date, fmt, {
          locale: this.getLocale().formatLocale
        });
      },
      scrollToSelected: function scrollToSelected() {
        var element = this.$el.querySelector('.active');
        if (!element) return;
        var scrollElement = getScrollParent(element, this.$el);
        if (!scrollElement) return;
        var to = element.offsetTop;
        scrollTo$1(scrollElement, to);
      },
      handleSelect: function handleSelect(value) {
        this.$emit('select', value, 'time');
      }
    }
  };
  /* script */

  var __vue_script__$7 = script$7;
  /* template */

  var __vue_render__$9 = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('scrollbar-vertical', _vm._l(_vm.list, function (item) {
      return _c('div', {
        key: item.value,
        class: [_vm.prefixClass + "-time-option", _vm.getClasses(item.value)],
        on: {
          "click": function click($event) {
            return _vm.handleSelect(item.value);
          }
        }
      }, [_vm._v("\n    " + _vm._s(item.text) + "\n  ")]);
    }), 0);
  };

  var __vue_staticRenderFns__$9 = [];
  /* style */

  var __vue_inject_styles__$9 = undefined;
  /* scoped */

  var __vue_scope_id__$9 = undefined;
  /* module identifier */

  var __vue_module_identifier__$9 = undefined;
  /* functional template */

  var __vue_is_functional_template__$9 = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$9 = normalizeComponent$1({
    render: __vue_render__$9,
    staticRenderFns: __vue_staticRenderFns__$9
  }, __vue_inject_styles__$9, __vue_script__$7, __vue_scope_id__$9, __vue_is_functional_template__$9, __vue_module_identifier__$9, false, undefined, undefined, undefined); //


  var script$8 = {
    name: 'TimePanel',
    components: {
      ListColumns: __vue_component__$8,
      ListOptions: __vue_component__$9
    },
    inject: {
      getLocale: {
        default: function _default() {
          return getLocale;
        }
      },
      prefixClass: {
        default: 'mx'
      }
    },
    props: {
      value: {},
      defaultValue: {
        default: function _default() {
          var date = new Date();
          date.setHours(0, 0, 0, 0);
          return date;
        }
      },
      format: {
        default: 'HH:mm:ss'
      },
      timeTitleFormat: {
        type: String,
        default: 'YYYY-MM-DD'
      },
      showTimeHeader: {
        type: Boolean,
        default: false
      },
      disabledTime: {
        type: Function,
        default: function _default() {
          return false;
        }
      },
      timePickerOptions: {
        type: [Object, Function],
        default: function _default() {
          return null;
        }
      },
      hourOptions: Array,
      minuteOptions: Array,
      secondOptions: Array,
      hourStep: {
        type: Number,
        default: 1
      },
      minuteStep: {
        type: Number,
        default: 1
      },
      secondStep: {
        type: Number,
        default: 1
      },
      showHour: {
        type: Boolean,
        default: undefined
      },
      showMinute: {
        type: Boolean,
        default: undefined
      },
      showSecond: {
        type: Boolean,
        default: undefined
      },
      use12h: {
        type: Boolean,
        default: undefined
      },
      scrollDuration: {
        type: Number,
        default: 100
      }
    },
    computed: {
      innerValue: function innerValue() {
        return getValidDate(this.value, this.defaultValue);
      },
      title: function title() {
        var titleFormat = this.timeTitleFormat;
        var date = new Date(this.innerValue);
        return this.formatDate(date, titleFormat);
      },
      innerForamt: function innerForamt() {
        return typeof this.format === 'string' ? this.format : 'HH:mm:ss';
      },
      ShowHourMinuteSecondAMPM: function ShowHourMinuteSecondAMPM() {
        var _this = this;

        var fmt = this.innerForamt;
        var defaultProps = {
          showHour: /[HhKk]/.test(fmt),
          showMinute: /m/.test(fmt),
          showSecond: /s/.test(fmt),
          use12h: /a/i.test(fmt)
        };
        var obj = {};
        Object.keys(defaultProps).forEach(function (key) {
          obj[key] = typeof _this[key] === 'boolean' ? _this[key] : defaultProps[key];
        });
        return obj;
      }
    },
    methods: {
      formatDate: function formatDate(date, fmt) {
        return format(date, fmt, {
          locale: this.getLocale().formatLocale
        });
      },
      isDisabled: function isDisabled(date) {
        return this.disabledTime(new Date(date));
      },
      handleSelect: function handleSelect(value, type) {
        var date = new Date(value);

        if (!this.isDisabled(value)) {
          this.$emit('select', date, type);
        }
      },
      handleClickTitle: function handleClickTitle() {
        this.$emit('clicktitle');
      },
      getClasses: function getClasses(value) {
        var cellDate = new Date(value);

        if (this.isDisabled(value)) {
          return 'disabled';
        }

        if (cellDate.getTime() === this.innerValue.getTime()) {
          return 'active';
        }

        return '';
      }
    }
  };
  /* script */

  var __vue_script__$8 = script$8;
  /* template */

  var __vue_render__$a = function __vue_render__() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('div', {
      class: _vm.prefixClass + "-time"
    }, [_vm.showTimeHeader ? _c('div', {
      class: _vm.prefixClass + "-time-header"
    }, [_c('button', {
      class: _vm.prefixClass + "-btn " + _vm.prefixClass + "-btn-text " + _vm.prefixClass + "-time-header-title",
      attrs: {
        "type": "button"
      },
      on: {
        "click": _vm.handleClickTitle
      }
    }, [_vm._v("\n      " + _vm._s(_vm.title) + "\n    ")])]) : _vm._e(), _vm._v(" "), _c('div', {
      class: _vm.prefixClass + "-time-content"
    }, [_vm.timePickerOptions ? _c('list-options', {
      attrs: {
        "date": _vm.innerValue,
        "get-classes": _vm.getClasses,
        "options": _vm.timePickerOptions,
        "format": _vm.innerForamt
      },
      on: {
        "select": _vm.handleSelect
      }
    }) : _c('list-columns', _vm._b({
      attrs: {
        "date": _vm.innerValue,
        "get-classes": _vm.getClasses,
        "hour-options": _vm.hourOptions,
        "minute-options": _vm.minuteOptions,
        "second-options": _vm.secondOptions,
        "hour-step": _vm.hourStep,
        "minute-step": _vm.minuteStep,
        "second-step": _vm.secondStep,
        "scroll-duration": _vm.scrollDuration
      },
      on: {
        "select": _vm.handleSelect
      }
    }, 'list-columns', _vm.ShowHourMinuteSecondAMPM, false))], 1)]);
  };

  var __vue_staticRenderFns__$a = [];
  /* style */

  var __vue_inject_styles__$a = undefined;
  /* scoped */

  var __vue_scope_id__$a = undefined;
  /* module identifier */

  var __vue_module_identifier__$a = undefined;
  /* functional template */

  var __vue_is_functional_template__$a = false;
  /* style inject */

  /* style inject SSR */

  /* style inject shadow dom */

  var __vue_component__$a = normalizeComponent$1({
    render: __vue_render__$a,
    staticRenderFns: __vue_staticRenderFns__$a
  }, __vue_inject_styles__$a, __vue_script__$8, __vue_scope_id__$a, __vue_is_functional_template__$a, __vue_module_identifier__$a, false, undefined, undefined, undefined);

  var TimeRange = {
    name: 'TimeRange',
    inject: {
      prefixClass: {
        default: 'mx'
      }
    },
    props: _objectSpread2$1({}, __vue_component__$a.props),
    data: function data() {
      return {
        startValue: new Date(NaN),
        endValue: new Date(NaN)
      };
    },
    watch: {
      value: {
        immediate: true,
        handler: function handler() {
          if (isValidRangeDate(this.value)) {
            var _this$value = _slicedToArray$1(this.value, 2),
                startValue = _this$value[0],
                endValue = _this$value[1];

            this.startValue = startValue;
            this.endValue = endValue;
          } else {
            this.startValue = new Date(NaN);
            this.endValue = new Date(NaN);
          }
        }
      }
    },
    methods: {
      emitChange: function emitChange(type, index) {
        var date = [this.startValue, this.endValue];
        this.$emit('select', date, type === 'time' ? 'time-range' : type, index);
      },
      handleSelectStart: function handleSelectStart(date, type) {
        this.startValue = date; // check the NaN

        if (!(this.endValue.getTime() >= date.getTime())) {
          this.endValue = date;
        }

        this.emitChange(type, 0);
      },
      handleSelectEnd: function handleSelectEnd(date, type) {
        // check the NaN
        this.endValue = date;

        if (!(this.startValue.getTime() <= date.getTime())) {
          this.startValue = date;
        }

        this.emitChange(type, 1);
      },
      disabledStartTime: function disabledStartTime(date) {
        return this.disabledTime(date, 0);
      },
      disabledEndTime: function disabledEndTime(date) {
        return date.getTime() < this.startValue.getTime() || this.disabledTime(date, 1);
      }
    },
    render: function render() {
      var h = arguments[0];
      var defaultValues = Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue, this.defaultValue];
      var prefixClass = this.prefixClass;
      return h("div", {
        "class": "".concat(prefixClass, "-range-wrapper")
      }, [h(__vue_component__$a, {
        "props": _objectSpread2$1({}, _objectSpread2$1({}, this.$props, {
          value: this.startValue,
          defaultValue: defaultValues[0],
          disabledTime: this.disabledStartTime
        })),
        "on": _objectSpread2$1({}, _objectSpread2$1({}, this.$listeners, {
          select: this.handleSelectStart
        }))
      }), h(__vue_component__$a, {
        "props": _objectSpread2$1({}, _objectSpread2$1({}, this.$props, {
          value: this.endValue,
          defaultValue: defaultValues[1],
          disabledTime: this.disabledEndTime
        })),
        "on": _objectSpread2$1({}, _objectSpread2$1({}, this.$listeners, {
          select: this.handleSelectEnd
        }))
      })]);
    }
  };
  var DatetimePanel = {
    name: 'DatetimePanel',
    inject: {
      prefixClass: {
        default: 'mx'
      }
    },
    emits: ['select', 'update:show-time-panel'],
    props: _objectSpread2$1({}, CalendarPanel.props, {}, __vue_component__$a.props, {
      showTimePanel: {
        type: Boolean,
        default: undefined
      }
    }),
    data: function data() {
      return {
        defaultTimeVisible: false,
        currentValue: this.value
      };
    },
    computed: {
      timeVisible: function timeVisible() {
        return typeof this.showTimePanel === 'boolean' ? this.showTimePanel : this.defaultTimeVisible;
      }
    },
    watch: {
      value: function value(val) {
        this.currentValue = val;
      },
      defaultTimeVisible: function defaultTimeVisible(val) {
        this.$emit('update:show-time-panel', val);
      }
    },
    methods: {
      closeTimePanel: function closeTimePanel() {
        this.defaultTimeVisible = false;
      },
      openTimePanel: function openTimePanel() {
        this.defaultTimeVisible = true;
      },
      emitDate: function emitDate(date, type) {
        this.$emit('select', date, type);
      },
      handleSelect: function handleSelect(date, type) {
        if (type === 'date') {
          this.openTimePanel();
        }

        var datetime = assignTime(date, getValidDate(this.value, this.defaultValue));

        if (this.disabledTime(new Date(datetime))) {
          // set the time of defalutValue;
          datetime = assignTime(date, this.defaultValue);

          if (this.disabledTime(new Date(datetime))) {
            // if disabled don't emit date
            this.currentValue = datetime;
            return;
          }
        }

        this.emitDate(datetime, type);
      }
    },
    render: function render() {
      var h = arguments[0];
      var calendarProps = {
        props: _objectSpread2$1({}, pick(this.$props, Object.keys(CalendarPanel.props)), {
          type: 'date',
          value: this.currentValue
        }),
        on: {
          select: this.handleSelect
        }
      };
      var timeProps = {
        props: _objectSpread2$1({}, pick(this.$props, Object.keys(__vue_component__$a.props)), {
          showTimeHeader: true,
          value: this.currentValue
        }),
        on: {
          select: this.emitDate,
          clicktitle: this.closeTimePanel
        }
      };
      var prefixClass = this.prefixClass;
      return h("div", [h(CalendarPanel, helper([{}, calendarProps])), this.timeVisible && h(__vue_component__$a, helper([{
        "class": "".concat(prefixClass, "-calendar-time")
      }, timeProps]))]);
    }
  };
  var DatetimeRange = {
    name: 'DatetimeRange',
    inject: {
      prefixClass: {
        default: 'mx'
      }
    },
    emits: ['select', 'update:show-time-panel'],
    props: _objectSpread2$1({}, CalendarRange.props, {}, TimeRange.props, {
      showTimePanel: {
        type: Boolean,
        default: undefined
      }
    }),
    data: function data() {
      return {
        defaultTimeVisible: false,
        currentValue: this.value
      };
    },
    computed: {
      timeVisible: function timeVisible() {
        return typeof this.showTimePanel === 'boolean' ? this.showTimePanel : this.defaultTimeVisible;
      }
    },
    watch: {
      value: function value(val) {
        this.currentValue = val;
      },
      defaultTimeVisible: function defaultTimeVisible(val) {
        this.$emit('update:show-time-panel', val);
      }
    },
    methods: {
      closeTimePanel: function closeTimePanel() {
        this.defaultTimeVisible = false;
      },
      openTimePanel: function openTimePanel() {
        this.defaultTimeVisible = true;
      },
      emitDate: function emitDate(dates, type) {
        this.$emit('select', dates, type);
      },
      handleSelect: function handleSelect(dates, type) {
        var _this = this;

        if (type === 'date') {
          this.openTimePanel();
        }

        var defaultValues = Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue, this.defaultValue];
        var datetimes = dates.map(function (date, i) {
          var time = isValidRangeDate(_this.value) ? _this.value[i] : defaultValues[i];
          return assignTime(date, time);
        });

        if (datetimes[1].getTime() < datetimes[0].getTime()) {
          datetimes = [datetimes[0], datetimes[0]];
        }

        if (datetimes.some(this.disabledTime)) {
          datetimes = dates.map(function (date, i) {
            return assignTime(date, defaultValues[i]);
          });

          if (datetimes.some(this.disabledTime)) {
            this.currentValue = datetimes;
            return;
          }
        }

        this.emitDate(datetimes, type);
      }
    },
    render: function render() {
      var h = arguments[0];
      var calendarProps = {
        props: _objectSpread2$1({}, pick(this.$props, Object.keys(CalendarRange.props)), {
          type: 'date',
          value: this.currentValue
        }),
        on: {
          select: this.handleSelect
        }
      };
      var timeProps = {
        props: _objectSpread2$1({}, pick(this.$props, Object.keys(TimeRange.props)), {
          value: this.currentValue,
          showTimeHeader: true
        }),
        on: {
          select: this.emitDate,
          clicktitle: this.closeTimePanel
        }
      };
      var prefixClass = this.prefixClass;
      return h("div", [h(CalendarRange, helper([{}, calendarProps])), this.timeVisible && h(TimeRange, helper([{
        "class": "".concat(prefixClass, "-calendar-time")
      }, timeProps]))]);
    }
  };
  var componentMap = {
    default: CalendarPanel,
    time: __vue_component__$a,
    datetime: DatetimePanel
  };
  var componentRangeMap = {
    default: CalendarRange,
    time: TimeRange,
    datetime: DatetimeRange
  };
  var DatePicker = {
    name: 'DatePicker',
    provide: function provide() {
      var _this = this;

      return {
        // make locale reactive
        getLocale: function getLocale() {
          return _this.locale;
        },
        getWeek: this.getWeek,
        prefixClass: this.prefixClass,
        dispatchDatePicker: this.$emit.bind(this)
      };
    },
    props: _objectSpread2$1({}, DatetimePanel.props, {
      value: {},
      valueType: {
        type: String,
        default: 'date' // date, format, timestamp, or token like 'YYYY-MM-DD'

      },
      type: {
        type: String,
        // ['date', 'datetime', 'time', 'year', 'month', 'week']
        default: 'date'
      },
      format: {
        type: String
      },
      formatter: {
        type: Object
      },
      range: {
        type: Boolean,
        default: false
      },
      multiple: {
        type: Boolean,
        default: false
      },
      rangeSeparator: {
        type: String
      },
      lang: {
        type: [String, Object]
      },
      placeholder: {
        type: String,
        default: ''
      },
      editable: {
        type: Boolean,
        default: true
      },
      disabled: {
        type: Boolean,
        default: false
      },
      clearable: {
        type: Boolean,
        default: true
      },
      prefixClass: {
        type: String,
        default: 'mx'
      },
      inputClass: {},
      inputAttr: {
        type: Object,
        default: function _default() {
          return {};
        }
      },
      appendToBody: {
        type: Boolean,
        default: true
      },
      open: {
        type: Boolean,
        default: undefined
      },
      popupClass: {},
      popupStyle: {
        type: Object,
        default: function _default() {
          return {};
        }
      },
      inline: {
        type: Boolean,
        default: false
      },
      confirm: {
        type: Boolean,
        default: false
      },
      confirmText: {
        type: String,
        default: 'OK'
      },
      renderInputText: {
        type: Function
      },
      shortcuts: {
        type: Array,
        validator: function validator(value) {
          return Array.isArray(value) && value.every(function (v) {
            return isObject$2(v) && typeof v.text === 'string' && typeof v.onClick === 'function';
          });
        },
        default: function _default() {
          return [];
        }
      }
    }),
    data: function data() {
      return {
        // cache the innervalue, wait to confirm
        currentValue: null,
        userInput: null,
        defaultOpen: false
      };
    },
    computed: {
      popupVisible: function popupVisible() {
        return !this.disabled && (typeof this.open === 'boolean' ? this.open : this.defaultOpen);
      },
      innerRangeSeparator: function innerRangeSeparator() {
        return this.rangeSeparator || (this.multiple ? ',' : ' ~ ');
      },
      innerFormat: function innerFormat() {
        var map = {
          date: 'YYYY-MM-DD',
          datetime: 'YYYY-MM-DD HH:mm:ss',
          year: 'YYYY',
          month: 'YYYY-MM',
          time: 'HH:mm:ss',
          week: 'w'
        };
        return this.format || map[this.type] || map.date;
      },
      innerValue: function innerValue() {
        var value = this.value;

        if (this.validMultipleType) {
          value = Array.isArray(value) ? value : [];
          return value.map(this.value2date);
        }

        if (this.range) {
          value = Array.isArray(value) ? value.slice(0, 2) : [null, null];
          return value.map(this.value2date);
        }

        return this.value2date(value);
      },
      text: function text() {
        var _this2 = this;

        if (this.userInput !== null) {
          return this.userInput;
        }

        if (typeof this.renderInputText === 'function') {
          return this.renderInputText(this.innerValue);
        }

        if (!this.isValidValue(this.innerValue)) {
          return '';
        }

        if (Array.isArray(this.innerValue)) {
          return this.innerValue.map(function (v) {
            return _this2.formatDate(v);
          }).join(this.innerRangeSeparator);
        }

        return this.formatDate(this.innerValue);
      },
      showClearIcon: function showClearIcon() {
        return !this.disabled && this.clearable && this.text;
      },
      locale: function locale() {
        if (isObject$2(this.lang)) {
          return mergeDeep(getLocale(), this.lang);
        }

        return getLocale(this.lang);
      },
      validMultipleType: function validMultipleType() {
        var types = ['date', 'month', 'year'];
        return this.multiple && !this.range && types.indexOf(this.type) !== -1;
      }
    },
    watch: {
      innerValue: {
        immediate: true,
        handler: function handler(val) {
          this.currentValue = val;
        }
      }
    },
    created: function created() {
      if (_typeof(this.format) === 'object') {
        console.warn("[vue2-datepicker]: The prop `format` don't support Object any more. You can use the new prop `formatter` to replace it");
      }
    },
    methods: {
      handleClickOutSide: function handleClickOutSide(evt) {
        var target = evt.target;

        if (!this.$el.contains(target)) {
          this.closePopup();
        }
      },
      getFormatter: function getFormatter(key) {
        return isObject$2(this.formatter) && this.formatter[key] || isObject$2(this.format) && this.format[key];
      },
      getWeek: function getWeek$1(date, options) {
        if (typeof this.getFormatter('getWeek') === 'function') {
          return this.getFormatter('getWeek')(date, options);
        }

        return getWeek(date, options);
      },
      parseDate: function parseDate(value, fmt) {
        fmt = fmt || this.innerFormat;

        if (typeof this.getFormatter('parse') === 'function') {
          return this.getFormatter('parse')(value, fmt);
        }

        var backupDate = new Date();
        return parse(value, fmt, {
          locale: this.locale.formatLocale,
          backupDate: backupDate
        });
      },
      formatDate: function formatDate(date, fmt) {
        fmt = fmt || this.innerFormat;

        if (typeof this.getFormatter('stringify') === 'function') {
          return this.getFormatter('stringify')(date, fmt);
        }

        return format(date, fmt, {
          locale: this.locale.formatLocale
        });
      },
      // transform the outer value to inner date
      value2date: function value2date(value) {
        switch (this.valueType) {
          case 'date':
            return value instanceof Date ? new Date(value.getTime()) : new Date(NaN);

          case 'timestamp':
            return typeof value === 'number' ? new Date(value) : new Date(NaN);

          case 'format':
            return typeof value === 'string' ? this.parseDate(value) : new Date(NaN);

          default:
            return typeof value === 'string' ? this.parseDate(value, this.valueType) : new Date(NaN);
        }
      },
      // transform the inner date to outer value
      date2value: function date2value(date) {
        if (!isValidDate$1(date)) return null;

        switch (this.valueType) {
          case 'date':
            return date;

          case 'timestamp':
            return date.getTime();

          case 'format':
            return this.formatDate(date);

          default:
            return this.formatDate(date, this.valueType);
        }
      },
      emitValue: function emitValue(date, type) {
        // fix IE11/10 trigger input event when input is focused. (placeholder !== '')
        this.userInput = null;
        var value = Array.isArray(date) ? date.map(this.date2value) : this.date2value(date);
        this.$emit('input', value);
        this.$emit('change', value, type);
        this.afterEmitValue(type);
        return value;
      },
      afterEmitValue: function afterEmitValue(type) {
        // this.type === 'datetime', click the time should close popup
        if (!type || type === this.type || type === 'time') {
          this.closePopup();
        }
      },
      isValidValue: function isValidValue(value) {
        if (this.validMultipleType) {
          return isValidDates(value);
        }

        if (this.range) {
          return isValidRangeDate(value);
        }

        return isValidDate$1(value);
      },
      isValidValueAndNotDisabled: function isValidValueAndNotDisabled(value) {
        if (!this.isValidValue(value)) {
          return false;
        }

        var disabledDate = typeof this.disabledDate === 'function' ? this.disabledDate : function () {
          return false;
        };
        var disabledTime = typeof this.disabledTime === 'function' ? this.disabledTime : function () {
          return false;
        };

        if (!Array.isArray(value)) {
          value = [value];
        }

        return value.every(function (v) {
          return !disabledDate(v) && !disabledTime(v);
        });
      },
      handleMultipleDates: function handleMultipleDates(date, dates) {
        if (this.validMultipleType && dates) {
          var nextDates = dates.filter(function (v) {
            return v.getTime() !== date.getTime();
          });

          if (nextDates.length === dates.length) {
            nextDates.push(date);
          }

          return nextDates;
        }

        return date;
      },
      handleSelectDate: function handleSelectDate(val, type, dates) {
        val = this.handleMultipleDates(val, dates);

        if (this.confirm) {
          this.currentValue = val;
        } else {
          this.emitValue(val, this.validMultipleType ? "multiple-".concat(type) : type);
        }
      },
      clear: function clear() {
        this.emitValue(this.range ? [null, null] : null);
        this.$emit('clear');
      },
      handleClear: function handleClear(evt) {
        evt.stopPropagation();
        this.clear();
      },
      handleConfirmDate: function handleConfirmDate() {
        var value = this.emitValue(this.currentValue);
        this.$emit('confirm', value);
      },
      handleSelectShortcut: function handleSelectShortcut(evt) {
        var index = evt.currentTarget.getAttribute('data-index');
        var item = this.shortcuts[parseInt(index, 10)];

        if (isObject$2(item) && typeof item.onClick === 'function') {
          var date = item.onClick(this);

          if (date) {
            this.emitValue(date);
          }
        }
      },
      openPopup: function openPopup(evt) {
        if (this.popupVisible) return;
        this.defaultOpen = true;
        this.$emit('open', evt);
        this.$emit('update:open', true);
      },
      closePopup: function closePopup() {
        if (!this.popupVisible) return;
        this.defaultOpen = false;
        this.$emit('close');
        this.$emit('update:open', false);
      },
      blur: function blur() {
        // when use slot input
        if (this.$refs.input) {
          this.$refs.input.blur();
        }
      },
      focus: function focus() {
        if (this.$refs.input) {
          this.$refs.input.focus();
        }
      },
      handleInputChange: function handleInputChange() {
        var _this3 = this;

        if (!this.editable || this.userInput === null) return;
        var text = this.userInput.trim();
        this.userInput = null;

        if (text === '') {
          this.clear();
          return;
        }

        var date;

        if (this.validMultipleType) {
          date = text.split(this.innerRangeSeparator).map(function (v) {
            return _this3.parseDate(v.trim());
          });
        } else if (this.range) {
          var arr = text.split(this.innerRangeSeparator);

          if (arr.length !== 2) {
            // Maybe the separator during the day is the same as the separator for the date
            // eg: 2019-10-09-2020-01-02
            arr = text.split(this.innerRangeSeparator.trim());
          }

          date = arr.map(function (v) {
            return _this3.parseDate(v.trim());
          });
        } else {
          date = this.parseDate(text);
        }

        if (this.isValidValueAndNotDisabled(date)) {
          this.emitValue(date);
          this.blur();
        } else {
          this.$emit('input-error', text);
        }
      },
      handleInputInput: function handleInputInput(evt) {
        // slot input v-model
        this.userInput = typeof evt === 'string' ? evt : evt.target.value;
      },
      handleInputKeydown: function handleInputKeydown(evt) {
        var keyCode = evt.keyCode; // Tab 9 or Enter 13

        if (keyCode === 9) {
          this.closePopup();
        } else if (keyCode === 13) {
          this.handleInputChange();
        }
      },
      handleInputBlur: function handleInputBlur(evt) {
        // tab close
        this.$emit('blur', evt);
      },
      handleInputFocus: function handleInputFocus(evt) {
        this.openPopup(evt);
        this.$emit('focus', evt);
      },
      hasSlot: function hasSlot(name) {
        return !!(this.$slots[name] || this.$scopedSlots[name]);
      },
      renderSlot: function renderSlot(name, fallback, props) {
        var slotFn = this.$scopedSlots[name];

        if (slotFn) {
          return slotFn(props) || fallback;
        }

        return this.$slots[name] || fallback;
      },
      renderInput: function renderInput() {
        var h = this.$createElement;
        var prefixClass = this.prefixClass;

        var props = _objectSpread2$1({
          name: 'date',
          type: 'text',
          autocomplete: 'off',
          value: this.text,
          class: this.inputClass || "".concat(this.prefixClass, "-input"),
          readonly: !this.editable,
          disabled: this.disabled,
          placeholder: this.placeholder
        }, this.inputAttr);

        var value = props.value,
            className = props.class,
            attrs = _objectWithoutProperties(props, ["value", "class"]);

        var events = {
          keydown: this.handleInputKeydown,
          focus: this.handleInputFocus,
          blur: this.handleInputBlur,
          input: this.handleInputInput,
          change: this.handleInputChange
        };
        var input = this.renderSlot('input', h("input", {
          "domProps": {
            "value": value
          },
          "class": className,
          "attrs": _objectSpread2$1({}, attrs),
          "on": _objectSpread2$1({}, events),
          "ref": "input"
        }), {
          props: props,
          events: events
        });
        return h("div", {
          "class": "".concat(prefixClass, "-input-wrapper"),
          "on": {
            "mousedown": this.openPopup
          }
        }, [input, this.showClearIcon ? h("i", {
          "class": "".concat(prefixClass, "-icon-clear"),
          "on": {
            "mousedown": this.handleClear
          }
        }, [this.renderSlot('icon-clear', h(__vue_component__$2$1))]) : null, h("i", {
          "class": "".concat(prefixClass, "-icon-calendar")
        }, [this.renderSlot('icon-calendar', h(__vue_component__$1$1))])]);
      },
      renderContent: function renderContent() {
        var h = this.$createElement;
        var map = this.range ? componentRangeMap : componentMap;
        var Component = map[this.type] || map.default;

        var props = _objectSpread2$1({}, pick(this.$props, Object.keys(Component.props)), {
          value: this.currentValue
        });

        var on = _objectSpread2$1({}, pick(this.$listeners, Component.emits || []), {
          select: this.handleSelectDate
        });

        var content = h(Component, helper([{}, {
          props: props,
          on: on,
          ref: 'picker'
        }]));
        return h("div", {
          "class": "".concat(this.prefixClass, "-datepicker-body")
        }, [this.renderSlot('content', content, {
          value: this.currentValue,
          emit: this.handleSelectDate
        })]);
      },
      renderSidebar: function renderSidebar() {
        var _this4 = this;

        var h = this.$createElement;
        var prefixClass = this.prefixClass;
        return h("div", {
          "class": "".concat(prefixClass, "-datepicker-sidebar")
        }, [this.renderSlot('sidebar', null, {
          value: this.currentValue,
          emit: this.handleSelectDate
        }), this.shortcuts.map(function (v, i) {
          return h("button", {
            "key": i,
            "attrs": {
              "data-index": i,
              "type": "button"
            },
            "class": "".concat(prefixClass, "-btn ").concat(prefixClass, "-btn-text ").concat(prefixClass, "-btn-shortcut"),
            "on": {
              "click": _this4.handleSelectShortcut
            }
          }, [v.text]);
        })]);
      },
      renderHeader: function renderHeader() {
        var h = this.$createElement;
        return h("div", {
          "class": "".concat(this.prefixClass, "-datepicker-header")
        }, [this.renderSlot('header', null, {
          value: this.currentValue,
          emit: this.handleSelectDate
        })]);
      },
      renderFooter: function renderFooter() {
        var h = this.$createElement;
        var prefixClass = this.prefixClass;
        return h("div", {
          "class": "".concat(prefixClass, "-datepicker-footer")
        }, [this.renderSlot('footer', null, {
          value: this.currentValue,
          emit: this.handleSelectDate
        }), this.confirm ? h("button", {
          "attrs": {
            "type": "button"
          },
          "class": "".concat(prefixClass, "-btn ").concat(prefixClass, "-datepicker-btn-confirm"),
          "on": {
            "click": this.handleConfirmDate
          }
        }, [this.confirmText]) : null]);
      }
    },
    render: function render() {
      var _class;

      var h = arguments[0];
      var prefixClass = this.prefixClass,
          inline = this.inline,
          disabled = this.disabled;
      var sidedar = this.hasSlot('sidebar') || this.shortcuts.length ? this.renderSidebar() : null;
      var content = h("div", {
        "class": "".concat(prefixClass, "-datepicker-content")
      }, [this.hasSlot('header') ? this.renderHeader() : null, this.renderContent(), this.hasSlot('footer') || this.confirm ? this.renderFooter() : null]);
      return h("div", {
        "class": (_class = {}, _defineProperty$2(_class, "".concat(prefixClass, "-datepicker"), true), _defineProperty$2(_class, "".concat(prefixClass, "-datepicker-range"), this.range), _defineProperty$2(_class, "".concat(prefixClass, "-datepicker-inline"), inline), _defineProperty$2(_class, "disabled", disabled), _class)
      }, [!inline ? this.renderInput() : null, !inline ? h(__vue_component__$5, {
        "ref": "popup",
        "class": this.popupClass,
        "style": this.popupStyle,
        "attrs": {
          "visible": this.popupVisible,
          "appendToBody": this.appendToBody
        },
        "on": {
          "clickoutside": this.handleClickOutSide
        }
      }, [sidedar, content]) : h("div", {
        "class": "".concat(prefixClass, "-datepicker-main")
      }, [sidedar, content])]);
    }
  };
  DatePicker.locale = locale$1;

  DatePicker.install = function install(Vue) {
    Vue.component(DatePicker.name, DatePicker);
  };

  if (typeof window !== 'undefined' && window.Vue) {
    DatePicker.install(window.Vue);
  }

  _extends(DatePicker, {
    CalendarPanel: CalendarPanel,
    CalendarRange: CalendarRange,
    TimePanel: __vue_component__$a,
    TimeRange: TimeRange,
    DatetimePanel: DatetimePanel,
    DatetimeRange: DatetimeRange
  });

  var fi = {
    formatLocale: {
      months: ['Tammikuu', 'Helmikuu', 'Maaliskuu', 'Huhtikuu', 'Toukokuu', 'Kesäkuu', 'Heinäkuu', 'Elokuu', 'Syyskuu', 'Lokakuu', 'Marraskuu', 'Joulukuu'],
      monthsShort: ['Tammi', 'Helmi', 'Maalis', 'Huhti', 'Touko', 'Kesä', 'Heinä', 'Elo', 'Syys', 'Loka', 'Marras', 'Joulu'],
      weekdays: ['Sunnuntai', 'Maanantai', 'Tiistai', 'Keskiviikko', 'Torstai', 'Perjantai', 'Lauantai'],
      weekdaysShort: ['Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La'],
      weekdaysMin: ['Su', 'Ma', 'Ti', 'Ke', 'To', 'Pe', 'La'],
      firstDayOfWeek: 1,
      firstWeekContainsDate: 4
    },
    monthBeforeYear: true
  };

  Vue.filter('toCurrencyPrecise', function (value) {
    if (typeof value !== "number") {
      return value;
    }

    var minFractionDigits = 2;

    if (Math.floor(value) !== value) {
      var valueFractionDigitsCount = value.toString().split(".")[1].length;
      if (valueFractionDigitsCount > 2) minFractionDigits = valueFractionDigitsCount;
    }

    var formatter = new Intl.NumberFormat('fi-FI', {
      style: 'currency',
      currency: 'EUR',
      minimumFractionDigits: minFractionDigits
    });
    return formatter.format(value);
  });
  var script$9 = Vue.extend({
    name: "CustomerOrder",
    components: {
      LinkWithImageInTitle: __vue_component__$3,
      ValidatingInput: __vue_component__$4,
      Vue2Datepicker: DatePicker
    },
    directives: {},
    data: function data() {
      return {
        cartIsLoading: false,
        savingShoppingCart: false,
        savingShoppingCartSuccess: false,
        savingShoppingCartFailed: false,
        copyingShoppingCartFailed: false,
        copyingShoppingCartSuccess: false,
        editingShoppingCartName: false,
        translations: [],
        shoppingCart: {},
        dpLang: fi,
        search: "",
        resultSelect: false,
        selectedProductToAdd: [],
        productsSearchResults: [],
        isProductSearchOpen: false,
        isProductSearchLoading: false,
        currentIndex: -1,
        searchInput: "",
        noSearchResults: false,
        suggestionsList: null,
        additionalInfoSaved: false,
        additionalInfoError: false
      };
    },
    watch: {},
    created: function created() {
      var _this = this;

      this.cartIsLoading = true;
      this.dpLang = this.getDatePickerLocale();
      this.translations = window['CustomerTranslations'];
      axios$1.get("/api/" + this.getPageID() + "/EditCustomerOrderForm").then(function (result) {
        _this.shoppingCart = result.data;
        _this.cartIsLoading = false;
      });
    },
    mounted: function mounted() {
      this.setInitialValues();
    },
    updated: function updated() {
      this.setInitialValues();
    },
    methods: {
      getDatePickerLocale: function getDatePickerLocale() {
        //var siterootName = window['SiterootName'];
        //return siterootName === 'en' ? englishDPFormatLocale.default : siterootName;
        return fi;
      },
      setInitialValues: function setInitialValues() {
        var savedShoppingCartsPage = this.$refs.savedShoppingCartsLink;

        if (savedShoppingCartsPage) {
          savedShoppingCartsPage.setAttribute("href", window["E21"].Mercamer.Redirect.UrlToSavedShoppingCarts);
        }
      },
      getPageID: function getPageID() {
        if (typeof window['E21PageData'] == "undefined") {
          return $("body > form").attr("data-pageid").toString();
        } else {
          return window['E21PageData'].PageID;
        }
      },
      dpDisabledDate: function dpDisabledDate(date) {
        //console.log('datepicker current date: ' + date);
        var today = new Date(); //console.log('today: ' + today);

        if (today.getDay() == 5 || today.getDay() == 6) {
          //console.log('today is Friday or Saturday: ' + today);
          var nextMonday = new Date();
          if (today.getDay() == 5) nextMonday.setDate(today.getDate() + 3);
          if (today.getDay() == 6) nextMonday.setDate(today.getDate() + 2); //console.log('nextMonday: ' + nextMonday);

          if (date < nextMonday) return true;
        }

        var tomorrow = new Date();
        tomorrow.setDate(today.getDate() + 1); //console.log('tomorrow: ' + tomorrow);

        if (date <= tomorrow) {
          //console.log('datepicker current date <= today - today: ' + today);
          return true;
        }

        var currentDatePickerDay = new Date(date).getDay();
        if (currentDatePickerDay === 0 || currentDatePickerDay === 6) return true;
        return false;
      },
      dpChange: function dpChange(date) {
        this.shoppingCart.DesiredDeliveryDateModelInvalid = false;
        this.shoppingCart.DesiredDeliveryDateModelRequired = false;
      },
      getTodayDateAsString: function getTodayDateAsString() {
        var today = new Date();
        var dd = today.getDate();
        var mm = today.getMonth() + 1;
        var yyyy = today.getFullYear();

        if (dd < 10) {
          dd = '0' + dd;
        }

        if (mm < 10) {
          mm = '0' + mm;
        }

        return dd + "." + mm + "." + yyyy;
      },
      getSuggestionList: function getSuggestionList() {
        return $('.autocomplete-dropdown')[0];
      },
      refreshShoppingCart: function refreshShoppingCart() {
        var _this2 = this;

        axios$1.get("/api/" + this.getPageID() + "/EditCustomerOrderForm").then(function (response) {
          _this2.shoppingCart = response.data;

          if (_this2.shoppingCart.ItemModels.length > 0) {
            $('header .amount').html(_this2.shoppingCart.ItemModels.length).show();
          } else {
            $('header .amount').html("");
          }
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText; //console.error("refreshShoppingCart function error: ", error);

          console.error("refreshShoppingCart function errorMessage: ", errorMessage);
        });
      },
      updateAmount: function updateAmount(item, index) {
        var _this3 = this;

        //alert('updateAmount: ' + item.ProductID + ', index: ' + index)
        var amount = parseInt(item.SalesQtyUnitAmount, 10);

        if (item.SalesQtyUnitAmount !== null && /^(?!\-)\d+$/.test(item.SalesQtyUnitAmount) == true && amount > 0 && amount.toString() !== "0") {
          //alert('updateAmount: ' + item.ProductID + ', Amount: ' + item.Amount)
          this.shoppingCart.ItemModels[index].Loading = true;
          axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderProducts/UpdateAmount/" + item.ProductID + "?newAmount=" + amount, this.shoppingCart).then(function (response) {
            _this3.shoppingCart.ItemModels[index].Loading = false; //this.refreshShoppingCart();
          }, function (error) {
            var errorMessage = error.data.Message || error.statusText;
            console.error("updateAmount: bug has been caught!");
            console.error("errorMessage: ", errorMessage);
          }).then(function () {
            if (_this3.shoppingCart.IsDraft) {
              _this3.saveCart();
            }
          })["finally"](function () {
            _this3.refreshShoppingCart();
          });
        }
      },
      updateAmountOffer: function updateAmountOffer(item, index) {
        var _this4 = this;

        var amount = parseInt(item.SalesQtyUnitAmount, 10);
        var salesQuantity = parseFloat(item.OfferBaseQtyUnitAmount);

        if (item.SalesQtyUnitAmount !== null && /^(?!\-)\d+$/.test(item.SalesQtyUnitAmount) == true && amount > 0 && amount.toString() !== "0" && !isNaN(salesQuantity) && salesQuantity > 0) {
          this.shoppingCart.ItemModels[index].Loading = true;
          axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderProducts/UpdateOfferItemAmount/" + item.ProductID + "?newAmount=" + amount, this.shoppingCart).then(function (response) {
            _this4.shoppingCart.ItemModels[index].Loading = false; //this.refreshShoppingCart();
          }, function (error) {
            var errorMessage = error.data.Message || error.statusText;
            console.error("updateAmountOffer: bug has been caught!");
            console.error("errorMessage: ", errorMessage);
          }).then(function () {
            if (_this4.shoppingCart.IsDraft) {
              _this4.saveCart();
            }
          })["finally"](function () {
            _this4.refreshShoppingCart();
          });
        }
      },
      selectOfferSalesQuantity: function selectOfferSalesQuantity(item, index) {
        var _this5 = this;

        var amount = parseInt(item.SalesQtyUnitAmount, 10);
        var salesQuantity = parseFloat(item.OfferBaseQtyUnitAmount);

        if (item.SalesQtyUnitAmount !== null && /^(?!\-)\d+$/.test(item.SalesQtyUnitAmount) == true && amount > 0 && amount.toString() !== "0" && !isNaN(salesQuantity) && salesQuantity > 0) {
          this.shoppingCart.ItemModels[index].Loading = true;
          axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderProducts/UpdateOfferItemAmount/" + item.ProductID + "?newAmount=" + amount, this.shoppingCart).then(function (response) {
            _this5.shoppingCart.ItemModels[index].Loading = false;

            _this5.refreshShoppingCart();
          }, function (error) {
            var errorMessage = error.data.Message || error.statusText;
            console.error("selectOfferSalesQuantity: bug has been caught!");
            console.error("errorMessage: ", errorMessage);
          });
        }
      },
      removeItemFromCart: function removeItemFromCart(item, event) {
        var _this6 = this;

        event.preventDefault;
        axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderProducts/DeleteRow/" + item.ProductID, this.shoppingCart).then(function (response) {
          _this6.shoppingCart = response.data;
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("removeItemFromCart: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        }).then(function () {
          if (_this6.shoppingCart.IsDraft) {
            _this6.saveCart();
          }
        })["finally"](function () {
          _this6.refreshShoppingCart();
        });
      },
      changeDeliveryAddress: function changeDeliveryAddress() {
        var _this7 = this;

        axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderForm/UpdateCart", this.shoppingCart).then(function (response) {
          _this7.shoppingCart = response.data;
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("changeDeliveryAddress functions error: ");
          console.error("errorMessage: ", errorMessage);
        }).then(function () {
          if (_this7.shoppingCart.IsDraft) {
            _this7.saveCart();
          }
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("changeDeliveryAddress: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        })["finally"](function () {
          _this7.refreshShoppingCart();
        });
      },
      setDefaultDeliveryAddress: function setDefaultDeliveryAddress(event) {
        var _this8 = this;

        event.preventDefault;
        axios$1.post("/api/EditCustomerOrderForm/SetUserDefaultDeliveryAddress", this.shoppingCart).then(function (response) {//this.refreshShoppingCart();
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("setDefaultDeliveryAddress functions error: ");
          console.error("errorMessage: ", errorMessage);
        }).then(function () {
          if (_this8.shoppingCart.IsDraft) {
            _this8.saveCart();
          }
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("setDefaultDeliveryAddress: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        })["finally"](function () {
          _this8.refreshShoppingCart();
        });
      },
      resetDefaultDeliveryAddress: function resetDefaultDeliveryAddress(event) {
        var _this9 = this;

        event.preventDefault;
        axios$1.post("/api/EditCustomerOrderForm/ResetUserDefaultDeliveryAddress", this.shoppingCart).then(function (response) {//this.refreshShoppingCart();
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("resetDefaultDeliveryAddress functions error: ");
          console.error("errorMessage: ", errorMessage);
        }).then(function () {
          if (_this9.shoppingCart.IsDraft) {
            _this9.saveCart();
          }
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("resetDefaultDeliveryAddress: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        })["finally"](function () {
          _this9.refreshShoppingCart();
        });
      },
      inputManualCustomerOrderReference: function inputManualCustomerOrderReference() {
        var _this10 = this;

        if (this.shoppingCart.CustomerOrderReferenceType === undefined || this.shoppingCart.CustomerOrderReferenceType === "" || this.shoppingCart.CustomerOrderReferenceType === "CostLocationCustomerOrderReference") {
          if (this.shoppingCart.CustomerOrderReferenceType === "CostLocationCustomerOrderReference") {
            if (this.shoppingCart.SelectedCostLocationCustomerOrderNumber !== "") {
              this.shoppingCart.SelectedCostLocationCustomerOrderNumber = "";
            }
          }

          this.shoppingCart.CustomerOrderReferenceType = 'ManualCustomerOrderReference';
        }

        if (this.shoppingCart.CustomerOrderReference === "") {
          this.shoppingCart.CustomerOrderReferenceType = '';
        } //console.log("selected CustomerOrderReferenceType: ", this.shoppingCart.CustomerOrderReferenceType);


        axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderForm/UpdateCart", this.shoppingCart).then(function (response) {
          _this10.shoppingCart = response.data;
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("inputManualCustomerOrderReference functions error: ");
          console.error("errorMessage: ", errorMessage);
        }).then(function () {
          if (_this10.shoppingCart.IsDraft) {
            _this10.saveCart();
          }
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("inputManualCustomerOrderReference: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      selectCostLocationCustomerOrderNumber: function selectCostLocationCustomerOrderNumber(event) {
        var _this11 = this;

        event.preventDefault;

        if (this.shoppingCart.CustomerOrderReferenceType === undefined || this.shoppingCart.CustomerOrderReferenceType === "" || this.shoppingCart.CustomerOrderReferenceType === "ManualCustomerOrderReference") {
          if (this.shoppingCart.CustomerOrderReferenceType === "ManualCustomerOrderReference") {
            if (this.shoppingCart.CustomerOrderReference !== "") {
              this.shoppingCart.CustomerOrderReference = "";
            }
          }

          this.shoppingCart.CustomerOrderReferenceType = 'CostLocationCustomerOrderReference';
        }

        if (this.shoppingCart.SelectedCostLocationCustomerOrderNumber === "") {
          this.shoppingCart.CustomerOrderReferenceType = '';
        } //console.log("selected CostLocationCustomerOrderNumber: ", this.shoppingCart.SelectedCostLocationCustomerOrderNumber);


        axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderForm/UpdateCart", this.shoppingCart).then(function (response) {
          _this11.shoppingCart = response.data;
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("selectCostLocationCustomerOrderNumber functions error: ");
          console.error("errorMessage: ", errorMessage);
        }).then(function () {
          if (_this11.shoppingCart.IsDraft) {
            _this11.saveCart();
          }
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("selectCostLocationCustomerOrderNumber: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      proceedToSummary: function proceedToSummary(event) {
        var _this12 = this;

        event.preventDefault;
        axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderForm/ProceedToSummary", this.shoppingCart).then(function (response) {
          var hbFeedbackFieldVal = $('#hb-feedback-field').val();
          var UrlToSummaryView = "";

          var windowE21 = _.property('E21')(window);

          UrlToSummaryView = windowE21.Mercamer.Redirect.UrlToSummaryView;

          if (hbFeedbackFieldVal === "" && response.data.CartIsValid) {
            window.location.href = UrlToSummaryView;
          } else {
            _this12.shoppingCart = response.data;
          }
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("proceedToSummary functions error: ");
          console.error("errorMessage: ", errorMessage);
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("proceedToSummary: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      editShoppingCartName: function editShoppingCartName(event) {
        event.preventDefault();
        this.editingShoppingCartName = true;
      },
      saveCartTextField: function saveCartTextField(event) {
        if (event) {
          event.preventDefault();
        }

        if (this.shoppingCart.IsDraft) {
          this.saveCart();
        }
      },
      saveCartName: function saveCartName(event) {
        if (event) {
          event.preventDefault();
        }

        if (!this.shoppingCart.ShoppingCartName || this.shoppingCart.ShoppingCartName.length <= 0 || !this.shoppingCart.ItemModels || this.shoppingCart.ItemModels.length <= 0) {
          return;
        }

        this.saveCart(event, true);
      },
      saveCart: function saveCart(event) {
        var _this13 = this;

        var removeDraftStatus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

        if (event) {
          event.preventDefault();
        }

        if (!this.shoppingCart.ItemModels || this.shoppingCart.ItemModels.length <= 0) {
          return;
        }

        if (this.shoppingCart.IsDraft && this.shoppingCart.IsDraft == true && removeDraftStatus && removeDraftStatus == true) {
          this.shoppingCart.IsDraft = false;
          console.log("removed Draft Status");
        }

        this.savingShoppingCart = true;
        this.savingShoppingCartFailed = false;
        this.savingShoppingCartSuccess = false;
        axios$1.post("/api/" + this.getPageID() + "/UnfinishedCustomerShoppingCarts/SaveCart", this.shoppingCart).then(function (response) {
          var windowE21 = _.property('E21')(window);

          if (response.data.OrderAlreadyFinished) {
            //alert('Order is Already Finished');
            window.location.href = windowE21.Mercamer.Redirect.UrlToFormView;
          }

          if (response.data.ForceResetOrder) {
            //alert('ForceResetOrder');
            window.location.href = windowE21.Mercamer.Redirect.UrlToFormView;
          }

          _this13.savingShoppingCart = false;

          if (response.data.CartValidOnlySaving) {
            _this13.savingShoppingCartSuccess = true;
            _this13.editingShoppingCartName = false;
          }

          _this13.shoppingCart = response.data;
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("saveCart functions error: ");
          console.error("errorMessage: ", errorMessage);
          this.savingShoppingCart = false;
          this.savingShoppingCartFailed = true;
          this.savingShoppingCartSuccess = false;
        }).then(function () {
          $('.shoppingcart-save-success').hide(2500);
          $('.shoppingcart-name-missing').hide(4000);
        });
      },
      copyCart: function copyCart(event) {
        var _this14 = this;

        event.preventDefault();
        this.savingShoppingCart = true;
        this.copyingShoppingCartFailed = false;
        this.copyingShoppingCartSuccess = false;
        axios$1.post("/api/" + this.getPageID() + "/UnfinishedCustomerShoppingCarts/CopyCart", this.shoppingCart).then(function (response) {
          var windowE21 = _.property('E21')(window);

          if (response.data.OrderAlreadyFinished) {
            //alert('Order is Already Finished');
            window.location.href = windowE21.Mercamer.Redirect.UrlToFormView;
          }

          if (response.data.ForceResetOrder) {
            //alert('ForceResetOrder');
            window.location.href = windowE21.Mercamer.Redirect.UrlToFormView;
          }

          _this14.savingShoppingCart = false;
          _this14.copyingShoppingCartSuccess = true;
          _this14.shoppingCart = response.data;
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("saveCart functions error: ");
          console.error("errorMessage: ", errorMessage);
          this.savingShoppingCart = false;
          this.copyingShoppingCartFailed = true;
          this.copyingShoppingCartSuccess = false;
        }).then(function () {
          $('.shoppingcart-copy-success').hide(2500);
        });
      },
      resetCart: function resetCart(event) {
        event.preventDefault();
        axios$1.post("/api/" + this.getPageID() + "/UnfinishedCustomerShoppingCarts/ResetCart").then(function (response) {
          var windowE21 = _.property('E21')(window);

          window.location.href = windowE21.Mercamer.Redirect.UrlToFormView;
        }, function (error) {
          var errorMessage = error.statusText;
          console.error("resetCart functions error: ");
          console.error("errorMessage: ", errorMessage);
        })["catch"](function (error) {
          var errorMessage = error.statusText;
          console.error("resetCart: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      saveAdditionalInfo: function saveAdditionalInfo(item) {
        var _this15 = this;

        this.additionalInfoSaved = false;
        this.additionalInfoError = false;
        var postData = {
          ProductID: item.ProductID,
          Notes: item.RowAdditionalInfo
        }; //alert('postData: ProductID: ' + postData.ProductID + ', Notes: ' + postData.Notes);

        axios$1.post("/api/EditCustomerOrderProducts/SaveCartItemNotes", postData).then(function (response) {
          _this15.additionalInfoSaved = true;
          window.setTimeout(function () {
            this.additionalInfoSaved = false; //this.refreshShoppingCart();
          }.bind(_this15), 2000);
        }, function (error) {
          this.additionalInfoError = true;
          var errorMessage = error.data.Message || error.statusText;
          console.error("saveAdditionalInfo: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        }).then(function () {
          if (_this15.shoppingCart.IsDraft) {
            _this15.saveCart();
          }
        })["finally"](function () {
          _this15.refreshShoppingCart();
        });
      },
      quickProductAdd: function quickProductAdd() {
        var _this16 = this;

        if (this.selectedProductToAdd && this.selectedProductToAdd.value) {
          var productId = this.selectedProductToAdd.value;
          this.selectedProductToAdd.value = null;
          axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderProducts/AddToCart/" + productId, this.shoppingCart).then(function (response) {
            //this.refreshShoppingCart();
            _this16.shoppingCart = response.data;
            _this16.search = "";
            _this16.searchInput = "";
            _this16.selectedProductToAdd = null;
          }, function (error) {
            var errorMessage = error.data.Message || error.statusText;
            console.error("$scope.quickProductAdd.add functions error:");
            console.error("errorMessage: ", errorMessage);
          }).then(function () {
            $(".autocomplete-text.toolbarProp").val("");
          }).then(function () {
            if (!_this16.UnfinishedCustomerOrderID) {
              //console.log('quickProductAdd - call saveCart !this.UnfinishedCustomerOrderID');
              _this16.shoppingCart.IgnoreItemsInvalidity = true;

              _this16.saveCart();
            } else {
              if (_this16.shoppingCart.IsDraft) {
                _this16.saveCart();
              }
            }
          });
        }
      },
      searchProducts: function searchProducts() {
        var _this17 = this;

        if (this.search) {
          this.noSearchResults = false;
          this.searchInput = this.search;
          this.isProductSearchLoading = true;
          this.isProductSearchOpen = true;
          axios$1.get("/api/ProductsQuickSearch?search=" + this.search).then(function (response) {
            if (response.data && response.data.length) {
              _this17.resultSelect = false;
              _this17.productsSearchResults = response.data;
            } else {
              _this17.noSearchResults = true;
              _this17.productsSearchResults = [];
            }

            _this17.isProductSearchLoading = false;
          });
        } else {
          this.isProductSearchLoading = false;
          this.searchInput = null;
          this.isProductSearchOpen = false;
          this.productsSearchResults = [];
          this.selectedProductToAdd = null;
          this.currentIndex = -1;
        }
      },
      setProductSearchResult: function setProductSearchResult(result) {
        if (result) {
          //alert('setProductSearchResult');
          this.search = result.label;
          this.searchInput = this.search;
          this.resultSelect = true;
          this.selectedProductToAdd = result;
          this.isProductSearchOpen = false;
          this.isProductSearchLoading = false;
          this.clearResults();
          this.currentIndex = -1;
        }
      },
      highlightProductSearchResult: function highlightProductSearchResult(searchResultLabel, searchWord) {
        var result;
        var matcher = new RegExp(searchWord.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), "i");
        var match = searchResultLabel.match(matcher);

        if (match) {
          result = searchResultLabel.replace(matcher, '<span class="matched-text">' + match[0] + '</span>');
        } else {
          result = searchResultLabel;
        }

        return result;
      },
      hoverRowProductSearch: function hoverRowProductSearch(index) {
        this.currentIndex = index;

        if (this.productsSearchResults) {
          this.selectedProductToAdd = this.productsSearchResults[this.currentIndex];
        }
      },
      hoverOutProductSearch: function hoverOutProductSearch(index) {
        this.selectedProductToAdd = null;
        this.currentIndex = -1;
      },
      hideProductSearchResults: function hideProductSearchResults(event) {
        if (this.resultSelect === false) {
          //this.search = this.searchInput;
          this.clearResults();

          if (this.selectedProductToAdd) {
            this.setProductSearchResult(this.selectedProductToAdd);
          }

          this.isProductSearchLoading = false;
          this.isProductSearchOpen = false;
          this.noSearchResults = false;
        }
      },
      clearResults: function clearResults() {
        this.isProductSearchOpen = false;
        this.productsSearchResults = [];
      },
      onArrowDown: function onArrowDown(event) {
        if (this.productsSearchResults) {
          event.preventDefault();

          if (this.currentIndex + 1 < this.productsSearchResults.length) {
            this.currentIndex++;
            this.search = this.productsSearchResults[this.currentIndex].label;
            this.adjustddHeight();
          } else if (this.currentIndex + 1 === this.productsSearchResults.length) {
            this.currentIndex = -1;
            this.search = this.searchInput;
            this.scrollToTop();
          }
        }
      },
      onArrowUp: function onArrowUp(event) {
        if (this.productsSearchResults) {
          event.preventDefault();

          if (this.currentIndex >= 1) {
            this.currentIndex--;
            this.search = this.productsSearchResults[this.currentIndex].label;
            this.adjustddHeight();
          } else if (this.currentIndex === 0) {
            this.currentIndex = -1;
            this.search = this.searchInput;
          } else if (this.currentIndex === -1) {
            this.currentIndex = this.productsSearchResults.length - 1;
            this.search = this.productsSearchResults[this.currentIndex].label;
            this.scrollToBottom();
          }
        }
      },
      adjustddHeight: function adjustddHeight() {
        if (this.isScrollNeeded()) {
          var ddCSS = getComputedStyle(this.getSuggestionList());
          var borderTop, paddingTop, offset, scroll, ddHeight, rowHeight;
          var row = $('.autocomplete-row')[this.currentIndex];
          borderTop = parseInt(ddCSS.borderTopWidth, 10) || 0;
          paddingTop = parseInt(ddCSS.paddingTop, 10) || 0;
          offset = row.getBoundingClientRect().top - this.getSuggestionList().getBoundingClientRect().top - borderTop - paddingTop;
          scroll = this.getSuggestionList().scrollTop;
          ddHeight = this.getSuggestionList().offsetHeight;
          rowHeight = row.offsetHeight;

          if (offset < 0) {
            this.getSuggestionList().scrollTop = scroll + offset;
          } else if (offset + rowHeight > ddHeight) {
            this.getSuggestionList().scrollTop = scroll + offset - ddHeight + rowHeight;
          }
        }
      },
      scrollToTop: function scrollToTop() {
        if (this.isScrollNeeded()) {
          var row = $('.autocomplete-row')[0];
          this.getSuggestionList().scrollTop = -1 * row.offsetHeight;
        }
      },
      scrollToBottom: function scrollToBottom() {
        if (this.isScrollNeeded()) {
          var row = $('.autocomplete-row')[this.productsSearchResults.length - 1];
          this.getSuggestionList().scrollTop = row.getBoundingClientRect().top;
        }
      },
      isScrollNeeded: function isScrollNeeded() {
        var ddCSS = getComputedStyle(this.getSuggestionList());
        return this.getSuggestionList().scrollHeight > this.getSuggestionList().clientHeight && (ddCSS.overflowY === 'auto' || ddCSS.overflowY === 'visible' || ddCSS.overflowY === 'scroll');
      },
      onEnter: function onEnter(event) {
        if (this.productsSearchResults) {
          if (this.currentIndex >= 0 && this.currentIndex < this.productsSearchResults.length) {
            event.preventDefault();
            this.setProductSearchResult(this.productsSearchResults[this.currentIndex]);
          } else {
            this.clearResults();
            this.isProductSearchOpen = false;
            this.isProductSearchLoading = false;
          }

          this.quickProductAdd();
        }
      }
    },
    computed: {
      itemsValid: function itemsValid() {
        //TODO: Check that items have prices
        return this.shoppingCart.ItemModels && this.shoppingCart.ItemModels.length < 1;
      }
    }
  });

  /* script */
  const __vue_script__$9 = script$9;

  /* template */
  var __vue_render__$b = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "customer-order-cart-view" }, [
      _c(
        "div",
        {
          staticClass:
            "heading-container d-flex align-items-start justify-content-between"
        },
        [
          _c(
            "div",
            {
              staticClass:
                "d-flex align-items-center justify-content-start flex-grow-1"
            },
            [
              _vm._m(0),
              _vm._v(" "),
              _c("div", { staticClass: "heading-status " }, [
                !_vm.itemsValid
                  ? _c("div", [
                      _c(
                        "span",
                        {
                          directives: [
                            {
                              name: "show",
                              rawName: "v-show",
                              value: _vm.savingShoppingCart,
                              expression: "savingShoppingCart"
                            }
                          ],
                          staticClass: "status-info"
                        },
                        [
                          _c("i", { staticClass: "fa fa-spinner rotate" }),
                          _vm._v(" Hetkinen...")
                        ]
                      )
                    ])
                  : _vm._e(),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value:
                          _vm.shoppingCart.ShoppingCartNameRequired ||
                          _vm.savingShoppingCartFailed ||
                          _vm.savingShoppingCartSuccess ||
                          !_vm.shoppingCart.CartValidForCopying,
                        expression:
                          "shoppingCart.ShoppingCartNameRequired || savingShoppingCartFailed || savingShoppingCartSuccess || !shoppingCart.CartValidForCopying"
                      }
                    ],
                    staticClass: "saving-shopping-cart-indicator"
                  },
                  [
                    _vm.shoppingCart.ShoppingCartNameRequired
                      ? _c(
                          "span",
                          {
                            staticClass:
                              "status-info shoppingcart-name-missing text-warning"
                          },
                          [_vm._v("Korille pitää antaa nimi")]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.shoppingCart.CartInvalidForCopying
                      ? _c(
                          "span",
                          {
                            staticClass:
                              "status-info shoppingcart-copy-failed text-danger"
                          },
                          [_vm._v("Kopionti epäonnistui")]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.savingShoppingCartFailed
                      ? _c(
                          "span",
                          {
                            staticClass:
                              "status-info shoppingcart-save-failed text-danger"
                          },
                          [_vm._v("Tallennus epäonnistui")]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.savingShoppingCartSuccess
                      ? _c(
                          "span",
                          {
                            staticClass:
                              "status-info shoppingcart-save-success text-success"
                          },
                          [
                            _c("i", { staticClass: "fa-light fa-thumbs-up" }),
                            _vm._v(" Tallennettu!")
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.copyingShoppingCartSuccess
                      ? _c(
                          "span",
                          {
                            staticClass:
                              "status-info shoppingcart-copy-success text-success"
                          },
                          [
                            _c("i", { staticClass: "fa-light fa-thumbs-up" }),
                            _vm._v(" Kopioitu!")
                          ]
                        )
                      : _vm._e()
                  ]
                )
              ])
            ]
          ),
          _vm._v(" "),
          _c("div", { staticClass: "heading-buttons" }, [
            !_vm.itemsValid
              ? _c("div", { staticClass: "cart-save-buttons" }, [
                  _c("div", { staticClass: "input-group" }, [
                    _vm._m(1),
                    _vm._v(" "),
                    _c("input", {
                      directives: [
                        {
                          name: "model",
                          rawName: "v-model",
                          value: _vm.shoppingCart.ShoppingCartName,
                          expression: "shoppingCart.ShoppingCartName"
                        }
                      ],
                      staticClass: "form-control font-italic",
                      attrs: { readonly: _vm.editingShoppingCartName == false },
                      domProps: { value: _vm.shoppingCart.ShoppingCartName },
                      on: {
                        input: function($event) {
                          if ($event.target.composing) {
                            return
                          }
                          _vm.$set(
                            _vm.shoppingCart,
                            "ShoppingCartName",
                            $event.target.value
                          );
                        }
                      }
                    }),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: _vm.editingShoppingCartName == false,
                            expression: "editingShoppingCartName == false"
                          }
                        ],
                        staticClass: "input-group-append"
                      },
                      [
                        _c(
                          "button",
                          {
                            staticClass: "btn btn-primary",
                            attrs: { type: "button" },
                            on: {
                              click: function($event) {
                                return _vm.editShoppingCartName($event)
                              }
                            }
                          },
                          [_c("i", { staticClass: "fa-light fa-pen" })]
                        )
                      ]
                    ),
                    _vm._v(" "),
                    _c(
                      "div",
                      {
                        directives: [
                          {
                            name: "show",
                            rawName: "v-show",
                            value: _vm.editingShoppingCartName == true,
                            expression: "editingShoppingCartName == true"
                          }
                        ],
                        staticClass: "input-group-append"
                      },
                      [
                        _c(
                          "button",
                          {
                            staticClass: "btn btn-primary",
                            attrs: { type: "button" },
                            on: {
                              click: function($event) {
                                return _vm.saveCartName($event)
                              }
                            }
                          },
                          [_vm._v("Tallenna ostoskori")]
                        )
                      ]
                    ),
                    _vm._v(" "),
                    _c("div", { staticClass: "dropdown input-group-append" }, [
                      _vm._m(2),
                      _vm._v(" "),
                      _c(
                        "div",
                        {
                          staticClass: "dropdown-menu dropdown-menu-right",
                          attrs: { "aria-labelledby": "CartFunctions" }
                        },
                        [
                          _vm.shoppingCart.UnfinishedCustomerOrderID &&
                          _vm.shoppingCart.ShoppingCartName
                            ? _c(
                                "a",
                                {
                                  staticClass: "dropdown-item",
                                  attrs: { href: "#" },
                                  on: {
                                    click: function($event) {
                                      return _vm.copyCart($event)
                                    }
                                  }
                                },
                                [
                                  _c("i", { staticClass: "fad fa-copy mr-2" }),
                                  _vm._v(
                                    "Tee kopio korista\n                            "
                                  )
                                ]
                              )
                            : _vm._e(),
                          _vm._v(" "),
                          _c(
                            "a",
                            {
                              staticClass: "dropdown-item",
                              attrs: { href: "#" },
                              on: {
                                click: function($event) {
                                  return _vm.resetCart($event)
                                }
                              }
                            },
                            [
                              _c("i", { staticClass: "fad fa-plus mr-2" }),
                              _vm._v(
                                "Tee uusi tyhjä kori\n                            "
                              )
                            ]
                          )
                        ]
                      )
                    ])
                  ]),
                  _vm._v(" "),
                  _c(
                    "a",
                    {
                      ref: "savedShoppingCartsLink",
                      staticClass: "text-sm",
                      attrs: { id: "saved-shoppingcarts-link" }
                    },
                    [
                      _vm._v(
                        "\n                    Tallennetut korit »\n                "
                      )
                    ]
                  )
                ])
              : _vm._e()
          ])
        ]
      ),
      _vm._v(" "),
      _c("div", { staticClass: "row" }, [
        _c("div", { staticClass: "col-lg-6" }, [
          _c("div", { staticClass: "add-by-product-no" }, [
            _c("div", { staticClass: "add-product-container" }, [
              _c("div", { staticClass: "autocomplete-content w-100" }, [
                _c("div", { staticClass: "input-group" }, [
                  _c("input", {
                    directives: [
                      {
                        name: "model",
                        rawName: "v-model",
                        value: _vm.search,
                        expression: "search"
                      }
                    ],
                    staticClass: "autocomplete-text toolbarProp form-control",
                    class: { loading: _vm.isProductSearchLoading },
                    attrs: {
                      type: "text",
                      placeholder: "Etsi tuotenimellä tai -numerolla",
                      autocapitalize: "off",
                      autocorrect: "off",
                      autocomplete: "off"
                    },
                    domProps: { value: _vm.search },
                    on: {
                      input: [
                        function($event) {
                          if ($event.target.composing) {
                            return
                          }
                          _vm.search = $event.target.value;
                        },
                        _vm.searchProducts
                      ],
                      focus: _vm.searchProducts,
                      blur: function($event) {
                        $event.preventDefault();
                        return _vm.hideProductSearchResults($event)
                      },
                      keyup: [
                        function($event) {
                          if (
                            !$event.type.indexOf("key") &&
                            _vm._k($event.keyCode, "down", 40, $event.key, [
                              "Down",
                              "ArrowDown"
                            ])
                          ) {
                            return null
                          }
                          return _vm.onArrowDown($event)
                        },
                        function($event) {
                          if (
                            !$event.type.indexOf("key") &&
                            _vm._k($event.keyCode, "up", 38, $event.key, [
                              "Up",
                              "ArrowUp"
                            ])
                          ) {
                            return null
                          }
                          return _vm.onArrowUp($event)
                        },
                        function($event) {
                          if (
                            !$event.type.indexOf("key") &&
                            _vm._k(
                              $event.keyCode,
                              "enter",
                              13,
                              $event.key,
                              "Enter"
                            )
                          ) {
                            return null
                          }
                          return _vm.onEnter($event)
                        }
                      ]
                    }
                  }),
                  _vm._v(" "),
                  _c("div", { staticClass: "input-group-append" }, [
                    _vm.isProductSearchLoading
                      ? _c(
                          "div",
                          {
                            staticClass:
                              "input-group-text autocomplete-search-text"
                          },
                          [
                            _c("i", { staticClass: "fa fa-spinner rotate" }),
                            _vm._v(" Haetaan...")
                          ]
                        )
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.noSearchResults
                      ? _c(
                          "div",
                          {
                            staticClass:
                              "input-group-text autocomplete-search-text"
                          },
                          [
                            _c("i", { staticClass: "fa-light fa-telescope" }),
                            _vm._v(" Ei tuloksia...")
                          ]
                        )
                      : _vm._e()
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "input-group-append" }, [
                    _c(
                      "a",
                      {
                        staticClass: "btn btn-primary",
                        attrs: { href: "#" },
                        on: {
                          click: function($event) {
                            return _vm.quickProductAdd()
                          }
                        }
                      },
                      [_vm._v("Lisää koriin")]
                    )
                  ])
                ]),
                _vm._v(" "),
                _c(
                  "div",
                  {
                    directives: [
                      {
                        name: "show",
                        rawName: "v-show",
                        value: _vm.isProductSearchOpen,
                        expression: "isProductSearchOpen"
                      }
                    ],
                    staticClass: "autocomplete-dropdown"
                  },
                  [
                    _c(
                      "ul",
                      {
                        staticClass:
                          "autocomplete-list results list-unstyled mb-0"
                      },
                      _vm._l(_vm.productsSearchResults, function(result, i) {
                        return _c(
                          "li",
                          {
                            key: i,
                            staticClass: "autocomplete-row",
                            class: {
                              "autocomplete-highlight-row": i === _vm.currentIndex
                            },
                            on: {
                              click: function($event) {
                                return _vm.setProductSearchResult(result)
                              },
                              mouseenter: function($event) {
                                return _vm.hoverRowProductSearch(i)
                              },
                              mouseleave: function($event) {
                                return _vm.hoverOutProductSearch(i)
                              }
                            }
                          },
                          [
                            _c("span", {
                              staticClass: "autocomplete-title",
                              domProps: {
                                innerHTML: _vm._s(
                                  _vm.highlightProductSearchResult(
                                    result.label,
                                    _vm.search
                                  )
                                )
                              }
                            })
                          ]
                        )
                      }),
                      0
                    )
                  ]
                )
              ])
            ])
          ])
        ]),
        _vm._v(" "),
        _c("div", { staticClass: "col-lg-6" })
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "table-responsive" }, [
        _c(
          "table",
          {
            staticClass: "table table-striped offer-table products-table-classic"
          },
          [
            _vm._m(3),
            _vm._v(" "),
            _c(
              "tbody",
              _vm._l(_vm.shoppingCart.ItemModels, function(item, index) {
                return _c("tr", { key: item.ProductID }, [
                  _c(
                    "td",
                    {
                      staticClass: "align-middle text-muted",
                      attrs: { "data-label": "Tuotenumero" }
                    },
                    [
                      _vm._v(
                        "\n                        " +
                          _vm._s(
                            item.ConversionProductNumber || item.ProductNumber
                          ) +
                          "\n                        "
                      ),
                      item.ConversionProductNumber
                        ? _c("span", [
                            _vm._v(
                              "\n                            (" +
                                _vm._s(item.ProductNumber) +
                                ")\n                        "
                            )
                          ])
                        : _vm._e()
                    ]
                  ),
                  _vm._v(" "),
                  _c(
                    "td",
                    {
                      staticClass: "align-middle",
                      attrs: { "data-label": "Nimi" }
                    },
                    [
                      _vm._v(
                        "\n                        " +
                          _vm._s(item.ConversionName || item.Name) +
                          "\n                    "
                      )
                    ]
                  ),
                  _vm._v(" "),
                  _c(
                    "td",
                    {
                      staticClass: "align-middle",
                      attrs: { "data-label": "Yksikköhinta" }
                    },
                    [
                      _c("span", [
                        _vm._v(
                          "\n                            " +
                            _vm._s(
                              _vm._f("toCurrencyPrecise")(item.BaseQtyUnitPrice)
                            ) +
                            " / " +
                            _vm._s(item.BaseQtyUnit) +
                            "\n                        "
                        )
                      ])
                    ]
                  ),
                  _vm._v(" "),
                  _c(
                    "td",
                    {
                      staticClass: "align-middle",
                      attrs: { "data-label": "Myyntierän hinta" }
                    },
                    [
                      item.PricesFoundFromOffer
                        ? _c("div", [
                            _c("span", [
                              _vm._v(
                                "\n                                " +
                                  _vm._s(
                                    _vm._f("toCurrencyPrecise")(
                                      item.SalesQtyUnitNetPrice
                                    )
                                  ) +
                                  " / " +
                                  _vm._s(item.SelectedOfferSalesQtyUnit) +
                                  "\n                            "
                              )
                            ])
                          ])
                        : _vm._e(),
                      _vm._v(" "),
                      !item.PricesFoundFromOffer
                        ? _c("div", [
                            _c("span", [
                              _vm._v(
                                "\n                                " +
                                  _vm._s(
                                    _vm._f("toCurrencyPrecise")(
                                      item.SalesQtyUnitNetPrice
                                    )
                                  ) +
                                  " / " +
                                  _vm._s(item.SalesQtyUnit) +
                                  "\n                            "
                              )
                            ])
                          ])
                        : _vm._e()
                    ]
                  ),
                  _vm._v(" "),
                  _c(
                    "td",
                    {
                      staticClass: "add-to-cart-row align-middle",
                      attrs: { "data-label": "Määrä" }
                    },
                    [
                      _c(
                        "div",
                        {
                          staticClass: "form-inline add-to-cart-container",
                          class: { "item-invalid": item.ItemInvalid }
                        },
                        [
                          item.PricesFoundFromOffer
                            ? _c(
                                "div",
                                {
                                  staticClass: "input-group update-amount-offer"
                                },
                                [
                                  _c("input", {
                                    directives: [
                                      {
                                        name: "model",
                                        rawName: "v-model.number",
                                        value: item.SalesQtyUnitAmount,
                                        expression: "item.SalesQtyUnitAmount",
                                        modifiers: { number: true }
                                      }
                                    ],
                                    staticClass: "form-control input-amount",
                                    class: {
                                      "amount-invalid":
                                        item.SalesQtyUnitAmount < 1
                                    },
                                    staticStyle: { "min-width": "50px" },
                                    attrs: {
                                      type: "number",
                                      "data-product-id": item.ProductID
                                    },
                                    domProps: { value: item.SalesQtyUnitAmount },
                                    on: {
                                      change: function($event) {
                                        return _vm.updateAmountOffer(item, index)
                                      },
                                      input: function($event) {
                                        if ($event.target.composing) {
                                          return
                                        }
                                        _vm.$set(
                                          item,
                                          "SalesQtyUnitAmount",
                                          _vm._n($event.target.value)
                                        );
                                      },
                                      blur: function($event) {
                                        return _vm.$forceUpdate()
                                      }
                                    }
                                  }),
                                  _vm._v(" "),
                                  _c(
                                    "div",
                                    { staticClass: "input-group-append" },
                                    [
                                      _c(
                                        "select",
                                        {
                                          directives: [
                                            {
                                              name: "model",
                                              rawName: "v-model",
                                              value: item.OfferBaseQtyUnitAmount,
                                              expression:
                                                "item.OfferBaseQtyUnitAmount"
                                            }
                                          ],
                                          staticClass: "form-control",
                                          on: {
                                            change: [
                                              function($event) {
                                                var $$selectedVal = Array.prototype.filter
                                                  .call(
                                                    $event.target.options,
                                                    function(o) {
                                                      return o.selected
                                                    }
                                                  )
                                                  .map(function(o) {
                                                    var val =
                                                      "_value" in o
                                                        ? o._value
                                                        : o.value;
                                                    return val
                                                  });
                                                _vm.$set(
                                                  item,
                                                  "OfferBaseQtyUnitAmount",
                                                  $event.target.multiple
                                                    ? $$selectedVal
                                                    : $$selectedVal[0]
                                                );
                                              },
                                              function($event) {
                                                return _vm.selectOfferSalesQuantity(
                                                  item,
                                                  index
                                                )
                                              }
                                            ]
                                          }
                                        },
                                        _vm._l(
                                          item.OfferSalesQuantities,
                                          function(offerSalesQuantity, qtyIndex) {
                                            return _c(
                                              "option",
                                              {
                                                domProps: {
                                                  value:
                                                    offerSalesQuantity.Quantity
                                                }
                                              },
                                              [
                                                _vm._v(
                                                  _vm._s(
                                                    offerSalesQuantity.SalesQty
                                                  )
                                                )
                                              ]
                                            )
                                          }
                                        ),
                                        0
                                      )
                                    ]
                                  )
                                ]
                              )
                            : _vm._e(),
                          _vm._v(" "),
                          !item.PricesFoundFromOffer
                            ? _c(
                                "div",
                                { staticClass: "input-group update-amount" },
                                [
                                  _c("input", {
                                    directives: [
                                      {
                                        name: "model",
                                        rawName: "v-model.number",
                                        value: item.SalesQtyUnitAmount,
                                        expression: "item.SalesQtyUnitAmount",
                                        modifiers: { number: true }
                                      }
                                    ],
                                    staticClass:
                                      "form-control amount input-amount",
                                    class: {
                                      "amount-invalid":
                                        item.SalesQtyUnitAmount < 1
                                    },
                                    attrs: {
                                      type: "number",
                                      "data-product-id": item.ProductID
                                    },
                                    domProps: { value: item.SalesQtyUnitAmount },
                                    on: {
                                      change: function($event) {
                                        return _vm.updateAmount(item, index)
                                      },
                                      input: function($event) {
                                        if ($event.target.composing) {
                                          return
                                        }
                                        _vm.$set(
                                          item,
                                          "SalesQtyUnitAmount",
                                          _vm._n($event.target.value)
                                        );
                                      },
                                      blur: function($event) {
                                        return _vm.$forceUpdate()
                                      }
                                    }
                                  }),
                                  _vm._v(" "),
                                  _c(
                                    "div",
                                    { staticClass: "input-group-append" },
                                    [
                                      _c(
                                        "div",
                                        { staticClass: "input-group-text" },
                                        [
                                          _vm._v(
                                            "\n                                        " +
                                              _vm._s(item.SalesQtyUnit) +
                                              "\n                                        "
                                          ),
                                          item.Loading
                                            ? _c("i", {
                                                staticClass:
                                                  "fa fa-cog fa-spin loading-icon fa2x"
                                              })
                                            : _vm._e()
                                        ]
                                      )
                                    ]
                                  ),
                                  _vm._v(" "),
                                  item.SalesQtyUnitAmount <
                                  item.MinimumSalesQtyUnitAmount
                                    ? _c("div", { staticClass: "row" }, [
                                        _c(
                                          "span",
                                          {
                                            staticClass:
                                              "alert-warning alert ml-3 mt-1"
                                          },
                                          [
                                            _vm._v(
                                              "Minimi tilausmäärä: " +
                                                _vm._s(
                                                  item.MinimumSalesQtyUnitAmount
                                                ) +
                                                " " +
                                                _vm._s(item.SalesQtyUnit)
                                            )
                                          ]
                                        )
                                      ])
                                    : _vm._e()
                                ]
                              )
                            : _vm._e()
                        ]
                      )
                    ]
                  ),
                  _vm._v(" "),
                  _c(
                    "td",
                    {
                      staticClass: "align-middle",
                      attrs: { "data-label": "Yhteensä" }
                    },
                    [
                      _vm._v(
                        "\n                        " +
                          _vm._s(
                            _vm._f("toCurrencyPrecise")(
                              item.TotalSalesQtyUnitNetPrice
                            )
                          ) +
                          "\n                    "
                      )
                    ]
                  ),
                  _vm._v(" "),
                  _c("td", { staticClass: "align-middle" }, [
                    _c("input", {
                      directives: [
                        {
                          name: "model",
                          rawName: "v-model",
                          value: item.RowAdditionalInfo,
                          expression: "item.RowAdditionalInfo"
                        }
                      ],
                      staticClass: "form-control",
                      attrs: {
                        id: "product-notes",
                        placeholder: "max. 20 merkkiä",
                        maxlength: "20"
                      },
                      domProps: { value: item.RowAdditionalInfo },
                      on: {
                        blur: function($event) {
                          return _vm.saveAdditionalInfo(item)
                        },
                        input: function($event) {
                          if ($event.target.composing) {
                            return
                          }
                          _vm.$set(item, "RowAdditionalInfo", $event.target.value);
                        }
                      }
                    }),
                    _vm._v(" "),
                    _vm.additionalInfoError
                      ? _c(
                          "span",
                          { staticClass: "message-error alert alert-info" },
                          [_vm._v("Virhe")]
                        )
                      : _vm._e()
                  ]),
                  _vm._v(" "),
                  _c("td", { staticClass: "align-middle text-right" }, [
                    _c(
                      "a",
                      {
                        staticClass: "remove-item",
                        attrs: { href: "#", "data-product-id": item.ProductID },
                        on: {
                          click: function($event) {
                            return _vm.removeItemFromCart(item, $event)
                          }
                        }
                      },
                      [_c("i", { staticClass: "fal fa-trash-alt" })]
                    )
                  ])
                ])
              }),
              0
            ),
            _vm._v(" "),
            _vm.cartIsLoading ? _c("tbody", [_vm._m(4)]) : _vm._e()
          ]
        )
      ]),
      _vm._v(" "),
      _c("br"),
      _vm._v(" "),
      _c("div", { staticClass: "row" }, [
        _c("div", { staticClass: "col-sm-6" }),
        _vm._v(" "),
        _c("div", { staticClass: "col-sm-6" }, [
          _c("div", { staticClass: "row cart-totals" }, [
            _vm._m(5),
            _vm._v(" "),
            _c("div", { staticClass: "col-md-4 text-md-right" }, [
              _c("h4", { staticClass: "amount" }, [
                _vm._v(
                  "\n                        " +
                    _vm._s(
                      _vm._f("toCurrencyPrecise")(_vm.shoppingCart.TotalPrice)
                    ) +
                    "\n                    "
                )
              ])
            ])
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "row" }, [
            _vm._m(6),
            _vm._v(" "),
            _c("div", { staticClass: "col-md-4 text-md-right" }, [
              _c("h4", { staticClass: "amount" }, [
                _vm._v(
                  "\n                        " +
                    _vm._s(
                      _vm._f("toCurrencyPrecise")(
                        _vm.shoppingCart.TotalPriceVatAmount
                      )
                    ) +
                    "\n                    "
                )
              ])
            ])
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "row" }, [
            _vm._m(7),
            _vm._v(" "),
            _c("div", { staticClass: "col-md-4 text-md-right" }, [
              _c("h4", { staticClass: "amount text-danger font-weight-bold" }, [
                _vm._v(
                  "\n                        " +
                    _vm._s(
                      _vm._f("toCurrencyPrecise")(
                        _vm.shoppingCart.TotalPriceWithVat
                      )
                    ) +
                    "\n                    "
                )
              ])
            ])
          ])
        ])
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "customer-info add-margin-top" }, [
        _c("div", { staticClass: "row" }, [
          _c("div", { staticClass: "col-md-12 col-lg-6" }, [
            _c(
              "div",
              { staticClass: "card info-container shadow-sm vertical-rythm" },
              [
                _c("div", { staticClass: "card-body" }, [
                  _c("h4", { staticClass: "card-title" }, [
                    _vm._v("Laskutustiedot")
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "row" }, [
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Yritys")
                      ]),
                      _vm._v(" "),
                      _c("span", [_vm._v(_vm._s(_vm.shoppingCart.CompanyName))])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Asiakasnro.")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.CustomerNumber))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [_vm._v("Nimi")]),
                      _vm._v(" "),
                      _c("span", [_vm._v(_vm._s(_vm.shoppingCart.UserFullName))])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Sähköposti")
                      ]),
                      _vm._v(" "),
                      _c("span", [_vm._v(_vm._s(_vm.shoppingCart.UserEmail))])
                    ])
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "row" }, [
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Toimitustapa")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.CompanyDeliveryType))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Toimitusehto")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.CompanyTermOfDelivery))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Maksuehto")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.CompanyTermOfPayment))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" })
                  ])
                ])
              ]
            )
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "col-md-12 col-lg-6" }, [
            _c(
              "div",
              { staticClass: "card info-container shadow-sm vertical-rythm" },
              [
                _c("div", { staticClass: "card-body" }, [
                  _c("h4", { staticClass: "card-title" }, [
                    _vm._v("Toimitustiedot")
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "row vertical-rythm" }, [
                    _c("div", { staticClass: "col-sm-12" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Toimitusosoite")
                      ]),
                      _vm._v(" "),
                      _c(
                        "select",
                        {
                          directives: [
                            {
                              name: "model",
                              rawName: "v-model",
                              value: _vm.shoppingCart.DeliveryAddressExternalCode,
                              expression:
                                "shoppingCart.DeliveryAddressExternalCode"
                            }
                          ],
                          staticClass: "form-control",
                          attrs: { id: "delivery-addresses" },
                          on: {
                            change: [
                              function($event) {
                                var $$selectedVal = Array.prototype.filter
                                  .call($event.target.options, function(o) {
                                    return o.selected
                                  })
                                  .map(function(o) {
                                    var val = "_value" in o ? o._value : o.value;
                                    return val
                                  });
                                _vm.$set(
                                  _vm.shoppingCart,
                                  "DeliveryAddressExternalCode",
                                  $event.target.multiple
                                    ? $$selectedVal
                                    : $$selectedVal[0]
                                );
                              },
                              function($event) {
                                return _vm.changeDeliveryAddress()
                              }
                            ]
                          }
                        },
                        _vm._l(_vm.shoppingCart.DeliveryAddresses, function(
                          address,
                          index
                        ) {
                          return _c(
                            "option",
                            {
                              class: {
                                "text-bold":
                                  address.externalCode ==
                                  _vm.shoppingCart
                                    .UserDefaultDeliveryAddressExternalCode
                              },
                              domProps: { value: address.externalCode }
                            },
                            [_vm._v(_vm._s(address.AddressInfo))]
                          )
                        }),
                        0
                      )
                    ]),
                    _vm._v(" "),
                    _vm.shoppingCart.DeliveryAddressExternalCodeRequired
                      ? _c(
                          "span",
                          { staticClass: "message-error alert alert-warning" },
                          [_vm._v("Valitse toimitusosoite")]
                        )
                      : _vm._e()
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "row" }, [
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Yritys")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.DeliveryCompanyName))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Osoite")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(
                          _vm._s(_vm.shoppingCart.DeliveryStreetAddress1) +
                            " " +
                            _vm._s(_vm.shoppingCart.DeliveryStreetAddress2)
                        )
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Postinumero ja -toimipaikka")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.DeliveryDistrict))
                      ])
                    ])
                  ]),
                  _vm._v(" "),
                  !_vm.shoppingCart.UserIsDealer
                    ? _c("div", { staticClass: "row" }, [
                        _vm.shoppingCart.DefaultDeliveryAddressExternalCodeSet
                          ? _c("div", { staticClass: "col-sm-12" }, [
                              _c(
                                "a",
                                {
                                  staticClass: "btn-sm btn-block btn-danger btn",
                                  on: {
                                    click: function($event) {
                                      return _vm.resetDefaultDeliveryAddress(
                                        $event
                                      )
                                    }
                                  }
                                },
                                [_vm._v("Tyhjennä oletus toimitusosoitevalinta")]
                              )
                            ])
                          : _c("div", { staticClass: "col-sm-12" }, [
                              _c(
                                "a",
                                {
                                  staticClass: "btn-sm btn-block btn-success btn",
                                  on: {
                                    click: function($event) {
                                      return _vm.setDefaultDeliveryAddress($event)
                                    }
                                  }
                                },
                                [_vm._v("Aseta oletus toimitusosoitteeksi")]
                              )
                            ])
                      ])
                    : _vm._e()
                ])
              ]
            )
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "col-md-12" }, [
            _c(
              "div",
              { staticClass: "card info-container shadow-sm vertical-rythm" },
              [
                _c("div", { staticClass: "card-body" }, [
                  _c("h4", { staticClass: "card-title" }, [
                    _vm._v("Tilaustiedot")
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "row" }, [
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("div", { staticClass: "form-group" }, [
                        _c("strong", { staticClass: "d-block" }, [
                          _vm._v("Tilausnumero tai kustannuspaikka")
                        ]),
                        _vm._v(" "),
                        _c("div", { staticClass: "input-group vertical-rythm" }, [
                          _vm._m(8),
                          _vm._v(" "),
                          _c("input", {
                            directives: [
                              {
                                name: "model",
                                rawName: "v-model",
                                value: _vm.shoppingCart.CustomerOrderReference,
                                expression: "shoppingCart.CustomerOrderReference"
                              }
                            ],
                            staticClass: "form-control",
                            attrs: {
                              type: "text",
                              placeholder: "max. 15 merkkiä",
                              maxlength: "15"
                            },
                            domProps: {
                              value: _vm.shoppingCart.CustomerOrderReference
                            },
                            on: {
                              change: _vm.inputManualCustomerOrderReference,
                              input: function($event) {
                                if ($event.target.composing) {
                                  return
                                }
                                _vm.$set(
                                  _vm.shoppingCart,
                                  "CustomerOrderReference",
                                  $event.target.value
                                );
                              }
                            }
                          })
                        ]),
                        _vm._v(" "),
                        _c("div", { staticClass: "input-group" }, [
                          _vm._m(9),
                          _vm._v(" "),
                          _c(
                            "select",
                            {
                              directives: [
                                {
                                  name: "model",
                                  rawName: "v-model",
                                  value:
                                    _vm.shoppingCart
                                      .SelectedCostLocationCustomerOrderNumber,
                                  expression:
                                    "shoppingCart.SelectedCostLocationCustomerOrderNumber"
                                }
                              ],
                              staticClass: "form-control",
                              on: {
                                change: [
                                  function($event) {
                                    var $$selectedVal = Array.prototype.filter
                                      .call($event.target.options, function(o) {
                                        return o.selected
                                      })
                                      .map(function(o) {
                                        var val =
                                          "_value" in o ? o._value : o.value;
                                        return val
                                      });
                                    _vm.$set(
                                      _vm.shoppingCart,
                                      "SelectedCostLocationCustomerOrderNumber",
                                      $event.target.multiple
                                        ? $$selectedVal
                                        : $$selectedVal[0]
                                    );
                                  },
                                  function($event) {
                                    return _vm.selectCostLocationCustomerOrderNumber(
                                      $event
                                    )
                                  }
                                ]
                              }
                            },
                            _vm._l(
                              _vm.shoppingCart.CostLocationCustomerOrderNumbers,
                              function(number) {
                                return _c(
                                  "option",
                                  {
                                    key: number.Number,
                                    domProps: { value: number.Number }
                                  },
                                  [_vm._v(_vm._s(number.Name))]
                                )
                              }
                            ),
                            0
                          )
                        ]),
                        _vm._v(" "),
                        _c(
                          "a",
                          {
                            staticClass: "btn btn-link btn-sm",
                            attrs: {
                              href: "/asiakas/asetukset",
                              target: "_blank"
                            }
                          },
                          [_vm._v("Muokkaa listaa Kustannuspaikoista »")]
                        )
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c(
                        "div",
                        { staticClass: "form-group mb-0" },
                        [
                          _c(
                            "strong",
                            {
                              staticClass: "d-block",
                              attrs: { for: "desired-date" }
                            },
                            [_vm._v("Toivottu toimituspäivämäärä *")]
                          ),
                          _vm._v(" "),
                          _c("Vue2Datepicker", {
                            attrs: {
                              "input-attr": { id: "desired-date" },
                              type: "date",
                              valueType: "format",
                              format: "D.M.YYYY",
                              "title-format": "D.M.YYYY",
                              "disabled-date": _vm.dpDisabledDate,
                              lang: _vm.dpLang,
                              clearable: true,
                              editable: false,
                              "input-class": "form-control"
                            },
                            on: { change: _vm.dpChange },
                            model: {
                              value: _vm.shoppingCart.DesiredDeliveryDateModel,
                              callback: function($$v) {
                                _vm.$set(
                                  _vm.shoppingCart,
                                  "DesiredDeliveryDateModel",
                                  $$v
                                );
                              },
                              expression: "shoppingCart.DesiredDeliveryDateModel"
                            }
                          })
                        ],
                        1
                      ),
                      _vm._v(" "),
                      _c("span", { staticClass: "text-sm text-muted" }, [
                        _vm._v("Huomioi mahdolliset pyhäpäivät")
                      ]),
                      _c("br"),
                      _vm._v(" "),
                      _c("span", { staticClass: "text-sm text-muted" }, [
                        _vm._v(
                          "Mikäli tarvitset nopeamman toimituksen, ota yhteyttä myynnin yhteyshenkilöösi."
                        )
                      ]),
                      _vm._v(" "),
                      _vm.shoppingCart.DesiredDeliveryDateModelInvalid
                        ? _c("span", { staticClass: "bg-warning" }, [
                            _vm._v(
                              _vm._s(
                                _vm.translations
                                  .CustomerOrderDesiredDeliveryDateInvalid
                              )
                            )
                          ])
                        : _vm._e(),
                      _vm._v(" "),
                      _vm.shoppingCart.DesiredDeliveryDateModelInvalidTime
                        ? _c("span", { staticClass: "bg-warning" }, [
                            _vm._v(
                              _vm._s(
                                _vm.translations
                                  .CustomerOrderDesiredDeliveryDateInvalidTime
                              )
                            )
                          ])
                        : _vm._e(),
                      _vm._v(" "),
                      _vm.shoppingCart.DesiredDeliveryDateModelRequired
                        ? _c("span", { staticClass: "bg-warning" }, [
                            _vm._v(
                              _vm._s(
                                _vm.translations
                                  .CustomerOrderDesiredDeliveryDateRequired
                              )
                            )
                          ])
                        : _vm._e()
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("div", { staticClass: "form-group additional" }, [
                        _c("strong", { staticClass: "d-block" }, [
                          _vm._v("Lisätietoa tilauksen käsittelijälle")
                        ]),
                        _vm._v(" "),
                        _c("textarea", {
                          directives: [
                            {
                              name: "model",
                              rawName: "v-model",
                              value: _vm.shoppingCart.AdditionalInfo,
                              expression: "shoppingCart.AdditionalInfo"
                            }
                          ],
                          staticClass: "form-control",
                          attrs: { rows: "4", cols: "20" },
                          domProps: { value: _vm.shoppingCart.AdditionalInfo },
                          on: {
                            blur: function($event) {
                              return _vm.saveCartTextField($event)
                            },
                            input: function($event) {
                              if ($event.target.composing) {
                                return
                              }
                              _vm.$set(
                                _vm.shoppingCart,
                                "AdditionalInfo",
                                $event.target.value
                              );
                            }
                          }
                        })
                      ])
                    ])
                  ])
                ])
              ]
            )
          ])
        ]),
        _vm._v(" "),
        _c("div", [
          _c("div", { staticClass: "form-row" }, [
            _vm._m(10),
            _vm._v(" "),
            _c("div", { staticClass: "col-sm-4 submit-column" }, [
              _c(
                "div",
                { staticClass: "controls-row order-extra-recipient-box mb-3" },
                [
                  _c("label", [
                    _vm._v("Lähetä kopio tilauksesta muihin sähköposteihin:")
                  ]),
                  _vm._v(" "),
                  _c("p", [
                    _vm._v("Useat sähköpostiosoitteet tulee erottaa pilkulla.")
                  ]),
                  _vm._v(" "),
                  _c("ValidatingInput", {
                    attrs: {
                      shoppingCart: _vm.shoppingCart,
                      invalidPropName: "ExtraFormCCRecipientEmailsInvalid",
                      inputType: "text",
                      invalid: _vm.shoppingCart.ExtraFormCCRecipientEmailsInvalid,
                      invalidErrorMessage: "Tarkasta sähköpostiosoitteet"
                    },
                    model: {
                      value: _vm.shoppingCart.ExtraFormCCRecipientEmails,
                      callback: function($$v) {
                        _vm.$set(
                          _vm.shoppingCart,
                          "ExtraFormCCRecipientEmails",
                          $$v
                        );
                      },
                      expression: "shoppingCart.ExtraFormCCRecipientEmails"
                    }
                  })
                ],
                1
              ),
              _vm._v(" "),
              _c("div", { staticClass: "controls controls-row" }, [
                _c("input", {
                  staticStyle: { display: "none" },
                  attrs: {
                    id: "hb-feedback-field",
                    type: "text",
                    autocomplete: "off"
                  }
                }),
                _vm._v(" "),
                _c(
                  "a",
                  {
                    staticClass: "btn-lg btn-block btn-success btn send-btn",
                    class: { disabled: _vm.itemsValid },
                    on: {
                      click: function($event) {
                        return _vm.proceedToSummary($event)
                      }
                    }
                  },
                  [
                    _c("i", {
                      staticClass: "fal fa-paper-plane mr-1",
                      attrs: { "aria-hidden": "true" }
                    }),
                    _vm._v("Jatka yhteenvetoon "),
                    _c("i", { staticClass: "fa fa-angle-right" })
                  ]
                )
              ]),
              _vm._v(" "),
              _vm.shoppingCart.ItemsInvalid
                ? _c("div", { staticClass: "row" }, [
                    _c("span", { staticClass: "bg-warning ml-3 mt-2 " }, [
                      _vm._v(_vm._s(_vm.translations.CustomerOrderCheckProducts))
                    ])
                  ])
                : _vm._e()
            ])
          ])
        ])
      ])
    ])
  };
  var __vue_staticRenderFns__$b = [
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("h1", { staticClass: "flex-grow-0 mr-2" }, [
        _c("i", { staticClass: "fa-duotone fa-cart-shopping mr-2" }),
        _vm._v("Ostoskori")
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c(
        "div",
        { staticClass: "input-group-prepend d-none d-sm-inline" },
        [
          _c("div", { staticClass: "input-group-text" }, [
            _c("span", [_vm._v("Tallennettu nimellä:")])
          ])
        ]
      )
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c(
        "a",
        {
          staticClass: "btn btn-light border dropdown-toggle ml-2",
          attrs: {
            id: "CartFunctions",
            "data-toggle": "dropdown",
            "aria-haspopup": "true",
            "aria-expanded": "false"
          }
        },
        [_c("i", { staticClass: "fa-light fa-gear" })]
      )
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("thead", [
        _c("tr", [
          _c(
            "th",
            {
              staticClass: "product-number-row align-middle",
              attrs: { "data-priority": "1" }
            },
            [_vm._v("Tuotenro.")]
          ),
          _vm._v(" "),
          _c("th", { staticClass: "product-name-row align-middle" }, [
            _vm._v("Nimi")
          ]),
          _vm._v(" "),
          _c("th", { staticClass: "product-price-row align-middle" }, [
            _vm._v("Yksikön €")
          ]),
          _vm._v(" "),
          _c("th", { staticClass: "product-price-row align-middle" }, [
            _vm._v("Myyntierän €")
          ]),
          _vm._v(" "),
          _c(
            "th",
            {
              staticClass: "add-to-cart-row align-middle",
              staticStyle: { width: "250px" }
            },
            [_vm._v("Määrä")]
          ),
          _vm._v(" "),
          _c("th", { staticClass: "product-price-row align-middle" }, [
            _vm._v("Yhteensä €")
          ]),
          _vm._v(" "),
          _c("th", { staticClass: "product-additional-info-row align-middle" }, [
            _vm._v("Asiakkaan rivikohtainen viitetieto")
          ]),
          _vm._v(" "),
          _c("th", { staticClass: "remove-from-cart-row" })
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("tr", [
        _c("td", { attrs: { colspan: "8" } }, [_vm._v("Ladataan tuotteita...")])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8" }, [
        _c("h4", [_c("strong", [_vm._v("Yhteensä alv 0%")])])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8" }, [
        _c("h4", [_c("strong", [_vm._v("alv 24%")])])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8" }, [
        _c("h4", { staticClass: "text-danger font-weight-bold" }, [
          _vm._v("Yhteensä sis. alv 24%")
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "input-group-prepend" }, [
        _c("div", { staticClass: "input-group-text" }, [
          _c("div", { staticClass: "form-check pl-0" }, [
            _c("label", { staticClass: "form-check-label" }, [
              _vm._v(
                "\n                                                        Tilausnumero\n                                                    "
              )
            ])
          ])
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "input-group-prepend" }, [
        _c("div", { staticClass: "input-group-text" }, [
          _c("div", { staticClass: "form-check pl-0" }, [
            _c("label", { staticClass: "form-check-label" }, [
              _vm._v(
                "\n                                                        Kustannuspaikka\n                                                    "
              )
            ])
          ])
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8" }, [
        _c("span", [
          _c("span", [
            _vm._v(
              "Saat ilmoituksen Tilauksen vastaanotosta sähköpostiisi. Tutustuthan myös "
            ),
            _c("a", { attrs: { href: "/toimitusehdot", target: "_blank" } }, [
              _c("strong", [_vm._v("toimitusehtoihin.")])
            ])
          ])
        ])
      ])
    }
  ];
  __vue_render__$b._withStripped = true;

    /* style */
    const __vue_inject_styles__$b = undefined;
    /* scoped */
    const __vue_scope_id__$b = undefined;
    /* module identifier */
    const __vue_module_identifier__$b = undefined;
    /* functional template */
    const __vue_is_functional_template__$b = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$b = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$b, staticRenderFns: __vue_staticRenderFns__$b },
      __vue_inject_styles__$b,
      __vue_script__$9,
      __vue_scope_id__$b,
      __vue_is_functional_template__$b,
      __vue_module_identifier__$b,
      false,
      undefined,
      undefined,
      undefined
    );

  Vue.filter('toCurrencyPrecise', function (value) {
    if (typeof value !== "number") {
      return value;
    }

    var minFractionDigits = 2;

    if (Math.floor(value) !== value) {
      var valueFractionDigitsCount = value.toString().split(".")[1].length;
      if (valueFractionDigitsCount > 2) minFractionDigits = valueFractionDigitsCount;
    }

    var formatter = new Intl.NumberFormat('fi-FI', {
      style: 'currency',
      currency: 'EUR',
      minimumFractionDigits: minFractionDigits
    });
    return formatter.format(value);
  });
  var script$a = Vue.extend({
    name: "CustomerOrderSummary",
    data: function data() {
      return {
        cartIsLoading: false,
        translations: [],
        shoppingCart: {}
      };
    },
    created: function created() {
      var _this = this;

      this.cartIsLoading = true;
      this.translations = window['CustomerTranslations'];
      axios$1.get("/api/" + this.getPageID() + "/EditCustomerOrderForm").then(function (result) {
        _this.shoppingCart = result.data;
        _this.cartIsLoading = false;
      });
    },
    mounted: function mounted() {
      this.setInitialValues();
    },
    methods: {
      getPageID: function getPageID() {
        if (typeof window['E21PageData'] == "undefined") {
          return $("body > form").attr("data-pageid").toString();
        } else {
          return window['E21PageData'].PageID;
        }
      },
      setInitialValues: function setInitialValues() {
        var toFormPageLink = this.$refs.returnToFormLink;
        toFormPageLink.setAttribute("href", window["E21"].Mercamer.Redirect.UrlToFormView);
      },
      acceptOrder: function acceptOrder(event) {
        event.preventDefault;
        axios$1.post("/api/" + this.getPageID() + "/EditCustomerOrderForm/AcceptCart", this.shoppingCart).then(function (response) {
          var URLtoAcceptedPage = "";
          var UrlToFormView = "";

          var windowE21 = _.property('E21')(window);

          URLtoAcceptedPage = windowE21.Mercamer.Redirect.UrlToAcceptedView;
          UrlToFormView = windowE21.Mercamer.Redirect.UrlToFormView;

          if (response.data.CartIsValid) {
            window.location.href = URLtoAcceptedPage;
          } else {
            window.location.href = UrlToFormView;
          }
        }, function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("acceptOrder functions error: ");
          console.error("errorMessage: ", errorMessage);
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("acceptOrder: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      strValuesSame: function strValuesSame(value1, value2) {
        if (value1 && value2) {
          return value1.toString().toLowerCase() === value2.toString().toLowerCase();
        }

        return false;
      }
    },
    computed: {}
  });

  /* script */
  const __vue_script__$a = script$a;

  /* template */
  var __vue_render__$c = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "customer-order-cart-summary-view " }, [
      _vm._m(0),
      _vm._v(" "),
      _c("div", { staticClass: "row justify-content-center" }, [
        _c("div", { staticClass: "col-sm-12 col-md-12 col-lg-8" }, [
          _c("div", { staticClass: "table-responsive" }, [
            _c(
              "table",
              {
                staticClass:
                  "table table-striped table-bordered offer-table products-table-classic"
              },
              [
                _vm._m(1),
                _vm._v(" "),
                _c(
                  "tbody",
                  _vm._l(_vm.shoppingCart.ItemModels, function(item, index) {
                    return _c("tr", { key: item.ProductID }, [
                      _c(
                        "td",
                        {
                          staticClass: "align-middle text-muted",
                          attrs: { "data-label": "Tuotenumero" }
                        },
                        [
                          _vm._v(
                            "\n\t\t\t\t\t\t\t\t" +
                              _vm._s(
                                item.ConversionProductNumber || item.ProductNumber
                              ) +
                              "\n\t\t\t\t\t\t\t\t"
                          ),
                          item.ConversionProductNumber
                            ? _c("span", [
                                _vm._v(
                                  "\n\t\t\t\t\t\t\t\t\t(" +
                                    _vm._s(item.ProductNumber) +
                                    ")\n\t\t\t\t\t\t\t\t"
                                )
                              ])
                            : _vm._e()
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "td",
                        {
                          staticClass: "align-middle",
                          attrs: { "data-label": "Nimi" }
                        },
                        [
                          _vm._v(
                            "\n\t\t\t\t\t\t\t\t" +
                              _vm._s(item.ConversionName || item.Name) +
                              "\n\t\t\t\t\t\t\t"
                          )
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "td",
                        {
                          staticClass: "align-middle",
                          attrs: { "data-label": "Yksikköhinta" }
                        },
                        [
                          _vm._v(
                            "\n\t\t\t\t\t\t\t\t" +
                              _vm._s(
                                _vm._f("toCurrencyPrecise")(item.BaseQtyUnitPrice)
                              ) +
                              " / " +
                              _vm._s(item.BaseQtyUnit) +
                              "\n\t\t\t\t\t\t\t"
                          )
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "td",
                        {
                          staticClass: "align-middle",
                          attrs: { "data-label": "Myyntierän hinta" }
                        },
                        [
                          item.PricesFoundFromOffer
                            ? _c("div", [
                                _c("span", [
                                  _vm._v(
                                    "\n\t\t\t\t\t\t\t\t\t\t" +
                                      _vm._s(
                                        _vm._f("toCurrencyPrecise")(
                                          item.SalesQtyUnitNetPrice
                                        )
                                      ) +
                                      " / " +
                                      _vm._s(item.SelectedOfferSalesQtyUnit) +
                                      "\n\t\t\t\t\t\t\t\t\t"
                                  )
                                ])
                              ])
                            : _vm._e(),
                          _vm._v(" "),
                          !item.PricesFoundFromOffer
                            ? _c("div", [
                                _c("span", [
                                  _vm._v(
                                    "\n\t\t\t\t\t\t\t\t\t\t" +
                                      _vm._s(
                                        _vm._f("toCurrencyPrecise")(
                                          item.SalesQtyUnitNetPrice
                                        )
                                      ) +
                                      " / " +
                                      _vm._s(item.SalesQtyUnit) +
                                      "\n\t\t\t\t\t\t\t\t\t"
                                  )
                                ])
                              ])
                            : _vm._e()
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "td",
                        {
                          staticClass: "align-middle",
                          attrs: { "data-label": "Määrä" }
                        },
                        [
                          item.PricesFoundFromOffer
                            ? _c("div", [
                                _c("span", [
                                  _vm._v(
                                    "\n\t\t\t\t\t\t\t\t\t\t" +
                                      _vm._s(item.SalesQtyUnitAmount) +
                                      " x " +
                                      _vm._s(item.SelectedOfferSalesQtyUnit) +
                                      "\n\t\t\t\t\t\t\t\t\t"
                                  )
                                ])
                              ])
                            : _vm._e(),
                          _vm._v(" "),
                          !item.PricesFoundFromOffer
                            ? _c("div", [
                                _c("span", [
                                  _vm._v(
                                    "\n\t\t\t\t\t\t\t\t\t\t" +
                                      _vm._s(item.SalesQtyUnitAmount) +
                                      " " +
                                      _vm._s(item.SalesQtyUnit) +
                                      "\n\t\t\t\t\t\t\t\t\t"
                                  )
                                ])
                              ])
                            : _vm._e()
                        ]
                      ),
                      _vm._v(" "),
                      _c(
                        "td",
                        {
                          staticClass: "align-middle",
                          attrs: { "data-label": "Yhteensä" }
                        },
                        [
                          _vm._v(
                            "\n\t\t\t\t\t\t\t\t" +
                              _vm._s(
                                _vm._f("toCurrencyPrecise")(
                                  item.TotalSalesQtyUnitNetPrice
                                )
                              ) +
                              "\n\t\t\t\t\t\t\t"
                          )
                        ]
                      ),
                      _vm._v(" "),
                      _c("td", { staticClass: "align-middle" }, [
                        _vm._v(
                          "\n\t\t\t\t\t\t\t\t" +
                            _vm._s(item.RowAdditionalInfo) +
                            "\n\t\t\t\t\t\t\t"
                        )
                      ])
                    ])
                  }),
                  0
                ),
                _vm._v(" "),
                _vm.cartIsLoading ? _c("tbody", [_vm._m(2)]) : _vm._e()
              ]
            )
          ])
        ])
      ]),
      _vm._v(" "),
      _c("br"),
      _vm._v(" "),
      _c(
        "div",
        {
          staticClass: "row justify-content-sm-center justify-content-lg-agound"
        },
        [
          _c("div", { staticClass: "col-lg-4" }),
          _vm._v(" "),
          _c("div", { staticClass: "col-sm-10 col-lg-4" }, [
            _c("div", { staticClass: "row cart-totals" }, [
              _vm._m(3),
              _vm._v(" "),
              _c("div", { staticClass: "col-md-4 text-md-right" }, [
                _c("h4", { staticClass: "amount" }, [
                  _vm._v(
                    "\n\t\t\t\t\t\t" +
                      _vm._s(
                        _vm._f("toCurrencyPrecise")(_vm.shoppingCart.TotalPrice)
                      ) +
                      "\n\t\t\t\t\t"
                  )
                ])
              ])
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "row" }, [
              _vm._m(4),
              _vm._v(" "),
              _c("div", { staticClass: "col-md-4 text-md-right" }, [
                _c("h4", { staticClass: "amount" }, [
                  _vm._v(
                    "\n\t\t\t\t\t\t" +
                      _vm._s(
                        _vm._f("toCurrencyPrecise")(
                          _vm.shoppingCart.TotalPriceVatAmount
                        )
                      ) +
                      "\n\t\t\t\t\t"
                  )
                ])
              ])
            ]),
            _vm._v(" "),
            _c("div", { staticClass: "row" }, [
              _vm._m(5),
              _vm._v(" "),
              _c("div", { staticClass: "col-md-4 text-md-right" }, [
                _c("h4", { staticClass: "amount text-danger font-weight-bold" }, [
                  _vm._v(
                    "\n\t\t\t\t\t\t" +
                      _vm._s(
                        _vm._f("toCurrencyPrecise")(
                          _vm.shoppingCart.TotalPriceWithVat
                        )
                      ) +
                      "\n\t\t\t\t\t"
                  )
                ])
              ])
            ])
          ])
        ]
      ),
      _vm._v(" "),
      _c("div", { staticClass: "customer-info add-margin-top" }, [
        _c("div", { staticClass: "row justify-content-center" }, [
          _c("div", { staticClass: "col-sm-12 col-md-12 col-lg-8" }, [
            _c(
              "div",
              { staticClass: "card info-container shadow-sm vertical-rythm" },
              [
                _c("div", { staticClass: "card-body" }, [
                  _vm._m(6),
                  _vm._v(" "),
                  _c("div", { staticClass: "row" }, [
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Yritys")
                      ]),
                      _vm._v(" "),
                      _c("span", [_vm._v(_vm._s(_vm.shoppingCart.CompanyName))])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Asiakasnro.")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.CustomerNumber))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [_vm._v("Nimi")]),
                      _vm._v(" "),
                      _c("span", [_vm._v(_vm._s(_vm.shoppingCart.UserFullName))])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Sähköposti")
                      ]),
                      _vm._v(" "),
                      _c("span", [_vm._v(_vm._s(_vm.shoppingCart.UserEmail))])
                    ])
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "row" }, [
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Toimitustapa")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.CompanyDeliveryType))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Toimitusehto")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.CompanyTermOfDelivery))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Maksuehto")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.CompanyTermOfPayment))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-3 mb-2" })
                  ])
                ])
              ]
            )
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "col-sm-12 col-md-12 col-lg-8" }, [
            _c(
              "div",
              { staticClass: "card info-container shadow-sm vertical-rythm" },
              [
                _c("div", { staticClass: "card-body" }, [
                  _vm._m(7),
                  _vm._v(" "),
                  _c("div", { staticClass: "row" }, [
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Yritys")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.DeliveryCompanyName))
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Osoite")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(
                          _vm._s(_vm.shoppingCart.DeliveryStreetAddress1) +
                            " " +
                            _vm._s(_vm.shoppingCart.DeliveryStreetAddress2)
                        )
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("strong", { staticClass: "d-block" }, [
                        _vm._v("Postinumero ja -toimipaikka")
                      ]),
                      _vm._v(" "),
                      _c("span", [
                        _vm._v(_vm._s(_vm.shoppingCart.DeliveryDistrict))
                      ])
                    ])
                  ])
                ])
              ]
            )
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "col-sm-12 col-md-12 col-lg-8" }, [
            _c(
              "div",
              { staticClass: "card info-container shadow-sm vertical-rythm" },
              [
                _c("div", { staticClass: "card-body" }, [
                  _vm._m(8),
                  _vm._v(" "),
                  _c("div", { staticClass: "row" }, [
                    _vm.shoppingCart.CustomerOrderReferenceType ===
                    "ManualCustomerOrderReference"
                      ? _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                          _c("div", { staticClass: "form-group" }, [
                            _c("strong", { staticClass: "d-block" }, [
                              _vm._v("Asiakkaan tilausnumero / Kustannuspaikka:")
                            ]),
                            _vm._v(
                              "\n\t\t\t\t\t\t\t\t\t" +
                                _vm._s(_vm.shoppingCart.CustomerOrderReference) +
                                "\n\t\t\t\t\t\t\t\t"
                            )
                          ])
                        ])
                      : _vm._e(),
                    _vm._v(" "),
                    _vm.shoppingCart.CustomerOrderReferenceType ===
                    "CostLocationCustomerOrderReference"
                      ? _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                          _c("div", { staticClass: "form-group" }, [
                            _c("strong", { staticClass: "d-block" }, [
                              _vm._v("Asiakkaan tilausnumero / Kustannuspaikka:")
                            ]),
                            _vm._v(
                              "\n\t\t\t\t\t\t\t\t\t" +
                                _vm._s(
                                  _vm.shoppingCart
                                    .SelectedCostLocationCustomerOrderNumber
                                ) +
                                "\n\t\t\t\t\t\t\t\t"
                            )
                          ])
                        ])
                      : _vm._e(),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("div", { staticClass: "form-group mb-0" }, [
                        _c("strong", { staticClass: "d-block" }, [
                          _vm._v("Toivottu toimituspäivämäärä:")
                        ]),
                        _vm._v(
                          "\n\t\t\t\t\t\t\t\t\t" +
                            _vm._s(_vm.shoppingCart.DesiredDeliveryDateModel) +
                            "\n\t\t\t\t\t\t\t\t"
                        )
                      ])
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "col-md-6 col-lg-4 mb-2" }, [
                      _c("div", { staticClass: "form-group additional" }, [
                        _c("strong", { staticClass: "d-block" }, [
                          _vm._v("Lisätietoa tilauksen käsittelijälle:")
                        ]),
                        _vm._v(" "),
                        _c("span", {
                          staticStyle: { "white-space": "pre-line" },
                          domProps: {
                            innerHTML: _vm._s(_vm.shoppingCart.AdditionalInfo)
                          }
                        })
                      ])
                    ])
                  ])
                ])
              ]
            )
          ])
        ]),
        _vm._v(" "),
        _c("div", [
          _c(
            "div",
            {
              staticClass:
                "form-row justify-content-center align-items-center mb-3"
            },
            [
              _c("div", { staticClass: "col-sm-12 col-md-12 col-lg-8" }, [
                _vm.shoppingCart.ExtraFormCCRecipientEmail &&
                _vm.shoppingCart.ExtraFormCCRecipientEmail !== ""
                  ? _c(
                      "div",
                      { staticClass: "controls-row order-extra-recipient-box" },
                      [
                        _c("span", [
                          _c("strong", [
                            _vm._v(
                              "Kopio tilauksen kuitista lähetetään sähköpostiin: "
                            )
                          ]),
                          _vm._v(
                            _vm._s(_vm.shoppingCart.ExtraFormCCRecipientEmail)
                          )
                        ])
                      ]
                    )
                  : _vm._e()
              ])
            ]
          ),
          _vm._v(" "),
          _c(
            "div",
            { staticClass: "form-row justify-content-center align-items-center" },
            [
              _c("div", { staticClass: "col-sm-6 col-md-6 col-lg-4" }, [
                _vm._m(9),
                _vm._v(" "),
                _c("div", { staticClass: "controls controls-row" }, [
                  _c(
                    "a",
                    {
                      ref: "returnToFormLink",
                      staticClass: "btn btn-primary shop mt-2 mb-2",
                      attrs: { id: "return-to-form-link" }
                    },
                    [
                      _c("i", { staticClass: "fa fa-reply" }),
                      _vm._v(" Palaa\n\t\t\t\t\t\t")
                    ]
                  )
                ])
              ]),
              _vm._v(" "),
              _c(
                "div",
                { staticClass: "col-sm-6 col-md-6 col-lg-4 submit-column" },
                [
                  _c("div", { staticClass: "controls controls-row" }, [
                    _c("input", {
                      staticStyle: { display: "none" },
                      attrs: {
                        id: "hb-feedback-field",
                        type: "text",
                        autocomplete: "off"
                      }
                    }),
                    _vm._v(" "),
                    _c(
                      "a",
                      {
                        staticClass: "btn-lg btn-block btn-success btn send-btn",
                        class: { disabled: _vm.itemsValid },
                        on: {
                          click: function($event) {
                            return _vm.acceptOrder($event)
                          }
                        }
                      },
                      [
                        _c("i", {
                          staticClass: "fal fa-paper-plane mr-1",
                          attrs: { "aria-hidden": "true" }
                        }),
                        _vm._v("Lähetä tilaus")
                      ]
                    )
                  ])
                ]
              )
            ]
          )
        ])
      ])
    ])
  };
  var __vue_staticRenderFns__$c = [
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c(
        "div",
        {
          staticClass:
            "shopping-cart-heading d-flex align-items-center justify-content-center mb-3"
        },
        [_c("h1", [_vm._v("Ostoskorin yhteenveto")])]
      )
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("thead", [
        _c("tr", [
          _c(
            "th",
            {
              staticClass: "product-number-row align-middle",
              attrs: { "data-priority": "1" }
            },
            [_vm._v("Tuotenro.")]
          ),
          _vm._v(" "),
          _c("th", { staticClass: "product-name-row align-middle" }, [
            _vm._v("Nimi")
          ]),
          _vm._v(" "),
          _c("th", { staticClass: "product-price-row align-middle" }, [
            _vm._v("Yksikön €")
          ]),
          _vm._v(" "),
          _c("th", { staticClass: "product-price-row align-middle" }, [
            _vm._v("Myyntierän €")
          ]),
          _vm._v(" "),
          _c(
            "th",
            {
              staticClass: "add-to-cart-row align-middle",
              staticStyle: { width: "250px" }
            },
            [_vm._v("Määrä")]
          ),
          _vm._v(" "),
          _c("th", { staticClass: "product-price-row align-middle" }, [
            _vm._v("Yhteensä €")
          ]),
          _vm._v(" "),
          _c("th", { staticClass: "product-additional-info-row align-middle" }, [
            _vm._v("Asiakkaan rivikohtainen viitetieto")
          ])
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("tr", [
        _c("td", { attrs: { colspan: "8" } }, [_vm._v("Ladataan tuotteita...")])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8" }, [
        _c("h4", [_c("strong", [_vm._v("Yhteensä alv 0%")])])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8" }, [
        _c("h4", [_c("strong", [_vm._v("alv 24%")])])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8" }, [
        _c("h4", { staticClass: "text-danger font-weight-bold" }, [
          _vm._v("Yhteensä sis. alv 24%")
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("h4", { staticClass: "card-title" }, [
        _c("strong", [_vm._v("Laskutustiedot")])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("h4", { staticClass: "card-title" }, [
        _c("strong", [_vm._v("Toimitustiedot")])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("h4", { staticClass: "card-title" }, [
        _c("strong", [_vm._v("Tilaustiedot")])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("span", [
        _c("span", [
          _vm._v(
            "Saat ilmoituksen Tilauksen vastaanotosta sähköpostiisi. Tutustuthan myös "
          ),
          _c("a", { attrs: { href: "/toimitusehdot", target: "_blank" } }, [
            _c("strong", [_vm._v("toimitusehtoihin.")])
          ])
        ])
      ])
    }
  ];
  __vue_render__$c._withStripped = true;

    /* style */
    const __vue_inject_styles__$c = undefined;
    /* scoped */
    const __vue_scope_id__$c = undefined;
    /* module identifier */
    const __vue_module_identifier__$c = undefined;
    /* functional template */
    const __vue_is_functional_template__$c = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$c = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$c, staticRenderFns: __vue_staticRenderFns__$c },
      __vue_inject_styles__$c,
      __vue_script__$a,
      __vue_scope_id__$c,
      __vue_is_functional_template__$c,
      __vue_module_identifier__$c,
      false,
      undefined,
      undefined,
      undefined
    );

  var script$b = Vue.extend({
    name: "OwnProductsSettings",
    data: function data() {
      return {
        loadingData: false,
        dataLoaded: false,
        products: [],
        savingShowHideAll: false
      };
    },
    created: function created() {
      this.loadData();
    },
    methods: {
      loadData: function loadData() {
        var _this = this;

        this.loadingData = true;
        axios$1.get("/api/OwnProductsSettings/GetCustomerOwnProducts").then(function (result) {
          _this.products = result.data;
        })["catch"](function (error) {
          console.log("loadData error", error);
        })["finally"](function () {
          _this.loadingData = false;
          _this.dataLoaded = true;
        });
      },
      toggleVisibility: function toggleVisibility(product, index) {
        if (product.IsHidden) {
          product.IsHidden = false;
        } else {
          product.IsHidden = true;
        }

        axios$1.post("/api/OwnProductsSettings/ToggleOwnProductVisibility?productNumber=" + product.OriginalProductNumber).then(function (response) {})["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("toggleVisibility functions error:");
          console.error("errorMessage: ", errorMessage);
        })["finally"](function () {});
      },
      showAll: function showAll() {
        var _this2 = this;

        this.savingShowHideAll = true;
        axios$1.post("/api/OwnProductsSettings/ShowAll").then(function (response) {
          _this2.products.forEach(function (el) {
            el.IsHidden = false;
          });
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("showAll functions error:");
          console.error("errorMessage: ", errorMessage);
        })["finally"](function () {
          _this2.savingShowHideAll = false;
        });
      },
      hideAll: function hideAll() {
        var _this3 = this;

        this.savingShowHideAll = true;
        var hideProducts = this.products.filter(function (x) {
          return !x.IsHidden;
        }).map(function (y) {
          return y.OriginalProductNumber;
        }); //console.log("hide products: ", hideProducts);

        axios$1.post("/api/OwnProductsSettings/HideAll", hideProducts).then(function (response) {
          _this3.products.forEach(function (el) {
            el.IsHidden = true;
          });
        })["catch"](function (error) {
          var errorMessage = error.data.Message || error.statusText;
          console.error("hideAll functions error:");
          console.error("errorMessage: ", errorMessage);
        })["finally"](function () {
          _this3.savingShowHideAll = false;
        });
      }
    }
  });

  /* script */
  const __vue_script__$b = script$b;

  /* template */
  var __vue_render__$d = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "own-products-view" }, [
      _vm.products && _vm.products.length > 1
        ? _c("div", { staticClass: "row vertical-rythm" }, [
            _c("div", { staticClass: "col-md-6" }),
            _vm._v(" "),
            _c(
              "div",
              {
                staticClass:
                  "col-md-6 d-flex justify-content-end align-items-center"
              },
              [
                _vm.savingShowHideAll
                  ? _c("span", { staticClass: "mr-2" }, [
                      _c("i", { staticClass: "fa-light fa-loader rotate" }),
                      _vm._v("Hetkinen...")
                    ])
                  : _vm._e(),
                _vm._v(" "),
                _c(
                  "a",
                  {
                    staticClass: "btn btn-primary m-1",
                    attrs: { href: "#" },
                    on: {
                      click: function($event) {
                        $event.preventDefault();
                        return _vm.showAll($event)
                      }
                    }
                  },
                  [
                    _c("i", { staticClass: "fa-regular fa-eye" }),
                    _vm._v(" kaikki")
                  ]
                ),
                _vm._v(" "),
                _c(
                  "a",
                  {
                    staticClass: "btn btn-secondary m-1",
                    attrs: { href: "#" },
                    on: {
                      click: function($event) {
                        $event.preventDefault();
                        return _vm.hideAll($event)
                      }
                    }
                  },
                  [
                    _c("i", { staticClass: "fa-regular fa-eye-slash" }),
                    _vm._v(" kaikki")
                  ]
                )
              ]
            )
          ])
        : _vm._e(),
      _vm._v(" "),
      _c("div", { staticClass: "table-responsive" }, [
        _c(
          "table",
          {
            staticClass:
              "table table-striped offer-table products-table-classic table-hover"
          },
          [
            _vm._m(0),
            _vm._v(" "),
            _c(
              "tbody",
              _vm._l(_vm.products, function(product, index) {
                return _c(
                  "tr",
                  {
                    directives: [
                      {
                        name: "key",
                        rawName: "v-key",
                        value: product.OriginalProductNumber,
                        expression: "product.OriginalProductNumber"
                      }
                    ],
                    class: { "is-hidden": product.IsHidden }
                  },
                  [
                    _c("td", { staticClass: "align-middle" }, [
                      _c(
                        "a",
                        {
                          staticClass: "btn btn-primary btn-block",
                          class: { "btn-secondary": product.IsHidden },
                          attrs: { href: "#" },
                          on: {
                            click: function($event) {
                              $event.preventDefault();
                              return _vm.toggleVisibility(product, index)
                            }
                          }
                        },
                        [
                          product.IsHidden
                            ? _c("i", { staticClass: "fa-regular fa-eye-slash" })
                            : _c("i", { staticClass: "fa-regular fa-eye" })
                        ]
                      )
                    ]),
                    _vm._v(" "),
                    _c("td", { staticClass: "align-middle product-no" }, [
                      _c("small", { staticClass: "text-muted" }, [
                        _vm._v(
                          _vm._s(
                            product.ConversionProductNumber &&
                              product.ConversionProductNumber.length > 0
                              ? product.ConversionProductNumber
                              : product.OriginalProductNumber
                          )
                        )
                      ]),
                      _vm._v(" "),
                      product.ConversionProductNumber &&
                      product.ConversionProductNumber.length > 0
                        ? _c("small", { staticClass: "text-muted" }, [
                            _vm._v(
                              "(" + _vm._s(product.OriginalProductNumber) + ")"
                            )
                          ])
                        : _vm._e()
                    ]),
                    _vm._v(" "),
                    _c("td", { staticClass: "align-middle" }, [
                      _vm._v(
                        "\n                        " +
                          _vm._s(
                            product.ConversionProductName &&
                              product.ConversionProductName.length > 0
                              ? product.ConversionProductName
                              : product.OriginalProductName
                          ) +
                          "\n                    "
                      )
                    ])
                  ]
                )
              }),
              0
            ),
            _vm._v(" "),
            _vm.loadingData ? _c("tbody", [_vm._m(1)]) : _vm._e(),
            _vm._v(" "),
            _vm.dataLoaded && !_vm.loadingData && _vm.products.length < 1
              ? _c("tbody", [_vm._m(2)])
              : _vm._e()
          ]
        )
      ])
    ])
  };
  var __vue_staticRenderFns__$d = [
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("thead", [
        _c("tr", [
          _c("th", { staticClass: "align-middle all" }, [
            _vm._v("Näytä/Piilota")
          ]),
          _vm._v(" "),
          _c(
            "th",
            {
              staticClass: "product-number-row product-no all",
              attrs: { "data-priority": "1" }
            },
            [_vm._v("Tuotenro.")]
          ),
          _vm._v(" "),
          _c("th", { staticClass: "product-name-row all w-100" }, [
            _vm._v("Nimi")
          ])
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("tr", [
        _c("td", { attrs: { colspan: "3" } }, [
          _c("span", { staticClass: "mr-2" }, [
            _c("i", { staticClass: "fa-light fa-loader rotate" })
          ]),
          _vm._v("Hetkinen, ladataan tuotteita...")
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("tr", [
        _c("td", { attrs: { colspan: "3" } }, [
          _vm._v("Ei löytynyt yhtään tuotetta")
        ])
      ])
    }
  ];
  __vue_render__$d._withStripped = true;

    /* style */
    const __vue_inject_styles__$d = undefined;
    /* scoped */
    const __vue_scope_id__$d = undefined;
    /* module identifier */
    const __vue_module_identifier__$d = undefined;
    /* functional template */
    const __vue_is_functional_template__$d = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$d = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$d, staticRenderFns: __vue_staticRenderFns__$d },
      __vue_inject_styles__$d,
      __vue_script__$b,
      __vue_scope_id__$d,
      __vue_is_functional_template__$d,
      __vue_module_identifier__$d,
      false,
      undefined,
      undefined,
      undefined
    );

  var e = function () {
    return (e = Object.assign || function (e) {
      for (var t, r = 1, s = arguments.length; r < s; r++) for (var a in t = arguments[r]) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);

      return e;
    }).apply(this, arguments);
  },
      t = {
    kebab: /-(\w)/g,
    styleProp: /:(.*)/,
    styleList: /;(?![^(]*\))/g
  };

  function r(e, t) {
    return t ? t.toUpperCase() : "";
  }

  function s(e) {
    for (var s, a = {}, c = 0, o = e.split(t.styleList); c < o.length; c++) {
      var n = o[c].split(t.styleProp),
          i = n[0],
          l = n[1];
      (i = i.trim()) && ("string" == typeof l && (l = l.trim()), a[(s = i, s.replace(t.kebab, r))] = l);
    }

    return a;
  }

  function a() {
    for (var t, r, a = {}, c = arguments.length; c--;) for (var o = 0, n = Object.keys(arguments[c]); o < n.length; o++) switch (t = n[o]) {
      case "class":
      case "style":
      case "directives":
        if (Array.isArray(a[t]) || (a[t] = []), "style" === t) {
          var i = void 0;
          i = Array.isArray(arguments[c].style) ? arguments[c].style : [arguments[c].style];

          for (var l = 0; l < i.length; l++) {
            var y = i[l];
            "string" == typeof y && (i[l] = s(y));
          }

          arguments[c].style = i;
        }

        a[t] = a[t].concat(arguments[c][t]);
        break;

      case "staticClass":
        if (!arguments[c][t]) break;
        void 0 === a[t] && (a[t] = ""), a[t] && (a[t] += " "), a[t] += arguments[c][t].trim();
        break;

      case "on":
      case "nativeOn":
        a[t] || (a[t] = {});

        for (var p = 0, f = Object.keys(arguments[c][t] || {}); p < f.length; p++) r = f[p], a[t][r] ? a[t][r] = [].concat(a[t][r], arguments[c][t][r]) : a[t][r] = arguments[c][t][r];

        break;

      case "attrs":
      case "props":
      case "domProps":
      case "scopedSlots":
      case "staticStyle":
      case "hook":
      case "transition":
        a[t] || (a[t] = {}), a[t] = e({}, arguments[c][t], a[t]);
        break;

      case "slot":
      case "key":
      case "ref":
      case "tag":
      case "show":
      case "keepAlive":
      default:
        a[t] || (a[t] = arguments[c][t]);
    }

    return a;
  }

  function ownKeys$3(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$1(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
        _defineProperty$3(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$3(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  function _objectWithoutProperties$1(source, excluded) {
    if (source == null) return {};

    var target = _objectWithoutPropertiesLoose$1(source, excluded);

    var key, i;

    if (Object.getOwnPropertySymbols) {
      var sourceSymbolKeys = Object.getOwnPropertySymbols(source);

      for (i = 0; i < sourceSymbolKeys.length; i++) {
        key = sourceSymbolKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
        target[key] = source[key];
      }
    }

    return target;
  }

  function _objectWithoutPropertiesLoose$1(source, excluded) {
    if (source == null) return {};
    var target = {};
    var sourceKeys = Object.keys(source);
    var key, i;

    for (i = 0; i < sourceKeys.length; i++) {
      key = sourceKeys[i];
      if (excluded.indexOf(key) >= 0) continue;
      target[key] = source[key];
    }

    return target;
  }

  function _typeof$1(obj) {
    "@babel/helpers - typeof";

    return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
      return typeof obj;
    } : function (obj) {
      return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    }, _typeof$1(obj);
  }

  var COMPONENT_UID_KEY = '_uid';
  var isVue3 = Vue.version.startsWith('3');
  var ALLOWED_FIELDS_IN_DATA = ['class', 'staticClass', 'style', 'attrs', 'props', 'domProps', 'on', 'nativeOn', 'directives', 'scopedSlots', 'slot', 'key', 'ref', 'refInFor'];
  var extend$2 = Vue.extend.bind(Vue);

  if (isVue3) {
    var originalExtend = Vue.extend;
    var KNOWN_COMPONENTS = ['router-link', 'transition', 'transition-group'];
    var originalVModelDynamicCreated = Vue.vModelDynamic.created;
    var originalVModelDynamicBeforeUpdate = Vue.vModelDynamic.beforeUpdate; // See https://github.com/vuejs/vue-next/pull/4121 for details

    Vue.vModelDynamic.created = function (el, binding, vnode) {
      originalVModelDynamicCreated.call(this, el, binding, vnode);

      if (!el._assign) {
        el._assign = function () {};
      }
    };

    Vue.vModelDynamic.beforeUpdate = function (el, binding, vnode) {
      originalVModelDynamicBeforeUpdate.call(this, el, binding, vnode);

      if (!el._assign) {
        el._assign = function () {};
      }
    };

    extend$2 = function patchedBootstrapVueExtend(definition) {
      if (_typeof$1(definition) === 'object' && definition.render && !definition.__alreadyPatched) {
        var originalRender = definition.render;
        definition.__alreadyPatched = true;

        definition.render = function (h) {
          var patchedH = function patchedH(tag, dataObjOrChildren, rawSlots) {
            var slots = rawSlots === undefined ? [] : [Array.isArray(rawSlots) ? rawSlots.filter(Boolean) : rawSlots];
            var isTag = typeof tag === 'string' && !KNOWN_COMPONENTS.includes(tag);
            var isSecondArgumentDataObject = dataObjOrChildren && _typeof$1(dataObjOrChildren) === 'object' && !Array.isArray(dataObjOrChildren);

            if (!isSecondArgumentDataObject) {
              return h.apply(void 0, [tag, dataObjOrChildren].concat(slots));
            }

            var attrs = dataObjOrChildren.attrs,
                props = dataObjOrChildren.props,
                restData = _objectWithoutProperties$1(dataObjOrChildren, ["attrs", "props"]);

            var normalizedData = _objectSpread$1(_objectSpread$1({}, restData), {}, {
              attrs: attrs,
              props: isTag ? {} : props
            });

            if (tag === 'router-link' && !normalizedData.slots && !normalizedData.scopedSlots) {
              // terrible workaround to fix router-link rendering with compat vue-router
              normalizedData.scopedSlots = {
                $hasNormal: function $hasNormal() {}
              };
            }

            return h.apply(void 0, [tag, normalizedData].concat(slots));
          };

          if (definition.functional) {
            var _ctx$children, _ctx$children$default;

            var ctx = arguments[1];

            var patchedCtx = _objectSpread$1({}, ctx);

            patchedCtx.data = {
              attrs: _objectSpread$1({}, ctx.data.attrs || {}),
              props: _objectSpread$1({}, ctx.data.props || {})
            };
            Object.keys(ctx.data || {}).forEach(function (key) {
              if (ALLOWED_FIELDS_IN_DATA.includes(key)) {
                patchedCtx.data[key] = ctx.data[key];
              } else if (key in ctx.props) {
                patchedCtx.data.props[key] = ctx.data[key];
              } else if (!key.startsWith('on')) {
                patchedCtx.data.attrs[key] = ctx.data[key];
              }
            });
            var IGNORED_CHILDREN_KEYS = ['_ctx'];
            var children = ((_ctx$children = ctx.children) === null || _ctx$children === void 0 ? void 0 : (_ctx$children$default = _ctx$children.default) === null || _ctx$children$default === void 0 ? void 0 : _ctx$children$default.call(_ctx$children)) || ctx.children;

            if (children && Object.keys(patchedCtx.children).filter(function (k) {
              return !IGNORED_CHILDREN_KEYS.includes(k);
            }).length === 0) {
              delete patchedCtx.children;
            } else {
              patchedCtx.children = children;
            }

            patchedCtx.data.on = ctx.listeners;
            return originalRender.call(this, patchedH, patchedCtx);
          }

          return originalRender.call(this, patchedH);
        };
      }

      return originalExtend.call(this, definition);
    }.bind(Vue);
  }

  var HAS_WINDOW_SUPPORT = typeof window !== 'undefined';
  var HAS_DOCUMENT_SUPPORT = typeof document !== 'undefined';
  var HAS_NAVIGATOR_SUPPORT = typeof navigator !== 'undefined';
  var IS_BROWSER = HAS_WINDOW_SUPPORT && HAS_DOCUMENT_SUPPORT && HAS_NAVIGATOR_SUPPORT;
  var WINDOW = HAS_WINDOW_SUPPORT ? window : {};
  var DOCUMENT = HAS_DOCUMENT_SUPPORT ? document : {};
  var NAVIGATOR = HAS_NAVIGATOR_SUPPORT ? navigator : {};
  var USER_AGENT = (NAVIGATOR.userAgent || '').toLowerCase();
  var IS_JSDOM = USER_AGENT.indexOf('jsdom') > 0;
  var IS_IE = /msie|trident/.test(USER_AGENT); // Determine if the browser supports the option passive for events

  var HAS_PASSIVE_EVENT_SUPPORT = function () {
    var passiveEventSupported = false;

    if (IS_BROWSER) {
      try {
        var options = {
          // This function will be called when the browser
          // attempts to access the passive property
          get passive() {
            /* istanbul ignore next: will never be called in JSDOM */
            passiveEventSupported = true;
          }

        };
        WINDOW.addEventListener('test', options, options);
        WINDOW.removeEventListener('test', options, options);
      } catch (_unused) {
        /* istanbul ignore next: will never be called in JSDOM */
        passiveEventSupported = false;
      }
    }

    return passiveEventSupported;
  }();
  /* istanbul ignore next: JSDOM only checks for 'IntersectionObserver' */

  var HAS_INTERACTION_OBSERVER_SUPPORT = IS_BROWSER && 'IntersectionObserver' in WINDOW && 'IntersectionObserverEntry' in WINDOW && // Edge 15 and UC Browser lack support for `isIntersecting`
  // but we an use `intersectionRatio > 0` instead
  // 'isIntersecting' in window.IntersectionObserverEntry.prototype &&
  'intersectionRatio' in WINDOW.IntersectionObserverEntry.prototype;

  var PROP_NAME = '$bvConfig';

  // --- General ---
  var RX_BV_PREFIX = /^(BV?)/;
  var RX_HYPHENATE = /\B([A-Z])/g;

  function _typeof$2(obj) {
    "@babel/helpers - typeof";

    return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
      return typeof obj;
    } : function (obj) {
      return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    }, _typeof$2(obj);
  }

  function _classCallCheck(instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  }

  function _inherits(subClass, superClass) {
    if (typeof superClass !== "function" && superClass !== null) {
      throw new TypeError("Super expression must either be null or a function");
    }

    Object.defineProperty(subClass, "prototype", {
      value: Object.create(superClass && superClass.prototype, {
        constructor: {
          value: subClass,
          writable: true,
          configurable: true
        }
      }),
      writable: false
    });
    if (superClass) _setPrototypeOf(subClass, superClass);
  }

  function _createSuper(Derived) {
    var hasNativeReflectConstruct = _isNativeReflectConstruct();

    return function _createSuperInternal() {
      var Super = _getPrototypeOf(Derived),
          result;

      if (hasNativeReflectConstruct) {
        var NewTarget = _getPrototypeOf(this).constructor;

        result = Reflect.construct(Super, arguments, NewTarget);
      } else {
        result = Super.apply(this, arguments);
      }

      return _possibleConstructorReturn(this, result);
    };
  }

  function _possibleConstructorReturn(self, call) {
    if (call && (_typeof$2(call) === "object" || typeof call === "function")) {
      return call;
    } else if (call !== void 0) {
      throw new TypeError("Derived constructors may only return object or undefined");
    }

    return _assertThisInitialized(self);
  }

  function _assertThisInitialized(self) {
    if (self === void 0) {
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    }

    return self;
  }

  function _wrapNativeSuper(Class) {
    var _cache = typeof Map === "function" ? new Map() : undefined;

    _wrapNativeSuper = function _wrapNativeSuper(Class) {
      if (Class === null || !_isNativeFunction(Class)) return Class;

      if (typeof Class !== "function") {
        throw new TypeError("Super expression must either be null or a function");
      }

      if (typeof _cache !== "undefined") {
        if (_cache.has(Class)) return _cache.get(Class);

        _cache.set(Class, Wrapper);
      }

      function Wrapper() {
        return _construct(Class, arguments, _getPrototypeOf(this).constructor);
      }

      Wrapper.prototype = Object.create(Class.prototype, {
        constructor: {
          value: Wrapper,
          enumerable: false,
          writable: true,
          configurable: true
        }
      });
      return _setPrototypeOf(Wrapper, Class);
    };

    return _wrapNativeSuper(Class);
  }

  function _construct(Parent, args, Class) {
    if (_isNativeReflectConstruct()) {
      _construct = Reflect.construct;
    } else {
      _construct = function _construct(Parent, args, Class) {
        var a = [null];
        a.push.apply(a, args);
        var Constructor = Function.bind.apply(Parent, a);
        var instance = new Constructor();
        if (Class) _setPrototypeOf(instance, Class.prototype);
        return instance;
      };
    }

    return _construct.apply(null, arguments);
  }

  function _isNativeReflectConstruct() {
    if (typeof Reflect === "undefined" || !Reflect.construct) return false;
    if (Reflect.construct.sham) return false;
    if (typeof Proxy === "function") return true;

    try {
      Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
      return true;
    } catch (e) {
      return false;
    }
  }

  function _isNativeFunction(fn) {
    return Function.toString.call(fn).indexOf("[native code]") !== -1;
  }

  function _setPrototypeOf(o, p) {
    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
      o.__proto__ = p;
      return o;
    };

    return _setPrototypeOf(o, p);
  }

  function _getPrototypeOf(o) {
    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
      return o.__proto__ || Object.getPrototypeOf(o);
    };
    return _getPrototypeOf(o);
  }
  /* istanbul ignore next */

  var Element = HAS_WINDOW_SUPPORT ? WINDOW.Element : /*#__PURE__*/function (_Object) {
    _inherits(Element, _Object);

    var _super = _createSuper(Element);

    function Element() {
      _classCallCheck(this, Element);

      return _super.apply(this, arguments);
    }

    return Element;
  }( /*#__PURE__*/_wrapNativeSuper(Object));
  /* istanbul ignore next */

  var HTMLElement = HAS_WINDOW_SUPPORT ? WINDOW.HTMLElement : /*#__PURE__*/function (_Element) {
    _inherits(HTMLElement, _Element);

    var _super2 = _createSuper(HTMLElement);

    function HTMLElement() {
      _classCallCheck(this, HTMLElement);

      return _super2.apply(this, arguments);
    }

    return HTMLElement;
  }(Element);
  /* istanbul ignore next */

  var SVGElement = HAS_WINDOW_SUPPORT ? WINDOW.SVGElement : /*#__PURE__*/function (_Element2) {
    _inherits(SVGElement, _Element2);

    var _super3 = _createSuper(SVGElement);

    function SVGElement() {
      _classCallCheck(this, SVGElement);

      return _super3.apply(this, arguments);
    }

    return SVGElement;
  }(Element);

  function _typeof$3(obj) {
    "@babel/helpers - typeof";

    return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
      return typeof obj;
    } : function (obj) {
      return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    }, _typeof$3(obj);
  }

  var toType = function toType(value) {
    return _typeof$3(value);
  };
  var isUndefined$1 = function isUndefined(value) {
    return value === undefined;
  };
  var isNull = function isNull(value) {
    return value === null;
  };
  var isUndefinedOrNull = function isUndefinedOrNull(value) {
    return isUndefined$1(value) || isNull(value);
  };
  var isFunction$1 = function isFunction(value) {
    return toType(value) === 'function';
  };
  var isString$1 = function isString(value) {
    return toType(value) === 'string';
  };
  var isNumber$1 = function isNumber(value) {
    return toType(value) === 'number';
  };
  var isArray$1 = function isArray(value) {
    return Array.isArray(value);
  }; // Quick object check
  // This is primarily used to tell Objects from primitive values
  // when we know the value is a JSON-compliant type
  // Note object could be a complex type like array, Date, etc.

  var isObject$3 = function isObject(obj) {
    return obj !== null && _typeof$3(obj) === 'object';
  }; // Strict object type check
  // Only returns true for plain JavaScript objects

  var isPlainObject$1 = function isPlainObject(obj) {
    return Object.prototype.toString.call(obj) === '[object Object]';
  };
  var isDate$2 = function isDate(value) {
    return value instanceof Date;
  };

  function ownKeys$4(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$2(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) {
        _defineProperty$4(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$4(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  var assign = function assign() {
    return Object.assign.apply(Object, arguments);
  };
  var defineProperties = function defineProperties(obj, props) {
    return Object.defineProperties(obj, props);
  };
  var defineProperty = function defineProperty(obj, prop, descriptor) {
    return Object.defineProperty(obj, prop, descriptor);
  };
  var keys = function keys(obj) {
    return Object.keys(obj);
  }; // --- "Instance" ---

  var hasOwnProperty$1 = function hasOwnProperty(obj, prop) {
    return Object.prototype.hasOwnProperty.call(obj, prop);
  };
  // See: https://gist.github.com/bisubus/2da8af7e801ffd813fab7ac221aa7afc

  var pick$1 = function pick(obj, props) {
    return keys(obj).filter(function (key) {
      return props.indexOf(key) !== -1;
    }).reduce(function (result, key) {
      return _objectSpread$2(_objectSpread$2({}, result), {}, _defineProperty$4({}, key, obj[key]));
    }, {});
  }; // Return a shallow copy of object with the specified properties omitted

  var sortKeys = function sortKeys(obj) {
    return keys(obj).sort().reduce(function (result, key) {
      return _objectSpread$2(_objectSpread$2({}, result), {}, _defineProperty$4({}, key, obj[key]));
    }, {});
  }; // Convenience method to create a read-only descriptor

  var readonlyDescriptor = function readonlyDescriptor() {
    return {
      enumerable: true,
      configurable: false,
      writable: false
    };
  };

  function ownKeys$5(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$3(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) {
        _defineProperty$5(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$5(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  function _toConsumableArray$1(arr) {
    return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
  }

  function _nonIterableSpread$1() {
    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }

  function _unsupportedIterableToArray$1(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(o);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
  }

  function _iterableToArray$1(iter) {
    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  }

  function _arrayWithoutHoles$1(arr) {
    if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
  }

  function _arrayLikeToArray$1(arr, len) {
    if (len == null || len > arr.length) len = arr.length;

    for (var i = 0, arr2 = new Array(len); i < len; i++) {
      arr2[i] = arr[i];
    }

    return arr2;
  }
  var cloneDeep = function cloneDeep(obj) {
    var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : obj;

    if (isArray$1(obj)) {
      return obj.reduce(function (result, val) {
        return [].concat(_toConsumableArray$1(result), [cloneDeep(val, val)]);
      }, []);
    }

    if (isPlainObject$1(obj)) {
      return keys(obj).reduce(function (result, key) {
        return _objectSpread$3(_objectSpread$3({}, result), {}, _defineProperty$5({}, key, cloneDeep(obj[key], obj[key])));
      }, {});
    }

    return defaultValue;
  };

  var identity$1 = function identity(x) {
    return x;
  };

  /**
   * Utilities to get information about the current environment
   */
  var getEnv = function getEnv(key) {
    var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
    var env = typeof process !== 'undefined' && process ? process.env || {} : {};

    if (!key) {
      /* istanbul ignore next */
      return env;
    }

    return env[key] || fallback;
  };
  var getNoWarn = function getNoWarn() {
    return getEnv('BOOTSTRAP_VUE_NO_WARN') || getEnv('NODE_ENV') === 'production';
  };

  /**
   * Log a warning message to the console with BootstrapVue formatting
   * @param {string} message
   */

  var warn$1 = function warn(message)
  /* istanbul ignore next */
  {
    var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

    if (!getNoWarn()) {
      console.warn("[BootstrapVue warn]: ".concat(source ? "".concat(source, " - ") : '').concat(message));
    }
  };

  // Component names
  var NAME_MODAL = 'BModal';
  var NAME_POPOVER = 'BPopover';
  var NAME_TOOLTIP = 'BTooltip';
  var NAME_POPOVER_HELPER = 'BVPopover';
  var NAME_POPOVER_TEMPLATE = 'BVPopoverTemplate';
  var NAME_POPPER = 'BVPopper';
  var NAME_TOOLTIP_HELPER = 'BVTooltip';
  var NAME_TOOLTIP_TEMPLATE = 'BVTooltipTemplate';
  var NAME_TRANSITION = 'BVTransition';

  var EVENT_NAME_CLICK = 'click';
  var EVENT_NAME_CLOSE = 'close';
  var EVENT_NAME_DISABLE = 'disable';
  var EVENT_NAME_DISABLED = 'disabled';
  var EVENT_NAME_ENABLE = 'enable';
  var EVENT_NAME_ENABLED = 'enabled';
  var EVENT_NAME_FOCUSIN = 'focusin';
  var EVENT_NAME_FOCUSOUT = 'focusout';
  var EVENT_NAME_HIDDEN = 'hidden';
  var EVENT_NAME_HIDE = 'hide';
  var EVENT_NAME_MOUSEENTER = 'mouseenter';
  var EVENT_NAME_MOUSELEAVE = 'mouseleave';
  var EVENT_NAME_OPEN = 'open';
  var EVENT_NAME_SHOW = 'show';
  var EVENT_NAME_SHOWN = 'shown';
  var HOOK_EVENT_NAME_BEFORE_DESTROY = isVue3 ? 'vnodeBeforeUnmount' : 'hook:beforeDestroy';
  var HOOK_EVENT_NAME_DESTROYED = isVue3 ? 'vNodeUnmounted' : 'hook:destroyed';
  var MODEL_EVENT_NAME_PREFIX = 'update:';
  var ROOT_EVENT_NAME_PREFIX = 'bv';
  var ROOT_EVENT_NAME_SEPARATOR = '::';
  var EVENT_OPTIONS_NO_CAPTURE = {
    passive: true,
    capture: false
  };

  // General types
  var PROP_TYPE_ANY = undefined;
  var PROP_TYPE_ARRAY = Array;
  var PROP_TYPE_BOOLEAN = Boolean;
  var PROP_TYPE_FUNCTION = Function;
  var PROP_TYPE_NUMBER = Number;
  var PROP_TYPE_OBJECT = Object;
  var PROP_TYPE_STRING = String; // Multiple types
  var PROP_TYPE_ARRAY_STRING = [PROP_TYPE_ARRAY, PROP_TYPE_STRING];
  var PROP_TYPE_NUMBER_STRING = [PROP_TYPE_NUMBER, PROP_TYPE_STRING];
  var PROP_TYPE_NUMBER_OBJECT_STRING = [PROP_TYPE_NUMBER, PROP_TYPE_OBJECT, PROP_TYPE_STRING];

  var SLOT_NAME_DEFAULT = 'default';
  var SLOT_NAME_TITLE = 'title';

  var from = function from() {
    return Array.from.apply(Array, arguments);
  }; // --- Instance ---

  var arrayIncludes = function arrayIncludes(array, value) {
    return array.indexOf(value) !== -1;
  };
  var concat$1 = function concat() {
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return Array.prototype.concat.apply([], args);
  }; // --- Utilities ---

  // In functional components, `slots` is a function so it must be called
  // first before passing to the below methods. `scopedSlots` is always an
  // object and may be undefined (for Vue < 2.6.x)

  /**
   * Returns true if either scoped or unscoped named slot exists
   *
   * @param {String, Array} name or name[]
   * @param {Object} scopedSlots
   * @param {Object} slots
   * @returns {Array|undefined} VNodes
   */

  var hasNormalizedSlot = function hasNormalizedSlot(names) {
    var $scopedSlots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    var $slots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; // Ensure names is an array

    names = concat$1(names).filter(identity$1); // Returns true if the either a $scopedSlot or $slot exists with the specified name

    return names.some(function (name) {
      return $scopedSlots[name] || $slots[name];
    });
  };
  /**
   * Returns VNodes for named slot either scoped or unscoped
   *
   * @param {String, Array} name or name[]
   * @param {String} scope
   * @param {Object} scopedSlots
   * @param {Object} slots
   * @returns {Array|undefined} VNodes
   */

  var normalizeSlot = function normalizeSlot(names) {
    var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    var $scopedSlots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    var $slots = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; // Ensure names is an array

    names = concat$1(names).filter(identity$1);
    var slot;

    for (var i = 0; i < names.length && !slot; i++) {
      var name = names[i];
      slot = $scopedSlots[name] || $slots[name];
    } // Note: in Vue 2.6.x, all named slots are also scoped slots


    return isFunction$1(slot) ? slot(scope) : slot;
  };

  var normalizeSlotMixin = extend$2({
    methods: {
      // Returns `true` if the either a `$scopedSlot` or `$slot` exists with the specified name
      // `name` can be a string name or an array of names
      hasNormalizedSlot: function hasNormalizedSlot$1() {
        var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SLOT_NAME_DEFAULT;
        var scopedSlots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.$scopedSlots;
        var slots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.$slots;
        return hasNormalizedSlot(name, scopedSlots, slots);
      },
      // Returns an array of rendered VNodes if slot found, otherwise `undefined`
      // `name` can be a string name or an array of names
      normalizeSlot: function normalizeSlot$1() {
        var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SLOT_NAME_DEFAULT;
        var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
        var scopedSlots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.$scopedSlots;
        var slots = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.$slots;

        var vNodes = normalizeSlot(name, scope, scopedSlots, slots);

        return vNodes ? concat$1(vNodes) : vNodes;
      }
    }
  });

  // Number utilities
  // Converts a value (string, number, etc.) to an integer number
  // Assumes radix base 10
  var toInteger = function toInteger(value) {
    var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
    var integer = parseInt(value, 10);
    return isNaN(integer) ? defaultValue : integer;
  }; // Converts a value (string, number, etc.) to a number

  var toFloat = function toFloat(value) {
    var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
    var float = parseFloat(value);
    return isNaN(float) ? defaultValue : float;
  }; // Converts a value (string, number, etc.) to a string

  // String utilities
  // Converts PascalCase or camelCase to kebab-case

  var kebabCase = function kebabCase(str) {
    return str.replace(RX_HYPHENATE, '-$1').toLowerCase();
  }; // Converts a kebab-case or camelCase string to PascalCase

  var ELEMENT_PROTO = Element.prototype;
  // See: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill

  /* istanbul ignore next */

  var matchesEl = ELEMENT_PROTO.matches || ELEMENT_PROTO.msMatchesSelector || ELEMENT_PROTO.webkitMatchesSelector; // See: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest

  /* istanbul ignore next */

  var closestEl = ELEMENT_PROTO.closest || function (sel) {
    var el = this;

    do {
      // Use our "patched" matches function
      if (matches$1(el, sel)) {
        return el;
      }

      el = el.parentElement || el.parentNode;
    } while (!isNull(el) && el.nodeType === Node.ELEMENT_NODE);

    return null;
  }; // `requestAnimationFrame()` convenience method

  /* istanbul ignore next: JSDOM always returns the first option */

  var requestAF = (WINDOW.requestAnimationFrame || WINDOW.webkitRequestAnimationFrame || WINDOW.mozRequestAnimationFrame || WINDOW.msRequestAnimationFrame || WINDOW.oRequestAnimationFrame || // Fallback, but not a true polyfill
  // Only needed for Opera Mini

  /* istanbul ignore next */
  function (cb) {
    return setTimeout(cb, 16);
  }).bind(WINDOW);

  var isElement = function isElement(el) {
    return !!(el && el.nodeType === Node.ELEMENT_NODE);
  }; // Get the currently active HTML element

  var getActiveElement = function getActiveElement() {
    var excludes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
    var activeElement = DOCUMENT.activeElement;
    return activeElement && !excludes.some(function (el) {
      return el === activeElement;
    }) ? activeElement : null;
  }; // Returns `true` if a tag's name equals `name`

  var isActiveElement = function isActiveElement(el) {
    return isElement(el) && el === getActiveElement();
  }; // Determine if an HTML element is visible - Faster than CSS check

  var isVisible = function isVisible(el) {
    if (!isElement(el) || !el.parentNode || !contains(DOCUMENT.body, el)) {
      // Note this can fail for shadow dom elements since they
      // are not a direct descendant of document.body
      return false;
    }

    if (getStyle$1(el, 'display') === 'none') {
      // We do this check to help with vue-test-utils when using v-show

      /* istanbul ignore next */
      return false;
    } // All browsers support getBoundingClientRect(), except JSDOM as it returns all 0's for values :(
    // So any tests that need isVisible will fail in JSDOM
    // Except when we override the getBCR prototype in some tests


    var bcr = getBCR(el);
    return !!(bcr && bcr.height > 0 && bcr.width > 0);
  }; // Determine if an element is disabled

  var isDisabled = function isDisabled(el) {
    return !isElement(el) || el.disabled || hasAttr(el, 'disabled') || hasClass(el, 'disabled');
  }; // Cause/wait-for an element to reflow its content (adjusting its height/width)

  var select = function select(selector, root) {
    return (isElement(root) ? root : DOCUMENT).querySelector(selector) || null;
  }; // Determine if an element matches a selector

  var matches$1 = function matches(el, selector) {
    return isElement(el) ? matchesEl.call(el, selector) : false;
  }; // Finds closest element matching selector. Returns `null` if not found

  var closest = function closest(selector, root) {
    var includeRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

    if (!isElement(root)) {
      return null;
    }

    var el = closestEl.call(root, selector); // Native closest behaviour when `includeRoot` is truthy,
    // else emulate jQuery closest and return `null` if match is
    // the passed in root element when `includeRoot` is falsey

    return includeRoot ? el : el === root ? null : el;
  }; // Returns true if the parent element contains the child element

  var contains = function contains(parent, child) {
    return parent && isFunction$1(parent.contains) ? parent.contains(child) : false;
  }; // Get an element given an ID

  var getById = function getById(id) {
    return DOCUMENT.getElementById(/^#/.test(id) ? id.slice(1) : id) || null;
  }; // Add a class to an element

  var hasClass = function hasClass(el, className) {
    // We are checking for `el.classList` existence here since IE 11
    // returns `undefined` for some elements (e.g. SVG elements)
    // See https://github.com/bootstrap-vue/bootstrap-vue/issues/2713
    if (className && isElement(el) && el.classList) {
      return el.classList.contains(className);
    }

    return false;
  }; // Set an attribute on an element

  var setAttr$1 = function setAttr(el, attr, value) {
    if (attr && isElement(el)) {
      el.setAttribute(attr, value);
    }
  }; // Remove an attribute from an element

  var removeAttr = function removeAttr(el, attr) {
    if (attr && isElement(el)) {
      el.removeAttribute(attr);
    }
  }; // Get an attribute value from an element
  // Returns `null` if not found

  var getAttr = function getAttr(el, attr) {
    return attr && isElement(el) ? el.getAttribute(attr) : null;
  }; // Determine if an attribute exists on an element
  // Returns `true` or `false`, or `null` if element not found

  var hasAttr = function hasAttr(el, attr) {
    return attr && isElement(el) ? el.hasAttribute(attr) : null;
  }; // Set an style property on an element
  // Returns `null` if not found

  var getStyle$1 = function getStyle(el, prop) {
    return prop && isElement(el) ? el.style[prop] || null : null;
  }; // Return the Bounding Client Rect of an element
  // Returns `null` if not an element

  /* istanbul ignore next: getBoundingClientRect() doesn't work in JSDOM */

  var getBCR = function getBCR(el) {
    return isElement(el) ? el.getBoundingClientRect() : null;
  }; // Get computed style object for an element

  /* istanbul ignore next: getComputedStyle() doesn't work in JSDOM */

  var getCS = function getCS(el) {
    var getComputedStyle = WINDOW.getComputedStyle;
    return getComputedStyle && isElement(el) ? getComputedStyle(el) : {};
  }; // Returns a `Selection` object representing the range of text selected

  var attemptFocus = function attemptFocus(el) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    try {
      el.focus(options);
    } catch (_unused) {}

    return isActiveElement(el);
  }; // Attempt to blur an element, and return `true` if successful

  var VueProto = Vue.prototype; // --- Getter methods ---

  var getConfigValue = function getConfigValue(key) {
    var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
    var bvConfig = VueProto[PROP_NAME];
    return bvConfig ? bvConfig.getConfigValue(key, defaultValue) : cloneDeep(defaultValue);
  }; // Method to grab a config value for a particular component

  var getComponentConfig = function getComponentConfig(key) {
    var propKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
    var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; // Return the particular config value for key if specified,
    // otherwise we return the full config (or an empty object if not found)

    return propKey ? getConfigValue("".concat(key, ".").concat(propKey), defaultValue) : getConfigValue(key, {});
  }; // Get all breakpoint names

  function ownKeys$6(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$4(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) {
        _defineProperty$6(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$6(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  var makeProp = function makeProp() {
    var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PROP_TYPE_ANY;
    var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
    var requiredOrValidator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
    var validator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
    var required = requiredOrValidator === true;
    validator = required ? validator : requiredOrValidator;
    return _objectSpread$4(_objectSpread$4(_objectSpread$4({}, type ? {
      type: type
    } : {}), required ? {
      required: required
    } : isUndefined$1(value) ? {} : {
      default: isObject$3(value) ? function () {
        return value;
      } : value
    }), isUndefined$1(validator) ? {} : {
      validator: validator
    });
  }; // Copies props from one array/object to a new array/object
  // Replaces the current `default` key of each prop with a `getComponentConfig()`
  // call that falls back to the current default value of the prop

  var makePropConfigurable = function makePropConfigurable(prop, key, componentKey) {
    return _objectSpread$4(_objectSpread$4({}, cloneDeep(prop)), {}, {
      default: function bvConfigurablePropDefault() {
        var value = getComponentConfig(componentKey, key, prop.default);
        return isFunction$1(value) ? value() : value;
      }
    });
  }; // Make a props object configurable by global configuration
  // Replaces the current `default` key of each prop with a `getComponentConfig()`
  // call that falls back to the current default value of the prop

  var makePropsConfigurable = function makePropsConfigurable(props, componentKey) {
    return keys(props).reduce(function (result, key) {
      return _objectSpread$4(_objectSpread$4({}, result), {}, _defineProperty$6({}, key, makePropConfigurable(props[key], key, componentKey)));
    }, {});
  }; // Get function name we use in `makePropConfigurable()`
  // for the prop default value override to compare
  // against in `hasPropFunction()`

  var configurablePropDefaultFnName = makePropConfigurable({}, '', '').default.name; // Detect wether the given value is currently a function

  // Normalize event options based on support of passive option
  // Exported only for testing purposes

  var parseEventOptions = function parseEventOptions(options) {
    /* istanbul ignore else: can't test in JSDOM, as it supports passive */
    if (HAS_PASSIVE_EVENT_SUPPORT) {
      return isObject$3(options) ? options : {
        capture: !!options || false
      };
    } else {
      // Need to translate to actual Boolean value
      return !!(isObject$3(options) ? options.capture : options);
    }
  }; // Attach an event listener to an element

  var eventOn = function eventOn(el, eventName, handler, options) {
    if (el && el.addEventListener) {
      el.addEventListener(eventName, handler, parseEventOptions(options));
    }
  }; // Remove an event listener from an element

  var eventOff = function eventOff(el, eventName, handler, options) {
    if (el && el.removeEventListener) {
      el.removeEventListener(eventName, handler, parseEventOptions(options));
    }
  }; // Utility method to add/remove a event listener based on first argument (boolean)
  // It passes all other arguments to the `eventOn()` or `eventOff` method

  var eventOnOff = function eventOnOff(on) {
    var method = on ? eventOn : eventOff;

    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      args[_key - 1] = arguments[_key];
    }

    method.apply(void 0, args);
  }; // Utility method to prevent the default event handling and propagation
  // `getBaseEventName('BNavigationItem')` => 'navigation-item'
  // `getBaseEventName('BVToggle')` => 'toggle'

  var getBaseEventName = function getBaseEventName(value) {
    return kebabCase(value.replace(RX_BV_PREFIX, ''));
  }; // Get a root event name by component/directive and event name
  // `getBaseEventName('BModal', 'show')` => 'bv::modal::show'


  var getRootEventName = function getRootEventName(name, eventName) {
    return [ROOT_EVENT_NAME_PREFIX, getBaseEventName(name), eventName].join(ROOT_EVENT_NAME_SEPARATOR);
  }; // Get a root action event name by component/directive and action name
  // `getRootActionEventName('BModal', 'show')` => 'bv::show::modal'

  var getRootActionEventName = function getRootActionEventName(name, actionName) {
    return [ROOT_EVENT_NAME_PREFIX, actionName, getBaseEventName(name)].join(ROOT_EVENT_NAME_SEPARATOR);
  };

  function ownKeys$7(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$5(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) {
        _defineProperty$7(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$7(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  } // Generic Bootstrap v4 fade (no-fade) transition component

  var NO_FADE_PROPS = {
    name: '',
    enterClass: '',
    enterActiveClass: '',
    enterToClass: 'show',
    leaveClass: 'show',
    leaveActiveClass: '',
    leaveToClass: ''
  };

  var FADE_PROPS = _objectSpread$5(_objectSpread$5({}, NO_FADE_PROPS), {}, {
    enterActiveClass: 'fade',
    leaveActiveClass: 'fade'
  }); // --- Props ---


  var props$1 = {
    // Has no effect if `trans-props` provided
    appear: makeProp(PROP_TYPE_BOOLEAN, false),
    // Can be overridden by user supplied `trans-props`
    mode: makeProp(PROP_TYPE_STRING),
    // Only applicable to the built in transition
    // Has no effect if `trans-props` provided
    noFade: makeProp(PROP_TYPE_BOOLEAN, false),
    // For user supplied transitions (if needed)
    transProps: makeProp(PROP_TYPE_OBJECT)
  }; // --- Main component ---
  // @vue/component

  var BVTransition = /*#__PURE__*/extend$2({
    name: NAME_TRANSITION,
    functional: true,
    props: props$1,
    render: function render(h, _ref) {
      var children = _ref.children,
          data = _ref.data,
          props = _ref.props;
      var transProps = props.transProps;

      if (!isPlainObject$1(transProps)) {
        transProps = props.noFade ? NO_FADE_PROPS : FADE_PROPS;

        if (props.appear) {
          // Default the appear classes to equal the enter classes
          transProps = _objectSpread$5(_objectSpread$5({}, transProps), {}, {
            appear: true,
            appearClass: transProps.enterClass,
            appearActiveClass: transProps.enterActiveClass,
            appearToClass: transProps.enterToClass
          });
        }
      }

      transProps = _objectSpread$5(_objectSpread$5({
        mode: props.mode
      }, transProps), {}, {
        // We always need `css` true
        css: true
      });

      var dataCopy = _objectSpread$5({}, data);

      delete dataCopy.props;
      return h('transition', // Any transition event listeners will get merged here
      a(dataCopy, {
        props: transProps
      }), children);
    }
  });

  // Math utilty functions
  var mathMax = Math.max;

  // Handles when arrays are "sparse" (array.every(...) doesn't handle sparse)

  var compareArrays = function compareArrays(a, b) {
    if (a.length !== b.length) {
      return false;
    }

    var equal = true;

    for (var i = 0; equal && i < a.length; i++) {
      equal = looseEqual$1(a[i], b[i]);
    }

    return equal;
  };
  /**
   * Check if two values are loosely equal - that is,
   * if they are plain objects, do they have the same shape?
   * Returns boolean true or false
   */


  var looseEqual$1 = function looseEqual(a, b) {
    if (a === b) {
      return true;
    }

    var aValidType = isDate$2(a);
    var bValidType = isDate$2(b);

    if (aValidType || bValidType) {
      return aValidType && bValidType ? a.getTime() === b.getTime() : false;
    }

    aValidType = isArray$1(a);
    bValidType = isArray$1(b);

    if (aValidType || bValidType) {
      return aValidType && bValidType ? compareArrays(a, b) : false;
    }

    aValidType = isObject$3(a);
    bValidType = isObject$3(b);

    if (aValidType || bValidType) {
      /* istanbul ignore if: this if will probably never be called */
      if (!aValidType || !bValidType) {
        return false;
      }

      var aKeysCount = keys(a).length;
      var bKeysCount = keys(b).length;

      if (aKeysCount !== bKeysCount) {
        return false;
      }

      for (var key in a) {
        var aHasKey = hasOwnProperty$1(a, key);
        var bHasKey = hasOwnProperty$1(b, key);

        if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
          return false;
        }
      }
    }

    return String(a) === String(b);
  };

  var getEventRoot = function getEventRoot(vm) {
    return vm.$root.$options.bvEventRoot || vm.$root;
  };

  var PROP = '$_rootListeners'; // --- Mixin ---
  // @vue/component

  var listenOnRootMixin = extend$2({
    computed: {
      bvEventRoot: function bvEventRoot() {
        return getEventRoot(this);
      }
    },
    created: function created() {
      // Define non-reactive property
      // Object of arrays, keyed by event name,
      // where value is an array of callbacks
      this[PROP] = {};
    },
    beforeDestroy: function beforeDestroy() {
      var _this = this; // Unregister all registered listeners


      keys(this[PROP] || {}).forEach(function (event) {
        _this[PROP][event].forEach(function (callback) {
          _this.listenOffRoot(event, callback);
        });
      });
      this[PROP] = null;
    },
    methods: {
      registerRootListener: function registerRootListener(event, callback) {
        if (this[PROP]) {
          this[PROP][event] = this[PROP][event] || [];

          if (!arrayIncludes(this[PROP][event], callback)) {
            this[PROP][event].push(callback);
          }
        }
      },
      unregisterRootListener: function unregisterRootListener(event, callback) {
        if (this[PROP] && this[PROP][event]) {
          this[PROP][event] = this[PROP][event].filter(function (cb) {
            return cb !== callback;
          });
        }
      },

      /**
       * Safely register event listeners on the root Vue node
       * While Vue automatically removes listeners for individual components,
       * when a component registers a listener on `$root` and is destroyed,
       * this orphans a callback because the node is gone, but the `$root`
       * does not clear the callback
       *
       * When registering a `$root` listener, it also registers the listener
       * to be removed in the component's `beforeDestroy()` hook
       *
       * @param {string} event
       * @param {function} callback
       */
      listenOnRoot: function listenOnRoot(event, callback) {
        if (this.bvEventRoot) {
          this.bvEventRoot.$on(event, callback);
          this.registerRootListener(event, callback);
        }
      },

      /**
       * Safely register a `$once()` event listener on the root Vue node
       * While Vue automatically removes listeners for individual components,
       * when a component registers a listener on `$root` and is destroyed,
       * this orphans a callback because the node is gone, but the `$root`
       * does not clear the callback
       *
       * When registering a `$root` listener, it also registers the listener
       * to be removed in the component's `beforeDestroy()` hook
       *
       * @param {string} event
       * @param {function} callback
       */
      listenOnRootOnce: function listenOnRootOnce(event, callback) {
        var _this2 = this;

        if (this.bvEventRoot) {
          var _callback = function _callback() {
            _this2.unregisterRootListener(_callback); // eslint-disable-next-line node/no-callback-literal


            callback.apply(void 0, arguments);
          };

          this.bvEventRoot.$once(event, _callback);
          this.registerRootListener(event, _callback);
        }
      },

      /**
       * Safely unregister event listeners from the root Vue node
       *
       * @param {string} event
       * @param {function} callback
       */
      listenOffRoot: function listenOffRoot(event, callback) {
        this.unregisterRootListener(event, callback);

        if (this.bvEventRoot) {
          this.bvEventRoot.$off(event, callback);
        }
      },

      /**
       * Convenience method for calling `vm.$emit()` on `$root`
       *
       * @param {string} event
       * @param {*} args
       */
      emitOnRoot: function emitOnRoot(event) {
        if (this.bvEventRoot) {
          var _this$bvEventRoot;

          for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key];
          }

          (_this$bvEventRoot = this.bvEventRoot).$emit.apply(_this$bvEventRoot, [event].concat(args));
        }
      }
    }
  });

  var noop$1 = function noop() {};

  /**!
   * @fileOverview Kickass library to create and place poppers near their reference elements.
   * @version 1.16.1
   * @license
   * Copyright (c) 2016 Federico Zivolo and contributors
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';

  var timeoutDuration = function () {
    var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];

    for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
      if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
        return 1;
      }
    }

    return 0;
  }();

  function microtaskDebounce(fn) {
    var called = false;
    return function () {
      if (called) {
        return;
      }

      called = true;
      window.Promise.resolve().then(function () {
        called = false;
        fn();
      });
    };
  }

  function taskDebounce(fn) {
    var scheduled = false;
    return function () {
      if (!scheduled) {
        scheduled = true;
        setTimeout(function () {
          scheduled = false;
          fn();
        }, timeoutDuration);
      }
    };
  }

  var supportsMicroTasks = isBrowser && window.Promise;
  /**
  * Create a debounced version of a method, that's asynchronously deferred
  * but called in the minimum time possible.
  *
  * @method
  * @memberof Popper.Utils
  * @argument {Function} fn
  * @returns {Function}
  */

  var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  /**
   * Check if the given variable is a function
   * @method
   * @memberof Popper.Utils
   * @argument {Any} functionToCheck - variable to check
   * @returns {Boolean} answer to: is a function?
   */

  function isFunction$2(functionToCheck) {
    var getType = {};
    return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  }
  /**
   * Get CSS computed property of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Eement} element
   * @argument {String} property
   */


  function getStyleComputedProperty(element, property) {
    if (element.nodeType !== 1) {
      return [];
    } // NOTE: 1 DOM access here


    var window = element.ownerDocument.defaultView;
    var css = window.getComputedStyle(element, null);
    return property ? css[property] : css;
  }
  /**
   * Returns the parentNode or the host of the element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} parent
   */


  function getParentNode(element) {
    if (element.nodeName === 'HTML') {
      return element;
    }

    return element.parentNode || element.host;
  }
  /**
   * Returns the scrolling parent of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} scroll parent
   */


  function getScrollParent$1(element) {
    // Return body, `getScroll` will take care to get the correct `scrollTop` from it
    if (!element) {
      return document.body;
    }

    switch (element.nodeName) {
      case 'HTML':
      case 'BODY':
        return element.ownerDocument.body;

      case '#document':
        return element.body;
    } // Firefox want us to check `-x` and `-y` variations as well


    var _getStyleComputedProp = getStyleComputedProperty(element),
        overflow = _getStyleComputedProp.overflow,
        overflowX = _getStyleComputedProp.overflowX,
        overflowY = _getStyleComputedProp.overflowY;

    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
      return element;
    }

    return getScrollParent$1(getParentNode(element));
  }
  /**
   * Returns the reference node of the reference object, or the reference object itself.
   * @method
   * @memberof Popper.Utils
   * @param {Element|Object} reference - the reference element (the popper will be relative to this)
   * @returns {Element} parent
   */


  function getReferenceNode(reference) {
    return reference && reference.referenceNode ? reference.referenceNode : reference;
  }

  var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  /**
   * Determines if the browser is Internet Explorer
   * @method
   * @memberof Popper.Utils
   * @param {Number} version to check
   * @returns {Boolean} isIE
   */

  function isIE$1(version) {
    if (version === 11) {
      return isIE11;
    }

    if (version === 10) {
      return isIE10;
    }

    return isIE11 || isIE10;
  }
  /**
   * Returns the offset parent of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} offset parent
   */


  function getOffsetParent(element) {
    if (!element) {
      return document.documentElement;
    }

    var noOffsetParent = isIE$1(10) ? document.body : null; // NOTE: 1 DOM access here

    var offsetParent = element.offsetParent || null; // Skip hidden elements which don't have an offsetParent

    while (offsetParent === noOffsetParent && element.nextElementSibling) {
      offsetParent = (element = element.nextElementSibling).offsetParent;
    }

    var nodeName = offsetParent && offsetParent.nodeName;

    if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
      return element ? element.ownerDocument.documentElement : document.documentElement;
    } // .offsetParent will return the closest TH, TD or TABLE in case
    // no offsetParent is present, I hate this job...


    if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
      return getOffsetParent(offsetParent);
    }

    return offsetParent;
  }

  function isOffsetContainer(element) {
    var nodeName = element.nodeName;

    if (nodeName === 'BODY') {
      return false;
    }

    return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  }
  /**
   * Finds the root node (document, shadowDOM root) of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} node
   * @returns {Element} root node
   */


  function getRoot(node) {
    if (node.parentNode !== null) {
      return getRoot(node.parentNode);
    }

    return node;
  }
  /**
   * Finds the offset parent common to the two provided nodes
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element1
   * @argument {Element} element2
   * @returns {Element} common offset parent
   */


  function findCommonOffsetParent(element1, element2) {
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
    if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
      return document.documentElement;
    } // Here we make sure to give as "start" the element that comes first in the DOM


    var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
    var start = order ? element1 : element2;
    var end = order ? element2 : element1; // Get common ancestor container

    var range = document.createRange();
    range.setStart(start, 0);
    range.setEnd(end, 0);
    var commonAncestorContainer = range.commonAncestorContainer; // Both nodes are inside #document

    if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
      if (isOffsetContainer(commonAncestorContainer)) {
        return commonAncestorContainer;
      }

      return getOffsetParent(commonAncestorContainer);
    } // one of the nodes is inside shadowDOM, find which one


    var element1root = getRoot(element1);

    if (element1root.host) {
      return findCommonOffsetParent(element1root.host, element2);
    } else {
      return findCommonOffsetParent(element1, getRoot(element2).host);
    }
  }
  /**
   * Gets the scroll value of the given element in the given side (top and left)
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @argument {String} side `top` or `left`
   * @returns {number} amount of scrolled pixels
   */


  function getScroll(element) {
    var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
    var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
    var nodeName = element.nodeName;

    if (nodeName === 'BODY' || nodeName === 'HTML') {
      var html = element.ownerDocument.documentElement;
      var scrollingElement = element.ownerDocument.scrollingElement || html;
      return scrollingElement[upperSide];
    }

    return element[upperSide];
  }
  /*
   * Sum or subtract the element scroll values (left and top) from a given rect object
   * @method
   * @memberof Popper.Utils
   * @param {Object} rect - Rect object you want to change
   * @param {HTMLElement} element - The element from the function reads the scroll values
   * @param {Boolean} subtract - set to true if you want to subtract the scroll values
   * @return {Object} rect - The modifier rect object
   */


  function includeScroll(rect, element) {
    var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
    var scrollTop = getScroll(element, 'top');
    var scrollLeft = getScroll(element, 'left');
    var modifier = subtract ? -1 : 1;
    rect.top += scrollTop * modifier;
    rect.bottom += scrollTop * modifier;
    rect.left += scrollLeft * modifier;
    rect.right += scrollLeft * modifier;
    return rect;
  }
  /*
   * Helper to detect borders of a given element
   * @method
   * @memberof Popper.Utils
   * @param {CSSStyleDeclaration} styles
   * Result of `getStyleComputedProperty` on the given element
   * @param {String} axis - `x` or `y`
   * @return {number} borders - The borders size of the given axis
   */


  function getBordersSize(styles, axis) {
    var sideA = axis === 'x' ? 'Left' : 'Top';
    var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
    return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  }

  function getSize(axis, body, html, computedStyle) {
    return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE$1(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  }

  function getWindowSizes(document) {
    var body = document.body;
    var html = document.documentElement;
    var computedStyle = isIE$1(10) && getComputedStyle(html);
    return {
      height: getSize('Height', body, html, computedStyle),
      width: getSize('Width', body, html, computedStyle)
    };
  }

  var classCallCheck = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  };

  var createClass = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }

    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();

  var defineProperty$1 = function (obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  };

  var _extends$2 = Object.assign || function (target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];

      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }

    return target;
  };
  /**
   * Given element offsets, generate an output similar to getBoundingClientRect
   * @method
   * @memberof Popper.Utils
   * @argument {Object} offsets
   * @returns {Object} ClientRect like output
   */


  function getClientRect(offsets) {
    return _extends$2({}, offsets, {
      right: offsets.left + offsets.width,
      bottom: offsets.top + offsets.height
    });
  }
  /**
   * Get bounding client rect of given element
   * @method
   * @memberof Popper.Utils
   * @param {HTMLElement} element
   * @return {Object} client rect
   */


  function getBoundingClientRect(element) {
    var rect = {}; // IE10 10 FIX: Please, don't ask, the element isn't
    // considered in DOM in some circumstances...
    // This isn't reproducible in IE10 compatibility mode of IE11

    try {
      if (isIE$1(10)) {
        rect = element.getBoundingClientRect();
        var scrollTop = getScroll(element, 'top');
        var scrollLeft = getScroll(element, 'left');
        rect.top += scrollTop;
        rect.left += scrollLeft;
        rect.bottom += scrollTop;
        rect.right += scrollLeft;
      } else {
        rect = element.getBoundingClientRect();
      }
    } catch (e) {}

    var result = {
      left: rect.left,
      top: rect.top,
      width: rect.right - rect.left,
      height: rect.bottom - rect.top
    }; // subtract scrollbar size from sizes

    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
    var width = sizes.width || element.clientWidth || result.width;
    var height = sizes.height || element.clientHeight || result.height;
    var horizScrollbar = element.offsetWidth - width;
    var vertScrollbar = element.offsetHeight - height; // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
    // we make this check conditional for performance reasons

    if (horizScrollbar || vertScrollbar) {
      var styles = getStyleComputedProperty(element);
      horizScrollbar -= getBordersSize(styles, 'x');
      vertScrollbar -= getBordersSize(styles, 'y');
      result.width -= horizScrollbar;
      result.height -= vertScrollbar;
    }

    return getClientRect(result);
  }

  function getOffsetRectRelativeToArbitraryNode(children, parent) {
    var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
    var isIE10 = isIE$1(10);
    var isHTML = parent.nodeName === 'HTML';
    var childrenRect = getBoundingClientRect(children);
    var parentRect = getBoundingClientRect(parent);
    var scrollParent = getScrollParent$1(children);
    var styles = getStyleComputedProperty(parent);
    var borderTopWidth = parseFloat(styles.borderTopWidth);
    var borderLeftWidth = parseFloat(styles.borderLeftWidth); // In cases where the parent is fixed, we must ignore negative scroll in offset calc

    if (fixedPosition && isHTML) {
      parentRect.top = Math.max(parentRect.top, 0);
      parentRect.left = Math.max(parentRect.left, 0);
    }

    var offsets = getClientRect({
      top: childrenRect.top - parentRect.top - borderTopWidth,
      left: childrenRect.left - parentRect.left - borderLeftWidth,
      width: childrenRect.width,
      height: childrenRect.height
    });
    offsets.marginTop = 0;
    offsets.marginLeft = 0; // Subtract margins of documentElement in case it's being used as parent
    // we do this only on HTML because it's the only element that behaves
    // differently when margins are applied to it. The margins are included in
    // the box of the documentElement, in the other cases not.

    if (!isIE10 && isHTML) {
      var marginTop = parseFloat(styles.marginTop);
      var marginLeft = parseFloat(styles.marginLeft);
      offsets.top -= borderTopWidth - marginTop;
      offsets.bottom -= borderTopWidth - marginTop;
      offsets.left -= borderLeftWidth - marginLeft;
      offsets.right -= borderLeftWidth - marginLeft; // Attach marginTop and marginLeft because in some circumstances we may need them

      offsets.marginTop = marginTop;
      offsets.marginLeft = marginLeft;
    }

    if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
      offsets = includeScroll(offsets, parent);
    }

    return offsets;
  }

  function getViewportOffsetRectRelativeToArtbitraryNode(element) {
    var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
    var html = element.ownerDocument.documentElement;
    var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
    var width = Math.max(html.clientWidth, window.innerWidth || 0);
    var height = Math.max(html.clientHeight, window.innerHeight || 0);
    var scrollTop = !excludeScroll ? getScroll(html) : 0;
    var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
    var offset = {
      top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
      left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
      width: width,
      height: height
    };
    return getClientRect(offset);
  }
  /**
   * Check if the given element is fixed or is inside a fixed parent
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @argument {Element} customContainer
   * @returns {Boolean} answer to "isFixed?"
   */


  function isFixed(element) {
    var nodeName = element.nodeName;

    if (nodeName === 'BODY' || nodeName === 'HTML') {
      return false;
    }

    if (getStyleComputedProperty(element, 'position') === 'fixed') {
      return true;
    }

    var parentNode = getParentNode(element);

    if (!parentNode) {
      return false;
    }

    return isFixed(parentNode);
  }
  /**
   * Finds the first parent of an element that has a transformed property defined
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} first transformed parent or documentElement
   */


  function getFixedPositionOffsetParent(element) {
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
    if (!element || !element.parentElement || isIE$1()) {
      return document.documentElement;
    }

    var el = element.parentElement;

    while (el && getStyleComputedProperty(el, 'transform') === 'none') {
      el = el.parentElement;
    }

    return el || document.documentElement;
  }
  /**
   * Computed the boundaries limits and return them
   * @method
   * @memberof Popper.Utils
   * @param {HTMLElement} popper
   * @param {HTMLElement} reference
   * @param {number} padding
   * @param {HTMLElement} boundariesElement - Element used to define the boundaries
   * @param {Boolean} fixedPosition - Is in fixed position mode
   * @returns {Object} Coordinates of the boundaries
   */


  function getBoundaries(popper, reference, padding, boundariesElement) {
    var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; // NOTE: 1 DOM access here

    var boundaries = {
      top: 0,
      left: 0
    };
    var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); // Handle viewport case

    if (boundariesElement === 'viewport') {
      boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
    } else {
      // Handle other cases based on DOM element used as boundaries
      var boundariesNode = void 0;

      if (boundariesElement === 'scrollParent') {
        boundariesNode = getScrollParent$1(getParentNode(reference));

        if (boundariesNode.nodeName === 'BODY') {
          boundariesNode = popper.ownerDocument.documentElement;
        }
      } else if (boundariesElement === 'window') {
        boundariesNode = popper.ownerDocument.documentElement;
      } else {
        boundariesNode = boundariesElement;
      }

      var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); // In case of HTML, we need a different computation

      if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
        var _getWindowSizes = getWindowSizes(popper.ownerDocument),
            height = _getWindowSizes.height,
            width = _getWindowSizes.width;

        boundaries.top += offsets.top - offsets.marginTop;
        boundaries.bottom = height + offsets.top;
        boundaries.left += offsets.left - offsets.marginLeft;
        boundaries.right = width + offsets.left;
      } else {
        // for all the other DOM elements, this one is good
        boundaries = offsets;
      }
    } // Add paddings


    padding = padding || 0;
    var isPaddingNumber = typeof padding === 'number';
    boundaries.left += isPaddingNumber ? padding : padding.left || 0;
    boundaries.top += isPaddingNumber ? padding : padding.top || 0;
    boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
    boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
    return boundaries;
  }

  function getArea(_ref) {
    var width = _ref.width,
        height = _ref.height;
    return width * height;
  }
  /**
   * Utility used to transform the `auto` placement to the placement with more
   * available space.
   * @method
   * @memberof Popper.Utils
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */


  function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
    var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;

    if (placement.indexOf('auto') === -1) {
      return placement;
    }

    var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
    var rects = {
      top: {
        width: boundaries.width,
        height: refRect.top - boundaries.top
      },
      right: {
        width: boundaries.right - refRect.right,
        height: boundaries.height
      },
      bottom: {
        width: boundaries.width,
        height: boundaries.bottom - refRect.bottom
      },
      left: {
        width: refRect.left - boundaries.left,
        height: boundaries.height
      }
    };
    var sortedAreas = Object.keys(rects).map(function (key) {
      return _extends$2({
        key: key
      }, rects[key], {
        area: getArea(rects[key])
      });
    }).sort(function (a, b) {
      return b.area - a.area;
    });
    var filteredAreas = sortedAreas.filter(function (_ref2) {
      var width = _ref2.width,
          height = _ref2.height;
      return width >= popper.clientWidth && height >= popper.clientHeight;
    });
    var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
    var variation = placement.split('-')[1];
    return computedPlacement + (variation ? '-' + variation : '');
  }
  /**
   * Get offsets to the reference element
   * @method
   * @memberof Popper.Utils
   * @param {Object} state
   * @param {Element} popper - the popper element
   * @param {Element} reference - the reference element (the popper will be relative to this)
   * @param {Element} fixedPosition - is in fixed position mode
   * @returns {Object} An object containing the offsets which will be applied to the popper
   */


  function getReferenceOffsets(state, popper, reference) {
    var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
    var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
    return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  }
  /**
   * Get the outer sizes of the given element (offset size + margins)
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Object} object containing width and height properties
   */


  function getOuterSizes(element) {
    var window = element.ownerDocument.defaultView;
    var styles = window.getComputedStyle(element);
    var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
    var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
    var result = {
      width: element.offsetWidth + y,
      height: element.offsetHeight + x
    };
    return result;
  }
  /**
   * Get the opposite placement of the given one
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement
   * @returns {String} flipped placement
   */


  function getOppositePlacement(placement) {
    var hash = {
      left: 'right',
      right: 'left',
      bottom: 'top',
      top: 'bottom'
    };
    return placement.replace(/left|right|bottom|top/g, function (matched) {
      return hash[matched];
    });
  }
  /**
   * Get offsets to the popper
   * @method
   * @memberof Popper.Utils
   * @param {Object} position - CSS position the Popper will get applied
   * @param {HTMLElement} popper - the popper element
   * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
   * @param {String} placement - one of the valid placement options
   * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
   */


  function getPopperOffsets(popper, referenceOffsets, placement) {
    placement = placement.split('-')[0]; // Get popper node sizes

    var popperRect = getOuterSizes(popper); // Add position, width and height to our offsets object

    var popperOffsets = {
      width: popperRect.width,
      height: popperRect.height
    }; // depending by the popper placement we have to compute its offsets slightly differently

    var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
    var mainSide = isHoriz ? 'top' : 'left';
    var secondarySide = isHoriz ? 'left' : 'top';
    var measurement = isHoriz ? 'height' : 'width';
    var secondaryMeasurement = !isHoriz ? 'height' : 'width';
    popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;

    if (placement === secondarySide) {
      popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
    } else {
      popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
    }

    return popperOffsets;
  }
  /**
   * Mimics the `find` method of Array
   * @method
   * @memberof Popper.Utils
   * @argument {Array} arr
   * @argument prop
   * @argument value
   * @returns index or -1
   */


  function find(arr, check) {
    // use native find if supported
    if (Array.prototype.find) {
      return arr.find(check);
    } // use `filter` to obtain the same behavior of `find`


    return arr.filter(check)[0];
  }
  /**
   * Return the index of the matching object
   * @method
   * @memberof Popper.Utils
   * @argument {Array} arr
   * @argument prop
   * @argument value
   * @returns index or -1
   */


  function findIndex(arr, prop, value) {
    // use native findIndex if supported
    if (Array.prototype.findIndex) {
      return arr.findIndex(function (cur) {
        return cur[prop] === value;
      });
    } // use `find` + `indexOf` if `findIndex` isn't supported


    var match = find(arr, function (obj) {
      return obj[prop] === value;
    });
    return arr.indexOf(match);
  }
  /**
   * Loop trough the list of modifiers and run them in order,
   * each of them will then edit the data object.
   * @method
   * @memberof Popper.Utils
   * @param {dataObject} data
   * @param {Array} modifiers
   * @param {String} ends - Optional modifier name used as stopper
   * @returns {dataObject}
   */


  function runModifiers(modifiers, data, ends) {
    var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
    modifiersToRun.forEach(function (modifier) {
      if (modifier['function']) {
        // eslint-disable-line dot-notation
        console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
      }

      var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation

      if (modifier.enabled && isFunction$2(fn)) {
        // Add properties to offsets to make them a complete clientRect object
        // we do this before each modifier to make sure the previous one doesn't
        // mess with these values
        data.offsets.popper = getClientRect(data.offsets.popper);
        data.offsets.reference = getClientRect(data.offsets.reference);
        data = fn(data, modifier);
      }
    });
    return data;
  }
  /**
   * Updates the position of the popper, computing the new offsets and applying
   * the new style.<br />
   * Prefer `scheduleUpdate` over `update` because of performance reasons.
   * @method
   * @memberof Popper
   */


  function update() {
    // if popper is destroyed, don't perform any further update
    if (this.state.isDestroyed) {
      return;
    }

    var data = {
      instance: this,
      styles: {},
      arrowStyles: {},
      attributes: {},
      flipped: false,
      offsets: {}
    }; // compute reference element offsets

    data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); // compute auto placement, store placement inside the data object,
    // modifiers will be able to edit `placement` if needed
    // and refer to originalPlacement to know the original value

    data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); // store the computed placement inside `originalPlacement`

    data.originalPlacement = data.placement;
    data.positionFixed = this.options.positionFixed; // compute the popper offsets

    data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
    data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; // run the modifiers

    data = runModifiers(this.modifiers, data); // the first `update` will call `onCreate` callback
    // the other ones will call `onUpdate` callback

    if (!this.state.isCreated) {
      this.state.isCreated = true;
      this.options.onCreate(data);
    } else {
      this.options.onUpdate(data);
    }
  }
  /**
   * Helper used to know if the given modifier is enabled.
   * @method
   * @memberof Popper.Utils
   * @returns {Boolean}
   */


  function isModifierEnabled(modifiers, modifierName) {
    return modifiers.some(function (_ref) {
      var name = _ref.name,
          enabled = _ref.enabled;
      return enabled && name === modifierName;
    });
  }
  /**
   * Get the prefixed supported property name
   * @method
   * @memberof Popper.Utils
   * @argument {String} property (camelCase)
   * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
   */


  function getSupportedPropertyName(property) {
    var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
    var upperProp = property.charAt(0).toUpperCase() + property.slice(1);

    for (var i = 0; i < prefixes.length; i++) {
      var prefix = prefixes[i];
      var toCheck = prefix ? '' + prefix + upperProp : property;

      if (typeof document.body.style[toCheck] !== 'undefined') {
        return toCheck;
      }
    }

    return null;
  }
  /**
   * Destroys the popper.
   * @method
   * @memberof Popper
   */


  function destroy() {
    this.state.isDestroyed = true; // touch DOM only if `applyStyle` modifier is enabled

    if (isModifierEnabled(this.modifiers, 'applyStyle')) {
      this.popper.removeAttribute('x-placement');
      this.popper.style.position = '';
      this.popper.style.top = '';
      this.popper.style.left = '';
      this.popper.style.right = '';
      this.popper.style.bottom = '';
      this.popper.style.willChange = '';
      this.popper.style[getSupportedPropertyName('transform')] = '';
    }

    this.disableEventListeners(); // remove the popper if user explicitly asked for the deletion on destroy
    // do not use `remove` because IE11 doesn't support it

    if (this.options.removeOnDestroy) {
      this.popper.parentNode.removeChild(this.popper);
    }

    return this;
  }
  /**
   * Get the window associated with the element
   * @argument {Element} element
   * @returns {Window}
   */


  function getWindow(element) {
    var ownerDocument = element.ownerDocument;
    return ownerDocument ? ownerDocument.defaultView : window;
  }

  function attachToScrollParents(scrollParent, event, callback, scrollParents) {
    var isBody = scrollParent.nodeName === 'BODY';
    var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
    target.addEventListener(event, callback, {
      passive: true
    });

    if (!isBody) {
      attachToScrollParents(getScrollParent$1(target.parentNode), event, callback, scrollParents);
    }

    scrollParents.push(target);
  }
  /**
   * Setup needed event listeners used to update the popper position
   * @method
   * @memberof Popper.Utils
   * @private
   */


  function setupEventListeners(reference, options, state, updateBound) {
    // Resize event listener on window
    state.updateBound = updateBound;
    getWindow(reference).addEventListener('resize', state.updateBound, {
      passive: true
    }); // Scroll event listener on scroll parents

    var scrollElement = getScrollParent$1(reference);
    attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
    state.scrollElement = scrollElement;
    state.eventsEnabled = true;
    return state;
  }
  /**
   * It will add resize/scroll events and start recalculating
   * position of the popper element when they are triggered.
   * @method
   * @memberof Popper
   */


  function enableEventListeners() {
    if (!this.state.eventsEnabled) {
      this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
    }
  }
  /**
   * Remove event listeners used to update the popper position
   * @method
   * @memberof Popper.Utils
   * @private
   */


  function removeEventListeners(reference, state) {
    // Remove resize event listener on window
    getWindow(reference).removeEventListener('resize', state.updateBound); // Remove scroll event listener on scroll parents

    state.scrollParents.forEach(function (target) {
      target.removeEventListener('scroll', state.updateBound);
    }); // Reset state

    state.updateBound = null;
    state.scrollParents = [];
    state.scrollElement = null;
    state.eventsEnabled = false;
    return state;
  }
  /**
   * It will remove resize/scroll events and won't recalculate popper position
   * when they are triggered. It also won't trigger `onUpdate` callback anymore,
   * unless you call `update` method manually.
   * @method
   * @memberof Popper
   */


  function disableEventListeners() {
    if (this.state.eventsEnabled) {
      cancelAnimationFrame(this.scheduleUpdate);
      this.state = removeEventListeners(this.reference, this.state);
    }
  }
  /**
   * Tells if a given input is a number
   * @method
   * @memberof Popper.Utils
   * @param {*} input to check
   * @return {Boolean}
   */


  function isNumeric(n) {
    return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  }
  /**
   * Set the style to the given popper
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element - Element to apply the style to
   * @argument {Object} styles
   * Object with a list of properties and values which will be applied to the element
   */


  function setStyles(element, styles) {
    Object.keys(styles).forEach(function (prop) {
      var unit = ''; // add unit if the value is numeric and is one of the following

      if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
        unit = 'px';
      }

      element.style[prop] = styles[prop] + unit;
    });
  }
  /**
   * Set the attributes to the given popper
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element - Element to apply the attributes to
   * @argument {Object} styles
   * Object with a list of properties and values which will be applied to the element
   */


  function setAttributes(element, attributes) {
    Object.keys(attributes).forEach(function (prop) {
      var value = attributes[prop];

      if (value !== false) {
        element.setAttribute(prop, attributes[prop]);
      } else {
        element.removeAttribute(prop);
      }
    });
  }
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} data.styles - List of style properties - values to apply to popper element
   * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The same data object
   */


  function applyStyle(data) {
    // any property present in `data.styles` will be applied to the popper,
    // in this way we can make the 3rd party modifiers add custom styles to it
    // Be aware, modifiers could override the properties defined in the previous
    // lines of this modifier!
    setStyles(data.instance.popper, data.styles); // any property present in `data.attributes` will be applied to the popper,
    // they will be set as HTML attributes of the element

    setAttributes(data.instance.popper, data.attributes); // if arrowElement is defined and arrowStyles has some properties

    if (data.arrowElement && Object.keys(data.arrowStyles).length) {
      setStyles(data.arrowElement, data.arrowStyles);
    }

    return data;
  }
  /**
   * Set the x-placement attribute before everything else because it could be used
   * to add margins to the popper margins needs to be calculated to get the
   * correct popper offsets.
   * @method
   * @memberof Popper.modifiers
   * @param {HTMLElement} reference - The reference element used to position the popper
   * @param {HTMLElement} popper - The HTML element used as popper
   * @param {Object} options - Popper.js options
   */


  function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
    // compute reference element offsets
    var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); // compute auto placement, store placement inside the data object,
    // modifiers will be able to edit `placement` if needed
    // and refer to originalPlacement to know the original value

    var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
    popper.setAttribute('x-placement', placement); // Apply `position` to popper before anything else because
    // without the position applied we can't guarantee correct computations

    setStyles(popper, {
      position: options.positionFixed ? 'fixed' : 'absolute'
    });
    return options;
  }
  /**
   * @function
   * @memberof Popper.Utils
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Boolean} shouldRound - If the offsets should be rounded at all
   * @returns {Object} The popper's position offsets rounded
   *
   * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
   * good as it can be within reason.
   * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
   *
   * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
   * as well on High DPI screens).
   *
   * Firefox prefers no rounding for positioning and does not have blurriness on
   * high DPI screens.
   *
   * Only horizontal placement and left/right values need to be considered.
   */


  function getRoundedOffsets(data, shouldRound) {
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
    var round = Math.round,
        floor = Math.floor;

    var noRound = function noRound(v) {
      return v;
    };

    var referenceWidth = round(reference.width);
    var popperWidth = round(popper.width);
    var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
    var isVariation = data.placement.indexOf('-') !== -1;
    var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
    var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
    var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
    var verticalToInteger = !shouldRound ? noRound : round;
    return {
      left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
      top: verticalToInteger(popper.top),
      bottom: verticalToInteger(popper.bottom),
      right: horizontalToInteger(popper.right)
    };
  }

  var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */

  function computeStyle(data, options) {
    var x = options.x,
        y = options.y;
    var popper = data.offsets.popper; // Remove this legacy support in Popper.js v2

    var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
      return modifier.name === 'applyStyle';
    }).gpuAcceleration;

    if (legacyGpuAccelerationOption !== undefined) {
      console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
    }

    var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
    var offsetParent = getOffsetParent(data.instance.popper);
    var offsetParentRect = getBoundingClientRect(offsetParent); // Styles

    var styles = {
      position: popper.position
    };
    var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
    var sideA = x === 'bottom' ? 'top' : 'bottom';
    var sideB = y === 'right' ? 'left' : 'right'; // if gpuAcceleration is set to `true` and transform is supported,
    //  we use `translate3d` to apply the position to the popper we
    // automatically use the supported prefixed version if needed

    var prefixedProperty = getSupportedPropertyName('transform'); // now, let's make a step back and look at this code closely (wtf?)
    // If the content of the popper grows once it's been positioned, it
    // may happen that the popper gets misplaced because of the new content
    // overflowing its reference element
    // To avoid this problem, we provide two options (x and y), which allow
    // the consumer to define the offset origin.
    // If we position a popper on top of a reference element, we can set
    // `x` to `top` to make the popper grow towards its top instead of
    // its bottom.

    var left = void 0,
        top = void 0;

    if (sideA === 'bottom') {
      // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
      // and not the bottom of the html element
      if (offsetParent.nodeName === 'HTML') {
        top = -offsetParent.clientHeight + offsets.bottom;
      } else {
        top = -offsetParentRect.height + offsets.bottom;
      }
    } else {
      top = offsets.top;
    }

    if (sideB === 'right') {
      if (offsetParent.nodeName === 'HTML') {
        left = -offsetParent.clientWidth + offsets.right;
      } else {
        left = -offsetParentRect.width + offsets.right;
      }
    } else {
      left = offsets.left;
    }

    if (gpuAcceleration && prefixedProperty) {
      styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
      styles[sideA] = 0;
      styles[sideB] = 0;
      styles.willChange = 'transform';
    } else {
      // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
      var invertTop = sideA === 'bottom' ? -1 : 1;
      var invertLeft = sideB === 'right' ? -1 : 1;
      styles[sideA] = top * invertTop;
      styles[sideB] = left * invertLeft;
      styles.willChange = sideA + ', ' + sideB;
    } // Attributes


    var attributes = {
      'x-placement': data.placement
    }; // Update `data` attributes, styles and arrowStyles

    data.attributes = _extends$2({}, attributes, data.attributes);
    data.styles = _extends$2({}, styles, data.styles);
    data.arrowStyles = _extends$2({}, data.offsets.arrow, data.arrowStyles);
    return data;
  }
  /**
   * Helper used to know if the given modifier depends from another one.<br />
   * It checks if the needed modifier is listed and enabled.
   * @method
   * @memberof Popper.Utils
   * @param {Array} modifiers - list of modifiers
   * @param {String} requestingName - name of requesting modifier
   * @param {String} requestedName - name of requested modifier
   * @returns {Boolean}
   */


  function isModifierRequired(modifiers, requestingName, requestedName) {
    var requesting = find(modifiers, function (_ref) {
      var name = _ref.name;
      return name === requestingName;
    });
    var isRequired = !!requesting && modifiers.some(function (modifier) {
      return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
    });

    if (!isRequired) {
      var _requesting = '`' + requestingName + '`';

      var requested = '`' + requestedName + '`';
      console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
    }

    return isRequired;
  }
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */


  function arrow(data, options) {
    var _data$offsets$arrow; // arrow depends on keepTogether in order to work


    if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
      return data;
    }

    var arrowElement = options.element; // if arrowElement is a string, suppose it's a CSS selector

    if (typeof arrowElement === 'string') {
      arrowElement = data.instance.popper.querySelector(arrowElement); // if arrowElement is not found, don't run the modifier

      if (!arrowElement) {
        return data;
      }
    } else {
      // if the arrowElement isn't a query selector we must check that the
      // provided DOM node is child of its popper node
      if (!data.instance.popper.contains(arrowElement)) {
        console.warn('WARNING: `arrow.element` must be child of its popper element!');
        return data;
      }
    }

    var placement = data.placement.split('-')[0];
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
    var isVertical = ['left', 'right'].indexOf(placement) !== -1;
    var len = isVertical ? 'height' : 'width';
    var sideCapitalized = isVertical ? 'Top' : 'Left';
    var side = sideCapitalized.toLowerCase();
    var altSide = isVertical ? 'left' : 'top';
    var opSide = isVertical ? 'bottom' : 'right';
    var arrowElementSize = getOuterSizes(arrowElement)[len]; //
    // extends keepTogether behavior making sure the popper and its
    // reference have enough pixels in conjunction
    //
    // top/left side

    if (reference[opSide] - arrowElementSize < popper[side]) {
      data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
    } // bottom/right side


    if (reference[side] + arrowElementSize > popper[opSide]) {
      data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
    }

    data.offsets.popper = getClientRect(data.offsets.popper); // compute center of the popper

    var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; // Compute the sideValue using the updated popper offsets
    // take popper margin in account because we don't have this info available

    var css = getStyleComputedProperty(data.instance.popper);
    var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
    var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
    var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; // prevent arrowElement from being placed not contiguously to its popper

    sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
    data.arrowElement = arrowElement;
    data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty$1(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty$1(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
    return data;
  }
  /**
   * Get the opposite placement variation of the given one
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement variation
   * @returns {String} flipped placement variation
   */


  function getOppositeVariation(variation) {
    if (variation === 'end') {
      return 'start';
    } else if (variation === 'start') {
      return 'end';
    }

    return variation;
  }
  /**
   * List of accepted placements to use as values of the `placement` option.<br />
   * Valid placements are:
   * - `auto`
   * - `top`
   * - `right`
   * - `bottom`
   * - `left`
   *
   * Each placement can have a variation from this list:
   * - `-start`
   * - `-end`
   *
   * Variations are interpreted easily if you think of them as the left to right
   * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
   * is right.<br />
   * Vertically (`left` and `right`), `start` is top and `end` is bottom.
   *
   * Some valid examples are:
   * - `top-end` (on top of reference, right aligned)
   * - `right-start` (on right of reference, top aligned)
   * - `bottom` (on bottom, centered)
   * - `auto-end` (on the side with more space available, alignment depends by placement)
   *
   * @static
   * @type {Array}
   * @enum {String}
   * @readonly
   * @method placements
   * @memberof Popper
   */


  var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; // Get rid of `auto` `auto-start` and `auto-end`

  var validPlacements = placements.slice(3);
  /**
   * Given an initial placement, returns all the subsequent placements
   * clockwise (or counter-clockwise).
   *
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement - A valid placement (it accepts variations)
   * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
   * @returns {Array} placements including their variations
   */

  function clockwise(placement) {
    var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
    var index = validPlacements.indexOf(placement);
    var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
    return counter ? arr.reverse() : arr;
  }

  var BEHAVIORS = {
    FLIP: 'flip',
    CLOCKWISE: 'clockwise',
    COUNTERCLOCKWISE: 'counterclockwise'
  };
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */

  function flip(data, options) {
    // if `inner` modifier is enabled, we can't use the `flip` modifier
    if (isModifierEnabled(data.instance.modifiers, 'inner')) {
      return data;
    }

    if (data.flipped && data.placement === data.originalPlacement) {
      // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
      return data;
    }

    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
    var placement = data.placement.split('-')[0];
    var placementOpposite = getOppositePlacement(placement);
    var variation = data.placement.split('-')[1] || '';
    var flipOrder = [];

    switch (options.behavior) {
      case BEHAVIORS.FLIP:
        flipOrder = [placement, placementOpposite];
        break;

      case BEHAVIORS.CLOCKWISE:
        flipOrder = clockwise(placement);
        break;

      case BEHAVIORS.COUNTERCLOCKWISE:
        flipOrder = clockwise(placement, true);
        break;

      default:
        flipOrder = options.behavior;
    }

    flipOrder.forEach(function (step, index) {
      if (placement !== step || flipOrder.length === index + 1) {
        return data;
      }

      placement = data.placement.split('-')[0];
      placementOpposite = getOppositePlacement(placement);
      var popperOffsets = data.offsets.popper;
      var refOffsets = data.offsets.reference; // using floor because the reference offsets may contain decimals we are not going to consider here

      var floor = Math.floor;
      var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
      var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
      var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
      var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
      var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
      var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; // flip the variation if required

      var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; // flips variation if reference element overflows boundaries

      var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); // flips variation if popper content overflows boundaries

      var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
      var flippedVariation = flippedVariationByRef || flippedVariationByContent;

      if (overlapsRef || overflowsBoundaries || flippedVariation) {
        // this boolean to detect any flip loop
        data.flipped = true;

        if (overlapsRef || overflowsBoundaries) {
          placement = flipOrder[index + 1];
        }

        if (flippedVariation) {
          variation = getOppositeVariation(variation);
        }

        data.placement = placement + (variation ? '-' + variation : ''); // this object contains `position`, we want to preserve it along with
        // any additional property we may add in the future

        data.offsets.popper = _extends$2({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
        data = runModifiers(data.instance.modifiers, data, 'flip');
      }
    });
    return data;
  }
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */


  function keepTogether(data) {
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
    var placement = data.placement.split('-')[0];
    var floor = Math.floor;
    var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
    var side = isVertical ? 'right' : 'bottom';
    var opSide = isVertical ? 'left' : 'top';
    var measurement = isVertical ? 'width' : 'height';

    if (popper[side] < floor(reference[opSide])) {
      data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
    }

    if (popper[opSide] > floor(reference[side])) {
      data.offsets.popper[opSide] = floor(reference[side]);
    }

    return data;
  }
  /**
   * Converts a string containing value + unit into a px value number
   * @function
   * @memberof {modifiers~offset}
   * @private
   * @argument {String} str - Value + unit string
   * @argument {String} measurement - `height` or `width`
   * @argument {Object} popperOffsets
   * @argument {Object} referenceOffsets
   * @returns {Number|String}
   * Value in pixels, or original string if no values were extracted
   */


  function toValue(str, measurement, popperOffsets, referenceOffsets) {
    // separate value from unit
    var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
    var value = +split[1];
    var unit = split[2]; // If it's not a number it's an operator, I guess

    if (!value) {
      return str;
    }

    if (unit.indexOf('%') === 0) {
      var element = void 0;

      switch (unit) {
        case '%p':
          element = popperOffsets;
          break;

        case '%':
        case '%r':
        default:
          element = referenceOffsets;
      }

      var rect = getClientRect(element);
      return rect[measurement] / 100 * value;
    } else if (unit === 'vh' || unit === 'vw') {
      // if is a vh or vw, we calculate the size based on the viewport
      var size = void 0;

      if (unit === 'vh') {
        size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
      } else {
        size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
      }

      return size / 100 * value;
    } else {
      // if is an explicit pixel unit, we get rid of the unit and keep the value
      // if is an implicit unit, it's px, and we return just the value
      return value;
    }
  }
  /**
   * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
   * @function
   * @memberof {modifiers~offset}
   * @private
   * @argument {String} offset
   * @argument {Object} popperOffsets
   * @argument {Object} referenceOffsets
   * @argument {String} basePlacement
   * @returns {Array} a two cells array with x and y offsets in numbers
   */


  function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
    var offsets = [0, 0]; // Use height if placement is left or right and index is 0 otherwise use width
    // in this way the first offset will use an axis and the second one
    // will use the other one

    var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; // Split the offset string to obtain a list of values and operands
    // The regex addresses values with the plus or minus sign in front (+10, -20, etc)

    var fragments = offset.split(/(\+|\-)/).map(function (frag) {
      return frag.trim();
    }); // Detect if the offset string contains a pair of values or a single one
    // they could be separated by comma or space

    var divider = fragments.indexOf(find(fragments, function (frag) {
      return frag.search(/,|\s/) !== -1;
    }));

    if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
      console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
    } // If divider is found, we divide the list of values and operands to divide
    // them by ofset X and Y.


    var splitRegex = /\s*,\s*|\s+/;
    var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; // Convert the values with units to absolute pixels to allow our computations

    ops = ops.map(function (op, index) {
      // Most of the units rely on the orientation of the popper
      var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
      var mergeWithPrevious = false;
      return op // This aggregates any `+` or `-` sign that aren't considered operators
      // e.g.: 10 + +5 => [10, +, +5]
      .reduce(function (a, b) {
        if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
          a[a.length - 1] = b;
          mergeWithPrevious = true;
          return a;
        } else if (mergeWithPrevious) {
          a[a.length - 1] += b;
          mergeWithPrevious = false;
          return a;
        } else {
          return a.concat(b);
        }
      }, []) // Here we convert the string values into number values (in px)
      .map(function (str) {
        return toValue(str, measurement, popperOffsets, referenceOffsets);
      });
    }); // Loop trough the offsets arrays and execute the operations

    ops.forEach(function (op, index) {
      op.forEach(function (frag, index2) {
        if (isNumeric(frag)) {
          offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
        }
      });
    });
    return offsets;
  }
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @argument {Number|String} options.offset=0
   * The offset value as described in the modifier description
   * @returns {Object} The data object, properly modified
   */


  function offset(data, _ref) {
    var offset = _ref.offset;
    var placement = data.placement,
        _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
    var basePlacement = placement.split('-')[0];
    var offsets = void 0;

    if (isNumeric(+offset)) {
      offsets = [+offset, 0];
    } else {
      offsets = parseOffset(offset, popper, reference, basePlacement);
    }

    if (basePlacement === 'left') {
      popper.top += offsets[0];
      popper.left -= offsets[1];
    } else if (basePlacement === 'right') {
      popper.top += offsets[0];
      popper.left += offsets[1];
    } else if (basePlacement === 'top') {
      popper.left += offsets[0];
      popper.top -= offsets[1];
    } else if (basePlacement === 'bottom') {
      popper.left += offsets[0];
      popper.top += offsets[1];
    }

    data.popper = popper;
    return data;
  }
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */


  function preventOverflow(data, options) {
    var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); // If offsetParent is the reference element, we really want to
    // go one step up and use the next offsetParent as reference to
    // avoid to make this modifier completely useless and look like broken

    if (data.instance.reference === boundariesElement) {
      boundariesElement = getOffsetParent(boundariesElement);
    } // NOTE: DOM access here
    // resets the popper's position so that the document size can be calculated excluding
    // the size of the popper element itself


    var transformProp = getSupportedPropertyName('transform');
    var popperStyles = data.instance.popper.style; // assignment to help minification

    var top = popperStyles.top,
        left = popperStyles.left,
        transform = popperStyles[transformProp];
    popperStyles.top = '';
    popperStyles.left = '';
    popperStyles[transformProp] = '';
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); // NOTE: DOM access here
    // restores the original style properties after the offsets have been computed

    popperStyles.top = top;
    popperStyles.left = left;
    popperStyles[transformProp] = transform;
    options.boundaries = boundaries;
    var order = options.priority;
    var popper = data.offsets.popper;
    var check = {
      primary: function primary(placement) {
        var value = popper[placement];

        if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
          value = Math.max(popper[placement], boundaries[placement]);
        }

        return defineProperty$1({}, placement, value);
      },
      secondary: function secondary(placement) {
        var mainSide = placement === 'right' ? 'left' : 'top';
        var value = popper[mainSide];

        if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
          value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
        }

        return defineProperty$1({}, mainSide, value);
      }
    };
    order.forEach(function (placement) {
      var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
      popper = _extends$2({}, popper, check[side](placement));
    });
    data.offsets.popper = popper;
    return data;
  }
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */


  function shift(data) {
    var placement = data.placement;
    var basePlacement = placement.split('-')[0];
    var shiftvariation = placement.split('-')[1]; // if shift shiftvariation is specified, run the modifier

    if (shiftvariation) {
      var _data$offsets = data.offsets,
          reference = _data$offsets.reference,
          popper = _data$offsets.popper;
      var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
      var side = isVertical ? 'left' : 'top';
      var measurement = isVertical ? 'width' : 'height';
      var shiftOffsets = {
        start: defineProperty$1({}, side, reference[side]),
        end: defineProperty$1({}, side, reference[side] + reference[measurement] - popper[measurement])
      };
      data.offsets.popper = _extends$2({}, popper, shiftOffsets[shiftvariation]);
    }

    return data;
  }
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */


  function hide(data) {
    if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
      return data;
    }

    var refRect = data.offsets.reference;
    var bound = find(data.instance.modifiers, function (modifier) {
      return modifier.name === 'preventOverflow';
    }).boundaries;

    if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
      // Avoid unnecessary DOM access if visibility hasn't changed
      if (data.hide === true) {
        return data;
      }

      data.hide = true;
      data.attributes['x-out-of-boundaries'] = '';
    } else {
      // Avoid unnecessary DOM access if visibility hasn't changed
      if (data.hide === false) {
        return data;
      }

      data.hide = false;
      data.attributes['x-out-of-boundaries'] = false;
    }

    return data;
  }
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */


  function inner(data) {
    var placement = data.placement;
    var basePlacement = placement.split('-')[0];
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
    var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
    var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
    popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
    data.placement = getOppositePlacement(placement);
    data.offsets.popper = getClientRect(popper);
    return data;
  }
  /**
   * Modifier function, each modifier can have a function of this type assigned
   * to its `fn` property.<br />
   * These functions will be called on each update, this means that you must
   * make sure they are performant enough to avoid performance bottlenecks.
   *
   * @function ModifierFn
   * @argument {dataObject} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {dataObject} The data object, properly modified
   */

  /**
   * Modifiers are plugins used to alter the behavior of your poppers.<br />
   * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
   * needed by the library.
   *
   * Usually you don't want to override the `order`, `fn` and `onLoad` props.
   * All the other properties are configurations that could be tweaked.
   * @namespace modifiers
   */


  var modifiers = {
    /**
     * Modifier used to shift the popper on the start or end of its reference
     * element.<br />
     * It will read the variation of the `placement` property.<br />
     * It can be one either `-end` or `-start`.
     * @memberof modifiers
     * @inner
     */
    shift: {
      /** @prop {number} order=100 - Index used to define the order of execution */
      order: 100,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: shift
    },

    /**
     * The `offset` modifier can shift your popper on both its axis.
     *
     * It accepts the following units:
     * - `px` or unit-less, interpreted as pixels
     * - `%` or `%r`, percentage relative to the length of the reference element
     * - `%p`, percentage relative to the length of the popper element
     * - `vw`, CSS viewport width unit
     * - `vh`, CSS viewport height unit
     *
     * For length is intended the main axis relative to the placement of the popper.<br />
     * This means that if the placement is `top` or `bottom`, the length will be the
     * `width`. In case of `left` or `right`, it will be the `height`.
     *
     * You can provide a single value (as `Number` or `String`), or a pair of values
     * as `String` divided by a comma or one (or more) white spaces.<br />
     * The latter is a deprecated method because it leads to confusion and will be
     * removed in v2.<br />
     * Additionally, it accepts additions and subtractions between different units.
     * Note that multiplications and divisions aren't supported.
     *
     * Valid examples are:
     * ```
     * 10
     * '10%'
     * '10, 10'
     * '10%, 10'
     * '10 + 10%'
     * '10 - 5vh + 3%'
     * '-10px + 5vh, 5px - 6%'
     * ```
     * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
     * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
     * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
     *
     * @memberof modifiers
     * @inner
     */
    offset: {
      /** @prop {number} order=200 - Index used to define the order of execution */
      order: 200,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: offset,

      /** @prop {Number|String} offset=0
       * The offset value as described in the modifier description
       */
      offset: 0
    },

    /**
     * Modifier used to prevent the popper from being positioned outside the boundary.
     *
     * A scenario exists where the reference itself is not within the boundaries.<br />
     * We can say it has "escaped the boundaries" — or just "escaped".<br />
     * In this case we need to decide whether the popper should either:
     *
     * - detach from the reference and remain "trapped" in the boundaries, or
     * - if it should ignore the boundary and "escape with its reference"
     *
     * When `escapeWithReference` is set to`true` and reference is completely
     * outside its boundaries, the popper will overflow (or completely leave)
     * the boundaries in order to remain attached to the edge of the reference.
     *
     * @memberof modifiers
     * @inner
     */
    preventOverflow: {
      /** @prop {number} order=300 - Index used to define the order of execution */
      order: 300,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: preventOverflow,

      /**
       * @prop {Array} [priority=['left','right','top','bottom']]
       * Popper will try to prevent overflow following these priorities by default,
       * then, it could overflow on the left and on top of the `boundariesElement`
       */
      priority: ['left', 'right', 'top', 'bottom'],

      /**
       * @prop {number} padding=5
       * Amount of pixel used to define a minimum distance between the boundaries
       * and the popper. This makes sure the popper always has a little padding
       * between the edges of its container
       */
      padding: 5,

      /**
       * @prop {String|HTMLElement} boundariesElement='scrollParent'
       * Boundaries used by the modifier. Can be `scrollParent`, `window`,
       * `viewport` or any DOM element.
       */
      boundariesElement: 'scrollParent'
    },

    /**
     * Modifier used to make sure the reference and its popper stay near each other
     * without leaving any gap between the two. Especially useful when the arrow is
     * enabled and you want to ensure that it points to its reference element.
     * It cares only about the first axis. You can still have poppers with margin
     * between the popper and its reference element.
     * @memberof modifiers
     * @inner
     */
    keepTogether: {
      /** @prop {number} order=400 - Index used to define the order of execution */
      order: 400,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: keepTogether
    },

    /**
     * This modifier is used to move the `arrowElement` of the popper to make
     * sure it is positioned between the reference element and its popper element.
     * It will read the outer size of the `arrowElement` node to detect how many
     * pixels of conjunction are needed.
     *
     * It has no effect if no `arrowElement` is provided.
     * @memberof modifiers
     * @inner
     */
    arrow: {
      /** @prop {number} order=500 - Index used to define the order of execution */
      order: 500,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: arrow,

      /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
      element: '[x-arrow]'
    },

    /**
     * Modifier used to flip the popper's placement when it starts to overlap its
     * reference element.
     *
     * Requires the `preventOverflow` modifier before it in order to work.
     *
     * **NOTE:** this modifier will interrupt the current update cycle and will
     * restart it if it detects the need to flip the placement.
     * @memberof modifiers
     * @inner
     */
    flip: {
      /** @prop {number} order=600 - Index used to define the order of execution */
      order: 600,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: flip,

      /**
       * @prop {String|Array} behavior='flip'
       * The behavior used to change the popper's placement. It can be one of
       * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
       * placements (with optional variations)
       */
      behavior: 'flip',

      /**
       * @prop {number} padding=5
       * The popper will flip if it hits the edges of the `boundariesElement`
       */
      padding: 5,

      /**
       * @prop {String|HTMLElement} boundariesElement='viewport'
       * The element which will define the boundaries of the popper position.
       * The popper will never be placed outside of the defined boundaries
       * (except if `keepTogether` is enabled)
       */
      boundariesElement: 'viewport',

      /**
       * @prop {Boolean} flipVariations=false
       * The popper will switch placement variation between `-start` and `-end` when
       * the reference element overlaps its boundaries.
       *
       * The original placement should have a set variation.
       */
      flipVariations: false,

      /**
       * @prop {Boolean} flipVariationsByContent=false
       * The popper will switch placement variation between `-start` and `-end` when
       * the popper element overlaps its reference boundaries.
       *
       * The original placement should have a set variation.
       */
      flipVariationsByContent: false
    },

    /**
     * Modifier used to make the popper flow toward the inner of the reference element.
     * By default, when this modifier is disabled, the popper will be placed outside
     * the reference element.
     * @memberof modifiers
     * @inner
     */
    inner: {
      /** @prop {number} order=700 - Index used to define the order of execution */
      order: 700,

      /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
      enabled: false,

      /** @prop {ModifierFn} */
      fn: inner
    },

    /**
     * Modifier used to hide the popper when its reference element is outside of the
     * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
     * be used to hide with a CSS selector the popper when its reference is
     * out of boundaries.
     *
     * Requires the `preventOverflow` modifier before it in order to work.
     * @memberof modifiers
     * @inner
     */
    hide: {
      /** @prop {number} order=800 - Index used to define the order of execution */
      order: 800,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: hide
    },

    /**
     * Computes the style that will be applied to the popper element to gets
     * properly positioned.
     *
     * Note that this modifier will not touch the DOM, it just prepares the styles
     * so that `applyStyle` modifier can apply it. This separation is useful
     * in case you need to replace `applyStyle` with a custom implementation.
     *
     * This modifier has `850` as `order` value to maintain backward compatibility
     * with previous versions of Popper.js. Expect the modifiers ordering method
     * to change in future major versions of the library.
     *
     * @memberof modifiers
     * @inner
     */
    computeStyle: {
      /** @prop {number} order=850 - Index used to define the order of execution */
      order: 850,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: computeStyle,

      /**
       * @prop {Boolean} gpuAcceleration=true
       * If true, it uses the CSS 3D transformation to position the popper.
       * Otherwise, it will use the `top` and `left` properties
       */
      gpuAcceleration: true,

      /**
       * @prop {string} [x='bottom']
       * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
       * Change this if your popper should grow in a direction different from `bottom`
       */
      x: 'bottom',

      /**
       * @prop {string} [x='left']
       * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
       * Change this if your popper should grow in a direction different from `right`
       */
      y: 'right'
    },

    /**
     * Applies the computed styles to the popper element.
     *
     * All the DOM manipulations are limited to this modifier. This is useful in case
     * you want to integrate Popper.js inside a framework or view library and you
     * want to delegate all the DOM manipulations to it.
     *
     * Note that if you disable this modifier, you must make sure the popper element
     * has its position set to `absolute` before Popper.js can do its work!
     *
     * Just disable this modifier and define your own to achieve the desired effect.
     *
     * @memberof modifiers
     * @inner
     */
    applyStyle: {
      /** @prop {number} order=900 - Index used to define the order of execution */
      order: 900,

      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,

      /** @prop {ModifierFn} */
      fn: applyStyle,

      /** @prop {Function} */
      onLoad: applyStyleOnLoad,

      /**
       * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
       * @prop {Boolean} gpuAcceleration=true
       * If true, it uses the CSS 3D transformation to position the popper.
       * Otherwise, it will use the `top` and `left` properties
       */
      gpuAcceleration: undefined
    }
  };
  /**
   * The `dataObject` is an object containing all the information used by Popper.js.
   * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
   * @name dataObject
   * @property {Object} data.instance The Popper.js instance
   * @property {String} data.placement Placement applied to popper
   * @property {String} data.originalPlacement Placement originally defined on init
   * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
   * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
   * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
   * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
   * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
   * @property {Object} data.boundaries Offsets of the popper boundaries
   * @property {Object} data.offsets The measurements of popper, reference and arrow elements
   * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
   * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
   * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
   */

  /**
   * Default options provided to Popper.js constructor.<br />
   * These can be overridden using the `options` argument of Popper.js.<br />
   * To override an option, simply pass an object with the same
   * structure of the `options` object, as the 3rd argument. For example:
   * ```
   * new Popper(ref, pop, {
   *   modifiers: {
   *     preventOverflow: { enabled: false }
   *   }
   * })
   * ```
   * @type {Object}
   * @static
   * @memberof Popper
   */

  var Defaults = {
    /**
     * Popper's placement.
     * @prop {Popper.placements} placement='bottom'
     */
    placement: 'bottom',

    /**
     * Set this to true if you want popper to position it self in 'fixed' mode
     * @prop {Boolean} positionFixed=false
     */
    positionFixed: false,

    /**
     * Whether events (resize, scroll) are initially enabled.
     * @prop {Boolean} eventsEnabled=true
     */
    eventsEnabled: true,

    /**
     * Set to true if you want to automatically remove the popper when
     * you call the `destroy` method.
     * @prop {Boolean} removeOnDestroy=false
     */
    removeOnDestroy: false,

    /**
     * Callback called when the popper is created.<br />
     * By default, it is set to no-op.<br />
     * Access Popper.js instance with `data.instance`.
     * @prop {onCreate}
     */
    onCreate: function onCreate() {},

    /**
     * Callback called when the popper is updated. This callback is not called
     * on the initialization/creation of the popper, but only on subsequent
     * updates.<br />
     * By default, it is set to no-op.<br />
     * Access Popper.js instance with `data.instance`.
     * @prop {onUpdate}
     */
    onUpdate: function onUpdate() {},

    /**
     * List of modifiers used to modify the offsets before they are applied to the popper.
     * They provide most of the functionalities of Popper.js.
     * @prop {modifiers}
     */
    modifiers: modifiers
  };
  /**
   * @callback onCreate
   * @param {dataObject} data
   */

  /**
   * @callback onUpdate
   * @param {dataObject} data
   */
  // Utils
  // Methods

  var Popper = function () {
    /**
     * Creates a new Popper.js instance.
     * @class Popper
     * @param {Element|referenceObject} reference - The reference element used to position the popper
     * @param {Element} popper - The HTML / XML element used as the popper
     * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
     * @return {Object} instance - The generated Popper.js instance
     */
    function Popper(reference, popper) {
      var _this = this;

      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      classCallCheck(this, Popper);

      this.scheduleUpdate = function () {
        return requestAnimationFrame(_this.update);
      }; // make update() debounced, so that it only runs at most once-per-tick


      this.update = debounce(this.update.bind(this)); // with {} we create a new object with the options inside it

      this.options = _extends$2({}, Popper.Defaults, options); // init state

      this.state = {
        isDestroyed: false,
        isCreated: false,
        scrollParents: []
      }; // get reference and popper elements (allow jQuery wrappers)

      this.reference = reference && reference.jquery ? reference[0] : reference;
      this.popper = popper && popper.jquery ? popper[0] : popper; // Deep merge modifiers options

      this.options.modifiers = {};
      Object.keys(_extends$2({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
        _this.options.modifiers[name] = _extends$2({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
      }); // Refactoring modifiers' list (Object => Array)

      this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
        return _extends$2({
          name: name
        }, _this.options.modifiers[name]);
      }) // sort the modifiers by order
      .sort(function (a, b) {
        return a.order - b.order;
      }); // modifiers have the ability to execute arbitrary code when Popper.js get inited
      // such code is executed in the same order of its modifier
      // they could add new properties to their options configuration
      // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!

      this.modifiers.forEach(function (modifierOptions) {
        if (modifierOptions.enabled && isFunction$2(modifierOptions.onLoad)) {
          modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
        }
      }); // fire the first update to position the popper in the right place

      this.update();
      var eventsEnabled = this.options.eventsEnabled;

      if (eventsEnabled) {
        // setup event listeners, they will take care of update the position in specific situations
        this.enableEventListeners();
      }

      this.state.eventsEnabled = eventsEnabled;
    } // We can't use class properties because they don't get listed in the
    // class prototype and break stuff like Sinon stubs


    createClass(Popper, [{
      key: 'update',
      value: function update$$1() {
        return update.call(this);
      }
    }, {
      key: 'destroy',
      value: function destroy$$1() {
        return destroy.call(this);
      }
    }, {
      key: 'enableEventListeners',
      value: function enableEventListeners$$1() {
        return enableEventListeners.call(this);
      }
    }, {
      key: 'disableEventListeners',
      value: function disableEventListeners$$1() {
        return disableEventListeners.call(this);
      }
      /**
       * Schedules an update. It will run on the next UI update available.
       * @method scheduleUpdate
       * @memberof Popper
       */

      /**
       * Collection of utilities useful when writing custom modifiers.
       * Starting from version 1.7, this method is available only if you
       * include `popper-utils.js` before `popper.js`.
       *
       * **DEPRECATION**: This way to access PopperUtils is deprecated
       * and will be removed in v2! Use the PopperUtils module directly instead.
       * Due to the high instability of the methods contained in Utils, we can't
       * guarantee them to follow semver. Use them at your own risk!
       * @static
       * @private
       * @type {Object}
       * @deprecated since version 1.8
       * @member Utils
       * @memberof Popper
       */

    }]);
    return Popper;
  }();
  /**
   * The `referenceObject` is an object that provides an interface compatible with Popper.js
   * and lets you use it as replacement of a real DOM node.<br />
   * You can use this method to position a popper relatively to a set of coordinates
   * in case you don't have a DOM node to use as reference.
   *
   * ```
   * new Popper(referenceObject, popperNode);
   * ```
   *
   * NB: This feature isn't supported in Internet Explorer 10.
   * @name referenceObject
   * @property {Function} data.getBoundingClientRect
   * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
   * @property {number} data.clientWidth
   * An ES6 getter that will return the width of the virtual reference element.
   * @property {number} data.clientHeight
   * An ES6 getter that will return the height of the virtual reference element.
   */


  Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  Popper.placements = placements;
  Popper.Defaults = Defaults;

  function _classCallCheck$1(instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  }

  function _defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }

  function _createClass(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    if (staticProps) _defineProperties(Constructor, staticProps);
    Object.defineProperty(Constructor, "prototype", {
      writable: false
    });
    return Constructor;
  }
  var BvEvent = /*#__PURE__*/function () {
    function BvEvent(type) {
      var eventInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

      _classCallCheck$1(this, BvEvent); // Start by emulating native Event constructor


      if (!type) {
        /* istanbul ignore next */
        throw new TypeError("Failed to construct '".concat(this.constructor.name, "'. 1 argument required, ").concat(arguments.length, " given."));
      } // Merge defaults first, the eventInit, and the type last
      // so it can't be overwritten


      assign(this, BvEvent.Defaults, this.constructor.Defaults, eventInit, {
        type: type
      }); // Freeze some props as readonly, but leave them enumerable

      defineProperties(this, {
        type: readonlyDescriptor(),
        cancelable: readonlyDescriptor(),
        nativeEvent: readonlyDescriptor(),
        target: readonlyDescriptor(),
        relatedTarget: readonlyDescriptor(),
        vueTarget: readonlyDescriptor(),
        componentId: readonlyDescriptor()
      }); // Create a private variable using closure scoping

      var defaultPrevented = false; // Recreate preventDefault method. One way setter

      this.preventDefault = function preventDefault() {
        if (this.cancelable) {
          defaultPrevented = true;
        }
      }; // Create `defaultPrevented` publicly accessible prop that
      // can only be altered by the preventDefault method


      defineProperty(this, 'defaultPrevented', {
        enumerable: true,
        get: function get() {
          return defaultPrevented;
        }
      });
    }

    _createClass(BvEvent, null, [{
      key: "Defaults",
      get: function get() {
        return {
          type: '',
          cancelable: true,
          nativeEvent: null,
          target: null,
          relatedTarget: null,
          vueTarget: null,
          componentId: null
        };
      }
    }]);

    return BvEvent;
  }();

  var registry = null;

  if (isVue3) {
    registry = new WeakMap();
  }
  var getInstanceFromElement = function getInstanceFromElement(element) {
    if (!isVue3) {
      return element.__vue__;
    }

    var currentElement = element;

    while (currentElement) {
      if (registry.has(currentElement)) {
        /* istanbul ignore next */
        return registry.get(currentElement);
      }

      currentElement = currentElement.parentNode;
    }

    return null;
  };

  // @vue/component

  var useParentMixin = extend$2({
    computed: {
      bvParent: function bvParent() {
        return this.$parent || this.$root === this && this.$options.bvParent;
      }
    }
  });

  // This method returns a component's scoped style attribute name: `data-v-xxxxxxx`
  // The `_scopeId` options property is added by vue-loader when using scoped styles
  // and will be `undefined` if no scoped styles are in use
  var getScopeId = function getScopeId(vm) {
    var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
    return vm ? vm.$options._scopeId || defaultValue : defaultValue;
  };

  function _defineProperty$8(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  var scopedStyleMixin = extend$2({
    mixins: [useParentMixin],
    computed: {
      scopedStyleAttrs: function scopedStyleAttrs() {
        var scopeId = getScopeId(this.bvParent);
        return scopeId ? _defineProperty$8({}, scopeId, '') : {};
      }
    }
  });

  function ownKeys$8(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$6(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) {
        _defineProperty$9(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$9(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  var createNewChildComponent = function createNewChildComponent(parent, Component) {
    var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    var bvEventRoot = parent.$root ? parent.$root.$options.bvEventRoot || parent.$root : null;
    return new Component(_objectSpread$6(_objectSpread$6({}, config), {}, {
      parent: parent,
      bvParent: parent,
      bvEventRoot: bvEventRoot
    }));
  };

  // Base on-demand component for tooltip / popover templates

  var AttachmentMap = {
    AUTO: 'auto',
    TOP: 'top',
    RIGHT: 'right',
    BOTTOM: 'bottom',
    LEFT: 'left',
    TOPLEFT: 'top',
    TOPRIGHT: 'top',
    RIGHTTOP: 'right',
    RIGHTBOTTOM: 'right',
    BOTTOMLEFT: 'bottom',
    BOTTOMRIGHT: 'bottom',
    LEFTTOP: 'left',
    LEFTBOTTOM: 'left'
  };
  var OffsetMap = {
    AUTO: 0,
    TOPLEFT: -1,
    TOP: 0,
    TOPRIGHT: +1,
    RIGHTTOP: -1,
    RIGHT: 0,
    RIGHTBOTTOM: +1,
    BOTTOMLEFT: -1,
    BOTTOM: 0,
    BOTTOMRIGHT: +1,
    LEFTTOP: -1,
    LEFT: 0,
    LEFTBOTTOM: +1
  }; // --- Props ---

  var props$2 = {
    // The minimum distance (in `px`) from the edge of the
    // tooltip/popover that the arrow can be positioned
    arrowPadding: makeProp(PROP_TYPE_NUMBER_STRING, 6),
    // 'scrollParent', 'viewport', 'window', or `Element`
    boundary: makeProp([HTMLElement, PROP_TYPE_STRING], 'scrollParent'),
    // Tooltip/popover will try and stay away from
    // boundary edge by this many pixels
    boundaryPadding: makeProp(PROP_TYPE_NUMBER_STRING, 5),
    fallbackPlacement: makeProp(PROP_TYPE_ARRAY_STRING, 'flip'),
    offset: makeProp(PROP_TYPE_NUMBER_STRING, 0),
    placement: makeProp(PROP_TYPE_STRING, 'top'),
    // Element that the tooltip/popover is positioned relative to
    target: makeProp([HTMLElement, SVGElement])
  }; // --- Main component ---
  // @vue/component

  var BVPopper = /*#__PURE__*/extend$2({
    name: NAME_POPPER,
    mixins: [useParentMixin],
    props: props$2,
    data: function data() {
      return {
        // reactive props set by parent
        noFade: false,
        // State related data
        localShow: true,
        attachment: this.getAttachment(this.placement)
      };
    },
    computed: {
      /* istanbul ignore next */
      templateType: function templateType() {
        // Overridden by template component
        return 'unknown';
      },
      popperConfig: function popperConfig() {
        var _this = this;

        var placement = this.placement;
        return {
          placement: this.getAttachment(placement),
          modifiers: {
            offset: {
              offset: this.getOffset(placement)
            },
            flip: {
              behavior: this.fallbackPlacement
            },
            // `arrow.element` can also be a reference to an HTML Element
            // maybe we should make this a `$ref` in the templates?
            arrow: {
              element: '.arrow'
            },
            preventOverflow: {
              padding: this.boundaryPadding,
              boundariesElement: this.boundary
            }
          },
          onCreate: function onCreate(data) {
            // Handle flipping arrow classes
            if (data.originalPlacement !== data.placement) {
              /* istanbul ignore next: can't test in JSDOM */
              _this.popperPlacementChange(data);
            }
          },
          onUpdate: function onUpdate(data) {
            // Handle flipping arrow classes
            _this.popperPlacementChange(data);
          }
        };
      }
    },
    created: function created() {
      var _this2 = this; // Note: We are created on-demand, and should be guaranteed that
      // DOM is rendered/ready by the time the created hook runs


      this.$_popper = null; // Ensure we show as we mount

      this.localShow = true; // Create popper instance before shown

      this.$on(EVENT_NAME_SHOW, function (el) {
        _this2.popperCreate(el);
      }); // Self destruct handler

      var handleDestroy = function handleDestroy() {
        _this2.$nextTick(function () {
          // In a `requestAF()` to release control back to application
          requestAF(function () {
            _this2.$destroy();
          });
        });
      }; // Self destruct if parent destroyed


      this.bvParent.$once(HOOK_EVENT_NAME_DESTROYED, handleDestroy); // Self destruct after hidden

      this.$once(EVENT_NAME_HIDDEN, handleDestroy);
    },
    beforeMount: function beforeMount() {
      // Ensure that the attachment position is correct before mounting
      // as our propsData is added after `new Template({...})`
      this.attachment = this.getAttachment(this.placement);
    },
    updated: function updated() {
      // Update popper if needed
      // TODO: Should this be a watcher on `this.popperConfig` instead?
      this.updatePopper();
    },
    beforeDestroy: function beforeDestroy() {
      this.destroyPopper();
    },
    destroyed: function destroyed() {
      // Make sure template is removed from DOM
      var el = this.$el;
      el && el.parentNode && el.parentNode.removeChild(el);
    },
    methods: {
      // "Public" method to trigger hide template
      hide: function hide() {
        this.localShow = false;
      },
      // Private
      getAttachment: function getAttachment(placement) {
        return AttachmentMap[String(placement).toUpperCase()] || 'auto';
      },
      getOffset: function getOffset(placement) {
        if (!this.offset) {
          // Could set a ref for the arrow element
          var arrow = this.$refs.arrow || select('.arrow', this.$el);
          var arrowOffset = toFloat(getCS(arrow).width, 0) + toFloat(this.arrowPadding, 0);

          switch (OffsetMap[String(placement).toUpperCase()] || 0) {
            /* istanbul ignore next: can't test in JSDOM */
            case +1:
              /* istanbul ignore next: can't test in JSDOM */
              return "+50%p - ".concat(arrowOffset, "px");

            /* istanbul ignore next: can't test in JSDOM */

            case -1:
              /* istanbul ignore next: can't test in JSDOM */
              return "-50%p + ".concat(arrowOffset, "px");

            default:
              return 0;
          }
        }
        /* istanbul ignore next */


        return this.offset;
      },
      popperCreate: function popperCreate(el) {
        this.destroyPopper(); // We use `el` rather than `this.$el` just in case the original
        // mountpoint root element type was changed by the template

        this.$_popper = new Popper(this.target, el, this.popperConfig);
      },
      destroyPopper: function destroyPopper() {
        this.$_popper && this.$_popper.destroy();
        this.$_popper = null;
      },
      updatePopper: function updatePopper() {
        this.$_popper && this.$_popper.scheduleUpdate();
      },
      popperPlacementChange: function popperPlacementChange(data) {
        // Callback used by popper to adjust the arrow placement
        this.attachment = this.getAttachment(data.placement);
      },

      /* istanbul ignore next */
      renderTemplate: function renderTemplate(h) {
        // Will be overridden by templates
        return h('div');
      }
    },
    render: function render(h) {
      var _this3 = this;

      var noFade = this.noFade; // Note: 'show' and 'fade' classes are only appled during transition

      return h(BVTransition, {
        // Transitions as soon as mounted
        props: {
          appear: true,
          noFade: noFade
        },
        on: {
          // Events used by parent component/instance
          beforeEnter: function beforeEnter(el) {
            return _this3.$emit(EVENT_NAME_SHOW, el);
          },
          afterEnter: function afterEnter(el) {
            return _this3.$emit(EVENT_NAME_SHOWN, el);
          },
          beforeLeave: function beforeLeave(el) {
            return _this3.$emit(EVENT_NAME_HIDE, el);
          },
          afterLeave: function afterLeave(el) {
            return _this3.$emit(EVENT_NAME_HIDDEN, el);
          }
        }
      }, [this.localShow ? this.renderTemplate(h) : h()]);
    }
  });

  function ownKeys$9(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$7(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$9(Object(source), !0).forEach(function (key) {
        _defineProperty$a(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$9(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$a(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  var props$3 = {
    // Used only by the directive versions
    html: makeProp(PROP_TYPE_BOOLEAN, false),
    // Other non-reactive (while open) props are pulled in from BVPopper
    id: makeProp(PROP_TYPE_STRING)
  }; // --- Main component ---
  // @vue/component

  var BVTooltipTemplate = /*#__PURE__*/extend$2({
    name: NAME_TOOLTIP_TEMPLATE,
    extends: BVPopper,
    mixins: [scopedStyleMixin],
    props: props$3,
    data: function data() {
      // We use data, rather than props to ensure reactivity
      // Parent component will directly set this data
      return {
        title: '',
        content: '',
        variant: null,
        customClass: null,
        interactive: true
      };
    },
    computed: {
      templateType: function templateType() {
        return 'tooltip';
      },
      templateClasses: function templateClasses() {
        var _ref;

        var variant = this.variant,
            attachment = this.attachment,
            templateType = this.templateType;
        return [(_ref = {
          // Disables pointer events to hide the tooltip when the user
          // hovers over its content
          noninteractive: !this.interactive
        }, _defineProperty$a(_ref, "b-".concat(templateType, "-").concat(variant), variant), _defineProperty$a(_ref, "bs-".concat(templateType, "-").concat(attachment), attachment), _ref), this.customClass];
      },
      templateAttributes: function templateAttributes() {
        var id = this.id;
        return _objectSpread$7(_objectSpread$7({}, this.bvParent.bvParent.$attrs), {}, {
          id: id,
          role: 'tooltip',
          tabindex: '-1'
        }, this.scopedStyleAttrs);
      },
      templateListeners: function templateListeners() {
        var _this = this; // Used for hover/focus trigger listeners


        return {
          mouseenter:
          /* istanbul ignore next */
          function mouseenter(event) {
            _this.$emit(EVENT_NAME_MOUSEENTER, event);
          },
          mouseleave:
          /* istanbul ignore next */
          function mouseleave(event) {
            _this.$emit(EVENT_NAME_MOUSELEAVE, event);
          },
          focusin:
          /* istanbul ignore next */
          function focusin(event) {
            _this.$emit(EVENT_NAME_FOCUSIN, event);
          },
          focusout:
          /* istanbul ignore next */
          function focusout(event) {
            _this.$emit(EVENT_NAME_FOCUSOUT, event);
          }
        };
      }
    },
    methods: {
      renderTemplate: function renderTemplate(h) {
        var title = this.title; // Title can be a scoped slot function

        var $title = isFunction$1(title) ? title({}) : title; // Directive versions only

        var domProps = this.html && !isFunction$1(title) ? {
          innerHTML: title
        } : {};
        return h('div', {
          staticClass: 'tooltip b-tooltip',
          class: this.templateClasses,
          attrs: this.templateAttributes,
          on: this.templateListeners
        }, [h('div', {
          staticClass: 'arrow',
          ref: 'arrow'
        }), h('div', {
          staticClass: 'tooltip-inner',
          domProps: domProps
        }, [$title])]);
      }
    }
  });

  function ownKeys$a(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$8(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$a(Object(source), !0).forEach(function (key) {
        _defineProperty$b(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$a(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$b(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  } // Tooltip "Class" (Built as a renderless Vue instance)
  // Modal container selector for appending tooltip/popover

  var MODAL_SELECTOR = '.modal-content'; // Modal `$root` hidden event

  var ROOT_EVENT_NAME_MODAL_HIDDEN = getRootEventName(NAME_MODAL, EVENT_NAME_HIDDEN); // Sidebar container selector for appending tooltip/popover

  var SIDEBAR_SELECTOR = '.b-sidebar'; // For finding the container to append to

  var CONTAINER_SELECTOR = [MODAL_SELECTOR, SIDEBAR_SELECTOR].join(', '); // For dropdown sniffing

  var DROPDOWN_CLASS = 'dropdown';
  var DROPDOWN_OPEN_SELECTOR = '.dropdown-menu.show'; // Data attribute to temporary store the `title` attribute's value

  var DATA_TITLE_ATTR = 'data-original-title'; // Data specific to popper and template
  // We don't use props, as we need reactivity (we can't pass reactive props)

  var templateData = {
    // Text string or Scoped slot function
    title: '',
    // Text string or Scoped slot function
    content: '',
    // String
    variant: null,
    // String, Array, Object
    customClass: null,
    // String or array of Strings (overwritten by BVPopper)
    triggers: '',
    // String (overwritten by BVPopper)
    placement: 'auto',
    // String or array of strings
    fallbackPlacement: 'flip',
    // Element or Component reference (or function that returns element) of
    // the element that will have the trigger events bound, and is also
    // default element for positioning
    target: null,
    // HTML ID, Element or Component reference
    container: null,
    // 'body'
    // Boolean
    noFade: false,
    // 'scrollParent', 'viewport', 'window', Element, or Component reference
    boundary: 'scrollParent',
    // Tooltip/popover will try and stay away from
    // boundary edge by this many pixels (Number)
    boundaryPadding: 5,
    // Arrow offset (Number)
    offset: 0,
    // Hover/focus delay (Number or Object)
    delay: 0,
    // Arrow of Tooltip/popover will try and stay away from
    // the edge of tooltip/popover edge by this many pixels
    arrowPadding: 6,
    // Interactive state (Boolean)
    interactive: true,
    // Disabled state (Boolean)
    disabled: false,
    // ID to use for tooltip/popover
    id: null,
    // Flag used by directives only, for HTML content
    html: false
  }; // --- Main component ---
  // @vue/component

  var BVTooltip = /*#__PURE__*/extend$2({
    name: NAME_TOOLTIP_HELPER,
    mixins: [listenOnRootMixin, useParentMixin],
    data: function data() {
      return _objectSpread$8(_objectSpread$8({}, templateData), {}, {
        // State management data
        activeTrigger: {
          // manual: false,
          hover: false,
          click: false,
          focus: false
        },
        localShow: false
      });
    },
    computed: {
      templateType: function templateType() {
        // Overwritten by BVPopover
        return 'tooltip';
      },
      computedId: function computedId() {
        return this.id || "__bv_".concat(this.templateType, "_").concat(this[COMPONENT_UID_KEY], "__");
      },
      computedDelay: function computedDelay() {
        // Normalizes delay into object form
        var delay = {
          show: 0,
          hide: 0
        };

        if (isPlainObject$1(this.delay)) {
          delay.show = mathMax(toInteger(this.delay.show, 0), 0);
          delay.hide = mathMax(toInteger(this.delay.hide, 0), 0);
        } else if (isNumber$1(this.delay) || isString$1(this.delay)) {
          delay.show = delay.hide = mathMax(toInteger(this.delay, 0), 0);
        }

        return delay;
      },
      computedTriggers: function computedTriggers() {
        // Returns the triggers in sorted array form
        // TODO: Switch this to object form for easier lookup
        return concat$1(this.triggers).filter(identity$1).join(' ').trim().toLowerCase().split(/\s+/).sort();
      },
      isWithActiveTrigger: function isWithActiveTrigger() {
        for (var trigger in this.activeTrigger) {
          if (this.activeTrigger[trigger]) {
            return true;
          }
        }

        return false;
      },
      computedTemplateData: function computedTemplateData() {
        var title = this.title,
            content = this.content,
            variant = this.variant,
            customClass = this.customClass,
            noFade = this.noFade,
            interactive = this.interactive;
        return {
          title: title,
          content: content,
          variant: variant,
          customClass: customClass,
          noFade: noFade,
          interactive: interactive
        };
      }
    },
    watch: {
      computedTriggers: function computedTriggers(newTriggers, oldTriggers) {
        var _this = this; // Triggers have changed, so re-register them

        /* istanbul ignore next */


        if (!looseEqual$1(newTriggers, oldTriggers)) {
          this.$nextTick(function () {
            // Disable trigger listeners
            _this.unListen(); // Clear any active triggers that are no longer in the list of triggers


            oldTriggers.forEach(function (trigger) {
              if (!arrayIncludes(newTriggers, trigger)) {
                if (_this.activeTrigger[trigger]) {
                  _this.activeTrigger[trigger] = false;
                }
              }
            }); // Re-enable the trigger listeners

            _this.listen();
          });
        }
      },
      computedTemplateData: function computedTemplateData() {
        // If any of the while open reactive "props" change,
        // ensure that the template updates accordingly
        this.handleTemplateUpdate();
      },
      title: function title(newValue, oldValue) {
        // Make sure to hide the tooltip when the title is set empty
        if (newValue !== oldValue && !newValue) {
          this.hide();
        }
      },
      disabled: function disabled(newValue) {
        if (newValue) {
          this.disable();
        } else {
          this.enable();
        }
      }
    },
    created: function created() {
      var _this2 = this; // Create non-reactive properties


      this.$_tip = null;
      this.$_hoverTimeout = null;
      this.$_hoverState = '';
      this.$_visibleInterval = null;
      this.$_enabled = !this.disabled;
      this.$_noop = noop$1.bind(this); // Destroy ourselves when the parent is destroyed

      if (this.bvParent) {
        this.bvParent.$once(HOOK_EVENT_NAME_BEFORE_DESTROY, function () {
          _this2.$nextTick(function () {
            // In a `requestAF()` to release control back to application
            requestAF(function () {
              _this2.$destroy();
            });
          });
        });
      }

      this.$nextTick(function () {
        var target = _this2.getTarget();

        if (target && contains(document.body, target)) {
          // Copy the parent's scoped style attribute
          _this2.scopeId = getScopeId(_this2.bvParent); // Set up all trigger handlers and listeners

          _this2.listen();
        } else {
          /* istanbul ignore next */
          warn$1(isString$1(_this2.target) ? "Unable to find target element by ID \"#".concat(_this2.target, "\" in document.") : 'The provided target is no valid HTML element.', _this2.templateType);
        }
      });
    },

    /* istanbul ignore next */
    updated: function updated() {
      // Usually called when the slots/data changes
      this.$nextTick(this.handleTemplateUpdate);
    },

    /* istanbul ignore next */
    deactivated: function deactivated() {
      // In a keepalive that has been deactivated, so hide
      // the tooltip/popover if it is showing
      this.forceHide();
    },
    beforeDestroy: function beforeDestroy() {
      // Remove all handler/listeners
      this.unListen();
      this.setWhileOpenListeners(false); // Clear any timeouts/intervals

      this.clearHoverTimeout();
      this.clearVisibilityInterval(); // Destroy the template

      this.destroyTemplate(); // Remove any other private properties created during create

      this.$_noop = null;
    },
    methods: {
      // --- Methods for creating and destroying the template ---
      getTemplate: function getTemplate() {
        // Overridden by BVPopover
        return BVTooltipTemplate;
      },
      updateData: function updateData() {
        var _this3 = this;

        var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Method for updating popper/template data
        // We only update data if it exists, and has not changed

        var titleUpdated = false;
        keys(templateData).forEach(function (prop) {
          if (!isUndefined$1(data[prop]) && _this3[prop] !== data[prop]) {
            _this3[prop] = data[prop];

            if (prop === 'title') {
              titleUpdated = true;
            }
          }
        }); // If the title has updated, we may need to handle the `title`
        // attribute on the trigger target
        // We only do this while the template is open

        if (titleUpdated && this.localShow) {
          this.fixTitle();
        }
      },
      createTemplateAndShow: function createTemplateAndShow() {
        // Creates the template instance and show it
        var container = this.getContainer();
        var Template = this.getTemplate();
        var $tip = this.$_tip = createNewChildComponent(this, Template, {
          // The following is not reactive to changes in the props data
          propsData: {
            // These values cannot be changed while template is showing
            id: this.computedId,
            html: this.html,
            placement: this.placement,
            fallbackPlacement: this.fallbackPlacement,
            target: this.getPlacementTarget(),
            boundary: this.getBoundary(),
            // Ensure the following are integers
            offset: toInteger(this.offset, 0),
            arrowPadding: toInteger(this.arrowPadding, 0),
            boundaryPadding: toInteger(this.boundaryPadding, 0)
          }
        }); // We set the initial reactive data (values that can be changed while open)

        this.handleTemplateUpdate(); // Template transition phase events (handled once only)
        // When the template has mounted, but not visibly shown yet

        $tip.$once(EVENT_NAME_SHOW, this.onTemplateShow); // When the template has completed showing

        $tip.$once(EVENT_NAME_SHOWN, this.onTemplateShown); // When the template has started to hide

        $tip.$once(EVENT_NAME_HIDE, this.onTemplateHide); // When the template has completed hiding

        $tip.$once(EVENT_NAME_HIDDEN, this.onTemplateHidden); // When the template gets destroyed for any reason

        $tip.$once(HOOK_EVENT_NAME_DESTROYED, this.destroyTemplate); // Convenience events from template
        // To save us from manually adding/removing DOM
        // listeners to tip element when it is open

        $tip.$on(EVENT_NAME_FOCUSIN, this.handleEvent);
        $tip.$on(EVENT_NAME_FOCUSOUT, this.handleEvent);
        $tip.$on(EVENT_NAME_MOUSEENTER, this.handleEvent);
        $tip.$on(EVENT_NAME_MOUSELEAVE, this.handleEvent); // Mount (which triggers the `show`)

        $tip.$mount(container.appendChild(document.createElement('div'))); // Template will automatically remove its markup from DOM when hidden
      },
      hideTemplate: function hideTemplate() {
        // Trigger the template to start hiding
        // The template will emit the `hide` event after this and
        // then emit the `hidden` event once it is fully hidden
        // The `hook:destroyed` will also be called (safety measure)
        this.$_tip && this.$_tip.hide(); // Clear out any stragging active triggers

        this.clearActiveTriggers(); // Reset the hover state

        this.$_hoverState = '';
      },
      // Destroy the template instance and reset state
      destroyTemplate: function destroyTemplate() {
        this.setWhileOpenListeners(false);
        this.clearHoverTimeout();
        this.$_hoverState = '';
        this.clearActiveTriggers();
        this.localPlacementTarget = null;

        try {
          this.$_tip.$destroy();
        } catch (_unused) {}

        this.$_tip = null;
        this.removeAriaDescribedby();
        this.restoreTitle();
        this.localShow = false;
      },
      getTemplateElement: function getTemplateElement() {
        return this.$_tip ? this.$_tip.$el : null;
      },
      handleTemplateUpdate: function handleTemplateUpdate() {
        var _this4 = this; // Update our template title/content "props"
        // So that the template updates accordingly


        var $tip = this.$_tip;

        if ($tip) {
          var props = ['title', 'content', 'variant', 'customClass', 'noFade', 'interactive']; // Only update the values if they have changed

          props.forEach(function (prop) {
            if ($tip[prop] !== _this4[prop]) {
              $tip[prop] = _this4[prop];
            }
          });
        }
      },
      // --- Show/Hide handlers ---
      // Show the tooltip
      show: function show() {
        var target = this.getTarget();

        if (!target || !contains(document.body, target) || !isVisible(target) || this.dropdownOpen() || (isUndefinedOrNull(this.title) || this.title === '') && (isUndefinedOrNull(this.content) || this.content === '')) {
          // If trigger element isn't in the DOM or is not visible, or
          // is on an open dropdown toggle, or has no content, then
          // we exit without showing
          return;
        } // If tip already exists, exit early


        if (this.$_tip || this.localShow) {
          /* istanbul ignore next */
          return;
        } // In the process of showing


        this.localShow = true; // Create a cancelable BvEvent

        var showEvent = this.buildEvent(EVENT_NAME_SHOW, {
          cancelable: true
        });
        this.emitEvent(showEvent); // Don't show if event cancelled

        /* istanbul ignore if */

        if (showEvent.defaultPrevented) {
          // Destroy the template (if for some reason it was created)
          this.destroyTemplate();
          return;
        } // Fix the title attribute on target


        this.fixTitle(); // Set aria-describedby on target

        this.addAriaDescribedby(); // Create and show the tooltip

        this.createTemplateAndShow();
      },
      hide: function hide() {
        var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; // Hide the tooltip

        var tip = this.getTemplateElement();
        /* istanbul ignore if */

        if (!tip || !this.localShow) {
          this.restoreTitle();
          return;
        } // Emit cancelable BvEvent 'hide'
        // We disable cancelling if `force` is true


        var hideEvent = this.buildEvent(EVENT_NAME_HIDE, {
          cancelable: !force
        });
        this.emitEvent(hideEvent);
        /* istanbul ignore if: ignore for now */

        if (hideEvent.defaultPrevented) {
          // Don't hide if event cancelled
          return;
        } // Tell the template to hide


        this.hideTemplate();
      },
      forceHide: function forceHide() {
        // Forcefully hides/destroys the template, regardless of any active triggers
        var tip = this.getTemplateElement();

        if (!tip || !this.localShow) {
          /* istanbul ignore next */
          return;
        } // Disable while open listeners/watchers
        // This is also done in the template `hide` event handler


        this.setWhileOpenListeners(false); // Clear any hover enter/leave event

        this.clearHoverTimeout();
        this.$_hoverState = '';
        this.clearActiveTriggers(); // Disable the fade animation on the template

        if (this.$_tip) {
          this.$_tip.noFade = true;
        } // Hide the tip (with force = true)


        this.hide(true);
      },
      enable: function enable() {
        this.$_enabled = true; // Create a non-cancelable BvEvent

        this.emitEvent(this.buildEvent(EVENT_NAME_ENABLED));
      },
      disable: function disable() {
        this.$_enabled = false; // Create a non-cancelable BvEvent

        this.emitEvent(this.buildEvent(EVENT_NAME_DISABLED));
      },
      // --- Handlers for template events ---
      // When template is inserted into DOM, but not yet shown
      onTemplateShow: function onTemplateShow() {
        // Enable while open listeners/watchers
        this.setWhileOpenListeners(true);
      },
      // When template show transition completes
      onTemplateShown: function onTemplateShown() {
        var prevHoverState = this.$_hoverState;
        this.$_hoverState = '';
        /* istanbul ignore next: occasional Node 10 coverage error */

        if (prevHoverState === 'out') {
          this.leave(null);
        } // Emit a non-cancelable BvEvent 'shown'


        this.emitEvent(this.buildEvent(EVENT_NAME_SHOWN));
      },
      // When template is starting to hide
      onTemplateHide: function onTemplateHide() {
        // Disable while open listeners/watchers
        this.setWhileOpenListeners(false);
      },
      // When template has completed closing (just before it self destructs)
      onTemplateHidden: function onTemplateHidden() {
        // Destroy the template
        this.destroyTemplate(); // Emit a non-cancelable BvEvent 'shown'

        this.emitEvent(this.buildEvent(EVENT_NAME_HIDDEN));
      },
      // --- Helper methods ---
      getTarget: function getTarget() {
        var target = this.target;

        if (isString$1(target)) {
          target = getById(target.replace(/^#/, ''));
        } else if (isFunction$1(target)) {
          target = target();
        } else if (target) {
          target = target.$el || target;
        }

        return isElement(target) ? target : null;
      },
      getPlacementTarget: function getPlacementTarget() {
        // This is the target that the tooltip will be placed on, which may not
        // necessarily be the same element that has the trigger event listeners
        // For now, this is the same as target
        // TODO:
        //   Add in child selector support
        //   Add in visibility checks for this element
        //   Fallback to target if not found
        return this.getTarget();
      },
      getTargetId: function getTargetId() {
        // Returns the ID of the trigger element
        var target = this.getTarget();
        return target && target.id ? target.id : null;
      },
      getContainer: function getContainer() {
        // Handle case where container may be a component ref
        var container = this.container ? this.container.$el || this.container : false;
        var body = document.body;
        var target = this.getTarget(); // If we are in a modal, we append to the modal, If we
        // are in a sidebar, we append to the sidebar, else append
        // to body, unless a container is specified
        // TODO:
        //   Template should periodically check to see if it is in dom
        //   And if not, self destruct (if container got v-if'ed out of DOM)
        //   Or this could possibly be part of the visibility check

        return container === false ? closest(CONTAINER_SELECTOR, target) || body :
        /*istanbul ignore next */
        isString$1(container) ?
        /*istanbul ignore next */
        getById(container.replace(/^#/, '')) || body :
        /*istanbul ignore next */
        body;
      },
      getBoundary: function getBoundary() {
        return this.boundary ? this.boundary.$el || this.boundary : 'scrollParent';
      },
      isInModal: function isInModal() {
        var target = this.getTarget();
        return target && closest(MODAL_SELECTOR, target);
      },
      isDropdown: function isDropdown() {
        // Returns true if trigger is a dropdown
        var target = this.getTarget();
        return target && hasClass(target, DROPDOWN_CLASS);
      },
      dropdownOpen: function dropdownOpen() {
        // Returns true if trigger is a dropdown and the dropdown menu is open
        var target = this.getTarget();
        return this.isDropdown() && target && select(DROPDOWN_OPEN_SELECTOR, target);
      },
      clearHoverTimeout: function clearHoverTimeout() {
        clearTimeout(this.$_hoverTimeout);
        this.$_hoverTimeout = null;
      },
      clearVisibilityInterval: function clearVisibilityInterval() {
        clearInterval(this.$_visibleInterval);
        this.$_visibleInterval = null;
      },
      clearActiveTriggers: function clearActiveTriggers() {
        for (var trigger in this.activeTrigger) {
          this.activeTrigger[trigger] = false;
        }
      },
      addAriaDescribedby: function addAriaDescribedby() {
        // Add aria-describedby on trigger element, without removing any other IDs
        var target = this.getTarget();
        var desc = getAttr(target, 'aria-describedby') || '';
        desc = desc.split(/\s+/).concat(this.computedId).join(' ').trim(); // Update/add aria-described by

        setAttr$1(target, 'aria-describedby', desc);
      },
      removeAriaDescribedby: function removeAriaDescribedby() {
        var _this5 = this; // Remove aria-describedby on trigger element, without removing any other IDs


        var target = this.getTarget();
        var desc = getAttr(target, 'aria-describedby') || '';
        desc = desc.split(/\s+/).filter(function (d) {
          return d !== _this5.computedId;
        }).join(' ').trim(); // Update or remove aria-describedby

        if (desc) {
          /* istanbul ignore next */
          setAttr$1(target, 'aria-describedby', desc);
        } else {
          removeAttr(target, 'aria-describedby');
        }
      },
      fixTitle: function fixTitle() {
        // If the target has a `title` attribute,
        // remove it and store it on a data attribute
        var target = this.getTarget();

        if (hasAttr(target, 'title')) {
          // Get `title` attribute value and remove it from target
          var title = getAttr(target, 'title');
          setAttr$1(target, 'title', ''); // Only set the data attribute when the value is truthy

          if (title) {
            setAttr$1(target, DATA_TITLE_ATTR, title);
          }
        }
      },
      restoreTitle: function restoreTitle() {
        // If the target had a `title` attribute,
        // restore it and remove the data attribute
        var target = this.getTarget();

        if (hasAttr(target, DATA_TITLE_ATTR)) {
          // Get data attribute value and remove it from target
          var title = getAttr(target, DATA_TITLE_ATTR);
          removeAttr(target, DATA_TITLE_ATTR); // Only restore the `title` attribute when the value is truthy

          if (title) {
            setAttr$1(target, 'title', title);
          }
        }
      },
      // --- BvEvent helpers ---
      buildEvent: function buildEvent(type) {
        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // Defaults to a non-cancellable event

        return new BvEvent(type, _objectSpread$8({
          cancelable: false,
          target: this.getTarget(),
          relatedTarget: this.getTemplateElement() || null,
          componentId: this.computedId,
          vueTarget: this
        }, options));
      },
      emitEvent: function emitEvent(bvEvent) {
        var type = bvEvent.type;
        this.emitOnRoot(getRootEventName(this.templateType, type), bvEvent);
        this.$emit(type, bvEvent);
      },
      // --- Event handler setup methods ---
      listen: function listen() {
        var _this6 = this; // Enable trigger event handlers


        var el = this.getTarget();

        if (!el) {
          /* istanbul ignore next */
          return;
        } // Listen for global show/hide events


        this.setRootListener(true); // Set up our listeners on the target trigger element

        this.computedTriggers.forEach(function (trigger) {
          if (trigger === 'click') {
            eventOn(el, 'click', _this6.handleEvent, EVENT_OPTIONS_NO_CAPTURE);
          } else if (trigger === 'focus') {
            eventOn(el, 'focusin', _this6.handleEvent, EVENT_OPTIONS_NO_CAPTURE);
            eventOn(el, 'focusout', _this6.handleEvent, EVENT_OPTIONS_NO_CAPTURE);
          } else if (trigger === 'blur') {
            // Used to close $tip when element loses focus

            /* istanbul ignore next */
            eventOn(el, 'focusout', _this6.handleEvent, EVENT_OPTIONS_NO_CAPTURE);
          } else if (trigger === 'hover') {
            eventOn(el, 'mouseenter', _this6.handleEvent, EVENT_OPTIONS_NO_CAPTURE);
            eventOn(el, 'mouseleave', _this6.handleEvent, EVENT_OPTIONS_NO_CAPTURE);
          }
        }, this);
      },

      /* istanbul ignore next */
      unListen: function unListen() {
        var _this7 = this; // Remove trigger event handlers


        var events = ['click', 'focusin', 'focusout', 'mouseenter', 'mouseleave'];
        var target = this.getTarget(); // Stop listening for global show/hide/enable/disable events

        this.setRootListener(false); // Clear out any active target listeners

        events.forEach(function (event) {
          target && eventOff(target, event, _this7.handleEvent, EVENT_OPTIONS_NO_CAPTURE);
        }, this);
      },
      setRootListener: function setRootListener(on) {
        // Listen for global `bv::{hide|show}::{tooltip|popover}` hide request event
        var method = on ? 'listenOnRoot' : 'listenOffRoot';
        var type = this.templateType;
        this[method](getRootActionEventName(type, EVENT_NAME_HIDE), this.doHide);
        this[method](getRootActionEventName(type, EVENT_NAME_SHOW), this.doShow);
        this[method](getRootActionEventName(type, EVENT_NAME_DISABLE), this.doDisable);
        this[method](getRootActionEventName(type, EVENT_NAME_ENABLE), this.doEnable);
      },
      setWhileOpenListeners: function setWhileOpenListeners(on) {
        // Events that are only registered when the template is showing
        // Modal close events
        this.setModalListener(on); // Dropdown open events (if we are attached to a dropdown)

        this.setDropdownListener(on); // Periodic $element visibility check
        // For handling when tip target is in <keepalive>, tabs, carousel, etc

        this.visibleCheck(on); // On-touch start listeners

        this.setOnTouchStartListener(on);
      },
      // Handler for periodic visibility check
      visibleCheck: function visibleCheck(on) {
        var _this8 = this;

        this.clearVisibilityInterval();
        var target = this.getTarget();

        if (on) {
          this.$_visibleInterval = setInterval(function () {
            var tip = _this8.getTemplateElement();

            if (tip && _this8.localShow && (!target.parentNode || !isVisible(target))) {
              // Target element is no longer visible or not in DOM, so force-hide the tooltip
              _this8.forceHide();
            }
          }, 100);
        }
      },
      setModalListener: function setModalListener(on) {
        // Handle case where tooltip/target is in a modal
        if (this.isInModal()) {
          // We can listen for modal hidden events on `$root`
          this[on ? 'listenOnRoot' : 'listenOffRoot'](ROOT_EVENT_NAME_MODAL_HIDDEN, this.forceHide);
        }
      },

      /* istanbul ignore next: JSDOM doesn't support `ontouchstart` */
      setOnTouchStartListener: function setOnTouchStartListener(on) {
        var _this9 = this; // If this is a touch-enabled device we add extra empty
        // `mouseover` listeners to the body's immediate children
        // Only needed because of broken event delegation on iOS
        // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html


        if ('ontouchstart' in document.documentElement) {
          from(document.body.children).forEach(function (el) {
            eventOnOff(on, el, 'mouseover', _this9.$_noop);
          });
        }
      },
      setDropdownListener: function setDropdownListener(on) {
        var target = this.getTarget();

        if (!target || !this.bvEventRoot || !this.isDropdown) {
          return;
        } // We can listen for dropdown shown events on its instance
        // TODO:
        //   We could grab the ID from the dropdown, and listen for
        //   $root events for that particular dropdown id
        //   Dropdown shown and hidden events will need to emit
        //   Note: Dropdown auto-ID happens in a `$nextTick()` after mount
        //         So the ID lookup would need to be done in a `$nextTick()`


        var instance = getInstanceFromElement(target);

        if (instance) {
          instance[on ? '$on' : '$off'](EVENT_NAME_SHOWN, this.forceHide);
        }
      },
      // --- Event handlers ---
      handleEvent: function handleEvent(event) {
        // General trigger event handler
        // target is the trigger element
        var target = this.getTarget();

        if (!target || isDisabled(target) || !this.$_enabled || this.dropdownOpen()) {
          // If disabled or not enabled, or if a dropdown that is open, don't do anything
          // If tip is shown before element gets disabled, then tip will not
          // close until no longer disabled or forcefully closed
          return;
        }

        var type = event.type;
        var triggers = this.computedTriggers;

        if (type === 'click' && arrayIncludes(triggers, 'click')) {
          this.click(event);
        } else if (type === 'mouseenter' && arrayIncludes(triggers, 'hover')) {
          // `mouseenter` is a non-bubbling event
          this.enter(event);
        } else if (type === 'focusin' && arrayIncludes(triggers, 'focus')) {
          // `focusin` is a bubbling event
          // `event` includes `relatedTarget` (element losing focus)
          this.enter(event);
        } else if (type === 'focusout' && (arrayIncludes(triggers, 'focus') || arrayIncludes(triggers, 'blur')) || type === 'mouseleave' && arrayIncludes(triggers, 'hover')) {
          // `focusout` is a bubbling event
          // `mouseleave` is a non-bubbling event
          // `tip` is the template (will be null if not open)
          var tip = this.getTemplateElement(); // `eventTarget` is the element which is losing focus/hover and

          var eventTarget = event.target; // `relatedTarget` is the element gaining focus/hover

          var relatedTarget = event.relatedTarget;
          /* istanbul ignore next */

          if ( // From tip to target
          tip && contains(tip, eventTarget) && contains(target, relatedTarget) || // From target to tip
          tip && contains(target, eventTarget) && contains(tip, relatedTarget) || // Within tip
          tip && contains(tip, eventTarget) && contains(tip, relatedTarget) || // Within target
          contains(target, eventTarget) && contains(target, relatedTarget)) {
            // If focus/hover moves within `tip` and `target`, don't trigger a leave
            return;
          } // Otherwise trigger a leave


          this.leave(event);
        }
      },
      doHide: function doHide(id) {
        // Programmatically hide tooltip or popover
        if (!id || this.getTargetId() === id || this.computedId === id) {
          // Close all tooltips or popovers, or this specific tip (with ID)
          this.forceHide();
        }
      },
      doShow: function doShow(id) {
        // Programmatically show tooltip or popover
        if (!id || this.getTargetId() === id || this.computedId === id) {
          // Open all tooltips or popovers, or this specific tip (with ID)
          this.show();
        }
      },

      /*istanbul ignore next: ignore for now */
      doDisable: function doDisable(id)
      /*istanbul ignore next: ignore for now */
      {
        // Programmatically disable tooltip or popover
        if (!id || this.getTargetId() === id || this.computedId === id) {
          // Disable all tooltips or popovers (no ID), or this specific tip (with ID)
          this.disable();
        }
      },

      /*istanbul ignore next: ignore for now */
      doEnable: function doEnable(id)
      /*istanbul ignore next: ignore for now */
      {
        // Programmatically enable tooltip or popover
        if (!id || this.getTargetId() === id || this.computedId === id) {
          // Enable all tooltips or popovers (no ID), or this specific tip (with ID)
          this.enable();
        }
      },
      click: function click(event) {
        if (!this.$_enabled || this.dropdownOpen()) {
          /* istanbul ignore next */
          return;
        } // Get around a WebKit bug where `click` does not trigger focus events
        // On most browsers, `click` triggers a `focusin`/`focus` event first
        // Needed so that trigger 'click blur' works on iOS
        // https://github.com/bootstrap-vue/bootstrap-vue/issues/5099
        // We use `currentTarget` rather than `target` to trigger on the
        // element, not the inner content


        attemptFocus(event.currentTarget);
        this.activeTrigger.click = !this.activeTrigger.click;

        if (this.isWithActiveTrigger) {
          this.enter(null);
        } else {
          /* istanbul ignore next */
          this.leave(null);
        }
      },

      /* istanbul ignore next */
      toggle: function toggle() {
        // Manual toggle handler
        if (!this.$_enabled || this.dropdownOpen()) {
          /* istanbul ignore next */
          return;
        } // Should we register as an active trigger?
        // this.activeTrigger.manual = !this.activeTrigger.manual


        if (this.localShow) {
          this.leave(null);
        } else {
          this.enter(null);
        }
      },
      enter: function enter() {
        var _this10 = this;

        var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; // Opening trigger handler
        // Note: Click events are sent with event === null

        if (event) {
          this.activeTrigger[event.type === 'focusin' ? 'focus' : 'hover'] = true;
        }
        /* istanbul ignore next */


        if (this.localShow || this.$_hoverState === 'in') {
          this.$_hoverState = 'in';
          return;
        }

        this.clearHoverTimeout();
        this.$_hoverState = 'in';

        if (!this.computedDelay.show) {
          this.show();
        } else {
          // Hide any title attribute while enter delay is active
          this.fixTitle();
          this.$_hoverTimeout = setTimeout(function () {
            /* istanbul ignore else */
            if (_this10.$_hoverState === 'in') {
              _this10.show();
            } else if (!_this10.localShow) {
              _this10.restoreTitle();
            }
          }, this.computedDelay.show);
        }
      },
      leave: function leave() {
        var _this11 = this;

        var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; // Closing trigger handler
        // Note: Click events are sent with event === null

        if (event) {
          this.activeTrigger[event.type === 'focusout' ? 'focus' : 'hover'] = false;
          /* istanbul ignore next */

          if (event.type === 'focusout' && arrayIncludes(this.computedTriggers, 'blur')) {
            // Special case for `blur`: we clear out the other triggers
            this.activeTrigger.click = false;
            this.activeTrigger.hover = false;
          }
        }
        /* istanbul ignore next: ignore for now */


        if (this.isWithActiveTrigger) {
          return;
        }

        this.clearHoverTimeout();
        this.$_hoverState = 'out';

        if (!this.computedDelay.hide) {
          this.hide();
        } else {
          this.$_hoverTimeout = setTimeout(function () {
            if (_this11.$_hoverState === 'out') {
              _this11.hide();
            }
          }, this.computedDelay.hide);
        }
      }
    }
  });

  var _makePropsConfigurabl, _watch;

  function ownKeys$b(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$9(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$b(Object(source), !0).forEach(function (key) {
        _defineProperty$c(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$b(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$c(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  var MODEL_PROP_NAME_ENABLED = 'disabled';
  var MODEL_EVENT_NAME_ENABLED = MODEL_EVENT_NAME_PREFIX + MODEL_PROP_NAME_ENABLED;
  var MODEL_PROP_NAME_SHOW = 'show';
  var MODEL_EVENT_NAME_SHOW = MODEL_EVENT_NAME_PREFIX + MODEL_PROP_NAME_SHOW; // --- Props ---

  var props$4 = makePropsConfigurable((_makePropsConfigurabl = {
    // String: scrollParent, window, or viewport
    // Element: element reference
    // Object: Vue component
    boundary: makeProp([HTMLElement, PROP_TYPE_OBJECT, PROP_TYPE_STRING], 'scrollParent'),
    boundaryPadding: makeProp(PROP_TYPE_NUMBER_STRING, 50),
    // String: HTML ID of container, if null body is used (default)
    // HTMLElement: element reference reference
    // Object: Vue Component
    container: makeProp([HTMLElement, PROP_TYPE_OBJECT, PROP_TYPE_STRING]),
    customClass: makeProp(PROP_TYPE_STRING),
    delay: makeProp(PROP_TYPE_NUMBER_OBJECT_STRING, 50)
  }, _defineProperty$c(_makePropsConfigurabl, MODEL_PROP_NAME_ENABLED, makeProp(PROP_TYPE_BOOLEAN, false)), _defineProperty$c(_makePropsConfigurabl, "fallbackPlacement", makeProp(PROP_TYPE_ARRAY_STRING, 'flip')), _defineProperty$c(_makePropsConfigurabl, "id", makeProp(PROP_TYPE_STRING)), _defineProperty$c(_makePropsConfigurabl, "noFade", makeProp(PROP_TYPE_BOOLEAN, false)), _defineProperty$c(_makePropsConfigurabl, "noninteractive", makeProp(PROP_TYPE_BOOLEAN, false)), _defineProperty$c(_makePropsConfigurabl, "offset", makeProp(PROP_TYPE_NUMBER_STRING, 0)), _defineProperty$c(_makePropsConfigurabl, "placement", makeProp(PROP_TYPE_STRING, 'top')), _defineProperty$c(_makePropsConfigurabl, MODEL_PROP_NAME_SHOW, makeProp(PROP_TYPE_BOOLEAN, false)), _defineProperty$c(_makePropsConfigurabl, "target", makeProp([HTMLElement, SVGElement, PROP_TYPE_FUNCTION, PROP_TYPE_OBJECT, PROP_TYPE_STRING], undefined, true)), _defineProperty$c(_makePropsConfigurabl, "title", makeProp(PROP_TYPE_STRING)), _defineProperty$c(_makePropsConfigurabl, "triggers", makeProp(PROP_TYPE_ARRAY_STRING, 'hover focus')), _defineProperty$c(_makePropsConfigurabl, "variant", makeProp(PROP_TYPE_STRING)), _makePropsConfigurabl), NAME_TOOLTIP); // --- Main component ---
  // @vue/component

  var BTooltip = /*#__PURE__*/extend$2({
    name: NAME_TOOLTIP,
    mixins: [normalizeSlotMixin, useParentMixin],
    inheritAttrs: false,
    props: props$4,
    data: function data() {
      return {
        localShow: this[MODEL_PROP_NAME_SHOW],
        localTitle: '',
        localContent: ''
      };
    },
    computed: {
      // Data that will be passed to the template and popper
      templateData: function templateData() {
        return _objectSpread$9({
          title: this.localTitle,
          content: this.localContent,
          interactive: !this.noninteractive
        }, pick$1(this.$props, ['boundary', 'boundaryPadding', 'container', 'customClass', 'delay', 'fallbackPlacement', 'id', 'noFade', 'offset', 'placement', 'target', 'target', 'triggers', 'variant', MODEL_PROP_NAME_ENABLED]));
      },
      // Used to watch for changes to the title and content props
      templateTitleContent: function templateTitleContent() {
        var title = this.title,
            content = this.content;
        return {
          title: title,
          content: content
        };
      }
    },
    watch: (_watch = {}, _defineProperty$c(_watch, MODEL_PROP_NAME_SHOW, function (newValue, oldValue) {
      if (newValue !== oldValue && newValue !== this.localShow && this.$_toolpop) {
        if (newValue) {
          this.$_toolpop.show();
        } else {
          // We use `forceHide()` to override any active triggers
          this.$_toolpop.forceHide();
        }
      }
    }), _defineProperty$c(_watch, MODEL_PROP_NAME_ENABLED, function (newValue) {
      if (newValue) {
        this.doDisable();
      } else {
        this.doEnable();
      }
    }), _defineProperty$c(_watch, "localShow", function localShow(newValue) {
      // TODO: May need to be done in a `$nextTick()`
      this.$emit(MODEL_EVENT_NAME_SHOW, newValue);
    }), _defineProperty$c(_watch, "templateData", function templateData() {
      var _this = this;

      this.$nextTick(function () {
        if (_this.$_toolpop) {
          _this.$_toolpop.updateData(_this.templateData);
        }
      });
    }), _defineProperty$c(_watch, "templateTitleContent", function templateTitleContent() {
      this.$nextTick(this.updateContent);
    }), _watch),
    created: function created() {
      // Create private non-reactive props
      this.$_toolpop = null;
    },
    updated: function updated() {
      // Update the `propData` object
      // Done in a `$nextTick()` to ensure slot(s) have updated
      this.$nextTick(this.updateContent);
    },
    beforeDestroy: function beforeDestroy() {
      // Shutdown our local event listeners
      this.$off(EVENT_NAME_OPEN, this.doOpen);
      this.$off(EVENT_NAME_CLOSE, this.doClose);
      this.$off(EVENT_NAME_DISABLE, this.doDisable);
      this.$off(EVENT_NAME_ENABLE, this.doEnable); // Destroy the tip instance

      if (this.$_toolpop) {
        this.$_toolpop.$destroy();
        this.$_toolpop = null;
      }
    },
    mounted: function mounted() {
      var _this2 = this; // Instantiate a new BVTooltip instance
      // Done in a `$nextTick()` to ensure DOM has completed rendering
      // so that target can be found


      this.$nextTick(function () {
        // Load the on demand child instance
        var Component = _this2.getComponent(); // Ensure we have initial content


        _this2.updateContent(); // Pass down the scoped style attribute if available


        var scopeId = getScopeId(_this2) || getScopeId(_this2.bvParent); // Create the instance

        var $toolpop = _this2.$_toolpop = createNewChildComponent(_this2, Component, {
          // Pass down the scoped style ID
          _scopeId: scopeId || undefined
        }); // Set the initial data

        $toolpop.updateData(_this2.templateData); // Set listeners

        $toolpop.$on(EVENT_NAME_SHOW, _this2.onShow);
        $toolpop.$on(EVENT_NAME_SHOWN, _this2.onShown);
        $toolpop.$on(EVENT_NAME_HIDE, _this2.onHide);
        $toolpop.$on(EVENT_NAME_HIDDEN, _this2.onHidden);
        $toolpop.$on(EVENT_NAME_DISABLED, _this2.onDisabled);
        $toolpop.$on(EVENT_NAME_ENABLED, _this2.onEnabled); // Initially disabled?

        if (_this2[MODEL_PROP_NAME_ENABLED]) {
          // Initially disabled
          _this2.doDisable();
        } // Listen to open signals from others


        _this2.$on(EVENT_NAME_OPEN, _this2.doOpen); // Listen to close signals from others


        _this2.$on(EVENT_NAME_CLOSE, _this2.doClose); // Listen to disable signals from others


        _this2.$on(EVENT_NAME_DISABLE, _this2.doDisable); // Listen to enable signals from others


        _this2.$on(EVENT_NAME_ENABLE, _this2.doEnable); // Initially show tooltip?


        if (_this2.localShow) {
          $toolpop.show();
        }
      });
    },
    methods: {
      getComponent: function getComponent() {
        // Overridden by BPopover
        return BVTooltip;
      },
      updateContent: function updateContent() {
        // Overridden by BPopover
        // Tooltip: Default slot is `title`
        // Popover: Default slot is `content`, `title` slot is title
        // We pass a scoped slot function reference by default (Vue v2.6x)
        // And pass the title prop as a fallback
        this.setTitle(this.normalizeSlot() || this.title);
      },
      // Helper methods for `updateContent()`
      setTitle: function setTitle(value) {
        value = isUndefinedOrNull(value) ? '' : value; // We only update the value if it has changed

        if (this.localTitle !== value) {
          this.localTitle = value;
        }
      },
      setContent: function setContent(value) {
        value = isUndefinedOrNull(value) ? '' : value; // We only update the value if it has changed

        if (this.localContent !== value) {
          this.localContent = value;
        }
      },
      // --- Template event handlers ---
      onShow: function onShow(bvEvent) {
        // Placeholder
        this.$emit(EVENT_NAME_SHOW, bvEvent);

        if (bvEvent) {
          this.localShow = !bvEvent.defaultPrevented;
        }
      },
      onShown: function onShown(bvEvent) {
        // Tip is now showing
        this.localShow = true;
        this.$emit(EVENT_NAME_SHOWN, bvEvent);
      },
      onHide: function onHide(bvEvent) {
        this.$emit(EVENT_NAME_HIDE, bvEvent);
      },
      onHidden: function onHidden(bvEvent) {
        // Tip is no longer showing
        this.$emit(EVENT_NAME_HIDDEN, bvEvent);
        this.localShow = false;
      },
      onDisabled: function onDisabled(bvEvent) {
        // Prevent possible endless loop if user mistakenly
        // fires `disabled` instead of `disable`
        if (bvEvent && bvEvent.type === EVENT_NAME_DISABLED) {
          this.$emit(MODEL_EVENT_NAME_ENABLED, true);
          this.$emit(EVENT_NAME_DISABLED, bvEvent);
        }
      },
      onEnabled: function onEnabled(bvEvent) {
        // Prevent possible endless loop if user mistakenly
        // fires `enabled` instead of `enable`
        if (bvEvent && bvEvent.type === EVENT_NAME_ENABLED) {
          this.$emit(MODEL_EVENT_NAME_ENABLED, false);
          this.$emit(EVENT_NAME_ENABLED, bvEvent);
        }
      },
      // --- Local event listeners ---
      doOpen: function doOpen() {
        !this.localShow && this.$_toolpop && this.$_toolpop.show();
      },
      doClose: function doClose() {
        this.localShow && this.$_toolpop && this.$_toolpop.hide();
      },
      doDisable: function doDisable() {
        this.$_toolpop && this.$_toolpop.disable();
      },
      doEnable: function doEnable() {
        this.$_toolpop && this.$_toolpop.enable();
      }
    },
    render: function render(h) {
      // Always renders a comment node
      // TODO:
      //   Future: Possibly render a target slot (single root element)
      //   which we can apply the listeners to (pass `this.$el` to BVTooltip)
      return h();
    }
  });

  var BVPopoverTemplate = /*#__PURE__*/extend$2({
    name: NAME_POPOVER_TEMPLATE,
    extends: BVTooltipTemplate,
    computed: {
      templateType: function templateType() {
        return 'popover';
      }
    },
    methods: {
      renderTemplate: function renderTemplate(h) {
        var title = this.title,
            content = this.content; // Title and content could be a scoped slot function

        var $title = isFunction$1(title) ? title({}) : title;
        var $content = isFunction$1(content) ? content({}) : content; // Directive usage only

        var titleDomProps = this.html && !isFunction$1(title) ? {
          innerHTML: title
        } : {};
        var contentDomProps = this.html && !isFunction$1(content) ? {
          innerHTML: content
        } : {};
        return h('div', {
          staticClass: 'popover b-popover',
          class: this.templateClasses,
          attrs: this.templateAttributes,
          on: this.templateListeners
        }, [h('div', {
          staticClass: 'arrow',
          ref: 'arrow'
        }), isUndefinedOrNull($title) || $title === '' ?
        /* istanbul ignore next */
        h() : h('h3', {
          staticClass: 'popover-header',
          domProps: titleDomProps
        }, [$title]), isUndefinedOrNull($content) || $content === '' ?
        /* istanbul ignore next */
        h() : h('div', {
          staticClass: 'popover-body',
          domProps: contentDomProps
        }, [$content])]);
      }
    }
  });

  // Popover "Class" (Built as a renderless Vue instance)

  var BVPopover = /*#__PURE__*/extend$2({
    name: NAME_POPOVER_HELPER,
    extends: BVTooltip,
    computed: {
      // Overwrites BVTooltip
      templateType: function templateType() {
        return 'popover';
      }
    },
    methods: {
      getTemplate: function getTemplate() {
        // Overwrites BVTooltip
        return BVPopoverTemplate;
      }
    }
  });

  function ownKeys$c(object, enumerableOnly) {
    var keys = Object.keys(object);

    if (Object.getOwnPropertySymbols) {
      var symbols = Object.getOwnPropertySymbols(object);
      enumerableOnly && (symbols = symbols.filter(function (sym) {
        return Object.getOwnPropertyDescriptor(object, sym).enumerable;
      })), keys.push.apply(keys, symbols);
    }

    return keys;
  }

  function _objectSpread$a(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = null != arguments[i] ? arguments[i] : {};
      i % 2 ? ownKeys$c(Object(source), !0).forEach(function (key) {
        _defineProperty$d(target, key, source[key]);
      }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$c(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }

    return target;
  }

  function _defineProperty$d(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }

    return obj;
  }

  var props$5 = makePropsConfigurable(sortKeys(_objectSpread$a(_objectSpread$a({}, props$4), {}, {
    content: makeProp(PROP_TYPE_STRING),
    placement: makeProp(PROP_TYPE_STRING, 'right'),
    triggers: makeProp(PROP_TYPE_ARRAY_STRING, EVENT_NAME_CLICK)
  })), NAME_POPOVER); // --- Main component ---
  // @vue/component

  var BPopover = /*#__PURE__*/extend$2({
    name: NAME_POPOVER,
    extends: BTooltip,
    inheritAttrs: false,
    props: props$5,
    methods: {
      getComponent: function getComponent() {
        // Overridden by BPopover
        return BVPopover;
      },
      updateContent: function updateContent() {
        // Tooltip: Default slot is `title`
        // Popover: Default slot is `content`, `title` slot is title
        // We pass a scoped slot function references by default (Vue v2.6x)
        // And pass the title prop as a fallback
        this.setContent(this.normalizeSlot() || this.content);
        this.setTitle(this.normalizeSlot(SLOT_NAME_TITLE) || this.title);
      }
    } // Render function provided by BTooltip

  });

  //
  var script$c = Vue.extend({
    name: "ProductGroupSubMenuItem",
    components: {
      ProductGroupSubMenuItem: 'ProductGroupSubMenuItem',
      BPopover: BPopover
    },
    props: {
      parent: Object,
      hierarchy: Object
    },
    methods: {
      updateSelectedOfferRequestGroups: function updateSelectedOfferRequestGroups(group) {
        this.$emit("update-selected-offer-request-groups", group);
      }
    },
    computed: {
      levelClass: function levelClass() {
        return "level".concat(this.hierarchy.Level);
      }
    }
  });

  /* script */
  const __vue_script__$c = script$c;

  /* template */
  var __vue_render__$e = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c(
      "nav",
      { staticClass: "nav nav-sub flex-column" },
      [
        _c(
          "div",
          {
            staticClass:
              "nav-item d-flex align-items-center justify-content-between",
            class: [{ active: _vm.hierarchy.Selected }, _vm.levelClass]
          },
          [
            _c(
              "a",
              {
                staticClass: "nav-link",
                class: { active: _vm.hierarchy.Selected },
                attrs: { href: "javascript:void(0)" },
                on: {
                  click: function($event) {
                    $event.preventDefault();
                    return _vm.updateSelectedOfferRequestGroups(_vm.hierarchy)
                  }
                }
              },
              [
                _vm._v(
                  "\n            " + _vm._s(_vm.hierarchy.Name) + "\n        "
                )
              ]
            ),
            _vm._v(" "),
            _c(
              "b-popover",
              {
                attrs: {
                  target: "infoPopoverChildGroup" + _vm.hierarchy.ID,
                  title: "Lisätietoa tuotteista",
                  triggers: "click blur",
                  placement: "top"
                }
              },
              [
                _c("p", [
                  _vm._v(
                    "Voit tutustua tarkemmin tuotteisiin ja tehdä tarjouspyyntöjä myös tuotesivuilta."
                  )
                ]),
                _vm._v(" "),
                _c(
                  "a",
                  {
                    staticClass: "btn btn-primary btn-sm btn-block",
                    attrs: { href: _vm.hierarchy.Url, target: "_blank" }
                  },
                  [
                    _vm._v(_vm._s(_vm.hierarchy.Name)),
                    _c("i", {
                      staticClass: "fa-light fa-arrow-right-from-bracket ml-2"
                    })
                  ]
                )
              ]
            ),
            _vm._v(" "),
            _c(
              "a",
              {
                staticClass: "group-link p-1",
                attrs: {
                  href: "javascript:void(0)",
                  id: "infoPopoverChildGroup" + _vm.hierarchy.ID
                }
              },
              [_c("i", { staticClass: "fa-sharp fa-light fa-circle-info" })]
            )
          ],
          1
        ),
        _vm._v(" "),
        _vm._l(_vm.hierarchy.ChildGroups, function(child) {
          return _vm.hierarchy.ChildGroups.length > 0 && _vm.hierarchy.Selected
            ? _c("product-group-sub-menu-item", {
                key: child.ID,
                attrs: { hierarchy: child, parent: _vm.hierarchy },
                on: {
                  "update-selected-offer-request-groups":
                    _vm.updateSelectedOfferRequestGroups
                }
              })
            : _vm._e()
        })
      ],
      2
    )
  };
  var __vue_staticRenderFns__$e = [];
  __vue_render__$e._withStripped = true;

    /* style */
    const __vue_inject_styles__$e = undefined;
    /* scoped */
    const __vue_scope_id__$e = undefined;
    /* module identifier */
    const __vue_module_identifier__$e = undefined;
    /* functional template */
    const __vue_is_functional_template__$e = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$e = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$e, staticRenderFns: __vue_staticRenderFns__$e },
      __vue_inject_styles__$e,
      __vue_script__$c,
      __vue_scope_id__$e,
      __vue_is_functional_template__$e,
      __vue_module_identifier__$e,
      false,
      undefined,
      undefined,
      undefined
    );

  var countChildGroups = function countChildGroups(selectedParents, count) {
    count = count || 0;

    for (var i = 0; i < selectedParents.length; i++) {
      var selectedParent = selectedParents[i];

      if (selectedParent.ChildGroups && selectedParent.ChildGroups.some(function (cg) {
        return cg.Selected;
      })) {
        var selectedChildren = selectedParent.ChildGroups.filter(function (cg) {
          return cg.Selected;
        });
        count += selectedChildren.length;
        count = countChildGroups(selectedChildren, count);
      }
    }

    return count;
  };

  var script$d = Vue.extend({
    name: "ProductGroupOfferRequest",
    components: {
      ValidatingInput: __vue_component__$1,
      ProductGroupSubMenuItem: __vue_component__$e,
      BPopover: BPopover
    },
    created: function created() {
      this.loadInitialData();
    },
    data: function data() {
      return {
        initializing: false,
        translations: [],
        offerRequest: {}
      };
    },
    methods: {
      loadInitialData: function loadInitialData() {
        var _this = this;

        this.initializing = true; //console.log('loadInitialData');

        axios$1.get("/api/ProductGroupOfferRequests/Initialize").then(function (response) {
          _this.initializing = false; //console.log('response.data', response.data);

          _this.offerRequest = response.data;
        })["catch"](function (error) {
          var errorMessage = error || error.data || error.data.Message || error.statusText;
          console.error("loadInitialData: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      updateSelectedOfferRequestGroups: function updateSelectedOfferRequestGroups(group) {
        console.log('group', group);

        if (group.Selected) {
          console.log('removing');
          group.Selected = false;

          if (group.ChildGroups && group.ChildGroups.length > 0) {
            console.log('group was parent -> unselect children');
            group.ChildGroups.map(function (child) {
              return child.Selected = false;
            });
          }
        } else {
          console.log('adding');
          group.Selected = true;
        }

        axios$1.post("/api/ProductGroupOfferRequests/UpdateOfferRequest", this.offerRequest).then(function (response) {//    this.offerRequest = response.data;
        })["catch"](function (error) {
          var errorMessage = error || error.data || error.data.Message || error.statusText;
          console.error("updateSelectedOfferRequestGroups: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      acceptOfferRequest: function acceptOfferRequest() {
        var _this2 = this;

        axios$1.post("/api/ProductGroupOfferRequests/AcceptCart", this.offerRequest).then(function (response) {
          var hbFeedbackFieldVal = $('#hb-feedback-field').val();
          var URLtoAcceptedPage = "";

          var windowE21 = _.property('E21')(window);

          URLtoAcceptedPage = windowE21.Mercamer.Redirect.UrlToAcceptedView;

          if (hbFeedbackFieldVal === "" && response.data.CartIsValid) {
            window.location.href = URLtoAcceptedPage;
          } else {
            _this2.offerRequest = response.data;
          }
        })["catch"](function (error) {
          var errorMessage = error || error.data || error.data.Message || error.statusText;
          console.error("acceptOfferRequest: bug has been caught!");
          console.error("errorMessage: ", errorMessage);
        });
      },
      selectedGroupCount: function selectedGroupCount() {
        var count = 0;

        if (this.offerRequest.GroupStructure && this.offerRequest.GroupStructure.some(function (i) {
          return i.Selected;
        })) {
          var selectedParents = this.offerRequest.GroupStructure.filter(function (i) {
            return i.Selected;
          });
          count = selectedParents.length;
          var childCount = countChildGroups(selectedParents, count);
          count = childCount;
        }

        return count;
      }
    },
    computed: {
      selectedGroupsEmpty: function selectedGroupsEmpty() {
        return !this.offerRequest.GroupStructure || this.offerRequest.GroupStructure && this.offerRequest.GroupStructure.length < 1 || !this.offerRequest.GroupStructure.some(function (i) {
          return i.Selected;
        });
      }
    }
  });

  /* script */
  const __vue_script__$d = script$d;

  /* template */
  var __vue_render__$f = function() {
    var _vm = this;
    var _h = _vm.$createElement;
    var _c = _vm._self._c || _h;
    return _c("div", { staticClass: "select-cards-container row" }, [
      _c("div", { staticClass: "col-md-6 col-lg-4" }, [
        _c("div", { staticClass: "card vertical-rythm" }, [
          _vm._m(0),
          _vm._v(" "),
          _c("div", { staticClass: "card-body group-selections" }, [
            _c(
              "nav",
              { staticClass: "nav nav-group-offer flex-column" },
              [
                _vm._l(_vm.offerRequest.GroupStructure, function(parentGroup) {
                  return _c(
                    "div",
                    {
                      key: parentGroup.ID,
                      staticClass: "nav-item level1",
                      class: { active: parentGroup.Selected }
                    },
                    [
                      _c(
                        "div",
                        {
                          staticClass:
                            "d-flex align-items-center justify-content-between"
                        },
                        [
                          _c(
                            "a",
                            {
                              staticClass: "nav-link",
                              class: { active: parentGroup.Selected },
                              attrs: { href: "javascript:void(0)" },
                              on: {
                                click: function($event) {
                                  $event.preventDefault();
                                  return _vm.updateSelectedOfferRequestGroups(
                                    parentGroup
                                  )
                                }
                              }
                            },
                            [
                              _c("img", {
                                staticClass: "img-fluid img-group",
                                attrs: {
                                  src: parentGroup.PictureUrl + "?height=200"
                                }
                              }),
                              _vm._v(
                                "\n                                " +
                                  _vm._s(parentGroup.Name) +
                                  "\n                            "
                              )
                            ]
                          ),
                          _vm._v(" "),
                          _c(
                            "b-popover",
                            {
                              attrs: {
                                target: "infoPopoverMainGroup" + parentGroup.ID,
                                title: "Tutustu tuotteisiin",
                                triggers: "click blur",
                                placement: "top"
                              }
                            },
                            [
                              _c("p", [
                                _vm._v(
                                  "Voit tutustua tarkemmin tuotteisiin ja tehdä tarjouspyyntöjä myös tuotesivuilta."
                                )
                              ]),
                              _vm._v(" "),
                              _c(
                                "a",
                                {
                                  staticClass: "btn btn-primary btn-block btn-sm",
                                  attrs: {
                                    href: parentGroup.Url,
                                    target: "_blank"
                                  }
                                },
                                [
                                  _vm._v(_vm._s(parentGroup.Name)),
                                  _c("i", {
                                    staticClass:
                                      "fa-light fa-arrow-right-from-bracket ml-2"
                                  })
                                ]
                              )
                            ]
                          ),
                          _vm._v(" "),
                          _c(
                            "a",
                            {
                              staticClass: "group-link p-1",
                              attrs: {
                                href: "javascript:void(0)",
                                id: "infoPopoverMainGroup" + parentGroup.ID
                              }
                            },
                            [
                              _c("i", {
                                staticClass: "fa-sharp fa-light fa-circle-info"
                              })
                            ]
                          )
                        ],
                        1
                      ),
                      _vm._v(" "),
                      _vm._l(parentGroup.ChildGroups, function(childGroup) {
                        return parentGroup.ChildGroups.length > 0 &&
                          parentGroup.Selected
                          ? _c("product-group-sub-menu-item", {
                              key: childGroup.ID,
                              attrs: {
                                hierarchy: childGroup,
                                parent: parentGroup
                              },
                              on: {
                                "update-selected-offer-request-groups":
                                  _vm.updateSelectedOfferRequestGroups
                              }
                            })
                          : _vm._e()
                      })
                    ],
                    2
                  )
                }),
                _vm._v(" "),
                _vm.initializing
                  ? _c("span", { staticClass: "d-block text-center" }, [
                      _vm._m(1),
                      _vm._v("Ladataan tuoteryhmiä...\n                    ")
                    ])
                  : _vm._e()
              ],
              2
            )
          ])
        ])
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "col-md-6 col-lg-8" }, [
        _c("div", { staticClass: "card shadow customer-info" }, [
          _c("div", { staticClass: "card-header" }, [
            _c("h4", { staticClass: "mb-0" }, [
              _vm._v("Tarjouspyyntöön lisätty: "),
              _vm._m(2),
              _vm._v(" "),
              _c("span", {
                staticClass: "text-info",
                domProps: {
                  innerHTML: _vm._s(+_vm.selectedGroupCount() + " tuoteryhmää")
                }
              })
            ])
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "card-body" }, [
            _c("div", { staticClass: "row" }, [
              _c("div", { staticClass: "col-lg-7" }, [
                _c("div", { staticClass: "form-row" }, [
                  _c("div", { staticClass: "col-lg-6" }, [
                    _c("div", { staticClass: "form-group" }, [
                      _c("label", [_vm._v("Etunimi*")]),
                      _vm._v(" "),
                      _c(
                        "div",
                        [
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.offerRequest,
                              requiredPropName: "UserFirstNameRequired",
                              inputType: "text",
                              required: _vm.offerRequest.UserFirstNameRequired,
                              requiredErrorMessage: "Etunimi on pakollinen",
                              disabled:
                                _vm.offerRequest.LoggedInRegisteredUser ||
                                _vm.initializing
                            },
                            model: {
                              value: _vm.offerRequest.UserFirstName,
                              callback: function($$v) {
                                _vm.$set(_vm.offerRequest, "UserFirstName", $$v);
                              },
                              expression: "offerRequest.UserFirstName"
                            }
                          })
                        ],
                        1
                      )
                    ])
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "col-lg-6" }, [
                    _c("div", { staticClass: "form-group" }, [
                      _c("label", [_vm._v("Sukunimi*")]),
                      _vm._v(" "),
                      _c(
                        "div",
                        [
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.offerRequest,
                              requiredPropName: "UserLastnameRequired",
                              inputType: "text",
                              required: _vm.offerRequest.UserLastnameRequired,
                              requiredErrorMessage: "Sukunimi on pakollinen",
                              disabled:
                                _vm.offerRequest.LoggedInRegisteredUser ||
                                _vm.initializing
                            },
                            model: {
                              value: _vm.offerRequest.UserLastname,
                              callback: function($$v) {
                                _vm.$set(_vm.offerRequest, "UserLastname", $$v);
                              },
                              expression: "offerRequest.UserLastname"
                            }
                          })
                        ],
                        1
                      )
                    ])
                  ])
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "form-row" }, [
                  _c("div", { staticClass: "col-lg-6" }, [
                    _c("div", { staticClass: "form-group" }, [
                      _c("label", [_vm._v("Sähköposti*")]),
                      _vm._v(" "),
                      _c(
                        "div",
                        [
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.offerRequest,
                              requiredPropName: "UserEmailRequired",
                              invalidPropName: "UserEmailInvalid",
                              inputType: "email",
                              required: _vm.offerRequest.UserEmailRequired,
                              requiredErrorMessage: "Sähköposti on pakollinen",
                              invalid: _vm.offerRequest.UserEmailInvalid,
                              invalidErrorMessage: "Sähköposti on väärää muotoa",
                              disabled:
                                _vm.offerRequest.LoggedInRegisteredUser ||
                                _vm.initializing
                            },
                            model: {
                              value: _vm.offerRequest.UserEmail,
                              callback: function($$v) {
                                _vm.$set(_vm.offerRequest, "UserEmail", $$v);
                              },
                              expression: "offerRequest.UserEmail"
                            }
                          })
                        ],
                        1
                      )
                    ])
                  ]),
                  _vm._v(" "),
                  _c("div", { staticClass: "col-lg-6" }, [
                    _c("div", { staticClass: "form-group" }, [
                      _c("label", [_vm._v("Puhelin")]),
                      _vm._v(" "),
                      _c("input", {
                        directives: [
                          {
                            name: "model",
                            rawName: "v-model",
                            value: _vm.offerRequest.Phone,
                            expression: "offerRequest.Phone"
                          }
                        ],
                        staticClass: "form-control",
                        attrs: { disabled: _vm.initializing },
                        domProps: { value: _vm.offerRequest.Phone },
                        on: {
                          input: function($event) {
                            if ($event.target.composing) {
                              return
                            }
                            _vm.$set(
                              _vm.offerRequest,
                              "Phone",
                              $event.target.value
                            );
                          }
                        }
                      })
                    ])
                  ])
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "form-row" }, [
                  _c("div", { staticClass: "col-lg-6" }, [
                    _c("div", { staticClass: "form-group" }, [
                      _c("label", [_vm._v("Yritys*")]),
                      _vm._v(" "),
                      _c(
                        "div",
                        [
                          _c("ValidatingInput", {
                            attrs: {
                              shoppingCart: _vm.offerRequest,
                              requiredPropName: "CompanyNameRequired",
                              inputType: "text",
                              required: _vm.offerRequest.CompanyNameRequired,
                              requiredErrorMessage: "Yritys on pakollinen",
                              disabled:
                                _vm.offerRequest.LoggedInRegisteredUser ||
                                _vm.initializing
                            },
                            model: {
                              value: _vm.offerRequest.CompanyName,
                              callback: function($$v) {
                                _vm.$set(_vm.offerRequest, "CompanyName", $$v);
                              },
                              expression: "offerRequest.CompanyName"
                            }
                          })
                        ],
                        1
                      )
                    ])
                  ]),
                  _vm._v(" "),
                  _vm._m(3)
                ])
              ]),
              _vm._v(" "),
              _c("div", { staticClass: "col-lg-5" }, [
                _c("div", { staticClass: "form-row" }, [
                  _c("div", { staticClass: "col-md-12" }, [
                    _c("div", { staticClass: "form-group additional" }, [
                      _c("label", [_vm._v("Lisätiedot")]),
                      _vm._v(" "),
                      _c("textarea", {
                        directives: [
                          {
                            name: "model",
                            rawName: "v-model",
                            value: _vm.offerRequest.AdditionalInfo,
                            expression: "offerRequest.AdditionalInfo"
                          }
                        ],
                        staticClass: "form-control",
                        attrs: { rows: "4", cols: "20" },
                        domProps: { value: _vm.offerRequest.AdditionalInfo },
                        on: {
                          input: function($event) {
                            if ($event.target.composing) {
                              return
                            }
                            _vm.$set(
                              _vm.offerRequest,
                              "AdditionalInfo",
                              $event.target.value
                            );
                          }
                        }
                      })
                    ])
                  ])
                ]),
                _vm._v(" "),
                _c("div", { staticClass: "form-row" }, [
                  _c("div", { staticClass: "col-md-12" }, [
                    _c("div", { staticClass: "form-check vertical-rythm" }, [
                      _c("input", {
                        directives: [
                          {
                            name: "model",
                            rawName: "v-model",
                            value: _vm.offerRequest.AcceptTerms,
                            expression: "offerRequest.AcceptTerms"
                          }
                        ],
                        staticClass: "form-check-input",
                        attrs: { type: "checkbox", id: "acceptTerms" },
                        domProps: {
                          checked: Array.isArray(_vm.offerRequest.AcceptTerms)
                            ? _vm._i(_vm.offerRequest.AcceptTerms, null) > -1
                            : _vm.offerRequest.AcceptTerms
                        },
                        on: {
                          change: function($event) {
                            var $$a = _vm.offerRequest.AcceptTerms,
                              $$el = $event.target,
                              $$c = $$el.checked ? true : false;
                            if (Array.isArray($$a)) {
                              var $$v = null,
                                $$i = _vm._i($$a, $$v);
                              if ($$el.checked) {
                                $$i < 0 &&
                                  _vm.$set(
                                    _vm.offerRequest,
                                    "AcceptTerms",
                                    $$a.concat([$$v])
                                  );
                              } else {
                                $$i > -1 &&
                                  _vm.$set(
                                    _vm.offerRequest,
                                    "AcceptTerms",
                                    $$a.slice(0, $$i).concat($$a.slice($$i + 1))
                                  );
                              }
                            } else {
                              _vm.$set(_vm.offerRequest, "AcceptTerms", $$c);
                            }
                          }
                        }
                      }),
                      _vm._v(" "),
                      _c(
                        "label",
                        {
                          staticClass: "form-check-label",
                          attrs: { for: "acceptTerms" }
                        },
                        [
                          _vm._v(
                            "\n                                        Hyväksyn tietojeni tallentamisen kaupankäyntiä varten. Lue lisää "
                          ),
                          _c(
                            "a",
                            {
                              attrs: {
                                href: "/kayttoehdot/tarjouspyynto",
                                target: "_blank"
                              }
                            },
                            [_vm._v("käyttöehdoista")]
                          ),
                          _vm._v(" ja "),
                          _c(
                            "a",
                            {
                              attrs: {
                                href: "/tietosuojaseloste",
                                target: "_blank"
                              }
                            },
                            [_vm._v("tietosuojapolitiikasta")]
                          ),
                          _vm._v(". *\n                                        "),
                          _vm.offerRequest.AcceptTermsRequired &&
                          !_vm.offerRequest.AcceptTerms
                            ? _c(
                                "span",
                                {
                                  staticClass:
                                    "alert alert-warning d-block text-sm"
                                },
                                [
                                  _vm._v(
                                    "Kaupankäynnin käyttöehdot on hyväksyttävä."
                                  )
                                ]
                              )
                            : _vm._e()
                        ]
                      )
                    ]),
                    _vm._v(" "),
                    _c("div", { staticClass: "form-check" }, [
                      _c("input", {
                        directives: [
                          {
                            name: "model",
                            rawName: "v-model",
                            value: _vm.offerRequest.AllowMarketing,
                            expression: "offerRequest.AllowMarketing"
                          }
                        ],
                        staticClass: "form-check-input",
                        attrs: { type: "checkbox", id: "allowMarketing" },
                        domProps: {
                          checked: Array.isArray(_vm.offerRequest.AllowMarketing)
                            ? _vm._i(_vm.offerRequest.AllowMarketing, null) > -1
                            : _vm.offerRequest.AllowMarketing
                        },
                        on: {
                          change: function($event) {
                            var $$a = _vm.offerRequest.AllowMarketing,
                              $$el = $event.target,
                              $$c = $$el.checked ? true : false;
                            if (Array.isArray($$a)) {
                              var $$v = null,
                                $$i = _vm._i($$a, $$v);
                              if ($$el.checked) {
                                $$i < 0 &&
                                  _vm.$set(
                                    _vm.offerRequest,
                                    "AllowMarketing",
                                    $$a.concat([$$v])
                                  );
                              } else {
                                $$i > -1 &&
                                  _vm.$set(
                                    _vm.offerRequest,
                                    "AllowMarketing",
                                    $$a.slice(0, $$i).concat($$a.slice($$i + 1))
                                  );
                              }
                            } else {
                              _vm.$set(_vm.offerRequest, "AllowMarketing", $$c);
                            }
                          }
                        }
                      }),
                      _vm._v(" "),
                      _vm._m(4)
                    ])
                  ])
                ])
              ])
            ])
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "card-footer" }, [
            _c("div", { staticClass: "row" }, [
              _vm._m(5),
              _vm._v(" "),
              _c("div", { staticClass: "col-md-4 text-right" }, [
                _c("input", {
                  staticStyle: { display: "none" },
                  attrs: {
                    id: "hb-feedback-field",
                    type: "text",
                    autocomplete: "off"
                  }
                }),
                _vm._v(" "),
                _c(
                  "a",
                  {
                    staticClass:
                      "btn btn-lg btn-success btn-block tagmngr-offer-request",
                    class: { disabled: _vm.selectedGroupsEmpty },
                    on: {
                      click: function($event) {
                        $event.preventDefault();
                        return _vm.acceptOfferRequest()
                      }
                    }
                  },
                  [
                    _c("i", {
                      staticClass: "fal fa-paper-plane mr-1",
                      attrs: { "aria-hidden": "true" }
                    }),
                    _vm._v("Lähetä tarjouspyyntö\n                        ")
                  ]
                )
              ])
            ])
          ])
        ])
      ])
    ])
  };
  var __vue_staticRenderFns__$f = [
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "card-header" }, [
        _c("h4", { staticClass: "mb-0" }, [
          _vm._v("Valitse tuoteryhmiä tarjouspyyntöön")
        ])
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("span", { staticClass: "mr-2" }, [
        _c("i", { staticClass: "fa-light fa-loader rotate" })
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("span", { staticClass: "text-info" }, [
        _c("i", { staticClass: "fa-solid fa-badge-check" })
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-lg-6" }, [
        _c("div", { staticClass: "form-group" })
      ])
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c(
        "label",
        { staticClass: "form-check-label", attrs: { for: "allowMarketing" } },
        [
          _vm._v(
            "\n                                        Haluan tietoa uutuuksista ja kampanjoista. "
          ),
          _c("a", { attrs: { href: "/kayttoehdot", target: "_blank" } }, [
            _vm._v("Lue lisää käyttöehdoista")
          ]),
          _vm._v(".\n                                    ")
        ]
      )
    },
    function() {
      var _vm = this;
      var _h = _vm.$createElement;
      var _c = _vm._self._c || _h;
      return _c("div", { staticClass: "col-md-8 text-muted" }, [
        _c("span", { staticClass: "text-sm" }, [
          _vm._v(
            "Saat ilmoituksen tarjouspyynnön vastaanotosta sähköpostiisi. Vastaamme sinulle mahdollisimman pian. Tutustuthan myös "
          ),
          _c("a", { attrs: { href: "/toimitusehdot", target: "_blank" } }, [
            _vm._v("toimitusehtoihin.")
          ])
        ])
      ])
    }
  ];
  __vue_render__$f._withStripped = true;

    /* style */
    const __vue_inject_styles__$f = undefined;
    /* scoped */
    const __vue_scope_id__$f = undefined;
    /* module identifier */
    const __vue_module_identifier__$f = undefined;
    /* functional template */
    const __vue_is_functional_template__$f = false;
    /* style inject */
    
    /* style inject SSR */
    
    /* style inject shadow dom */
    

    
    const __vue_component__$f = /*#__PURE__*/normalizeComponent(
      { render: __vue_render__$f, staticRenderFns: __vue_staticRenderFns__$f },
      __vue_inject_styles__$f,
      __vue_script__$d,
      __vue_scope_id__$f,
      __vue_is_functional_template__$f,
      __vue_module_identifier__$f,
      false,
      undefined,
      undefined,
      undefined
    );

  document.addEventListener('DOMContentLoaded', function (event) {
    //if (document.querySelector('#product-pages-grid-vue')) {
    //  let productPageGridApp = new Vue({
    //    el: '#product-pages-grid-vue',
    //    render: h => h(ProductPagesGrid)
    //  });
    //}
    // Do other vue initializing here, including usercontrol based with a class name
    //Public offer request
    if (document.querySelector('#publicOfferRequestVueFormViewCtrl')) {
      var publicOfferRequestApp = new Vue({
        el: '#publicOfferRequestVueFormViewCtrl',
        render: function render(h) {
          return h(__vue_component__$2);
        }
      });
    } //Customer order form view


    if (document.querySelector('#customerOrderVueFormViewCtrl')) {
      var customerOrderApp = new Vue({
        el: '#customerOrderVueFormViewCtrl',
        render: function render(h) {
          return h(__vue_component__$b);
        }
      });
    } //Customer order summary view


    if (document.querySelector('#customerOrderVueSummaryViewCtrl')) {
      var customerOrderSummaryApp = new Vue({
        el: '#customerOrderVueSummaryViewCtrl',
        render: function render(h) {
          return h(__vue_component__$c);
        }
      });
    } //Own products settings


    if (document.querySelector('#own-products-settings-ctrl')) {
      var ownProductsSettingsApp = new Vue({
        el: '#own-products-settings-ctrl',
        render: function render(h) {
          return h(__vue_component__$d);
        }
      });
    } //Product group offer request


    if (document.querySelector('#productGroupOfferRequestCtrl')) {
      var productGroupOfferRequestApp = new Vue({
        el: '#productGroupOfferRequestCtrl',
        render: function render(h) {
          return h(__vue_component__$f);
        }
      });
    }
  });

}());
;
