/** vim: et:ts=4:sw=4:sts=4
 * @license RequireJS 2.1.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/requirejs for details
 */
//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) {
    var req, s, head, baseElement, dataMain, src,
        interactiveScript, currentlyAddingScript, mainScript, subPath,
        version = '2.1.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,
        ap = Array.prototype,
        apsp = ap.splice,
        isBrowser = !!(typeof window !== 'undefined' && navigator && 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;

    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 !== 'string') {
                        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');
    }

    //Allow getting a global that expressed in
    //dot notation, like 'a.b.c'.
    function getGlobal(value) {
        if (!value) {
            return value;
        }
        var g = global;
        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 and 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: {},
                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 = {},
            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; ary[i]; i += 1) {
                part = ary[i];
                if (part === '.') {
                    ary.splice(i, 1);
                    i -= 1;
                } else if (part === '..') {
                    if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
                        //End of the line. Keep at least one non-dot
                        //path segment at the front so it can be mapped
                        //correctly to disk. Otherwise, there is likely
                        //no path mapping for a path starting with '..'.
                        //This can still fail, but catches the most reasonable
                        //uses of ..
                        break;
                    } 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) {
            var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
                foundMap, foundI, foundStarMap, starI,
                baseParts = baseName && baseName.split('/'),
                normalizedBaseParts = baseParts,
                map = config.map,
                starMap = map && map['*'];

            //Adjust any relative paths.
            if (name && name.charAt(0) === '.') {
                //If have a base name, try to normalize against it,
                //otherwise, assume it is a top-level require that will
                //be relative to baseUrl in the end.
                if (baseName) {
                    if (getOwn(config.pkgs, baseName)) {
                        //If the baseName is a package name, then just treat it as one
                        //name to concat the name with.
                        normalizedBaseParts = baseParts = [baseName];
                    } else {
                        //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.split('/'));
                    trimDots(name);

                    //Some use of packages may use a . path to reference the
                    //'main' module name, so normalize for that.
                    pkgConfig = getOwn(config.pkgs, (pkgName = name[0]));
                    name = name.join('/');
                    if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
                        name = pkgName;
                    }
                } else if (name.indexOf('./') === 0) {
                    // No baseName, so this is ID is resolved relative
                    // to baseUrl, pull off the leading dot.
                    name = name.substring(2);
                }
            }

            //Apply map config if available.
            if (applyMap && map && (baseParts || starMap)) {
                nameParts = name.split('/');

                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;
                                }
                            }
                        }
                    }

                    if (foundMap) {
                        break;
                    }

                    //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('/');
                }
            }

            return 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) {
                removeScript(id);
                //Pop off the first array value, since it failed, and
                //retry
                pathConfig.shift();
                context.require.undef(id);
                context.require([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);
            }

            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 (pluginModule && pluginModule.normalize) {
                        //Plugin is loaded, use its normalize method.
                        normalizedName = pluginModule.normalize(name, function (name) {
                            return normalize(name, parentName, applyMap);
                        });
                    } else {
                        normalizedName = normalize(name, parentName, applyMap);
                    }
                } 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.
                    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 {
                getModule(depMap).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) {
                //Array splice in the values since the context code has a
                //local var ref to defQueue, so cannot just reassign the one
                //on context.
                apsp.apply(defQueue,
                           [defQueue.length - 1, 0].concat(globalDefQueue));
                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 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 (config.config && getOwn(config.config, mod.map.id)) || {};
                        },
                        exports: defined[mod.map.id]
                    });
                }
            }
        };

        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 map, modId, 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) {
                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) {
                    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.
                            if (this.events.error) {
                                try {
                                    exports = context.execCb(id, factory, depExports, exports);
                                } catch (e) {
                                    err = e;
                                }
                            } else {
                                exports = context.execCb(id, factory, depExports, exports);
                            }

                            if (this.map.isDefine) {
                                //If setting exports via 'module' is in play,
                                //favor that over return value and exports. After that,
                                //favor a non-undefined return value over exports use.
                                cjsModule = this.module;
                                if (cjsModule &&
                                        cjsModule.exports !== undefined &&
                                        //Make sure it is not already the exports value
                                        cjsModule.exports !== this.exports) {
                                    exports = cjsModule.exports;
                                } else if (exports === undefined && this.usingExports) {
                                    //exports already set the defined value.
                                    exports = this.exports;
                                }
                            }

                            if (err) {
                                err.requireMap = this.map;
                                err.requireModules = [this.map.id];
                                err.requireType = 'define';
                                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) {
                                req.onResourceLoad(context, this.map, this.depMaps);
                            }
                        }

                        //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,
                        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);
                        on(normalizedMap,
                            'defined', bind(this, function (value) {
                                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;
                    }

                    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) {
                            this.defineDep(i, depExports);
                            this.check();
                        }));

                        if (this.errback) {
                            on(depMap, 'error', this.errback);
                        }
                    }

                    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 = {
            config: config,
            contextName: contextName,
            registry: registry,
            defined: defined,
            urlFetched: urlFetched,
            defQueue: defQueue,
            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 += '/';
                    }
                }

                //Save off the paths and packages since they require special processing,
                //they are additive.
                var pkgs = config.pkgs,
                    shim = config.shim,
                    objs = {
                        paths: true,
                        config: true,
                        map: true
                    };

                eachProp(cfg, function (value, prop) {
                    if (objs[prop]) {
                        if (prop === 'map') {
                            if (!config.map) {
                                config.map = {};
                            }
                            mixin(config[prop], value, true, true);
                        } else {
                            mixin(config[prop], value, true);
                        }
                    } else {
                        config[prop] = value;
                    }
                });

                //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;

                        pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
                        location = pkgObj.location;

                        //Create a brand new object on pkgs, since currentPackages can
                        //be passed in again, and config.pkgs is the internal transformed
                        //state for all package configs.
                        pkgs[pkgObj.name] = {
                            name: pkgObj.name,
                            location: location || pkgObj.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.
                            main: (pkgObj.main || 'main')
                                  .replace(currDirRegExp, '')
                                  .replace(jsSuffixRegExp, '')
                        };
                    });

                    //Done with modifications, assing packages back to context config
                    config.pkgs = pkgs;
                }

                //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);
                    }
                });

                //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) {
                        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);

                        delete defined[id];
                        delete urlFetched[map.url];
                        delete undefEvents[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 overriden 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);
                }

                //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, pkgs, pkg, pkgPath, syms, i, parentModule, url,
                    parentPath;

                //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;
                    pkgs = config.pkgs;

                    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('/');
                        pkg = getOwn(pkgs, parentModule);
                        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;
                        } else if (pkg) {
                            //If module name is just the package name, then looking
                            //for the main module.
                            if (moduleName === pkg.name) {
                                pkgPath = pkg.location + '/' + pkg.main;
                            } else {
                                pkgPath = pkg.location;
                            }
                            syms.splice(0, i, pkgPath);
                            break;
                        }
                    }

                    //Join the path parts together, then figure out if baseUrl is needed.
                    url = syms.join('/');
                    url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
                    url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
                }

                return config.urlArgs ? url +
                                        ((url.indexOf('?') === -1 ? '?' : '&') +
                                         config.urlArgs) : 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 callack 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)) {
                    return onError(makeError('scripterror', 'Script error', 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 = function (err) {
        throw err;
    };

    /**
     * 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 = 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;

            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/jrburke/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/jrburke/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;

            //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 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.
                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) {
        //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) {
                //Set final baseUrl if there is not already an explicit one.
                if (!cfg.baseUrl) {
                    //Pull off the directory of data-main for use as the
                    //baseUrl.
                    src = dataMain.split('/');
                    mainScript = src.pop();
                    subPath = src.length ? src.join('/')  + '/' : './';

                    cfg.baseUrl = subPath;
                    dataMain = mainScript;
                }

                //Strip off any trailing .js since dataMain is now
                //like a module name.
                dataMain = dataMain.replace(jsSuffixRegExp, '');

                //Put the data-main script in the files to load.
                cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];

                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 = [];
        }

        //If no name, and callback is a function, then figure out if it a
        //CommonJS thing with dependencies.
        if (!deps.length && isFunction(callback)) {
            //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, '')
                    .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.
        (context ? context.defQueue : 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));

var components = {
    "packages": [
        {
            "name": "bootstrap",
            "main": "bootstrap-built.js"
        },
        {
            "name": "jquery",
            "main": "jquery-built.js"
        },
        {
            "name": "jquery-ui",
            "main": "jquery-ui-built.js"
        },
        {
            "name": "underscore",
            "main": "underscore-built.js"
        },
        {
            "name": "openlayers6-es5",
            "main": "openlayers6-es5-built.js"
        },
        {
            "name": "vis-ui.js",
            "main": "vis-ui.js-built.js"
        },
        {
            "name": "jquery-context-menu",
            "main": "jquery-context-menu-built.js"
        },
        {
            "name": "select2",
            "main": "select2-built.js"
        },
        {
            "name": "jquerydialogextendjs",
            "main": "jquerydialogextendjs-built.js"
        }
    ],
    "shim": {
        "bootstrap": {
            "deps": [
                "jquery"
            ]
        },
        "jquery-ui": {
            "deps": [
                "jquery"
            ],
            "exports": "jQuery"
        },
        "underscore": {
            "exports": "_"
        }
    },
    "baseUrl": "/components"
};
if (typeof require !== "undefined" && require.config) {
    require.config(components);
} else {
    var require = components;
}
if (typeof exports !== "undefined" && typeof module !== "undefined") {
    module.exports = components;
}
define('bootstrap', function (require, exports, module) {
/*!
 * Bootstrap v3.4.1 (https://getbootstrap.com/)
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under the MIT license
 */

if (typeof jQuery === 'undefined') {
  throw new Error('Bootstrap\'s JavaScript requires jQuery')
}

+function ($) {
  'use strict';
  var version = $.fn.jquery.split(' ')[0].split('.')
  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
    throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  }
}(jQuery);

/* ========================================================================
 * Bootstrap: transition.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#transitions
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/)
  // ============================================================

  function transitionEnd() {
    var el = document.createElement('bootstrap')

    var transEndEventNames = {
      WebkitTransition : 'webkitTransitionEnd',
      MozTransition    : 'transitionend',
      OTransition      : 'oTransitionEnd otransitionend',
      transition       : 'transitionend'
    }

    for (var name in transEndEventNames) {
      if (el.style[name] !== undefined) {
        return { end: transEndEventNames[name] }
      }
    }

    return false // explicit for ie8 (  ._.)
  }

  // https://blog.alexmaccaw.com/css-transitions
  $.fn.emulateTransitionEnd = function (duration) {
    var called = false
    var $el = this
    $(this).one('bsTransitionEnd', function () { called = true })
    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
    setTimeout(callback, duration)
    return this
  }

  $(function () {
    $.support.transition = transitionEnd()

    if (!$.support.transition) return

    $.event.special.bsTransitionEnd = {
      bindType: $.support.transition.end,
      delegateType: $.support.transition.end,
      handle: function (e) {
        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
      }
    }
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: alert.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#alerts
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // ALERT CLASS DEFINITION
  // ======================

  var dismiss = '[data-dismiss="alert"]'
  var Alert   = function (el) {
    $(el).on('click', dismiss, this.close)
  }

  Alert.VERSION = '3.4.1'

  Alert.TRANSITION_DURATION = 150

  Alert.prototype.close = function (e) {
    var $this    = $(this)
    var selector = $this.attr('data-target')

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }

    selector    = selector === '#' ? [] : selector
    var $parent = $(document).find(selector)

    if (e) e.preventDefault()

    if (!$parent.length) {
      $parent = $this.closest('.alert')
    }

    $parent.trigger(e = $.Event('close.bs.alert'))

    if (e.isDefaultPrevented()) return

    $parent.removeClass('in')

    function removeElement() {
      // detach from parent, fire event then clean up data
      $parent.detach().trigger('closed.bs.alert').remove()
    }

    $.support.transition && $parent.hasClass('fade') ?
      $parent
        .one('bsTransitionEnd', removeElement)
        .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
      removeElement()
  }


  // ALERT PLUGIN DEFINITION
  // =======================

  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.alert')

      if (!data) $this.data('bs.alert', (data = new Alert(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }

  var old = $.fn.alert

  $.fn.alert             = Plugin
  $.fn.alert.Constructor = Alert


  // ALERT NO CONFLICT
  // =================

  $.fn.alert.noConflict = function () {
    $.fn.alert = old
    return this
  }


  // ALERT DATA-API
  // ==============

  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)

}(jQuery);

/* ========================================================================
 * Bootstrap: button.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#buttons
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // BUTTON PUBLIC CLASS DEFINITION
  // ==============================

  var Button = function (element, options) {
    this.$element  = $(element)
    this.options   = $.extend({}, Button.DEFAULTS, options)
    this.isLoading = false
  }

  Button.VERSION  = '3.4.1'

  Button.DEFAULTS = {
    loadingText: 'loading...'
  }

  Button.prototype.setState = function (state) {
    var d    = 'disabled'
    var $el  = this.$element
    var val  = $el.is('input') ? 'val' : 'html'
    var data = $el.data()

    state += 'Text'

    if (data.resetText == null) $el.data('resetText', $el[val]())

    // push to event loop to allow forms to submit
    setTimeout($.proxy(function () {
      $el[val](data[state] == null ? this.options[state] : data[state])

      if (state == 'loadingText') {
        this.isLoading = true
        $el.addClass(d).attr(d, d).prop(d, true)
      } else if (this.isLoading) {
        this.isLoading = false
        $el.removeClass(d).removeAttr(d).prop(d, false)
      }
    }, this), 0)
  }

  Button.prototype.toggle = function () {
    var changed = true
    var $parent = this.$element.closest('[data-toggle="buttons"]')

    if ($parent.length) {
      var $input = this.$element.find('input')
      if ($input.prop('type') == 'radio') {
        if ($input.prop('checked')) changed = false
        $parent.find('.active').removeClass('active')
        this.$element.addClass('active')
      } else if ($input.prop('type') == 'checkbox') {
        if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
        this.$element.toggleClass('active')
      }
      $input.prop('checked', this.$element.hasClass('active'))
      if (changed) $input.trigger('change')
    } else {
      this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
      this.$element.toggleClass('active')
    }
  }


  // BUTTON PLUGIN DEFINITION
  // ========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.button')
      var options = typeof option == 'object' && option

      if (!data) $this.data('bs.button', (data = new Button(this, options)))

      if (option == 'toggle') data.toggle()
      else if (option) data.setState(option)
    })
  }

  var old = $.fn.button

  $.fn.button             = Plugin
  $.fn.button.Constructor = Button


  // BUTTON NO CONFLICT
  // ==================

  $.fn.button.noConflict = function () {
    $.fn.button = old
    return this
  }


  // BUTTON DATA-API
  // ===============

  $(document)
    .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
      var $btn = $(e.target).closest('.btn')
      Plugin.call($btn, 'toggle')
      if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
        // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
        e.preventDefault()
        // The target component still receive the focus
        if ($btn.is('input,button')) $btn.trigger('focus')
        else $btn.find('input:visible,button:visible').first().trigger('focus')
      }
    })
    .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
      $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
    })

}(jQuery);

/* ========================================================================
 * Bootstrap: carousel.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#carousel
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // CAROUSEL CLASS DEFINITION
  // =========================

  var Carousel = function (element, options) {
    this.$element    = $(element)
    this.$indicators = this.$element.find('.carousel-indicators')
    this.options     = options
    this.paused      = null
    this.sliding     = null
    this.interval    = null
    this.$active     = null
    this.$items      = null

    this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))

    this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
      .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
      .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  }

  Carousel.VERSION  = '3.4.1'

  Carousel.TRANSITION_DURATION = 600

  Carousel.DEFAULTS = {
    interval: 5000,
    pause: 'hover',
    wrap: true,
    keyboard: true
  }

  Carousel.prototype.keydown = function (e) {
    if (/input|textarea/i.test(e.target.tagName)) return
    switch (e.which) {
      case 37: this.prev(); break
      case 39: this.next(); break
      default: return
    }

    e.preventDefault()
  }

  Carousel.prototype.cycle = function (e) {
    e || (this.paused = false)

    this.interval && clearInterval(this.interval)

    this.options.interval
      && !this.paused
      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))

    return this
  }

  Carousel.prototype.getItemIndex = function (item) {
    this.$items = item.parent().children('.item')
    return this.$items.index(item || this.$active)
  }

  Carousel.prototype.getItemForDirection = function (direction, active) {
    var activeIndex = this.getItemIndex(active)
    var willWrap = (direction == 'prev' && activeIndex === 0)
                || (direction == 'next' && activeIndex == (this.$items.length - 1))
    if (willWrap && !this.options.wrap) return active
    var delta = direction == 'prev' ? -1 : 1
    var itemIndex = (activeIndex + delta) % this.$items.length
    return this.$items.eq(itemIndex)
  }

  Carousel.prototype.to = function (pos) {
    var that        = this
    var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))

    if (pos > (this.$items.length - 1) || pos < 0) return

    if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
    if (activeIndex == pos) return this.pause().cycle()

    return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  }

  Carousel.prototype.pause = function (e) {
    e || (this.paused = true)

    if (this.$element.find('.next, .prev').length && $.support.transition) {
      this.$element.trigger($.support.transition.end)
      this.cycle(true)
    }

    this.interval = clearInterval(this.interval)

    return this
  }

  Carousel.prototype.next = function () {
    if (this.sliding) return
    return this.slide('next')
  }

  Carousel.prototype.prev = function () {
    if (this.sliding) return
    return this.slide('prev')
  }

  Carousel.prototype.slide = function (type, next) {
    var $active   = this.$element.find('.item.active')
    var $next     = next || this.getItemForDirection(type, $active)
    var isCycling = this.interval
    var direction = type == 'next' ? 'left' : 'right'
    var that      = this

    if ($next.hasClass('active')) return (this.sliding = false)

    var relatedTarget = $next[0]
    var slideEvent = $.Event('slide.bs.carousel', {
      relatedTarget: relatedTarget,
      direction: direction
    })
    this.$element.trigger(slideEvent)
    if (slideEvent.isDefaultPrevented()) return

    this.sliding = true

    isCycling && this.pause()

    if (this.$indicators.length) {
      this.$indicators.find('.active').removeClass('active')
      var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
      $nextIndicator && $nextIndicator.addClass('active')
    }

    var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
    if ($.support.transition && this.$element.hasClass('slide')) {
      $next.addClass(type)
      if (typeof $next === 'object' && $next.length) {
        $next[0].offsetWidth // force reflow
      }
      $active.addClass(direction)
      $next.addClass(direction)
      $active
        .one('bsTransitionEnd', function () {
          $next.removeClass([type, direction].join(' ')).addClass('active')
          $active.removeClass(['active', direction].join(' '))
          that.sliding = false
          setTimeout(function () {
            that.$element.trigger(slidEvent)
          }, 0)
        })
        .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
    } else {
      $active.removeClass('active')
      $next.addClass('active')
      this.sliding = false
      this.$element.trigger(slidEvent)
    }

    isCycling && this.cycle()

    return this
  }


  // CAROUSEL PLUGIN DEFINITION
  // ==========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.carousel')
      var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
      var action  = typeof option == 'string' ? option : options.slide

      if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
      if (typeof option == 'number') data.to(option)
      else if (action) data[action]()
      else if (options.interval) data.pause().cycle()
    })
  }

  var old = $.fn.carousel

  $.fn.carousel             = Plugin
  $.fn.carousel.Constructor = Carousel


  // CAROUSEL NO CONFLICT
  // ====================

  $.fn.carousel.noConflict = function () {
    $.fn.carousel = old
    return this
  }


  // CAROUSEL DATA-API
  // =================

  var clickHandler = function (e) {
    var $this   = $(this)
    var href    = $this.attr('href')
    if (href) {
      href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
    }

    var target  = $this.attr('data-target') || href
    var $target = $(document).find(target)

    if (!$target.hasClass('carousel')) return

    var options = $.extend({}, $target.data(), $this.data())
    var slideIndex = $this.attr('data-slide-to')
    if (slideIndex) options.interval = false

    Plugin.call($target, options)

    if (slideIndex) {
      $target.data('bs.carousel').to(slideIndex)
    }

    e.preventDefault()
  }

  $(document)
    .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
    .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)

  $(window).on('load', function () {
    $('[data-ride="carousel"]').each(function () {
      var $carousel = $(this)
      Plugin.call($carousel, $carousel.data())
    })
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: collapse.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#collapse
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* jshint latedef: false */

+function ($) {
  'use strict';

  // COLLAPSE PUBLIC CLASS DEFINITION
  // ================================

  var Collapse = function (element, options) {
    this.$element      = $(element)
    this.options       = $.extend({}, Collapse.DEFAULTS, options)
    this.$trigger      = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
                           '[data-toggle="collapse"][data-target="#' + element.id + '"]')
    this.transitioning = null

    if (this.options.parent) {
      this.$parent = this.getParent()
    } else {
      this.addAriaAndCollapsedClass(this.$element, this.$trigger)
    }

    if (this.options.toggle) this.toggle()
  }

  Collapse.VERSION  = '3.4.1'

  Collapse.TRANSITION_DURATION = 350

  Collapse.DEFAULTS = {
    toggle: true
  }

  Collapse.prototype.dimension = function () {
    var hasWidth = this.$element.hasClass('width')
    return hasWidth ? 'width' : 'height'
  }

  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return

    var activesData
    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')

    if (actives && actives.length) {
      activesData = actives.data('bs.collapse')
      if (activesData && activesData.transitioning) return
    }

    var startEvent = $.Event('show.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return

    if (actives && actives.length) {
      Plugin.call(actives, 'hide')
      activesData || actives.data('bs.collapse', null)
    }

    var dimension = this.dimension()

    this.$element
      .removeClass('collapse')
      .addClass('collapsing')[dimension](0)
      .attr('aria-expanded', true)

    this.$trigger
      .removeClass('collapsed')
      .attr('aria-expanded', true)

    this.transitioning = 1

    var complete = function () {
      this.$element
        .removeClass('collapsing')
        .addClass('collapse in')[dimension]('')
      this.transitioning = 0
      this.$element
        .trigger('shown.bs.collapse')
    }

    if (!$.support.transition) return complete.call(this)

    var scrollSize = $.camelCase(['scroll', dimension].join('-'))

    this.$element
      .one('bsTransitionEnd', $.proxy(complete, this))
      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  }

  Collapse.prototype.hide = function () {
    if (this.transitioning || !this.$element.hasClass('in')) return

    var startEvent = $.Event('hide.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return

    var dimension = this.dimension()

    this.$element[dimension](this.$element[dimension]())[0].offsetHeight

    this.$element
      .addClass('collapsing')
      .removeClass('collapse in')
      .attr('aria-expanded', false)

    this.$trigger
      .addClass('collapsed')
      .attr('aria-expanded', false)

    this.transitioning = 1

    var complete = function () {
      this.transitioning = 0
      this.$element
        .removeClass('collapsing')
        .addClass('collapse')
        .trigger('hidden.bs.collapse')
    }

    if (!$.support.transition) return complete.call(this)

    this.$element
      [dimension](0)
      .one('bsTransitionEnd', $.proxy(complete, this))
      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  }

  Collapse.prototype.toggle = function () {
    this[this.$element.hasClass('in') ? 'hide' : 'show']()
  }

  Collapse.prototype.getParent = function () {
    return $(document).find(this.options.parent)
      .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
      .each($.proxy(function (i, element) {
        var $element = $(element)
        this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
      }, this))
      .end()
  }

  Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
    var isOpen = $element.hasClass('in')

    $element.attr('aria-expanded', isOpen)
    $trigger
      .toggleClass('collapsed', !isOpen)
      .attr('aria-expanded', isOpen)
  }

  function getTargetFromTrigger($trigger) {
    var href
    var target = $trigger.attr('data-target')
      || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7

    return $(document).find(target)
  }


  // COLLAPSE PLUGIN DEFINITION
  // ==========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.collapse')
      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)

      if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.collapse

  $.fn.collapse             = Plugin
  $.fn.collapse.Constructor = Collapse


  // COLLAPSE NO CONFLICT
  // ====================

  $.fn.collapse.noConflict = function () {
    $.fn.collapse = old
    return this
  }


  // COLLAPSE DATA-API
  // =================

  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
    var $this   = $(this)

    if (!$this.attr('data-target')) e.preventDefault()

    var $target = getTargetFromTrigger($this)
    var data    = $target.data('bs.collapse')
    var option  = data ? 'toggle' : $this.data()

    Plugin.call($target, option)
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: dropdown.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#dropdowns
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // DROPDOWN CLASS DEFINITION
  // =========================

  var backdrop = '.dropdown-backdrop'
  var toggle   = '[data-toggle="dropdown"]'
  var Dropdown = function (element) {
    $(element).on('click.bs.dropdown', this.toggle)
  }

  Dropdown.VERSION = '3.4.1'

  function getParent($this) {
    var selector = $this.attr('data-target')

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }

    var $parent = selector !== '#' ? $(document).find(selector) : null

    return $parent && $parent.length ? $parent : $this.parent()
  }

  function clearMenus(e) {
    if (e && e.which === 3) return
    $(backdrop).remove()
    $(toggle).each(function () {
      var $this         = $(this)
      var $parent       = getParent($this)
      var relatedTarget = { relatedTarget: this }

      if (!$parent.hasClass('open')) return

      if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return

      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))

      if (e.isDefaultPrevented()) return

      $this.attr('aria-expanded', 'false')
      $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
    })
  }

  Dropdown.prototype.toggle = function (e) {
    var $this = $(this)

    if ($this.is('.disabled, :disabled')) return

    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')

    clearMenus()

    if (!isActive) {
      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
        // if mobile we use a backdrop because click events don't delegate
        $(document.createElement('div'))
          .addClass('dropdown-backdrop')
          .insertAfter($(this))
          .on('click', clearMenus)
      }

      var relatedTarget = { relatedTarget: this }
      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))

      if (e.isDefaultPrevented()) return

      $this
        .trigger('focus')
        .attr('aria-expanded', 'true')

      $parent
        .toggleClass('open')
        .trigger($.Event('shown.bs.dropdown', relatedTarget))
    }

    return false
  }

  Dropdown.prototype.keydown = function (e) {
    if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return

    var $this = $(this)

    e.preventDefault()
    e.stopPropagation()

    if ($this.is('.disabled, :disabled')) return

    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')

    if (!isActive && e.which != 27 || isActive && e.which == 27) {
      if (e.which == 27) $parent.find(toggle).trigger('focus')
      return $this.trigger('click')
    }

    var desc = ' li:not(.disabled):visible a'
    var $items = $parent.find('.dropdown-menu' + desc)

    if (!$items.length) return

    var index = $items.index(e.target)

    if (e.which == 38 && index > 0)                 index--         // up
    if (e.which == 40 && index < $items.length - 1) index++         // down
    if (!~index)                                    index = 0

    $items.eq(index).trigger('focus')
  }


  // DROPDOWN PLUGIN DEFINITION
  // ==========================

  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.dropdown')

      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }

  var old = $.fn.dropdown

  $.fn.dropdown             = Plugin
  $.fn.dropdown.Constructor = Dropdown


  // DROPDOWN NO CONFLICT
  // ====================

  $.fn.dropdown.noConflict = function () {
    $.fn.dropdown = old
    return this
  }


  // APPLY TO STANDARD DROPDOWN ELEMENTS
  // ===================================

  $(document)
    .on('click.bs.dropdown.data-api', clearMenus)
    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
    .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
    .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)

}(jQuery);

/* ========================================================================
 * Bootstrap: modal.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#modals
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // MODAL CLASS DEFINITION
  // ======================

  var Modal = function (element, options) {
    this.options = options
    this.$body = $(document.body)
    this.$element = $(element)
    this.$dialog = this.$element.find('.modal-dialog')
    this.$backdrop = null
    this.isShown = null
    this.originalBodyPad = null
    this.scrollbarWidth = 0
    this.ignoreBackdropClick = false
    this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom'

    if (this.options.remote) {
      this.$element
        .find('.modal-content')
        .load(this.options.remote, $.proxy(function () {
          this.$element.trigger('loaded.bs.modal')
        }, this))
    }
  }

  Modal.VERSION = '3.4.1'

  Modal.TRANSITION_DURATION = 300
  Modal.BACKDROP_TRANSITION_DURATION = 150

  Modal.DEFAULTS = {
    backdrop: true,
    keyboard: true,
    show: true
  }

  Modal.prototype.toggle = function (_relatedTarget) {
    return this.isShown ? this.hide() : this.show(_relatedTarget)
  }

  Modal.prototype.show = function (_relatedTarget) {
    var that = this
    var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })

    this.$element.trigger(e)

    if (this.isShown || e.isDefaultPrevented()) return

    this.isShown = true

    this.checkScrollbar()
    this.setScrollbar()
    this.$body.addClass('modal-open')

    this.escape()
    this.resize()

    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))

    this.$dialog.on('mousedown.dismiss.bs.modal', function () {
      that.$element.one('mouseup.dismiss.bs.modal', function (e) {
        if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
      })
    })

    this.backdrop(function () {
      var transition = $.support.transition && that.$element.hasClass('fade')

      if (!that.$element.parent().length) {
        that.$element.appendTo(that.$body) // don't move modals dom position
      }

      that.$element
        .show()
        .scrollTop(0)

      that.adjustDialog()

      if (transition) {
        that.$element[0].offsetWidth // force reflow
      }

      that.$element.addClass('in')

      that.enforceFocus()

      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })

      transition ?
        that.$dialog // wait for modal to slide in
          .one('bsTransitionEnd', function () {
            that.$element.trigger('focus').trigger(e)
          })
          .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
        that.$element.trigger('focus').trigger(e)
    })
  }

  Modal.prototype.hide = function (e) {
    if (e) e.preventDefault()

    e = $.Event('hide.bs.modal')

    this.$element.trigger(e)

    if (!this.isShown || e.isDefaultPrevented()) return

    this.isShown = false

    this.escape()
    this.resize()

    $(document).off('focusin.bs.modal')

    this.$element
      .removeClass('in')
      .off('click.dismiss.bs.modal')
      .off('mouseup.dismiss.bs.modal')

    this.$dialog.off('mousedown.dismiss.bs.modal')

    $.support.transition && this.$element.hasClass('fade') ?
      this.$element
        .one('bsTransitionEnd', $.proxy(this.hideModal, this))
        .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
      this.hideModal()
  }

  Modal.prototype.enforceFocus = function () {
    $(document)
      .off('focusin.bs.modal') // guard against infinite focus loop
      .on('focusin.bs.modal', $.proxy(function (e) {
        if (document !== e.target &&
          this.$element[0] !== e.target &&
          !this.$element.has(e.target).length) {
          this.$element.trigger('focus')
        }
      }, this))
  }

  Modal.prototype.escape = function () {
    if (this.isShown && this.options.keyboard) {
      this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
        e.which == 27 && this.hide()
      }, this))
    } else if (!this.isShown) {
      this.$element.off('keydown.dismiss.bs.modal')
    }
  }

  Modal.prototype.resize = function () {
    if (this.isShown) {
      $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
    } else {
      $(window).off('resize.bs.modal')
    }
  }

  Modal.prototype.hideModal = function () {
    var that = this
    this.$element.hide()
    this.backdrop(function () {
      that.$body.removeClass('modal-open')
      that.resetAdjustments()
      that.resetScrollbar()
      that.$element.trigger('hidden.bs.modal')
    })
  }

  Modal.prototype.removeBackdrop = function () {
    this.$backdrop && this.$backdrop.remove()
    this.$backdrop = null
  }

  Modal.prototype.backdrop = function (callback) {
    var that = this
    var animate = this.$element.hasClass('fade') ? 'fade' : ''

    if (this.isShown && this.options.backdrop) {
      var doAnimate = $.support.transition && animate

      this.$backdrop = $(document.createElement('div'))
        .addClass('modal-backdrop ' + animate)
        .appendTo(this.$body)

      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
        if (this.ignoreBackdropClick) {
          this.ignoreBackdropClick = false
          return
        }
        if (e.target !== e.currentTarget) return
        this.options.backdrop == 'static'
          ? this.$element[0].focus()
          : this.hide()
      }, this))

      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow

      this.$backdrop.addClass('in')

      if (!callback) return

      doAnimate ?
        this.$backdrop
          .one('bsTransitionEnd', callback)
          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
        callback()

    } else if (!this.isShown && this.$backdrop) {
      this.$backdrop.removeClass('in')

      var callbackRemove = function () {
        that.removeBackdrop()
        callback && callback()
      }
      $.support.transition && this.$element.hasClass('fade') ?
        this.$backdrop
          .one('bsTransitionEnd', callbackRemove)
          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
        callbackRemove()

    } else if (callback) {
      callback()
    }
  }

  // these following methods are used to handle overflowing modals

  Modal.prototype.handleUpdate = function () {
    this.adjustDialog()
  }

  Modal.prototype.adjustDialog = function () {
    var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight

    this.$element.css({
      paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
      paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
    })
  }

  Modal.prototype.resetAdjustments = function () {
    this.$element.css({
      paddingLeft: '',
      paddingRight: ''
    })
  }

  Modal.prototype.checkScrollbar = function () {
    var fullWindowWidth = window.innerWidth
    if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
      var documentElementRect = document.documentElement.getBoundingClientRect()
      fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
    }
    this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
    this.scrollbarWidth = this.measureScrollbar()
  }

  Modal.prototype.setScrollbar = function () {
    var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
    this.originalBodyPad = document.body.style.paddingRight || ''
    var scrollbarWidth = this.scrollbarWidth
    if (this.bodyIsOverflowing) {
      this.$body.css('padding-right', bodyPad + scrollbarWidth)
      $(this.fixedContent).each(function (index, element) {
        var actualPadding = element.style.paddingRight
        var calculatedPadding = $(element).css('padding-right')
        $(element)
          .data('padding-right', actualPadding)
          .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px')
      })
    }
  }

  Modal.prototype.resetScrollbar = function () {
    this.$body.css('padding-right', this.originalBodyPad)
    $(this.fixedContent).each(function (index, element) {
      var padding = $(element).data('padding-right')
      $(element).removeData('padding-right')
      element.style.paddingRight = padding ? padding : ''
    })
  }

  Modal.prototype.measureScrollbar = function () { // thx walsh
    var scrollDiv = document.createElement('div')
    scrollDiv.className = 'modal-scrollbar-measure'
    this.$body.append(scrollDiv)
    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
    this.$body[0].removeChild(scrollDiv)
    return scrollbarWidth
  }


  // MODAL PLUGIN DEFINITION
  // =======================

  function Plugin(option, _relatedTarget) {
    return this.each(function () {
      var $this = $(this)
      var data = $this.data('bs.modal')
      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)

      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
      if (typeof option == 'string') data[option](_relatedTarget)
      else if (options.show) data.show(_relatedTarget)
    })
  }

  var old = $.fn.modal

  $.fn.modal = Plugin
  $.fn.modal.Constructor = Modal


  // MODAL NO CONFLICT
  // =================

  $.fn.modal.noConflict = function () {
    $.fn.modal = old
    return this
  }


  // MODAL DATA-API
  // ==============

  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
    var $this = $(this)
    var href = $this.attr('href')
    var target = $this.attr('data-target') ||
      (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7

    var $target = $(document).find(target)
    var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())

    if ($this.is('a')) e.preventDefault()

    $target.one('show.bs.modal', function (showEvent) {
      if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
      $target.one('hidden.bs.modal', function () {
        $this.is(':visible') && $this.trigger('focus')
      })
    })
    Plugin.call($target, option, this)
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: tooltip.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#tooltip
 * Inspired by the original jQuery.tipsy by Jason Frame
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

+function ($) {
  'use strict';

  var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']

  var uriAttrs = [
    'background',
    'cite',
    'href',
    'itemtype',
    'longdesc',
    'poster',
    'src',
    'xlink:href'
  ]

  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i

  var DefaultWhitelist = {
    // Global attributes allowed on any supplied element below.
    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
    a: ['target', 'href', 'title', 'rel'],
    area: [],
    b: [],
    br: [],
    col: [],
    code: [],
    div: [],
    em: [],
    hr: [],
    h1: [],
    h2: [],
    h3: [],
    h4: [],
    h5: [],
    h6: [],
    i: [],
    img: ['src', 'alt', 'title', 'width', 'height'],
    li: [],
    ol: [],
    p: [],
    pre: [],
    s: [],
    small: [],
    span: [],
    sub: [],
    sup: [],
    strong: [],
    u: [],
    ul: []
  }

  /**
   * A pattern that recognizes a commonly useful subset of URLs that are safe.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */
  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi

  /**
   * A pattern that matches safe data URLs. Only matches image, video and audio types.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */
  var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i

  function allowedAttribute(attr, allowedAttributeList) {
    var attrName = attr.nodeName.toLowerCase()

    if ($.inArray(attrName, allowedAttributeList) !== -1) {
      if ($.inArray(attrName, uriAttrs) !== -1) {
        return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
      }

      return true
    }

    var regExp = $(allowedAttributeList).filter(function (index, value) {
      return value instanceof RegExp
    })

    // Check if a regular expression validates the attribute.
    for (var i = 0, l = regExp.length; i < l; i++) {
      if (attrName.match(regExp[i])) {
        return true
      }
    }

    return false
  }

  function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
    if (unsafeHtml.length === 0) {
      return unsafeHtml
    }

    if (sanitizeFn && typeof sanitizeFn === 'function') {
      return sanitizeFn(unsafeHtml)
    }

    // IE 8 and below don't support createHTMLDocument
    if (!document.implementation || !document.implementation.createHTMLDocument) {
      return unsafeHtml
    }

    var createdDocument = document.implementation.createHTMLDocument('sanitization')
    createdDocument.body.innerHTML = unsafeHtml

    var whitelistKeys = $.map(whiteList, function (el, i) { return i })
    var elements = $(createdDocument.body).find('*')

    for (var i = 0, len = elements.length; i < len; i++) {
      var el = elements[i]
      var elName = el.nodeName.toLowerCase()

      if ($.inArray(elName, whitelistKeys) === -1) {
        el.parentNode.removeChild(el)

        continue
      }

      var attributeList = $.map(el.attributes, function (el) { return el })
      var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])

      for (var j = 0, len2 = attributeList.length; j < len2; j++) {
        if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
          el.removeAttribute(attributeList[j].nodeName)
        }
      }
    }

    return createdDocument.body.innerHTML
  }

  // TOOLTIP PUBLIC CLASS DEFINITION
  // ===============================

  var Tooltip = function (element, options) {
    this.type       = null
    this.options    = null
    this.enabled    = null
    this.timeout    = null
    this.hoverState = null
    this.$element   = null
    this.inState    = null

    this.init('tooltip', element, options)
  }

  Tooltip.VERSION  = '3.4.1'

  Tooltip.TRANSITION_DURATION = 150

  Tooltip.DEFAULTS = {
    animation: true,
    placement: 'top',
    selector: false,
    template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    container: false,
    viewport: {
      selector: 'body',
      padding: 0
    },
    sanitize : true,
    sanitizeFn : null,
    whiteList : DefaultWhitelist
  }

  Tooltip.prototype.init = function (type, element, options) {
    this.enabled   = true
    this.type      = type
    this.$element  = $(element)
    this.options   = this.getOptions(options)
    this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
    this.inState   = { click: false, hover: false, focus: false }

    if (this.$element[0] instanceof document.constructor && !this.options.selector) {
      throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
    }

    var triggers = this.options.trigger.split(' ')

    for (var i = triggers.length; i--;) {
      var trigger = triggers[i]

      if (trigger == 'click') {
        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
      } else if (trigger != 'manual') {
        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'
        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'

        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
      }
    }

    this.options.selector ?
      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
      this.fixTitle()
  }

  Tooltip.prototype.getDefaults = function () {
    return Tooltip.DEFAULTS
  }

  Tooltip.prototype.getOptions = function (options) {
    var dataAttributes = this.$element.data()

    for (var dataAttr in dataAttributes) {
      if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
        delete dataAttributes[dataAttr]
      }
    }

    options = $.extend({}, this.getDefaults(), dataAttributes, options)

    if (options.delay && typeof options.delay == 'number') {
      options.delay = {
        show: options.delay,
        hide: options.delay
      }
    }

    if (options.sanitize) {
      options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
    }

    return options
  }

  Tooltip.prototype.getDelegateOptions = function () {
    var options  = {}
    var defaults = this.getDefaults()

    this._options && $.each(this._options, function (key, value) {
      if (defaults[key] != value) options[key] = value
    })

    return options
  }

  Tooltip.prototype.enter = function (obj) {
    var self = obj instanceof this.constructor ?
      obj : $(obj.currentTarget).data('bs.' + this.type)

    if (!self) {
      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
      $(obj.currentTarget).data('bs.' + this.type, self)
    }

    if (obj instanceof $.Event) {
      self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
    }

    if (self.tip().hasClass('in') || self.hoverState == 'in') {
      self.hoverState = 'in'
      return
    }

    clearTimeout(self.timeout)

    self.hoverState = 'in'

    if (!self.options.delay || !self.options.delay.show) return self.show()

    self.timeout = setTimeout(function () {
      if (self.hoverState == 'in') self.show()
    }, self.options.delay.show)
  }

  Tooltip.prototype.isInStateTrue = function () {
    for (var key in this.inState) {
      if (this.inState[key]) return true
    }

    return false
  }

  Tooltip.prototype.leave = function (obj) {
    var self = obj instanceof this.constructor ?
      obj : $(obj.currentTarget).data('bs.' + this.type)

    if (!self) {
      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
      $(obj.currentTarget).data('bs.' + this.type, self)
    }

    if (obj instanceof $.Event) {
      self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
    }

    if (self.isInStateTrue()) return

    clearTimeout(self.timeout)

    self.hoverState = 'out'

    if (!self.options.delay || !self.options.delay.hide) return self.hide()

    self.timeout = setTimeout(function () {
      if (self.hoverState == 'out') self.hide()
    }, self.options.delay.hide)
  }

  Tooltip.prototype.show = function () {
    var e = $.Event('show.bs.' + this.type)

    if (this.hasContent() && this.enabled) {
      this.$element.trigger(e)

      var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
      if (e.isDefaultPrevented() || !inDom) return
      var that = this

      var $tip = this.tip()

      var tipId = this.getUID(this.type)

      this.setContent()
      $tip.attr('id', tipId)
      this.$element.attr('aria-describedby', tipId)

      if (this.options.animation) $tip.addClass('fade')

      var placement = typeof this.options.placement == 'function' ?
        this.options.placement.call(this, $tip[0], this.$element[0]) :
        this.options.placement

      var autoToken = /\s?auto?\s?/i
      var autoPlace = autoToken.test(placement)
      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'

      $tip
        .detach()
        .css({ top: 0, left: 0, display: 'block' })
        .addClass(placement)
        .data('bs.' + this.type, this)

      this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
      this.$element.trigger('inserted.bs.' + this.type)

      var pos          = this.getPosition()
      var actualWidth  = $tip[0].offsetWidth
      var actualHeight = $tip[0].offsetHeight

      if (autoPlace) {
        var orgPlacement = placement
        var viewportDim = this.getPosition(this.$viewport)

        placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top'    :
                    placement == 'top'    && pos.top    - actualHeight < viewportDim.top    ? 'bottom' :
                    placement == 'right'  && pos.right  + actualWidth  > viewportDim.width  ? 'left'   :
                    placement == 'left'   && pos.left   - actualWidth  < viewportDim.left   ? 'right'  :
                    placement

        $tip
          .removeClass(orgPlacement)
          .addClass(placement)
      }

      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)

      this.applyPlacement(calculatedOffset, placement)

      var complete = function () {
        var prevHoverState = that.hoverState
        that.$element.trigger('shown.bs.' + that.type)
        that.hoverState = null

        if (prevHoverState == 'out') that.leave(that)
      }

      $.support.transition && this.$tip.hasClass('fade') ?
        $tip
          .one('bsTransitionEnd', complete)
          .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
        complete()
    }
  }

  Tooltip.prototype.applyPlacement = function (offset, placement) {
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight

    // manually read margins because getBoundingClientRect includes difference
    var marginTop = parseInt($tip.css('margin-top'), 10)
    var marginLeft = parseInt($tip.css('margin-left'), 10)

    // we must check for NaN for ie 8/9
    if (isNaN(marginTop))  marginTop  = 0
    if (isNaN(marginLeft)) marginLeft = 0

    offset.top  += marginTop
    offset.left += marginLeft

    // $.fn.offset doesn't round pixel values
    // so we use setOffset directly with our own function B-0
    $.offset.setOffset($tip[0], $.extend({
      using: function (props) {
        $tip.css({
          top: Math.round(props.top),
          left: Math.round(props.left)
        })
      }
    }, offset), 0)

    $tip.addClass('in')

    // check to see if placing tip in new offset caused the tip to resize itself
    var actualWidth  = $tip[0].offsetWidth
    var actualHeight = $tip[0].offsetHeight

    if (placement == 'top' && actualHeight != height) {
      offset.top = offset.top + height - actualHeight
    }

    var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)

    if (delta.left) offset.left += delta.left
    else offset.top += delta.top

    var isVertical          = /top|bottom/.test(placement)
    var arrowDelta          = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
    var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'

    $tip.offset(offset)
    this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  }

  Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
    this.arrow()
      .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
      .css(isVertical ? 'top' : 'left', '')
  }

  Tooltip.prototype.setContent = function () {
    var $tip  = this.tip()
    var title = this.getTitle()

    if (this.options.html) {
      if (this.options.sanitize) {
        title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)
      }

      $tip.find('.tooltip-inner').html(title)
    } else {
      $tip.find('.tooltip-inner').text(title)
    }

    $tip.removeClass('fade in top bottom left right')
  }

  Tooltip.prototype.hide = function (callback) {
    var that = this
    var $tip = $(this.$tip)
    var e    = $.Event('hide.bs.' + this.type)

    function complete() {
      if (that.hoverState != 'in') $tip.detach()
      if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
        that.$element
          .removeAttr('aria-describedby')
          .trigger('hidden.bs.' + that.type)
      }
      callback && callback()
    }

    this.$element.trigger(e)

    if (e.isDefaultPrevented()) return

    $tip.removeClass('in')

    $.support.transition && $tip.hasClass('fade') ?
      $tip
        .one('bsTransitionEnd', complete)
        .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
      complete()

    this.hoverState = null

    return this
  }

  Tooltip.prototype.fixTitle = function () {
    var $e = this.$element
    if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
    }
  }

  Tooltip.prototype.hasContent = function () {
    return this.getTitle()
  }

  Tooltip.prototype.getPosition = function ($element) {
    $element   = $element || this.$element

    var el     = $element[0]
    var isBody = el.tagName == 'BODY'

    var elRect    = el.getBoundingClientRect()
    if (elRect.width == null) {
      // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
      elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
    }
    var isSvg = window.SVGElement && el instanceof window.SVGElement
    // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
    // See https://github.com/twbs/bootstrap/issues/20280
    var elOffset  = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
    var scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
    var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null

    return $.extend({}, elRect, scroll, outerDims, elOffset)
  }

  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2 } :
           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }

  }

  Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
    var delta = { top: 0, left: 0 }
    if (!this.$viewport) return delta

    var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
    var viewportDimensions = this.getPosition(this.$viewport)

    if (/right|left/.test(placement)) {
      var topEdgeOffset    = pos.top - viewportPadding - viewportDimensions.scroll
      var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
      if (topEdgeOffset < viewportDimensions.top) { // top overflow
        delta.top = viewportDimensions.top - topEdgeOffset
      } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
        delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
      }
    } else {
      var leftEdgeOffset  = pos.left - viewportPadding
      var rightEdgeOffset = pos.left + viewportPadding + actualWidth
      if (leftEdgeOffset < viewportDimensions.left) { // left overflow
        delta.left = viewportDimensions.left - leftEdgeOffset
      } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
        delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
      }
    }

    return delta
  }

  Tooltip.prototype.getTitle = function () {
    var title
    var $e = this.$element
    var o  = this.options

    title = $e.attr('data-original-title')
      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)

    return title
  }

  Tooltip.prototype.getUID = function (prefix) {
    do prefix += ~~(Math.random() * 1000000)
    while (document.getElementById(prefix))
    return prefix
  }

  Tooltip.prototype.tip = function () {
    if (!this.$tip) {
      this.$tip = $(this.options.template)
      if (this.$tip.length != 1) {
        throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
      }
    }
    return this.$tip
  }

  Tooltip.prototype.arrow = function () {
    return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  }

  Tooltip.prototype.enable = function () {
    this.enabled = true
  }

  Tooltip.prototype.disable = function () {
    this.enabled = false
  }

  Tooltip.prototype.toggleEnabled = function () {
    this.enabled = !this.enabled
  }

  Tooltip.prototype.toggle = function (e) {
    var self = this
    if (e) {
      self = $(e.currentTarget).data('bs.' + this.type)
      if (!self) {
        self = new this.constructor(e.currentTarget, this.getDelegateOptions())
        $(e.currentTarget).data('bs.' + this.type, self)
      }
    }

    if (e) {
      self.inState.click = !self.inState.click
      if (self.isInStateTrue()) self.enter(self)
      else self.leave(self)
    } else {
      self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
    }
  }

  Tooltip.prototype.destroy = function () {
    var that = this
    clearTimeout(this.timeout)
    this.hide(function () {
      that.$element.off('.' + that.type).removeData('bs.' + that.type)
      if (that.$tip) {
        that.$tip.detach()
      }
      that.$tip = null
      that.$arrow = null
      that.$viewport = null
      that.$element = null
    })
  }

  Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {
    return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)
  }

  // TOOLTIP PLUGIN DEFINITION
  // =========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.tooltip')
      var options = typeof option == 'object' && option

      if (!data && /destroy|hide/.test(option)) return
      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.tooltip

  $.fn.tooltip             = Plugin
  $.fn.tooltip.Constructor = Tooltip


  // TOOLTIP NO CONFLICT
  // ===================

  $.fn.tooltip.noConflict = function () {
    $.fn.tooltip = old
    return this
  }

}(jQuery);

/* ========================================================================
 * Bootstrap: popover.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#popovers
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // POPOVER PUBLIC CLASS DEFINITION
  // ===============================

  var Popover = function (element, options) {
    this.init('popover', element, options)
  }

  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')

  Popover.VERSION  = '3.4.1'

  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
    placement: 'right',
    trigger: 'click',
    content: '',
    template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  })


  // NOTE: POPOVER EXTENDS tooltip.js
  // ================================

  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)

  Popover.prototype.constructor = Popover

  Popover.prototype.getDefaults = function () {
    return Popover.DEFAULTS
  }

  Popover.prototype.setContent = function () {
    var $tip    = this.tip()
    var title   = this.getTitle()
    var content = this.getContent()

    if (this.options.html) {
      var typeContent = typeof content

      if (this.options.sanitize) {
        title = this.sanitizeHtml(title)

        if (typeContent === 'string') {
          content = this.sanitizeHtml(content)
        }
      }

      $tip.find('.popover-title').html(title)
      $tip.find('.popover-content').children().detach().end()[
        typeContent === 'string' ? 'html' : 'append'
      ](content)
    } else {
      $tip.find('.popover-title').text(title)
      $tip.find('.popover-content').children().detach().end().text(content)
    }

    $tip.removeClass('fade top bottom left right in')

    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
    // this manually by checking the contents.
    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  }

  Popover.prototype.hasContent = function () {
    return this.getTitle() || this.getContent()
  }

  Popover.prototype.getContent = function () {
    var $e = this.$element
    var o  = this.options

    return $e.attr('data-content')
      || (typeof o.content == 'function' ?
        o.content.call($e[0]) :
        o.content)
  }

  Popover.prototype.arrow = function () {
    return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  }


  // POPOVER PLUGIN DEFINITION
  // =========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.popover')
      var options = typeof option == 'object' && option

      if (!data && /destroy|hide/.test(option)) return
      if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.popover

  $.fn.popover             = Plugin
  $.fn.popover.Constructor = Popover


  // POPOVER NO CONFLICT
  // ===================

  $.fn.popover.noConflict = function () {
    $.fn.popover = old
    return this
  }

}(jQuery);

/* ========================================================================
 * Bootstrap: scrollspy.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#scrollspy
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // SCROLLSPY CLASS DEFINITION
  // ==========================

  function ScrollSpy(element, options) {
    this.$body          = $(document.body)
    this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
    this.selector       = (this.options.target || '') + ' .nav li > a'
    this.offsets        = []
    this.targets        = []
    this.activeTarget   = null
    this.scrollHeight   = 0

    this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
    this.refresh()
    this.process()
  }

  ScrollSpy.VERSION  = '3.4.1'

  ScrollSpy.DEFAULTS = {
    offset: 10
  }

  ScrollSpy.prototype.getScrollHeight = function () {
    return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  }

  ScrollSpy.prototype.refresh = function () {
    var that          = this
    var offsetMethod  = 'offset'
    var offsetBase    = 0

    this.offsets      = []
    this.targets      = []
    this.scrollHeight = this.getScrollHeight()

    if (!$.isWindow(this.$scrollElement[0])) {
      offsetMethod = 'position'
      offsetBase   = this.$scrollElement.scrollTop()
    }

    this.$body
      .find(this.selector)
      .map(function () {
        var $el   = $(this)
        var href  = $el.data('target') || $el.attr('href')
        var $href = /^#./.test(href) && $(href)

        return ($href
          && $href.length
          && $href.is(':visible')
          && [[$href[offsetMethod]().top + offsetBase, href]]) || null
      })
      .sort(function (a, b) { return a[0] - b[0] })
      .each(function () {
        that.offsets.push(this[0])
        that.targets.push(this[1])
      })
  }

  ScrollSpy.prototype.process = function () {
    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset
    var scrollHeight = this.getScrollHeight()
    var maxScroll    = this.options.offset + scrollHeight - this.$scrollElement.height()
    var offsets      = this.offsets
    var targets      = this.targets
    var activeTarget = this.activeTarget
    var i

    if (this.scrollHeight != scrollHeight) {
      this.refresh()
    }

    if (scrollTop >= maxScroll) {
      return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
    }

    if (activeTarget && scrollTop < offsets[0]) {
      this.activeTarget = null
      return this.clear()
    }

    for (i = offsets.length; i--;) {
      activeTarget != targets[i]
        && scrollTop >= offsets[i]
        && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
        && this.activate(targets[i])
    }
  }

  ScrollSpy.prototype.activate = function (target) {
    this.activeTarget = target

    this.clear()

    var selector = this.selector +
      '[data-target="' + target + '"],' +
      this.selector + '[href="' + target + '"]'

    var active = $(selector)
      .parents('li')
      .addClass('active')

    if (active.parent('.dropdown-menu').length) {
      active = active
        .closest('li.dropdown')
        .addClass('active')
    }

    active.trigger('activate.bs.scrollspy')
  }

  ScrollSpy.prototype.clear = function () {
    $(this.selector)
      .parentsUntil(this.options.target, '.active')
      .removeClass('active')
  }


  // SCROLLSPY PLUGIN DEFINITION
  // ===========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.scrollspy')
      var options = typeof option == 'object' && option

      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.scrollspy

  $.fn.scrollspy             = Plugin
  $.fn.scrollspy.Constructor = ScrollSpy


  // SCROLLSPY NO CONFLICT
  // =====================

  $.fn.scrollspy.noConflict = function () {
    $.fn.scrollspy = old
    return this
  }


  // SCROLLSPY DATA-API
  // ==================

  $(window).on('load.bs.scrollspy.data-api', function () {
    $('[data-spy="scroll"]').each(function () {
      var $spy = $(this)
      Plugin.call($spy, $spy.data())
    })
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: tab.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#tabs
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // TAB CLASS DEFINITION
  // ====================

  var Tab = function (element) {
    // jscs:disable requireDollarBeforejQueryAssignment
    this.element = $(element)
    // jscs:enable requireDollarBeforejQueryAssignment
  }

  Tab.VERSION = '3.4.1'

  Tab.TRANSITION_DURATION = 150

  Tab.prototype.show = function () {
    var $this    = this.element
    var $ul      = $this.closest('ul:not(.dropdown-menu)')
    var selector = $this.data('target')

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }

    if ($this.parent('li').hasClass('active')) return

    var $previous = $ul.find('.active:last a')
    var hideEvent = $.Event('hide.bs.tab', {
      relatedTarget: $this[0]
    })
    var showEvent = $.Event('show.bs.tab', {
      relatedTarget: $previous[0]
    })

    $previous.trigger(hideEvent)
    $this.trigger(showEvent)

    if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return

    var $target = $(document).find(selector)

    this.activate($this.closest('li'), $ul)
    this.activate($target, $target.parent(), function () {
      $previous.trigger({
        type: 'hidden.bs.tab',
        relatedTarget: $this[0]
      })
      $this.trigger({
        type: 'shown.bs.tab',
        relatedTarget: $previous[0]
      })
    })
  }

  Tab.prototype.activate = function (element, container, callback) {
    var $active    = container.find('> .active')
    var transition = callback
      && $.support.transition
      && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)

    function next() {
      $active
        .removeClass('active')
        .find('> .dropdown-menu > .active')
        .removeClass('active')
        .end()
        .find('[data-toggle="tab"]')
        .attr('aria-expanded', false)

      element
        .addClass('active')
        .find('[data-toggle="tab"]')
        .attr('aria-expanded', true)

      if (transition) {
        element[0].offsetWidth // reflow for transition
        element.addClass('in')
      } else {
        element.removeClass('fade')
      }

      if (element.parent('.dropdown-menu').length) {
        element
          .closest('li.dropdown')
          .addClass('active')
          .end()
          .find('[data-toggle="tab"]')
          .attr('aria-expanded', true)
      }

      callback && callback()
    }

    $active.length && transition ?
      $active
        .one('bsTransitionEnd', next)
        .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
      next()

    $active.removeClass('in')
  }


  // TAB PLUGIN DEFINITION
  // =====================

  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.tab')

      if (!data) $this.data('bs.tab', (data = new Tab(this)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.tab

  $.fn.tab             = Plugin
  $.fn.tab.Constructor = Tab


  // TAB NO CONFLICT
  // ===============

  $.fn.tab.noConflict = function () {
    $.fn.tab = old
    return this
  }


  // TAB DATA-API
  // ============

  var clickHandler = function (e) {
    e.preventDefault()
    Plugin.call($(this), 'show')
  }

  $(document)
    .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
    .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)

}(jQuery);

/* ========================================================================
 * Bootstrap: affix.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#affix
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // AFFIX CLASS DEFINITION
  // ======================

  var Affix = function (element, options) {
    this.options = $.extend({}, Affix.DEFAULTS, options)

    var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target)

    this.$target = target
      .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
      .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))

    this.$element     = $(element)
    this.affixed      = null
    this.unpin        = null
    this.pinnedOffset = null

    this.checkPosition()
  }

  Affix.VERSION  = '3.4.1'

  Affix.RESET    = 'affix affix-top affix-bottom'

  Affix.DEFAULTS = {
    offset: 0,
    target: window
  }

  Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
    var scrollTop    = this.$target.scrollTop()
    var position     = this.$element.offset()
    var targetHeight = this.$target.height()

    if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false

    if (this.affixed == 'bottom') {
      if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
      return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
    }

    var initializing   = this.affixed == null
    var colliderTop    = initializing ? scrollTop : position.top
    var colliderHeight = initializing ? targetHeight : height

    if (offsetTop != null && scrollTop <= offsetTop) return 'top'
    if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'

    return false
  }

  Affix.prototype.getPinnedOffset = function () {
    if (this.pinnedOffset) return this.pinnedOffset
    this.$element.removeClass(Affix.RESET).addClass('affix')
    var scrollTop = this.$target.scrollTop()
    var position  = this.$element.offset()
    return (this.pinnedOffset = position.top - scrollTop)
  }

  Affix.prototype.checkPositionWithEventLoop = function () {
    setTimeout($.proxy(this.checkPosition, this), 1)
  }

  Affix.prototype.checkPosition = function () {
    if (!this.$element.is(':visible')) return

    var height       = this.$element.height()
    var offset       = this.options.offset
    var offsetTop    = offset.top
    var offsetBottom = offset.bottom
    var scrollHeight = Math.max($(document).height(), $(document.body).height())

    if (typeof offset != 'object')         offsetBottom = offsetTop = offset
    if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
    if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)

    var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)

    if (this.affixed != affix) {
      if (this.unpin != null) this.$element.css('top', '')

      var affixType = 'affix' + (affix ? '-' + affix : '')
      var e         = $.Event(affixType + '.bs.affix')

      this.$element.trigger(e)

      if (e.isDefaultPrevented()) return

      this.affixed = affix
      this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null

      this.$element
        .removeClass(Affix.RESET)
        .addClass(affixType)
        .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
    }

    if (affix == 'bottom') {
      this.$element.offset({
        top: scrollHeight - height - offsetBottom
      })
    }
  }


  // AFFIX PLUGIN DEFINITION
  // =======================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.affix')
      var options = typeof option == 'object' && option

      if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.affix

  $.fn.affix             = Plugin
  $.fn.affix.Constructor = Affix


  // AFFIX NO CONFLICT
  // =================

  $.fn.affix.noConflict = function () {
    $.fn.affix = old
    return this
  }


  // AFFIX DATA-API
  // ==============

  $(window).on('load', function () {
    $('[data-spy="affix"]').each(function () {
      var $spy = $(this)
      var data = $spy.data()

      data.offset = data.offset || {}

      if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
      if (data.offsetTop    != null) data.offset.top    = data.offsetTop

      Plugin.call($spy, data)
    })
  })

}(jQuery);

});

define('jquery', function (require, exports, module) {
/*!
 * jQuery JavaScript Library v1.12.4
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2016-05-20T17:17Z
 */

(function( global, factory ) {

	if ( typeof module === "object" && typeof module.exports === "object" ) {
		// For CommonJS and CommonJS-like environments where a proper `window`
		// is present, execute the factory and get jQuery.
		// For environments that do not have a `window` with a `document`
		// (such as Node.js), expose a factory as module.exports.
		// This accentuates the need for the creation of a real `window`.
		// e.g. var jQuery = require("jquery")(window);
		// See ticket #14549 for more info.
		module.exports = global.document ?
			factory( global, true ) :
			function( w ) {
				if ( !w.document ) {
					throw new Error( "jQuery requires a window with a document" );
				}
				return factory( w );
			};
	} else {
		factory( global );
	}

// Pass this if window is not defined yet
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {

// Support: Firefox 18+
// Can't be in strict mode, several libs including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
//"use strict";
var deletedIds = [];

var document = window.document;

var slice = deletedIds.slice;

var concat = deletedIds.concat;

var push = deletedIds.push;

var indexOf = deletedIds.indexOf;

var class2type = {};

var toString = class2type.toString;

var hasOwn = class2type.hasOwnProperty;

var support = {};



var
	version = "1.12.4",

	// Define a local copy of jQuery
	jQuery = function( selector, context ) {

		// The jQuery object is actually just the init constructor 'enhanced'
		// Need init if jQuery is called (just allow error to be thrown if not included)
		return new jQuery.fn.init( selector, context );
	},

	// Support: Android<4.1, IE<9
	// Make sure we trim BOM and NBSP
	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,

	// Matches dashed string for camelizing
	rmsPrefix = /^-ms-/,
	rdashAlpha = /-([\da-z])/gi,

	// Used by jQuery.camelCase as callback to replace()
	fcamelCase = function( all, letter ) {
		return letter.toUpperCase();
	};

jQuery.fn = jQuery.prototype = {

	// The current version of jQuery being used
	jquery: version,

	constructor: jQuery,

	// Start with an empty selector
	selector: "",

	// The default length of a jQuery object is 0
	length: 0,

	toArray: function() {
		return slice.call( this );
	},

	// Get the Nth element in the matched element set OR
	// Get the whole matched element set as a clean array
	get: function( num ) {
		return num != null ?

			// Return just the one element from the set
			( num < 0 ? this[ num + this.length ] : this[ num ] ) :

			// Return all the elements in a clean array
			slice.call( this );
	},

	// Take an array of elements and push it onto the stack
	// (returning the new matched element set)
	pushStack: function( elems ) {

		// Build a new jQuery matched element set
		var ret = jQuery.merge( this.constructor(), elems );

		// Add the old object onto the stack (as a reference)
		ret.prevObject = this;
		ret.context = this.context;

		// Return the newly-formed element set
		return ret;
	},

	// Execute a callback for every element in the matched set.
	each: function( callback ) {
		return jQuery.each( this, callback );
	},

	map: function( callback ) {
		return this.pushStack( jQuery.map( this, function( elem, i ) {
			return callback.call( elem, i, elem );
		} ) );
	},

	slice: function() {
		return this.pushStack( slice.apply( this, arguments ) );
	},

	first: function() {
		return this.eq( 0 );
	},

	last: function() {
		return this.eq( -1 );
	},

	eq: function( i ) {
		var len = this.length,
			j = +i + ( i < 0 ? len : 0 );
		return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
	},

	end: function() {
		return this.prevObject || this.constructor();
	},

	// For internal use only.
	// Behaves like an Array's method, not like a jQuery method.
	push: push,
	sort: deletedIds.sort,
	splice: deletedIds.splice
};

jQuery.extend = jQuery.fn.extend = function() {
	var src, copyIsArray, copy, name, options, clone,
		target = arguments[ 0 ] || {},
		i = 1,
		length = arguments.length,
		deep = false;

	// Handle a deep copy situation
	if ( typeof target === "boolean" ) {
		deep = target;

		// skip the boolean and the target
		target = arguments[ i ] || {};
		i++;
	}

	// Handle case when target is a string or something (possible in deep copy)
	if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
		target = {};
	}

	// extend jQuery itself if only one argument is passed
	if ( i === length ) {
		target = this;
		i--;
	}

	for ( ; i < length; i++ ) {

		// Only deal with non-null/undefined values
		if ( ( options = arguments[ i ] ) != null ) {

			// Extend the base object
			for ( name in options ) {
				src = target[ name ];
				copy = options[ name ];

				// Prevent never-ending loop
				if ( target === copy ) {
					continue;
				}

				// Recurse if we're merging plain objects or arrays
				if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
					( copyIsArray = jQuery.isArray( copy ) ) ) ) {

					if ( copyIsArray ) {
						copyIsArray = false;
						clone = src && jQuery.isArray( src ) ? src : [];

					} else {
						clone = src && jQuery.isPlainObject( src ) ? src : {};
					}

					// Never move original objects, clone them
					target[ name ] = jQuery.extend( deep, clone, copy );

				// Don't bring in undefined values
				} else if ( copy !== undefined ) {
					target[ name ] = copy;
				}
			}
		}
	}

	// Return the modified object
	return target;
};

jQuery.extend( {

	// Unique for each copy of jQuery on the page
	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),

	// Assume jQuery is ready without the ready module
	isReady: true,

	error: function( msg ) {
		throw new Error( msg );
	},

	noop: function() {},

	// See test/unit/core.js for details concerning isFunction.
	// Since version 1.3, DOM methods and functions like alert
	// aren't supported. They return false on IE (#2968).
	isFunction: function( obj ) {
		return jQuery.type( obj ) === "function";
	},

	isArray: Array.isArray || function( obj ) {
		return jQuery.type( obj ) === "array";
	},

	isWindow: function( obj ) {
		/* jshint eqeqeq: false */
		return obj != null && obj == obj.window;
	},

	isNumeric: function( obj ) {

		// parseFloat NaNs numeric-cast false positives (null|true|false|"")
		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
		// subtraction forces infinities to NaN
		// adding 1 corrects loss of precision from parseFloat (#15100)
		var realStringObj = obj && obj.toString();
		return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
	},

	isEmptyObject: function( obj ) {
		var name;
		for ( name in obj ) {
			return false;
		}
		return true;
	},

	isPlainObject: function( obj ) {
		var key;

		// Must be an Object.
		// Because of IE, we also have to check the presence of the constructor property.
		// Make sure that DOM nodes and window objects don't pass through, as well
		if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
			return false;
		}

		try {

			// Not own constructor property must be Object
			if ( obj.constructor &&
				!hasOwn.call( obj, "constructor" ) &&
				!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
				return false;
			}
		} catch ( e ) {

			// IE8,9 Will throw exceptions on certain host objects #9897
			return false;
		}

		// Support: IE<9
		// Handle iteration over inherited properties before own properties.
		if ( !support.ownFirst ) {
			for ( key in obj ) {
				return hasOwn.call( obj, key );
			}
		}

		// Own properties are enumerated firstly, so to speed up,
		// if last one is own, then all properties are own.
		for ( key in obj ) {}

		return key === undefined || hasOwn.call( obj, key );
	},

	type: function( obj ) {
		if ( obj == null ) {
			return obj + "";
		}
		return typeof obj === "object" || typeof obj === "function" ?
			class2type[ toString.call( obj ) ] || "object" :
			typeof obj;
	},

	// Workarounds based on findings by Jim Driscoll
	// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
	globalEval: function( data ) {
		if ( data && jQuery.trim( data ) ) {

			// We use execScript on Internet Explorer
			// We use an anonymous function so that context is window
			// rather than jQuery in Firefox
			( window.execScript || function( data ) {
				window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
			} )( data );
		}
	},

	// Convert dashed to camelCase; used by the css and data modules
	// Microsoft forgot to hump their vendor prefix (#9572)
	camelCase: function( string ) {
		return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
	},

	nodeName: function( elem, name ) {
		return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
	},

	each: function( obj, callback ) {
		var length, i = 0;

		if ( isArrayLike( obj ) ) {
			length = obj.length;
			for ( ; i < length; i++ ) {
				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
					break;
				}
			}
		} else {
			for ( i in obj ) {
				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
					break;
				}
			}
		}

		return obj;
	},

	// Support: Android<4.1, IE<9
	trim: function( text ) {
		return text == null ?
			"" :
			( text + "" ).replace( rtrim, "" );
	},

	// results is for internal usage only
	makeArray: function( arr, results ) {
		var ret = results || [];

		if ( arr != null ) {
			if ( isArrayLike( Object( arr ) ) ) {
				jQuery.merge( ret,
					typeof arr === "string" ?
					[ arr ] : arr
				);
			} else {
				push.call( ret, arr );
			}
		}

		return ret;
	},

	inArray: function( elem, arr, i ) {
		var len;

		if ( arr ) {
			if ( indexOf ) {
				return indexOf.call( arr, elem, i );
			}

			len = arr.length;
			i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;

			for ( ; i < len; i++ ) {

				// Skip accessing in sparse arrays
				if ( i in arr && arr[ i ] === elem ) {
					return i;
				}
			}
		}

		return -1;
	},

	merge: function( first, second ) {
		var len = +second.length,
			j = 0,
			i = first.length;

		while ( j < len ) {
			first[ i++ ] = second[ j++ ];
		}

		// Support: IE<9
		// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
		if ( len !== len ) {
			while ( second[ j ] !== undefined ) {
				first[ i++ ] = second[ j++ ];
			}
		}

		first.length = i;

		return first;
	},

	grep: function( elems, callback, invert ) {
		var callbackInverse,
			matches = [],
			i = 0,
			length = elems.length,
			callbackExpect = !invert;

		// Go through the array, only saving the items
		// that pass the validator function
		for ( ; i < length; i++ ) {
			callbackInverse = !callback( elems[ i ], i );
			if ( callbackInverse !== callbackExpect ) {
				matches.push( elems[ i ] );
			}
		}

		return matches;
	},

	// arg is for internal usage only
	map: function( elems, callback, arg ) {
		var length, value,
			i = 0,
			ret = [];

		// Go through the array, translating each of the items to their new values
		if ( isArrayLike( elems ) ) {
			length = elems.length;
			for ( ; i < length; i++ ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}

		// Go through every key on the object,
		} else {
			for ( i in elems ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}
		}

		// Flatten any nested arrays
		return concat.apply( [], ret );
	},

	// A global GUID counter for objects
	guid: 1,

	// Bind a function to a context, optionally partially applying any
	// arguments.
	proxy: function( fn, context ) {
		var args, proxy, tmp;

		if ( typeof context === "string" ) {
			tmp = fn[ context ];
			context = fn;
			fn = tmp;
		}

		// Quick check to determine if target is callable, in the spec
		// this throws a TypeError, but we will just return undefined.
		if ( !jQuery.isFunction( fn ) ) {
			return undefined;
		}

		// Simulated bind
		args = slice.call( arguments, 2 );
		proxy = function() {
			return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
		};

		// Set the guid of unique handler to the same of original handler, so it can be removed
		proxy.guid = fn.guid = fn.guid || jQuery.guid++;

		return proxy;
	},

	now: function() {
		return +( new Date() );
	},

	// jQuery.support is not used in Core but other projects attach their
	// properties to it so it needs to exist.
	support: support
} );

// JSHint would error on this code due to the Symbol not being defined in ES5.
// Defining this global in .jshintrc would create a danger of using the global
// unguarded in another place, it seems safer to just disable JSHint for these
// three lines.
/* jshint ignore: start */
if ( typeof Symbol === "function" ) {
	jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
}
/* jshint ignore: end */

// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( i, name ) {
	class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );

function isArrayLike( obj ) {

	// Support: iOS 8.2 (not reproducible in simulator)
	// `in` check used to prevent JIT error (gh-2145)
	// hasOwn isn't used here due to false negatives
	// regarding Nodelist length in IE
	var length = !!obj && "length" in obj && obj.length,
		type = jQuery.type( obj );

	if ( type === "function" || jQuery.isWindow( obj ) ) {
		return false;
	}

	return type === "array" || length === 0 ||
		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var Sizzle =
/*!
 * Sizzle CSS Selector Engine v2.2.1
 * http://sizzlejs.com/
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2015-10-17
 */
(function( window ) {

var i,
	support,
	Expr,
	getText,
	isXML,
	tokenize,
	compile,
	select,
	outermostContext,
	sortInput,
	hasDuplicate,

	// Local document vars
	setDocument,
	document,
	docElem,
	documentIsHTML,
	rbuggyQSA,
	rbuggyMatches,
	matches,
	contains,

	// Instance-specific data
	expando = "sizzle" + 1 * new Date(),
	preferredDoc = window.document,
	dirruns = 0,
	done = 0,
	classCache = createCache(),
	tokenCache = createCache(),
	compilerCache = createCache(),
	sortOrder = function( a, b ) {
		if ( a === b ) {
			hasDuplicate = true;
		}
		return 0;
	},

	// General-purpose constants
	MAX_NEGATIVE = 1 << 31,

	// Instance methods
	hasOwn = ({}).hasOwnProperty,
	arr = [],
	pop = arr.pop,
	push_native = arr.push,
	push = arr.push,
	slice = arr.slice,
	// Use a stripped-down indexOf as it's faster than native
	// http://jsperf.com/thor-indexof-vs-for/5
	indexOf = function( list, elem ) {
		var i = 0,
			len = list.length;
		for ( ; i < len; i++ ) {
			if ( list[i] === elem ) {
				return i;
			}
		}
		return -1;
	},

	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",

	// Regular expressions

	// http://www.w3.org/TR/css3-selectors/#whitespace
	whitespace = "[\\x20\\t\\r\\n\\f]",

	// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
	identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",

	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
		// Operator (capture 2)
		"*([*^$|!~]?=)" + whitespace +
		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
		"*\\]",

	pseudos = ":(" + identifier + ")(?:\\((" +
		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
		// 1. quoted (capture 3; capture 4 or capture 5)
		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
		// 2. simple (capture 6)
		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
		// 3. anything else (capture 2)
		".*" +
		")\\)|)",

	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
	rwhitespace = new RegExp( whitespace + "+", "g" ),
	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),

	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),

	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),

	rpseudo = new RegExp( pseudos ),
	ridentifier = new RegExp( "^" + identifier + "$" ),

	matchExpr = {
		"ID": new RegExp( "^#(" + identifier + ")" ),
		"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
		"TAG": new RegExp( "^(" + identifier + "|[*])" ),
		"ATTR": new RegExp( "^" + attributes ),
		"PSEUDO": new RegExp( "^" + pseudos ),
		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
		// For use in libraries implementing .is()
		// We use this for POS matching in `select`
		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
	},

	rinputs = /^(?:input|select|textarea|button)$/i,
	rheader = /^h\d$/i,

	rnative = /^[^{]+\{\s*\[native \w/,

	// Easily-parseable/retrievable ID or TAG or CLASS selectors
	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,

	rsibling = /[+~]/,
	rescape = /'|\\/g,

	// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
	runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
	funescape = function( _, escaped, escapedWhitespace ) {
		var high = "0x" + escaped - 0x10000;
		// NaN means non-codepoint
		// Support: Firefox<24
		// Workaround erroneous numeric interpretation of +"0x"
		return high !== high || escapedWhitespace ?
			escaped :
			high < 0 ?
				// BMP codepoint
				String.fromCharCode( high + 0x10000 ) :
				// Supplemental Plane codepoint (surrogate pair)
				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
	},

	// Used for iframes
	// See setDocument()
	// Removing the function wrapper causes a "Permission Denied"
	// error in IE
	unloadHandler = function() {
		setDocument();
	};

// Optimize for push.apply( _, NodeList )
try {
	push.apply(
		(arr = slice.call( preferredDoc.childNodes )),
		preferredDoc.childNodes
	);
	// Support: Android<4.0
	// Detect silently failing push.apply
	arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
	push = { apply: arr.length ?

		// Leverage slice if possible
		function( target, els ) {
			push_native.apply( target, slice.call(els) );
		} :

		// Support: IE<9
		// Otherwise append directly
		function( target, els ) {
			var j = target.length,
				i = 0;
			// Can't trust NodeList.length
			while ( (target[j++] = els[i++]) ) {}
			target.length = j - 1;
		}
	};
}

function Sizzle( selector, context, results, seed ) {
	var m, i, elem, nid, nidselect, match, groups, newSelector,
		newContext = context && context.ownerDocument,

		// nodeType defaults to 9, since context defaults to document
		nodeType = context ? context.nodeType : 9;

	results = results || [];

	// Return early from calls with invalid selector or context
	if ( typeof selector !== "string" || !selector ||
		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {

		return results;
	}

	// Try to shortcut find operations (as opposed to filters) in HTML documents
	if ( !seed ) {

		if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
			setDocument( context );
		}
		context = context || document;

		if ( documentIsHTML ) {

			// If the selector is sufficiently simple, try using a "get*By*" DOM method
			// (excepting DocumentFragment context, where the methods don't exist)
			if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {

				// ID selector
				if ( (m = match[1]) ) {

					// Document context
					if ( nodeType === 9 ) {
						if ( (elem = context.getElementById( m )) ) {

							// Support: IE, Opera, Webkit
							// TODO: identify versions
							// getElementById can match elements by name instead of ID
							if ( elem.id === m ) {
								results.push( elem );
								return results;
							}
						} else {
							return results;
						}

					// Element context
					} else {

						// Support: IE, Opera, Webkit
						// TODO: identify versions
						// getElementById can match elements by name instead of ID
						if ( newContext && (elem = newContext.getElementById( m )) &&
							contains( context, elem ) &&
							elem.id === m ) {

							results.push( elem );
							return results;
						}
					}

				// Type selector
				} else if ( match[2] ) {
					push.apply( results, context.getElementsByTagName( selector ) );
					return results;

				// Class selector
				} else if ( (m = match[3]) && support.getElementsByClassName &&
					context.getElementsByClassName ) {

					push.apply( results, context.getElementsByClassName( m ) );
					return results;
				}
			}

			// Take advantage of querySelectorAll
			if ( support.qsa &&
				!compilerCache[ selector + " " ] &&
				(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {

				if ( nodeType !== 1 ) {
					newContext = context;
					newSelector = selector;

				// qSA looks outside Element context, which is not what we want
				// Thanks to Andrew Dupont for this workaround technique
				// Support: IE <=8
				// Exclude object elements
				} else if ( context.nodeName.toLowerCase() !== "object" ) {

					// Capture the context ID, setting it first if necessary
					if ( (nid = context.getAttribute( "id" )) ) {
						nid = nid.replace( rescape, "\\$&" );
					} else {
						context.setAttribute( "id", (nid = expando) );
					}

					// Prefix every selector in the list
					groups = tokenize( selector );
					i = groups.length;
					nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
					while ( i-- ) {
						groups[i] = nidselect + " " + toSelector( groups[i] );
					}
					newSelector = groups.join( "," );

					// Expand context for sibling selectors
					newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
						context;
				}

				if ( newSelector ) {
					try {
						push.apply( results,
							newContext.querySelectorAll( newSelector )
						);
						return results;
					} catch ( qsaError ) {
					} finally {
						if ( nid === expando ) {
							context.removeAttribute( "id" );
						}
					}
				}
			}
		}
	}

	// All others
	return select( selector.replace( rtrim, "$1" ), context, results, seed );
}

/**
 * Create key-value caches of limited size
 * @returns {function(string, object)} Returns the Object data after storing it on itself with
 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
 *	deleting the oldest entry
 */
function createCache() {
	var keys = [];

	function cache( key, value ) {
		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
		if ( keys.push( key + " " ) > Expr.cacheLength ) {
			// Only keep the most recent entries
			delete cache[ keys.shift() ];
		}
		return (cache[ key + " " ] = value);
	}
	return cache;
}

/**
 * Mark a function for special use by Sizzle
 * @param {Function} fn The function to mark
 */
function markFunction( fn ) {
	fn[ expando ] = true;
	return fn;
}

/**
 * Support testing using an element
 * @param {Function} fn Passed the created div and expects a boolean result
 */
function assert( fn ) {
	var div = document.createElement("div");

	try {
		return !!fn( div );
	} catch (e) {
		return false;
	} finally {
		// Remove from its parent by default
		if ( div.parentNode ) {
			div.parentNode.removeChild( div );
		}
		// release memory in IE
		div = null;
	}
}

/**
 * Adds the same handler for all of the specified attrs
 * @param {String} attrs Pipe-separated list of attributes
 * @param {Function} handler The method that will be applied
 */
function addHandle( attrs, handler ) {
	var arr = attrs.split("|"),
		i = arr.length;

	while ( i-- ) {
		Expr.attrHandle[ arr[i] ] = handler;
	}
}

/**
 * Checks document order of two siblings
 * @param {Element} a
 * @param {Element} b
 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
 */
function siblingCheck( a, b ) {
	var cur = b && a,
		diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
			( ~b.sourceIndex || MAX_NEGATIVE ) -
			( ~a.sourceIndex || MAX_NEGATIVE );

	// Use IE sourceIndex if available on both nodes
	if ( diff ) {
		return diff;
	}

	// Check if b follows a
	if ( cur ) {
		while ( (cur = cur.nextSibling) ) {
			if ( cur === b ) {
				return -1;
			}
		}
	}

	return a ? 1 : -1;
}

/**
 * Returns a function to use in pseudos for input types
 * @param {String} type
 */
function createInputPseudo( type ) {
	return function( elem ) {
		var name = elem.nodeName.toLowerCase();
		return name === "input" && elem.type === type;
	};
}

/**
 * Returns a function to use in pseudos for buttons
 * @param {String} type
 */
function createButtonPseudo( type ) {
	return function( elem ) {
		var name = elem.nodeName.toLowerCase();
		return (name === "input" || name === "button") && elem.type === type;
	};
}

/**
 * Returns a function to use in pseudos for positionals
 * @param {Function} fn
 */
function createPositionalPseudo( fn ) {
	return markFunction(function( argument ) {
		argument = +argument;
		return markFunction(function( seed, matches ) {
			var j,
				matchIndexes = fn( [], seed.length, argument ),
				i = matchIndexes.length;

			// Match elements found at the specified indexes
			while ( i-- ) {
				if ( seed[ (j = matchIndexes[i]) ] ) {
					seed[j] = !(matches[j] = seed[j]);
				}
			}
		});
	});
}

/**
 * Checks a node for validity as a Sizzle context
 * @param {Element|Object=} context
 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
 */
function testContext( context ) {
	return context && typeof context.getElementsByTagName !== "undefined" && context;
}

// Expose support vars for convenience
support = Sizzle.support = {};

/**
 * Detects XML nodes
 * @param {Element|Object} elem An element or a document
 * @returns {Boolean} True iff elem is a non-HTML XML node
 */
isXML = Sizzle.isXML = function( elem ) {
	// documentElement is verified for cases where it doesn't yet exist
	// (such as loading iframes in IE - #4833)
	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
	return documentElement ? documentElement.nodeName !== "HTML" : false;
};

/**
 * Sets document-related variables once based on the current document
 * @param {Element|Object} [doc] An element or document object to use to set the document
 * @returns {Object} Returns the current document
 */
setDocument = Sizzle.setDocument = function( node ) {
	var hasCompare, parent,
		doc = node ? node.ownerDocument || node : preferredDoc;

	// Return early if doc is invalid or already selected
	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
		return document;
	}

	// Update global variables
	document = doc;
	docElem = document.documentElement;
	documentIsHTML = !isXML( document );

	// Support: IE 9-11, Edge
	// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
	if ( (parent = document.defaultView) && parent.top !== parent ) {
		// Support: IE 11
		if ( parent.addEventListener ) {
			parent.addEventListener( "unload", unloadHandler, false );

		// Support: IE 9 - 10 only
		} else if ( parent.attachEvent ) {
			parent.attachEvent( "onunload", unloadHandler );
		}
	}

	/* Attributes
	---------------------------------------------------------------------- */

	// Support: IE<8
	// Verify that getAttribute really returns attributes and not properties
	// (excepting IE8 booleans)
	support.attributes = assert(function( div ) {
		div.className = "i";
		return !div.getAttribute("className");
	});

	/* getElement(s)By*
	---------------------------------------------------------------------- */

	// Check if getElementsByTagName("*") returns only elements
	support.getElementsByTagName = assert(function( div ) {
		div.appendChild( document.createComment("") );
		return !div.getElementsByTagName("*").length;
	});

	// Support: IE<9
	support.getElementsByClassName = rnative.test( document.getElementsByClassName );

	// Support: IE<10
	// Check if getElementById returns elements by name
	// The broken getElementById methods don't pick up programatically-set names,
	// so use a roundabout getElementsByName test
	support.getById = assert(function( div ) {
		docElem.appendChild( div ).id = expando;
		return !document.getElementsByName || !document.getElementsByName( expando ).length;
	});

	// ID find and filter
	if ( support.getById ) {
		Expr.find["ID"] = function( id, context ) {
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
				var m = context.getElementById( id );
				return m ? [ m ] : [];
			}
		};
		Expr.filter["ID"] = function( id ) {
			var attrId = id.replace( runescape, funescape );
			return function( elem ) {
				return elem.getAttribute("id") === attrId;
			};
		};
	} else {
		// Support: IE6/7
		// getElementById is not reliable as a find shortcut
		delete Expr.find["ID"];

		Expr.filter["ID"] =  function( id ) {
			var attrId = id.replace( runescape, funescape );
			return function( elem ) {
				var node = typeof elem.getAttributeNode !== "undefined" &&
					elem.getAttributeNode("id");
				return node && node.value === attrId;
			};
		};
	}

	// Tag
	Expr.find["TAG"] = support.getElementsByTagName ?
		function( tag, context ) {
			if ( typeof context.getElementsByTagName !== "undefined" ) {
				return context.getElementsByTagName( tag );

			// DocumentFragment nodes don't have gEBTN
			} else if ( support.qsa ) {
				return context.querySelectorAll( tag );
			}
		} :

		function( tag, context ) {
			var elem,
				tmp = [],
				i = 0,
				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
				results = context.getElementsByTagName( tag );

			// Filter out possible comments
			if ( tag === "*" ) {
				while ( (elem = results[i++]) ) {
					if ( elem.nodeType === 1 ) {
						tmp.push( elem );
					}
				}

				return tmp;
			}
			return results;
		};

	// Class
	Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
		if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
			return context.getElementsByClassName( className );
		}
	};

	/* QSA/matchesSelector
	---------------------------------------------------------------------- */

	// QSA and matchesSelector support

	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
	rbuggyMatches = [];

	// qSa(:focus) reports false when true (Chrome 21)
	// We allow this because of a bug in IE8/9 that throws an error
	// whenever `document.activeElement` is accessed on an iframe
	// So, we allow :focus to pass through QSA all the time to avoid the IE error
	// See http://bugs.jquery.com/ticket/13378
	rbuggyQSA = [];

	if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
		// Build QSA regex
		// Regex strategy adopted from Diego Perini
		assert(function( div ) {
			// Select is set to empty string on purpose
			// This is to test IE's treatment of not explicitly
			// setting a boolean content attribute,
			// since its presence should be enough
			// http://bugs.jquery.com/ticket/12359
			docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
				"<select id='" + expando + "-\r\\' msallowcapture=''>" +
				"<option selected=''></option></select>";

			// Support: IE8, Opera 11-12.16
			// Nothing should be selected when empty strings follow ^= or $= or *=
			// The test attribute must be unknown in Opera but "safe" for WinRT
			// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
			if ( div.querySelectorAll("[msallowcapture^='']").length ) {
				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
			}

			// Support: IE8
			// Boolean attributes and "value" are not treated correctly
			if ( !div.querySelectorAll("[selected]").length ) {
				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
			}

			// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
			if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
				rbuggyQSA.push("~=");
			}

			// Webkit/Opera - :checked should return selected option elements
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
			// IE8 throws error here and will not see later tests
			if ( !div.querySelectorAll(":checked").length ) {
				rbuggyQSA.push(":checked");
			}

			// Support: Safari 8+, iOS 8+
			// https://bugs.webkit.org/show_bug.cgi?id=136851
			// In-page `selector#id sibing-combinator selector` fails
			if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
				rbuggyQSA.push(".#.+[+~]");
			}
		});

		assert(function( div ) {
			// Support: Windows 8 Native Apps
			// The type and name attributes are restricted during .innerHTML assignment
			var input = document.createElement("input");
			input.setAttribute( "type", "hidden" );
			div.appendChild( input ).setAttribute( "name", "D" );

			// Support: IE8
			// Enforce case-sensitivity of name attribute
			if ( div.querySelectorAll("[name=d]").length ) {
				rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
			}

			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
			// IE8 throws error here and will not see later tests
			if ( !div.querySelectorAll(":enabled").length ) {
				rbuggyQSA.push( ":enabled", ":disabled" );
			}

			// Opera 10-11 does not throw on post-comma invalid pseudos
			div.querySelectorAll("*,:x");
			rbuggyQSA.push(",.*:");
		});
	}

	if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
		docElem.webkitMatchesSelector ||
		docElem.mozMatchesSelector ||
		docElem.oMatchesSelector ||
		docElem.msMatchesSelector) )) ) {

		assert(function( div ) {
			// Check to see if it's possible to do matchesSelector
			// on a disconnected node (IE 9)
			support.disconnectedMatch = matches.call( div, "div" );

			// This should fail with an exception
			// Gecko does not error, returns false instead
			matches.call( div, "[s!='']:x" );
			rbuggyMatches.push( "!=", pseudos );
		});
	}

	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
	rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );

	/* Contains
	---------------------------------------------------------------------- */
	hasCompare = rnative.test( docElem.compareDocumentPosition );

	// Element contains another
	// Purposefully self-exclusive
	// As in, an element does not contain itself
	contains = hasCompare || rnative.test( docElem.contains ) ?
		function( a, b ) {
			var adown = a.nodeType === 9 ? a.documentElement : a,
				bup = b && b.parentNode;
			return a === bup || !!( bup && bup.nodeType === 1 && (
				adown.contains ?
					adown.contains( bup ) :
					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
			));
		} :
		function( a, b ) {
			if ( b ) {
				while ( (b = b.parentNode) ) {
					if ( b === a ) {
						return true;
					}
				}
			}
			return false;
		};

	/* Sorting
	---------------------------------------------------------------------- */

	// Document order sorting
	sortOrder = hasCompare ?
	function( a, b ) {

		// Flag for duplicate removal
		if ( a === b ) {
			hasDuplicate = true;
			return 0;
		}

		// Sort on method existence if only one input has compareDocumentPosition
		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
		if ( compare ) {
			return compare;
		}

		// Calculate position if both inputs belong to the same document
		compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
			a.compareDocumentPosition( b ) :

			// Otherwise we know they are disconnected
			1;

		// Disconnected nodes
		if ( compare & 1 ||
			(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {

			// Choose the first element that is related to our preferred document
			if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
				return -1;
			}
			if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
				return 1;
			}

			// Maintain original order
			return sortInput ?
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
				0;
		}

		return compare & 4 ? -1 : 1;
	} :
	function( a, b ) {
		// Exit early if the nodes are identical
		if ( a === b ) {
			hasDuplicate = true;
			return 0;
		}

		var cur,
			i = 0,
			aup = a.parentNode,
			bup = b.parentNode,
			ap = [ a ],
			bp = [ b ];

		// Parentless nodes are either documents or disconnected
		if ( !aup || !bup ) {
			return a === document ? -1 :
				b === document ? 1 :
				aup ? -1 :
				bup ? 1 :
				sortInput ?
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
				0;

		// If the nodes are siblings, we can do a quick check
		} else if ( aup === bup ) {
			return siblingCheck( a, b );
		}

		// Otherwise we need full lists of their ancestors for comparison
		cur = a;
		while ( (cur = cur.parentNode) ) {
			ap.unshift( cur );
		}
		cur = b;
		while ( (cur = cur.parentNode) ) {
			bp.unshift( cur );
		}

		// Walk down the tree looking for a discrepancy
		while ( ap[i] === bp[i] ) {
			i++;
		}

		return i ?
			// Do a sibling check if the nodes have a common ancestor
			siblingCheck( ap[i], bp[i] ) :

			// Otherwise nodes in our document sort first
			ap[i] === preferredDoc ? -1 :
			bp[i] === preferredDoc ? 1 :
			0;
	};

	return document;
};

Sizzle.matches = function( expr, elements ) {
	return Sizzle( expr, null, null, elements );
};

Sizzle.matchesSelector = function( elem, expr ) {
	// Set document vars if needed
	if ( ( elem.ownerDocument || elem ) !== document ) {
		setDocument( elem );
	}

	// Make sure that attribute selectors are quoted
	expr = expr.replace( rattributeQuotes, "='$1']" );

	if ( support.matchesSelector && documentIsHTML &&
		!compilerCache[ expr + " " ] &&
		( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
		( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {

		try {
			var ret = matches.call( elem, expr );

			// IE 9's matchesSelector returns false on disconnected nodes
			if ( ret || support.disconnectedMatch ||
					// As well, disconnected nodes are said to be in a document
					// fragment in IE 9
					elem.document && elem.document.nodeType !== 11 ) {
				return ret;
			}
		} catch (e) {}
	}

	return Sizzle( expr, document, null, [ elem ] ).length > 0;
};

Sizzle.contains = function( context, elem ) {
	// Set document vars if needed
	if ( ( context.ownerDocument || context ) !== document ) {
		setDocument( context );
	}
	return contains( context, elem );
};

Sizzle.attr = function( elem, name ) {
	// Set document vars if needed
	if ( ( elem.ownerDocument || elem ) !== document ) {
		setDocument( elem );
	}

	var fn = Expr.attrHandle[ name.toLowerCase() ],
		// Don't get fooled by Object.prototype properties (jQuery #13807)
		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
			fn( elem, name, !documentIsHTML ) :
			undefined;

	return val !== undefined ?
		val :
		support.attributes || !documentIsHTML ?
			elem.getAttribute( name ) :
			(val = elem.getAttributeNode(name)) && val.specified ?
				val.value :
				null;
};

Sizzle.error = function( msg ) {
	throw new Error( "Syntax error, unrecognized expression: " + msg );
};

/**
 * Document sorting and removing duplicates
 * @param {ArrayLike} results
 */
Sizzle.uniqueSort = function( results ) {
	var elem,
		duplicates = [],
		j = 0,
		i = 0;

	// Unless we *know* we can detect duplicates, assume their presence
	hasDuplicate = !support.detectDuplicates;
	sortInput = !support.sortStable && results.slice( 0 );
	results.sort( sortOrder );

	if ( hasDuplicate ) {
		while ( (elem = results[i++]) ) {
			if ( elem === results[ i ] ) {
				j = duplicates.push( i );
			}
		}
		while ( j-- ) {
			results.splice( duplicates[ j ], 1 );
		}
	}

	// Clear input after sorting to release objects
	// See https://github.com/jquery/sizzle/pull/225
	sortInput = null;

	return results;
};

/**
 * Utility function for retrieving the text value of an array of DOM nodes
 * @param {Array|Element} elem
 */
getText = Sizzle.getText = function( elem ) {
	var node,
		ret = "",
		i = 0,
		nodeType = elem.nodeType;

	if ( !nodeType ) {
		// If no nodeType, this is expected to be an array
		while ( (node = elem[i++]) ) {
			// Do not traverse comment nodes
			ret += getText( node );
		}
	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
		// Use textContent for elements
		// innerText usage removed for consistency of new lines (jQuery #11153)
		if ( typeof elem.textContent === "string" ) {
			return elem.textContent;
		} else {
			// Traverse its children
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
				ret += getText( elem );
			}
		}
	} else if ( nodeType === 3 || nodeType === 4 ) {
		return elem.nodeValue;
	}
	// Do not include comment or processing instruction nodes

	return ret;
};

Expr = Sizzle.selectors = {

	// Can be adjusted by the user
	cacheLength: 50,

	createPseudo: markFunction,

	match: matchExpr,

	attrHandle: {},

	find: {},

	relative: {
		">": { dir: "parentNode", first: true },
		" ": { dir: "parentNode" },
		"+": { dir: "previousSibling", first: true },
		"~": { dir: "previousSibling" }
	},

	preFilter: {
		"ATTR": function( match ) {
			match[1] = match[1].replace( runescape, funescape );

			// Move the given value to match[3] whether quoted or unquoted
			match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );

			if ( match[2] === "~=" ) {
				match[3] = " " + match[3] + " ";
			}

			return match.slice( 0, 4 );
		},

		"CHILD": function( match ) {
			/* matches from matchExpr["CHILD"]
				1 type (only|nth|...)
				2 what (child|of-type)
				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
				4 xn-component of xn+y argument ([+-]?\d*n|)
				5 sign of xn-component
				6 x of xn-component
				7 sign of y-component
				8 y of y-component
			*/
			match[1] = match[1].toLowerCase();

			if ( match[1].slice( 0, 3 ) === "nth" ) {
				// nth-* requires argument
				if ( !match[3] ) {
					Sizzle.error( match[0] );
				}

				// numeric x and y parameters for Expr.filter.CHILD
				// remember that false/true cast respectively to 0/1
				match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
				match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );

			// other types prohibit arguments
			} else if ( match[3] ) {
				Sizzle.error( match[0] );
			}

			return match;
		},

		"PSEUDO": function( match ) {
			var excess,
				unquoted = !match[6] && match[2];

			if ( matchExpr["CHILD"].test( match[0] ) ) {
				return null;
			}

			// Accept quoted arguments as-is
			if ( match[3] ) {
				match[2] = match[4] || match[5] || "";

			// Strip excess characters from unquoted arguments
			} else if ( unquoted && rpseudo.test( unquoted ) &&
				// Get excess from tokenize (recursively)
				(excess = tokenize( unquoted, true )) &&
				// advance to the next closing parenthesis
				(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {

				// excess is a negative index
				match[0] = match[0].slice( 0, excess );
				match[2] = unquoted.slice( 0, excess );
			}

			// Return only captures needed by the pseudo filter method (type and argument)
			return match.slice( 0, 3 );
		}
	},

	filter: {

		"TAG": function( nodeNameSelector ) {
			var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
			return nodeNameSelector === "*" ?
				function() { return true; } :
				function( elem ) {
					return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
				};
		},

		"CLASS": function( className ) {
			var pattern = classCache[ className + " " ];

			return pattern ||
				(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
				classCache( className, function( elem ) {
					return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
				});
		},

		"ATTR": function( name, operator, check ) {
			return function( elem ) {
				var result = Sizzle.attr( elem, name );

				if ( result == null ) {
					return operator === "!=";
				}
				if ( !operator ) {
					return true;
				}

				result += "";

				return operator === "=" ? result === check :
					operator === "!=" ? result !== check :
					operator === "^=" ? check && result.indexOf( check ) === 0 :
					operator === "*=" ? check && result.indexOf( check ) > -1 :
					operator === "$=" ? check && result.slice( -check.length ) === check :
					operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
					false;
			};
		},

		"CHILD": function( type, what, argument, first, last ) {
			var simple = type.slice( 0, 3 ) !== "nth",
				forward = type.slice( -4 ) !== "last",
				ofType = what === "of-type";

			return first === 1 && last === 0 ?

				// Shortcut for :nth-*(n)
				function( elem ) {
					return !!elem.parentNode;
				} :

				function( elem, context, xml ) {
					var cache, uniqueCache, outerCache, node, nodeIndex, start,
						dir = simple !== forward ? "nextSibling" : "previousSibling",
						parent = elem.parentNode,
						name = ofType && elem.nodeName.toLowerCase(),
						useCache = !xml && !ofType,
						diff = false;

					if ( parent ) {

						// :(first|last|only)-(child|of-type)
						if ( simple ) {
							while ( dir ) {
								node = elem;
								while ( (node = node[ dir ]) ) {
									if ( ofType ?
										node.nodeName.toLowerCase() === name :
										node.nodeType === 1 ) {

										return false;
									}
								}
								// Reverse direction for :only-* (if we haven't yet done so)
								start = dir = type === "only" && !start && "nextSibling";
							}
							return true;
						}

						start = [ forward ? parent.firstChild : parent.lastChild ];

						// non-xml :nth-child(...) stores cache data on `parent`
						if ( forward && useCache ) {

							// Seek `elem` from a previously-cached index

							// ...in a gzip-friendly way
							node = parent;
							outerCache = node[ expando ] || (node[ expando ] = {});

							// Support: IE <9 only
							// Defend against cloned attroperties (jQuery gh-1709)
							uniqueCache = outerCache[ node.uniqueID ] ||
								(outerCache[ node.uniqueID ] = {});

							cache = uniqueCache[ type ] || [];
							nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
							diff = nodeIndex && cache[ 2 ];
							node = nodeIndex && parent.childNodes[ nodeIndex ];

							while ( (node = ++nodeIndex && node && node[ dir ] ||

								// Fallback to seeking `elem` from the start
								(diff = nodeIndex = 0) || start.pop()) ) {

								// When found, cache indexes on `parent` and break
								if ( node.nodeType === 1 && ++diff && node === elem ) {
									uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
									break;
								}
							}

						} else {
							// Use previously-cached element index if available
							if ( useCache ) {
								// ...in a gzip-friendly way
								node = elem;
								outerCache = node[ expando ] || (node[ expando ] = {});

								// Support: IE <9 only
								// Defend against cloned attroperties (jQuery gh-1709)
								uniqueCache = outerCache[ node.uniqueID ] ||
									(outerCache[ node.uniqueID ] = {});

								cache = uniqueCache[ type ] || [];
								nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
								diff = nodeIndex;
							}

							// xml :nth-child(...)
							// or :nth-last-child(...) or :nth(-last)?-of-type(...)
							if ( diff === false ) {
								// Use the same loop as above to seek `elem` from the start
								while ( (node = ++nodeIndex && node && node[ dir ] ||
									(diff = nodeIndex = 0) || start.pop()) ) {

									if ( ( ofType ?
										node.nodeName.toLowerCase() === name :
										node.nodeType === 1 ) &&
										++diff ) {

										// Cache the index of each encountered element
										if ( useCache ) {
											outerCache = node[ expando ] || (node[ expando ] = {});

											// Support: IE <9 only
											// Defend against cloned attroperties (jQuery gh-1709)
											uniqueCache = outerCache[ node.uniqueID ] ||
												(outerCache[ node.uniqueID ] = {});

											uniqueCache[ type ] = [ dirruns, diff ];
										}

										if ( node === elem ) {
											break;
										}
									}
								}
							}
						}

						// Incorporate the offset, then check against cycle size
						diff -= last;
						return diff === first || ( diff % first === 0 && diff / first >= 0 );
					}
				};
		},

		"PSEUDO": function( pseudo, argument ) {
			// pseudo-class names are case-insensitive
			// http://www.w3.org/TR/selectors/#pseudo-classes
			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
			// Remember that setFilters inherits from pseudos
			var args,
				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
					Sizzle.error( "unsupported pseudo: " + pseudo );

			// The user may use createPseudo to indicate that
			// arguments are needed to create the filter function
			// just as Sizzle does
			if ( fn[ expando ] ) {
				return fn( argument );
			}

			// But maintain support for old signatures
			if ( fn.length > 1 ) {
				args = [ pseudo, pseudo, "", argument ];
				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
					markFunction(function( seed, matches ) {
						var idx,
							matched = fn( seed, argument ),
							i = matched.length;
						while ( i-- ) {
							idx = indexOf( seed, matched[i] );
							seed[ idx ] = !( matches[ idx ] = matched[i] );
						}
					}) :
					function( elem ) {
						return fn( elem, 0, args );
					};
			}

			return fn;
		}
	},

	pseudos: {
		// Potentially complex pseudos
		"not": markFunction(function( selector ) {
			// Trim the selector passed to compile
			// to avoid treating leading and trailing
			// spaces as combinators
			var input = [],
				results = [],
				matcher = compile( selector.replace( rtrim, "$1" ) );

			return matcher[ expando ] ?
				markFunction(function( seed, matches, context, xml ) {
					var elem,
						unmatched = matcher( seed, null, xml, [] ),
						i = seed.length;

					// Match elements unmatched by `matcher`
					while ( i-- ) {
						if ( (elem = unmatched[i]) ) {
							seed[i] = !(matches[i] = elem);
						}
					}
				}) :
				function( elem, context, xml ) {
					input[0] = elem;
					matcher( input, null, xml, results );
					// Don't keep the element (issue #299)
					input[0] = null;
					return !results.pop();
				};
		}),

		"has": markFunction(function( selector ) {
			return function( elem ) {
				return Sizzle( selector, elem ).length > 0;
			};
		}),

		"contains": markFunction(function( text ) {
			text = text.replace( runescape, funescape );
			return function( elem ) {
				return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
			};
		}),

		// "Whether an element is represented by a :lang() selector
		// is based solely on the element's language value
		// being equal to the identifier C,
		// or beginning with the identifier C immediately followed by "-".
		// The matching of C against the element's language value is performed case-insensitively.
		// The identifier C does not have to be a valid language name."
		// http://www.w3.org/TR/selectors/#lang-pseudo
		"lang": markFunction( function( lang ) {
			// lang value must be a valid identifier
			if ( !ridentifier.test(lang || "") ) {
				Sizzle.error( "unsupported lang: " + lang );
			}
			lang = lang.replace( runescape, funescape ).toLowerCase();
			return function( elem ) {
				var elemLang;
				do {
					if ( (elemLang = documentIsHTML ?
						elem.lang :
						elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {

						elemLang = elemLang.toLowerCase();
						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
					}
				} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
				return false;
			};
		}),

		// Miscellaneous
		"target": function( elem ) {
			var hash = window.location && window.location.hash;
			return hash && hash.slice( 1 ) === elem.id;
		},

		"root": function( elem ) {
			return elem === docElem;
		},

		"focus": function( elem ) {
			return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
		},

		// Boolean properties
		"enabled": function( elem ) {
			return elem.disabled === false;
		},

		"disabled": function( elem ) {
			return elem.disabled === true;
		},

		"checked": function( elem ) {
			// In CSS3, :checked should return both checked and selected elements
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
			var nodeName = elem.nodeName.toLowerCase();
			return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
		},

		"selected": function( elem ) {
			// Accessing this property makes selected-by-default
			// options in Safari work properly
			if ( elem.parentNode ) {
				elem.parentNode.selectedIndex;
			}

			return elem.selected === true;
		},

		// Contents
		"empty": function( elem ) {
			// http://www.w3.org/TR/selectors/#empty-pseudo
			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
			//   but not by others (comment: 8; processing instruction: 7; etc.)
			// nodeType < 6 works because attributes (2) do not appear as children
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
				if ( elem.nodeType < 6 ) {
					return false;
				}
			}
			return true;
		},

		"parent": function( elem ) {
			return !Expr.pseudos["empty"]( elem );
		},

		// Element/input types
		"header": function( elem ) {
			return rheader.test( elem.nodeName );
		},

		"input": function( elem ) {
			return rinputs.test( elem.nodeName );
		},

		"button": function( elem ) {
			var name = elem.nodeName.toLowerCase();
			return name === "input" && elem.type === "button" || name === "button";
		},

		"text": function( elem ) {
			var attr;
			return elem.nodeName.toLowerCase() === "input" &&
				elem.type === "text" &&

				// Support: IE<8
				// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
				( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
		},

		// Position-in-collection
		"first": createPositionalPseudo(function() {
			return [ 0 ];
		}),

		"last": createPositionalPseudo(function( matchIndexes, length ) {
			return [ length - 1 ];
		}),

		"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
			return [ argument < 0 ? argument + length : argument ];
		}),

		"even": createPositionalPseudo(function( matchIndexes, length ) {
			var i = 0;
			for ( ; i < length; i += 2 ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		}),

		"odd": createPositionalPseudo(function( matchIndexes, length ) {
			var i = 1;
			for ( ; i < length; i += 2 ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		}),

		"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
			var i = argument < 0 ? argument + length : argument;
			for ( ; --i >= 0; ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		}),

		"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
			var i = argument < 0 ? argument + length : argument;
			for ( ; ++i < length; ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		})
	}
};

Expr.pseudos["nth"] = Expr.pseudos["eq"];

// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
	Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
	Expr.pseudos[ i ] = createButtonPseudo( i );
}

// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();

tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
	var matched, match, tokens, type,
		soFar, groups, preFilters,
		cached = tokenCache[ selector + " " ];

	if ( cached ) {
		return parseOnly ? 0 : cached.slice( 0 );
	}

	soFar = selector;
	groups = [];
	preFilters = Expr.preFilter;

	while ( soFar ) {

		// Comma and first run
		if ( !matched || (match = rcomma.exec( soFar )) ) {
			if ( match ) {
				// Don't consume trailing commas as valid
				soFar = soFar.slice( match[0].length ) || soFar;
			}
			groups.push( (tokens = []) );
		}

		matched = false;

		// Combinators
		if ( (match = rcombinators.exec( soFar )) ) {
			matched = match.shift();
			tokens.push({
				value: matched,
				// Cast descendant combinators to space
				type: match[0].replace( rtrim, " " )
			});
			soFar = soFar.slice( matched.length );
		}

		// Filters
		for ( type in Expr.filter ) {
			if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
				(match = preFilters[ type ]( match ))) ) {
				matched = match.shift();
				tokens.push({
					value: matched,
					type: type,
					matches: match
				});
				soFar = soFar.slice( matched.length );
			}
		}

		if ( !matched ) {
			break;
		}
	}

	// Return the length of the invalid excess
	// if we're just parsing
	// Otherwise, throw an error or return tokens
	return parseOnly ?
		soFar.length :
		soFar ?
			Sizzle.error( selector ) :
			// Cache the tokens
			tokenCache( selector, groups ).slice( 0 );
};

function toSelector( tokens ) {
	var i = 0,
		len = tokens.length,
		selector = "";
	for ( ; i < len; i++ ) {
		selector += tokens[i].value;
	}
	return selector;
}

function addCombinator( matcher, combinator, base ) {
	var dir = combinator.dir,
		checkNonElements = base && dir === "parentNode",
		doneName = done++;

	return combinator.first ?
		// Check against closest ancestor/preceding element
		function( elem, context, xml ) {
			while ( (elem = elem[ dir ]) ) {
				if ( elem.nodeType === 1 || checkNonElements ) {
					return matcher( elem, context, xml );
				}
			}
		} :

		// Check against all ancestor/preceding elements
		function( elem, context, xml ) {
			var oldCache, uniqueCache, outerCache,
				newCache = [ dirruns, doneName ];

			// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
			if ( xml ) {
				while ( (elem = elem[ dir ]) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						if ( matcher( elem, context, xml ) ) {
							return true;
						}
					}
				}
			} else {
				while ( (elem = elem[ dir ]) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						outerCache = elem[ expando ] || (elem[ expando ] = {});

						// Support: IE <9 only
						// Defend against cloned attroperties (jQuery gh-1709)
						uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});

						if ( (oldCache = uniqueCache[ dir ]) &&
							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {

							// Assign to newCache so results back-propagate to previous elements
							return (newCache[ 2 ] = oldCache[ 2 ]);
						} else {
							// Reuse newcache so results back-propagate to previous elements
							uniqueCache[ dir ] = newCache;

							// A match means we're done; a fail means we have to keep checking
							if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
								return true;
							}
						}
					}
				}
			}
		};
}

function elementMatcher( matchers ) {
	return matchers.length > 1 ?
		function( elem, context, xml ) {
			var i = matchers.length;
			while ( i-- ) {
				if ( !matchers[i]( elem, context, xml ) ) {
					return false;
				}
			}
			return true;
		} :
		matchers[0];
}

function multipleContexts( selector, contexts, results ) {
	var i = 0,
		len = contexts.length;
	for ( ; i < len; i++ ) {
		Sizzle( selector, contexts[i], results );
	}
	return results;
}

function condense( unmatched, map, filter, context, xml ) {
	var elem,
		newUnmatched = [],
		i = 0,
		len = unmatched.length,
		mapped = map != null;

	for ( ; i < len; i++ ) {
		if ( (elem = unmatched[i]) ) {
			if ( !filter || filter( elem, context, xml ) ) {
				newUnmatched.push( elem );
				if ( mapped ) {
					map.push( i );
				}
			}
		}
	}

	return newUnmatched;
}

function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
	if ( postFilter && !postFilter[ expando ] ) {
		postFilter = setMatcher( postFilter );
	}
	if ( postFinder && !postFinder[ expando ] ) {
		postFinder = setMatcher( postFinder, postSelector );
	}
	return markFunction(function( seed, results, context, xml ) {
		var temp, i, elem,
			preMap = [],
			postMap = [],
			preexisting = results.length,

			// Get initial elements from seed or context
			elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),

			// Prefilter to get matcher input, preserving a map for seed-results synchronization
			matcherIn = preFilter && ( seed || !selector ) ?
				condense( elems, preMap, preFilter, context, xml ) :
				elems,

			matcherOut = matcher ?
				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?

					// ...intermediate processing is necessary
					[] :

					// ...otherwise use results directly
					results :
				matcherIn;

		// Find primary matches
		if ( matcher ) {
			matcher( matcherIn, matcherOut, context, xml );
		}

		// Apply postFilter
		if ( postFilter ) {
			temp = condense( matcherOut, postMap );
			postFilter( temp, [], context, xml );

			// Un-match failing elements by moving them back to matcherIn
			i = temp.length;
			while ( i-- ) {
				if ( (elem = temp[i]) ) {
					matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
				}
			}
		}

		if ( seed ) {
			if ( postFinder || preFilter ) {
				if ( postFinder ) {
					// Get the final matcherOut by condensing this intermediate into postFinder contexts
					temp = [];
					i = matcherOut.length;
					while ( i-- ) {
						if ( (elem = matcherOut[i]) ) {
							// Restore matcherIn since elem is not yet a final match
							temp.push( (matcherIn[i] = elem) );
						}
					}
					postFinder( null, (matcherOut = []), temp, xml );
				}

				// Move matched elements from seed to results to keep them synchronized
				i = matcherOut.length;
				while ( i-- ) {
					if ( (elem = matcherOut[i]) &&
						(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {

						seed[temp] = !(results[temp] = elem);
					}
				}
			}

		// Add elements to results, through postFinder if defined
		} else {
			matcherOut = condense(
				matcherOut === results ?
					matcherOut.splice( preexisting, matcherOut.length ) :
					matcherOut
			);
			if ( postFinder ) {
				postFinder( null, results, matcherOut, xml );
			} else {
				push.apply( results, matcherOut );
			}
		}
	});
}

function matcherFromTokens( tokens ) {
	var checkContext, matcher, j,
		len = tokens.length,
		leadingRelative = Expr.relative[ tokens[0].type ],
		implicitRelative = leadingRelative || Expr.relative[" "],
		i = leadingRelative ? 1 : 0,

		// The foundational matcher ensures that elements are reachable from top-level context(s)
		matchContext = addCombinator( function( elem ) {
			return elem === checkContext;
		}, implicitRelative, true ),
		matchAnyContext = addCombinator( function( elem ) {
			return indexOf( checkContext, elem ) > -1;
		}, implicitRelative, true ),
		matchers = [ function( elem, context, xml ) {
			var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
				(checkContext = context).nodeType ?
					matchContext( elem, context, xml ) :
					matchAnyContext( elem, context, xml ) );
			// Avoid hanging onto element (issue #299)
			checkContext = null;
			return ret;
		} ];

	for ( ; i < len; i++ ) {
		if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
			matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
		} else {
			matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );

			// Return special upon seeing a positional matcher
			if ( matcher[ expando ] ) {
				// Find the next relative operator (if any) for proper handling
				j = ++i;
				for ( ; j < len; j++ ) {
					if ( Expr.relative[ tokens[j].type ] ) {
						break;
					}
				}
				return setMatcher(
					i > 1 && elementMatcher( matchers ),
					i > 1 && toSelector(
						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
						tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
					).replace( rtrim, "$1" ),
					matcher,
					i < j && matcherFromTokens( tokens.slice( i, j ) ),
					j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
					j < len && toSelector( tokens )
				);
			}
			matchers.push( matcher );
		}
	}

	return elementMatcher( matchers );
}

function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
	var bySet = setMatchers.length > 0,
		byElement = elementMatchers.length > 0,
		superMatcher = function( seed, context, xml, results, outermost ) {
			var elem, j, matcher,
				matchedCount = 0,
				i = "0",
				unmatched = seed && [],
				setMatched = [],
				contextBackup = outermostContext,
				// We must always have either seed elements or outermost context
				elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
				// Use integer dirruns iff this is the outermost matcher
				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
				len = elems.length;

			if ( outermost ) {
				outermostContext = context === document || context || outermost;
			}

			// Add elements passing elementMatchers directly to results
			// Support: IE<9, Safari
			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
			for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
				if ( byElement && elem ) {
					j = 0;
					if ( !context && elem.ownerDocument !== document ) {
						setDocument( elem );
						xml = !documentIsHTML;
					}
					while ( (matcher = elementMatchers[j++]) ) {
						if ( matcher( elem, context || document, xml) ) {
							results.push( elem );
							break;
						}
					}
					if ( outermost ) {
						dirruns = dirrunsUnique;
					}
				}

				// Track unmatched elements for set filters
				if ( bySet ) {
					// They will have gone through all possible matchers
					if ( (elem = !matcher && elem) ) {
						matchedCount--;
					}

					// Lengthen the array for every element, matched or not
					if ( seed ) {
						unmatched.push( elem );
					}
				}
			}

			// `i` is now the count of elements visited above, and adding it to `matchedCount`
			// makes the latter nonnegative.
			matchedCount += i;

			// Apply set filters to unmatched elements
			// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
			// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
			// no element matchers and no seed.
			// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
			// case, which will result in a "00" `matchedCount` that differs from `i` but is also
			// numerically zero.
			if ( bySet && i !== matchedCount ) {
				j = 0;
				while ( (matcher = setMatchers[j++]) ) {
					matcher( unmatched, setMatched, context, xml );
				}

				if ( seed ) {
					// Reintegrate element matches to eliminate the need for sorting
					if ( matchedCount > 0 ) {
						while ( i-- ) {
							if ( !(unmatched[i] || setMatched[i]) ) {
								setMatched[i] = pop.call( results );
							}
						}
					}

					// Discard index placeholder values to get only actual matches
					setMatched = condense( setMatched );
				}

				// Add matches to results
				push.apply( results, setMatched );

				// Seedless set matches succeeding multiple successful matchers stipulate sorting
				if ( outermost && !seed && setMatched.length > 0 &&
					( matchedCount + setMatchers.length ) > 1 ) {

					Sizzle.uniqueSort( results );
				}
			}

			// Override manipulation of globals by nested matchers
			if ( outermost ) {
				dirruns = dirrunsUnique;
				outermostContext = contextBackup;
			}

			return unmatched;
		};

	return bySet ?
		markFunction( superMatcher ) :
		superMatcher;
}

compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
	var i,
		setMatchers = [],
		elementMatchers = [],
		cached = compilerCache[ selector + " " ];

	if ( !cached ) {
		// Generate a function of recursive functions that can be used to check each element
		if ( !match ) {
			match = tokenize( selector );
		}
		i = match.length;
		while ( i-- ) {
			cached = matcherFromTokens( match[i] );
			if ( cached[ expando ] ) {
				setMatchers.push( cached );
			} else {
				elementMatchers.push( cached );
			}
		}

		// Cache the compiled function
		cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );

		// Save selector and tokenization
		cached.selector = selector;
	}
	return cached;
};

/**
 * A low-level selection function that works with Sizzle's compiled
 *  selector functions
 * @param {String|Function} selector A selector or a pre-compiled
 *  selector function built with Sizzle.compile
 * @param {Element} context
 * @param {Array} [results]
 * @param {Array} [seed] A set of elements to match against
 */
select = Sizzle.select = function( selector, context, results, seed ) {
	var i, tokens, token, type, find,
		compiled = typeof selector === "function" && selector,
		match = !seed && tokenize( (selector = compiled.selector || selector) );

	results = results || [];

	// Try to minimize operations if there is only one selector in the list and no seed
	// (the latter of which guarantees us context)
	if ( match.length === 1 ) {

		// Reduce context if the leading compound selector is an ID
		tokens = match[0] = match[0].slice( 0 );
		if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
				support.getById && context.nodeType === 9 && documentIsHTML &&
				Expr.relative[ tokens[1].type ] ) {

			context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
			if ( !context ) {
				return results;

			// Precompiled matchers will still verify ancestry, so step up a level
			} else if ( compiled ) {
				context = context.parentNode;
			}

			selector = selector.slice( tokens.shift().value.length );
		}

		// Fetch a seed set for right-to-left matching
		i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
		while ( i-- ) {
			token = tokens[i];

			// Abort if we hit a combinator
			if ( Expr.relative[ (type = token.type) ] ) {
				break;
			}
			if ( (find = Expr.find[ type ]) ) {
				// Search, expanding context for leading sibling combinators
				if ( (seed = find(
					token.matches[0].replace( runescape, funescape ),
					rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
				)) ) {

					// If seed is empty or no tokens remain, we can return early
					tokens.splice( i, 1 );
					selector = seed.length && toSelector( tokens );
					if ( !selector ) {
						push.apply( results, seed );
						return results;
					}

					break;
				}
			}
		}
	}

	// Compile and execute a filtering function if one is not provided
	// Provide `match` to avoid retokenization if we modified the selector above
	( compiled || compile( selector, match ) )(
		seed,
		context,
		!documentIsHTML,
		results,
		!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
	);
	return results;
};

// One-time assignments

// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;

// Support: Chrome 14-35+
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;

// Initialize against the default document
setDocument();

// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( div1 ) {
	// Should return 1, but returns 4 (following)
	return div1.compareDocumentPosition( document.createElement("div") ) & 1;
});

// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( div ) {
	div.innerHTML = "<a href='#'></a>";
	return div.firstChild.getAttribute("href") === "#" ;
}) ) {
	addHandle( "type|href|height|width", function( elem, name, isXML ) {
		if ( !isXML ) {
			return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
		}
	});
}

// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( div ) {
	div.innerHTML = "<input/>";
	div.firstChild.setAttribute( "value", "" );
	return div.firstChild.getAttribute( "value" ) === "";
}) ) {
	addHandle( "value", function( elem, name, isXML ) {
		if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
			return elem.defaultValue;
		}
	});
}

// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( div ) {
	return div.getAttribute("disabled") == null;
}) ) {
	addHandle( booleans, function( elem, name, isXML ) {
		var val;
		if ( !isXML ) {
			return elem[ name ] === true ? name.toLowerCase() :
					(val = elem.getAttributeNode( name )) && val.specified ?
					val.value :
				null;
		}
	});
}

return Sizzle;

})( window );



jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;



var dir = function( elem, dir, until ) {
	var matched = [],
		truncate = until !== undefined;

	while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
		if ( elem.nodeType === 1 ) {
			if ( truncate && jQuery( elem ).is( until ) ) {
				break;
			}
			matched.push( elem );
		}
	}
	return matched;
};


var siblings = function( n, elem ) {
	var matched = [];

	for ( ; n; n = n.nextSibling ) {
		if ( n.nodeType === 1 && n !== elem ) {
			matched.push( n );
		}
	}

	return matched;
};


var rneedsContext = jQuery.expr.match.needsContext;

var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );



var risSimple = /^.[^:#\[\.,]*$/;

// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
	if ( jQuery.isFunction( qualifier ) ) {
		return jQuery.grep( elements, function( elem, i ) {
			/* jshint -W018 */
			return !!qualifier.call( elem, i, elem ) !== not;
		} );

	}

	if ( qualifier.nodeType ) {
		return jQuery.grep( elements, function( elem ) {
			return ( elem === qualifier ) !== not;
		} );

	}

	if ( typeof qualifier === "string" ) {
		if ( risSimple.test( qualifier ) ) {
			return jQuery.filter( qualifier, elements, not );
		}

		qualifier = jQuery.filter( qualifier, elements );
	}

	return jQuery.grep( elements, function( elem ) {
		return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not;
	} );
}

jQuery.filter = function( expr, elems, not ) {
	var elem = elems[ 0 ];

	if ( not ) {
		expr = ":not(" + expr + ")";
	}

	return elems.length === 1 && elem.nodeType === 1 ?
		jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
		jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
			return elem.nodeType === 1;
		} ) );
};

jQuery.fn.extend( {
	find: function( selector ) {
		var i,
			ret = [],
			self = this,
			len = self.length;

		if ( typeof selector !== "string" ) {
			return this.pushStack( jQuery( selector ).filter( function() {
				for ( i = 0; i < len; i++ ) {
					if ( jQuery.contains( self[ i ], this ) ) {
						return true;
					}
				}
			} ) );
		}

		for ( i = 0; i < len; i++ ) {
			jQuery.find( selector, self[ i ], ret );
		}

		// Needed because $( selector, context ) becomes $( context ).find( selector )
		ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
		ret.selector = this.selector ? this.selector + " " + selector : selector;
		return ret;
	},
	filter: function( selector ) {
		return this.pushStack( winnow( this, selector || [], false ) );
	},
	not: function( selector ) {
		return this.pushStack( winnow( this, selector || [], true ) );
	},
	is: function( selector ) {
		return !!winnow(
			this,

			// If this is a positional/relative selector, check membership in the returned set
			// so $("p:first").is("p:last") won't return true for a doc with two "p".
			typeof selector === "string" && rneedsContext.test( selector ) ?
				jQuery( selector ) :
				selector || [],
			false
		).length;
	}
} );


// Initialize a jQuery object


// A central reference to the root jQuery(document)
var rootjQuery,

	// A simple way to check for HTML strings
	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
	// Strict HTML recognition (#11290: must start with <)
	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,

	init = jQuery.fn.init = function( selector, context, root ) {
		var match, elem;

		// HANDLE: $(""), $(null), $(undefined), $(false)
		if ( !selector ) {
			return this;
		}

		// init accepts an alternate rootjQuery
		// so migrate can support jQuery.sub (gh-2101)
		root = root || rootjQuery;

		// Handle HTML strings
		if ( typeof selector === "string" ) {
			if ( selector.charAt( 0 ) === "<" &&
				selector.charAt( selector.length - 1 ) === ">" &&
				selector.length >= 3 ) {

				// Assume that strings that start and end with <> are HTML and skip the regex check
				match = [ null, selector, null ];

			} else {
				match = rquickExpr.exec( selector );
			}

			// Match html or make sure no context is specified for #id
			if ( match && ( match[ 1 ] || !context ) ) {

				// HANDLE: $(html) -> $(array)
				if ( match[ 1 ] ) {
					context = context instanceof jQuery ? context[ 0 ] : context;

					// scripts is true for back-compat
					// Intentionally let the error be thrown if parseHTML is not present
					jQuery.merge( this, jQuery.parseHTML(
						match[ 1 ],
						context && context.nodeType ? context.ownerDocument || context : document,
						true
					) );

					// HANDLE: $(html, props)
					if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
						for ( match in context ) {

							// Properties of context are called as methods if possible
							if ( jQuery.isFunction( this[ match ] ) ) {
								this[ match ]( context[ match ] );

							// ...and otherwise set as attributes
							} else {
								this.attr( match, context[ match ] );
							}
						}
					}

					return this;

				// HANDLE: $(#id)
				} else {
					elem = document.getElementById( match[ 2 ] );

					// Check parentNode to catch when Blackberry 4.6 returns
					// nodes that are no longer in the document #6963
					if ( elem && elem.parentNode ) {

						// Handle the case where IE and Opera return items
						// by name instead of ID
						if ( elem.id !== match[ 2 ] ) {
							return rootjQuery.find( selector );
						}

						// Otherwise, we inject the element directly into the jQuery object
						this.length = 1;
						this[ 0 ] = elem;
					}

					this.context = document;
					this.selector = selector;
					return this;
				}

			// HANDLE: $(expr, $(...))
			} else if ( !context || context.jquery ) {
				return ( context || root ).find( selector );

			// HANDLE: $(expr, context)
			// (which is just equivalent to: $(context).find(expr)
			} else {
				return this.constructor( context ).find( selector );
			}

		// HANDLE: $(DOMElement)
		} else if ( selector.nodeType ) {
			this.context = this[ 0 ] = selector;
			this.length = 1;
			return this;

		// HANDLE: $(function)
		// Shortcut for document ready
		} else if ( jQuery.isFunction( selector ) ) {
			return typeof root.ready !== "undefined" ?
				root.ready( selector ) :

				// Execute immediately if ready is not present
				selector( jQuery );
		}

		if ( selector.selector !== undefined ) {
			this.selector = selector.selector;
			this.context = selector.context;
		}

		return jQuery.makeArray( selector, this );
	};

// Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn;

// Initialize central reference
rootjQuery = jQuery( document );


var rparentsprev = /^(?:parents|prev(?:Until|All))/,

	// methods guaranteed to produce a unique set when starting from a unique set
	guaranteedUnique = {
		children: true,
		contents: true,
		next: true,
		prev: true
	};

jQuery.fn.extend( {
	has: function( target ) {
		var i,
			targets = jQuery( target, this ),
			len = targets.length;

		return this.filter( function() {
			for ( i = 0; i < len; i++ ) {
				if ( jQuery.contains( this, targets[ i ] ) ) {
					return true;
				}
			}
		} );
	},

	closest: function( selectors, context ) {
		var cur,
			i = 0,
			l = this.length,
			matched = [],
			pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
				jQuery( selectors, context || this.context ) :
				0;

		for ( ; i < l; i++ ) {
			for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {

				// Always skip document fragments
				if ( cur.nodeType < 11 && ( pos ?
					pos.index( cur ) > -1 :

					// Don't pass non-elements to Sizzle
					cur.nodeType === 1 &&
						jQuery.find.matchesSelector( cur, selectors ) ) ) {

					matched.push( cur );
					break;
				}
			}
		}

		return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
	},

	// Determine the position of an element within
	// the matched set of elements
	index: function( elem ) {

		// No argument, return index in parent
		if ( !elem ) {
			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
		}

		// index in selector
		if ( typeof elem === "string" ) {
			return jQuery.inArray( this[ 0 ], jQuery( elem ) );
		}

		// Locate the position of the desired element
		return jQuery.inArray(

			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[ 0 ] : elem, this );
	},

	add: function( selector, context ) {
		return this.pushStack(
			jQuery.uniqueSort(
				jQuery.merge( this.get(), jQuery( selector, context ) )
			)
		);
	},

	addBack: function( selector ) {
		return this.add( selector == null ?
			this.prevObject : this.prevObject.filter( selector )
		);
	}
} );

function sibling( cur, dir ) {
	do {
		cur = cur[ dir ];
	} while ( cur && cur.nodeType !== 1 );

	return cur;
}

jQuery.each( {
	parent: function( elem ) {
		var parent = elem.parentNode;
		return parent && parent.nodeType !== 11 ? parent : null;
	},
	parents: function( elem ) {
		return dir( elem, "parentNode" );
	},
	parentsUntil: function( elem, i, until ) {
		return dir( elem, "parentNode", until );
	},
	next: function( elem ) {
		return sibling( elem, "nextSibling" );
	},
	prev: function( elem ) {
		return sibling( elem, "previousSibling" );
	},
	nextAll: function( elem ) {
		return dir( elem, "nextSibling" );
	},
	prevAll: function( elem ) {
		return dir( elem, "previousSibling" );
	},
	nextUntil: function( elem, i, until ) {
		return dir( elem, "nextSibling", until );
	},
	prevUntil: function( elem, i, until ) {
		return dir( elem, "previousSibling", until );
	},
	siblings: function( elem ) {
		return siblings( ( elem.parentNode || {} ).firstChild, elem );
	},
	children: function( elem ) {
		return siblings( elem.firstChild );
	},
	contents: function( elem ) {
		return jQuery.nodeName( elem, "iframe" ) ?
			elem.contentDocument || elem.contentWindow.document :
			jQuery.merge( [], elem.childNodes );
	}
}, function( name, fn ) {
	jQuery.fn[ name ] = function( until, selector ) {
		var ret = jQuery.map( this, fn, until );

		if ( name.slice( -5 ) !== "Until" ) {
			selector = until;
		}

		if ( selector && typeof selector === "string" ) {
			ret = jQuery.filter( selector, ret );
		}

		if ( this.length > 1 ) {

			// Remove duplicates
			if ( !guaranteedUnique[ name ] ) {
				ret = jQuery.uniqueSort( ret );
			}

			// Reverse order for parents* and prev-derivatives
			if ( rparentsprev.test( name ) ) {
				ret = ret.reverse();
			}
		}

		return this.pushStack( ret );
	};
} );
var rnotwhite = ( /\S+/g );



// Convert String-formatted options into Object-formatted ones
function createOptions( options ) {
	var object = {};
	jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
		object[ flag ] = true;
	} );
	return object;
}

/*
 * Create a callback list using the following parameters:
 *
 *	options: an optional list of space-separated options that will change how
 *			the callback list behaves or a more traditional option object
 *
 * By default a callback list will act like an event callback list and can be
 * "fired" multiple times.
 *
 * Possible options:
 *
 *	once:			will ensure the callback list can only be fired once (like a Deferred)
 *
 *	memory:			will keep track of previous values and will call any callback added
 *					after the list has been fired right away with the latest "memorized"
 *					values (like a Deferred)
 *
 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
 *
 *	stopOnFalse:	interrupt callings when a callback returns false
 *
 */
jQuery.Callbacks = function( options ) {

	// Convert options from String-formatted to Object-formatted if needed
	// (we check in cache first)
	options = typeof options === "string" ?
		createOptions( options ) :
		jQuery.extend( {}, options );

	var // Flag to know if list is currently firing
		firing,

		// Last fire value for non-forgettable lists
		memory,

		// Flag to know if list was already fired
		fired,

		// Flag to prevent firing
		locked,

		// Actual callback list
		list = [],

		// Queue of execution data for repeatable lists
		queue = [],

		// Index of currently firing callback (modified by add/remove as needed)
		firingIndex = -1,

		// Fire callbacks
		fire = function() {

			// Enforce single-firing
			locked = options.once;

			// Execute callbacks for all pending executions,
			// respecting firingIndex overrides and runtime changes
			fired = firing = true;
			for ( ; queue.length; firingIndex = -1 ) {
				memory = queue.shift();
				while ( ++firingIndex < list.length ) {

					// Run callback and check for early termination
					if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
						options.stopOnFalse ) {

						// Jump to end and forget the data so .add doesn't re-fire
						firingIndex = list.length;
						memory = false;
					}
				}
			}

			// Forget the data if we're done with it
			if ( !options.memory ) {
				memory = false;
			}

			firing = false;

			// Clean up if we're done firing for good
			if ( locked ) {

				// Keep an empty list if we have data for future add calls
				if ( memory ) {
					list = [];

				// Otherwise, this object is spent
				} else {
					list = "";
				}
			}
		},

		// Actual Callbacks object
		self = {

			// Add a callback or a collection of callbacks to the list
			add: function() {
				if ( list ) {

					// If we have memory from a past run, we should fire after adding
					if ( memory && !firing ) {
						firingIndex = list.length - 1;
						queue.push( memory );
					}

					( function add( args ) {
						jQuery.each( args, function( _, arg ) {
							if ( jQuery.isFunction( arg ) ) {
								if ( !options.unique || !self.has( arg ) ) {
									list.push( arg );
								}
							} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {

								// Inspect recursively
								add( arg );
							}
						} );
					} )( arguments );

					if ( memory && !firing ) {
						fire();
					}
				}
				return this;
			},

			// Remove a callback from the list
			remove: function() {
				jQuery.each( arguments, function( _, arg ) {
					var index;
					while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
						list.splice( index, 1 );

						// Handle firing indexes
						if ( index <= firingIndex ) {
							firingIndex--;
						}
					}
				} );
				return this;
			},

			// Check if a given callback is in the list.
			// If no argument is given, return whether or not list has callbacks attached.
			has: function( fn ) {
				return fn ?
					jQuery.inArray( fn, list ) > -1 :
					list.length > 0;
			},

			// Remove all callbacks from the list
			empty: function() {
				if ( list ) {
					list = [];
				}
				return this;
			},

			// Disable .fire and .add
			// Abort any current/pending executions
			// Clear all callbacks and values
			disable: function() {
				locked = queue = [];
				list = memory = "";
				return this;
			},
			disabled: function() {
				return !list;
			},

			// Disable .fire
			// Also disable .add unless we have memory (since it would have no effect)
			// Abort any pending executions
			lock: function() {
				locked = true;
				if ( !memory ) {
					self.disable();
				}
				return this;
			},
			locked: function() {
				return !!locked;
			},

			// Call all callbacks with the given context and arguments
			fireWith: function( context, args ) {
				if ( !locked ) {
					args = args || [];
					args = [ context, args.slice ? args.slice() : args ];
					queue.push( args );
					if ( !firing ) {
						fire();
					}
				}
				return this;
			},

			// Call all the callbacks with the given arguments
			fire: function() {
				self.fireWith( this, arguments );
				return this;
			},

			// To know if the callbacks have already been called at least once
			fired: function() {
				return !!fired;
			}
		};

	return self;
};


jQuery.extend( {

	Deferred: function( func ) {
		var tuples = [

				// action, add listener, listener list, final state
				[ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
				[ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
				[ "notify", "progress", jQuery.Callbacks( "memory" ) ]
			],
			state = "pending",
			promise = {
				state: function() {
					return state;
				},
				always: function() {
					deferred.done( arguments ).fail( arguments );
					return this;
				},
				then: function( /* fnDone, fnFail, fnProgress */ ) {
					var fns = arguments;
					return jQuery.Deferred( function( newDefer ) {
						jQuery.each( tuples, function( i, tuple ) {
							var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];

							// deferred[ done | fail | progress ] for forwarding actions to newDefer
							deferred[ tuple[ 1 ] ]( function() {
								var returned = fn && fn.apply( this, arguments );
								if ( returned && jQuery.isFunction( returned.promise ) ) {
									returned.promise()
										.progress( newDefer.notify )
										.done( newDefer.resolve )
										.fail( newDefer.reject );
								} else {
									newDefer[ tuple[ 0 ] + "With" ](
										this === promise ? newDefer.promise() : this,
										fn ? [ returned ] : arguments
									);
								}
							} );
						} );
						fns = null;
					} ).promise();
				},

				// Get a promise for this deferred
				// If obj is provided, the promise aspect is added to the object
				promise: function( obj ) {
					return obj != null ? jQuery.extend( obj, promise ) : promise;
				}
			},
			deferred = {};

		// Keep pipe for back-compat
		promise.pipe = promise.then;

		// Add list-specific methods
		jQuery.each( tuples, function( i, tuple ) {
			var list = tuple[ 2 ],
				stateString = tuple[ 3 ];

			// promise[ done | fail | progress ] = list.add
			promise[ tuple[ 1 ] ] = list.add;

			// Handle state
			if ( stateString ) {
				list.add( function() {

					// state = [ resolved | rejected ]
					state = stateString;

				// [ reject_list | resolve_list ].disable; progress_list.lock
				}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
			}

			// deferred[ resolve | reject | notify ]
			deferred[ tuple[ 0 ] ] = function() {
				deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
				return this;
			};
			deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
		} );

		// Make the deferred a promise
		promise.promise( deferred );

		// Call given func if any
		if ( func ) {
			func.call( deferred, deferred );
		}

		// All done!
		return deferred;
	},

	// Deferred helper
	when: function( subordinate /* , ..., subordinateN */ ) {
		var i = 0,
			resolveValues = slice.call( arguments ),
			length = resolveValues.length,

			// the count of uncompleted subordinates
			remaining = length !== 1 ||
				( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,

			// the master Deferred.
			// If resolveValues consist of only a single Deferred, just use that.
			deferred = remaining === 1 ? subordinate : jQuery.Deferred(),

			// Update function for both resolve and progress values
			updateFunc = function( i, contexts, values ) {
				return function( value ) {
					contexts[ i ] = this;
					values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
					if ( values === progressValues ) {
						deferred.notifyWith( contexts, values );

					} else if ( !( --remaining ) ) {
						deferred.resolveWith( contexts, values );
					}
				};
			},

			progressValues, progressContexts, resolveContexts;

		// add listeners to Deferred subordinates; treat others as resolved
		if ( length > 1 ) {
			progressValues = new Array( length );
			progressContexts = new Array( length );
			resolveContexts = new Array( length );
			for ( ; i < length; i++ ) {
				if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
					resolveValues[ i ].promise()
						.progress( updateFunc( i, progressContexts, progressValues ) )
						.done( updateFunc( i, resolveContexts, resolveValues ) )
						.fail( deferred.reject );
				} else {
					--remaining;
				}
			}
		}

		// if we're not waiting on anything, resolve the master
		if ( !remaining ) {
			deferred.resolveWith( resolveContexts, resolveValues );
		}

		return deferred.promise();
	}
} );


// The deferred used on DOM ready
var readyList;

jQuery.fn.ready = function( fn ) {

	// Add the callback
	jQuery.ready.promise().done( fn );

	return this;
};

jQuery.extend( {

	// Is the DOM ready to be used? Set to true once it occurs.
	isReady: false,

	// A counter to track how many items to wait for before
	// the ready event fires. See #6781
	readyWait: 1,

	// Hold (or release) the ready event
	holdReady: function( hold ) {
		if ( hold ) {
			jQuery.readyWait++;
		} else {
			jQuery.ready( true );
		}
	},

	// Handle when the DOM is ready
	ready: function( wait ) {

		// Abort if there are pending holds or we're already ready
		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
			return;
		}

		// Remember that the DOM is ready
		jQuery.isReady = true;

		// If a normal DOM Ready event fired, decrement, and wait if need be
		if ( wait !== true && --jQuery.readyWait > 0 ) {
			return;
		}

		// If there are functions bound, to execute
		readyList.resolveWith( document, [ jQuery ] );

		// Trigger any bound ready events
		if ( jQuery.fn.triggerHandler ) {
			jQuery( document ).triggerHandler( "ready" );
			jQuery( document ).off( "ready" );
		}
	}
} );

/**
 * Clean-up method for dom ready events
 */
function detach() {
	if ( document.addEventListener ) {
		document.removeEventListener( "DOMContentLoaded", completed );
		window.removeEventListener( "load", completed );

	} else {
		document.detachEvent( "onreadystatechange", completed );
		window.detachEvent( "onload", completed );
	}
}

/**
 * The ready event handler and self cleanup method
 */
function completed() {

	// readyState === "complete" is good enough for us to call the dom ready in oldIE
	if ( document.addEventListener ||
		window.event.type === "load" ||
		document.readyState === "complete" ) {

		detach();
		jQuery.ready();
	}
}

jQuery.ready.promise = function( obj ) {
	if ( !readyList ) {

		readyList = jQuery.Deferred();

		// Catch cases where $(document).ready() is called
		// after the browser event has already occurred.
		// Support: IE6-10
		// Older IE sometimes signals "interactive" too soon
		if ( document.readyState === "complete" ||
			( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {

			// Handle it asynchronously to allow scripts the opportunity to delay ready
			window.setTimeout( jQuery.ready );

		// Standards-based browsers support DOMContentLoaded
		} else if ( document.addEventListener ) {

			// Use the handy event callback
			document.addEventListener( "DOMContentLoaded", completed );

			// A fallback to window.onload, that will always work
			window.addEventListener( "load", completed );

		// If IE event model is used
		} else {

			// Ensure firing before onload, maybe late but safe also for iframes
			document.attachEvent( "onreadystatechange", completed );

			// A fallback to window.onload, that will always work
			window.attachEvent( "onload", completed );

			// If IE and not a frame
			// continually check to see if the document is ready
			var top = false;

			try {
				top = window.frameElement == null && document.documentElement;
			} catch ( e ) {}

			if ( top && top.doScroll ) {
				( function doScrollCheck() {
					if ( !jQuery.isReady ) {

						try {

							// Use the trick by Diego Perini
							// http://javascript.nwbox.com/IEContentLoaded/
							top.doScroll( "left" );
						} catch ( e ) {
							return window.setTimeout( doScrollCheck, 50 );
						}

						// detach all dom ready events
						detach();

						// and execute any waiting functions
						jQuery.ready();
					}
				} )();
			}
		}
	}
	return readyList.promise( obj );
};

// Kick off the DOM ready check even if the user does not
jQuery.ready.promise();




// Support: IE<9
// Iteration over object's inherited properties before its own
var i;
for ( i in jQuery( support ) ) {
	break;
}
support.ownFirst = i === "0";

// Note: most support tests are defined in their respective modules.
// false until the test is run
support.inlineBlockNeedsLayout = false;

// Execute ASAP in case we need to set body.style.zoom
jQuery( function() {

	// Minified: var a,b,c,d
	var val, div, body, container;

	body = document.getElementsByTagName( "body" )[ 0 ];
	if ( !body || !body.style ) {

		// Return for frameset docs that don't have a body
		return;
	}

	// Setup
	div = document.createElement( "div" );
	container = document.createElement( "div" );
	container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
	body.appendChild( container ).appendChild( div );

	if ( typeof div.style.zoom !== "undefined" ) {

		// Support: IE<8
		// Check if natively block-level elements act like inline-block
		// elements when setting their display to 'inline' and giving
		// them layout
		div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";

		support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
		if ( val ) {

			// Prevent IE 6 from affecting layout for positioned elements #11048
			// Prevent IE from shrinking the body in IE 7 mode #12869
			// Support: IE<8
			body.style.zoom = 1;
		}
	}

	body.removeChild( container );
} );


( function() {
	var div = document.createElement( "div" );

	// Support: IE<9
	support.deleteExpando = true;
	try {
		delete div.test;
	} catch ( e ) {
		support.deleteExpando = false;
	}

	// Null elements to avoid leaks in IE.
	div = null;
} )();
var acceptData = function( elem ) {
	var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
		nodeType = +elem.nodeType || 1;

	// Do not set data on non-element DOM nodes because it will not be cleared (#8335).
	return nodeType !== 1 && nodeType !== 9 ?
		false :

		// Nodes accept data unless otherwise specified; rejection can be conditional
		!noData || noData !== true && elem.getAttribute( "classid" ) === noData;
};




var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
	rmultiDash = /([A-Z])/g;

function dataAttr( elem, key, data ) {

	// If nothing was found internally, try to fetch any
	// data from the HTML5 data-* attribute
	if ( data === undefined && elem.nodeType === 1 ) {

		var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();

		data = elem.getAttribute( name );

		if ( typeof data === "string" ) {
			try {
				data = data === "true" ? true :
					data === "false" ? false :
					data === "null" ? null :

					// Only convert to a number if it doesn't change the string
					+data + "" === data ? +data :
					rbrace.test( data ) ? jQuery.parseJSON( data ) :
					data;
			} catch ( e ) {}

			// Make sure we set the data so it isn't changed later
			jQuery.data( elem, key, data );

		} else {
			data = undefined;
		}
	}

	return data;
}

// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
	var name;
	for ( name in obj ) {

		// if the public data object is empty, the private is still empty
		if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) {
			continue;
		}
		if ( name !== "toJSON" ) {
			return false;
		}
	}

	return true;
}

function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
	if ( !acceptData( elem ) ) {
		return;
	}

	var ret, thisCache,
		internalKey = jQuery.expando,

		// We have to handle DOM nodes and JS objects differently because IE6-7
		// can't GC object references properly across the DOM-JS boundary
		isNode = elem.nodeType,

		// Only DOM nodes need the global jQuery cache; JS object data is
		// attached directly to the object so GC can occur automatically
		cache = isNode ? jQuery.cache : elem,

		// Only defining an ID for JS objects if its cache already exists allows
		// the code to shortcut on the same path as a DOM node with no cache
		id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;

	// Avoid doing any more work than we need to when trying to get data on an
	// object that has no data at all
	if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) &&
		data === undefined && typeof name === "string" ) {
		return;
	}

	if ( !id ) {

		// Only DOM nodes need a new unique ID for each element since their data
		// ends up in the global cache
		if ( isNode ) {
			id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
		} else {
			id = internalKey;
		}
	}

	if ( !cache[ id ] ) {

		// Avoid exposing jQuery metadata on plain JS objects when the object
		// is serialized using JSON.stringify
		cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
	}

	// An object can be passed to jQuery.data instead of a key/value pair; this gets
	// shallow copied over onto the existing cache
	if ( typeof name === "object" || typeof name === "function" ) {
		if ( pvt ) {
			cache[ id ] = jQuery.extend( cache[ id ], name );
		} else {
			cache[ id ].data = jQuery.extend( cache[ id ].data, name );
		}
	}

	thisCache = cache[ id ];

	// jQuery data() is stored in a separate object inside the object's internal data
	// cache in order to avoid key collisions between internal data and user-defined
	// data.
	if ( !pvt ) {
		if ( !thisCache.data ) {
			thisCache.data = {};
		}

		thisCache = thisCache.data;
	}

	if ( data !== undefined ) {
		thisCache[ jQuery.camelCase( name ) ] = data;
	}

	// Check for both converted-to-camel and non-converted data property names
	// If a data property was specified
	if ( typeof name === "string" ) {

		// First Try to find as-is property data
		ret = thisCache[ name ];

		// Test for null|undefined property data
		if ( ret == null ) {

			// Try to find the camelCased property
			ret = thisCache[ jQuery.camelCase( name ) ];
		}
	} else {
		ret = thisCache;
	}

	return ret;
}

function internalRemoveData( elem, name, pvt ) {
	if ( !acceptData( elem ) ) {
		return;
	}

	var thisCache, i,
		isNode = elem.nodeType,

		// See jQuery.data for more information
		cache = isNode ? jQuery.cache : elem,
		id = isNode ? elem[ jQuery.expando ] : jQuery.expando;

	// If there is already no cache entry for this object, there is no
	// purpose in continuing
	if ( !cache[ id ] ) {
		return;
	}

	if ( name ) {

		thisCache = pvt ? cache[ id ] : cache[ id ].data;

		if ( thisCache ) {

			// Support array or space separated string names for data keys
			if ( !jQuery.isArray( name ) ) {

				// try the string as a key before any manipulation
				if ( name in thisCache ) {
					name = [ name ];
				} else {

					// split the camel cased version by spaces unless a key with the spaces exists
					name = jQuery.camelCase( name );
					if ( name in thisCache ) {
						name = [ name ];
					} else {
						name = name.split( " " );
					}
				}
			} else {

				// If "name" is an array of keys...
				// When data is initially created, via ("key", "val") signature,
				// keys will be converted to camelCase.
				// Since there is no way to tell _how_ a key was added, remove
				// both plain key and camelCase key. #12786
				// This will only penalize the array argument path.
				name = name.concat( jQuery.map( name, jQuery.camelCase ) );
			}

			i = name.length;
			while ( i-- ) {
				delete thisCache[ name[ i ] ];
			}

			// If there is no data left in the cache, we want to continue
			// and let the cache object itself get destroyed
			if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) {
				return;
			}
		}
	}

	// See jQuery.data for more information
	if ( !pvt ) {
		delete cache[ id ].data;

		// Don't destroy the parent cache unless the internal data object
		// had been the only thing left in it
		if ( !isEmptyDataObject( cache[ id ] ) ) {
			return;
		}
	}

	// Destroy the cache
	if ( isNode ) {
		jQuery.cleanData( [ elem ], true );

	// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
	/* jshint eqeqeq: false */
	} else if ( support.deleteExpando || cache != cache.window ) {
		/* jshint eqeqeq: true */
		delete cache[ id ];

	// When all else fails, undefined
	} else {
		cache[ id ] = undefined;
	}
}

jQuery.extend( {
	cache: {},

	// The following elements (space-suffixed to avoid Object.prototype collisions)
	// throw uncatchable exceptions if you attempt to set expando properties
	noData: {
		"applet ": true,
		"embed ": true,

		// ...but Flash objects (which have this classid) *can* handle expandos
		"object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
	},

	hasData: function( elem ) {
		elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ];
		return !!elem && !isEmptyDataObject( elem );
	},

	data: function( elem, name, data ) {
		return internalData( elem, name, data );
	},

	removeData: function( elem, name ) {
		return internalRemoveData( elem, name );
	},

	// For internal use only.
	_data: function( elem, name, data ) {
		return internalData( elem, name, data, true );
	},

	_removeData: function( elem, name ) {
		return internalRemoveData( elem, name, true );
	}
} );

jQuery.fn.extend( {
	data: function( key, value ) {
		var i, name, data,
			elem = this[ 0 ],
			attrs = elem && elem.attributes;

		// Special expections of .data basically thwart jQuery.access,
		// so implement the relevant behavior ourselves

		// Gets all values
		if ( key === undefined ) {
			if ( this.length ) {
				data = jQuery.data( elem );

				if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
					i = attrs.length;
					while ( i-- ) {

						// Support: IE11+
						// The attrs elements can be null (#14894)
						if ( attrs[ i ] ) {
							name = attrs[ i ].name;
							if ( name.indexOf( "data-" ) === 0 ) {
								name = jQuery.camelCase( name.slice( 5 ) );
								dataAttr( elem, name, data[ name ] );
							}
						}
					}
					jQuery._data( elem, "parsedAttrs", true );
				}
			}

			return data;
		}

		// Sets multiple values
		if ( typeof key === "object" ) {
			return this.each( function() {
				jQuery.data( this, key );
			} );
		}

		return arguments.length > 1 ?

			// Sets one value
			this.each( function() {
				jQuery.data( this, key, value );
			} ) :

			// Gets one value
			// Try to fetch any internally stored data first
			elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
	},

	removeData: function( key ) {
		return this.each( function() {
			jQuery.removeData( this, key );
		} );
	}
} );


jQuery.extend( {
	queue: function( elem, type, data ) {
		var queue;

		if ( elem ) {
			type = ( type || "fx" ) + "queue";
			queue = jQuery._data( elem, type );

			// Speed up dequeue by getting out quickly if this is just a lookup
			if ( data ) {
				if ( !queue || jQuery.isArray( data ) ) {
					queue = jQuery._data( elem, type, jQuery.makeArray( data ) );
				} else {
					queue.push( data );
				}
			}
			return queue || [];
		}
	},

	dequeue: function( elem, type ) {
		type = type || "fx";

		var queue = jQuery.queue( elem, type ),
			startLength = queue.length,
			fn = queue.shift(),
			hooks = jQuery._queueHooks( elem, type ),
			next = function() {
				jQuery.dequeue( elem, type );
			};

		// If the fx queue is dequeued, always remove the progress sentinel
		if ( fn === "inprogress" ) {
			fn = queue.shift();
			startLength--;
		}

		if ( fn ) {

			// Add a progress sentinel to prevent the fx queue from being
			// automatically dequeued
			if ( type === "fx" ) {
				queue.unshift( "inprogress" );
			}

			// clear up the last queue stop function
			delete hooks.stop;
			fn.call( elem, next, hooks );
		}

		if ( !startLength && hooks ) {
			hooks.empty.fire();
		}
	},

	// not intended for public consumption - generates a queueHooks object,
	// or returns the current one
	_queueHooks: function( elem, type ) {
		var key = type + "queueHooks";
		return jQuery._data( elem, key ) || jQuery._data( elem, key, {
			empty: jQuery.Callbacks( "once memory" ).add( function() {
				jQuery._removeData( elem, type + "queue" );
				jQuery._removeData( elem, key );
			} )
		} );
	}
} );

jQuery.fn.extend( {
	queue: function( type, data ) {
		var setter = 2;

		if ( typeof type !== "string" ) {
			data = type;
			type = "fx";
			setter--;
		}

		if ( arguments.length < setter ) {
			return jQuery.queue( this[ 0 ], type );
		}

		return data === undefined ?
			this :
			this.each( function() {
				var queue = jQuery.queue( this, type, data );

				// ensure a hooks for this queue
				jQuery._queueHooks( this, type );

				if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
					jQuery.dequeue( this, type );
				}
			} );
	},
	dequeue: function( type ) {
		return this.each( function() {
			jQuery.dequeue( this, type );
		} );
	},
	clearQueue: function( type ) {
		return this.queue( type || "fx", [] );
	},

	// Get a promise resolved when queues of a certain type
	// are emptied (fx is the type by default)
	promise: function( type, obj ) {
		var tmp,
			count = 1,
			defer = jQuery.Deferred(),
			elements = this,
			i = this.length,
			resolve = function() {
				if ( !( --count ) ) {
					defer.resolveWith( elements, [ elements ] );
				}
			};

		if ( typeof type !== "string" ) {
			obj = type;
			type = undefined;
		}
		type = type || "fx";

		while ( i-- ) {
			tmp = jQuery._data( elements[ i ], type + "queueHooks" );
			if ( tmp && tmp.empty ) {
				count++;
				tmp.empty.add( resolve );
			}
		}
		resolve();
		return defer.promise( obj );
	}
} );


( function() {
	var shrinkWrapBlocksVal;

	support.shrinkWrapBlocks = function() {
		if ( shrinkWrapBlocksVal != null ) {
			return shrinkWrapBlocksVal;
		}

		// Will be changed later if needed.
		shrinkWrapBlocksVal = false;

		// Minified: var b,c,d
		var div, body, container;

		body = document.getElementsByTagName( "body" )[ 0 ];
		if ( !body || !body.style ) {

			// Test fired too early or in an unsupported environment, exit.
			return;
		}

		// Setup
		div = document.createElement( "div" );
		container = document.createElement( "div" );
		container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
		body.appendChild( container ).appendChild( div );

		// Support: IE6
		// Check if elements with layout shrink-wrap their children
		if ( typeof div.style.zoom !== "undefined" ) {

			// Reset CSS: box-sizing; display; margin; border
			div.style.cssText =

				// Support: Firefox<29, Android 2.3
				// Vendor-prefix box-sizing
				"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
				"box-sizing:content-box;display:block;margin:0;border:0;" +
				"padding:1px;width:1px;zoom:1";
			div.appendChild( document.createElement( "div" ) ).style.width = "5px";
			shrinkWrapBlocksVal = div.offsetWidth !== 3;
		}

		body.removeChild( container );

		return shrinkWrapBlocksVal;
	};

} )();
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;

var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );


var cssExpand = [ "Top", "Right", "Bottom", "Left" ];

var isHidden = function( elem, el ) {

		// isHidden might be called from jQuery#filter function;
		// in that case, element will be second argument
		elem = el || elem;
		return jQuery.css( elem, "display" ) === "none" ||
			!jQuery.contains( elem.ownerDocument, elem );
	};



function adjustCSS( elem, prop, valueParts, tween ) {
	var adjusted,
		scale = 1,
		maxIterations = 20,
		currentValue = tween ?
			function() { return tween.cur(); } :
			function() { return jQuery.css( elem, prop, "" ); },
		initial = currentValue(),
		unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),

		// Starting value computation is required for potential unit mismatches
		initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
			rcssNum.exec( jQuery.css( elem, prop ) );

	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {

		// Trust units reported by jQuery.css
		unit = unit || initialInUnit[ 3 ];

		// Make sure we update the tween properties later on
		valueParts = valueParts || [];

		// Iteratively approximate from a nonzero starting point
		initialInUnit = +initial || 1;

		do {

			// If previous iteration zeroed out, double until we get *something*.
			// Use string for doubling so we don't accidentally see scale as unchanged below
			scale = scale || ".5";

			// Adjust and apply
			initialInUnit = initialInUnit / scale;
			jQuery.style( elem, prop, initialInUnit + unit );

		// Update scale, tolerating zero or NaN from tween.cur()
		// Break the loop if scale is unchanged or perfect, or if we've just had enough.
		} while (
			scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
		);
	}

	if ( valueParts ) {
		initialInUnit = +initialInUnit || +initial || 0;

		// Apply relative offset (+=/-=) if specified
		adjusted = valueParts[ 1 ] ?
			initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
			+valueParts[ 2 ];
		if ( tween ) {
			tween.unit = unit;
			tween.start = initialInUnit;
			tween.end = adjusted;
		}
	}
	return adjusted;
}


// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
	var i = 0,
		length = elems.length,
		bulk = key == null;

	// Sets many values
	if ( jQuery.type( key ) === "object" ) {
		chainable = true;
		for ( i in key ) {
			access( elems, fn, i, key[ i ], true, emptyGet, raw );
		}

	// Sets one value
	} else if ( value !== undefined ) {
		chainable = true;

		if ( !jQuery.isFunction( value ) ) {
			raw = true;
		}

		if ( bulk ) {

			// Bulk operations run against the entire set
			if ( raw ) {
				fn.call( elems, value );
				fn = null;

			// ...except when executing function values
			} else {
				bulk = fn;
				fn = function( elem, key, value ) {
					return bulk.call( jQuery( elem ), value );
				};
			}
		}

		if ( fn ) {
			for ( ; i < length; i++ ) {
				fn(
					elems[ i ],
					key,
					raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) )
				);
			}
		}
	}

	return chainable ?
		elems :

		// Gets
		bulk ?
			fn.call( elems ) :
			length ? fn( elems[ 0 ], key ) : emptyGet;
};
var rcheckableType = ( /^(?:checkbox|radio)$/i );

var rtagName = ( /<([\w:-]+)/ );

var rscriptType = ( /^$|\/(?:java|ecma)script/i );

var rleadingWhitespace = ( /^\s+/ );

var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
		"details|dialog|figcaption|figure|footer|header|hgroup|main|" +
		"mark|meter|nav|output|picture|progress|section|summary|template|time|video";



function createSafeFragment( document ) {
	var list = nodeNames.split( "|" ),
		safeFrag = document.createDocumentFragment();

	if ( safeFrag.createElement ) {
		while ( list.length ) {
			safeFrag.createElement(
				list.pop()
			);
		}
	}
	return safeFrag;
}


( function() {
	var div = document.createElement( "div" ),
		fragment = document.createDocumentFragment(),
		input = document.createElement( "input" );

	// Setup
	div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";

	// IE strips leading whitespace when .innerHTML is used
	support.leadingWhitespace = div.firstChild.nodeType === 3;

	// Make sure that tbody elements aren't automatically inserted
	// IE will insert them into empty tables
	support.tbody = !div.getElementsByTagName( "tbody" ).length;

	// Make sure that link elements get serialized correctly by innerHTML
	// This requires a wrapper element in IE
	support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;

	// Makes sure cloning an html5 element does not cause problems
	// Where outerHTML is undefined, this still works
	support.html5Clone =
		document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";

	// Check if a disconnected checkbox will retain its checked
	// value of true after appended to the DOM (IE6/7)
	input.type = "checkbox";
	input.checked = true;
	fragment.appendChild( input );
	support.appendChecked = input.checked;

	// Make sure textarea (and checkbox) defaultValue is properly cloned
	// Support: IE6-IE11+
	div.innerHTML = "<textarea>x</textarea>";
	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;

	// #11217 - WebKit loses check when the name is after the checked attribute
	fragment.appendChild( div );

	// Support: Windows Web Apps (WWA)
	// `name` and `type` must use .setAttribute for WWA (#14901)
	input = document.createElement( "input" );
	input.setAttribute( "type", "radio" );
	input.setAttribute( "checked", "checked" );
	input.setAttribute( "name", "t" );

	div.appendChild( input );

	// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
	// old WebKit doesn't clone checked state correctly in fragments
	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;

	// Support: IE<9
	// Cloned elements keep attachEvent handlers, we use addEventListener on IE9+
	support.noCloneEvent = !!div.addEventListener;

	// Support: IE<9
	// Since attributes and properties are the same in IE,
	// cleanData must set properties to undefined rather than use removeAttribute
	div[ jQuery.expando ] = 1;
	support.attributes = !div.getAttribute( jQuery.expando );
} )();


// We have to close these tags to support XHTML (#13200)
var wrapMap = {
	option: [ 1, "<select multiple='multiple'>", "</select>" ],
	legend: [ 1, "<fieldset>", "</fieldset>" ],
	area: [ 1, "<map>", "</map>" ],

	// Support: IE8
	param: [ 1, "<object>", "</object>" ],
	thead: [ 1, "<table>", "</table>" ],
	tr: [ 2, "<table><tbody>", "</tbody></table>" ],
	col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
	td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],

	// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
	// unless wrapped in a div with non-breaking characters in front of it.
	_default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
};

// Support: IE8-IE9
wrapMap.optgroup = wrapMap.option;

wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;


function getAll( context, tag ) {
	var elems, elem,
		i = 0,
		found = typeof context.getElementsByTagName !== "undefined" ?
			context.getElementsByTagName( tag || "*" ) :
			typeof context.querySelectorAll !== "undefined" ?
				context.querySelectorAll( tag || "*" ) :
				undefined;

	if ( !found ) {
		for ( found = [], elems = context.childNodes || context;
			( elem = elems[ i ] ) != null;
			i++
		) {
			if ( !tag || jQuery.nodeName( elem, tag ) ) {
				found.push( elem );
			} else {
				jQuery.merge( found, getAll( elem, tag ) );
			}
		}
	}

	return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
		jQuery.merge( [ context ], found ) :
		found;
}


// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
	var elem,
		i = 0;
	for ( ; ( elem = elems[ i ] ) != null; i++ ) {
		jQuery._data(
			elem,
			"globalEval",
			!refElements || jQuery._data( refElements[ i ], "globalEval" )
		);
	}
}


var rhtml = /<|&#?\w+;/,
	rtbody = /<tbody/i;

function fixDefaultChecked( elem ) {
	if ( rcheckableType.test( elem.type ) ) {
		elem.defaultChecked = elem.checked;
	}
}

function buildFragment( elems, context, scripts, selection, ignored ) {
	var j, elem, contains,
		tmp, tag, tbody, wrap,
		l = elems.length,

		// Ensure a safe fragment
		safe = createSafeFragment( context ),

		nodes = [],
		i = 0;

	for ( ; i < l; i++ ) {
		elem = elems[ i ];

		if ( elem || elem === 0 ) {

			// Add nodes directly
			if ( jQuery.type( elem ) === "object" ) {
				jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );

			// Convert non-html into a text node
			} else if ( !rhtml.test( elem ) ) {
				nodes.push( context.createTextNode( elem ) );

			// Convert html into DOM nodes
			} else {
				tmp = tmp || safe.appendChild( context.createElement( "div" ) );

				// Deserialize a standard representation
				tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
				wrap = wrapMap[ tag ] || wrapMap._default;

				tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];

				// Descend through wrappers to the right content
				j = wrap[ 0 ];
				while ( j-- ) {
					tmp = tmp.lastChild;
				}

				// Manually add leading whitespace removed by IE
				if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
					nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
				}

				// Remove IE's autoinserted <tbody> from table fragments
				if ( !support.tbody ) {

					// String was a <table>, *may* have spurious <tbody>
					elem = tag === "table" && !rtbody.test( elem ) ?
						tmp.firstChild :

						// String was a bare <thead> or <tfoot>
						wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
							tmp :
							0;

					j = elem && elem.childNodes.length;
					while ( j-- ) {
						if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
							!tbody.childNodes.length ) {

							elem.removeChild( tbody );
						}
					}
				}

				jQuery.merge( nodes, tmp.childNodes );

				// Fix #12392 for WebKit and IE > 9
				tmp.textContent = "";

				// Fix #12392 for oldIE
				while ( tmp.firstChild ) {
					tmp.removeChild( tmp.firstChild );
				}

				// Remember the top-level container for proper cleanup
				tmp = safe.lastChild;
			}
		}
	}

	// Fix #11356: Clear elements from fragment
	if ( tmp ) {
		safe.removeChild( tmp );
	}

	// Reset defaultChecked for any radios and checkboxes
	// about to be appended to the DOM in IE 6/7 (#8060)
	if ( !support.appendChecked ) {
		jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
	}

	i = 0;
	while ( ( elem = nodes[ i++ ] ) ) {

		// Skip elements already in the context collection (trac-4087)
		if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
			if ( ignored ) {
				ignored.push( elem );
			}

			continue;
		}

		contains = jQuery.contains( elem.ownerDocument, elem );

		// Append to fragment
		tmp = getAll( safe.appendChild( elem ), "script" );

		// Preserve script evaluation history
		if ( contains ) {
			setGlobalEval( tmp );
		}

		// Capture executables
		if ( scripts ) {
			j = 0;
			while ( ( elem = tmp[ j++ ] ) ) {
				if ( rscriptType.test( elem.type || "" ) ) {
					scripts.push( elem );
				}
			}
		}
	}

	tmp = null;

	return safe;
}


( function() {
	var i, eventName,
		div = document.createElement( "div" );

	// Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)
	for ( i in { submit: true, change: true, focusin: true } ) {
		eventName = "on" + i;

		if ( !( support[ i ] = eventName in window ) ) {

			// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
			div.setAttribute( eventName, "t" );
			support[ i ] = div.attributes[ eventName ].expando === false;
		}
	}

	// Null elements to avoid leaks in IE.
	div = null;
} )();


var rformElems = /^(?:input|select|textarea)$/i,
	rkeyEvent = /^key/,
	rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
	rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
	rtypenamespace = /^([^.]*)(?:\.(.+)|)/;

function returnTrue() {
	return true;
}

function returnFalse() {
	return false;
}

// Support: IE9
// See #13393 for more info
function safeActiveElement() {
	try {
		return document.activeElement;
	} catch ( err ) { }
}

function on( elem, types, selector, data, fn, one ) {
	var origFn, type;

	// Types can be a map of types/handlers
	if ( typeof types === "object" ) {

		// ( types-Object, selector, data )
		if ( typeof selector !== "string" ) {

			// ( types-Object, data )
			data = data || selector;
			selector = undefined;
		}
		for ( type in types ) {
			on( elem, type, selector, data, types[ type ], one );
		}
		return elem;
	}

	if ( data == null && fn == null ) {

		// ( types, fn )
		fn = selector;
		data = selector = undefined;
	} else if ( fn == null ) {
		if ( typeof selector === "string" ) {

			// ( types, selector, fn )
			fn = data;
			data = undefined;
		} else {

			// ( types, data, fn )
			fn = data;
			data = selector;
			selector = undefined;
		}
	}
	if ( fn === false ) {
		fn = returnFalse;
	} else if ( !fn ) {
		return elem;
	}

	if ( one === 1 ) {
		origFn = fn;
		fn = function( event ) {

			// Can use an empty set, since event contains the info
			jQuery().off( event );
			return origFn.apply( this, arguments );
		};

		// Use same guid so caller can remove using origFn
		fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
	}
	return elem.each( function() {
		jQuery.event.add( this, types, fn, data, selector );
	} );
}

/*
 * Helper functions for managing events -- not part of the public interface.
 * Props to Dean Edwards' addEvent library for many of the ideas.
 */
jQuery.event = {

	global: {},

	add: function( elem, types, handler, data, selector ) {
		var tmp, events, t, handleObjIn,
			special, eventHandle, handleObj,
			handlers, type, namespaces, origType,
			elemData = jQuery._data( elem );

		// Don't attach events to noData or text/comment nodes (but allow plain objects)
		if ( !elemData ) {
			return;
		}

		// Caller can pass in an object of custom data in lieu of the handler
		if ( handler.handler ) {
			handleObjIn = handler;
			handler = handleObjIn.handler;
			selector = handleObjIn.selector;
		}

		// Make sure that the handler has a unique ID, used to find/remove it later
		if ( !handler.guid ) {
			handler.guid = jQuery.guid++;
		}

		// Init the element's event structure and main handler, if this is the first
		if ( !( events = elemData.events ) ) {
			events = elemData.events = {};
		}
		if ( !( eventHandle = elemData.handle ) ) {
			eventHandle = elemData.handle = function( e ) {

				// Discard the second event of a jQuery.event.trigger() and
				// when an event is called after a page has unloaded
				return typeof jQuery !== "undefined" &&
					( !e || jQuery.event.triggered !== e.type ) ?
					jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
					undefined;
			};

			// Add elem as a property of the handle fn to prevent a memory leak
			// with IE non-native events
			eventHandle.elem = elem;
		}

		// Handle multiple events separated by a space
		types = ( types || "" ).match( rnotwhite ) || [ "" ];
		t = types.length;
		while ( t-- ) {
			tmp = rtypenamespace.exec( types[ t ] ) || [];
			type = origType = tmp[ 1 ];
			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();

			// There *must* be a type, no attaching namespace-only handlers
			if ( !type ) {
				continue;
			}

			// If event changes its type, use the special event handlers for the changed type
			special = jQuery.event.special[ type ] || {};

			// If selector defined, determine special event api type, otherwise given type
			type = ( selector ? special.delegateType : special.bindType ) || type;

			// Update special based on newly reset type
			special = jQuery.event.special[ type ] || {};

			// handleObj is passed to all event handlers
			handleObj = jQuery.extend( {
				type: type,
				origType: origType,
				data: data,
				handler: handler,
				guid: handler.guid,
				selector: selector,
				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
				namespace: namespaces.join( "." )
			}, handleObjIn );

			// Init the event handler queue if we're the first
			if ( !( handlers = events[ type ] ) ) {
				handlers = events[ type ] = [];
				handlers.delegateCount = 0;

				// Only use addEventListener/attachEvent if the special events handler returns false
				if ( !special.setup ||
					special.setup.call( elem, data, namespaces, eventHandle ) === false ) {

					// Bind the global event handler to the element
					if ( elem.addEventListener ) {
						elem.addEventListener( type, eventHandle, false );

					} else if ( elem.attachEvent ) {
						elem.attachEvent( "on" + type, eventHandle );
					}
				}
			}

			if ( special.add ) {
				special.add.call( elem, handleObj );

				if ( !handleObj.handler.guid ) {
					handleObj.handler.guid = handler.guid;
				}
			}

			// Add to the element's handler list, delegates in front
			if ( selector ) {
				handlers.splice( handlers.delegateCount++, 0, handleObj );
			} else {
				handlers.push( handleObj );
			}

			// Keep track of which events have ever been used, for event optimization
			jQuery.event.global[ type ] = true;
		}

		// Nullify elem to prevent memory leaks in IE
		elem = null;
	},

	// Detach an event or set of events from an element
	remove: function( elem, types, handler, selector, mappedTypes ) {
		var j, handleObj, tmp,
			origCount, t, events,
			special, handlers, type,
			namespaces, origType,
			elemData = jQuery.hasData( elem ) && jQuery._data( elem );

		if ( !elemData || !( events = elemData.events ) ) {
			return;
		}

		// Once for each type.namespace in types; type may be omitted
		types = ( types || "" ).match( rnotwhite ) || [ "" ];
		t = types.length;
		while ( t-- ) {
			tmp = rtypenamespace.exec( types[ t ] ) || [];
			type = origType = tmp[ 1 ];
			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();

			// Unbind all events (on this namespace, if provided) for the element
			if ( !type ) {
				for ( type in events ) {
					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
				}
				continue;
			}

			special = jQuery.event.special[ type ] || {};
			type = ( selector ? special.delegateType : special.bindType ) || type;
			handlers = events[ type ] || [];
			tmp = tmp[ 2 ] &&
				new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );

			// Remove matching events
			origCount = j = handlers.length;
			while ( j-- ) {
				handleObj = handlers[ j ];

				if ( ( mappedTypes || origType === handleObj.origType ) &&
					( !handler || handler.guid === handleObj.guid ) &&
					( !tmp || tmp.test( handleObj.namespace ) ) &&
					( !selector || selector === handleObj.selector ||
						selector === "**" && handleObj.selector ) ) {
					handlers.splice( j, 1 );

					if ( handleObj.selector ) {
						handlers.delegateCount--;
					}
					if ( special.remove ) {
						special.remove.call( elem, handleObj );
					}
				}
			}

			// Remove generic event handler if we removed something and no more handlers exist
			// (avoids potential for endless recursion during removal of special event handlers)
			if ( origCount && !handlers.length ) {
				if ( !special.teardown ||
					special.teardown.call( elem, namespaces, elemData.handle ) === false ) {

					jQuery.removeEvent( elem, type, elemData.handle );
				}

				delete events[ type ];
			}
		}

		// Remove the expando if it's no longer used
		if ( jQuery.isEmptyObject( events ) ) {
			delete elemData.handle;

			// removeData also checks for emptiness and clears the expando if empty
			// so use it instead of delete
			jQuery._removeData( elem, "events" );
		}
	},

	trigger: function( event, data, elem, onlyHandlers ) {
		var handle, ontype, cur,
			bubbleType, special, tmp, i,
			eventPath = [ elem || document ],
			type = hasOwn.call( event, "type" ) ? event.type : event,
			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];

		cur = tmp = elem = elem || document;

		// Don't do events on text and comment nodes
		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
			return;
		}

		// focus/blur morphs to focusin/out; ensure we're not firing them right now
		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
			return;
		}

		if ( type.indexOf( "." ) > -1 ) {

			// Namespaced trigger; create a regexp to match event type in handle()
			namespaces = type.split( "." );
			type = namespaces.shift();
			namespaces.sort();
		}
		ontype = type.indexOf( ":" ) < 0 && "on" + type;

		// Caller can pass in a jQuery.Event object, Object, or just an event type string
		event = event[ jQuery.expando ] ?
			event :
			new jQuery.Event( type, typeof event === "object" && event );

		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
		event.isTrigger = onlyHandlers ? 2 : 3;
		event.namespace = namespaces.join( "." );
		event.rnamespace = event.namespace ?
			new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
			null;

		// Clean up the event in case it is being reused
		event.result = undefined;
		if ( !event.target ) {
			event.target = elem;
		}

		// Clone any incoming data and prepend the event, creating the handler arg list
		data = data == null ?
			[ event ] :
			jQuery.makeArray( data, [ event ] );

		// Allow special events to draw outside the lines
		special = jQuery.event.special[ type ] || {};
		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
			return;
		}

		// Determine event propagation path in advance, per W3C events spec (#9951)
		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
		if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {

			bubbleType = special.delegateType || type;
			if ( !rfocusMorph.test( bubbleType + type ) ) {
				cur = cur.parentNode;
			}
			for ( ; cur; cur = cur.parentNode ) {
				eventPath.push( cur );
				tmp = cur;
			}

			// Only add window if we got to document (e.g., not plain obj or detached DOM)
			if ( tmp === ( elem.ownerDocument || document ) ) {
				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
			}
		}

		// Fire handlers on the event path
		i = 0;
		while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {

			event.type = i > 1 ?
				bubbleType :
				special.bindType || type;

			// jQuery handler
			handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
				jQuery._data( cur, "handle" );

			if ( handle ) {
				handle.apply( cur, data );
			}

			// Native handler
			handle = ontype && cur[ ontype ];
			if ( handle && handle.apply && acceptData( cur ) ) {
				event.result = handle.apply( cur, data );
				if ( event.result === false ) {
					event.preventDefault();
				}
			}
		}
		event.type = type;

		// If nobody prevented the default action, do it now
		if ( !onlyHandlers && !event.isDefaultPrevented() ) {

			if (
				( !special._default ||
				 special._default.apply( eventPath.pop(), data ) === false
				) && acceptData( elem )
			) {

				// Call a native DOM method on the target with the same name name as the event.
				// Can't use an .isFunction() check here because IE6/7 fails that test.
				// Don't do default actions on window, that's where global variables be (#6170)
				if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {

					// Don't re-trigger an onFOO event when we call its FOO() method
					tmp = elem[ ontype ];

					if ( tmp ) {
						elem[ ontype ] = null;
					}

					// Prevent re-triggering of the same event, since we already bubbled it above
					jQuery.event.triggered = type;
					try {
						elem[ type ]();
					} catch ( e ) {

						// IE<9 dies on focus/blur to hidden element (#1486,#12518)
						// only reproducible on winXP IE8 native, not IE9 in IE8 mode
					}
					jQuery.event.triggered = undefined;

					if ( tmp ) {
						elem[ ontype ] = tmp;
					}
				}
			}
		}

		return event.result;
	},

	dispatch: function( event ) {

		// Make a writable jQuery.Event from the native event object
		event = jQuery.event.fix( event );

		var i, j, ret, matched, handleObj,
			handlerQueue = [],
			args = slice.call( arguments ),
			handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
			special = jQuery.event.special[ event.type ] || {};

		// Use the fix-ed jQuery.Event rather than the (read-only) native event
		args[ 0 ] = event;
		event.delegateTarget = this;

		// Call the preDispatch hook for the mapped type, and let it bail if desired
		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
			return;
		}

		// Determine handlers
		handlerQueue = jQuery.event.handlers.call( this, event, handlers );

		// Run delegates first; they may want to stop propagation beneath us
		i = 0;
		while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
			event.currentTarget = matched.elem;

			j = 0;
			while ( ( handleObj = matched.handlers[ j++ ] ) &&
				!event.isImmediatePropagationStopped() ) {

				// Triggered event must either 1) have no namespace, or 2) have namespace(s)
				// a subset or equal to those in the bound event (both can have no namespace).
				if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {

					event.handleObj = handleObj;
					event.data = handleObj.data;

					ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
						handleObj.handler ).apply( matched.elem, args );

					if ( ret !== undefined ) {
						if ( ( event.result = ret ) === false ) {
							event.preventDefault();
							event.stopPropagation();
						}
					}
				}
			}
		}

		// Call the postDispatch hook for the mapped type
		if ( special.postDispatch ) {
			special.postDispatch.call( this, event );
		}

		return event.result;
	},

	handlers: function( event, handlers ) {
		var i, matches, sel, handleObj,
			handlerQueue = [],
			delegateCount = handlers.delegateCount,
			cur = event.target;

		// Support (at least): Chrome, IE9
		// Find delegate handlers
		// Black-hole SVG <use> instance trees (#13180)
		//
		// Support: Firefox<=42+
		// Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
		if ( delegateCount && cur.nodeType &&
			( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {

			/* jshint eqeqeq: false */
			for ( ; cur != this; cur = cur.parentNode || this ) {
				/* jshint eqeqeq: true */

				// Don't check non-elements (#13208)
				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
				if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
					matches = [];
					for ( i = 0; i < delegateCount; i++ ) {
						handleObj = handlers[ i ];

						// Don't conflict with Object.prototype properties (#13203)
						sel = handleObj.selector + " ";

						if ( matches[ sel ] === undefined ) {
							matches[ sel ] = handleObj.needsContext ?
								jQuery( sel, this ).index( cur ) > -1 :
								jQuery.find( sel, this, null, [ cur ] ).length;
						}
						if ( matches[ sel ] ) {
							matches.push( handleObj );
						}
					}
					if ( matches.length ) {
						handlerQueue.push( { elem: cur, handlers: matches } );
					}
				}
			}
		}

		// Add the remaining (directly-bound) handlers
		if ( delegateCount < handlers.length ) {
			handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
		}

		return handlerQueue;
	},

	fix: function( event ) {
		if ( event[ jQuery.expando ] ) {
			return event;
		}

		// Create a writable copy of the event object and normalize some properties
		var i, prop, copy,
			type = event.type,
			originalEvent = event,
			fixHook = this.fixHooks[ type ];

		if ( !fixHook ) {
			this.fixHooks[ type ] = fixHook =
				rmouseEvent.test( type ) ? this.mouseHooks :
				rkeyEvent.test( type ) ? this.keyHooks :
				{};
		}
		copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;

		event = new jQuery.Event( originalEvent );

		i = copy.length;
		while ( i-- ) {
			prop = copy[ i ];
			event[ prop ] = originalEvent[ prop ];
		}

		// Support: IE<9
		// Fix target property (#1925)
		if ( !event.target ) {
			event.target = originalEvent.srcElement || document;
		}

		// Support: Safari 6-8+
		// Target should not be a text node (#504, #13143)
		if ( event.target.nodeType === 3 ) {
			event.target = event.target.parentNode;
		}

		// Support: IE<9
		// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
		event.metaKey = !!event.metaKey;

		return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
	},

	// Includes some event props shared by KeyEvent and MouseEvent
	props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
		"metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),

	fixHooks: {},

	keyHooks: {
		props: "char charCode key keyCode".split( " " ),
		filter: function( event, original ) {

			// Add which for key events
			if ( event.which == null ) {
				event.which = original.charCode != null ? original.charCode : original.keyCode;
			}

			return event;
		}
	},

	mouseHooks: {
		props: ( "button buttons clientX clientY fromElement offsetX offsetY " +
			"pageX pageY screenX screenY toElement" ).split( " " ),
		filter: function( event, original ) {
			var body, eventDoc, doc,
				button = original.button,
				fromElement = original.fromElement;

			// Calculate pageX/Y if missing and clientX/Y available
			if ( event.pageX == null && original.clientX != null ) {
				eventDoc = event.target.ownerDocument || document;
				doc = eventDoc.documentElement;
				body = eventDoc.body;

				event.pageX = original.clientX +
					( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
					( doc && doc.clientLeft || body && body.clientLeft || 0 );
				event.pageY = original.clientY +
					( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) -
					( doc && doc.clientTop  || body && body.clientTop  || 0 );
			}

			// Add relatedTarget, if necessary
			if ( !event.relatedTarget && fromElement ) {
				event.relatedTarget = fromElement === event.target ?
					original.toElement :
					fromElement;
			}

			// Add which for click: 1 === left; 2 === middle; 3 === right
			// Note: button is not normalized, so don't use it
			if ( !event.which && button !== undefined ) {
				event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
			}

			return event;
		}
	},

	special: {
		load: {

			// Prevent triggered image.load events from bubbling to window.load
			noBubble: true
		},
		focus: {

			// Fire native event if possible so blur/focus sequence is correct
			trigger: function() {
				if ( this !== safeActiveElement() && this.focus ) {
					try {
						this.focus();
						return false;
					} catch ( e ) {

						// Support: IE<9
						// If we error on focus to hidden element (#1486, #12518),
						// let .trigger() run the handlers
					}
				}
			},
			delegateType: "focusin"
		},
		blur: {
			trigger: function() {
				if ( this === safeActiveElement() && this.blur ) {
					this.blur();
					return false;
				}
			},
			delegateType: "focusout"
		},
		click: {

			// For checkbox, fire native event so checked state will be right
			trigger: function() {
				if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
					this.click();
					return false;
				}
			},

			// For cross-browser consistency, don't fire native .click() on links
			_default: function( event ) {
				return jQuery.nodeName( event.target, "a" );
			}
		},

		beforeunload: {
			postDispatch: function( event ) {

				// Support: Firefox 20+
				// Firefox doesn't alert if the returnValue field is not set.
				if ( event.result !== undefined && event.originalEvent ) {
					event.originalEvent.returnValue = event.result;
				}
			}
		}
	},

	// Piggyback on a donor event to simulate a different one
	simulate: function( type, elem, event ) {
		var e = jQuery.extend(
			new jQuery.Event(),
			event,
			{
				type: type,
				isSimulated: true

				// Previously, `originalEvent: {}` was set here, so stopPropagation call
				// would not be triggered on donor event, since in our own
				// jQuery.event.stopPropagation function we had a check for existence of
				// originalEvent.stopPropagation method, so, consequently it would be a noop.
				//
				// Guard for simulated events was moved to jQuery.event.stopPropagation function
				// since `originalEvent` should point to the original event for the
				// constancy with other events and for more focused logic
			}
		);

		jQuery.event.trigger( e, null, elem );

		if ( e.isDefaultPrevented() ) {
			event.preventDefault();
		}
	}
};

jQuery.removeEvent = document.removeEventListener ?
	function( elem, type, handle ) {

		// This "if" is needed for plain objects
		if ( elem.removeEventListener ) {
			elem.removeEventListener( type, handle );
		}
	} :
	function( elem, type, handle ) {
		var name = "on" + type;

		if ( elem.detachEvent ) {

			// #8545, #7054, preventing memory leaks for custom events in IE6-8
			// detachEvent needed property on element, by name of that event,
			// to properly expose it to GC
			if ( typeof elem[ name ] === "undefined" ) {
				elem[ name ] = null;
			}

			elem.detachEvent( name, handle );
		}
	};

jQuery.Event = function( src, props ) {

	// Allow instantiation without the 'new' keyword
	if ( !( this instanceof jQuery.Event ) ) {
		return new jQuery.Event( src, props );
	}

	// Event object
	if ( src && src.type ) {
		this.originalEvent = src;
		this.type = src.type;

		// Events bubbling up the document may have been marked as prevented
		// by a handler lower down the tree; reflect the correct value.
		this.isDefaultPrevented = src.defaultPrevented ||
				src.defaultPrevented === undefined &&

				// Support: IE < 9, Android < 4.0
				src.returnValue === false ?
			returnTrue :
			returnFalse;

	// Event type
	} else {
		this.type = src;
	}

	// Put explicitly provided properties onto the event object
	if ( props ) {
		jQuery.extend( this, props );
	}

	// Create a timestamp if incoming event doesn't have one
	this.timeStamp = src && src.timeStamp || jQuery.now();

	// Mark it as fixed
	this[ jQuery.expando ] = true;
};

// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
	constructor: jQuery.Event,
	isDefaultPrevented: returnFalse,
	isPropagationStopped: returnFalse,
	isImmediatePropagationStopped: returnFalse,

	preventDefault: function() {
		var e = this.originalEvent;

		this.isDefaultPrevented = returnTrue;
		if ( !e ) {
			return;
		}

		// If preventDefault exists, run it on the original event
		if ( e.preventDefault ) {
			e.preventDefault();

		// Support: IE
		// Otherwise set the returnValue property of the original event to false
		} else {
			e.returnValue = false;
		}
	},
	stopPropagation: function() {
		var e = this.originalEvent;

		this.isPropagationStopped = returnTrue;

		if ( !e || this.isSimulated ) {
			return;
		}

		// If stopPropagation exists, run it on the original event
		if ( e.stopPropagation ) {
			e.stopPropagation();
		}

		// Support: IE
		// Set the cancelBubble property of the original event to true
		e.cancelBubble = true;
	},
	stopImmediatePropagation: function() {
		var e = this.originalEvent;

		this.isImmediatePropagationStopped = returnTrue;

		if ( e && e.stopImmediatePropagation ) {
			e.stopImmediatePropagation();
		}

		this.stopPropagation();
	}
};

// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://code.google.com/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each( {
	mouseenter: "mouseover",
	mouseleave: "mouseout",
	pointerenter: "pointerover",
	pointerleave: "pointerout"
}, function( orig, fix ) {
	jQuery.event.special[ orig ] = {
		delegateType: fix,
		bindType: fix,

		handle: function( event ) {
			var ret,
				target = this,
				related = event.relatedTarget,
				handleObj = event.handleObj;

			// For mouseenter/leave call the handler if related is outside the target.
			// NB: No relatedTarget if the mouse left/entered the browser window
			if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
				event.type = handleObj.origType;
				ret = handleObj.handler.apply( this, arguments );
				event.type = fix;
			}
			return ret;
		}
	};
} );

// IE submit delegation
if ( !support.submit ) {

	jQuery.event.special.submit = {
		setup: function() {

			// Only need this for delegated form submit events
			if ( jQuery.nodeName( this, "form" ) ) {
				return false;
			}

			// Lazy-add a submit handler when a descendant form may potentially be submitted
			jQuery.event.add( this, "click._submit keypress._submit", function( e ) {

				// Node name check avoids a VML-related crash in IE (#9807)
				var elem = e.target,
					form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ?

						// Support: IE <=8
						// We use jQuery.prop instead of elem.form
						// to allow fixing the IE8 delegated submit issue (gh-2332)
						// by 3rd party polyfills/workarounds.
						jQuery.prop( elem, "form" ) :
						undefined;

				if ( form && !jQuery._data( form, "submit" ) ) {
					jQuery.event.add( form, "submit._submit", function( event ) {
						event._submitBubble = true;
					} );
					jQuery._data( form, "submit", true );
				}
			} );

			// return undefined since we don't need an event listener
		},

		postDispatch: function( event ) {

			// If form was submitted by the user, bubble the event up the tree
			if ( event._submitBubble ) {
				delete event._submitBubble;
				if ( this.parentNode && !event.isTrigger ) {
					jQuery.event.simulate( "submit", this.parentNode, event );
				}
			}
		},

		teardown: function() {

			// Only need this for delegated form submit events
			if ( jQuery.nodeName( this, "form" ) ) {
				return false;
			}

			// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
			jQuery.event.remove( this, "._submit" );
		}
	};
}

// IE change delegation and checkbox/radio fix
if ( !support.change ) {

	jQuery.event.special.change = {

		setup: function() {

			if ( rformElems.test( this.nodeName ) ) {

				// IE doesn't fire change on a check/radio until blur; trigger it on click
				// after a propertychange. Eat the blur-change in special.change.handle.
				// This still fires onchange a second time for check/radio after blur.
				if ( this.type === "checkbox" || this.type === "radio" ) {
					jQuery.event.add( this, "propertychange._change", function( event ) {
						if ( event.originalEvent.propertyName === "checked" ) {
							this._justChanged = true;
						}
					} );
					jQuery.event.add( this, "click._change", function( event ) {
						if ( this._justChanged && !event.isTrigger ) {
							this._justChanged = false;
						}

						// Allow triggered, simulated change events (#11500)
						jQuery.event.simulate( "change", this, event );
					} );
				}
				return false;
			}

			// Delegated event; lazy-add a change handler on descendant inputs
			jQuery.event.add( this, "beforeactivate._change", function( e ) {
				var elem = e.target;

				if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) {
					jQuery.event.add( elem, "change._change", function( event ) {
						if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
							jQuery.event.simulate( "change", this.parentNode, event );
						}
					} );
					jQuery._data( elem, "change", true );
				}
			} );
		},

		handle: function( event ) {
			var elem = event.target;

			// Swallow native change events from checkbox/radio, we already triggered them above
			if ( this !== elem || event.isSimulated || event.isTrigger ||
				( elem.type !== "radio" && elem.type !== "checkbox" ) ) {

				return event.handleObj.handler.apply( this, arguments );
			}
		},

		teardown: function() {
			jQuery.event.remove( this, "._change" );

			return !rformElems.test( this.nodeName );
		}
	};
}

// Support: Firefox
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome, Safari
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
	jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {

		// Attach a single capturing handler on the document while someone wants focusin/focusout
		var handler = function( event ) {
			jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
		};

		jQuery.event.special[ fix ] = {
			setup: function() {
				var doc = this.ownerDocument || this,
					attaches = jQuery._data( doc, fix );

				if ( !attaches ) {
					doc.addEventListener( orig, handler, true );
				}
				jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
			},
			teardown: function() {
				var doc = this.ownerDocument || this,
					attaches = jQuery._data( doc, fix ) - 1;

				if ( !attaches ) {
					doc.removeEventListener( orig, handler, true );
					jQuery._removeData( doc, fix );
				} else {
					jQuery._data( doc, fix, attaches );
				}
			}
		};
	} );
}

jQuery.fn.extend( {

	on: function( types, selector, data, fn ) {
		return on( this, types, selector, data, fn );
	},
	one: function( types, selector, data, fn ) {
		return on( this, types, selector, data, fn, 1 );
	},
	off: function( types, selector, fn ) {
		var handleObj, type;
		if ( types && types.preventDefault && types.handleObj ) {

			// ( event )  dispatched jQuery.Event
			handleObj = types.handleObj;
			jQuery( types.delegateTarget ).off(
				handleObj.namespace ?
					handleObj.origType + "." + handleObj.namespace :
					handleObj.origType,
				handleObj.selector,
				handleObj.handler
			);
			return this;
		}
		if ( typeof types === "object" ) {

			// ( types-object [, selector] )
			for ( type in types ) {
				this.off( type, selector, types[ type ] );
			}
			return this;
		}
		if ( selector === false || typeof selector === "function" ) {

			// ( types [, fn] )
			fn = selector;
			selector = undefined;
		}
		if ( fn === false ) {
			fn = returnFalse;
		}
		return this.each( function() {
			jQuery.event.remove( this, types, fn, selector );
		} );
	},

	trigger: function( type, data ) {
		return this.each( function() {
			jQuery.event.trigger( type, data, this );
		} );
	},
	triggerHandler: function( type, data ) {
		var elem = this[ 0 ];
		if ( elem ) {
			return jQuery.event.trigger( type, data, elem, true );
		}
	}
} );


var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
	rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,

	// Support: IE 10-11, Edge 10240+
	// In IE/Edge using regex groups here causes severe slowdowns.
	// See https://connect.microsoft.com/IE/feedback/details/1736512/
	rnoInnerhtml = /<script|<style|<link/i,

	// checked="checked" or checked
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
	rscriptTypeMasked = /^true\/(.*)/,
	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
	safeFragment = createSafeFragment( document ),
	fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) );

// Support: IE<8
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
	return jQuery.nodeName( elem, "table" ) &&
		jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?

		elem.getElementsByTagName( "tbody" )[ 0 ] ||
			elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) :
		elem;
}

// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
	elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type;
	return elem;
}
function restoreScript( elem ) {
	var match = rscriptTypeMasked.exec( elem.type );
	if ( match ) {
		elem.type = match[ 1 ];
	} else {
		elem.removeAttribute( "type" );
	}
	return elem;
}

function cloneCopyEvent( src, dest ) {
	if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
		return;
	}

	var type, i, l,
		oldData = jQuery._data( src ),
		curData = jQuery._data( dest, oldData ),
		events = oldData.events;

	if ( events ) {
		delete curData.handle;
		curData.events = {};

		for ( type in events ) {
			for ( i = 0, l = events[ type ].length; i < l; i++ ) {
				jQuery.event.add( dest, type, events[ type ][ i ] );
			}
		}
	}

	// make the cloned public data object a copy from the original
	if ( curData.data ) {
		curData.data = jQuery.extend( {}, curData.data );
	}
}

function fixCloneNodeIssues( src, dest ) {
	var nodeName, e, data;

	// We do not need to do anything for non-Elements
	if ( dest.nodeType !== 1 ) {
		return;
	}

	nodeName = dest.nodeName.toLowerCase();

	// IE6-8 copies events bound via attachEvent when using cloneNode.
	if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
		data = jQuery._data( dest );

		for ( e in data.events ) {
			jQuery.removeEvent( dest, e, data.handle );
		}

		// Event data gets referenced instead of copied if the expando gets copied too
		dest.removeAttribute( jQuery.expando );
	}

	// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
	if ( nodeName === "script" && dest.text !== src.text ) {
		disableScript( dest ).text = src.text;
		restoreScript( dest );

	// IE6-10 improperly clones children of object elements using classid.
	// IE10 throws NoModificationAllowedError if parent is null, #12132.
	} else if ( nodeName === "object" ) {
		if ( dest.parentNode ) {
			dest.outerHTML = src.outerHTML;
		}

		// This path appears unavoidable for IE9. When cloning an object
		// element in IE9, the outerHTML strategy above is not sufficient.
		// If the src has innerHTML and the destination does not,
		// copy the src.innerHTML into the dest.innerHTML. #10324
		if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {
			dest.innerHTML = src.innerHTML;
		}

	} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {

		// IE6-8 fails to persist the checked state of a cloned checkbox
		// or radio button. Worse, IE6-7 fail to give the cloned element
		// a checked appearance if the defaultChecked value isn't also set

		dest.defaultChecked = dest.checked = src.checked;

		// IE6-7 get confused and end up setting the value of a cloned
		// checkbox/radio button to an empty string instead of "on"
		if ( dest.value !== src.value ) {
			dest.value = src.value;
		}

	// IE6-8 fails to return the selected option to the default selected
	// state when cloning options
	} else if ( nodeName === "option" ) {
		dest.defaultSelected = dest.selected = src.defaultSelected;

	// IE6-8 fails to set the defaultValue to the correct value when
	// cloning other types of input fields
	} else if ( nodeName === "input" || nodeName === "textarea" ) {
		dest.defaultValue = src.defaultValue;
	}
}

function domManip( collection, args, callback, ignored ) {

	// Flatten any nested arrays
	args = concat.apply( [], args );

	var first, node, hasScripts,
		scripts, doc, fragment,
		i = 0,
		l = collection.length,
		iNoClone = l - 1,
		value = args[ 0 ],
		isFunction = jQuery.isFunction( value );

	// We can't cloneNode fragments that contain checked, in WebKit
	if ( isFunction ||
			( l > 1 && typeof value === "string" &&
				!support.checkClone && rchecked.test( value ) ) ) {
		return collection.each( function( index ) {
			var self = collection.eq( index );
			if ( isFunction ) {
				args[ 0 ] = value.call( this, index, self.html() );
			}
			domManip( self, args, callback, ignored );
		} );
	}

	if ( l ) {
		fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
		first = fragment.firstChild;

		if ( fragment.childNodes.length === 1 ) {
			fragment = first;
		}

		// Require either new content or an interest in ignored elements to invoke the callback
		if ( first || ignored ) {
			scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
			hasScripts = scripts.length;

			// Use the original fragment for the last item
			// instead of the first because it can end up
			// being emptied incorrectly in certain situations (#8070).
			for ( ; i < l; i++ ) {
				node = fragment;

				if ( i !== iNoClone ) {
					node = jQuery.clone( node, true, true );

					// Keep references to cloned scripts for later restoration
					if ( hasScripts ) {

						// Support: Android<4.1, PhantomJS<2
						// push.apply(_, arraylike) throws on ancient WebKit
						jQuery.merge( scripts, getAll( node, "script" ) );
					}
				}

				callback.call( collection[ i ], node, i );
			}

			if ( hasScripts ) {
				doc = scripts[ scripts.length - 1 ].ownerDocument;

				// Reenable scripts
				jQuery.map( scripts, restoreScript );

				// Evaluate executable scripts on first document insertion
				for ( i = 0; i < hasScripts; i++ ) {
					node = scripts[ i ];
					if ( rscriptType.test( node.type || "" ) &&
						!jQuery._data( node, "globalEval" ) &&
						jQuery.contains( doc, node ) ) {

						if ( node.src ) {

							// Optional AJAX dependency, but won't run scripts if not present
							if ( jQuery._evalUrl ) {
								jQuery._evalUrl( node.src );
							}
						} else {
							jQuery.globalEval(
								( node.text || node.textContent || node.innerHTML || "" )
									.replace( rcleanScript, "" )
							);
						}
					}
				}
			}

			// Fix #11809: Avoid leaking memory
			fragment = first = null;
		}
	}

	return collection;
}

function remove( elem, selector, keepData ) {
	var node,
		elems = selector ? jQuery.filter( selector, elem ) : elem,
		i = 0;

	for ( ; ( node = elems[ i ] ) != null; i++ ) {

		if ( !keepData && node.nodeType === 1 ) {
			jQuery.cleanData( getAll( node ) );
		}

		if ( node.parentNode ) {
			if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
				setGlobalEval( getAll( node, "script" ) );
			}
			node.parentNode.removeChild( node );
		}
	}

	return elem;
}

jQuery.extend( {
	htmlPrefilter: function( html ) {
		return html.replace( rxhtmlTag, "<$1></$2>" );
	},

	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
		var destElements, node, clone, i, srcElements,
			inPage = jQuery.contains( elem.ownerDocument, elem );

		if ( support.html5Clone || jQuery.isXMLDoc( elem ) ||
			!rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {

			clone = elem.cloneNode( true );

		// IE<=8 does not properly clone detached, unknown element nodes
		} else {
			fragmentDiv.innerHTML = elem.outerHTML;
			fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
		}

		if ( ( !support.noCloneEvent || !support.noCloneChecked ) &&
				( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {

			// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
			destElements = getAll( clone );
			srcElements = getAll( elem );

			// Fix all IE cloning issues
			for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {

				// Ensure that the destination node is not null; Fixes #9587
				if ( destElements[ i ] ) {
					fixCloneNodeIssues( node, destElements[ i ] );
				}
			}
		}

		// Copy the events from the original to the clone
		if ( dataAndEvents ) {
			if ( deepDataAndEvents ) {
				srcElements = srcElements || getAll( elem );
				destElements = destElements || getAll( clone );

				for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {
					cloneCopyEvent( node, destElements[ i ] );
				}
			} else {
				cloneCopyEvent( elem, clone );
			}
		}

		// Preserve script evaluation history
		destElements = getAll( clone, "script" );
		if ( destElements.length > 0 ) {
			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
		}

		destElements = srcElements = node = null;

		// Return the cloned set
		return clone;
	},

	cleanData: function( elems, /* internal */ forceAcceptData ) {
		var elem, type, id, data,
			i = 0,
			internalKey = jQuery.expando,
			cache = jQuery.cache,
			attributes = support.attributes,
			special = jQuery.event.special;

		for ( ; ( elem = elems[ i ] ) != null; i++ ) {
			if ( forceAcceptData || acceptData( elem ) ) {

				id = elem[ internalKey ];
				data = id && cache[ id ];

				if ( data ) {
					if ( data.events ) {
						for ( type in data.events ) {
							if ( special[ type ] ) {
								jQuery.event.remove( elem, type );

							// This is a shortcut to avoid jQuery.event.remove's overhead
							} else {
								jQuery.removeEvent( elem, type, data.handle );
							}
						}
					}

					// Remove cache only if it was not already removed by jQuery.event.remove
					if ( cache[ id ] ) {

						delete cache[ id ];

						// Support: IE<9
						// IE does not allow us to delete expando properties from nodes
						// IE creates expando attributes along with the property
						// IE does not have a removeAttribute function on Document nodes
						if ( !attributes && typeof elem.removeAttribute !== "undefined" ) {
							elem.removeAttribute( internalKey );

						// Webkit & Blink performance suffers when deleting properties
						// from DOM nodes, so set to undefined instead
						// https://code.google.com/p/chromium/issues/detail?id=378607
						} else {
							elem[ internalKey ] = undefined;
						}

						deletedIds.push( id );
					}
				}
			}
		}
	}
} );

jQuery.fn.extend( {

	// Keep domManip exposed until 3.0 (gh-2225)
	domManip: domManip,

	detach: function( selector ) {
		return remove( this, selector, true );
	},

	remove: function( selector ) {
		return remove( this, selector );
	},

	text: function( value ) {
		return access( this, function( value ) {
			return value === undefined ?
				jQuery.text( this ) :
				this.empty().append(
					( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value )
				);
		}, null, value, arguments.length );
	},

	append: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
				var target = manipulationTarget( this, elem );
				target.appendChild( elem );
			}
		} );
	},

	prepend: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
				var target = manipulationTarget( this, elem );
				target.insertBefore( elem, target.firstChild );
			}
		} );
	},

	before: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.parentNode ) {
				this.parentNode.insertBefore( elem, this );
			}
		} );
	},

	after: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.parentNode ) {
				this.parentNode.insertBefore( elem, this.nextSibling );
			}
		} );
	},

	empty: function() {
		var elem,
			i = 0;

		for ( ; ( elem = this[ i ] ) != null; i++ ) {

			// Remove element nodes and prevent memory leaks
			if ( elem.nodeType === 1 ) {
				jQuery.cleanData( getAll( elem, false ) );
			}

			// Remove any remaining nodes
			while ( elem.firstChild ) {
				elem.removeChild( elem.firstChild );
			}

			// If this is a select, ensure that it displays empty (#12336)
			// Support: IE<9
			if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
				elem.options.length = 0;
			}
		}

		return this;
	},

	clone: function( dataAndEvents, deepDataAndEvents ) {
		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;

		return this.map( function() {
			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
		} );
	},

	html: function( value ) {
		return access( this, function( value ) {
			var elem = this[ 0 ] || {},
				i = 0,
				l = this.length;

			if ( value === undefined ) {
				return elem.nodeType === 1 ?
					elem.innerHTML.replace( rinlinejQuery, "" ) :
					undefined;
			}

			// See if we can take a shortcut and just use innerHTML
			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
				( support.htmlSerialize || !rnoshimcache.test( value )  ) &&
				( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {

				value = jQuery.htmlPrefilter( value );

				try {
					for ( ; i < l; i++ ) {

						// Remove element nodes and prevent memory leaks
						elem = this[ i ] || {};
						if ( elem.nodeType === 1 ) {
							jQuery.cleanData( getAll( elem, false ) );
							elem.innerHTML = value;
						}
					}

					elem = 0;

				// If using innerHTML throws an exception, use the fallback method
				} catch ( e ) {}
			}

			if ( elem ) {
				this.empty().append( value );
			}
		}, null, value, arguments.length );
	},

	replaceWith: function() {
		var ignored = [];

		// Make the changes, replacing each non-ignored context element with the new content
		return domManip( this, arguments, function( elem ) {
			var parent = this.parentNode;

			if ( jQuery.inArray( this, ignored ) < 0 ) {
				jQuery.cleanData( getAll( this ) );
				if ( parent ) {
					parent.replaceChild( elem, this );
				}
			}

		// Force callback invocation
		}, ignored );
	}
} );

jQuery.each( {
	appendTo: "append",
	prependTo: "prepend",
	insertBefore: "before",
	insertAfter: "after",
	replaceAll: "replaceWith"
}, function( name, original ) {
	jQuery.fn[ name ] = function( selector ) {
		var elems,
			i = 0,
			ret = [],
			insert = jQuery( selector ),
			last = insert.length - 1;

		for ( ; i <= last; i++ ) {
			elems = i === last ? this : this.clone( true );
			jQuery( insert[ i ] )[ original ]( elems );

			// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
			push.apply( ret, elems.get() );
		}

		return this.pushStack( ret );
	};
} );


var iframe,
	elemdisplay = {

		// Support: Firefox
		// We have to pre-define these values for FF (#10227)
		HTML: "block",
		BODY: "block"
	};

/**
 * Retrieve the actual display of a element
 * @param {String} name nodeName of the element
 * @param {Object} doc Document object
 */

// Called only from within defaultDisplay
function actualDisplay( name, doc ) {
	var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),

		display = jQuery.css( elem[ 0 ], "display" );

	// We don't have any data stored on the element,
	// so use "detach" method as fast way to get rid of the element
	elem.detach();

	return display;
}

/**
 * Try to determine the default display value of an element
 * @param {String} nodeName
 */
function defaultDisplay( nodeName ) {
	var doc = document,
		display = elemdisplay[ nodeName ];

	if ( !display ) {
		display = actualDisplay( nodeName, doc );

		// If the simple way fails, read from inside an iframe
		if ( display === "none" || !display ) {

			// Use the already-created iframe if possible
			iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) )
				.appendTo( doc.documentElement );

			// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
			doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;

			// Support: IE
			doc.write();
			doc.close();

			display = actualDisplay( nodeName, doc );
			iframe.detach();
		}

		// Store the correct default display
		elemdisplay[ nodeName ] = display;
	}

	return display;
}
var rmargin = ( /^margin/ );

var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );

var swap = function( elem, options, callback, args ) {
	var ret, name,
		old = {};

	// Remember the old values, and insert the new ones
	for ( name in options ) {
		old[ name ] = elem.style[ name ];
		elem.style[ name ] = options[ name ];
	}

	ret = callback.apply( elem, args || [] );

	// Revert the old values
	for ( name in options ) {
		elem.style[ name ] = old[ name ];
	}

	return ret;
};


var documentElement = document.documentElement;



( function() {
	var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
		reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
		container = document.createElement( "div" ),
		div = document.createElement( "div" );

	// Finish early in limited (non-browser) environments
	if ( !div.style ) {
		return;
	}

	div.style.cssText = "float:left;opacity:.5";

	// Support: IE<9
	// Make sure that element opacity exists (as opposed to filter)
	support.opacity = div.style.opacity === "0.5";

	// Verify style float existence
	// (IE uses styleFloat instead of cssFloat)
	support.cssFloat = !!div.style.cssFloat;

	div.style.backgroundClip = "content-box";
	div.cloneNode( true ).style.backgroundClip = "";
	support.clearCloneStyle = div.style.backgroundClip === "content-box";

	container = document.createElement( "div" );
	container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
		"padding:0;margin-top:1px;position:absolute";
	div.innerHTML = "";
	container.appendChild( div );

	// Support: Firefox<29, Android 2.3
	// Vendor-prefix box-sizing
	support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" ||
		div.style.WebkitBoxSizing === "";

	jQuery.extend( support, {
		reliableHiddenOffsets: function() {
			if ( pixelPositionVal == null ) {
				computeStyleTests();
			}
			return reliableHiddenOffsetsVal;
		},

		boxSizingReliable: function() {

			// We're checking for pixelPositionVal here instead of boxSizingReliableVal
			// since that compresses better and they're computed together anyway.
			if ( pixelPositionVal == null ) {
				computeStyleTests();
			}
			return boxSizingReliableVal;
		},

		pixelMarginRight: function() {

			// Support: Android 4.0-4.3
			if ( pixelPositionVal == null ) {
				computeStyleTests();
			}
			return pixelMarginRightVal;
		},

		pixelPosition: function() {
			if ( pixelPositionVal == null ) {
				computeStyleTests();
			}
			return pixelPositionVal;
		},

		reliableMarginRight: function() {

			// Support: Android 2.3
			if ( pixelPositionVal == null ) {
				computeStyleTests();
			}
			return reliableMarginRightVal;
		},

		reliableMarginLeft: function() {

			// Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
			if ( pixelPositionVal == null ) {
				computeStyleTests();
			}
			return reliableMarginLeftVal;
		}
	} );

	function computeStyleTests() {
		var contents, divStyle,
			documentElement = document.documentElement;

		// Setup
		documentElement.appendChild( container );

		div.style.cssText =

			// Support: Android 2.3
			// Vendor-prefix box-sizing
			"-webkit-box-sizing:border-box;box-sizing:border-box;" +
			"position:relative;display:block;" +
			"margin:auto;border:1px;padding:1px;" +
			"top:1%;width:50%";

		// Support: IE<9
		// Assume reasonable values in the absence of getComputedStyle
		pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false;
		pixelMarginRightVal = reliableMarginRightVal = true;

		// Check for getComputedStyle so that this code is not run in IE<9.
		if ( window.getComputedStyle ) {
			divStyle = window.getComputedStyle( div );
			pixelPositionVal = ( divStyle || {} ).top !== "1%";
			reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px";
			boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px";

			// Support: Android 4.0 - 4.3 only
			// Some styles come back with percentage values, even though they shouldn't
			div.style.marginRight = "50%";
			pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px";

			// Support: Android 2.3 only
			// Div with explicit width and no margin-right incorrectly
			// gets computed margin-right based on width of container (#3333)
			// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
			contents = div.appendChild( document.createElement( "div" ) );

			// Reset CSS: box-sizing; display; margin; border; padding
			contents.style.cssText = div.style.cssText =

				// Support: Android 2.3
				// Vendor-prefix box-sizing
				"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
				"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
			contents.style.marginRight = contents.style.width = "0";
			div.style.width = "1px";

			reliableMarginRightVal =
				!parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight );

			div.removeChild( contents );
		}

		// Support: IE6-8
		// First check that getClientRects works as expected
		// Check if table cells still have offsetWidth/Height when they are set
		// to display:none and there are still other visible table cells in a
		// table row; if so, offsetWidth/Height are not reliable for use when
		// determining if an element has been hidden directly using
		// display:none (it is still safe to use offsets if a parent element is
		// hidden; don safety goggles and see bug #4512 for more information).
		div.style.display = "none";
		reliableHiddenOffsetsVal = div.getClientRects().length === 0;
		if ( reliableHiddenOffsetsVal ) {
			div.style.display = "";
			div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
			div.childNodes[ 0 ].style.borderCollapse = "separate";
			contents = div.getElementsByTagName( "td" );
			contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
			reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
			if ( reliableHiddenOffsetsVal ) {
				contents[ 0 ].style.display = "";
				contents[ 1 ].style.display = "none";
				reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
			}
		}

		// Teardown
		documentElement.removeChild( container );
	}

} )();


var getStyles, curCSS,
	rposition = /^(top|right|bottom|left)$/;

if ( window.getComputedStyle ) {
	getStyles = function( elem ) {

		// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
		// IE throws on elements created in popups
		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
		var view = elem.ownerDocument.defaultView;

		if ( !view || !view.opener ) {
			view = window;
		}

		return view.getComputedStyle( elem );
	};

	curCSS = function( elem, name, computed ) {
		var width, minWidth, maxWidth, ret,
			style = elem.style;

		computed = computed || getStyles( elem );

		// getPropertyValue is only needed for .css('filter') in IE9, see #12537
		ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;

		// Support: Opera 12.1x only
		// Fall back to style even without computed
		// computed is undefined for elems on document fragments
		if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
			ret = jQuery.style( elem, name );
		}

		if ( computed ) {

			// A tribute to the "awesome hack by Dean Edwards"
			// Chrome < 17 and Safari 5.0 uses "computed value"
			// instead of "used value" for margin-right
			// Safari 5.1.7 (at least) returns percentage for a larger set of values,
			// but width seems to be reliably pixels
			// this is against the CSSOM draft spec:
			// http://dev.w3.org/csswg/cssom/#resolved-values
			if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {

				// Remember the original values
				width = style.width;
				minWidth = style.minWidth;
				maxWidth = style.maxWidth;

				// Put in the new values to get a computed value out
				style.minWidth = style.maxWidth = style.width = ret;
				ret = computed.width;

				// Revert the changed values
				style.width = width;
				style.minWidth = minWidth;
				style.maxWidth = maxWidth;
			}
		}

		// Support: IE
		// IE returns zIndex value as an integer.
		return ret === undefined ?
			ret :
			ret + "";
	};
} else if ( documentElement.currentStyle ) {
	getStyles = function( elem ) {
		return elem.currentStyle;
	};

	curCSS = function( elem, name, computed ) {
		var left, rs, rsLeft, ret,
			style = elem.style;

		computed = computed || getStyles( elem );
		ret = computed ? computed[ name ] : undefined;

		// Avoid setting ret to empty string here
		// so we don't default to auto
		if ( ret == null && style && style[ name ] ) {
			ret = style[ name ];
		}

		// From the awesome hack by Dean Edwards
		// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291

		// If we're not dealing with a regular pixel number
		// but a number that has a weird ending, we need to convert it to pixels
		// but not position css attributes, as those are
		// proportional to the parent element instead
		// and we can't measure the parent instead because it
		// might trigger a "stacking dolls" problem
		if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {

			// Remember the original values
			left = style.left;
			rs = elem.runtimeStyle;
			rsLeft = rs && rs.left;

			// Put in the new values to get a computed value out
			if ( rsLeft ) {
				rs.left = elem.currentStyle.left;
			}
			style.left = name === "fontSize" ? "1em" : ret;
			ret = style.pixelLeft + "px";

			// Revert the changed values
			style.left = left;
			if ( rsLeft ) {
				rs.left = rsLeft;
			}
		}

		// Support: IE
		// IE returns zIndex value as an integer.
		return ret === undefined ?
			ret :
			ret + "" || "auto";
	};
}




function addGetHookIf( conditionFn, hookFn ) {

	// Define the hook, we'll check on the first run if it's really needed.
	return {
		get: function() {
			if ( conditionFn() ) {

				// Hook not needed (or it's not possible to use it due
				// to missing dependency), remove it.
				delete this.get;
				return;
			}

			// Hook needed; redefine it so that the support test is not executed again.
			return ( this.get = hookFn ).apply( this, arguments );
		}
	};
}


var

		ralpha = /alpha\([^)]*\)/i,
	ropacity = /opacity\s*=\s*([^)]*)/i,

	// swappable if display is none or starts with table except
	// "table", "table-cell", or "table-caption"
	// see here for display values:
	// https://developer.mozilla.org/en-US/docs/CSS/display
	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
	rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),

	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
	cssNormalTransform = {
		letterSpacing: "0",
		fontWeight: "400"
	},

	cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
	emptyStyle = document.createElement( "div" ).style;


// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( name ) {

	// shortcut for names that are not vendor prefixed
	if ( name in emptyStyle ) {
		return name;
	}

	// check for vendor prefixed names
	var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ),
		i = cssPrefixes.length;

	while ( i-- ) {
		name = cssPrefixes[ i ] + capName;
		if ( name in emptyStyle ) {
			return name;
		}
	}
}

function showHide( elements, show ) {
	var display, elem, hidden,
		values = [],
		index = 0,
		length = elements.length;

	for ( ; index < length; index++ ) {
		elem = elements[ index ];
		if ( !elem.style ) {
			continue;
		}

		values[ index ] = jQuery._data( elem, "olddisplay" );
		display = elem.style.display;
		if ( show ) {

			// Reset the inline display of this element to learn if it is
			// being hidden by cascaded rules or not
			if ( !values[ index ] && display === "none" ) {
				elem.style.display = "";
			}

			// Set elements which have been overridden with display: none
			// in a stylesheet to whatever the default browser style is
			// for such an element
			if ( elem.style.display === "" && isHidden( elem ) ) {
				values[ index ] =
					jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
			}
		} else {
			hidden = isHidden( elem );

			if ( display && display !== "none" || !hidden ) {
				jQuery._data(
					elem,
					"olddisplay",
					hidden ? display : jQuery.css( elem, "display" )
				);
			}
		}
	}

	// Set the display of most of the elements in a second loop
	// to avoid the constant reflow
	for ( index = 0; index < length; index++ ) {
		elem = elements[ index ];
		if ( !elem.style ) {
			continue;
		}
		if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
			elem.style.display = show ? values[ index ] || "" : "none";
		}
	}

	return elements;
}

function setPositiveNumber( elem, value, subtract ) {
	var matches = rnumsplit.exec( value );
	return matches ?

		// Guard against undefined "subtract", e.g., when used as in cssHooks
		Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
		value;
}

function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
	var i = extra === ( isBorderBox ? "border" : "content" ) ?

		// If we already have the right measurement, avoid augmentation
		4 :

		// Otherwise initialize for horizontal or vertical properties
		name === "width" ? 1 : 0,

		val = 0;

	for ( ; i < 4; i += 2 ) {

		// both box models exclude margin, so add it if we want it
		if ( extra === "margin" ) {
			val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
		}

		if ( isBorderBox ) {

			// border-box includes padding, so remove it if we want content
			if ( extra === "content" ) {
				val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
			}

			// at this point, extra isn't border nor margin, so remove border
			if ( extra !== "margin" ) {
				val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}
		} else {

			// at this point, extra isn't content, so add padding
			val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );

			// at this point, extra isn't content nor padding, so add border
			if ( extra !== "padding" ) {
				val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}
		}
	}

	return val;
}

function getWidthOrHeight( elem, name, extra ) {

	// Start with offset property, which is equivalent to the border-box value
	var valueIsBorderBox = true,
		val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
		styles = getStyles( elem ),
		isBorderBox = support.boxSizing &&
			jQuery.css( elem, "boxSizing", false, styles ) === "border-box";

	// some non-html elements return undefined for offsetWidth, so check for null/undefined
	// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
	// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
	if ( val <= 0 || val == null ) {

		// Fall back to computed then uncomputed css if necessary
		val = curCSS( elem, name, styles );
		if ( val < 0 || val == null ) {
			val = elem.style[ name ];
		}

		// Computed unit is not pixels. Stop here and return.
		if ( rnumnonpx.test( val ) ) {
			return val;
		}

		// we need the check for style in case a browser which returns unreliable values
		// for getComputedStyle silently falls back to the reliable elem.style
		valueIsBorderBox = isBorderBox &&
			( support.boxSizingReliable() || val === elem.style[ name ] );

		// Normalize "", auto, and prepare for extra
		val = parseFloat( val ) || 0;
	}

	// use the active box-sizing model to add/subtract irrelevant styles
	return ( val +
		augmentWidthOrHeight(
			elem,
			name,
			extra || ( isBorderBox ? "border" : "content" ),
			valueIsBorderBox,
			styles
		)
	) + "px";
}

jQuery.extend( {

	// Add in style property hooks for overriding the default
	// behavior of getting and setting a style property
	cssHooks: {
		opacity: {
			get: function( elem, computed ) {
				if ( computed ) {

					// We should always get a number back from opacity
					var ret = curCSS( elem, "opacity" );
					return ret === "" ? "1" : ret;
				}
			}
		}
	},

	// Don't automatically add "px" to these possibly-unitless properties
	cssNumber: {
		"animationIterationCount": true,
		"columnCount": true,
		"fillOpacity": true,
		"flexGrow": true,
		"flexShrink": true,
		"fontWeight": true,
		"lineHeight": true,
		"opacity": true,
		"order": true,
		"orphans": true,
		"widows": true,
		"zIndex": true,
		"zoom": true
	},

	// Add in properties whose names you wish to fix before
	// setting or getting the value
	cssProps: {

		// normalize float css property
		"float": support.cssFloat ? "cssFloat" : "styleFloat"
	},

	// Get and set the style property on a DOM Node
	style: function( elem, name, value, extra ) {

		// Don't set styles on text and comment nodes
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
			return;
		}

		// Make sure that we're working with the right name
		var ret, type, hooks,
			origName = jQuery.camelCase( name ),
			style = elem.style;

		name = jQuery.cssProps[ origName ] ||
			( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );

		// gets hook for the prefixed version
		// followed by the unprefixed version
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];

		// Check if we're setting a value
		if ( value !== undefined ) {
			type = typeof value;

			// Convert "+=" or "-=" to relative numbers (#7345)
			if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
				value = adjustCSS( elem, name, ret );

				// Fixes bug #9237
				type = "number";
			}

			// Make sure that null and NaN values aren't set. See: #7116
			if ( value == null || value !== value ) {
				return;
			}

			// If a number was passed in, add the unit (except for certain CSS properties)
			if ( type === "number" ) {
				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
			}

			// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
			// but it would mean to define eight
			// (for every problematic property) identical functions
			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
				style[ name ] = "inherit";
			}

			// If a hook was provided, use that value, otherwise just set the specified value
			if ( !hooks || !( "set" in hooks ) ||
				( value = hooks.set( elem, value, extra ) ) !== undefined ) {

				// Support: IE
				// Swallow errors from 'invalid' CSS values (#5509)
				try {
					style[ name ] = value;
				} catch ( e ) {}
			}

		} else {

			// If a hook was provided get the non-computed value from there
			if ( hooks && "get" in hooks &&
				( ret = hooks.get( elem, false, extra ) ) !== undefined ) {

				return ret;
			}

			// Otherwise just get the value from the style object
			return style[ name ];
		}
	},

	css: function( elem, name, extra, styles ) {
		var num, val, hooks,
			origName = jQuery.camelCase( name );

		// Make sure that we're working with the right name
		name = jQuery.cssProps[ origName ] ||
			( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );

		// gets hook for the prefixed version
		// followed by the unprefixed version
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];

		// If a hook was provided get the computed value from there
		if ( hooks && "get" in hooks ) {
			val = hooks.get( elem, true, extra );
		}

		// Otherwise, if a way to get the computed value exists, use that
		if ( val === undefined ) {
			val = curCSS( elem, name, styles );
		}

		//convert "normal" to computed value
		if ( val === "normal" && name in cssNormalTransform ) {
			val = cssNormalTransform[ name ];
		}

		// Return, converting to number if forced or a qualifier was provided and val looks numeric
		if ( extra === "" || extra ) {
			num = parseFloat( val );
			return extra === true || isFinite( num ) ? num || 0 : val;
		}
		return val;
	}
} );

jQuery.each( [ "height", "width" ], function( i, name ) {
	jQuery.cssHooks[ name ] = {
		get: function( elem, computed, extra ) {
			if ( computed ) {

				// certain elements can have dimension info if we invisibly show them
				// however, it must have a current display style that would benefit from this
				return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
					elem.offsetWidth === 0 ?
						swap( elem, cssShow, function() {
							return getWidthOrHeight( elem, name, extra );
						} ) :
						getWidthOrHeight( elem, name, extra );
			}
		},

		set: function( elem, value, extra ) {
			var styles = extra && getStyles( elem );
			return setPositiveNumber( elem, value, extra ?
				augmentWidthOrHeight(
					elem,
					name,
					extra,
					support.boxSizing &&
						jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
					styles
				) : 0
			);
		}
	};
} );

if ( !support.opacity ) {
	jQuery.cssHooks.opacity = {
		get: function( elem, computed ) {

			// IE uses filters for opacity
			return ropacity.test( ( computed && elem.currentStyle ?
				elem.currentStyle.filter :
				elem.style.filter ) || "" ) ?
					( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
					computed ? "1" : "";
		},

		set: function( elem, value ) {
			var style = elem.style,
				currentStyle = elem.currentStyle,
				opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
				filter = currentStyle && currentStyle.filter || style.filter || "";

			// IE has trouble with opacity if it does not have layout
			// Force it by setting the zoom level
			style.zoom = 1;

			// if setting opacity to 1, and no other filters exist -
			// attempt to remove filter attribute #6652
			// if value === "", then remove inline opacity #12685
			if ( ( value >= 1 || value === "" ) &&
					jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
					style.removeAttribute ) {

				// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
				// if "filter:" is present at all, clearType is disabled, we want to avoid this
				// style.removeAttribute is IE Only, but so apparently is this code path...
				style.removeAttribute( "filter" );

				// if there is no filter style applied in a css rule
				// or unset inline opacity, we are done
				if ( value === "" || currentStyle && !currentStyle.filter ) {
					return;
				}
			}

			// otherwise, set new filter values
			style.filter = ralpha.test( filter ) ?
				filter.replace( ralpha, opacity ) :
				filter + " " + opacity;
		}
	};
}

jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
	function( elem, computed ) {
		if ( computed ) {
			return swap( elem, { "display": "inline-block" },
				curCSS, [ elem, "marginRight" ] );
		}
	}
);

jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
	function( elem, computed ) {
		if ( computed ) {
			return (
				parseFloat( curCSS( elem, "marginLeft" ) ) ||

				// Support: IE<=11+
				// Running getBoundingClientRect on a disconnected node in IE throws an error
				// Support: IE8 only
				// getClientRects() errors on disconnected elems
				( jQuery.contains( elem.ownerDocument, elem ) ?
					elem.getBoundingClientRect().left -
						swap( elem, { marginLeft: 0 }, function() {
							return elem.getBoundingClientRect().left;
						} ) :
					0
				)
			) + "px";
		}
	}
);

// These hooks are used by animate to expand properties
jQuery.each( {
	margin: "",
	padding: "",
	border: "Width"
}, function( prefix, suffix ) {
	jQuery.cssHooks[ prefix + suffix ] = {
		expand: function( value ) {
			var i = 0,
				expanded = {},

				// assumes a single number if not a string
				parts = typeof value === "string" ? value.split( " " ) : [ value ];

			for ( ; i < 4; i++ ) {
				expanded[ prefix + cssExpand[ i ] + suffix ] =
					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
			}

			return expanded;
		}
	};

	if ( !rmargin.test( prefix ) ) {
		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
	}
} );

jQuery.fn.extend( {
	css: function( name, value ) {
		return access( this, function( elem, name, value ) {
			var styles, len,
				map = {},
				i = 0;

			if ( jQuery.isArray( name ) ) {
				styles = getStyles( elem );
				len = name.length;

				for ( ; i < len; i++ ) {
					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
				}

				return map;
			}

			return value !== undefined ?
				jQuery.style( elem, name, value ) :
				jQuery.css( elem, name );
		}, name, value, arguments.length > 1 );
	},
	show: function() {
		return showHide( this, true );
	},
	hide: function() {
		return showHide( this );
	},
	toggle: function( state ) {
		if ( typeof state === "boolean" ) {
			return state ? this.show() : this.hide();
		}

		return this.each( function() {
			if ( isHidden( this ) ) {
				jQuery( this ).show();
			} else {
				jQuery( this ).hide();
			}
		} );
	}
} );


function Tween( elem, options, prop, end, easing ) {
	return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;

Tween.prototype = {
	constructor: Tween,
	init: function( elem, options, prop, end, easing, unit ) {
		this.elem = elem;
		this.prop = prop;
		this.easing = easing || jQuery.easing._default;
		this.options = options;
		this.start = this.now = this.cur();
		this.end = end;
		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
	},
	cur: function() {
		var hooks = Tween.propHooks[ this.prop ];

		return hooks && hooks.get ?
			hooks.get( this ) :
			Tween.propHooks._default.get( this );
	},
	run: function( percent ) {
		var eased,
			hooks = Tween.propHooks[ this.prop ];

		if ( this.options.duration ) {
			this.pos = eased = jQuery.easing[ this.easing ](
				percent, this.options.duration * percent, 0, 1, this.options.duration
			);
		} else {
			this.pos = eased = percent;
		}
		this.now = ( this.end - this.start ) * eased + this.start;

		if ( this.options.step ) {
			this.options.step.call( this.elem, this.now, this );
		}

		if ( hooks && hooks.set ) {
			hooks.set( this );
		} else {
			Tween.propHooks._default.set( this );
		}
		return this;
	}
};

Tween.prototype.init.prototype = Tween.prototype;

Tween.propHooks = {
	_default: {
		get: function( tween ) {
			var result;

			// Use a property on the element directly when it is not a DOM element,
			// or when there is no matching style property that exists.
			if ( tween.elem.nodeType !== 1 ||
				tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
				return tween.elem[ tween.prop ];
			}

			// passing an empty string as a 3rd parameter to .css will automatically
			// attempt a parseFloat and fallback to a string if the parse fails
			// so, simple values such as "10px" are parsed to Float.
			// complex values such as "rotate(1rad)" are returned as is.
			result = jQuery.css( tween.elem, tween.prop, "" );

			// Empty strings, null, undefined and "auto" are converted to 0.
			return !result || result === "auto" ? 0 : result;
		},
		set: function( tween ) {

			// use step hook for back compat - use cssHook if its there - use .style if its
			// available and use plain properties where available
			if ( jQuery.fx.step[ tween.prop ] ) {
				jQuery.fx.step[ tween.prop ]( tween );
			} else if ( tween.elem.nodeType === 1 &&
				( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
					jQuery.cssHooks[ tween.prop ] ) ) {
				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
			} else {
				tween.elem[ tween.prop ] = tween.now;
			}
		}
	}
};

// Support: IE <=9
// Panic based approach to setting things on disconnected nodes

Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
	set: function( tween ) {
		if ( tween.elem.nodeType && tween.elem.parentNode ) {
			tween.elem[ tween.prop ] = tween.now;
		}
	}
};

jQuery.easing = {
	linear: function( p ) {
		return p;
	},
	swing: function( p ) {
		return 0.5 - Math.cos( p * Math.PI ) / 2;
	},
	_default: "swing"
};

jQuery.fx = Tween.prototype.init;

// Back Compat <1.8 extension point
jQuery.fx.step = {};




var
	fxNow, timerId,
	rfxtypes = /^(?:toggle|show|hide)$/,
	rrun = /queueHooks$/;

// Animations created synchronously will run synchronously
function createFxNow() {
	window.setTimeout( function() {
		fxNow = undefined;
	} );
	return ( fxNow = jQuery.now() );
}

// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
	var which,
		attrs = { height: type },
		i = 0;

	// if we include width, step value is 1 to do all cssExpand values,
	// if we don't include width, step value is 2 to skip over Left and Right
	includeWidth = includeWidth ? 1 : 0;
	for ( ; i < 4 ; i += 2 - includeWidth ) {
		which = cssExpand[ i ];
		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
	}

	if ( includeWidth ) {
		attrs.opacity = attrs.width = type;
	}

	return attrs;
}

function createTween( value, prop, animation ) {
	var tween,
		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
		index = 0,
		length = collection.length;
	for ( ; index < length; index++ ) {
		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {

			// we're done with this property
			return tween;
		}
	}
}

function defaultPrefilter( elem, props, opts ) {
	/* jshint validthis: true */
	var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
		anim = this,
		orig = {},
		style = elem.style,
		hidden = elem.nodeType && isHidden( elem ),
		dataShow = jQuery._data( elem, "fxshow" );

	// handle queue: false promises
	if ( !opts.queue ) {
		hooks = jQuery._queueHooks( elem, "fx" );
		if ( hooks.unqueued == null ) {
			hooks.unqueued = 0;
			oldfire = hooks.empty.fire;
			hooks.empty.fire = function() {
				if ( !hooks.unqueued ) {
					oldfire();
				}
			};
		}
		hooks.unqueued++;

		anim.always( function() {

			// doing this makes sure that the complete handler will be called
			// before this completes
			anim.always( function() {
				hooks.unqueued--;
				if ( !jQuery.queue( elem, "fx" ).length ) {
					hooks.empty.fire();
				}
			} );
		} );
	}

	// height/width overflow pass
	if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {

		// Make sure that nothing sneaks out
		// Record all 3 overflow attributes because IE does not
		// change the overflow attribute when overflowX and
		// overflowY are set to the same value
		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];

		// Set display property to inline-block for height/width
		// animations on inline elements that are having width/height animated
		display = jQuery.css( elem, "display" );

		// Test default display if display is currently "none"
		checkDisplay = display === "none" ?
			jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;

		if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {

			// inline-level elements accept inline-block;
			// block-level elements need to be inline with layout
			if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
				style.display = "inline-block";
			} else {
				style.zoom = 1;
			}
		}
	}

	if ( opts.overflow ) {
		style.overflow = "hidden";
		if ( !support.shrinkWrapBlocks() ) {
			anim.always( function() {
				style.overflow = opts.overflow[ 0 ];
				style.overflowX = opts.overflow[ 1 ];
				style.overflowY = opts.overflow[ 2 ];
			} );
		}
	}

	// show/hide pass
	for ( prop in props ) {
		value = props[ prop ];
		if ( rfxtypes.exec( value ) ) {
			delete props[ prop ];
			toggle = toggle || value === "toggle";
			if ( value === ( hidden ? "hide" : "show" ) ) {

				// If there is dataShow left over from a stopped hide or show
				// and we are going to proceed with show, we should pretend to be hidden
				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
					hidden = true;
				} else {
					continue;
				}
			}
			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );

		// Any non-fx value stops us from restoring the original display value
		} else {
			display = undefined;
		}
	}

	if ( !jQuery.isEmptyObject( orig ) ) {
		if ( dataShow ) {
			if ( "hidden" in dataShow ) {
				hidden = dataShow.hidden;
			}
		} else {
			dataShow = jQuery._data( elem, "fxshow", {} );
		}

		// store state if its toggle - enables .stop().toggle() to "reverse"
		if ( toggle ) {
			dataShow.hidden = !hidden;
		}
		if ( hidden ) {
			jQuery( elem ).show();
		} else {
			anim.done( function() {
				jQuery( elem ).hide();
			} );
		}
		anim.done( function() {
			var prop;
			jQuery._removeData( elem, "fxshow" );
			for ( prop in orig ) {
				jQuery.style( elem, prop, orig[ prop ] );
			}
		} );
		for ( prop in orig ) {
			tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );

			if ( !( prop in dataShow ) ) {
				dataShow[ prop ] = tween.start;
				if ( hidden ) {
					tween.end = tween.start;
					tween.start = prop === "width" || prop === "height" ? 1 : 0;
				}
			}
		}

	// If this is a noop like .hide().hide(), restore an overwritten display value
	} else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : display ) === "inline" ) {
		style.display = display;
	}
}

function propFilter( props, specialEasing ) {
	var index, name, easing, value, hooks;

	// camelCase, specialEasing and expand cssHook pass
	for ( index in props ) {
		name = jQuery.camelCase( index );
		easing = specialEasing[ name ];
		value = props[ index ];
		if ( jQuery.isArray( value ) ) {
			easing = value[ 1 ];
			value = props[ index ] = value[ 0 ];
		}

		if ( index !== name ) {
			props[ name ] = value;
			delete props[ index ];
		}

		hooks = jQuery.cssHooks[ name ];
		if ( hooks && "expand" in hooks ) {
			value = hooks.expand( value );
			delete props[ name ];

			// not quite $.extend, this wont overwrite keys already present.
			// also - reusing 'index' from above because we have the correct "name"
			for ( index in value ) {
				if ( !( index in props ) ) {
					props[ index ] = value[ index ];
					specialEasing[ index ] = easing;
				}
			}
		} else {
			specialEasing[ name ] = easing;
		}
	}
}

function Animation( elem, properties, options ) {
	var result,
		stopped,
		index = 0,
		length = Animation.prefilters.length,
		deferred = jQuery.Deferred().always( function() {

			// don't match elem in the :animated selector
			delete tick.elem;
		} ),
		tick = function() {
			if ( stopped ) {
				return false;
			}
			var currentTime = fxNow || createFxNow(),
				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),

				// Support: Android 2.3
				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
				temp = remaining / animation.duration || 0,
				percent = 1 - temp,
				index = 0,
				length = animation.tweens.length;

			for ( ; index < length ; index++ ) {
				animation.tweens[ index ].run( percent );
			}

			deferred.notifyWith( elem, [ animation, percent, remaining ] );

			if ( percent < 1 && length ) {
				return remaining;
			} else {
				deferred.resolveWith( elem, [ animation ] );
				return false;
			}
		},
		animation = deferred.promise( {
			elem: elem,
			props: jQuery.extend( {}, properties ),
			opts: jQuery.extend( true, {
				specialEasing: {},
				easing: jQuery.easing._default
			}, options ),
			originalProperties: properties,
			originalOptions: options,
			startTime: fxNow || createFxNow(),
			duration: options.duration,
			tweens: [],
			createTween: function( prop, end ) {
				var tween = jQuery.Tween( elem, animation.opts, prop, end,
						animation.opts.specialEasing[ prop ] || animation.opts.easing );
				animation.tweens.push( tween );
				return tween;
			},
			stop: function( gotoEnd ) {
				var index = 0,

					// if we are going to the end, we want to run all the tweens
					// otherwise we skip this part
					length = gotoEnd ? animation.tweens.length : 0;
				if ( stopped ) {
					return this;
				}
				stopped = true;
				for ( ; index < length ; index++ ) {
					animation.tweens[ index ].run( 1 );
				}

				// resolve when we played the last frame
				// otherwise, reject
				if ( gotoEnd ) {
					deferred.notifyWith( elem, [ animation, 1, 0 ] );
					deferred.resolveWith( elem, [ animation, gotoEnd ] );
				} else {
					deferred.rejectWith( elem, [ animation, gotoEnd ] );
				}
				return this;
			}
		} ),
		props = animation.props;

	propFilter( props, animation.opts.specialEasing );

	for ( ; index < length ; index++ ) {
		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
		if ( result ) {
			if ( jQuery.isFunction( result.stop ) ) {
				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
					jQuery.proxy( result.stop, result );
			}
			return result;
		}
	}

	jQuery.map( props, createTween, animation );

	if ( jQuery.isFunction( animation.opts.start ) ) {
		animation.opts.start.call( elem, animation );
	}

	jQuery.fx.timer(
		jQuery.extend( tick, {
			elem: elem,
			anim: animation,
			queue: animation.opts.queue
		} )
	);

	// attach callbacks from options
	return animation.progress( animation.opts.progress )
		.done( animation.opts.done, animation.opts.complete )
		.fail( animation.opts.fail )
		.always( animation.opts.always );
}

jQuery.Animation = jQuery.extend( Animation, {

	tweeners: {
		"*": [ function( prop, value ) {
			var tween = this.createTween( prop, value );
			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
			return tween;
		} ]
	},

	tweener: function( props, callback ) {
		if ( jQuery.isFunction( props ) ) {
			callback = props;
			props = [ "*" ];
		} else {
			props = props.match( rnotwhite );
		}

		var prop,
			index = 0,
			length = props.length;

		for ( ; index < length ; index++ ) {
			prop = props[ index ];
			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
			Animation.tweeners[ prop ].unshift( callback );
		}
	},

	prefilters: [ defaultPrefilter ],

	prefilter: function( callback, prepend ) {
		if ( prepend ) {
			Animation.prefilters.unshift( callback );
		} else {
			Animation.prefilters.push( callback );
		}
	}
} );

jQuery.speed = function( speed, easing, fn ) {
	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
		complete: fn || !fn && easing ||
			jQuery.isFunction( speed ) && speed,
		duration: speed,
		easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
	};

	opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
		opt.duration in jQuery.fx.speeds ?
			jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;

	// normalize opt.queue - true/undefined/null -> "fx"
	if ( opt.queue == null || opt.queue === true ) {
		opt.queue = "fx";
	}

	// Queueing
	opt.old = opt.complete;

	opt.complete = function() {
		if ( jQuery.isFunction( opt.old ) ) {
			opt.old.call( this );
		}

		if ( opt.queue ) {
			jQuery.dequeue( this, opt.queue );
		}
	};

	return opt;
};

jQuery.fn.extend( {
	fadeTo: function( speed, to, easing, callback ) {

		// show any hidden elements after setting opacity to 0
		return this.filter( isHidden ).css( "opacity", 0 ).show()

			// animate to the value specified
			.end().animate( { opacity: to }, speed, easing, callback );
	},
	animate: function( prop, speed, easing, callback ) {
		var empty = jQuery.isEmptyObject( prop ),
			optall = jQuery.speed( speed, easing, callback ),
			doAnimation = function() {

				// Operate on a copy of prop so per-property easing won't be lost
				var anim = Animation( this, jQuery.extend( {}, prop ), optall );

				// Empty animations, or finishing resolves immediately
				if ( empty || jQuery._data( this, "finish" ) ) {
					anim.stop( true );
				}
			};
			doAnimation.finish = doAnimation;

		return empty || optall.queue === false ?
			this.each( doAnimation ) :
			this.queue( optall.queue, doAnimation );
	},
	stop: function( type, clearQueue, gotoEnd ) {
		var stopQueue = function( hooks ) {
			var stop = hooks.stop;
			delete hooks.stop;
			stop( gotoEnd );
		};

		if ( typeof type !== "string" ) {
			gotoEnd = clearQueue;
			clearQueue = type;
			type = undefined;
		}
		if ( clearQueue && type !== false ) {
			this.queue( type || "fx", [] );
		}

		return this.each( function() {
			var dequeue = true,
				index = type != null && type + "queueHooks",
				timers = jQuery.timers,
				data = jQuery._data( this );

			if ( index ) {
				if ( data[ index ] && data[ index ].stop ) {
					stopQueue( data[ index ] );
				}
			} else {
				for ( index in data ) {
					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
						stopQueue( data[ index ] );
					}
				}
			}

			for ( index = timers.length; index--; ) {
				if ( timers[ index ].elem === this &&
					( type == null || timers[ index ].queue === type ) ) {

					timers[ index ].anim.stop( gotoEnd );
					dequeue = false;
					timers.splice( index, 1 );
				}
			}

			// start the next in the queue if the last step wasn't forced
			// timers currently will call their complete callbacks, which will dequeue
			// but only if they were gotoEnd
			if ( dequeue || !gotoEnd ) {
				jQuery.dequeue( this, type );
			}
		} );
	},
	finish: function( type ) {
		if ( type !== false ) {
			type = type || "fx";
		}
		return this.each( function() {
			var index,
				data = jQuery._data( this ),
				queue = data[ type + "queue" ],
				hooks = data[ type + "queueHooks" ],
				timers = jQuery.timers,
				length = queue ? queue.length : 0;

			// enable finishing flag on private data
			data.finish = true;

			// empty the queue first
			jQuery.queue( this, type, [] );

			if ( hooks && hooks.stop ) {
				hooks.stop.call( this, true );
			}

			// look for any active animations, and finish them
			for ( index = timers.length; index--; ) {
				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
					timers[ index ].anim.stop( true );
					timers.splice( index, 1 );
				}
			}

			// look for any animations in the old queue and finish them
			for ( index = 0; index < length; index++ ) {
				if ( queue[ index ] && queue[ index ].finish ) {
					queue[ index ].finish.call( this );
				}
			}

			// turn off finishing flag
			delete data.finish;
		} );
	}
} );

jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
	var cssFn = jQuery.fn[ name ];
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return speed == null || typeof speed === "boolean" ?
			cssFn.apply( this, arguments ) :
			this.animate( genFx( name, true ), speed, easing, callback );
	};
} );

// Generate shortcuts for custom animations
jQuery.each( {
	slideDown: genFx( "show" ),
	slideUp: genFx( "hide" ),
	slideToggle: genFx( "toggle" ),
	fadeIn: { opacity: "show" },
	fadeOut: { opacity: "hide" },
	fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return this.animate( props, speed, easing, callback );
	};
} );

jQuery.timers = [];
jQuery.fx.tick = function() {
	var timer,
		timers = jQuery.timers,
		i = 0;

	fxNow = jQuery.now();

	for ( ; i < timers.length; i++ ) {
		timer = timers[ i ];

		// Checks the timer has not already been removed
		if ( !timer() && timers[ i ] === timer ) {
			timers.splice( i--, 1 );
		}
	}

	if ( !timers.length ) {
		jQuery.fx.stop();
	}
	fxNow = undefined;
};

jQuery.fx.timer = function( timer ) {
	jQuery.timers.push( timer );
	if ( timer() ) {
		jQuery.fx.start();
	} else {
		jQuery.timers.pop();
	}
};

jQuery.fx.interval = 13;

jQuery.fx.start = function() {
	if ( !timerId ) {
		timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
	}
};

jQuery.fx.stop = function() {
	window.clearInterval( timerId );
	timerId = null;
};

jQuery.fx.speeds = {
	slow: 600,
	fast: 200,

	// Default speed
	_default: 400
};


// Based off of the plugin by Clint Helfers, with permission.
// http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function( time, type ) {
	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
	type = type || "fx";

	return this.queue( type, function( next, hooks ) {
		var timeout = window.setTimeout( next, time );
		hooks.stop = function() {
			window.clearTimeout( timeout );
		};
	} );
};


( function() {
	var a,
		input = document.createElement( "input" ),
		div = document.createElement( "div" ),
		select = document.createElement( "select" ),
		opt = select.appendChild( document.createElement( "option" ) );

	// Setup
	div = document.createElement( "div" );
	div.setAttribute( "className", "t" );
	div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
	a = div.getElementsByTagName( "a" )[ 0 ];

	// Support: Windows Web Apps (WWA)
	// `type` must use .setAttribute for WWA (#14901)
	input.setAttribute( "type", "checkbox" );
	div.appendChild( input );

	a = div.getElementsByTagName( "a" )[ 0 ];

	// First batch of tests.
	a.style.cssText = "top:1px";

	// Test setAttribute on camelCase class.
	// If it works, we need attrFixes when doing get/setAttribute (ie6/7)
	support.getSetAttribute = div.className !== "t";

	// Get the style information from getAttribute
	// (IE uses .cssText instead)
	support.style = /top/.test( a.getAttribute( "style" ) );

	// Make sure that URLs aren't manipulated
	// (IE normalizes it by default)
	support.hrefNormalized = a.getAttribute( "href" ) === "/a";

	// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
	support.checkOn = !!input.value;

	// Make sure that a selected-by-default option has a working selected property.
	// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
	support.optSelected = opt.selected;

	// Tests for enctype support on a form (#6743)
	support.enctype = !!document.createElement( "form" ).enctype;

	// Make sure that the options inside disabled selects aren't marked as disabled
	// (WebKit marks them as disabled)
	select.disabled = true;
	support.optDisabled = !opt.disabled;

	// Support: IE8 only
	// Check if we can trust getAttribute("value")
	input = document.createElement( "input" );
	input.setAttribute( "value", "" );
	support.input = input.getAttribute( "value" ) === "";

	// Check if an input maintains its value after becoming a radio
	input.value = "t";
	input.setAttribute( "type", "radio" );
	support.radioValue = input.value === "t";
} )();


var rreturn = /\r/g,
	rspaces = /[\x20\t\r\n\f]+/g;

jQuery.fn.extend( {
	val: function( value ) {
		var hooks, ret, isFunction,
			elem = this[ 0 ];

		if ( !arguments.length ) {
			if ( elem ) {
				hooks = jQuery.valHooks[ elem.type ] ||
					jQuery.valHooks[ elem.nodeName.toLowerCase() ];

				if (
					hooks &&
					"get" in hooks &&
					( ret = hooks.get( elem, "value" ) ) !== undefined
				) {
					return ret;
				}

				ret = elem.value;

				return typeof ret === "string" ?

					// handle most common string cases
					ret.replace( rreturn, "" ) :

					// handle cases where value is null/undef or number
					ret == null ? "" : ret;
			}

			return;
		}

		isFunction = jQuery.isFunction( value );

		return this.each( function( i ) {
			var val;

			if ( this.nodeType !== 1 ) {
				return;
			}

			if ( isFunction ) {
				val = value.call( this, i, jQuery( this ).val() );
			} else {
				val = value;
			}

			// Treat null/undefined as ""; convert numbers to string
			if ( val == null ) {
				val = "";
			} else if ( typeof val === "number" ) {
				val += "";
			} else if ( jQuery.isArray( val ) ) {
				val = jQuery.map( val, function( value ) {
					return value == null ? "" : value + "";
				} );
			}

			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];

			// If set returns undefined, fall back to normal setting
			if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
				this.value = val;
			}
		} );
	}
} );

jQuery.extend( {
	valHooks: {
		option: {
			get: function( elem ) {
				var val = jQuery.find.attr( elem, "value" );
				return val != null ?
					val :

					// Support: IE10-11+
					// option.text throws exceptions (#14686, #14858)
					// Strip and collapse whitespace
					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
					jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
			}
		},
		select: {
			get: function( elem ) {
				var value, option,
					options = elem.options,
					index = elem.selectedIndex,
					one = elem.type === "select-one" || index < 0,
					values = one ? null : [],
					max = one ? index + 1 : options.length,
					i = index < 0 ?
						max :
						one ? index : 0;

				// Loop through all the selected options
				for ( ; i < max; i++ ) {
					option = options[ i ];

					// oldIE doesn't update selected after form reset (#2551)
					if ( ( option.selected || i === index ) &&

							// Don't return options that are disabled or in a disabled optgroup
							( support.optDisabled ?
								!option.disabled :
								option.getAttribute( "disabled" ) === null ) &&
							( !option.parentNode.disabled ||
								!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {

						// Get the specific value for the option
						value = jQuery( option ).val();

						// We don't need an array for one selects
						if ( one ) {
							return value;
						}

						// Multi-Selects return an array
						values.push( value );
					}
				}

				return values;
			},

			set: function( elem, value ) {
				var optionSet, option,
					options = elem.options,
					values = jQuery.makeArray( value ),
					i = options.length;

				while ( i-- ) {
					option = options[ i ];

					if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) {

						// Support: IE6
						// When new option element is added to select box we need to
						// force reflow of newly added node in order to workaround delay
						// of initialization properties
						try {
							option.selected = optionSet = true;

						} catch ( _ ) {

							// Will be executed only in IE6
							option.scrollHeight;
						}

					} else {
						option.selected = false;
					}
				}

				// Force browsers to behave consistently when non-matching value is set
				if ( !optionSet ) {
					elem.selectedIndex = -1;
				}

				return options;
			}
		}
	}
} );

// Radios and checkboxes getter/setter
jQuery.each( [ "radio", "checkbox" ], function() {
	jQuery.valHooks[ this ] = {
		set: function( elem, value ) {
			if ( jQuery.isArray( value ) ) {
				return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
			}
		}
	};
	if ( !support.checkOn ) {
		jQuery.valHooks[ this ].get = function( elem ) {
			return elem.getAttribute( "value" ) === null ? "on" : elem.value;
		};
	}
} );




var nodeHook, boolHook,
	attrHandle = jQuery.expr.attrHandle,
	ruseDefault = /^(?:checked|selected)$/i,
	getSetAttribute = support.getSetAttribute,
	getSetInput = support.input;

jQuery.fn.extend( {
	attr: function( name, value ) {
		return access( this, jQuery.attr, name, value, arguments.length > 1 );
	},

	removeAttr: function( name ) {
		return this.each( function() {
			jQuery.removeAttr( this, name );
		} );
	}
} );

jQuery.extend( {
	attr: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set attributes on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		// Fallback to prop when attributes are not supported
		if ( typeof elem.getAttribute === "undefined" ) {
			return jQuery.prop( elem, name, value );
		}

		// All attributes are lowercase
		// Grab necessary hook if one is defined
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
			name = name.toLowerCase();
			hooks = jQuery.attrHooks[ name ] ||
				( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
		}

		if ( value !== undefined ) {
			if ( value === null ) {
				jQuery.removeAttr( elem, name );
				return;
			}

			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			elem.setAttribute( name, value + "" );
			return value;
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		ret = jQuery.find.attr( elem, name );

		// Non-existent attributes return null, we normalize to undefined
		return ret == null ? undefined : ret;
	},

	attrHooks: {
		type: {
			set: function( elem, value ) {
				if ( !support.radioValue && value === "radio" &&
					jQuery.nodeName( elem, "input" ) ) {

					// Setting the type on a radio button after the value resets the value in IE8-9
					// Reset value to default in case type is set after value during creation
					var val = elem.value;
					elem.setAttribute( "type", value );
					if ( val ) {
						elem.value = val;
					}
					return value;
				}
			}
		}
	},

	removeAttr: function( elem, value ) {
		var name, propName,
			i = 0,
			attrNames = value && value.match( rnotwhite );

		if ( attrNames && elem.nodeType === 1 ) {
			while ( ( name = attrNames[ i++ ] ) ) {
				propName = jQuery.propFix[ name ] || name;

				// Boolean attributes get special treatment (#10870)
				if ( jQuery.expr.match.bool.test( name ) ) {

					// Set corresponding property to false
					if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
						elem[ propName ] = false;

					// Support: IE<9
					// Also clear defaultChecked/defaultSelected (if appropriate)
					} else {
						elem[ jQuery.camelCase( "default-" + name ) ] =
							elem[ propName ] = false;
					}

				// See #9699 for explanation of this approach (setting first, then removal)
				} else {
					jQuery.attr( elem, name, "" );
				}

				elem.removeAttribute( getSetAttribute ? name : propName );
			}
		}
	}
} );

// Hooks for boolean attributes
boolHook = {
	set: function( elem, value, name ) {
		if ( value === false ) {

			// Remove boolean attributes when set to false
			jQuery.removeAttr( elem, name );
		} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {

			// IE<8 needs the *property* name
			elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );

		} else {

			// Support: IE<9
			// Use defaultChecked and defaultSelected for oldIE
			elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
		}
		return name;
	}
};

jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
	var getter = attrHandle[ name ] || jQuery.find.attr;

	if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
		attrHandle[ name ] = function( elem, name, isXML ) {
			var ret, handle;
			if ( !isXML ) {

				// Avoid an infinite loop by temporarily removing this function from the getter
				handle = attrHandle[ name ];
				attrHandle[ name ] = ret;
				ret = getter( elem, name, isXML ) != null ?
					name.toLowerCase() :
					null;
				attrHandle[ name ] = handle;
			}
			return ret;
		};
	} else {
		attrHandle[ name ] = function( elem, name, isXML ) {
			if ( !isXML ) {
				return elem[ jQuery.camelCase( "default-" + name ) ] ?
					name.toLowerCase() :
					null;
			}
		};
	}
} );

// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
	jQuery.attrHooks.value = {
		set: function( elem, value, name ) {
			if ( jQuery.nodeName( elem, "input" ) ) {

				// Does not return so that setAttribute is also used
				elem.defaultValue = value;
			} else {

				// Use nodeHook if defined (#1954); otherwise setAttribute is fine
				return nodeHook && nodeHook.set( elem, value, name );
			}
		}
	};
}

// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {

	// Use this for any attribute in IE6/7
	// This fixes almost every IE6/7 issue
	nodeHook = {
		set: function( elem, value, name ) {

			// Set the existing or create a new attribute node
			var ret = elem.getAttributeNode( name );
			if ( !ret ) {
				elem.setAttributeNode(
					( ret = elem.ownerDocument.createAttribute( name ) )
				);
			}

			ret.value = value += "";

			// Break association with cloned elements by also using setAttribute (#9646)
			if ( name === "value" || value === elem.getAttribute( name ) ) {
				return value;
			}
		}
	};

	// Some attributes are constructed with empty-string values when not defined
	attrHandle.id = attrHandle.name = attrHandle.coords =
		function( elem, name, isXML ) {
			var ret;
			if ( !isXML ) {
				return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
					ret.value :
					null;
			}
		};

	// Fixing value retrieval on a button requires this module
	jQuery.valHooks.button = {
		get: function( elem, name ) {
			var ret = elem.getAttributeNode( name );
			if ( ret && ret.specified ) {
				return ret.value;
			}
		},
		set: nodeHook.set
	};

	// Set contenteditable to false on removals(#10429)
	// Setting to empty string throws an error as an invalid value
	jQuery.attrHooks.contenteditable = {
		set: function( elem, value, name ) {
			nodeHook.set( elem, value === "" ? false : value, name );
		}
	};

	// Set width and height to auto instead of 0 on empty string( Bug #8150 )
	// This is for removals
	jQuery.each( [ "width", "height" ], function( i, name ) {
		jQuery.attrHooks[ name ] = {
			set: function( elem, value ) {
				if ( value === "" ) {
					elem.setAttribute( name, "auto" );
					return value;
				}
			}
		};
	} );
}

if ( !support.style ) {
	jQuery.attrHooks.style = {
		get: function( elem ) {

			// Return undefined in the case of empty string
			// Note: IE uppercases css property names, but if we were to .toLowerCase()
			// .cssText, that would destroy case sensitivity in URL's, like in "background"
			return elem.style.cssText || undefined;
		},
		set: function( elem, value ) {
			return ( elem.style.cssText = value + "" );
		}
	};
}




var rfocusable = /^(?:input|select|textarea|button|object)$/i,
	rclickable = /^(?:a|area)$/i;

jQuery.fn.extend( {
	prop: function( name, value ) {
		return access( this, jQuery.prop, name, value, arguments.length > 1 );
	},

	removeProp: function( name ) {
		name = jQuery.propFix[ name ] || name;
		return this.each( function() {

			// try/catch handles cases where IE balks (such as removing a property on window)
			try {
				this[ name ] = undefined;
				delete this[ name ];
			} catch ( e ) {}
		} );
	}
} );

jQuery.extend( {
	prop: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set properties on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {

			// Fix name and attach hooks
			name = jQuery.propFix[ name ] || name;
			hooks = jQuery.propHooks[ name ];
		}

		if ( value !== undefined ) {
			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			return ( elem[ name ] = value );
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		return elem[ name ];
	},

	propHooks: {
		tabIndex: {
			get: function( elem ) {

				// elem.tabIndex doesn't always return the
				// correct value when it hasn't been explicitly set
				// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
				// Use proper attribute retrieval(#12072)
				var tabindex = jQuery.find.attr( elem, "tabindex" );

				return tabindex ?
					parseInt( tabindex, 10 ) :
					rfocusable.test( elem.nodeName ) ||
						rclickable.test( elem.nodeName ) && elem.href ?
							0 :
							-1;
			}
		}
	},

	propFix: {
		"for": "htmlFor",
		"class": "className"
	}
} );

// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !support.hrefNormalized ) {

	// href/src property should get the full normalized URL (#10299/#12915)
	jQuery.each( [ "href", "src" ], function( i, name ) {
		jQuery.propHooks[ name ] = {
			get: function( elem ) {
				return elem.getAttribute( name, 4 );
			}
		};
	} );
}

// Support: Safari, IE9+
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
if ( !support.optSelected ) {
	jQuery.propHooks.selected = {
		get: function( elem ) {
			var parent = elem.parentNode;

			if ( parent ) {
				parent.selectedIndex;

				// Make sure that it also works with optgroups, see #5701
				if ( parent.parentNode ) {
					parent.parentNode.selectedIndex;
				}
			}
			return null;
		},
		set: function( elem ) {
			var parent = elem.parentNode;
			if ( parent ) {
				parent.selectedIndex;

				if ( parent.parentNode ) {
					parent.parentNode.selectedIndex;
				}
			}
		}
	};
}

jQuery.each( [
	"tabIndex",
	"readOnly",
	"maxLength",
	"cellSpacing",
	"cellPadding",
	"rowSpan",
	"colSpan",
	"useMap",
	"frameBorder",
	"contentEditable"
], function() {
	jQuery.propFix[ this.toLowerCase() ] = this;
} );

// IE6/7 call enctype encoding
if ( !support.enctype ) {
	jQuery.propFix.enctype = "encoding";
}




var rclass = /[\t\r\n\f]/g;

function getClass( elem ) {
	return jQuery.attr( elem, "class" ) || "";
}

jQuery.fn.extend( {
	addClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( jQuery.isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		if ( typeof value === "string" && value ) {
			classes = value.match( rnotwhite ) || [];

			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );
				cur = elem.nodeType === 1 &&
					( " " + curValue + " " ).replace( rclass, " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {
						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
							cur += clazz + " ";
						}
					}

					// only assign if different to avoid unneeded rendering.
					finalValue = jQuery.trim( cur );
					if ( curValue !== finalValue ) {
						jQuery.attr( elem, "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	removeClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( jQuery.isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		if ( !arguments.length ) {
			return this.attr( "class", "" );
		}

		if ( typeof value === "string" && value ) {
			classes = value.match( rnotwhite ) || [];

			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );

				// This expression is here for better compressibility (see addClass)
				cur = elem.nodeType === 1 &&
					( " " + curValue + " " ).replace( rclass, " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {

						// Remove *all* instances
						while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
							cur = cur.replace( " " + clazz + " ", " " );
						}
					}

					// Only assign if different to avoid unneeded rendering.
					finalValue = jQuery.trim( cur );
					if ( curValue !== finalValue ) {
						jQuery.attr( elem, "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	toggleClass: function( value, stateVal ) {
		var type = typeof value;

		if ( typeof stateVal === "boolean" && type === "string" ) {
			return stateVal ? this.addClass( value ) : this.removeClass( value );
		}

		if ( jQuery.isFunction( value ) ) {
			return this.each( function( i ) {
				jQuery( this ).toggleClass(
					value.call( this, i, getClass( this ), stateVal ),
					stateVal
				);
			} );
		}

		return this.each( function() {
			var className, i, self, classNames;

			if ( type === "string" ) {

				// Toggle individual class names
				i = 0;
				self = jQuery( this );
				classNames = value.match( rnotwhite ) || [];

				while ( ( className = classNames[ i++ ] ) ) {

					// Check each className given, space separated list
					if ( self.hasClass( className ) ) {
						self.removeClass( className );
					} else {
						self.addClass( className );
					}
				}

			// Toggle whole class name
			} else if ( value === undefined || type === "boolean" ) {
				className = getClass( this );
				if ( className ) {

					// store className if set
					jQuery._data( this, "__className__", className );
				}

				// If the element has a class name or if we're passed "false",
				// then remove the whole classname (if there was one, the above saved it).
				// Otherwise bring back whatever was previously saved (if anything),
				// falling back to the empty string if nothing was stored.
				jQuery.attr( this, "class",
					className || value === false ?
					"" :
					jQuery._data( this, "__className__" ) || ""
				);
			}
		} );
	},

	hasClass: function( selector ) {
		var className, elem,
			i = 0;

		className = " " + selector + " ";
		while ( ( elem = this[ i++ ] ) ) {
			if ( elem.nodeType === 1 &&
				( " " + getClass( elem ) + " " ).replace( rclass, " " )
					.indexOf( className ) > -1
			) {
				return true;
			}
		}

		return false;
	}
} );




// Return jQuery for attributes-only inclusion


jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
	"change select submit keydown keypress keyup error contextmenu" ).split( " " ),
	function( i, name ) {

	// Handle event binding
	jQuery.fn[ name ] = function( data, fn ) {
		return arguments.length > 0 ?
			this.on( name, null, data, fn ) :
			this.trigger( name );
	};
} );

jQuery.fn.extend( {
	hover: function( fnOver, fnOut ) {
		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
	}
} );


var location = window.location;

var nonce = jQuery.now();

var rquery = ( /\?/ );



var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;

jQuery.parseJSON = function( data ) {

	// Attempt to parse using the native JSON parser first
	if ( window.JSON && window.JSON.parse ) {

		// Support: Android 2.3
		// Workaround failure to string-cast null input
		return window.JSON.parse( data + "" );
	}

	var requireNonComma,
		depth = null,
		str = jQuery.trim( data + "" );

	// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
	// after removing valid tokens
	return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {

		// Force termination if we see a misplaced comma
		if ( requireNonComma && comma ) {
			depth = 0;
		}

		// Perform no more replacements after returning to outermost depth
		if ( depth === 0 ) {
			return token;
		}

		// Commas must not follow "[", "{", or ","
		requireNonComma = open || comma;

		// Determine new depth
		// array/object open ("[" or "{"): depth += true - false (increment)
		// array/object close ("]" or "}"): depth += false - true (decrement)
		// other cases ("," or primitive): depth += true - true (numeric cast)
		depth += !close - !open;

		// Remove this token
		return "";
	} ) ) ?
		( Function( "return " + str ) )() :
		jQuery.error( "Invalid JSON: " + data );
};


// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
	var xml, tmp;
	if ( !data || typeof data !== "string" ) {
		return null;
	}
	try {
		if ( window.DOMParser ) { // Standard
			tmp = new window.DOMParser();
			xml = tmp.parseFromString( data, "text/xml" );
		} else { // IE
			xml = new window.ActiveXObject( "Microsoft.XMLDOM" );
			xml.async = "false";
			xml.loadXML( data );
		}
	} catch ( e ) {
		xml = undefined;
	}
	if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
		jQuery.error( "Invalid XML: " + data );
	}
	return xml;
};


var
	rhash = /#.*$/,
	rts = /([?&])_=[^&]*/,

	// IE leaves an \r character at EOL
	rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,

	// #7653, #8125, #8152: local protocol detection
	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
	rnoContent = /^(?:GET|HEAD)$/,
	rprotocol = /^\/\//,
	rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,

	/* Prefilters
	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
	 * 2) These are called:
	 *    - BEFORE asking for a transport
	 *    - AFTER param serialization (s.data is a string if s.processData is true)
	 * 3) key is the dataType
	 * 4) the catchall symbol "*" can be used
	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
	 */
	prefilters = {},

	/* Transports bindings
	 * 1) key is the dataType
	 * 2) the catchall symbol "*" can be used
	 * 3) selection will start with transport dataType and THEN go to "*" if needed
	 */
	transports = {},

	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
	allTypes = "*/".concat( "*" ),

	// Document location
	ajaxLocation = location.href,

	// Segment location into parts
	ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];

// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {

	// dataTypeExpression is optional and defaults to "*"
	return function( dataTypeExpression, func ) {

		if ( typeof dataTypeExpression !== "string" ) {
			func = dataTypeExpression;
			dataTypeExpression = "*";
		}

		var dataType,
			i = 0,
			dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];

		if ( jQuery.isFunction( func ) ) {

			// For each dataType in the dataTypeExpression
			while ( ( dataType = dataTypes[ i++ ] ) ) {

				// Prepend if requested
				if ( dataType.charAt( 0 ) === "+" ) {
					dataType = dataType.slice( 1 ) || "*";
					( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );

				// Otherwise append
				} else {
					( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
				}
			}
		}
	};
}

// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {

	var inspected = {},
		seekingTransport = ( structure === transports );

	function inspect( dataType ) {
		var selected;
		inspected[ dataType ] = true;
		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
			if ( typeof dataTypeOrTransport === "string" &&
				!seekingTransport && !inspected[ dataTypeOrTransport ] ) {

				options.dataTypes.unshift( dataTypeOrTransport );
				inspect( dataTypeOrTransport );
				return false;
			} else if ( seekingTransport ) {
				return !( selected = dataTypeOrTransport );
			}
		} );
		return selected;
	}

	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}

// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
	var deep, key,
		flatOptions = jQuery.ajaxSettings.flatOptions || {};

	for ( key in src ) {
		if ( src[ key ] !== undefined ) {
			( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
		}
	}
	if ( deep ) {
		jQuery.extend( true, target, deep );
	}

	return target;
}

/* Handles responses to an ajax request:
 * - finds the right dataType (mediates between content-type and expected dataType)
 * - returns the corresponding response
 */
function ajaxHandleResponses( s, jqXHR, responses ) {
	var firstDataType, ct, finalDataType, type,
		contents = s.contents,
		dataTypes = s.dataTypes;

	// Remove auto dataType and get content-type in the process
	while ( dataTypes[ 0 ] === "*" ) {
		dataTypes.shift();
		if ( ct === undefined ) {
			ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
		}
	}

	// Check if we're dealing with a known content-type
	if ( ct ) {
		for ( type in contents ) {
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
				dataTypes.unshift( type );
				break;
			}
		}
	}

	// Check to see if we have a response for the expected dataType
	if ( dataTypes[ 0 ] in responses ) {
		finalDataType = dataTypes[ 0 ];
	} else {

		// Try convertible dataTypes
		for ( type in responses ) {
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
				finalDataType = type;
				break;
			}
			if ( !firstDataType ) {
				firstDataType = type;
			}
		}

		// Or just use first one
		finalDataType = finalDataType || firstDataType;
	}

	// If we found a dataType
	// We add the dataType to the list if needed
	// and return the corresponding response
	if ( finalDataType ) {
		if ( finalDataType !== dataTypes[ 0 ] ) {
			dataTypes.unshift( finalDataType );
		}
		return responses[ finalDataType ];
	}
}

/* Chain conversions given the request and the original response
 * Also sets the responseXXX fields on the jqXHR instance
 */
function ajaxConvert( s, response, jqXHR, isSuccess ) {
	var conv2, current, conv, tmp, prev,
		converters = {},

		// Work with a copy of dataTypes in case we need to modify it for conversion
		dataTypes = s.dataTypes.slice();

	// Create converters map with lowercased keys
	if ( dataTypes[ 1 ] ) {
		for ( conv in s.converters ) {
			converters[ conv.toLowerCase() ] = s.converters[ conv ];
		}
	}

	current = dataTypes.shift();

	// Convert to each sequential dataType
	while ( current ) {

		if ( s.responseFields[ current ] ) {
			jqXHR[ s.responseFields[ current ] ] = response;
		}

		// Apply the dataFilter if provided
		if ( !prev && isSuccess && s.dataFilter ) {
			response = s.dataFilter( response, s.dataType );
		}

		prev = current;
		current = dataTypes.shift();

		if ( current ) {

			// There's only work to do if current dataType is non-auto
			if ( current === "*" ) {

				current = prev;

			// Convert response if prev dataType is non-auto and differs from current
			} else if ( prev !== "*" && prev !== current ) {

				// Seek a direct converter
				conv = converters[ prev + " " + current ] || converters[ "* " + current ];

				// If none found, seek a pair
				if ( !conv ) {
					for ( conv2 in converters ) {

						// If conv2 outputs current
						tmp = conv2.split( " " );
						if ( tmp[ 1 ] === current ) {

							// If prev can be converted to accepted input
							conv = converters[ prev + " " + tmp[ 0 ] ] ||
								converters[ "* " + tmp[ 0 ] ];
							if ( conv ) {

								// Condense equivalence converters
								if ( conv === true ) {
									conv = converters[ conv2 ];

								// Otherwise, insert the intermediate dataType
								} else if ( converters[ conv2 ] !== true ) {
									current = tmp[ 0 ];
									dataTypes.unshift( tmp[ 1 ] );
								}
								break;
							}
						}
					}
				}

				// Apply converter (if not an equivalence)
				if ( conv !== true ) {

					// Unless errors are allowed to bubble, catch and return them
					if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation
						response = conv( response );
					} else {
						try {
							response = conv( response );
						} catch ( e ) {
							return {
								state: "parsererror",
								error: conv ? e : "No conversion from " + prev + " to " + current
							};
						}
					}
				}
			}
		}
	}

	return { state: "success", data: response };
}

jQuery.extend( {

	// Counter for holding the number of active queries
	active: 0,

	// Last-Modified header cache for next request
	lastModified: {},
	etag: {},

	ajaxSettings: {
		url: ajaxLocation,
		type: "GET",
		isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
		global: true,
		processData: true,
		async: true,
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
		/*
		timeout: 0,
		data: null,
		dataType: null,
		username: null,
		password: null,
		cache: null,
		throws: false,
		traditional: false,
		headers: {},
		*/

		accepts: {
			"*": allTypes,
			text: "text/plain",
			html: "text/html",
			xml: "application/xml, text/xml",
			json: "application/json, text/javascript"
		},

		contents: {
			xml: /\bxml\b/,
			html: /\bhtml/,
			json: /\bjson\b/
		},

		responseFields: {
			xml: "responseXML",
			text: "responseText",
			json: "responseJSON"
		},

		// Data converters
		// Keys separate source (or catchall "*") and destination types with a single space
		converters: {

			// Convert anything to text
			"* text": String,

			// Text to html (true = no transformation)
			"text html": true,

			// Evaluate text as a json expression
			"text json": jQuery.parseJSON,

			// Parse text as xml
			"text xml": jQuery.parseXML
		},

		// For options that shouldn't be deep extended:
		// you can add your own custom options here if
		// and when you create one that shouldn't be
		// deep extended (see ajaxExtend)
		flatOptions: {
			url: true,
			context: true
		}
	},

	// Creates a full fledged settings object into target
	// with both ajaxSettings and settings fields.
	// If target is omitted, writes into ajaxSettings.
	ajaxSetup: function( target, settings ) {
		return settings ?

			// Building a settings object
			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :

			// Extending ajaxSettings
			ajaxExtend( jQuery.ajaxSettings, target );
	},

	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
	ajaxTransport: addToPrefiltersOrTransports( transports ),

	// Main method
	ajax: function( url, options ) {

		// If url is an object, simulate pre-1.5 signature
		if ( typeof url === "object" ) {
			options = url;
			url = undefined;
		}

		// Force options to be an object
		options = options || {};

		var

			// Cross-domain detection vars
			parts,

			// Loop variable
			i,

			// URL without anti-cache param
			cacheURL,

			// Response headers as string
			responseHeadersString,

			// timeout handle
			timeoutTimer,

			// To know if global events are to be dispatched
			fireGlobals,

			transport,

			// Response headers
			responseHeaders,

			// Create the final options object
			s = jQuery.ajaxSetup( {}, options ),

			// Callbacks context
			callbackContext = s.context || s,

			// Context for global events is callbackContext if it is a DOM node or jQuery collection
			globalEventContext = s.context &&
				( callbackContext.nodeType || callbackContext.jquery ) ?
					jQuery( callbackContext ) :
					jQuery.event,

			// Deferreds
			deferred = jQuery.Deferred(),
			completeDeferred = jQuery.Callbacks( "once memory" ),

			// Status-dependent callbacks
			statusCode = s.statusCode || {},

			// Headers (they are sent all at once)
			requestHeaders = {},
			requestHeadersNames = {},

			// The jqXHR state
			state = 0,

			// Default abort message
			strAbort = "canceled",

			// Fake xhr
			jqXHR = {
				readyState: 0,

				// Builds headers hashtable if needed
				getResponseHeader: function( key ) {
					var match;
					if ( state === 2 ) {
						if ( !responseHeaders ) {
							responseHeaders = {};
							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
								responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
							}
						}
						match = responseHeaders[ key.toLowerCase() ];
					}
					return match == null ? null : match;
				},

				// Raw string
				getAllResponseHeaders: function() {
					return state === 2 ? responseHeadersString : null;
				},

				// Caches the header
				setRequestHeader: function( name, value ) {
					var lname = name.toLowerCase();
					if ( !state ) {
						name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
						requestHeaders[ name ] = value;
					}
					return this;
				},

				// Overrides response content-type header
				overrideMimeType: function( type ) {
					if ( !state ) {
						s.mimeType = type;
					}
					return this;
				},

				// Status-dependent callbacks
				statusCode: function( map ) {
					var code;
					if ( map ) {
						if ( state < 2 ) {
							for ( code in map ) {

								// Lazy-add the new callback in a way that preserves old ones
								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
							}
						} else {

							// Execute the appropriate callbacks
							jqXHR.always( map[ jqXHR.status ] );
						}
					}
					return this;
				},

				// Cancel the request
				abort: function( statusText ) {
					var finalText = statusText || strAbort;
					if ( transport ) {
						transport.abort( finalText );
					}
					done( 0, finalText );
					return this;
				}
			};

		// Attach deferreds
		deferred.promise( jqXHR ).complete = completeDeferred.add;
		jqXHR.success = jqXHR.done;
		jqXHR.error = jqXHR.fail;

		// Remove hash character (#7531: and string promotion)
		// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
		// Handle falsy url in the settings object (#10093: consistency with old signature)
		// We also use the url parameter if available
		s.url = ( ( url || s.url || ajaxLocation ) + "" )
			.replace( rhash, "" )
			.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );

		// Alias method option to type as per ticket #12004
		s.type = options.method || options.type || s.method || s.type;

		// Extract dataTypes list
		s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];

		// A cross-domain request is in order when we have a protocol:host:port mismatch
		if ( s.crossDomain == null ) {
			parts = rurl.exec( s.url.toLowerCase() );
			s.crossDomain = !!( parts &&
				( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
					( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
						( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
			);
		}

		// Convert data if not already a string
		if ( s.data && s.processData && typeof s.data !== "string" ) {
			s.data = jQuery.param( s.data, s.traditional );
		}

		// Apply prefilters
		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );

		// If request was aborted inside a prefilter, stop there
		if ( state === 2 ) {
			return jqXHR;
		}

		// We can fire global events as of now if asked to
		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
		fireGlobals = jQuery.event && s.global;

		// Watch for a new set of requests
		if ( fireGlobals && jQuery.active++ === 0 ) {
			jQuery.event.trigger( "ajaxStart" );
		}

		// Uppercase the type
		s.type = s.type.toUpperCase();

		// Determine if request has content
		s.hasContent = !rnoContent.test( s.type );

		// Save the URL in case we're toying with the If-Modified-Since
		// and/or If-None-Match header later on
		cacheURL = s.url;

		// More options handling for requests with no content
		if ( !s.hasContent ) {

			// If data is available, append data to url
			if ( s.data ) {
				cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );

				// #9682: remove data so that it's not used in an eventual retry
				delete s.data;
			}

			// Add anti-cache in url if needed
			if ( s.cache === false ) {
				s.url = rts.test( cacheURL ) ?

					// If there is already a '_' parameter, set its value
					cacheURL.replace( rts, "$1_=" + nonce++ ) :

					// Otherwise add one to the end
					cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
			}
		}

		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
		if ( s.ifModified ) {
			if ( jQuery.lastModified[ cacheURL ] ) {
				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
			}
			if ( jQuery.etag[ cacheURL ] ) {
				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
			}
		}

		// Set the correct header, if data is being sent
		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
			jqXHR.setRequestHeader( "Content-Type", s.contentType );
		}

		// Set the Accepts header for the server, depending on the dataType
		jqXHR.setRequestHeader(
			"Accept",
			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
				s.accepts[ s.dataTypes[ 0 ] ] +
					( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
				s.accepts[ "*" ]
		);

		// Check for headers option
		for ( i in s.headers ) {
			jqXHR.setRequestHeader( i, s.headers[ i ] );
		}

		// Allow custom headers/mimetypes and early abort
		if ( s.beforeSend &&
			( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {

			// Abort if not done already and return
			return jqXHR.abort();
		}

		// aborting is no longer a cancellation
		strAbort = "abort";

		// Install callbacks on deferreds
		for ( i in { success: 1, error: 1, complete: 1 } ) {
			jqXHR[ i ]( s[ i ] );
		}

		// Get transport
		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );

		// If no transport, we auto-abort
		if ( !transport ) {
			done( -1, "No Transport" );
		} else {
			jqXHR.readyState = 1;

			// Send global event
			if ( fireGlobals ) {
				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
			}

			// If request was aborted inside ajaxSend, stop there
			if ( state === 2 ) {
				return jqXHR;
			}

			// Timeout
			if ( s.async && s.timeout > 0 ) {
				timeoutTimer = window.setTimeout( function() {
					jqXHR.abort( "timeout" );
				}, s.timeout );
			}

			try {
				state = 1;
				transport.send( requestHeaders, done );
			} catch ( e ) {

				// Propagate exception as error if not done
				if ( state < 2 ) {
					done( -1, e );

				// Simply rethrow otherwise
				} else {
					throw e;
				}
			}
		}

		// Callback for when everything is done
		function done( status, nativeStatusText, responses, headers ) {
			var isSuccess, success, error, response, modified,
				statusText = nativeStatusText;

			// Called once
			if ( state === 2 ) {
				return;
			}

			// State is "done" now
			state = 2;

			// Clear timeout if it exists
			if ( timeoutTimer ) {
				window.clearTimeout( timeoutTimer );
			}

			// Dereference transport for early garbage collection
			// (no matter how long the jqXHR object will be used)
			transport = undefined;

			// Cache response headers
			responseHeadersString = headers || "";

			// Set readyState
			jqXHR.readyState = status > 0 ? 4 : 0;

			// Determine if successful
			isSuccess = status >= 200 && status < 300 || status === 304;

			// Get response data
			if ( responses ) {
				response = ajaxHandleResponses( s, jqXHR, responses );
			}

			// Convert no matter what (that way responseXXX fields are always set)
			response = ajaxConvert( s, response, jqXHR, isSuccess );

			// If successful, handle type chaining
			if ( isSuccess ) {

				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
				if ( s.ifModified ) {
					modified = jqXHR.getResponseHeader( "Last-Modified" );
					if ( modified ) {
						jQuery.lastModified[ cacheURL ] = modified;
					}
					modified = jqXHR.getResponseHeader( "etag" );
					if ( modified ) {
						jQuery.etag[ cacheURL ] = modified;
					}
				}

				// if no content
				if ( status === 204 || s.type === "HEAD" ) {
					statusText = "nocontent";

				// if not modified
				} else if ( status === 304 ) {
					statusText = "notmodified";

				// If we have data, let's convert it
				} else {
					statusText = response.state;
					success = response.data;
					error = response.error;
					isSuccess = !error;
				}
			} else {

				// We extract error from statusText
				// then normalize statusText and status for non-aborts
				error = statusText;
				if ( status || !statusText ) {
					statusText = "error";
					if ( status < 0 ) {
						status = 0;
					}
				}
			}

			// Set data for the fake xhr object
			jqXHR.status = status;
			jqXHR.statusText = ( nativeStatusText || statusText ) + "";

			// Success/Error
			if ( isSuccess ) {
				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
			} else {
				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
			}

			// Status-dependent callbacks
			jqXHR.statusCode( statusCode );
			statusCode = undefined;

			if ( fireGlobals ) {
				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
					[ jqXHR, s, isSuccess ? success : error ] );
			}

			// Complete
			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );

			if ( fireGlobals ) {
				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );

				// Handle the global AJAX counter
				if ( !( --jQuery.active ) ) {
					jQuery.event.trigger( "ajaxStop" );
				}
			}
		}

		return jqXHR;
	},

	getJSON: function( url, data, callback ) {
		return jQuery.get( url, data, callback, "json" );
	},

	getScript: function( url, callback ) {
		return jQuery.get( url, undefined, callback, "script" );
	}
} );

jQuery.each( [ "get", "post" ], function( i, method ) {
	jQuery[ method ] = function( url, data, callback, type ) {

		// shift arguments if data argument was omitted
		if ( jQuery.isFunction( data ) ) {
			type = type || callback;
			callback = data;
			data = undefined;
		}

		// The url can be an options object (which then must have .url)
		return jQuery.ajax( jQuery.extend( {
			url: url,
			type: method,
			dataType: type,
			data: data,
			success: callback
		}, jQuery.isPlainObject( url ) && url ) );
	};
} );


jQuery._evalUrl = function( url ) {
	return jQuery.ajax( {
		url: url,

		// Make this explicit, since user can override this through ajaxSetup (#11264)
		type: "GET",
		dataType: "script",
		cache: true,
		async: false,
		global: false,
		"throws": true
	} );
};


jQuery.fn.extend( {
	wrapAll: function( html ) {
		if ( jQuery.isFunction( html ) ) {
			return this.each( function( i ) {
				jQuery( this ).wrapAll( html.call( this, i ) );
			} );
		}

		if ( this[ 0 ] ) {

			// The elements to wrap the target around
			var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );

			if ( this[ 0 ].parentNode ) {
				wrap.insertBefore( this[ 0 ] );
			}

			wrap.map( function() {
				var elem = this;

				while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
					elem = elem.firstChild;
				}

				return elem;
			} ).append( this );
		}

		return this;
	},

	wrapInner: function( html ) {
		if ( jQuery.isFunction( html ) ) {
			return this.each( function( i ) {
				jQuery( this ).wrapInner( html.call( this, i ) );
			} );
		}

		return this.each( function() {
			var self = jQuery( this ),
				contents = self.contents();

			if ( contents.length ) {
				contents.wrapAll( html );

			} else {
				self.append( html );
			}
		} );
	},

	wrap: function( html ) {
		var isFunction = jQuery.isFunction( html );

		return this.each( function( i ) {
			jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
		} );
	},

	unwrap: function() {
		return this.parent().each( function() {
			if ( !jQuery.nodeName( this, "body" ) ) {
				jQuery( this ).replaceWith( this.childNodes );
			}
		} ).end();
	}
} );


function getDisplay( elem ) {
	return elem.style && elem.style.display || jQuery.css( elem, "display" );
}

function filterHidden( elem ) {

	// Disconnected elements are considered hidden
	if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) {
		return true;
	}
	while ( elem && elem.nodeType === 1 ) {
		if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
			return true;
		}
		elem = elem.parentNode;
	}
	return false;
}

jQuery.expr.filters.hidden = function( elem ) {

	// Support: Opera <= 12.12
	// Opera reports offsetWidths and offsetHeights less than zero on some elements
	return support.reliableHiddenOffsets() ?
		( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
			!elem.getClientRects().length ) :
			filterHidden( elem );
};

jQuery.expr.filters.visible = function( elem ) {
	return !jQuery.expr.filters.hidden( elem );
};




var r20 = /%20/g,
	rbracket = /\[\]$/,
	rCRLF = /\r?\n/g,
	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
	rsubmittable = /^(?:input|select|textarea|keygen)/i;

function buildParams( prefix, obj, traditional, add ) {
	var name;

	if ( jQuery.isArray( obj ) ) {

		// Serialize array item.
		jQuery.each( obj, function( i, v ) {
			if ( traditional || rbracket.test( prefix ) ) {

				// Treat each array item as a scalar.
				add( prefix, v );

			} else {

				// Item is non-scalar (array or object), encode its numeric index.
				buildParams(
					prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
					v,
					traditional,
					add
				);
			}
		} );

	} else if ( !traditional && jQuery.type( obj ) === "object" ) {

		// Serialize object item.
		for ( name in obj ) {
			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
		}

	} else {

		// Serialize scalar item.
		add( prefix, obj );
	}
}

// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function( a, traditional ) {
	var prefix,
		s = [],
		add = function( key, value ) {

			// If value is a function, invoke it and return its value
			value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
			s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
		};

	// Set traditional to true for jQuery <= 1.3.2 behavior.
	if ( traditional === undefined ) {
		traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
	}

	// If an array was passed in, assume that it is an array of form elements.
	if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {

		// Serialize the form elements
		jQuery.each( a, function() {
			add( this.name, this.value );
		} );

	} else {

		// If traditional, encode the "old" way (the way 1.3.2 or older
		// did it), otherwise encode params recursively.
		for ( prefix in a ) {
			buildParams( prefix, a[ prefix ], traditional, add );
		}
	}

	// Return the resulting serialization
	return s.join( "&" ).replace( r20, "+" );
};

jQuery.fn.extend( {
	serialize: function() {
		return jQuery.param( this.serializeArray() );
	},
	serializeArray: function() {
		return this.map( function() {

			// Can add propHook for "elements" to filter or add form elements
			var elements = jQuery.prop( this, "elements" );
			return elements ? jQuery.makeArray( elements ) : this;
		} )
		.filter( function() {
			var type = this.type;

			// Use .is(":disabled") so that fieldset[disabled] works
			return this.name && !jQuery( this ).is( ":disabled" ) &&
				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
				( this.checked || !rcheckableType.test( type ) );
		} )
		.map( function( i, elem ) {
			var val = jQuery( this ).val();

			return val == null ?
				null :
				jQuery.isArray( val ) ?
					jQuery.map( val, function( val ) {
						return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
					} ) :
					{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
		} ).get();
	}
} );


// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?

	// Support: IE6-IE8
	function() {

		// XHR cannot access local files, always use ActiveX for that case
		if ( this.isLocal ) {
			return createActiveXHR();
		}

		// Support: IE 9-11
		// IE seems to error on cross-domain PATCH requests when ActiveX XHR
		// is used. In IE 9+ always use the native XHR.
		// Note: this condition won't catch Edge as it doesn't define
		// document.documentMode but it also doesn't support ActiveX so it won't
		// reach this code.
		if ( document.documentMode > 8 ) {
			return createStandardXHR();
		}

		// Support: IE<9
		// oldIE XHR does not support non-RFC2616 methods (#13240)
		// See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
		// and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
		// Although this check for six methods instead of eight
		// since IE also does not support "trace" and "connect"
		return /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
			createStandardXHR() || createActiveXHR();
	} :

	// For all other browsers, use the standard XMLHttpRequest object
	createStandardXHR;

var xhrId = 0,
	xhrCallbacks = {},
	xhrSupported = jQuery.ajaxSettings.xhr();

// Support: IE<10
// Open requests must be manually aborted on unload (#5280)
// See https://support.microsoft.com/kb/2856746 for more info
if ( window.attachEvent ) {
	window.attachEvent( "onunload", function() {
		for ( var key in xhrCallbacks ) {
			xhrCallbacks[ key ]( undefined, true );
		}
	} );
}

// Determine support properties
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = support.ajax = !!xhrSupported;

// Create transport if the browser can provide an xhr
if ( xhrSupported ) {

	jQuery.ajaxTransport( function( options ) {

		// Cross domain only allowed if supported through XMLHttpRequest
		if ( !options.crossDomain || support.cors ) {

			var callback;

			return {
				send: function( headers, complete ) {
					var i,
						xhr = options.xhr(),
						id = ++xhrId;

					// Open the socket
					xhr.open(
						options.type,
						options.url,
						options.async,
						options.username,
						options.password
					);

					// Apply custom fields if provided
					if ( options.xhrFields ) {
						for ( i in options.xhrFields ) {
							xhr[ i ] = options.xhrFields[ i ];
						}
					}

					// Override mime type if needed
					if ( options.mimeType && xhr.overrideMimeType ) {
						xhr.overrideMimeType( options.mimeType );
					}

					// X-Requested-With header
					// For cross-domain requests, seeing as conditions for a preflight are
					// akin to a jigsaw puzzle, we simply never set it to be sure.
					// (it can always be set on a per-request basis or even using ajaxSetup)
					// For same-domain requests, won't change header if already provided.
					if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
						headers[ "X-Requested-With" ] = "XMLHttpRequest";
					}

					// Set headers
					for ( i in headers ) {

						// Support: IE<9
						// IE's ActiveXObject throws a 'Type Mismatch' exception when setting
						// request header to a null-value.
						//
						// To keep consistent with other XHR implementations, cast the value
						// to string and ignore `undefined`.
						if ( headers[ i ] !== undefined ) {
							xhr.setRequestHeader( i, headers[ i ] + "" );
						}
					}

					// Do send the request
					// This may raise an exception which is actually
					// handled in jQuery.ajax (so no try/catch here)
					xhr.send( ( options.hasContent && options.data ) || null );

					// Listener
					callback = function( _, isAbort ) {
						var status, statusText, responses;

						// Was never called and is aborted or complete
						if ( callback && ( isAbort || xhr.readyState === 4 ) ) {

							// Clean up
							delete xhrCallbacks[ id ];
							callback = undefined;
							xhr.onreadystatechange = jQuery.noop;

							// Abort manually if needed
							if ( isAbort ) {
								if ( xhr.readyState !== 4 ) {
									xhr.abort();
								}
							} else {
								responses = {};
								status = xhr.status;

								// Support: IE<10
								// Accessing binary-data responseText throws an exception
								// (#11426)
								if ( typeof xhr.responseText === "string" ) {
									responses.text = xhr.responseText;
								}

								// Firefox throws an exception when accessing
								// statusText for faulty cross-domain requests
								try {
									statusText = xhr.statusText;
								} catch ( e ) {

									// We normalize with Webkit giving an empty statusText
									statusText = "";
								}

								// Filter status for non standard behaviors

								// If the request is local and we have data: assume a success
								// (success with no data won't get notified, that's the best we
								// can do given current implementations)
								if ( !status && options.isLocal && !options.crossDomain ) {
									status = responses.text ? 200 : 404;

								// IE - #1450: sometimes returns 1223 when it should be 204
								} else if ( status === 1223 ) {
									status = 204;
								}
							}
						}

						// Call complete if needed
						if ( responses ) {
							complete( status, statusText, responses, xhr.getAllResponseHeaders() );
						}
					};

					// Do send the request
					// `xhr.send` may raise an exception, but it will be
					// handled in jQuery.ajax (so no try/catch here)
					if ( !options.async ) {

						// If we're in sync mode we fire the callback
						callback();
					} else if ( xhr.readyState === 4 ) {

						// (IE6 & IE7) if it's in cache and has been
						// retrieved directly we need to fire the callback
						window.setTimeout( callback );
					} else {

						// Register the callback, but delay it in case `xhr.send` throws
						// Add to the list of active xhr callbacks
						xhr.onreadystatechange = xhrCallbacks[ id ] = callback;
					}
				},

				abort: function() {
					if ( callback ) {
						callback( undefined, true );
					}
				}
			};
		}
	} );
}

// Functions to create xhrs
function createStandardXHR() {
	try {
		return new window.XMLHttpRequest();
	} catch ( e ) {}
}

function createActiveXHR() {
	try {
		return new window.ActiveXObject( "Microsoft.XMLHTTP" );
	} catch ( e ) {}
}




// Install script dataType
jQuery.ajaxSetup( {
	accepts: {
		script: "text/javascript, application/javascript, " +
			"application/ecmascript, application/x-ecmascript"
	},
	contents: {
		script: /\b(?:java|ecma)script\b/
	},
	converters: {
		"text script": function( text ) {
			jQuery.globalEval( text );
			return text;
		}
	}
} );

// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
	if ( s.cache === undefined ) {
		s.cache = false;
	}
	if ( s.crossDomain ) {
		s.type = "GET";
		s.global = false;
	}
} );

// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {

	// This transport only deals with cross domain requests
	if ( s.crossDomain ) {

		var script,
			head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;

		return {

			send: function( _, callback ) {

				script = document.createElement( "script" );

				script.async = true;

				if ( s.scriptCharset ) {
					script.charset = s.scriptCharset;
				}

				script.src = s.url;

				// Attach handlers for all browsers
				script.onload = script.onreadystatechange = function( _, isAbort ) {

					if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {

						// Handle memory leak in IE
						script.onload = script.onreadystatechange = null;

						// Remove the script
						if ( script.parentNode ) {
							script.parentNode.removeChild( script );
						}

						// Dereference the script
						script = null;

						// Callback if not abort
						if ( !isAbort ) {
							callback( 200, "success" );
						}
					}
				};

				// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
				// Use native DOM manipulation to avoid our domManip AJAX trickery
				head.insertBefore( script, head.firstChild );
			},

			abort: function() {
				if ( script ) {
					script.onload( undefined, true );
				}
			}
		};
	}
} );




var oldCallbacks = [],
	rjsonp = /(=)\?(?=&|$)|\?\?/;

// Default jsonp settings
jQuery.ajaxSetup( {
	jsonp: "callback",
	jsonpCallback: function() {
		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
		this[ callback ] = true;
		return callback;
	}
} );

// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {

	var callbackName, overwritten, responseContainer,
		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
			"url" :
			typeof s.data === "string" &&
				( s.contentType || "" )
					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
				rjsonp.test( s.data ) && "data"
		);

	// Handle iff the expected data type is "jsonp" or we have a parameter to set
	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {

		// Get callback name, remembering preexisting value associated with it
		callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
			s.jsonpCallback() :
			s.jsonpCallback;

		// Insert callback into url or form data
		if ( jsonProp ) {
			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
		} else if ( s.jsonp !== false ) {
			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
		}

		// Use data converter to retrieve json after script execution
		s.converters[ "script json" ] = function() {
			if ( !responseContainer ) {
				jQuery.error( callbackName + " was not called" );
			}
			return responseContainer[ 0 ];
		};

		// force json dataType
		s.dataTypes[ 0 ] = "json";

		// Install callback
		overwritten = window[ callbackName ];
		window[ callbackName ] = function() {
			responseContainer = arguments;
		};

		// Clean-up function (fires after converters)
		jqXHR.always( function() {

			// If previous value didn't exist - remove it
			if ( overwritten === undefined ) {
				jQuery( window ).removeProp( callbackName );

			// Otherwise restore preexisting value
			} else {
				window[ callbackName ] = overwritten;
			}

			// Save back as free
			if ( s[ callbackName ] ) {

				// make sure that re-using the options doesn't screw things around
				s.jsonpCallback = originalSettings.jsonpCallback;

				// save the callback name for future use
				oldCallbacks.push( callbackName );
			}

			// Call if it was a function and we have a response
			if ( responseContainer && jQuery.isFunction( overwritten ) ) {
				overwritten( responseContainer[ 0 ] );
			}

			responseContainer = overwritten = undefined;
		} );

		// Delegate to script
		return "script";
	}
} );




// data: string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
	if ( !data || typeof data !== "string" ) {
		return null;
	}
	if ( typeof context === "boolean" ) {
		keepScripts = context;
		context = false;
	}
	context = context || document;

	var parsed = rsingleTag.exec( data ),
		scripts = !keepScripts && [];

	// Single tag
	if ( parsed ) {
		return [ context.createElement( parsed[ 1 ] ) ];
	}

	parsed = buildFragment( [ data ], context, scripts );

	if ( scripts && scripts.length ) {
		jQuery( scripts ).remove();
	}

	return jQuery.merge( [], parsed.childNodes );
};


// Keep a copy of the old load method
var _load = jQuery.fn.load;

/**
 * Load a url into a page
 */
jQuery.fn.load = function( url, params, callback ) {
	if ( typeof url !== "string" && _load ) {
		return _load.apply( this, arguments );
	}

	var selector, type, response,
		self = this,
		off = url.indexOf( " " );

	if ( off > -1 ) {
		selector = jQuery.trim( url.slice( off, url.length ) );
		url = url.slice( 0, off );
	}

	// If it's a function
	if ( jQuery.isFunction( params ) ) {

		// We assume that it's the callback
		callback = params;
		params = undefined;

	// Otherwise, build a param string
	} else if ( params && typeof params === "object" ) {
		type = "POST";
	}

	// If we have elements to modify, make the request
	if ( self.length > 0 ) {
		jQuery.ajax( {
			url: url,

			// If "type" variable is undefined, then "GET" method will be used.
			// Make value of this field explicit since
			// user can override it through ajaxSetup method
			type: type || "GET",
			dataType: "html",
			data: params
		} ).done( function( responseText ) {

			// Save response for use in complete callback
			response = arguments;

			self.html( selector ?

				// If a selector was specified, locate the right elements in a dummy div
				// Exclude scripts to avoid IE 'Permission Denied' errors
				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :

				// Otherwise use the full result
				responseText );

		// If the request succeeds, this function gets "data", "status", "jqXHR"
		// but they are ignored because response was set above.
		// If it fails, this function gets "jqXHR", "status", "error"
		} ).always( callback && function( jqXHR, status ) {
			self.each( function() {
				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
			} );
		} );
	}

	return this;
};




// Attach a bunch of functions for handling common AJAX events
jQuery.each( [
	"ajaxStart",
	"ajaxStop",
	"ajaxComplete",
	"ajaxError",
	"ajaxSuccess",
	"ajaxSend"
], function( i, type ) {
	jQuery.fn[ type ] = function( fn ) {
		return this.on( type, fn );
	};
} );




jQuery.expr.filters.animated = function( elem ) {
	return jQuery.grep( jQuery.timers, function( fn ) {
		return elem === fn.elem;
	} ).length;
};





/**
 * Gets a window from an element
 */
function getWindow( elem ) {
	return jQuery.isWindow( elem ) ?
		elem :
		elem.nodeType === 9 ?
			elem.defaultView || elem.parentWindow :
			false;
}

jQuery.offset = {
	setOffset: function( elem, options, i ) {
		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
			position = jQuery.css( elem, "position" ),
			curElem = jQuery( elem ),
			props = {};

		// set position first, in-case top/left are set even on static elem
		if ( position === "static" ) {
			elem.style.position = "relative";
		}

		curOffset = curElem.offset();
		curCSSTop = jQuery.css( elem, "top" );
		curCSSLeft = jQuery.css( elem, "left" );
		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
			jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1;

		// need to be able to calculate position if either top or left
		// is auto and position is either absolute or fixed
		if ( calculatePosition ) {
			curPosition = curElem.position();
			curTop = curPosition.top;
			curLeft = curPosition.left;
		} else {
			curTop = parseFloat( curCSSTop ) || 0;
			curLeft = parseFloat( curCSSLeft ) || 0;
		}

		if ( jQuery.isFunction( options ) ) {

			// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
			options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
		}

		if ( options.top != null ) {
			props.top = ( options.top - curOffset.top ) + curTop;
		}
		if ( options.left != null ) {
			props.left = ( options.left - curOffset.left ) + curLeft;
		}

		if ( "using" in options ) {
			options.using.call( elem, props );
		} else {
			curElem.css( props );
		}
	}
};

jQuery.fn.extend( {
	offset: function( options ) {
		if ( arguments.length ) {
			return options === undefined ?
				this :
				this.each( function( i ) {
					jQuery.offset.setOffset( this, options, i );
				} );
		}

		var docElem, win,
			box = { top: 0, left: 0 },
			elem = this[ 0 ],
			doc = elem && elem.ownerDocument;

		if ( !doc ) {
			return;
		}

		docElem = doc.documentElement;

		// Make sure it's not a disconnected DOM node
		if ( !jQuery.contains( docElem, elem ) ) {
			return box;
		}

		// If we don't have gBCR, just use 0,0 rather than error
		// BlackBerry 5, iOS 3 (original iPhone)
		if ( typeof elem.getBoundingClientRect !== "undefined" ) {
			box = elem.getBoundingClientRect();
		}
		win = getWindow( doc );
		return {
			top: box.top  + ( win.pageYOffset || docElem.scrollTop )  - ( docElem.clientTop  || 0 ),
			left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
		};
	},

	position: function() {
		if ( !this[ 0 ] ) {
			return;
		}

		var offsetParent, offset,
			parentOffset = { top: 0, left: 0 },
			elem = this[ 0 ];

		// Fixed elements are offset from window (parentOffset = {top:0, left: 0},
		// because it is its only offset parent
		if ( jQuery.css( elem, "position" ) === "fixed" ) {

			// we assume that getBoundingClientRect is available when computed position is fixed
			offset = elem.getBoundingClientRect();
		} else {

			// Get *real* offsetParent
			offsetParent = this.offsetParent();

			// Get correct offsets
			offset = this.offset();
			if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
				parentOffset = offsetParent.offset();
			}

			// Add offsetParent borders
			parentOffset.top  += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
			parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
		}

		// Subtract parent offsets and element margins
		// note: when an element has margin: auto the offsetLeft and marginLeft
		// are the same in Safari causing offset.left to incorrectly be 0
		return {
			top:  offset.top  - parentOffset.top - jQuery.css( elem, "marginTop", true ),
			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
		};
	},

	offsetParent: function() {
		return this.map( function() {
			var offsetParent = this.offsetParent;

			while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) &&
				jQuery.css( offsetParent, "position" ) === "static" ) ) {
				offsetParent = offsetParent.offsetParent;
			}
			return offsetParent || documentElement;
		} );
	}
} );

// Create scrollLeft and scrollTop methods
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
	var top = /Y/.test( prop );

	jQuery.fn[ method ] = function( val ) {
		return access( this, function( elem, method, val ) {
			var win = getWindow( elem );

			if ( val === undefined ) {
				return win ? ( prop in win ) ? win[ prop ] :
					win.document.documentElement[ method ] :
					elem[ method ];
			}

			if ( win ) {
				win.scrollTo(
					!top ? val : jQuery( win ).scrollLeft(),
					top ? val : jQuery( win ).scrollTop()
				);

			} else {
				elem[ method ] = val;
			}
		}, method, val, arguments.length, null );
	};
} );

// Support: Safari<7-8+, Chrome<37-44+
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
jQuery.each( [ "top", "left" ], function( i, prop ) {
	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
		function( elem, computed ) {
			if ( computed ) {
				computed = curCSS( elem, prop );

				// if curCSS returns percentage, fallback to offset
				return rnumnonpx.test( computed ) ?
					jQuery( elem ).position()[ prop ] + "px" :
					computed;
			}
		}
	);
} );


// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
	function( defaultExtra, funcName ) {

		// margin is only for outerHeight, outerWidth
		jQuery.fn[ funcName ] = function( margin, value ) {
			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );

			return access( this, function( elem, type, value ) {
				var doc;

				if ( jQuery.isWindow( elem ) ) {

					// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
					// isn't a whole lot we can do. See pull request at this URL for discussion:
					// https://github.com/jquery/jquery/pull/764
					return elem.document.documentElement[ "client" + name ];
				}

				// Get document width or height
				if ( elem.nodeType === 9 ) {
					doc = elem.documentElement;

					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
					// whichever is greatest
					// unfortunately, this causes bug #3838 in IE6/8 only,
					// but there is currently no good, small way to fix it.
					return Math.max(
						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
						elem.body[ "offset" + name ], doc[ "offset" + name ],
						doc[ "client" + name ]
					);
				}

				return value === undefined ?

					// Get width or height on the element, requesting but not forcing parseFloat
					jQuery.css( elem, type, extra ) :

					// Set width or height on the element
					jQuery.style( elem, type, value, extra );
			}, type, chainable ? margin : undefined, chainable, null );
		};
	} );
} );


jQuery.fn.extend( {

	bind: function( types, data, fn ) {
		return this.on( types, null, data, fn );
	},
	unbind: function( types, fn ) {
		return this.off( types, null, fn );
	},

	delegate: function( selector, types, data, fn ) {
		return this.on( types, selector, data, fn );
	},
	undelegate: function( selector, types, fn ) {

		// ( namespace ) or ( selector, types [, fn] )
		return arguments.length === 1 ?
			this.off( selector, "**" ) :
			this.off( types, selector || "**", fn );
	}
} );

// The number of elements contained in the matched element set
jQuery.fn.size = function() {
	return this.length;
};

jQuery.fn.andSelf = jQuery.fn.addBack;




// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.

// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon

if ( typeof define === "function" && define.amd ) {
	define( "jquery", [], function() {
		return jQuery;
	} );
}



var

	// Map over jQuery in case of overwrite
	_jQuery = window.jQuery,

	// Map over the $ in case of overwrite
	_$ = window.$;

jQuery.noConflict = function( deep ) {
	if ( window.$ === jQuery ) {
		window.$ = _$;
	}

	if ( deep && window.jQuery === jQuery ) {
		window.jQuery = _jQuery;
	}

	return jQuery;
};

// Expose jQuery and $ identifiers, even in
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if ( !noGlobal ) {
	window.jQuery = window.$ = jQuery;
}

return jQuery;
}));

});

define('jquery-ui', function (require, exports, module) {
/*! jQuery UI - v1.12.1 - 2016-09-14
* http://jqueryui.com
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */

(function( factory ) {
	if ( typeof define === "function" && define.amd ) {

		// AMD. Register as an anonymous module.
		define([ "jquery" ], factory );
	} else {

		// Browser globals
		factory( jQuery );
	}
}(function( $ ) {

$.ui = $.ui || {};

var version = $.ui.version = "1.12.1";


/*!
 * jQuery UI Widget 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Widget
//>>group: Core
//>>description: Provides a factory for creating stateful widgets with a common API.
//>>docs: http://api.jqueryui.com/jQuery.widget/
//>>demos: http://jqueryui.com/widget/



var widgetUuid = 0;
var widgetSlice = Array.prototype.slice;

$.cleanData = ( function( orig ) {
	return function( elems ) {
		var events, elem, i;
		for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
			try {

				// Only trigger remove when necessary to save time
				events = $._data( elem, "events" );
				if ( events && events.remove ) {
					$( elem ).triggerHandler( "remove" );
				}

			// Http://bugs.jquery.com/ticket/8235
			} catch ( e ) {}
		}
		orig( elems );
	};
} )( $.cleanData );

$.widget = function( name, base, prototype ) {
	var existingConstructor, constructor, basePrototype;

	// ProxiedPrototype allows the provided prototype to remain unmodified
	// so that it can be used as a mixin for multiple widgets (#8876)
	var proxiedPrototype = {};

	var namespace = name.split( "." )[ 0 ];
	name = name.split( "." )[ 1 ];
	var fullName = namespace + "-" + name;

	if ( !prototype ) {
		prototype = base;
		base = $.Widget;
	}

	if ( $.isArray( prototype ) ) {
		prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
	}

	// Create selector for plugin
	$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
		return !!$.data( elem, fullName );
	};

	$[ namespace ] = $[ namespace ] || {};
	existingConstructor = $[ namespace ][ name ];
	constructor = $[ namespace ][ name ] = function( options, element ) {

		// Allow instantiation without "new" keyword
		if ( !this._createWidget ) {
			return new constructor( options, element );
		}

		// Allow instantiation without initializing for simple inheritance
		// must use "new" keyword (the code above always passes args)
		if ( arguments.length ) {
			this._createWidget( options, element );
		}
	};

	// Extend with the existing constructor to carry over any static properties
	$.extend( constructor, existingConstructor, {
		version: prototype.version,

		// Copy the object used to create the prototype in case we need to
		// redefine the widget later
		_proto: $.extend( {}, prototype ),

		// Track widgets that inherit from this widget in case this widget is
		// redefined after a widget inherits from it
		_childConstructors: []
	} );

	basePrototype = new base();

	// We need to make the options hash a property directly on the new instance
	// otherwise we'll modify the options hash on the prototype that we're
	// inheriting from
	basePrototype.options = $.widget.extend( {}, basePrototype.options );
	$.each( prototype, function( prop, value ) {
		if ( !$.isFunction( value ) ) {
			proxiedPrototype[ prop ] = value;
			return;
		}
		proxiedPrototype[ prop ] = ( function() {
			function _super() {
				return base.prototype[ prop ].apply( this, arguments );
			}

			function _superApply( args ) {
				return base.prototype[ prop ].apply( this, args );
			}

			return function() {
				var __super = this._super;
				var __superApply = this._superApply;
				var returnValue;

				this._super = _super;
				this._superApply = _superApply;

				returnValue = value.apply( this, arguments );

				this._super = __super;
				this._superApply = __superApply;

				return returnValue;
			};
		} )();
	} );
	constructor.prototype = $.widget.extend( basePrototype, {

		// TODO: remove support for widgetEventPrefix
		// always use the name + a colon as the prefix, e.g., draggable:start
		// don't prefix for widgets that aren't DOM-based
		widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
	}, proxiedPrototype, {
		constructor: constructor,
		namespace: namespace,
		widgetName: name,
		widgetFullName: fullName
	} );

	// If this widget is being redefined then we need to find all widgets that
	// are inheriting from it and redefine all of them so that they inherit from
	// the new version of this widget. We're essentially trying to replace one
	// level in the prototype chain.
	if ( existingConstructor ) {
		$.each( existingConstructor._childConstructors, function( i, child ) {
			var childPrototype = child.prototype;

			// Redefine the child widget using the same prototype that was
			// originally used, but inherit from the new version of the base
			$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
				child._proto );
		} );

		// Remove the list of existing child constructors from the old constructor
		// so the old child constructors can be garbage collected
		delete existingConstructor._childConstructors;
	} else {
		base._childConstructors.push( constructor );
	}

	$.widget.bridge( name, constructor );

	return constructor;
};

$.widget.extend = function( target ) {
	var input = widgetSlice.call( arguments, 1 );
	var inputIndex = 0;
	var inputLength = input.length;
	var key;
	var value;

	for ( ; inputIndex < inputLength; inputIndex++ ) {
		for ( key in input[ inputIndex ] ) {
			value = input[ inputIndex ][ key ];
			if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {

				// Clone objects
				if ( $.isPlainObject( value ) ) {
					target[ key ] = $.isPlainObject( target[ key ] ) ?
						$.widget.extend( {}, target[ key ], value ) :

						// Don't extend strings, arrays, etc. with objects
						$.widget.extend( {}, value );

				// Copy everything else by reference
				} else {
					target[ key ] = value;
				}
			}
		}
	}
	return target;
};

$.widget.bridge = function( name, object ) {
	var fullName = object.prototype.widgetFullName || name;
	$.fn[ name ] = function( options ) {
		var isMethodCall = typeof options === "string";
		var args = widgetSlice.call( arguments, 1 );
		var returnValue = this;

		if ( isMethodCall ) {

			// If this is an empty collection, we need to have the instance method
			// return undefined instead of the jQuery instance
			if ( !this.length && options === "instance" ) {
				returnValue = undefined;
			} else {
				this.each( function() {
					var methodValue;
					var instance = $.data( this, fullName );

					if ( options === "instance" ) {
						returnValue = instance;
						return false;
					}

					if ( !instance ) {
						return $.error( "cannot call methods on " + name +
							" prior to initialization; " +
							"attempted to call method '" + options + "'" );
					}

					if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
						return $.error( "no such method '" + options + "' for " + name +
							" widget instance" );
					}

					methodValue = instance[ options ].apply( instance, args );

					if ( methodValue !== instance && methodValue !== undefined ) {
						returnValue = methodValue && methodValue.jquery ?
							returnValue.pushStack( methodValue.get() ) :
							methodValue;
						return false;
					}
				} );
			}
		} else {

			// Allow multiple hashes to be passed on init
			if ( args.length ) {
				options = $.widget.extend.apply( null, [ options ].concat( args ) );
			}

			this.each( function() {
				var instance = $.data( this, fullName );
				if ( instance ) {
					instance.option( options || {} );
					if ( instance._init ) {
						instance._init();
					}
				} else {
					$.data( this, fullName, new object( options, this ) );
				}
			} );
		}

		return returnValue;
	};
};

$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];

$.Widget.prototype = {
	widgetName: "widget",
	widgetEventPrefix: "",
	defaultElement: "<div>",

	options: {
		classes: {},
		disabled: false,

		// Callbacks
		create: null
	},

	_createWidget: function( options, element ) {
		element = $( element || this.defaultElement || this )[ 0 ];
		this.element = $( element );
		this.uuid = widgetUuid++;
		this.eventNamespace = "." + this.widgetName + this.uuid;

		this.bindings = $();
		this.hoverable = $();
		this.focusable = $();
		this.classesElementLookup = {};

		if ( element !== this ) {
			$.data( element, this.widgetFullName, this );
			this._on( true, this.element, {
				remove: function( event ) {
					if ( event.target === element ) {
						this.destroy();
					}
				}
			} );
			this.document = $( element.style ?

				// Element within the document
				element.ownerDocument :

				// Element is window or document
				element.document || element );
			this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
		}

		this.options = $.widget.extend( {},
			this.options,
			this._getCreateOptions(),
			options );

		this._create();

		if ( this.options.disabled ) {
			this._setOptionDisabled( this.options.disabled );
		}

		this._trigger( "create", null, this._getCreateEventData() );
		this._init();
	},

	_getCreateOptions: function() {
		return {};
	},

	_getCreateEventData: $.noop,

	_create: $.noop,

	_init: $.noop,

	destroy: function() {
		var that = this;

		this._destroy();
		$.each( this.classesElementLookup, function( key, value ) {
			that._removeClass( value, key );
		} );

		// We can probably remove the unbind calls in 2.0
		// all event bindings should go through this._on()
		this.element
			.off( this.eventNamespace )
			.removeData( this.widgetFullName );
		this.widget()
			.off( this.eventNamespace )
			.removeAttr( "aria-disabled" );

		// Clean up events and states
		this.bindings.off( this.eventNamespace );
	},

	_destroy: $.noop,

	widget: function() {
		return this.element;
	},

	option: function( key, value ) {
		var options = key;
		var parts;
		var curOption;
		var i;

		if ( arguments.length === 0 ) {

			// Don't return a reference to the internal hash
			return $.widget.extend( {}, this.options );
		}

		if ( typeof key === "string" ) {

			// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
			options = {};
			parts = key.split( "." );
			key = parts.shift();
			if ( parts.length ) {
				curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
				for ( i = 0; i < parts.length - 1; i++ ) {
					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
					curOption = curOption[ parts[ i ] ];
				}
				key = parts.pop();
				if ( arguments.length === 1 ) {
					return curOption[ key ] === undefined ? null : curOption[ key ];
				}
				curOption[ key ] = value;
			} else {
				if ( arguments.length === 1 ) {
					return this.options[ key ] === undefined ? null : this.options[ key ];
				}
				options[ key ] = value;
			}
		}

		this._setOptions( options );

		return this;
	},

	_setOptions: function( options ) {
		var key;

		for ( key in options ) {
			this._setOption( key, options[ key ] );
		}

		return this;
	},

	_setOption: function( key, value ) {
		if ( key === "classes" ) {
			this._setOptionClasses( value );
		}

		this.options[ key ] = value;

		if ( key === "disabled" ) {
			this._setOptionDisabled( value );
		}

		return this;
	},

	_setOptionClasses: function( value ) {
		var classKey, elements, currentElements;

		for ( classKey in value ) {
			currentElements = this.classesElementLookup[ classKey ];
			if ( value[ classKey ] === this.options.classes[ classKey ] ||
					!currentElements ||
					!currentElements.length ) {
				continue;
			}

			// We are doing this to create a new jQuery object because the _removeClass() call
			// on the next line is going to destroy the reference to the current elements being
			// tracked. We need to save a copy of this collection so that we can add the new classes
			// below.
			elements = $( currentElements.get() );
			this._removeClass( currentElements, classKey );

			// We don't use _addClass() here, because that uses this.options.classes
			// for generating the string of classes. We want to use the value passed in from
			// _setOption(), this is the new value of the classes option which was passed to
			// _setOption(). We pass this value directly to _classes().
			elements.addClass( this._classes( {
				element: elements,
				keys: classKey,
				classes: value,
				add: true
			} ) );
		}
	},

	_setOptionDisabled: function( value ) {
		this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );

		// If the widget is becoming disabled, then nothing is interactive
		if ( value ) {
			this._removeClass( this.hoverable, null, "ui-state-hover" );
			this._removeClass( this.focusable, null, "ui-state-focus" );
		}
	},

	enable: function() {
		return this._setOptions( { disabled: false } );
	},

	disable: function() {
		return this._setOptions( { disabled: true } );
	},

	_classes: function( options ) {
		var full = [];
		var that = this;

		options = $.extend( {
			element: this.element,
			classes: this.options.classes || {}
		}, options );

		function processClassString( classes, checkOption ) {
			var current, i;
			for ( i = 0; i < classes.length; i++ ) {
				current = that.classesElementLookup[ classes[ i ] ] || $();
				if ( options.add ) {
					current = $( $.unique( current.get().concat( options.element.get() ) ) );
				} else {
					current = $( current.not( options.element ).get() );
				}
				that.classesElementLookup[ classes[ i ] ] = current;
				full.push( classes[ i ] );
				if ( checkOption && options.classes[ classes[ i ] ] ) {
					full.push( options.classes[ classes[ i ] ] );
				}
			}
		}

		this._on( options.element, {
			"remove": "_untrackClassesElement"
		} );

		if ( options.keys ) {
			processClassString( options.keys.match( /\S+/g ) || [], true );
		}
		if ( options.extra ) {
			processClassString( options.extra.match( /\S+/g ) || [] );
		}

		return full.join( " " );
	},

	_untrackClassesElement: function( event ) {
		var that = this;
		$.each( that.classesElementLookup, function( key, value ) {
			if ( $.inArray( event.target, value ) !== -1 ) {
				that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
			}
		} );
	},

	_removeClass: function( element, keys, extra ) {
		return this._toggleClass( element, keys, extra, false );
	},

	_addClass: function( element, keys, extra ) {
		return this._toggleClass( element, keys, extra, true );
	},

	_toggleClass: function( element, keys, extra, add ) {
		add = ( typeof add === "boolean" ) ? add : extra;
		var shift = ( typeof element === "string" || element === null ),
			options = {
				extra: shift ? keys : extra,
				keys: shift ? element : keys,
				element: shift ? this.element : element,
				add: add
			};
		options.element.toggleClass( this._classes( options ), add );
		return this;
	},

	_on: function( suppressDisabledCheck, element, handlers ) {
		var delegateElement;
		var instance = this;

		// No suppressDisabledCheck flag, shuffle arguments
		if ( typeof suppressDisabledCheck !== "boolean" ) {
			handlers = element;
			element = suppressDisabledCheck;
			suppressDisabledCheck = false;
		}

		// No element argument, shuffle and use this.element
		if ( !handlers ) {
			handlers = element;
			element = this.element;
			delegateElement = this.widget();
		} else {
			element = delegateElement = $( element );
			this.bindings = this.bindings.add( element );
		}

		$.each( handlers, function( event, handler ) {
			function handlerProxy() {

				// Allow widgets to customize the disabled handling
				// - disabled as an array instead of boolean
				// - disabled class as method for disabling individual parts
				if ( !suppressDisabledCheck &&
						( instance.options.disabled === true ||
						$( this ).hasClass( "ui-state-disabled" ) ) ) {
					return;
				}
				return ( typeof handler === "string" ? instance[ handler ] : handler )
					.apply( instance, arguments );
			}

			// Copy the guid so direct unbinding works
			if ( typeof handler !== "string" ) {
				handlerProxy.guid = handler.guid =
					handler.guid || handlerProxy.guid || $.guid++;
			}

			var match = event.match( /^([\w:-]*)\s*(.*)$/ );
			var eventName = match[ 1 ] + instance.eventNamespace;
			var selector = match[ 2 ];

			if ( selector ) {
				delegateElement.on( eventName, selector, handlerProxy );
			} else {
				element.on( eventName, handlerProxy );
			}
		} );
	},

	_off: function( element, eventName ) {
		eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
			this.eventNamespace;
		element.off( eventName ).off( eventName );

		// Clear the stack to avoid memory leaks (#10056)
		this.bindings = $( this.bindings.not( element ).get() );
		this.focusable = $( this.focusable.not( element ).get() );
		this.hoverable = $( this.hoverable.not( element ).get() );
	},

	_delay: function( handler, delay ) {
		function handlerProxy() {
			return ( typeof handler === "string" ? instance[ handler ] : handler )
				.apply( instance, arguments );
		}
		var instance = this;
		return setTimeout( handlerProxy, delay || 0 );
	},

	_hoverable: function( element ) {
		this.hoverable = this.hoverable.add( element );
		this._on( element, {
			mouseenter: function( event ) {
				this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
			},
			mouseleave: function( event ) {
				this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
			}
		} );
	},

	_focusable: function( element ) {
		this.focusable = this.focusable.add( element );
		this._on( element, {
			focusin: function( event ) {
				this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
			},
			focusout: function( event ) {
				this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
			}
		} );
	},

	_trigger: function( type, event, data ) {
		var prop, orig;
		var callback = this.options[ type ];

		data = data || {};
		event = $.Event( event );
		event.type = ( type === this.widgetEventPrefix ?
			type :
			this.widgetEventPrefix + type ).toLowerCase();

		// The original event may come from any element
		// so we need to reset the target on the new event
		event.target = this.element[ 0 ];

		// Copy original event properties over to the new event
		orig = event.originalEvent;
		if ( orig ) {
			for ( prop in orig ) {
				if ( !( prop in event ) ) {
					event[ prop ] = orig[ prop ];
				}
			}
		}

		this.element.trigger( event, data );
		return !( $.isFunction( callback ) &&
			callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
			event.isDefaultPrevented() );
	}
};

$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
	$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
		if ( typeof options === "string" ) {
			options = { effect: options };
		}

		var hasOptions;
		var effectName = !options ?
			method :
			options === true || typeof options === "number" ?
				defaultEffect :
				options.effect || defaultEffect;

		options = options || {};
		if ( typeof options === "number" ) {
			options = { duration: options };
		}

		hasOptions = !$.isEmptyObject( options );
		options.complete = callback;

		if ( options.delay ) {
			element.delay( options.delay );
		}

		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
			element[ method ]( options );
		} else if ( effectName !== method && element[ effectName ] ) {
			element[ effectName ]( options.duration, options.easing, callback );
		} else {
			element.queue( function( next ) {
				$( this )[ method ]();
				if ( callback ) {
					callback.call( element[ 0 ] );
				}
				next();
			} );
		}
	};
} );

var widget = $.widget;


/*!
 * jQuery UI Position 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/position/
 */

//>>label: Position
//>>group: Core
//>>description: Positions elements relative to other elements.
//>>docs: http://api.jqueryui.com/position/
//>>demos: http://jqueryui.com/position/


( function() {
var cachedScrollbarWidth,
	max = Math.max,
	abs = Math.abs,
	rhorizontal = /left|center|right/,
	rvertical = /top|center|bottom/,
	roffset = /[\+\-]\d+(\.[\d]+)?%?/,
	rposition = /^\w+/,
	rpercent = /%$/,
	_position = $.fn.position;

function getOffsets( offsets, width, height ) {
	return [
		parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
		parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
	];
}

function parseCss( element, property ) {
	return parseInt( $.css( element, property ), 10 ) || 0;
}

function getDimensions( elem ) {
	var raw = elem[ 0 ];
	if ( raw.nodeType === 9 ) {
		return {
			width: elem.width(),
			height: elem.height(),
			offset: { top: 0, left: 0 }
		};
	}
	if ( $.isWindow( raw ) ) {
		return {
			width: elem.width(),
			height: elem.height(),
			offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
		};
	}
	if ( raw.preventDefault ) {
		return {
			width: 0,
			height: 0,
			offset: { top: raw.pageY, left: raw.pageX }
		};
	}
	return {
		width: elem.outerWidth(),
		height: elem.outerHeight(),
		offset: elem.offset()
	};
}

$.position = {
	scrollbarWidth: function() {
		if ( cachedScrollbarWidth !== undefined ) {
			return cachedScrollbarWidth;
		}
		var w1, w2,
			div = $( "<div " +
				"style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
				"<div style='height:100px;width:auto;'></div></div>" ),
			innerDiv = div.children()[ 0 ];

		$( "body" ).append( div );
		w1 = innerDiv.offsetWidth;
		div.css( "overflow", "scroll" );

		w2 = innerDiv.offsetWidth;

		if ( w1 === w2 ) {
			w2 = div[ 0 ].clientWidth;
		}

		div.remove();

		return ( cachedScrollbarWidth = w1 - w2 );
	},
	getScrollInfo: function( within ) {
		var overflowX = within.isWindow || within.isDocument ? "" :
				within.element.css( "overflow-x" ),
			overflowY = within.isWindow || within.isDocument ? "" :
				within.element.css( "overflow-y" ),
			hasOverflowX = overflowX === "scroll" ||
				( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
			hasOverflowY = overflowY === "scroll" ||
				( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
		return {
			width: hasOverflowY ? $.position.scrollbarWidth() : 0,
			height: hasOverflowX ? $.position.scrollbarWidth() : 0
		};
	},
	getWithinInfo: function( element ) {
		var withinElement = $( element || window ),
			isWindow = $.isWindow( withinElement[ 0 ] ),
			isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
			hasOffset = !isWindow && !isDocument;
		return {
			element: withinElement,
			isWindow: isWindow,
			isDocument: isDocument,
			offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
			scrollLeft: withinElement.scrollLeft(),
			scrollTop: withinElement.scrollTop(),
			width: withinElement.outerWidth(),
			height: withinElement.outerHeight()
		};
	}
};

$.fn.position = function( options ) {
	if ( !options || !options.of ) {
		return _position.apply( this, arguments );
	}

	// Make a copy, we don't want to modify arguments
	options = $.extend( {}, options );

	var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
		target = $( options.of ),
		within = $.position.getWithinInfo( options.within ),
		scrollInfo = $.position.getScrollInfo( within ),
		collision = ( options.collision || "flip" ).split( " " ),
		offsets = {};

	dimensions = getDimensions( target );
	if ( target[ 0 ].preventDefault ) {

		// Force left top to allow flipping
		options.at = "left top";
	}
	targetWidth = dimensions.width;
	targetHeight = dimensions.height;
	targetOffset = dimensions.offset;

	// Clone to reuse original targetOffset later
	basePosition = $.extend( {}, targetOffset );

	// Force my and at to have valid horizontal and vertical positions
	// if a value is missing or invalid, it will be converted to center
	$.each( [ "my", "at" ], function() {
		var pos = ( options[ this ] || "" ).split( " " ),
			horizontalOffset,
			verticalOffset;

		if ( pos.length === 1 ) {
			pos = rhorizontal.test( pos[ 0 ] ) ?
				pos.concat( [ "center" ] ) :
				rvertical.test( pos[ 0 ] ) ?
					[ "center" ].concat( pos ) :
					[ "center", "center" ];
		}
		pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
		pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";

		// Calculate offsets
		horizontalOffset = roffset.exec( pos[ 0 ] );
		verticalOffset = roffset.exec( pos[ 1 ] );
		offsets[ this ] = [
			horizontalOffset ? horizontalOffset[ 0 ] : 0,
			verticalOffset ? verticalOffset[ 0 ] : 0
		];

		// Reduce to just the positions without the offsets
		options[ this ] = [
			rposition.exec( pos[ 0 ] )[ 0 ],
			rposition.exec( pos[ 1 ] )[ 0 ]
		];
	} );

	// Normalize collision option
	if ( collision.length === 1 ) {
		collision[ 1 ] = collision[ 0 ];
	}

	if ( options.at[ 0 ] === "right" ) {
		basePosition.left += targetWidth;
	} else if ( options.at[ 0 ] === "center" ) {
		basePosition.left += targetWidth / 2;
	}

	if ( options.at[ 1 ] === "bottom" ) {
		basePosition.top += targetHeight;
	} else if ( options.at[ 1 ] === "center" ) {
		basePosition.top += targetHeight / 2;
	}

	atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
	basePosition.left += atOffset[ 0 ];
	basePosition.top += atOffset[ 1 ];

	return this.each( function() {
		var collisionPosition, using,
			elem = $( this ),
			elemWidth = elem.outerWidth(),
			elemHeight = elem.outerHeight(),
			marginLeft = parseCss( this, "marginLeft" ),
			marginTop = parseCss( this, "marginTop" ),
			collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
				scrollInfo.width,
			collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
				scrollInfo.height,
			position = $.extend( {}, basePosition ),
			myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );

		if ( options.my[ 0 ] === "right" ) {
			position.left -= elemWidth;
		} else if ( options.my[ 0 ] === "center" ) {
			position.left -= elemWidth / 2;
		}

		if ( options.my[ 1 ] === "bottom" ) {
			position.top -= elemHeight;
		} else if ( options.my[ 1 ] === "center" ) {
			position.top -= elemHeight / 2;
		}

		position.left += myOffset[ 0 ];
		position.top += myOffset[ 1 ];

		collisionPosition = {
			marginLeft: marginLeft,
			marginTop: marginTop
		};

		$.each( [ "left", "top" ], function( i, dir ) {
			if ( $.ui.position[ collision[ i ] ] ) {
				$.ui.position[ collision[ i ] ][ dir ]( position, {
					targetWidth: targetWidth,
					targetHeight: targetHeight,
					elemWidth: elemWidth,
					elemHeight: elemHeight,
					collisionPosition: collisionPosition,
					collisionWidth: collisionWidth,
					collisionHeight: collisionHeight,
					offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
					my: options.my,
					at: options.at,
					within: within,
					elem: elem
				} );
			}
		} );

		if ( options.using ) {

			// Adds feedback as second argument to using callback, if present
			using = function( props ) {
				var left = targetOffset.left - position.left,
					right = left + targetWidth - elemWidth,
					top = targetOffset.top - position.top,
					bottom = top + targetHeight - elemHeight,
					feedback = {
						target: {
							element: target,
							left: targetOffset.left,
							top: targetOffset.top,
							width: targetWidth,
							height: targetHeight
						},
						element: {
							element: elem,
							left: position.left,
							top: position.top,
							width: elemWidth,
							height: elemHeight
						},
						horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
						vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
					};
				if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
					feedback.horizontal = "center";
				}
				if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
					feedback.vertical = "middle";
				}
				if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
					feedback.important = "horizontal";
				} else {
					feedback.important = "vertical";
				}
				options.using.call( this, props, feedback );
			};
		}

		elem.offset( $.extend( position, { using: using } ) );
	} );
};

$.ui.position = {
	fit: {
		left: function( position, data ) {
			var within = data.within,
				withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
				outerWidth = within.width,
				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
				overLeft = withinOffset - collisionPosLeft,
				overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
				newOverRight;

			// Element is wider than within
			if ( data.collisionWidth > outerWidth ) {

				// Element is initially over the left side of within
				if ( overLeft > 0 && overRight <= 0 ) {
					newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
						withinOffset;
					position.left += overLeft - newOverRight;

				// Element is initially over right side of within
				} else if ( overRight > 0 && overLeft <= 0 ) {
					position.left = withinOffset;

				// Element is initially over both left and right sides of within
				} else {
					if ( overLeft > overRight ) {
						position.left = withinOffset + outerWidth - data.collisionWidth;
					} else {
						position.left = withinOffset;
					}
				}

			// Too far left -> align with left edge
			} else if ( overLeft > 0 ) {
				position.left += overLeft;

			// Too far right -> align with right edge
			} else if ( overRight > 0 ) {
				position.left -= overRight;

			// Adjust based on position and margin
			} else {
				position.left = max( position.left - collisionPosLeft, position.left );
			}
		},
		top: function( position, data ) {
			var within = data.within,
				withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
				outerHeight = data.within.height,
				collisionPosTop = position.top - data.collisionPosition.marginTop,
				overTop = withinOffset - collisionPosTop,
				overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
				newOverBottom;

			// Element is taller than within
			if ( data.collisionHeight > outerHeight ) {

				// Element is initially over the top of within
				if ( overTop > 0 && overBottom <= 0 ) {
					newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
						withinOffset;
					position.top += overTop - newOverBottom;

				// Element is initially over bottom of within
				} else if ( overBottom > 0 && overTop <= 0 ) {
					position.top = withinOffset;

				// Element is initially over both top and bottom of within
				} else {
					if ( overTop > overBottom ) {
						position.top = withinOffset + outerHeight - data.collisionHeight;
					} else {
						position.top = withinOffset;
					}
				}

			// Too far up -> align with top
			} else if ( overTop > 0 ) {
				position.top += overTop;

			// Too far down -> align with bottom edge
			} else if ( overBottom > 0 ) {
				position.top -= overBottom;

			// Adjust based on position and margin
			} else {
				position.top = max( position.top - collisionPosTop, position.top );
			}
		}
	},
	flip: {
		left: function( position, data ) {
			var within = data.within,
				withinOffset = within.offset.left + within.scrollLeft,
				outerWidth = within.width,
				offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
				overLeft = collisionPosLeft - offsetLeft,
				overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
				myOffset = data.my[ 0 ] === "left" ?
					-data.elemWidth :
					data.my[ 0 ] === "right" ?
						data.elemWidth :
						0,
				atOffset = data.at[ 0 ] === "left" ?
					data.targetWidth :
					data.at[ 0 ] === "right" ?
						-data.targetWidth :
						0,
				offset = -2 * data.offset[ 0 ],
				newOverRight,
				newOverLeft;

			if ( overLeft < 0 ) {
				newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
					outerWidth - withinOffset;
				if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
					position.left += myOffset + atOffset + offset;
				}
			} else if ( overRight > 0 ) {
				newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
					atOffset + offset - offsetLeft;
				if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
					position.left += myOffset + atOffset + offset;
				}
			}
		},
		top: function( position, data ) {
			var within = data.within,
				withinOffset = within.offset.top + within.scrollTop,
				outerHeight = within.height,
				offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
				collisionPosTop = position.top - data.collisionPosition.marginTop,
				overTop = collisionPosTop - offsetTop,
				overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
				top = data.my[ 1 ] === "top",
				myOffset = top ?
					-data.elemHeight :
					data.my[ 1 ] === "bottom" ?
						data.elemHeight :
						0,
				atOffset = data.at[ 1 ] === "top" ?
					data.targetHeight :
					data.at[ 1 ] === "bottom" ?
						-data.targetHeight :
						0,
				offset = -2 * data.offset[ 1 ],
				newOverTop,
				newOverBottom;
			if ( overTop < 0 ) {
				newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
					outerHeight - withinOffset;
				if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
					position.top += myOffset + atOffset + offset;
				}
			} else if ( overBottom > 0 ) {
				newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
					offset - offsetTop;
				if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
					position.top += myOffset + atOffset + offset;
				}
			}
		}
	},
	flipfit: {
		left: function() {
			$.ui.position.flip.left.apply( this, arguments );
			$.ui.position.fit.left.apply( this, arguments );
		},
		top: function() {
			$.ui.position.flip.top.apply( this, arguments );
			$.ui.position.fit.top.apply( this, arguments );
		}
	}
};

} )();

var position = $.ui.position;


/*!
 * jQuery UI :data 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: :data Selector
//>>group: Core
//>>description: Selects elements which have data stored under the specified key.
//>>docs: http://api.jqueryui.com/data-selector/


var data = $.extend( $.expr[ ":" ], {
	data: $.expr.createPseudo ?
		$.expr.createPseudo( function( dataName ) {
			return function( elem ) {
				return !!$.data( elem, dataName );
			};
		} ) :

		// Support: jQuery <1.8
		function( elem, i, match ) {
			return !!$.data( elem, match[ 3 ] );
		}
} );

/*!
 * jQuery UI Disable Selection 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: disableSelection
//>>group: Core
//>>description: Disable selection of text content within the set of matched elements.
//>>docs: http://api.jqueryui.com/disableSelection/

// This file is deprecated


var disableSelection = $.fn.extend( {
	disableSelection: ( function() {
		var eventType = "onselectstart" in document.createElement( "div" ) ?
			"selectstart" :
			"mousedown";

		return function() {
			return this.on( eventType + ".ui-disableSelection", function( event ) {
				event.preventDefault();
			} );
		};
	} )(),

	enableSelection: function() {
		return this.off( ".ui-disableSelection" );
	}
} );


/*!
 * jQuery UI Effects 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Effects Core
//>>group: Effects
// jscs:disable maximumLineLength
//>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
// jscs:enable maximumLineLength
//>>docs: http://api.jqueryui.com/category/effects-core/
//>>demos: http://jqueryui.com/effect/



var dataSpace = "ui-effects-",
	dataSpaceStyle = "ui-effects-style",
	dataSpaceAnimated = "ui-effects-animated",

	// Create a local jQuery because jQuery Color relies on it and the
	// global may not exist with AMD and a custom build (#10199)
	jQuery = $;

$.effects = {
	effect: {}
};

/*!
 * jQuery Color Animations v2.1.2
 * https://github.com/jquery/jquery-color
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * Date: Wed Jan 16 08:47:09 2013 -0600
 */
( function( jQuery, undefined ) {

	var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
		"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",

	// Plusequals test for += 100 -= 100
	rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,

	// A set of RE's that can match strings and generate color tuples.
	stringParsers = [ {
			re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
			parse: function( execResult ) {
				return [
					execResult[ 1 ],
					execResult[ 2 ],
					execResult[ 3 ],
					execResult[ 4 ]
				];
			}
		}, {
			re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
			parse: function( execResult ) {
				return [
					execResult[ 1 ] * 2.55,
					execResult[ 2 ] * 2.55,
					execResult[ 3 ] * 2.55,
					execResult[ 4 ]
				];
			}
		}, {

			// This regex ignores A-F because it's compared against an already lowercased string
			re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
			parse: function( execResult ) {
				return [
					parseInt( execResult[ 1 ], 16 ),
					parseInt( execResult[ 2 ], 16 ),
					parseInt( execResult[ 3 ], 16 )
				];
			}
		}, {

			// This regex ignores A-F because it's compared against an already lowercased string
			re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
			parse: function( execResult ) {
				return [
					parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
					parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
					parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
				];
			}
		}, {
			re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
			space: "hsla",
			parse: function( execResult ) {
				return [
					execResult[ 1 ],
					execResult[ 2 ] / 100,
					execResult[ 3 ] / 100,
					execResult[ 4 ]
				];
			}
		} ],

	// JQuery.Color( )
	color = jQuery.Color = function( color, green, blue, alpha ) {
		return new jQuery.Color.fn.parse( color, green, blue, alpha );
	},
	spaces = {
		rgba: {
			props: {
				red: {
					idx: 0,
					type: "byte"
				},
				green: {
					idx: 1,
					type: "byte"
				},
				blue: {
					idx: 2,
					type: "byte"
				}
			}
		},

		hsla: {
			props: {
				hue: {
					idx: 0,
					type: "degrees"
				},
				saturation: {
					idx: 1,
					type: "percent"
				},
				lightness: {
					idx: 2,
					type: "percent"
				}
			}
		}
	},
	propTypes = {
		"byte": {
			floor: true,
			max: 255
		},
		"percent": {
			max: 1
		},
		"degrees": {
			mod: 360,
			floor: true
		}
	},
	support = color.support = {},

	// Element for support tests
	supportElem = jQuery( "<p>" )[ 0 ],

	// Colors = jQuery.Color.names
	colors,

	// Local aliases of functions called often
	each = jQuery.each;

// Determine rgba support immediately
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;

// Define cache name and alpha properties
// for rgba and hsla spaces
each( spaces, function( spaceName, space ) {
	space.cache = "_" + spaceName;
	space.props.alpha = {
		idx: 3,
		type: "percent",
		def: 1
	};
} );

function clamp( value, prop, allowEmpty ) {
	var type = propTypes[ prop.type ] || {};

	if ( value == null ) {
		return ( allowEmpty || !prop.def ) ? null : prop.def;
	}

	// ~~ is an short way of doing floor for positive numbers
	value = type.floor ? ~~value : parseFloat( value );

	// IE will pass in empty strings as value for alpha,
	// which will hit this case
	if ( isNaN( value ) ) {
		return prop.def;
	}

	if ( type.mod ) {

		// We add mod before modding to make sure that negatives values
		// get converted properly: -10 -> 350
		return ( value + type.mod ) % type.mod;
	}

	// For now all property types without mod have min and max
	return 0 > value ? 0 : type.max < value ? type.max : value;
}

function stringParse( string ) {
	var inst = color(),
		rgba = inst._rgba = [];

	string = string.toLowerCase();

	each( stringParsers, function( i, parser ) {
		var parsed,
			match = parser.re.exec( string ),
			values = match && parser.parse( match ),
			spaceName = parser.space || "rgba";

		if ( values ) {
			parsed = inst[ spaceName ]( values );

			// If this was an rgba parse the assignment might happen twice
			// oh well....
			inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
			rgba = inst._rgba = parsed._rgba;

			// Exit each( stringParsers ) here because we matched
			return false;
		}
	} );

	// Found a stringParser that handled it
	if ( rgba.length ) {

		// If this came from a parsed string, force "transparent" when alpha is 0
		// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
		if ( rgba.join() === "0,0,0,0" ) {
			jQuery.extend( rgba, colors.transparent );
		}
		return inst;
	}

	// Named colors
	return colors[ string ];
}

color.fn = jQuery.extend( color.prototype, {
	parse: function( red, green, blue, alpha ) {
		if ( red === undefined ) {
			this._rgba = [ null, null, null, null ];
			return this;
		}
		if ( red.jquery || red.nodeType ) {
			red = jQuery( red ).css( green );
			green = undefined;
		}

		var inst = this,
			type = jQuery.type( red ),
			rgba = this._rgba = [];

		// More than 1 argument specified - assume ( red, green, blue, alpha )
		if ( green !== undefined ) {
			red = [ red, green, blue, alpha ];
			type = "array";
		}

		if ( type === "string" ) {
			return this.parse( stringParse( red ) || colors._default );
		}

		if ( type === "array" ) {
			each( spaces.rgba.props, function( key, prop ) {
				rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
			} );
			return this;
		}

		if ( type === "object" ) {
			if ( red instanceof color ) {
				each( spaces, function( spaceName, space ) {
					if ( red[ space.cache ] ) {
						inst[ space.cache ] = red[ space.cache ].slice();
					}
				} );
			} else {
				each( spaces, function( spaceName, space ) {
					var cache = space.cache;
					each( space.props, function( key, prop ) {

						// If the cache doesn't exist, and we know how to convert
						if ( !inst[ cache ] && space.to ) {

							// If the value was null, we don't need to copy it
							// if the key was alpha, we don't need to copy it either
							if ( key === "alpha" || red[ key ] == null ) {
								return;
							}
							inst[ cache ] = space.to( inst._rgba );
						}

						// This is the only case where we allow nulls for ALL properties.
						// call clamp with alwaysAllowEmpty
						inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
					} );

					// Everything defined but alpha?
					if ( inst[ cache ] &&
							jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {

						// Use the default of 1
						inst[ cache ][ 3 ] = 1;
						if ( space.from ) {
							inst._rgba = space.from( inst[ cache ] );
						}
					}
				} );
			}
			return this;
		}
	},
	is: function( compare ) {
		var is = color( compare ),
			same = true,
			inst = this;

		each( spaces, function( _, space ) {
			var localCache,
				isCache = is[ space.cache ];
			if ( isCache ) {
				localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
				each( space.props, function( _, prop ) {
					if ( isCache[ prop.idx ] != null ) {
						same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
						return same;
					}
				} );
			}
			return same;
		} );
		return same;
	},
	_space: function() {
		var used = [],
			inst = this;
		each( spaces, function( spaceName, space ) {
			if ( inst[ space.cache ] ) {
				used.push( spaceName );
			}
		} );
		return used.pop();
	},
	transition: function( other, distance ) {
		var end = color( other ),
			spaceName = end._space(),
			space = spaces[ spaceName ],
			startColor = this.alpha() === 0 ? color( "transparent" ) : this,
			start = startColor[ space.cache ] || space.to( startColor._rgba ),
			result = start.slice();

		end = end[ space.cache ];
		each( space.props, function( key, prop ) {
			var index = prop.idx,
				startValue = start[ index ],
				endValue = end[ index ],
				type = propTypes[ prop.type ] || {};

			// If null, don't override start value
			if ( endValue === null ) {
				return;
			}

			// If null - use end
			if ( startValue === null ) {
				result[ index ] = endValue;
			} else {
				if ( type.mod ) {
					if ( endValue - startValue > type.mod / 2 ) {
						startValue += type.mod;
					} else if ( startValue - endValue > type.mod / 2 ) {
						startValue -= type.mod;
					}
				}
				result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
			}
		} );
		return this[ spaceName ]( result );
	},
	blend: function( opaque ) {

		// If we are already opaque - return ourself
		if ( this._rgba[ 3 ] === 1 ) {
			return this;
		}

		var rgb = this._rgba.slice(),
			a = rgb.pop(),
			blend = color( opaque )._rgba;

		return color( jQuery.map( rgb, function( v, i ) {
			return ( 1 - a ) * blend[ i ] + a * v;
		} ) );
	},
	toRgbaString: function() {
		var prefix = "rgba(",
			rgba = jQuery.map( this._rgba, function( v, i ) {
				return v == null ? ( i > 2 ? 1 : 0 ) : v;
			} );

		if ( rgba[ 3 ] === 1 ) {
			rgba.pop();
			prefix = "rgb(";
		}

		return prefix + rgba.join() + ")";
	},
	toHslaString: function() {
		var prefix = "hsla(",
			hsla = jQuery.map( this.hsla(), function( v, i ) {
				if ( v == null ) {
					v = i > 2 ? 1 : 0;
				}

				// Catch 1 and 2
				if ( i && i < 3 ) {
					v = Math.round( v * 100 ) + "%";
				}
				return v;
			} );

		if ( hsla[ 3 ] === 1 ) {
			hsla.pop();
			prefix = "hsl(";
		}
		return prefix + hsla.join() + ")";
	},
	toHexString: function( includeAlpha ) {
		var rgba = this._rgba.slice(),
			alpha = rgba.pop();

		if ( includeAlpha ) {
			rgba.push( ~~( alpha * 255 ) );
		}

		return "#" + jQuery.map( rgba, function( v ) {

			// Default to 0 when nulls exist
			v = ( v || 0 ).toString( 16 );
			return v.length === 1 ? "0" + v : v;
		} ).join( "" );
	},
	toString: function() {
		return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
	}
} );
color.fn.parse.prototype = color.fn;

// Hsla conversions adapted from:
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021

function hue2rgb( p, q, h ) {
	h = ( h + 1 ) % 1;
	if ( h * 6 < 1 ) {
		return p + ( q - p ) * h * 6;
	}
	if ( h * 2 < 1 ) {
		return q;
	}
	if ( h * 3 < 2 ) {
		return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
	}
	return p;
}

spaces.hsla.to = function( rgba ) {
	if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
		return [ null, null, null, rgba[ 3 ] ];
	}
	var r = rgba[ 0 ] / 255,
		g = rgba[ 1 ] / 255,
		b = rgba[ 2 ] / 255,
		a = rgba[ 3 ],
		max = Math.max( r, g, b ),
		min = Math.min( r, g, b ),
		diff = max - min,
		add = max + min,
		l = add * 0.5,
		h, s;

	if ( min === max ) {
		h = 0;
	} else if ( r === max ) {
		h = ( 60 * ( g - b ) / diff ) + 360;
	} else if ( g === max ) {
		h = ( 60 * ( b - r ) / diff ) + 120;
	} else {
		h = ( 60 * ( r - g ) / diff ) + 240;
	}

	// Chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
	// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
	if ( diff === 0 ) {
		s = 0;
	} else if ( l <= 0.5 ) {
		s = diff / add;
	} else {
		s = diff / ( 2 - add );
	}
	return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
};

spaces.hsla.from = function( hsla ) {
	if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
		return [ null, null, null, hsla[ 3 ] ];
	}
	var h = hsla[ 0 ] / 360,
		s = hsla[ 1 ],
		l = hsla[ 2 ],
		a = hsla[ 3 ],
		q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
		p = 2 * l - q;

	return [
		Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
		Math.round( hue2rgb( p, q, h ) * 255 ),
		Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
		a
	];
};

each( spaces, function( spaceName, space ) {
	var props = space.props,
		cache = space.cache,
		to = space.to,
		from = space.from;

	// Makes rgba() and hsla()
	color.fn[ spaceName ] = function( value ) {

		// Generate a cache for this space if it doesn't exist
		if ( to && !this[ cache ] ) {
			this[ cache ] = to( this._rgba );
		}
		if ( value === undefined ) {
			return this[ cache ].slice();
		}

		var ret,
			type = jQuery.type( value ),
			arr = ( type === "array" || type === "object" ) ? value : arguments,
			local = this[ cache ].slice();

		each( props, function( key, prop ) {
			var val = arr[ type === "object" ? key : prop.idx ];
			if ( val == null ) {
				val = local[ prop.idx ];
			}
			local[ prop.idx ] = clamp( val, prop );
		} );

		if ( from ) {
			ret = color( from( local ) );
			ret[ cache ] = local;
			return ret;
		} else {
			return color( local );
		}
	};

	// Makes red() green() blue() alpha() hue() saturation() lightness()
	each( props, function( key, prop ) {

		// Alpha is included in more than one space
		if ( color.fn[ key ] ) {
			return;
		}
		color.fn[ key ] = function( value ) {
			var vtype = jQuery.type( value ),
				fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
				local = this[ fn ](),
				cur = local[ prop.idx ],
				match;

			if ( vtype === "undefined" ) {
				return cur;
			}

			if ( vtype === "function" ) {
				value = value.call( this, cur );
				vtype = jQuery.type( value );
			}
			if ( value == null && prop.empty ) {
				return this;
			}
			if ( vtype === "string" ) {
				match = rplusequals.exec( value );
				if ( match ) {
					value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
				}
			}
			local[ prop.idx ] = value;
			return this[ fn ]( local );
		};
	} );
} );

// Add cssHook and .fx.step function for each named hook.
// accept a space separated string of properties
color.hook = function( hook ) {
	var hooks = hook.split( " " );
	each( hooks, function( i, hook ) {
		jQuery.cssHooks[ hook ] = {
			set: function( elem, value ) {
				var parsed, curElem,
					backgroundColor = "";

				if ( value !== "transparent" && ( jQuery.type( value ) !== "string" ||
						( parsed = stringParse( value ) ) ) ) {
					value = color( parsed || value );
					if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
						curElem = hook === "backgroundColor" ? elem.parentNode : elem;
						while (
							( backgroundColor === "" || backgroundColor === "transparent" ) &&
							curElem && curElem.style
						) {
							try {
								backgroundColor = jQuery.css( curElem, "backgroundColor" );
								curElem = curElem.parentNode;
							} catch ( e ) {
							}
						}

						value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
							backgroundColor :
							"_default" );
					}

					value = value.toRgbaString();
				}
				try {
					elem.style[ hook ] = value;
				} catch ( e ) {

					// Wrapped to prevent IE from throwing errors on "invalid" values like
					// 'auto' or 'inherit'
				}
			}
		};
		jQuery.fx.step[ hook ] = function( fx ) {
			if ( !fx.colorInit ) {
				fx.start = color( fx.elem, hook );
				fx.end = color( fx.end );
				fx.colorInit = true;
			}
			jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
		};
	} );

};

color.hook( stepHooks );

jQuery.cssHooks.borderColor = {
	expand: function( value ) {
		var expanded = {};

		each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
			expanded[ "border" + part + "Color" ] = value;
		} );
		return expanded;
	}
};

// Basic color names only.
// Usage of any of the other color names requires adding yourself or including
// jquery.color.svg-names.js.
colors = jQuery.Color.names = {

	// 4.1. Basic color keywords
	aqua: "#00ffff",
	black: "#000000",
	blue: "#0000ff",
	fuchsia: "#ff00ff",
	gray: "#808080",
	green: "#008000",
	lime: "#00ff00",
	maroon: "#800000",
	navy: "#000080",
	olive: "#808000",
	purple: "#800080",
	red: "#ff0000",
	silver: "#c0c0c0",
	teal: "#008080",
	white: "#ffffff",
	yellow: "#ffff00",

	// 4.2.3. "transparent" color keyword
	transparent: [ null, null, null, 0 ],

	_default: "#ffffff"
};

} )( jQuery );

/******************************************************************************/
/****************************** CLASS ANIMATIONS ******************************/
/******************************************************************************/
( function() {

var classAnimationActions = [ "add", "remove", "toggle" ],
	shorthandStyles = {
		border: 1,
		borderBottom: 1,
		borderColor: 1,
		borderLeft: 1,
		borderRight: 1,
		borderTop: 1,
		borderWidth: 1,
		margin: 1,
		padding: 1
	};

$.each(
	[ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
	function( _, prop ) {
		$.fx.step[ prop ] = function( fx ) {
			if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
				jQuery.style( fx.elem, prop, fx.end );
				fx.setAttr = true;
			}
		};
	}
);

function getElementStyles( elem ) {
	var key, len,
		style = elem.ownerDocument.defaultView ?
			elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
			elem.currentStyle,
		styles = {};

	if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
		len = style.length;
		while ( len-- ) {
			key = style[ len ];
			if ( typeof style[ key ] === "string" ) {
				styles[ $.camelCase( key ) ] = style[ key ];
			}
		}

	// Support: Opera, IE <9
	} else {
		for ( key in style ) {
			if ( typeof style[ key ] === "string" ) {
				styles[ key ] = style[ key ];
			}
		}
	}

	return styles;
}

function styleDifference( oldStyle, newStyle ) {
	var diff = {},
		name, value;

	for ( name in newStyle ) {
		value = newStyle[ name ];
		if ( oldStyle[ name ] !== value ) {
			if ( !shorthandStyles[ name ] ) {
				if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
					diff[ name ] = value;
				}
			}
		}
	}

	return diff;
}

// Support: jQuery <1.8
if ( !$.fn.addBack ) {
	$.fn.addBack = function( selector ) {
		return this.add( selector == null ?
			this.prevObject : this.prevObject.filter( selector )
		);
	};
}

$.effects.animateClass = function( value, duration, easing, callback ) {
	var o = $.speed( duration, easing, callback );

	return this.queue( function() {
		var animated = $( this ),
			baseClass = animated.attr( "class" ) || "",
			applyClassChange,
			allAnimations = o.children ? animated.find( "*" ).addBack() : animated;

		// Map the animated objects to store the original styles.
		allAnimations = allAnimations.map( function() {
			var el = $( this );
			return {
				el: el,
				start: getElementStyles( this )
			};
		} );

		// Apply class change
		applyClassChange = function() {
			$.each( classAnimationActions, function( i, action ) {
				if ( value[ action ] ) {
					animated[ action + "Class" ]( value[ action ] );
				}
			} );
		};
		applyClassChange();

		// Map all animated objects again - calculate new styles and diff
		allAnimations = allAnimations.map( function() {
			this.end = getElementStyles( this.el[ 0 ] );
			this.diff = styleDifference( this.start, this.end );
			return this;
		} );

		// Apply original class
		animated.attr( "class", baseClass );

		// Map all animated objects again - this time collecting a promise
		allAnimations = allAnimations.map( function() {
			var styleInfo = this,
				dfd = $.Deferred(),
				opts = $.extend( {}, o, {
					queue: false,
					complete: function() {
						dfd.resolve( styleInfo );
					}
				} );

			this.el.animate( this.diff, opts );
			return dfd.promise();
		} );

		// Once all animations have completed:
		$.when.apply( $, allAnimations.get() ).done( function() {

			// Set the final class
			applyClassChange();

			// For each animated element,
			// clear all css properties that were animated
			$.each( arguments, function() {
				var el = this.el;
				$.each( this.diff, function( key ) {
					el.css( key, "" );
				} );
			} );

			// This is guarnteed to be there if you use jQuery.speed()
			// it also handles dequeuing the next anim...
			o.complete.call( animated[ 0 ] );
		} );
	} );
};

$.fn.extend( {
	addClass: ( function( orig ) {
		return function( classNames, speed, easing, callback ) {
			return speed ?
				$.effects.animateClass.call( this,
					{ add: classNames }, speed, easing, callback ) :
				orig.apply( this, arguments );
		};
	} )( $.fn.addClass ),

	removeClass: ( function( orig ) {
		return function( classNames, speed, easing, callback ) {
			return arguments.length > 1 ?
				$.effects.animateClass.call( this,
					{ remove: classNames }, speed, easing, callback ) :
				orig.apply( this, arguments );
		};
	} )( $.fn.removeClass ),

	toggleClass: ( function( orig ) {
		return function( classNames, force, speed, easing, callback ) {
			if ( typeof force === "boolean" || force === undefined ) {
				if ( !speed ) {

					// Without speed parameter
					return orig.apply( this, arguments );
				} else {
					return $.effects.animateClass.call( this,
						( force ? { add: classNames } : { remove: classNames } ),
						speed, easing, callback );
				}
			} else {

				// Without force parameter
				return $.effects.animateClass.call( this,
					{ toggle: classNames }, force, speed, easing );
			}
		};
	} )( $.fn.toggleClass ),

	switchClass: function( remove, add, speed, easing, callback ) {
		return $.effects.animateClass.call( this, {
			add: add,
			remove: remove
		}, speed, easing, callback );
	}
} );

} )();

/******************************************************************************/
/*********************************** EFFECTS **********************************/
/******************************************************************************/

( function() {

if ( $.expr && $.expr.filters && $.expr.filters.animated ) {
	$.expr.filters.animated = ( function( orig ) {
		return function( elem ) {
			return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
		};
	} )( $.expr.filters.animated );
}

if ( $.uiBackCompat !== false ) {
	$.extend( $.effects, {

		// Saves a set of properties in a data storage
		save: function( element, set ) {
			var i = 0, length = set.length;
			for ( ; i < length; i++ ) {
				if ( set[ i ] !== null ) {
					element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
				}
			}
		},

		// Restores a set of previously saved properties from a data storage
		restore: function( element, set ) {
			var val, i = 0, length = set.length;
			for ( ; i < length; i++ ) {
				if ( set[ i ] !== null ) {
					val = element.data( dataSpace + set[ i ] );
					element.css( set[ i ], val );
				}
			}
		},

		setMode: function( el, mode ) {
			if ( mode === "toggle" ) {
				mode = el.is( ":hidden" ) ? "show" : "hide";
			}
			return mode;
		},

		// Wraps the element around a wrapper that copies position properties
		createWrapper: function( element ) {

			// If the element is already wrapped, return it
			if ( element.parent().is( ".ui-effects-wrapper" ) ) {
				return element.parent();
			}

			// Wrap the element
			var props = {
					width: element.outerWidth( true ),
					height: element.outerHeight( true ),
					"float": element.css( "float" )
				},
				wrapper = $( "<div></div>" )
					.addClass( "ui-effects-wrapper" )
					.css( {
						fontSize: "100%",
						background: "transparent",
						border: "none",
						margin: 0,
						padding: 0
					} ),

				// Store the size in case width/height are defined in % - Fixes #5245
				size = {
					width: element.width(),
					height: element.height()
				},
				active = document.activeElement;

			// Support: Firefox
			// Firefox incorrectly exposes anonymous content
			// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
			try {
				active.id;
			} catch ( e ) {
				active = document.body;
			}

			element.wrap( wrapper );

			// Fixes #7595 - Elements lose focus when wrapped.
			if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
				$( active ).trigger( "focus" );
			}

			// Hotfix for jQuery 1.4 since some change in wrap() seems to actually
			// lose the reference to the wrapped element
			wrapper = element.parent();

			// Transfer positioning properties to the wrapper
			if ( element.css( "position" ) === "static" ) {
				wrapper.css( { position: "relative" } );
				element.css( { position: "relative" } );
			} else {
				$.extend( props, {
					position: element.css( "position" ),
					zIndex: element.css( "z-index" )
				} );
				$.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
					props[ pos ] = element.css( pos );
					if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
						props[ pos ] = "auto";
					}
				} );
				element.css( {
					position: "relative",
					top: 0,
					left: 0,
					right: "auto",
					bottom: "auto"
				} );
			}
			element.css( size );

			return wrapper.css( props ).show();
		},

		removeWrapper: function( element ) {
			var active = document.activeElement;

			if ( element.parent().is( ".ui-effects-wrapper" ) ) {
				element.parent().replaceWith( element );

				// Fixes #7595 - Elements lose focus when wrapped.
				if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
					$( active ).trigger( "focus" );
				}
			}

			return element;
		}
	} );
}

$.extend( $.effects, {
	version: "1.12.1",

	define: function( name, mode, effect ) {
		if ( !effect ) {
			effect = mode;
			mode = "effect";
		}

		$.effects.effect[ name ] = effect;
		$.effects.effect[ name ].mode = mode;

		return effect;
	},

	scaledDimensions: function( element, percent, direction ) {
		if ( percent === 0 ) {
			return {
				height: 0,
				width: 0,
				outerHeight: 0,
				outerWidth: 0
			};
		}

		var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
			y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;

		return {
			height: element.height() * y,
			width: element.width() * x,
			outerHeight: element.outerHeight() * y,
			outerWidth: element.outerWidth() * x
		};

	},

	clipToBox: function( animation ) {
		return {
			width: animation.clip.right - animation.clip.left,
			height: animation.clip.bottom - animation.clip.top,
			left: animation.clip.left,
			top: animation.clip.top
		};
	},

	// Injects recently queued functions to be first in line (after "inprogress")
	unshift: function( element, queueLength, count ) {
		var queue = element.queue();

		if ( queueLength > 1 ) {
			queue.splice.apply( queue,
				[ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
		}
		element.dequeue();
	},

	saveStyle: function( element ) {
		element.data( dataSpaceStyle, element[ 0 ].style.cssText );
	},

	restoreStyle: function( element ) {
		element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
		element.removeData( dataSpaceStyle );
	},

	mode: function( element, mode ) {
		var hidden = element.is( ":hidden" );

		if ( mode === "toggle" ) {
			mode = hidden ? "show" : "hide";
		}
		if ( hidden ? mode === "hide" : mode === "show" ) {
			mode = "none";
		}
		return mode;
	},

	// Translates a [top,left] array into a baseline value
	getBaseline: function( origin, original ) {
		var y, x;

		switch ( origin[ 0 ] ) {
		case "top":
			y = 0;
			break;
		case "middle":
			y = 0.5;
			break;
		case "bottom":
			y = 1;
			break;
		default:
			y = origin[ 0 ] / original.height;
		}

		switch ( origin[ 1 ] ) {
		case "left":
			x = 0;
			break;
		case "center":
			x = 0.5;
			break;
		case "right":
			x = 1;
			break;
		default:
			x = origin[ 1 ] / original.width;
		}

		return {
			x: x,
			y: y
		};
	},

	// Creates a placeholder element so that the original element can be made absolute
	createPlaceholder: function( element ) {
		var placeholder,
			cssPosition = element.css( "position" ),
			position = element.position();

		// Lock in margins first to account for form elements, which
		// will change margin if you explicitly set height
		// see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
		// Support: Safari
		element.css( {
			marginTop: element.css( "marginTop" ),
			marginBottom: element.css( "marginBottom" ),
			marginLeft: element.css( "marginLeft" ),
			marginRight: element.css( "marginRight" )
		} )
		.outerWidth( element.outerWidth() )
		.outerHeight( element.outerHeight() );

		if ( /^(static|relative)/.test( cssPosition ) ) {
			cssPosition = "absolute";

			placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {

				// Convert inline to inline block to account for inline elements
				// that turn to inline block based on content (like img)
				display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
					"inline-block" :
					"block",
				visibility: "hidden",

				// Margins need to be set to account for margin collapse
				marginTop: element.css( "marginTop" ),
				marginBottom: element.css( "marginBottom" ),
				marginLeft: element.css( "marginLeft" ),
				marginRight: element.css( "marginRight" ),
				"float": element.css( "float" )
			} )
			.outerWidth( element.outerWidth() )
			.outerHeight( element.outerHeight() )
			.addClass( "ui-effects-placeholder" );

			element.data( dataSpace + "placeholder", placeholder );
		}

		element.css( {
			position: cssPosition,
			left: position.left,
			top: position.top
		} );

		return placeholder;
	},

	removePlaceholder: function( element ) {
		var dataKey = dataSpace + "placeholder",
				placeholder = element.data( dataKey );

		if ( placeholder ) {
			placeholder.remove();
			element.removeData( dataKey );
		}
	},

	// Removes a placeholder if it exists and restores
	// properties that were modified during placeholder creation
	cleanUp: function( element ) {
		$.effects.restoreStyle( element );
		$.effects.removePlaceholder( element );
	},

	setTransition: function( element, list, factor, value ) {
		value = value || {};
		$.each( list, function( i, x ) {
			var unit = element.cssUnit( x );
			if ( unit[ 0 ] > 0 ) {
				value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
			}
		} );
		return value;
	}
} );

// Return an effect options object for the given parameters:
function _normalizeArguments( effect, options, speed, callback ) {

	// Allow passing all options as the first parameter
	if ( $.isPlainObject( effect ) ) {
		options = effect;
		effect = effect.effect;
	}

	// Convert to an object
	effect = { effect: effect };

	// Catch (effect, null, ...)
	if ( options == null ) {
		options = {};
	}

	// Catch (effect, callback)
	if ( $.isFunction( options ) ) {
		callback = options;
		speed = null;
		options = {};
	}

	// Catch (effect, speed, ?)
	if ( typeof options === "number" || $.fx.speeds[ options ] ) {
		callback = speed;
		speed = options;
		options = {};
	}

	// Catch (effect, options, callback)
	if ( $.isFunction( speed ) ) {
		callback = speed;
		speed = null;
	}

	// Add options to effect
	if ( options ) {
		$.extend( effect, options );
	}

	speed = speed || options.duration;
	effect.duration = $.fx.off ? 0 :
		typeof speed === "number" ? speed :
		speed in $.fx.speeds ? $.fx.speeds[ speed ] :
		$.fx.speeds._default;

	effect.complete = callback || options.complete;

	return effect;
}

function standardAnimationOption( option ) {

	// Valid standard speeds (nothing, number, named speed)
	if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
		return true;
	}

	// Invalid strings - treat as "normal" speed
	if ( typeof option === "string" && !$.effects.effect[ option ] ) {
		return true;
	}

	// Complete callback
	if ( $.isFunction( option ) ) {
		return true;
	}

	// Options hash (but not naming an effect)
	if ( typeof option === "object" && !option.effect ) {
		return true;
	}

	// Didn't match any standard API
	return false;
}

$.fn.extend( {
	effect: function( /* effect, options, speed, callback */ ) {
		var args = _normalizeArguments.apply( this, arguments ),
			effectMethod = $.effects.effect[ args.effect ],
			defaultMode = effectMethod.mode,
			queue = args.queue,
			queueName = queue || "fx",
			complete = args.complete,
			mode = args.mode,
			modes = [],
			prefilter = function( next ) {
				var el = $( this ),
					normalizedMode = $.effects.mode( el, mode ) || defaultMode;

				// Sentinel for duck-punching the :animated psuedo-selector
				el.data( dataSpaceAnimated, true );

				// Save effect mode for later use,
				// we can't just call $.effects.mode again later,
				// as the .show() below destroys the initial state
				modes.push( normalizedMode );

				// See $.uiBackCompat inside of run() for removal of defaultMode in 1.13
				if ( defaultMode && ( normalizedMode === "show" ||
						( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
					el.show();
				}

				if ( !defaultMode || normalizedMode !== "none" ) {
					$.effects.saveStyle( el );
				}

				if ( $.isFunction( next ) ) {
					next();
				}
			};

		if ( $.fx.off || !effectMethod ) {

			// Delegate to the original method (e.g., .show()) if possible
			if ( mode ) {
				return this[ mode ]( args.duration, complete );
			} else {
				return this.each( function() {
					if ( complete ) {
						complete.call( this );
					}
				} );
			}
		}

		function run( next ) {
			var elem = $( this );

			function cleanup() {
				elem.removeData( dataSpaceAnimated );

				$.effects.cleanUp( elem );

				if ( args.mode === "hide" ) {
					elem.hide();
				}

				done();
			}

			function done() {
				if ( $.isFunction( complete ) ) {
					complete.call( elem[ 0 ] );
				}

				if ( $.isFunction( next ) ) {
					next();
				}
			}

			// Override mode option on a per element basis,
			// as toggle can be either show or hide depending on element state
			args.mode = modes.shift();

			if ( $.uiBackCompat !== false && !defaultMode ) {
				if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {

					// Call the core method to track "olddisplay" properly
					elem[ mode ]();
					done();
				} else {
					effectMethod.call( elem[ 0 ], args, done );
				}
			} else {
				if ( args.mode === "none" ) {

					// Call the core method to track "olddisplay" properly
					elem[ mode ]();
					done();
				} else {
					effectMethod.call( elem[ 0 ], args, cleanup );
				}
			}
		}

		// Run prefilter on all elements first to ensure that
		// any showing or hiding happens before placeholder creation,
		// which ensures that any layout changes are correctly captured.
		return queue === false ?
			this.each( prefilter ).each( run ) :
			this.queue( queueName, prefilter ).queue( queueName, run );
	},

	show: ( function( orig ) {
		return function( option ) {
			if ( standardAnimationOption( option ) ) {
				return orig.apply( this, arguments );
			} else {
				var args = _normalizeArguments.apply( this, arguments );
				args.mode = "show";
				return this.effect.call( this, args );
			}
		};
	} )( $.fn.show ),

	hide: ( function( orig ) {
		return function( option ) {
			if ( standardAnimationOption( option ) ) {
				return orig.apply( this, arguments );
			} else {
				var args = _normalizeArguments.apply( this, arguments );
				args.mode = "hide";
				return this.effect.call( this, args );
			}
		};
	} )( $.fn.hide ),

	toggle: ( function( orig ) {
		return function( option ) {
			if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
				return orig.apply( this, arguments );
			} else {
				var args = _normalizeArguments.apply( this, arguments );
				args.mode = "toggle";
				return this.effect.call( this, args );
			}
		};
	} )( $.fn.toggle ),

	cssUnit: function( key ) {
		var style = this.css( key ),
			val = [];

		$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
			if ( style.indexOf( unit ) > 0 ) {
				val = [ parseFloat( style ), unit ];
			}
		} );
		return val;
	},

	cssClip: function( clipObj ) {
		if ( clipObj ) {
			return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
				clipObj.bottom + "px " + clipObj.left + "px)" );
		}
		return parseClip( this.css( "clip" ), this );
	},

	transfer: function( options, done ) {
		var element = $( this ),
			target = $( options.to ),
			targetFixed = target.css( "position" ) === "fixed",
			body = $( "body" ),
			fixTop = targetFixed ? body.scrollTop() : 0,
			fixLeft = targetFixed ? body.scrollLeft() : 0,
			endPosition = target.offset(),
			animation = {
				top: endPosition.top - fixTop,
				left: endPosition.left - fixLeft,
				height: target.innerHeight(),
				width: target.innerWidth()
			},
			startPosition = element.offset(),
			transfer = $( "<div class='ui-effects-transfer'></div>" )
				.appendTo( "body" )
				.addClass( options.className )
				.css( {
					top: startPosition.top - fixTop,
					left: startPosition.left - fixLeft,
					height: element.innerHeight(),
					width: element.innerWidth(),
					position: targetFixed ? "fixed" : "absolute"
				} )
				.animate( animation, options.duration, options.easing, function() {
					transfer.remove();
					if ( $.isFunction( done ) ) {
						done();
					}
				} );
	}
} );

function parseClip( str, element ) {
		var outerWidth = element.outerWidth(),
			outerHeight = element.outerHeight(),
			clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
			values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];

		return {
			top: parseFloat( values[ 1 ] ) || 0,
			right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
			bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
			left: parseFloat( values[ 4 ] ) || 0
		};
}

$.fx.step.clip = function( fx ) {
	if ( !fx.clipInit ) {
		fx.start = $( fx.elem ).cssClip();
		if ( typeof fx.end === "string" ) {
			fx.end = parseClip( fx.end, fx.elem );
		}
		fx.clipInit = true;
	}

	$( fx.elem ).cssClip( {
		top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
		right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
		bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
		left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
	} );
};

} )();

/******************************************************************************/
/*********************************** EASING ***********************************/
/******************************************************************************/

( function() {

// Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)

var baseEasings = {};

$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
	baseEasings[ name ] = function( p ) {
		return Math.pow( p, i + 2 );
	};
} );

$.extend( baseEasings, {
	Sine: function( p ) {
		return 1 - Math.cos( p * Math.PI / 2 );
	},
	Circ: function( p ) {
		return 1 - Math.sqrt( 1 - p * p );
	},
	Elastic: function( p ) {
		return p === 0 || p === 1 ? p :
			-Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
	},
	Back: function( p ) {
		return p * p * ( 3 * p - 2 );
	},
	Bounce: function( p ) {
		var pow2,
			bounce = 4;

		while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
		return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
	}
} );

$.each( baseEasings, function( name, easeIn ) {
	$.easing[ "easeIn" + name ] = easeIn;
	$.easing[ "easeOut" + name ] = function( p ) {
		return 1 - easeIn( 1 - p );
	};
	$.easing[ "easeInOut" + name ] = function( p ) {
		return p < 0.5 ?
			easeIn( p * 2 ) / 2 :
			1 - easeIn( p * -2 + 2 ) / 2;
	};
} );

} )();

var effect = $.effects;


/*!
 * jQuery UI Effects Blind 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Blind Effect
//>>group: Effects
//>>description: Blinds the element.
//>>docs: http://api.jqueryui.com/blind-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, done ) {
	var map = {
			up: [ "bottom", "top" ],
			vertical: [ "bottom", "top" ],
			down: [ "top", "bottom" ],
			left: [ "right", "left" ],
			horizontal: [ "right", "left" ],
			right: [ "left", "right" ]
		},
		element = $( this ),
		direction = options.direction || "up",
		start = element.cssClip(),
		animate = { clip: $.extend( {}, start ) },
		placeholder = $.effects.createPlaceholder( element );

	animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];

	if ( options.mode === "show" ) {
		element.cssClip( animate.clip );
		if ( placeholder ) {
			placeholder.css( $.effects.clipToBox( animate ) );
		}

		animate.clip = start;
	}

	if ( placeholder ) {
		placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
	}

	element.animate( animate, {
		queue: false,
		duration: options.duration,
		easing: options.easing,
		complete: done
	} );
} );


/*!
 * jQuery UI Effects Bounce 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Bounce Effect
//>>group: Effects
//>>description: Bounces an element horizontally or vertically n times.
//>>docs: http://api.jqueryui.com/bounce-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectBounce = $.effects.define( "bounce", function( options, done ) {
	var upAnim, downAnim, refValue,
		element = $( this ),

		// Defaults:
		mode = options.mode,
		hide = mode === "hide",
		show = mode === "show",
		direction = options.direction || "up",
		distance = options.distance,
		times = options.times || 5,

		// Number of internal animations
		anims = times * 2 + ( show || hide ? 1 : 0 ),
		speed = options.duration / anims,
		easing = options.easing,

		// Utility:
		ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
		motion = ( direction === "up" || direction === "left" ),
		i = 0,

		queuelen = element.queue().length;

	$.effects.createPlaceholder( element );

	refValue = element.css( ref );

	// Default distance for the BIGGEST bounce is the outer Distance / 3
	if ( !distance ) {
		distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
	}

	if ( show ) {
		downAnim = { opacity: 1 };
		downAnim[ ref ] = refValue;

		// If we are showing, force opacity 0 and set the initial position
		// then do the "first" animation
		element
			.css( "opacity", 0 )
			.css( ref, motion ? -distance * 2 : distance * 2 )
			.animate( downAnim, speed, easing );
	}

	// Start at the smallest distance if we are hiding
	if ( hide ) {
		distance = distance / Math.pow( 2, times - 1 );
	}

	downAnim = {};
	downAnim[ ref ] = refValue;

	// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
	for ( ; i < times; i++ ) {
		upAnim = {};
		upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;

		element
			.animate( upAnim, speed, easing )
			.animate( downAnim, speed, easing );

		distance = hide ? distance * 2 : distance / 2;
	}

	// Last Bounce when Hiding
	if ( hide ) {
		upAnim = { opacity: 0 };
		upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;

		element.animate( upAnim, speed, easing );
	}

	element.queue( done );

	$.effects.unshift( element, queuelen, anims + 1 );
} );


/*!
 * jQuery UI Effects Clip 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Clip Effect
//>>group: Effects
//>>description: Clips the element on and off like an old TV.
//>>docs: http://api.jqueryui.com/clip-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectClip = $.effects.define( "clip", "hide", function( options, done ) {
	var start,
		animate = {},
		element = $( this ),
		direction = options.direction || "vertical",
		both = direction === "both",
		horizontal = both || direction === "horizontal",
		vertical = both || direction === "vertical";

	start = element.cssClip();
	animate.clip = {
		top: vertical ? ( start.bottom - start.top ) / 2 : start.top,
		right: horizontal ? ( start.right - start.left ) / 2 : start.right,
		bottom: vertical ? ( start.bottom - start.top ) / 2 : start.bottom,
		left: horizontal ? ( start.right - start.left ) / 2 : start.left
	};

	$.effects.createPlaceholder( element );

	if ( options.mode === "show" ) {
		element.cssClip( animate.clip );
		animate.clip = start;
	}

	element.animate( animate, {
		queue: false,
		duration: options.duration,
		easing: options.easing,
		complete: done
	} );

} );


/*!
 * jQuery UI Effects Drop 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Drop Effect
//>>group: Effects
//>>description: Moves an element in one direction and hides it at the same time.
//>>docs: http://api.jqueryui.com/drop-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, done ) {

	var distance,
		element = $( this ),
		mode = options.mode,
		show = mode === "show",
		direction = options.direction || "left",
		ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
		motion = ( direction === "up" || direction === "left" ) ? "-=" : "+=",
		oppositeMotion = ( motion === "+=" ) ? "-=" : "+=",
		animation = {
			opacity: 0
		};

	$.effects.createPlaceholder( element );

	distance = options.distance ||
		element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;

	animation[ ref ] = motion + distance;

	if ( show ) {
		element.css( animation );

		animation[ ref ] = oppositeMotion + distance;
		animation.opacity = 1;
	}

	// Animate
	element.animate( animation, {
		queue: false,
		duration: options.duration,
		easing: options.easing,
		complete: done
	} );
} );


/*!
 * jQuery UI Effects Explode 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Explode Effect
//>>group: Effects
// jscs:disable maximumLineLength
//>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
// jscs:enable maximumLineLength
//>>docs: http://api.jqueryui.com/explode-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectExplode = $.effects.define( "explode", "hide", function( options, done ) {

	var i, j, left, top, mx, my,
		rows = options.pieces ? Math.round( Math.sqrt( options.pieces ) ) : 3,
		cells = rows,
		element = $( this ),
		mode = options.mode,
		show = mode === "show",

		// Show and then visibility:hidden the element before calculating offset
		offset = element.show().css( "visibility", "hidden" ).offset(),

		// Width and height of a piece
		width = Math.ceil( element.outerWidth() / cells ),
		height = Math.ceil( element.outerHeight() / rows ),
		pieces = [];

	// Children animate complete:
	function childComplete() {
		pieces.push( this );
		if ( pieces.length === rows * cells ) {
			animComplete();
		}
	}

	// Clone the element for each row and cell.
	for ( i = 0; i < rows; i++ ) { // ===>
		top = offset.top + i * height;
		my = i - ( rows - 1 ) / 2;

		for ( j = 0; j < cells; j++ ) { // |||
			left = offset.left + j * width;
			mx = j - ( cells - 1 ) / 2;

			// Create a clone of the now hidden main element that will be absolute positioned
			// within a wrapper div off the -left and -top equal to size of our pieces
			element
				.clone()
				.appendTo( "body" )
				.wrap( "<div></div>" )
				.css( {
					position: "absolute",
					visibility: "visible",
					left: -j * width,
					top: -i * height
				} )

				// Select the wrapper - make it overflow: hidden and absolute positioned based on
				// where the original was located +left and +top equal to the size of pieces
				.parent()
					.addClass( "ui-effects-explode" )
					.css( {
						position: "absolute",
						overflow: "hidden",
						width: width,
						height: height,
						left: left + ( show ? mx * width : 0 ),
						top: top + ( show ? my * height : 0 ),
						opacity: show ? 0 : 1
					} )
					.animate( {
						left: left + ( show ? 0 : mx * width ),
						top: top + ( show ? 0 : my * height ),
						opacity: show ? 1 : 0
					}, options.duration || 500, options.easing, childComplete );
		}
	}

	function animComplete() {
		element.css( {
			visibility: "visible"
		} );
		$( pieces ).remove();
		done();
	}
} );


/*!
 * jQuery UI Effects Fade 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Fade Effect
//>>group: Effects
//>>description: Fades the element.
//>>docs: http://api.jqueryui.com/fade-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, done ) {
	var show = options.mode === "show";

	$( this )
		.css( "opacity", show ? 0 : 1 )
		.animate( {
			opacity: show ? 1 : 0
		}, {
			queue: false,
			duration: options.duration,
			easing: options.easing,
			complete: done
		} );
} );


/*!
 * jQuery UI Effects Fold 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Fold Effect
//>>group: Effects
//>>description: Folds an element first horizontally and then vertically.
//>>docs: http://api.jqueryui.com/fold-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectFold = $.effects.define( "fold", "hide", function( options, done ) {

	// Create element
	var element = $( this ),
		mode = options.mode,
		show = mode === "show",
		hide = mode === "hide",
		size = options.size || 15,
		percent = /([0-9]+)%/.exec( size ),
		horizFirst = !!options.horizFirst,
		ref = horizFirst ? [ "right", "bottom" ] : [ "bottom", "right" ],
		duration = options.duration / 2,

		placeholder = $.effects.createPlaceholder( element ),

		start = element.cssClip(),
		animation1 = { clip: $.extend( {}, start ) },
		animation2 = { clip: $.extend( {}, start ) },

		distance = [ start[ ref[ 0 ] ], start[ ref[ 1 ] ] ],

		queuelen = element.queue().length;

	if ( percent ) {
		size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
	}
	animation1.clip[ ref[ 0 ] ] = size;
	animation2.clip[ ref[ 0 ] ] = size;
	animation2.clip[ ref[ 1 ] ] = 0;

	if ( show ) {
		element.cssClip( animation2.clip );
		if ( placeholder ) {
			placeholder.css( $.effects.clipToBox( animation2 ) );
		}

		animation2.clip = start;
	}

	// Animate
	element
		.queue( function( next ) {
			if ( placeholder ) {
				placeholder
					.animate( $.effects.clipToBox( animation1 ), duration, options.easing )
					.animate( $.effects.clipToBox( animation2 ), duration, options.easing );
			}

			next();
		} )
		.animate( animation1, duration, options.easing )
		.animate( animation2, duration, options.easing )
		.queue( done );

	$.effects.unshift( element, queuelen, 4 );
} );


/*!
 * jQuery UI Effects Highlight 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Highlight Effect
//>>group: Effects
//>>description: Highlights the background of an element in a defined color for a custom duration.
//>>docs: http://api.jqueryui.com/highlight-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectHighlight = $.effects.define( "highlight", "show", function( options, done ) {
	var element = $( this ),
		animation = {
			backgroundColor: element.css( "backgroundColor" )
		};

	if ( options.mode === "hide" ) {
		animation.opacity = 0;
	}

	$.effects.saveStyle( element );

	element
		.css( {
			backgroundImage: "none",
			backgroundColor: options.color || "#ffff99"
		} )
		.animate( animation, {
			queue: false,
			duration: options.duration,
			easing: options.easing,
			complete: done
		} );
} );


/*!
 * jQuery UI Effects Size 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Size Effect
//>>group: Effects
//>>description: Resize an element to a specified width and height.
//>>docs: http://api.jqueryui.com/size-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectSize = $.effects.define( "size", function( options, done ) {

	// Create element
	var baseline, factor, temp,
		element = $( this ),

		// Copy for children
		cProps = [ "fontSize" ],
		vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
		hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],

		// Set options
		mode = options.mode,
		restore = mode !== "effect",
		scale = options.scale || "both",
		origin = options.origin || [ "middle", "center" ],
		position = element.css( "position" ),
		pos = element.position(),
		original = $.effects.scaledDimensions( element ),
		from = options.from || original,
		to = options.to || $.effects.scaledDimensions( element, 0 );

	$.effects.createPlaceholder( element );

	if ( mode === "show" ) {
		temp = from;
		from = to;
		to = temp;
	}

	// Set scaling factor
	factor = {
		from: {
			y: from.height / original.height,
			x: from.width / original.width
		},
		to: {
			y: to.height / original.height,
			x: to.width / original.width
		}
	};

	// Scale the css box
	if ( scale === "box" || scale === "both" ) {

		// Vertical props scaling
		if ( factor.from.y !== factor.to.y ) {
			from = $.effects.setTransition( element, vProps, factor.from.y, from );
			to = $.effects.setTransition( element, vProps, factor.to.y, to );
		}

		// Horizontal props scaling
		if ( factor.from.x !== factor.to.x ) {
			from = $.effects.setTransition( element, hProps, factor.from.x, from );
			to = $.effects.setTransition( element, hProps, factor.to.x, to );
		}
	}

	// Scale the content
	if ( scale === "content" || scale === "both" ) {

		// Vertical props scaling
		if ( factor.from.y !== factor.to.y ) {
			from = $.effects.setTransition( element, cProps, factor.from.y, from );
			to = $.effects.setTransition( element, cProps, factor.to.y, to );
		}
	}

	// Adjust the position properties based on the provided origin points
	if ( origin ) {
		baseline = $.effects.getBaseline( origin, original );
		from.top = ( original.outerHeight - from.outerHeight ) * baseline.y + pos.top;
		from.left = ( original.outerWidth - from.outerWidth ) * baseline.x + pos.left;
		to.top = ( original.outerHeight - to.outerHeight ) * baseline.y + pos.top;
		to.left = ( original.outerWidth - to.outerWidth ) * baseline.x + pos.left;
	}
	element.css( from );

	// Animate the children if desired
	if ( scale === "content" || scale === "both" ) {

		vProps = vProps.concat( [ "marginTop", "marginBottom" ] ).concat( cProps );
		hProps = hProps.concat( [ "marginLeft", "marginRight" ] );

		// Only animate children with width attributes specified
		// TODO: is this right? should we include anything with css width specified as well
		element.find( "*[width]" ).each( function() {
			var child = $( this ),
				childOriginal = $.effects.scaledDimensions( child ),
				childFrom = {
					height: childOriginal.height * factor.from.y,
					width: childOriginal.width * factor.from.x,
					outerHeight: childOriginal.outerHeight * factor.from.y,
					outerWidth: childOriginal.outerWidth * factor.from.x
				},
				childTo = {
					height: childOriginal.height * factor.to.y,
					width: childOriginal.width * factor.to.x,
					outerHeight: childOriginal.height * factor.to.y,
					outerWidth: childOriginal.width * factor.to.x
				};

			// Vertical props scaling
			if ( factor.from.y !== factor.to.y ) {
				childFrom = $.effects.setTransition( child, vProps, factor.from.y, childFrom );
				childTo = $.effects.setTransition( child, vProps, factor.to.y, childTo );
			}

			// Horizontal props scaling
			if ( factor.from.x !== factor.to.x ) {
				childFrom = $.effects.setTransition( child, hProps, factor.from.x, childFrom );
				childTo = $.effects.setTransition( child, hProps, factor.to.x, childTo );
			}

			if ( restore ) {
				$.effects.saveStyle( child );
			}

			// Animate children
			child.css( childFrom );
			child.animate( childTo, options.duration, options.easing, function() {

				// Restore children
				if ( restore ) {
					$.effects.restoreStyle( child );
				}
			} );
		} );
	}

	// Animate
	element.animate( to, {
		queue: false,
		duration: options.duration,
		easing: options.easing,
		complete: function() {

			var offset = element.offset();

			if ( to.opacity === 0 ) {
				element.css( "opacity", from.opacity );
			}

			if ( !restore ) {
				element
					.css( "position", position === "static" ? "relative" : position )
					.offset( offset );

				// Need to save style here so that automatic style restoration
				// doesn't restore to the original styles from before the animation.
				$.effects.saveStyle( element );
			}

			done();
		}
	} );

} );


/*!
 * jQuery UI Effects Scale 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Scale Effect
//>>group: Effects
//>>description: Grows or shrinks an element and its content.
//>>docs: http://api.jqueryui.com/scale-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectScale = $.effects.define( "scale", function( options, done ) {

	// Create element
	var el = $( this ),
		mode = options.mode,
		percent = parseInt( options.percent, 10 ) ||
			( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),

		newOptions = $.extend( true, {
			from: $.effects.scaledDimensions( el ),
			to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
			origin: options.origin || [ "middle", "center" ]
		}, options );

	// Fade option to support puff
	if ( options.fade ) {
		newOptions.from.opacity = 1;
		newOptions.to.opacity = 0;
	}

	$.effects.effect.size.call( this, newOptions, done );
} );


/*!
 * jQuery UI Effects Puff 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Puff Effect
//>>group: Effects
//>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
//>>docs: http://api.jqueryui.com/puff-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, done ) {
	var newOptions = $.extend( true, {}, options, {
		fade: true,
		percent: parseInt( options.percent, 10 ) || 150
	} );

	$.effects.effect.scale.call( this, newOptions, done );
} );


/*!
 * jQuery UI Effects Pulsate 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Pulsate Effect
//>>group: Effects
//>>description: Pulsates an element n times by changing the opacity to zero and back.
//>>docs: http://api.jqueryui.com/pulsate-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( options, done ) {
	var element = $( this ),
		mode = options.mode,
		show = mode === "show",
		hide = mode === "hide",
		showhide = show || hide,

		// Showing or hiding leaves off the "last" animation
		anims = ( ( options.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
		duration = options.duration / anims,
		animateTo = 0,
		i = 1,
		queuelen = element.queue().length;

	if ( show || !element.is( ":visible" ) ) {
		element.css( "opacity", 0 ).show();
		animateTo = 1;
	}

	// Anims - 1 opacity "toggles"
	for ( ; i < anims; i++ ) {
		element.animate( { opacity: animateTo }, duration, options.easing );
		animateTo = 1 - animateTo;
	}

	element.animate( { opacity: animateTo }, duration, options.easing );

	element.queue( done );

	$.effects.unshift( element, queuelen, anims + 1 );
} );


/*!
 * jQuery UI Effects Shake 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Shake Effect
//>>group: Effects
//>>description: Shakes an element horizontally or vertically n times.
//>>docs: http://api.jqueryui.com/shake-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectShake = $.effects.define( "shake", function( options, done ) {

	var i = 1,
		element = $( this ),
		direction = options.direction || "left",
		distance = options.distance || 20,
		times = options.times || 3,
		anims = times * 2 + 1,
		speed = Math.round( options.duration / anims ),
		ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
		positiveMotion = ( direction === "up" || direction === "left" ),
		animation = {},
		animation1 = {},
		animation2 = {},

		queuelen = element.queue().length;

	$.effects.createPlaceholder( element );

	// Animation
	animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
	animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
	animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;

	// Animate
	element.animate( animation, speed, options.easing );

	// Shakes
	for ( ; i < times; i++ ) {
		element
			.animate( animation1, speed, options.easing )
			.animate( animation2, speed, options.easing );
	}

	element
		.animate( animation1, speed, options.easing )
		.animate( animation, speed / 2, options.easing )
		.queue( done );

	$.effects.unshift( element, queuelen, anims + 1 );
} );


/*!
 * jQuery UI Effects Slide 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Slide Effect
//>>group: Effects
//>>description: Slides an element in and out of the viewport.
//>>docs: http://api.jqueryui.com/slide-effect/
//>>demos: http://jqueryui.com/effect/



var effectsEffectSlide = $.effects.define( "slide", "show", function( options, done ) {
	var startClip, startRef,
		element = $( this ),
		map = {
			up: [ "bottom", "top" ],
			down: [ "top", "bottom" ],
			left: [ "right", "left" ],
			right: [ "left", "right" ]
		},
		mode = options.mode,
		direction = options.direction || "left",
		ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
		positiveMotion = ( direction === "up" || direction === "left" ),
		distance = options.distance ||
			element[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ),
		animation = {};

	$.effects.createPlaceholder( element );

	startClip = element.cssClip();
	startRef = element.position()[ ref ];

	// Define hide animation
	animation[ ref ] = ( positiveMotion ? -1 : 1 ) * distance + startRef;
	animation.clip = element.cssClip();
	animation.clip[ map[ direction ][ 1 ] ] = animation.clip[ map[ direction ][ 0 ] ];

	// Reverse the animation if we're showing
	if ( mode === "show" ) {
		element.cssClip( animation.clip );
		element.css( ref, animation[ ref ] );
		animation.clip = startClip;
		animation[ ref ] = startRef;
	}

	// Actually animate
	element.animate( animation, {
		queue: false,
		duration: options.duration,
		easing: options.easing,
		complete: done
	} );
} );


/*!
 * jQuery UI Effects Transfer 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Transfer Effect
//>>group: Effects
//>>description: Displays a transfer effect from one element to another.
//>>docs: http://api.jqueryui.com/transfer-effect/
//>>demos: http://jqueryui.com/effect/



var effect;
if ( $.uiBackCompat !== false ) {
	effect = $.effects.define( "transfer", function( options, done ) {
		$( this ).transfer( options, done );
	} );
}
var effectsEffectTransfer = effect;


/*!
 * jQuery UI Focusable 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: :focusable Selector
//>>group: Core
//>>description: Selects elements which can be focused.
//>>docs: http://api.jqueryui.com/focusable-selector/



// Selectors
$.ui.focusable = function( element, hasTabindex ) {
	var map, mapName, img, focusableIfVisible, fieldset,
		nodeName = element.nodeName.toLowerCase();

	if ( "area" === nodeName ) {
		map = element.parentNode;
		mapName = map.name;
		if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
			return false;
		}
		img = $( "img[usemap='#" + mapName + "']" );
		return img.length > 0 && img.is( ":visible" );
	}

	if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) {
		focusableIfVisible = !element.disabled;

		if ( focusableIfVisible ) {

			// Form controls within a disabled fieldset are disabled.
			// However, controls within the fieldset's legend do not get disabled.
			// Since controls generally aren't placed inside legends, we skip
			// this portion of the check.
			fieldset = $( element ).closest( "fieldset" )[ 0 ];
			if ( fieldset ) {
				focusableIfVisible = !fieldset.disabled;
			}
		}
	} else if ( "a" === nodeName ) {
		focusableIfVisible = element.href || hasTabindex;
	} else {
		focusableIfVisible = hasTabindex;
	}

	return focusableIfVisible && $( element ).is( ":visible" ) && visible( $( element ) );
};

// Support: IE 8 only
// IE 8 doesn't resolve inherit to visible/hidden for computed values
function visible( element ) {
	var visibility = element.css( "visibility" );
	while ( visibility === "inherit" ) {
		element = element.parent();
		visibility = element.css( "visibility" );
	}
	return visibility !== "hidden";
}

$.extend( $.expr[ ":" ], {
	focusable: function( element ) {
		return $.ui.focusable( element, $.attr( element, "tabindex" ) != null );
	}
} );

var focusable = $.ui.focusable;




// Support: IE8 Only
// IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
// with a string, so we need to find the proper form.
var form = $.fn.form = function() {
	return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
};


/*!
 * jQuery UI Form Reset Mixin 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Form Reset Mixin
//>>group: Core
//>>description: Refresh input widgets when their form is reset
//>>docs: http://api.jqueryui.com/form-reset-mixin/



var formResetMixin = $.ui.formResetMixin = {
	_formResetHandler: function() {
		var form = $( this );

		// Wait for the form reset to actually happen before refreshing
		setTimeout( function() {
			var instances = form.data( "ui-form-reset-instances" );
			$.each( instances, function() {
				this.refresh();
			} );
		} );
	},

	_bindFormResetHandler: function() {
		this.form = this.element.form();
		if ( !this.form.length ) {
			return;
		}

		var instances = this.form.data( "ui-form-reset-instances" ) || [];
		if ( !instances.length ) {

			// We don't use _on() here because we use a single event handler per form
			this.form.on( "reset.ui-form-reset", this._formResetHandler );
		}
		instances.push( this );
		this.form.data( "ui-form-reset-instances", instances );
	},

	_unbindFormResetHandler: function() {
		if ( !this.form.length ) {
			return;
		}

		var instances = this.form.data( "ui-form-reset-instances" );
		instances.splice( $.inArray( this, instances ), 1 );
		if ( instances.length ) {
			this.form.data( "ui-form-reset-instances", instances );
		} else {
			this.form
				.removeData( "ui-form-reset-instances" )
				.off( "reset.ui-form-reset" );
		}
	}
};


/*!
 * jQuery UI Support for jQuery core 1.7.x 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 */

//>>label: jQuery 1.7 Support
//>>group: Core
//>>description: Support version 1.7.x of jQuery core



// Support: jQuery 1.7 only
// Not a great way to check versions, but since we only support 1.7+ and only
// need to detect <1.8, this is a simple check that should suffice. Checking
// for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0
// and we'll never reach 1.70.0 (if we do, we certainly won't be supporting
// 1.7 anymore). See #11197 for why we're not using feature detection.
if ( $.fn.jquery.substring( 0, 3 ) === "1.7" ) {

	// Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight()
	// Unlike jQuery Core 1.8+, these only support numeric values to set the
	// dimensions in pixels
	$.each( [ "Width", "Height" ], function( i, name ) {
		var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
			type = name.toLowerCase(),
			orig = {
				innerWidth: $.fn.innerWidth,
				innerHeight: $.fn.innerHeight,
				outerWidth: $.fn.outerWidth,
				outerHeight: $.fn.outerHeight
			};

		function reduce( elem, size, border, margin ) {
			$.each( side, function() {
				size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
				if ( border ) {
					size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
				}
				if ( margin ) {
					size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
				}
			} );
			return size;
		}

		$.fn[ "inner" + name ] = function( size ) {
			if ( size === undefined ) {
				return orig[ "inner" + name ].call( this );
			}

			return this.each( function() {
				$( this ).css( type, reduce( this, size ) + "px" );
			} );
		};

		$.fn[ "outer" + name ] = function( size, margin ) {
			if ( typeof size !== "number" ) {
				return orig[ "outer" + name ].call( this, size );
			}

			return this.each( function() {
				$( this ).css( type, reduce( this, size, true, margin ) + "px" );
			} );
		};
	} );

	$.fn.addBack = function( selector ) {
		return this.add( selector == null ?
			this.prevObject : this.prevObject.filter( selector )
		);
	};
}

;
/*!
 * jQuery UI Keycode 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Keycode
//>>group: Core
//>>description: Provide keycodes as keynames
//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/


var keycode = $.ui.keyCode = {
	BACKSPACE: 8,
	COMMA: 188,
	DELETE: 46,
	DOWN: 40,
	END: 35,
	ENTER: 13,
	ESCAPE: 27,
	HOME: 36,
	LEFT: 37,
	PAGE_DOWN: 34,
	PAGE_UP: 33,
	PERIOD: 190,
	RIGHT: 39,
	SPACE: 32,
	TAB: 9,
	UP: 38
};




// Internal use only
var escapeSelector = $.ui.escapeSelector = ( function() {
	var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
	return function( selector ) {
		return selector.replace( selectorEscape, "\\$1" );
	};
} )();


/*!
 * jQuery UI Labels 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: labels
//>>group: Core
//>>description: Find all the labels associated with a given input
//>>docs: http://api.jqueryui.com/labels/



var labels = $.fn.labels = function() {
	var ancestor, selector, id, labels, ancestors;

	// Check control.labels first
	if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
		return this.pushStack( this[ 0 ].labels );
	}

	// Support: IE <= 11, FF <= 37, Android <= 2.3 only
	// Above browsers do not support control.labels. Everything below is to support them
	// as well as document fragments. control.labels does not work on document fragments
	labels = this.eq( 0 ).parents( "label" );

	// Look for the label based on the id
	id = this.attr( "id" );
	if ( id ) {

		// We don't search against the document in case the element
		// is disconnected from the DOM
		ancestor = this.eq( 0 ).parents().last();

		// Get a full set of top level ancestors
		ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );

		// Create a selector for the label based on the id
		selector = "label[for='" + $.ui.escapeSelector( id ) + "']";

		labels = labels.add( ancestors.find( selector ).addBack( selector ) );

	}

	// Return whatever we have found for labels
	return this.pushStack( labels );
};


/*!
 * jQuery UI Scroll Parent 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: scrollParent
//>>group: Core
//>>description: Get the closest ancestor element that is scrollable.
//>>docs: http://api.jqueryui.com/scrollParent/



var scrollParent = $.fn.scrollParent = function( includeHidden ) {
	var position = this.css( "position" ),
		excludeStaticParent = position === "absolute",
		overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
		scrollParent = this.parents().filter( function() {
			var parent = $( this );
			if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
				return false;
			}
			return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
				parent.css( "overflow-x" ) );
		} ).eq( 0 );

	return position === "fixed" || !scrollParent.length ?
		$( this[ 0 ].ownerDocument || document ) :
		scrollParent;
};


/*!
 * jQuery UI Tabbable 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: :tabbable Selector
//>>group: Core
//>>description: Selects elements which can be tabbed to.
//>>docs: http://api.jqueryui.com/tabbable-selector/



var tabbable = $.extend( $.expr[ ":" ], {
	tabbable: function( element ) {
		var tabIndex = $.attr( element, "tabindex" ),
			hasTabindex = tabIndex != null;
		return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex );
	}
} );


/*!
 * jQuery UI Unique ID 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: uniqueId
//>>group: Core
//>>description: Functions to generate and remove uniqueId's
//>>docs: http://api.jqueryui.com/uniqueId/



var uniqueId = $.fn.extend( {
	uniqueId: ( function() {
		var uuid = 0;

		return function() {
			return this.each( function() {
				if ( !this.id ) {
					this.id = "ui-id-" + ( ++uuid );
				}
			} );
		};
	} )(),

	removeUniqueId: function() {
		return this.each( function() {
			if ( /^ui-id-\d+$/.test( this.id ) ) {
				$( this ).removeAttr( "id" );
			}
		} );
	}
} );


/*!
 * jQuery UI Accordion 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Accordion
//>>group: Widgets
// jscs:disable maximumLineLength
//>>description: Displays collapsible content panels for presenting information in a limited amount of space.
// jscs:enable maximumLineLength
//>>docs: http://api.jqueryui.com/accordion/
//>>demos: http://jqueryui.com/accordion/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/accordion.css
//>>css.theme: ../../themes/base/theme.css



var widgetsAccordion = $.widget( "ui.accordion", {
	version: "1.12.1",
	options: {
		active: 0,
		animate: {},
		classes: {
			"ui-accordion-header": "ui-corner-top",
			"ui-accordion-header-collapsed": "ui-corner-all",
			"ui-accordion-content": "ui-corner-bottom"
		},
		collapsible: false,
		event: "click",
		header: "> li > :first-child, > :not(li):even",
		heightStyle: "auto",
		icons: {
			activeHeader: "ui-icon-triangle-1-s",
			header: "ui-icon-triangle-1-e"
		},

		// Callbacks
		activate: null,
		beforeActivate: null
	},

	hideProps: {
		borderTopWidth: "hide",
		borderBottomWidth: "hide",
		paddingTop: "hide",
		paddingBottom: "hide",
		height: "hide"
	},

	showProps: {
		borderTopWidth: "show",
		borderBottomWidth: "show",
		paddingTop: "show",
		paddingBottom: "show",
		height: "show"
	},

	_create: function() {
		var options = this.options;

		this.prevShow = this.prevHide = $();
		this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
		this.element.attr( "role", "tablist" );

		// Don't allow collapsible: false and active: false / null
		if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
			options.active = 0;
		}

		this._processPanels();

		// handle negative values
		if ( options.active < 0 ) {
			options.active += this.headers.length;
		}
		this._refresh();
	},

	_getCreateEventData: function() {
		return {
			header: this.active,
			panel: !this.active.length ? $() : this.active.next()
		};
	},

	_createIcons: function() {
		var icon, children,
			icons = this.options.icons;

		if ( icons ) {
			icon = $( "<span>" );
			this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
			icon.prependTo( this.headers );
			children = this.active.children( ".ui-accordion-header-icon" );
			this._removeClass( children, icons.header )
				._addClass( children, null, icons.activeHeader )
				._addClass( this.headers, "ui-accordion-icons" );
		}
	},

	_destroyIcons: function() {
		this._removeClass( this.headers, "ui-accordion-icons" );
		this.headers.children( ".ui-accordion-header-icon" ).remove();
	},

	_destroy: function() {
		var contents;

		// Clean up main element
		this.element.removeAttr( "role" );

		// Clean up headers
		this.headers
			.removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
			.removeUniqueId();

		this._destroyIcons();

		// Clean up content panels
		contents = this.headers.next()
			.css( "display", "" )
			.removeAttr( "role aria-hidden aria-labelledby" )
			.removeUniqueId();

		if ( this.options.heightStyle !== "content" ) {
			contents.css( "height", "" );
		}
	},

	_setOption: function( key, value ) {
		if ( key === "active" ) {

			// _activate() will handle invalid values and update this.options
			this._activate( value );
			return;
		}

		if ( key === "event" ) {
			if ( this.options.event ) {
				this._off( this.headers, this.options.event );
			}
			this._setupEvents( value );
		}

		this._super( key, value );

		// Setting collapsible: false while collapsed; open first panel
		if ( key === "collapsible" && !value && this.options.active === false ) {
			this._activate( 0 );
		}

		if ( key === "icons" ) {
			this._destroyIcons();
			if ( value ) {
				this._createIcons();
			}
		}
	},

	_setOptionDisabled: function( value ) {
		this._super( value );

		this.element.attr( "aria-disabled", value );

		// Support: IE8 Only
		// #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
		// so we need to add the disabled class to the headers and panels
		this._toggleClass( null, "ui-state-disabled", !!value );
		this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
			!!value );
	},

	_keydown: function( event ) {
		if ( event.altKey || event.ctrlKey ) {
			return;
		}

		var keyCode = $.ui.keyCode,
			length = this.headers.length,
			currentIndex = this.headers.index( event.target ),
			toFocus = false;

		switch ( event.keyCode ) {
		case keyCode.RIGHT:
		case keyCode.DOWN:
			toFocus = this.headers[ ( currentIndex + 1 ) % length ];
			break;
		case keyCode.LEFT:
		case keyCode.UP:
			toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
			break;
		case keyCode.SPACE:
		case keyCode.ENTER:
			this._eventHandler( event );
			break;
		case keyCode.HOME:
			toFocus = this.headers[ 0 ];
			break;
		case keyCode.END:
			toFocus = this.headers[ length - 1 ];
			break;
		}

		if ( toFocus ) {
			$( event.target ).attr( "tabIndex", -1 );
			$( toFocus ).attr( "tabIndex", 0 );
			$( toFocus ).trigger( "focus" );
			event.preventDefault();
		}
	},

	_panelKeyDown: function( event ) {
		if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
			$( event.currentTarget ).prev().trigger( "focus" );
		}
	},

	refresh: function() {
		var options = this.options;
		this._processPanels();

		// Was collapsed or no panel
		if ( ( options.active === false && options.collapsible === true ) ||
				!this.headers.length ) {
			options.active = false;
			this.active = $();

		// active false only when collapsible is true
		} else if ( options.active === false ) {
			this._activate( 0 );

		// was active, but active panel is gone
		} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {

			// all remaining panel are disabled
			if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
				options.active = false;
				this.active = $();

			// activate previous panel
			} else {
				this._activate( Math.max( 0, options.active - 1 ) );
			}

		// was active, active panel still exists
		} else {

			// make sure active index is correct
			options.active = this.headers.index( this.active );
		}

		this._destroyIcons();

		this._refresh();
	},

	_processPanels: function() {
		var prevHeaders = this.headers,
			prevPanels = this.panels;

		this.headers = this.element.find( this.options.header );
		this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
			"ui-state-default" );

		this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
		this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );

		// Avoid memory leaks (#10056)
		if ( prevPanels ) {
			this._off( prevHeaders.not( this.headers ) );
			this._off( prevPanels.not( this.panels ) );
		}
	},

	_refresh: function() {
		var maxHeight,
			options = this.options,
			heightStyle = options.heightStyle,
			parent = this.element.parent();

		this.active = this._findActive( options.active );
		this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
			._removeClass( this.active, "ui-accordion-header-collapsed" );
		this._addClass( this.active.next(), "ui-accordion-content-active" );
		this.active.next().show();

		this.headers
			.attr( "role", "tab" )
			.each( function() {
				var header = $( this ),
					headerId = header.uniqueId().attr( "id" ),
					panel = header.next(),
					panelId = panel.uniqueId().attr( "id" );
				header.attr( "aria-controls", panelId );
				panel.attr( "aria-labelledby", headerId );
			} )
			.next()
				.attr( "role", "tabpanel" );

		this.headers
			.not( this.active )
				.attr( {
					"aria-selected": "false",
					"aria-expanded": "false",
					tabIndex: -1
				} )
				.next()
					.attr( {
						"aria-hidden": "true"
					} )
					.hide();

		// Make sure at least one header is in the tab order
		if ( !this.active.length ) {
			this.headers.eq( 0 ).attr( "tabIndex", 0 );
		} else {
			this.active.attr( {
				"aria-selected": "true",
				"aria-expanded": "true",
				tabIndex: 0
			} )
				.next()
					.attr( {
						"aria-hidden": "false"
					} );
		}

		this._createIcons();

		this._setupEvents( options.event );

		if ( heightStyle === "fill" ) {
			maxHeight = parent.height();
			this.element.siblings( ":visible" ).each( function() {
				var elem = $( this ),
					position = elem.css( "position" );

				if ( position === "absolute" || position === "fixed" ) {
					return;
				}
				maxHeight -= elem.outerHeight( true );
			} );

			this.headers.each( function() {
				maxHeight -= $( this ).outerHeight( true );
			} );

			this.headers.next()
				.each( function() {
					$( this ).height( Math.max( 0, maxHeight -
						$( this ).innerHeight() + $( this ).height() ) );
				} )
				.css( "overflow", "auto" );
		} else if ( heightStyle === "auto" ) {
			maxHeight = 0;
			this.headers.next()
				.each( function() {
					var isVisible = $( this ).is( ":visible" );
					if ( !isVisible ) {
						$( this ).show();
					}
					maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
					if ( !isVisible ) {
						$( this ).hide();
					}
				} )
				.height( maxHeight );
		}
	},

	_activate: function( index ) {
		var active = this._findActive( index )[ 0 ];

		// Trying to activate the already active panel
		if ( active === this.active[ 0 ] ) {
			return;
		}

		// Trying to collapse, simulate a click on the currently active header
		active = active || this.active[ 0 ];

		this._eventHandler( {
			target: active,
			currentTarget: active,
			preventDefault: $.noop
		} );
	},

	_findActive: function( selector ) {
		return typeof selector === "number" ? this.headers.eq( selector ) : $();
	},

	_setupEvents: function( event ) {
		var events = {
			keydown: "_keydown"
		};
		if ( event ) {
			$.each( event.split( " " ), function( index, eventName ) {
				events[ eventName ] = "_eventHandler";
			} );
		}

		this._off( this.headers.add( this.headers.next() ) );
		this._on( this.headers, events );
		this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
		this._hoverable( this.headers );
		this._focusable( this.headers );
	},

	_eventHandler: function( event ) {
		var activeChildren, clickedChildren,
			options = this.options,
			active = this.active,
			clicked = $( event.currentTarget ),
			clickedIsActive = clicked[ 0 ] === active[ 0 ],
			collapsing = clickedIsActive && options.collapsible,
			toShow = collapsing ? $() : clicked.next(),
			toHide = active.next(),
			eventData = {
				oldHeader: active,
				oldPanel: toHide,
				newHeader: collapsing ? $() : clicked,
				newPanel: toShow
			};

		event.preventDefault();

		if (

				// click on active header, but not collapsible
				( clickedIsActive && !options.collapsible ) ||

				// allow canceling activation
				( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
			return;
		}

		options.active = collapsing ? false : this.headers.index( clicked );

		// When the call to ._toggle() comes after the class changes
		// it causes a very odd bug in IE 8 (see #6720)
		this.active = clickedIsActive ? $() : clicked;
		this._toggle( eventData );

		// Switch classes
		// corner classes on the previously active header stay after the animation
		this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
		if ( options.icons ) {
			activeChildren = active.children( ".ui-accordion-header-icon" );
			this._removeClass( activeChildren, null, options.icons.activeHeader )
				._addClass( activeChildren, null, options.icons.header );
		}

		if ( !clickedIsActive ) {
			this._removeClass( clicked, "ui-accordion-header-collapsed" )
				._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
			if ( options.icons ) {
				clickedChildren = clicked.children( ".ui-accordion-header-icon" );
				this._removeClass( clickedChildren, null, options.icons.header )
					._addClass( clickedChildren, null, options.icons.activeHeader );
			}

			this._addClass( clicked.next(), "ui-accordion-content-active" );
		}
	},

	_toggle: function( data ) {
		var toShow = data.newPanel,
			toHide = this.prevShow.length ? this.prevShow : data.oldPanel;

		// Handle activating a panel during the animation for another activation
		this.prevShow.add( this.prevHide ).stop( true, true );
		this.prevShow = toShow;
		this.prevHide = toHide;

		if ( this.options.animate ) {
			this._animate( toShow, toHide, data );
		} else {
			toHide.hide();
			toShow.show();
			this._toggleComplete( data );
		}

		toHide.attr( {
			"aria-hidden": "true"
		} );
		toHide.prev().attr( {
			"aria-selected": "false",
			"aria-expanded": "false"
		} );

		// if we're switching panels, remove the old header from the tab order
		// if we're opening from collapsed state, remove the previous header from the tab order
		// if we're collapsing, then keep the collapsing header in the tab order
		if ( toShow.length && toHide.length ) {
			toHide.prev().attr( {
				"tabIndex": -1,
				"aria-expanded": "false"
			} );
		} else if ( toShow.length ) {
			this.headers.filter( function() {
				return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
			} )
				.attr( "tabIndex", -1 );
		}

		toShow
			.attr( "aria-hidden", "false" )
			.prev()
				.attr( {
					"aria-selected": "true",
					"aria-expanded": "true",
					tabIndex: 0
				} );
	},

	_animate: function( toShow, toHide, data ) {
		var total, easing, duration,
			that = this,
			adjust = 0,
			boxSizing = toShow.css( "box-sizing" ),
			down = toShow.length &&
				( !toHide.length || ( toShow.index() < toHide.index() ) ),
			animate = this.options.animate || {},
			options = down && animate.down || animate,
			complete = function() {
				that._toggleComplete( data );
			};

		if ( typeof options === "number" ) {
			duration = options;
		}
		if ( typeof options === "string" ) {
			easing = options;
		}

		// fall back from options to animation in case of partial down settings
		easing = easing || options.easing || animate.easing;
		duration = duration || options.duration || animate.duration;

		if ( !toHide.length ) {
			return toShow.animate( this.showProps, duration, easing, complete );
		}
		if ( !toShow.length ) {
			return toHide.animate( this.hideProps, duration, easing, complete );
		}

		total = toShow.show().outerHeight();
		toHide.animate( this.hideProps, {
			duration: duration,
			easing: easing,
			step: function( now, fx ) {
				fx.now = Math.round( now );
			}
		} );
		toShow
			.hide()
			.animate( this.showProps, {
				duration: duration,
				easing: easing,
				complete: complete,
				step: function( now, fx ) {
					fx.now = Math.round( now );
					if ( fx.prop !== "height" ) {
						if ( boxSizing === "content-box" ) {
							adjust += fx.now;
						}
					} else if ( that.options.heightStyle !== "content" ) {
						fx.now = Math.round( total - toHide.outerHeight() - adjust );
						adjust = 0;
					}
				}
			} );
	},

	_toggleComplete: function( data ) {
		var toHide = data.oldPanel,
			prev = toHide.prev();

		this._removeClass( toHide, "ui-accordion-content-active" );
		this._removeClass( prev, "ui-accordion-header-active" )
			._addClass( prev, "ui-accordion-header-collapsed" );

		// Work around for rendering bug in IE (#5421)
		if ( toHide.length ) {
			toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
		}
		this._trigger( "activate", null, data );
	}
} );



var safeActiveElement = $.ui.safeActiveElement = function( document ) {
	var activeElement;

	// Support: IE 9 only
	// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
	try {
		activeElement = document.activeElement;
	} catch ( error ) {
		activeElement = document.body;
	}

	// Support: IE 9 - 11 only
	// IE may return null instead of an element
	// Interestingly, this only seems to occur when NOT in an iframe
	if ( !activeElement ) {
		activeElement = document.body;
	}

	// Support: IE 11 only
	// IE11 returns a seemingly empty object in some cases when accessing
	// document.activeElement from an <iframe>
	if ( !activeElement.nodeName ) {
		activeElement = document.body;
	}

	return activeElement;
};


/*!
 * jQuery UI Menu 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Menu
//>>group: Widgets
//>>description: Creates nestable menus.
//>>docs: http://api.jqueryui.com/menu/
//>>demos: http://jqueryui.com/menu/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/menu.css
//>>css.theme: ../../themes/base/theme.css



var widgetsMenu = $.widget( "ui.menu", {
	version: "1.12.1",
	defaultElement: "<ul>",
	delay: 300,
	options: {
		icons: {
			submenu: "ui-icon-caret-1-e"
		},
		items: "> *",
		menus: "ul",
		position: {
			my: "left top",
			at: "right top"
		},
		role: "menu",

		// Callbacks
		blur: null,
		focus: null,
		select: null
	},

	_create: function() {
		this.activeMenu = this.element;

		// Flag used to prevent firing of the click handler
		// as the event bubbles up through nested menus
		this.mouseHandled = false;
		this.element
			.uniqueId()
			.attr( {
				role: this.options.role,
				tabIndex: 0
			} );

		this._addClass( "ui-menu", "ui-widget ui-widget-content" );
		this._on( {

			// Prevent focus from sticking to links inside menu after clicking
			// them (focus should always stay on UL during navigation).
			"mousedown .ui-menu-item": function( event ) {
				event.preventDefault();
			},
			"click .ui-menu-item": function( event ) {
				var target = $( event.target );
				var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
				if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
					this.select( event );

					// Only set the mouseHandled flag if the event will bubble, see #9469.
					if ( !event.isPropagationStopped() ) {
						this.mouseHandled = true;
					}

					// Open submenu on click
					if ( target.has( ".ui-menu" ).length ) {
						this.expand( event );
					} else if ( !this.element.is( ":focus" ) &&
							active.closest( ".ui-menu" ).length ) {

						// Redirect focus to the menu
						this.element.trigger( "focus", [ true ] );

						// If the active item is on the top level, let it stay active.
						// Otherwise, blur the active item since it is no longer visible.
						if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
							clearTimeout( this.timer );
						}
					}
				}
			},
			"mouseenter .ui-menu-item": function( event ) {

				// Ignore mouse events while typeahead is active, see #10458.
				// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
				// is over an item in the menu
				if ( this.previousFilter ) {
					return;
				}

				var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
					target = $( event.currentTarget );

				// Ignore bubbled events on parent items, see #11641
				if ( actualTarget[ 0 ] !== target[ 0 ] ) {
					return;
				}

				// Remove ui-state-active class from siblings of the newly focused menu item
				// to avoid a jump caused by adjacent elements both having a class with a border
				this._removeClass( target.siblings().children( ".ui-state-active" ),
					null, "ui-state-active" );
				this.focus( event, target );
			},
			mouseleave: "collapseAll",
			"mouseleave .ui-menu": "collapseAll",
			focus: function( event, keepActiveItem ) {

				// If there's already an active item, keep it active
				// If not, activate the first item
				var item = this.active || this.element.find( this.options.items ).eq( 0 );

				if ( !keepActiveItem ) {
					this.focus( event, item );
				}
			},
			blur: function( event ) {
				this._delay( function() {
					var notContained = !$.contains(
						this.element[ 0 ],
						$.ui.safeActiveElement( this.document[ 0 ] )
					);
					if ( notContained ) {
						this.collapseAll( event );
					}
				} );
			},
			keydown: "_keydown"
		} );

		this.refresh();

		// Clicks outside of a menu collapse any open menus
		this._on( this.document, {
			click: function( event ) {
				if ( this._closeOnDocumentClick( event ) ) {
					this.collapseAll( event );
				}

				// Reset the mouseHandled flag
				this.mouseHandled = false;
			}
		} );
	},

	_destroy: function() {
		var items = this.element.find( ".ui-menu-item" )
				.removeAttr( "role aria-disabled" ),
			submenus = items.children( ".ui-menu-item-wrapper" )
				.removeUniqueId()
				.removeAttr( "tabIndex role aria-haspopup" );

		// Destroy (sub)menus
		this.element
			.removeAttr( "aria-activedescendant" )
			.find( ".ui-menu" ).addBack()
				.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
					"tabIndex" )
				.removeUniqueId()
				.show();

		submenus.children().each( function() {
			var elem = $( this );
			if ( elem.data( "ui-menu-submenu-caret" ) ) {
				elem.remove();
			}
		} );
	},

	_keydown: function( event ) {
		var match, prev, character, skip,
			preventDefault = true;

		switch ( event.keyCode ) {
		case $.ui.keyCode.PAGE_UP:
			this.previousPage( event );
			break;
		case $.ui.keyCode.PAGE_DOWN:
			this.nextPage( event );
			break;
		case $.ui.keyCode.HOME:
			this._move( "first", "first", event );
			break;
		case $.ui.keyCode.END:
			this._move( "last", "last", event );
			break;
		case $.ui.keyCode.UP:
			this.previous( event );
			break;
		case $.ui.keyCode.DOWN:
			this.next( event );
			break;
		case $.ui.keyCode.LEFT:
			this.collapse( event );
			break;
		case $.ui.keyCode.RIGHT:
			if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
				this.expand( event );
			}
			break;
		case $.ui.keyCode.ENTER:
		case $.ui.keyCode.SPACE:
			this._activate( event );
			break;
		case $.ui.keyCode.ESCAPE:
			this.collapse( event );
			break;
		default:
			preventDefault = false;
			prev = this.previousFilter || "";
			skip = false;

			// Support number pad values
			character = event.keyCode >= 96 && event.keyCode <= 105 ?
				( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );

			clearTimeout( this.filterTimer );

			if ( character === prev ) {
				skip = true;
			} else {
				character = prev + character;
			}

			match = this._filterMenuItems( character );
			match = skip && match.index( this.active.next() ) !== -1 ?
				this.active.nextAll( ".ui-menu-item" ) :
				match;

			// If no matches on the current filter, reset to the last character pressed
			// to move down the menu to the first item that starts with that character
			if ( !match.length ) {
				character = String.fromCharCode( event.keyCode );
				match = this._filterMenuItems( character );
			}

			if ( match.length ) {
				this.focus( event, match );
				this.previousFilter = character;
				this.filterTimer = this._delay( function() {
					delete this.previousFilter;
				}, 1000 );
			} else {
				delete this.previousFilter;
			}
		}

		if ( preventDefault ) {
			event.preventDefault();
		}
	},

	_activate: function( event ) {
		if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
			if ( this.active.children( "[aria-haspopup='true']" ).length ) {
				this.expand( event );
			} else {
				this.select( event );
			}
		}
	},

	refresh: function() {
		var menus, items, newSubmenus, newItems, newWrappers,
			that = this,
			icon = this.options.icons.submenu,
			submenus = this.element.find( this.options.menus );

		this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );

		// Initialize nested menus
		newSubmenus = submenus.filter( ":not(.ui-menu)" )
			.hide()
			.attr( {
				role: this.options.role,
				"aria-hidden": "true",
				"aria-expanded": "false"
			} )
			.each( function() {
				var menu = $( this ),
					item = menu.prev(),
					submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );

				that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );
				item
					.attr( "aria-haspopup", "true" )
					.prepend( submenuCaret );
				menu.attr( "aria-labelledby", item.attr( "id" ) );
			} );

		this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );

		menus = submenus.add( this.element );
		items = menus.find( this.options.items );

		// Initialize menu-items containing spaces and/or dashes only as dividers
		items.not( ".ui-menu-item" ).each( function() {
			var item = $( this );
			if ( that._isDivider( item ) ) {
				that._addClass( item, "ui-menu-divider", "ui-widget-content" );
			}
		} );

		// Don't refresh list items that are already adapted
		newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
		newWrappers = newItems.children()
			.not( ".ui-menu" )
				.uniqueId()
				.attr( {
					tabIndex: -1,
					role: this._itemRole()
				} );
		this._addClass( newItems, "ui-menu-item" )
			._addClass( newWrappers, "ui-menu-item-wrapper" );

		// Add aria-disabled attribute to any disabled menu item
		items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );

		// If the active item has been removed, blur the menu
		if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
			this.blur();
		}
	},

	_itemRole: function() {
		return {
			menu: "menuitem",
			listbox: "option"
		}[ this.options.role ];
	},

	_setOption: function( key, value ) {
		if ( key === "icons" ) {
			var icons = this.element.find( ".ui-menu-icon" );
			this._removeClass( icons, null, this.options.icons.submenu )
				._addClass( icons, null, value.submenu );
		}
		this._super( key, value );
	},

	_setOptionDisabled: function( value ) {
		this._super( value );

		this.element.attr( "aria-disabled", String( value ) );
		this._toggleClass( null, "ui-state-disabled", !!value );
	},

	focus: function( event, item ) {
		var nested, focused, activeParent;
		this.blur( event, event && event.type === "focus" );

		this._scrollIntoView( item );

		this.active = item.first();

		focused = this.active.children( ".ui-menu-item-wrapper" );
		this._addClass( focused, null, "ui-state-active" );

		// Only update aria-activedescendant if there's a role
		// otherwise we assume focus is managed elsewhere
		if ( this.options.role ) {
			this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
		}

		// Highlight active parent menu item, if any
		activeParent = this.active
			.parent()
				.closest( ".ui-menu-item" )
					.children( ".ui-menu-item-wrapper" );
		this._addClass( activeParent, null, "ui-state-active" );

		if ( event && event.type === "keydown" ) {
			this._close();
		} else {
			this.timer = this._delay( function() {
				this._close();
			}, this.delay );
		}

		nested = item.children( ".ui-menu" );
		if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
			this._startOpening( nested );
		}
		this.activeMenu = item.parent();

		this._trigger( "focus", event, { item: item } );
	},

	_scrollIntoView: function( item ) {
		var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
		if ( this._hasScroll() ) {
			borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
			paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
			offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
			scroll = this.activeMenu.scrollTop();
			elementHeight = this.activeMenu.height();
			itemHeight = item.outerHeight();

			if ( offset < 0 ) {
				this.activeMenu.scrollTop( scroll + offset );
			} else if ( offset + itemHeight > elementHeight ) {
				this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
			}
		}
	},

	blur: function( event, fromFocus ) {
		if ( !fromFocus ) {
			clearTimeout( this.timer );
		}

		if ( !this.active ) {
			return;
		}

		this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),
			null, "ui-state-active" );

		this._trigger( "blur", event, { item: this.active } );
		this.active = null;
	},

	_startOpening: function( submenu ) {
		clearTimeout( this.timer );

		// Don't open if already open fixes a Firefox bug that caused a .5 pixel
		// shift in the submenu position when mousing over the caret icon
		if ( submenu.attr( "aria-hidden" ) !== "true" ) {
			return;
		}

		this.timer = this._delay( function() {
			this._close();
			this._open( submenu );
		}, this.delay );
	},

	_open: function( submenu ) {
		var position = $.extend( {
			of: this.active
		}, this.options.position );

		clearTimeout( this.timer );
		this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
			.hide()
			.attr( "aria-hidden", "true" );

		submenu
			.show()
			.removeAttr( "aria-hidden" )
			.attr( "aria-expanded", "true" )
			.position( position );
	},

	collapseAll: function( event, all ) {
		clearTimeout( this.timer );
		this.timer = this._delay( function() {

			// If we were passed an event, look for the submenu that contains the event
			var currentMenu = all ? this.element :
				$( event && event.target ).closest( this.element.find( ".ui-menu" ) );

			// If we found no valid submenu ancestor, use the main menu to close all
			// sub menus anyway
			if ( !currentMenu.length ) {
				currentMenu = this.element;
			}

			this._close( currentMenu );

			this.blur( event );

			// Work around active item staying active after menu is blurred
			this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );

			this.activeMenu = currentMenu;
		}, this.delay );
	},

	// With no arguments, closes the currently active menu - if nothing is active
	// it closes all menus.  If passed an argument, it will search for menus BELOW
	_close: function( startMenu ) {
		if ( !startMenu ) {
			startMenu = this.active ? this.active.parent() : this.element;
		}

		startMenu.find( ".ui-menu" )
			.hide()
			.attr( "aria-hidden", "true" )
			.attr( "aria-expanded", "false" );
	},

	_closeOnDocumentClick: function( event ) {
		return !$( event.target ).closest( ".ui-menu" ).length;
	},

	_isDivider: function( item ) {

		// Match hyphen, em dash, en dash
		return !/[^\-\u2014\u2013\s]/.test( item.text() );
	},

	collapse: function( event ) {
		var newItem = this.active &&
			this.active.parent().closest( ".ui-menu-item", this.element );
		if ( newItem && newItem.length ) {
			this._close();
			this.focus( event, newItem );
		}
	},

	expand: function( event ) {
		var newItem = this.active &&
			this.active
				.children( ".ui-menu " )
					.find( this.options.items )
						.first();

		if ( newItem && newItem.length ) {
			this._open( newItem.parent() );

			// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
			this._delay( function() {
				this.focus( event, newItem );
			} );
		}
	},

	next: function( event ) {
		this._move( "next", "first", event );
	},

	previous: function( event ) {
		this._move( "prev", "last", event );
	},

	isFirstItem: function() {
		return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
	},

	isLastItem: function() {
		return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
	},

	_move: function( direction, filter, event ) {
		var next;
		if ( this.active ) {
			if ( direction === "first" || direction === "last" ) {
				next = this.active
					[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
					.eq( -1 );
			} else {
				next = this.active
					[ direction + "All" ]( ".ui-menu-item" )
					.eq( 0 );
			}
		}
		if ( !next || !next.length || !this.active ) {
			next = this.activeMenu.find( this.options.items )[ filter ]();
		}

		this.focus( event, next );
	},

	nextPage: function( event ) {
		var item, base, height;

		if ( !this.active ) {
			this.next( event );
			return;
		}
		if ( this.isLastItem() ) {
			return;
		}
		if ( this._hasScroll() ) {
			base = this.active.offset().top;
			height = this.element.height();
			this.active.nextAll( ".ui-menu-item" ).each( function() {
				item = $( this );
				return item.offset().top - base - height < 0;
			} );

			this.focus( event, item );
		} else {
			this.focus( event, this.activeMenu.find( this.options.items )
				[ !this.active ? "first" : "last" ]() );
		}
	},

	previousPage: function( event ) {
		var item, base, height;
		if ( !this.active ) {
			this.next( event );
			return;
		}
		if ( this.isFirstItem() ) {
			return;
		}
		if ( this._hasScroll() ) {
			base = this.active.offset().top;
			height = this.element.height();
			this.active.prevAll( ".ui-menu-item" ).each( function() {
				item = $( this );
				return item.offset().top - base + height > 0;
			} );

			this.focus( event, item );
		} else {
			this.focus( event, this.activeMenu.find( this.options.items ).first() );
		}
	},

	_hasScroll: function() {
		return this.element.outerHeight() < this.element.prop( "scrollHeight" );
	},

	select: function( event ) {

		// TODO: It should never be possible to not have an active item at this
		// point, but the tests don't trigger mouseenter before click.
		this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
		var ui = { item: this.active };
		if ( !this.active.has( ".ui-menu" ).length ) {
			this.collapseAll( event, true );
		}
		this._trigger( "select", event, ui );
	},

	_filterMenuItems: function( character ) {
		var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
			regex = new RegExp( "^" + escapedCharacter, "i" );

		return this.activeMenu
			.find( this.options.items )

				// Only match on items, not dividers or other content (#10571)
				.filter( ".ui-menu-item" )
					.filter( function() {
						return regex.test(
							$.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) );
					} );
	}
} );


/*!
 * jQuery UI Autocomplete 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Autocomplete
//>>group: Widgets
//>>description: Lists suggested words as the user is typing.
//>>docs: http://api.jqueryui.com/autocomplete/
//>>demos: http://jqueryui.com/autocomplete/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/autocomplete.css
//>>css.theme: ../../themes/base/theme.css



$.widget( "ui.autocomplete", {
	version: "1.12.1",
	defaultElement: "<input>",
	options: {
		appendTo: null,
		autoFocus: false,
		delay: 300,
		minLength: 1,
		position: {
			my: "left top",
			at: "left bottom",
			collision: "none"
		},
		source: null,

		// Callbacks
		change: null,
		close: null,
		focus: null,
		open: null,
		response: null,
		search: null,
		select: null
	},

	requestIndex: 0,
	pending: 0,

	_create: function() {

		// Some browsers only repeat keydown events, not keypress events,
		// so we use the suppressKeyPress flag to determine if we've already
		// handled the keydown event. #7269
		// Unfortunately the code for & in keypress is the same as the up arrow,
		// so we use the suppressKeyPressRepeat flag to avoid handling keypress
		// events when we know the keydown event was used to modify the
		// search term. #7799
		var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
			nodeName = this.element[ 0 ].nodeName.toLowerCase(),
			isTextarea = nodeName === "textarea",
			isInput = nodeName === "input";

		// Textareas are always multi-line
		// Inputs are always single-line, even if inside a contentEditable element
		// IE also treats inputs as contentEditable
		// All other element types are determined by whether or not they're contentEditable
		this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element );

		this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
		this.isNewMenu = true;

		this._addClass( "ui-autocomplete-input" );
		this.element.attr( "autocomplete", "off" );

		this._on( this.element, {
			keydown: function( event ) {
				if ( this.element.prop( "readOnly" ) ) {
					suppressKeyPress = true;
					suppressInput = true;
					suppressKeyPressRepeat = true;
					return;
				}

				suppressKeyPress = false;
				suppressInput = false;
				suppressKeyPressRepeat = false;
				var keyCode = $.ui.keyCode;
				switch ( event.keyCode ) {
				case keyCode.PAGE_UP:
					suppressKeyPress = true;
					this._move( "previousPage", event );
					break;
				case keyCode.PAGE_DOWN:
					suppressKeyPress = true;
					this._move( "nextPage", event );
					break;
				case keyCode.UP:
					suppressKeyPress = true;
					this._keyEvent( "previous", event );
					break;
				case keyCode.DOWN:
					suppressKeyPress = true;
					this._keyEvent( "next", event );
					break;
				case keyCode.ENTER:

					// when menu is open and has focus
					if ( this.menu.active ) {

						// #6055 - Opera still allows the keypress to occur
						// which causes forms to submit
						suppressKeyPress = true;
						event.preventDefault();
						this.menu.select( event );
					}
					break;
				case keyCode.TAB:
					if ( this.menu.active ) {
						this.menu.select( event );
					}
					break;
				case keyCode.ESCAPE:
					if ( this.menu.element.is( ":visible" ) ) {
						if ( !this.isMultiLine ) {
							this._value( this.term );
						}
						this.close( event );

						// Different browsers have different default behavior for escape
						// Single press can mean undo or clear
						// Double press in IE means clear the whole form
						event.preventDefault();
					}
					break;
				default:
					suppressKeyPressRepeat = true;

					// search timeout should be triggered before the input value is changed
					this._searchTimeout( event );
					break;
				}
			},
			keypress: function( event ) {
				if ( suppressKeyPress ) {
					suppressKeyPress = false;
					if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
						event.preventDefault();
					}
					return;
				}
				if ( suppressKeyPressRepeat ) {
					return;
				}

				// Replicate some key handlers to allow them to repeat in Firefox and Opera
				var keyCode = $.ui.keyCode;
				switch ( event.keyCode ) {
				case keyCode.PAGE_UP:
					this._move( "previousPage", event );
					break;
				case keyCode.PAGE_DOWN:
					this._move( "nextPage", event );
					break;
				case keyCode.UP:
					this._keyEvent( "previous", event );
					break;
				case keyCode.DOWN:
					this._keyEvent( "next", event );
					break;
				}
			},
			input: function( event ) {
				if ( suppressInput ) {
					suppressInput = false;
					event.preventDefault();
					return;
				}
				this._searchTimeout( event );
			},
			focus: function() {
				this.selectedItem = null;
				this.previous = this._value();
			},
			blur: function( event ) {
				if ( this.cancelBlur ) {
					delete this.cancelBlur;
					return;
				}

				clearTimeout( this.searching );
				this.close( event );
				this._change( event );
			}
		} );

		this._initSource();
		this.menu = $( "<ul>" )
			.appendTo( this._appendTo() )
			.menu( {

				// disable ARIA support, the live region takes care of that
				role: null
			} )
			.hide()
			.menu( "instance" );

		this._addClass( this.menu.element, "ui-autocomplete", "ui-front" );
		this._on( this.menu.element, {
			mousedown: function( event ) {

				// prevent moving focus out of the text field
				event.preventDefault();

				// IE doesn't prevent moving focus even with event.preventDefault()
				// so we set a flag to know when we should ignore the blur event
				this.cancelBlur = true;
				this._delay( function() {
					delete this.cancelBlur;

					// Support: IE 8 only
					// Right clicking a menu item or selecting text from the menu items will
					// result in focus moving out of the input. However, we've already received
					// and ignored the blur event because of the cancelBlur flag set above. So
					// we restore focus to ensure that the menu closes properly based on the user's
					// next actions.
					if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
						this.element.trigger( "focus" );
					}
				} );
			},
			menufocus: function( event, ui ) {
				var label, item;

				// support: Firefox
				// Prevent accidental activation of menu items in Firefox (#7024 #9118)
				if ( this.isNewMenu ) {
					this.isNewMenu = false;
					if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
						this.menu.blur();

						this.document.one( "mousemove", function() {
							$( event.target ).trigger( event.originalEvent );
						} );

						return;
					}
				}

				item = ui.item.data( "ui-autocomplete-item" );
				if ( false !== this._trigger( "focus", event, { item: item } ) ) {

					// use value to match what will end up in the input, if it was a key event
					if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
						this._value( item.value );
					}
				}

				// Announce the value in the liveRegion
				label = ui.item.attr( "aria-label" ) || item.value;
				if ( label && $.trim( label ).length ) {
					this.liveRegion.children().hide();
					$( "<div>" ).text( label ).appendTo( this.liveRegion );
				}
			},
			menuselect: function( event, ui ) {
				var item = ui.item.data( "ui-autocomplete-item" ),
					previous = this.previous;

				// Only trigger when focus was lost (click on menu)
				if ( this.element[ 0 ] !== $.ui.safeActiveElement( this.document[ 0 ] ) ) {
					this.element.trigger( "focus" );
					this.previous = previous;

					// #6109 - IE triggers two focus events and the second
					// is asynchronous, so we need to reset the previous
					// term synchronously and asynchronously :-(
					this._delay( function() {
						this.previous = previous;
						this.selectedItem = item;
					} );
				}

				if ( false !== this._trigger( "select", event, { item: item } ) ) {
					this._value( item.value );
				}

				// reset the term after the select event
				// this allows custom select handling to work properly
				this.term = this._value();

				this.close( event );
				this.selectedItem = item;
			}
		} );

		this.liveRegion = $( "<div>", {
			role: "status",
			"aria-live": "assertive",
			"aria-relevant": "additions"
		} )
			.appendTo( this.document[ 0 ].body );

		this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );

		// Turning off autocomplete prevents the browser from remembering the
		// value when navigating through history, so we re-enable autocomplete
		// if the page is unloaded before the widget is destroyed. #7790
		this._on( this.window, {
			beforeunload: function() {
				this.element.removeAttr( "autocomplete" );
			}
		} );
	},

	_destroy: function() {
		clearTimeout( this.searching );
		this.element.removeAttr( "autocomplete" );
		this.menu.element.remove();
		this.liveRegion.remove();
	},

	_setOption: function( key, value ) {
		this._super( key, value );
		if ( key === "source" ) {
			this._initSource();
		}
		if ( key === "appendTo" ) {
			this.menu.element.appendTo( this._appendTo() );
		}
		if ( key === "disabled" && value && this.xhr ) {
			this.xhr.abort();
		}
	},

	_isEventTargetInWidget: function( event ) {
		var menuElement = this.menu.element[ 0 ];

		return event.target === this.element[ 0 ] ||
			event.target === menuElement ||
			$.contains( menuElement, event.target );
	},

	_closeOnClickOutside: function( event ) {
		if ( !this._isEventTargetInWidget( event ) ) {
			this.close();
		}
	},

	_appendTo: function() {
		var element = this.options.appendTo;

		if ( element ) {
			element = element.jquery || element.nodeType ?
				$( element ) :
				this.document.find( element ).eq( 0 );
		}

		if ( !element || !element[ 0 ] ) {
			element = this.element.closest( ".ui-front, dialog" );
		}

		if ( !element.length ) {
			element = this.document[ 0 ].body;
		}

		return element;
	},

	_initSource: function() {
		var array, url,
			that = this;
		if ( $.isArray( this.options.source ) ) {
			array = this.options.source;
			this.source = function( request, response ) {
				response( $.ui.autocomplete.filter( array, request.term ) );
			};
		} else if ( typeof this.options.source === "string" ) {
			url = this.options.source;
			this.source = function( request, response ) {
				if ( that.xhr ) {
					that.xhr.abort();
				}
				that.xhr = $.ajax( {
					url: url,
					data: request,
					dataType: "json",
					success: function( data ) {
						response( data );
					},
					error: function() {
						response( [] );
					}
				} );
			};
		} else {
			this.source = this.options.source;
		}
	},

	_searchTimeout: function( event ) {
		clearTimeout( this.searching );
		this.searching = this._delay( function() {

			// Search if the value has changed, or if the user retypes the same value (see #7434)
			var equalValues = this.term === this._value(),
				menuVisible = this.menu.element.is( ":visible" ),
				modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;

			if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
				this.selectedItem = null;
				this.search( null, event );
			}
		}, this.options.delay );
	},

	search: function( value, event ) {
		value = value != null ? value : this._value();

		// Always save the actual value, not the one passed as an argument
		this.term = this._value();

		if ( value.length < this.options.minLength ) {
			return this.close( event );
		}

		if ( this._trigger( "search", event ) === false ) {
			return;
		}

		return this._search( value );
	},

	_search: function( value ) {
		this.pending++;
		this._addClass( "ui-autocomplete-loading" );
		this.cancelSearch = false;

		this.source( { term: value }, this._response() );
	},

	_response: function() {
		var index = ++this.requestIndex;

		return $.proxy( function( content ) {
			if ( index === this.requestIndex ) {
				this.__response( content );
			}

			this.pending--;
			if ( !this.pending ) {
				this._removeClass( "ui-autocomplete-loading" );
			}
		}, this );
	},

	__response: function( content ) {
		if ( content ) {
			content = this._normalize( content );
		}
		this._trigger( "response", null, { content: content } );
		if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
			this._suggest( content );
			this._trigger( "open" );
		} else {

			// use ._close() instead of .close() so we don't cancel future searches
			this._close();
		}
	},

	close: function( event ) {
		this.cancelSearch = true;
		this._close( event );
	},

	_close: function( event ) {

		// Remove the handler that closes the menu on outside clicks
		this._off( this.document, "mousedown" );

		if ( this.menu.element.is( ":visible" ) ) {
			this.menu.element.hide();
			this.menu.blur();
			this.isNewMenu = true;
			this._trigger( "close", event );
		}
	},

	_change: function( event ) {
		if ( this.previous !== this._value() ) {
			this._trigger( "change", event, { item: this.selectedItem } );
		}
	},

	_normalize: function( items ) {

		// assume all items have the right format when the first item is complete
		if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
			return items;
		}
		return $.map( items, function( item ) {
			if ( typeof item === "string" ) {
				return {
					label: item,
					value: item
				};
			}
			return $.extend( {}, item, {
				label: item.label || item.value,
				value: item.value || item.label
			} );
		} );
	},

	_suggest: function( items ) {
		var ul = this.menu.element.empty();
		this._renderMenu( ul, items );
		this.isNewMenu = true;
		this.menu.refresh();

		// Size and position menu
		ul.show();
		this._resizeMenu();
		ul.position( $.extend( {
			of: this.element
		}, this.options.position ) );

		if ( this.options.autoFocus ) {
			this.menu.next();
		}

		// Listen for interactions outside of the widget (#6642)
		this._on( this.document, {
			mousedown: "_closeOnClickOutside"
		} );
	},

	_resizeMenu: function() {
		var ul = this.menu.element;
		ul.outerWidth( Math.max(

			// Firefox wraps long text (possibly a rounding bug)
			// so we add 1px to avoid the wrapping (#7513)
			ul.width( "" ).outerWidth() + 1,
			this.element.outerWidth()
		) );
	},

	_renderMenu: function( ul, items ) {
		var that = this;
		$.each( items, function( index, item ) {
			that._renderItemData( ul, item );
		} );
	},

	_renderItemData: function( ul, item ) {
		return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
	},

	_renderItem: function( ul, item ) {
		return $( "<li>" )
			.append( $( "<div>" ).text( item.label ) )
			.appendTo( ul );
	},

	_move: function( direction, event ) {
		if ( !this.menu.element.is( ":visible" ) ) {
			this.search( null, event );
			return;
		}
		if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
				this.menu.isLastItem() && /^next/.test( direction ) ) {

			if ( !this.isMultiLine ) {
				this._value( this.term );
			}

			this.menu.blur();
			return;
		}
		this.menu[ direction ]( event );
	},

	widget: function() {
		return this.menu.element;
	},

	_value: function() {
		return this.valueMethod.apply( this.element, arguments );
	},

	_keyEvent: function( keyEvent, event ) {
		if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
			this._move( keyEvent, event );

			// Prevents moving cursor to beginning/end of the text field in some browsers
			event.preventDefault();
		}
	},

	// Support: Chrome <=50
	// We should be able to just use this.element.prop( "isContentEditable" )
	// but hidden elements always report false in Chrome.
	// https://code.google.com/p/chromium/issues/detail?id=313082
	_isContentEditable: function( element ) {
		if ( !element.length ) {
			return false;
		}

		var editable = element.prop( "contentEditable" );

		if ( editable === "inherit" ) {
		  return this._isContentEditable( element.parent() );
		}

		return editable === "true";
	}
} );

$.extend( $.ui.autocomplete, {
	escapeRegex: function( value ) {
		return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
	},
	filter: function( array, term ) {
		var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
		return $.grep( array, function( value ) {
			return matcher.test( value.label || value.value || value );
		} );
	}
} );

// Live region extension, adding a `messages` option
// NOTE: This is an experimental API. We are still investigating
// a full solution for string manipulation and internationalization.
$.widget( "ui.autocomplete", $.ui.autocomplete, {
	options: {
		messages: {
			noResults: "No search results.",
			results: function( amount ) {
				return amount + ( amount > 1 ? " results are" : " result is" ) +
					" available, use up and down arrow keys to navigate.";
			}
		}
	},

	__response: function( content ) {
		var message;
		this._superApply( arguments );
		if ( this.options.disabled || this.cancelSearch ) {
			return;
		}
		if ( content && content.length ) {
			message = this.options.messages.results( content.length );
		} else {
			message = this.options.messages.noResults;
		}
		this.liveRegion.children().hide();
		$( "<div>" ).text( message ).appendTo( this.liveRegion );
	}
} );

var widgetsAutocomplete = $.ui.autocomplete;


/*!
 * jQuery UI Controlgroup 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Controlgroup
//>>group: Widgets
//>>description: Visually groups form control widgets
//>>docs: http://api.jqueryui.com/controlgroup/
//>>demos: http://jqueryui.com/controlgroup/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/controlgroup.css
//>>css.theme: ../../themes/base/theme.css


var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;

var widgetsControlgroup = $.widget( "ui.controlgroup", {
	version: "1.12.1",
	defaultElement: "<div>",
	options: {
		direction: "horizontal",
		disabled: null,
		onlyVisible: true,
		items: {
			"button": "input[type=button], input[type=submit], input[type=reset], button, a",
			"controlgroupLabel": ".ui-controlgroup-label",
			"checkboxradio": "input[type='checkbox'], input[type='radio']",
			"selectmenu": "select",
			"spinner": ".ui-spinner-input"
		}
	},

	_create: function() {
		this._enhance();
	},

	// To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
	_enhance: function() {
		this.element.attr( "role", "toolbar" );
		this.refresh();
	},

	_destroy: function() {
		this._callChildMethod( "destroy" );
		this.childWidgets.removeData( "ui-controlgroup-data" );
		this.element.removeAttr( "role" );
		if ( this.options.items.controlgroupLabel ) {
			this.element
				.find( this.options.items.controlgroupLabel )
				.find( ".ui-controlgroup-label-contents" )
				.contents().unwrap();
		}
	},

	_initWidgets: function() {
		var that = this,
			childWidgets = [];

		// First we iterate over each of the items options
		$.each( this.options.items, function( widget, selector ) {
			var labels;
			var options = {};

			// Make sure the widget has a selector set
			if ( !selector ) {
				return;
			}

			if ( widget === "controlgroupLabel" ) {
				labels = that.element.find( selector );
				labels.each( function() {
					var element = $( this );

					if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
						return;
					}
					element.contents()
						.wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
				} );
				that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
				childWidgets = childWidgets.concat( labels.get() );
				return;
			}

			// Make sure the widget actually exists
			if ( !$.fn[ widget ] ) {
				return;
			}

			// We assume everything is in the middle to start because we can't determine
			// first / last elements until all enhancments are done.
			if ( that[ "_" + widget + "Options" ] ) {
				options = that[ "_" + widget + "Options" ]( "middle" );
			} else {
				options = { classes: {} };
			}

			// Find instances of this widget inside controlgroup and init them
			that.element
				.find( selector )
				.each( function() {
					var element = $( this );
					var instance = element[ widget ]( "instance" );

					// We need to clone the default options for this type of widget to avoid
					// polluting the variable options which has a wider scope than a single widget.
					var instanceOptions = $.widget.extend( {}, options );

					// If the button is the child of a spinner ignore it
					// TODO: Find a more generic solution
					if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
						return;
					}

					// Create the widget if it doesn't exist
					if ( !instance ) {
						instance = element[ widget ]()[ widget ]( "instance" );
					}
					if ( instance ) {
						instanceOptions.classes =
							that._resolveClassesValues( instanceOptions.classes, instance );
					}
					element[ widget ]( instanceOptions );

					// Store an instance of the controlgroup to be able to reference
					// from the outermost element for changing options and refresh
					var widgetElement = element[ widget ]( "widget" );
					$.data( widgetElement[ 0 ], "ui-controlgroup-data",
						instance ? instance : element[ widget ]( "instance" ) );

					childWidgets.push( widgetElement[ 0 ] );
				} );
		} );

		this.childWidgets = $( $.unique( childWidgets ) );
		this._addClass( this.childWidgets, "ui-controlgroup-item" );
	},

	_callChildMethod: function( method ) {
		this.childWidgets.each( function() {
			var element = $( this ),
				data = element.data( "ui-controlgroup-data" );
			if ( data && data[ method ] ) {
				data[ method ]();
			}
		} );
	},

	_updateCornerClass: function( element, position ) {
		var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
		var add = this._buildSimpleOptions( position, "label" ).classes.label;

		this._removeClass( element, null, remove );
		this._addClass( element, null, add );
	},

	_buildSimpleOptions: function( position, key ) {
		var direction = this.options.direction === "vertical";
		var result = {
			classes: {}
		};
		result.classes[ key ] = {
			"middle": "",
			"first": "ui-corner-" + ( direction ? "top" : "left" ),
			"last": "ui-corner-" + ( direction ? "bottom" : "right" ),
			"only": "ui-corner-all"
		}[ position ];

		return result;
	},

	_spinnerOptions: function( position ) {
		var options = this._buildSimpleOptions( position, "ui-spinner" );

		options.classes[ "ui-spinner-up" ] = "";
		options.classes[ "ui-spinner-down" ] = "";

		return options;
	},

	_buttonOptions: function( position ) {
		return this._buildSimpleOptions( position, "ui-button" );
	},

	_checkboxradioOptions: function( position ) {
		return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
	},

	_selectmenuOptions: function( position ) {
		var direction = this.options.direction === "vertical";
		return {
			width: direction ? "auto" : false,
			classes: {
				middle: {
					"ui-selectmenu-button-open": "",
					"ui-selectmenu-button-closed": ""
				},
				first: {
					"ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
					"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
				},
				last: {
					"ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
					"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
				},
				only: {
					"ui-selectmenu-button-open": "ui-corner-top",
					"ui-selectmenu-button-closed": "ui-corner-all"
				}

			}[ position ]
		};
	},

	_resolveClassesValues: function( classes, instance ) {
		var result = {};
		$.each( classes, function( key ) {
			var current = instance.options.classes[ key ] || "";
			current = $.trim( current.replace( controlgroupCornerRegex, "" ) );
			result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
		} );
		return result;
	},

	_setOption: function( key, value ) {
		if ( key === "direction" ) {
			this._removeClass( "ui-controlgroup-" + this.options.direction );
		}

		this._super( key, value );
		if ( key === "disabled" ) {
			this._callChildMethod( value ? "disable" : "enable" );
			return;
		}

		this.refresh();
	},

	refresh: function() {
		var children,
			that = this;

		this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );

		if ( this.options.direction === "horizontal" ) {
			this._addClass( null, "ui-helper-clearfix" );
		}
		this._initWidgets();

		children = this.childWidgets;

		// We filter here because we need to track all childWidgets not just the visible ones
		if ( this.options.onlyVisible ) {
			children = children.filter( ":visible" );
		}

		if ( children.length ) {

			// We do this last because we need to make sure all enhancment is done
			// before determining first and last
			$.each( [ "first", "last" ], function( index, value ) {
				var instance = children[ value ]().data( "ui-controlgroup-data" );

				if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
					var options = that[ "_" + instance.widgetName + "Options" ](
						children.length === 1 ? "only" : value
					);
					options.classes = that._resolveClassesValues( options.classes, instance );
					instance.element[ instance.widgetName ]( options );
				} else {
					that._updateCornerClass( children[ value ](), value );
				}
			} );

			// Finally call the refresh method on each of the child widgets.
			this._callChildMethod( "refresh" );
		}
	}
} );

/*!
 * jQuery UI Checkboxradio 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Checkboxradio
//>>group: Widgets
//>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
//>>docs: http://api.jqueryui.com/checkboxradio/
//>>demos: http://jqueryui.com/checkboxradio/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/button.css
//>>css.structure: ../../themes/base/checkboxradio.css
//>>css.theme: ../../themes/base/theme.css



$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
	version: "1.12.1",
	options: {
		disabled: null,
		label: null,
		icon: true,
		classes: {
			"ui-checkboxradio-label": "ui-corner-all",
			"ui-checkboxradio-icon": "ui-corner-all"
		}
	},

	_getCreateOptions: function() {
		var disabled, labels;
		var that = this;
		var options = this._super() || {};

		// We read the type here, because it makes more sense to throw a element type error first,
		// rather then the error for lack of a label. Often if its the wrong type, it
		// won't have a label (e.g. calling on a div, btn, etc)
		this._readType();

		labels = this.element.labels();

		// If there are multiple labels, use the last one
		this.label = $( labels[ labels.length - 1 ] );
		if ( !this.label.length ) {
			$.error( "No label found for checkboxradio widget" );
		}

		this.originalLabel = "";

		// We need to get the label text but this may also need to make sure it does not contain the
		// input itself.
		this.label.contents().not( this.element[ 0 ] ).each( function() {

			// The label contents could be text, html, or a mix. We concat each element to get a
			// string representation of the label, without the input as part of it.
			that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
		} );

		// Set the label option if we found label text
		if ( this.originalLabel ) {
			options.label = this.originalLabel;
		}

		disabled = this.element[ 0 ].disabled;
		if ( disabled != null ) {
			options.disabled = disabled;
		}
		return options;
	},

	_create: function() {
		var checked = this.element[ 0 ].checked;

		this._bindFormResetHandler();

		if ( this.options.disabled == null ) {
			this.options.disabled = this.element[ 0 ].disabled;
		}

		this._setOption( "disabled", this.options.disabled );
		this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
		this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );

		if ( this.type === "radio" ) {
			this._addClass( this.label, "ui-checkboxradio-radio-label" );
		}

		if ( this.options.label && this.options.label !== this.originalLabel ) {
			this._updateLabel();
		} else if ( this.originalLabel ) {
			this.options.label = this.originalLabel;
		}

		this._enhance();

		if ( checked ) {
			this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
			if ( this.icon ) {
				this._addClass( this.icon, null, "ui-state-hover" );
			}
		}

		this._on( {
			change: "_toggleClasses",
			focus: function() {
				this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
			},
			blur: function() {
				this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
			}
		} );
	},

	_readType: function() {
		var nodeName = this.element[ 0 ].nodeName.toLowerCase();
		this.type = this.element[ 0 ].type;
		if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
			$.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
				" and element.type=" + this.type );
		}
	},

	// Support jQuery Mobile enhanced option
	_enhance: function() {
		this._updateIcon( this.element[ 0 ].checked );
	},

	widget: function() {
		return this.label;
	},

	_getRadioGroup: function() {
		var group;
		var name = this.element[ 0 ].name;
		var nameSelector = "input[name='" + $.ui.escapeSelector( name ) + "']";

		if ( !name ) {
			return $( [] );
		}

		if ( this.form.length ) {
			group = $( this.form[ 0 ].elements ).filter( nameSelector );
		} else {

			// Not inside a form, check all inputs that also are not inside a form
			group = $( nameSelector ).filter( function() {
				return $( this ).form().length === 0;
			} );
		}

		return group.not( this.element );
	},

	_toggleClasses: function() {
		var checked = this.element[ 0 ].checked;
		this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );

		if ( this.options.icon && this.type === "checkbox" ) {
			this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
				._toggleClass( this.icon, null, "ui-icon-blank", !checked );
		}

		if ( this.type === "radio" ) {
			this._getRadioGroup()
				.each( function() {
					var instance = $( this ).checkboxradio( "instance" );

					if ( instance ) {
						instance._removeClass( instance.label,
							"ui-checkboxradio-checked", "ui-state-active" );
					}
				} );
		}
	},

	_destroy: function() {
		this._unbindFormResetHandler();

		if ( this.icon ) {
			this.icon.remove();
			this.iconSpace.remove();
		}
	},

	_setOption: function( key, value ) {

		// We don't allow the value to be set to nothing
		if ( key === "label" && !value ) {
			return;
		}

		this._super( key, value );

		if ( key === "disabled" ) {
			this._toggleClass( this.label, null, "ui-state-disabled", value );
			this.element[ 0 ].disabled = value;

			// Don't refresh when setting disabled
			return;
		}
		this.refresh();
	},

	_updateIcon: function( checked ) {
		var toAdd = "ui-icon ui-icon-background ";

		if ( this.options.icon ) {
			if ( !this.icon ) {
				this.icon = $( "<span>" );
				this.iconSpace = $( "<span> </span>" );
				this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
			}

			if ( this.type === "checkbox" ) {
				toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
				this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
			} else {
				toAdd += "ui-icon-blank";
			}
			this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
			if ( !checked ) {
				this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
			}
			this.icon.prependTo( this.label ).after( this.iconSpace );
		} else if ( this.icon !== undefined ) {
			this.icon.remove();
			this.iconSpace.remove();
			delete this.icon;
		}
	},

	_updateLabel: function() {

		// Remove the contents of the label ( minus the icon, icon space, and input )
		var contents = this.label.contents().not( this.element[ 0 ] );
		if ( this.icon ) {
			contents = contents.not( this.icon[ 0 ] );
		}
		if ( this.iconSpace ) {
			contents = contents.not( this.iconSpace[ 0 ] );
		}
		contents.remove();

		this.label.append( this.options.label );
	},

	refresh: function() {
		var checked = this.element[ 0 ].checked,
			isDisabled = this.element[ 0 ].disabled;

		this._updateIcon( checked );
		this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
		if ( this.options.label !== null ) {
			this._updateLabel();
		}

		if ( isDisabled !== this.options.disabled ) {
			this._setOptions( { "disabled": isDisabled } );
		}
	}

} ] );

var widgetsCheckboxradio = $.ui.checkboxradio;


/*!
 * jQuery UI Button 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Button
//>>group: Widgets
//>>description: Enhances a form with themeable buttons.
//>>docs: http://api.jqueryui.com/button/
//>>demos: http://jqueryui.com/button/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/button.css
//>>css.theme: ../../themes/base/theme.css



$.widget( "ui.button", {
	version: "1.12.1",
	defaultElement: "<button>",
	options: {
		classes: {
			"ui-button": "ui-corner-all"
		},
		disabled: null,
		icon: null,
		iconPosition: "beginning",
		label: null,
		showLabel: true
	},

	_getCreateOptions: function() {
		var disabled,

			// This is to support cases like in jQuery Mobile where the base widget does have
			// an implementation of _getCreateOptions
			options = this._super() || {};

		this.isInput = this.element.is( "input" );

		disabled = this.element[ 0 ].disabled;
		if ( disabled != null ) {
			options.disabled = disabled;
		}

		this.originalLabel = this.isInput ? this.element.val() : this.element.html();
		if ( this.originalLabel ) {
			options.label = this.originalLabel;
		}

		return options;
	},

	_create: function() {
		if ( !this.option.showLabel & !this.options.icon ) {
			this.options.showLabel = true;
		}

		// We have to check the option again here even though we did in _getCreateOptions,
		// because null may have been passed on init which would override what was set in
		// _getCreateOptions
		if ( this.options.disabled == null ) {
			this.options.disabled = this.element[ 0 ].disabled || false;
		}

		this.hasTitle = !!this.element.attr( "title" );

		// Check to see if the label needs to be set or if its already correct
		if ( this.options.label && this.options.label !== this.originalLabel ) {
			if ( this.isInput ) {
				this.element.val( this.options.label );
			} else {
				this.element.html( this.options.label );
			}
		}
		this._addClass( "ui-button", "ui-widget" );
		this._setOption( "disabled", this.options.disabled );
		this._enhance();

		if ( this.element.is( "a" ) ) {
			this._on( {
				"keyup": function( event ) {
					if ( event.keyCode === $.ui.keyCode.SPACE ) {
						event.preventDefault();

						// Support: PhantomJS <= 1.9, IE 8 Only
						// If a native click is available use it so we actually cause navigation
						// otherwise just trigger a click event
						if ( this.element[ 0 ].click ) {
							this.element[ 0 ].click();
						} else {
							this.element.trigger( "click" );
						}
					}
				}
			} );
		}
	},

	_enhance: function() {
		if ( !this.element.is( "button" ) ) {
			this.element.attr( "role", "button" );
		}

		if ( this.options.icon ) {
			this._updateIcon( "icon", this.options.icon );
			this._updateTooltip();
		}
	},

	_updateTooltip: function() {
		this.title = this.element.attr( "title" );

		if ( !this.options.showLabel && !this.title ) {
			this.element.attr( "title", this.options.label );
		}
	},

	_updateIcon: function( option, value ) {
		var icon = option !== "iconPosition",
			position = icon ? this.options.iconPosition : value,
			displayBlock = position === "top" || position === "bottom";

		// Create icon
		if ( !this.icon ) {
			this.icon = $( "<span>" );

			this._addClass( this.icon, "ui-button-icon", "ui-icon" );

			if ( !this.options.showLabel ) {
				this._addClass( "ui-button-icon-only" );
			}
		} else if ( icon ) {

			// If we are updating the icon remove the old icon class
			this._removeClass( this.icon, null, this.options.icon );
		}

		// If we are updating the icon add the new icon class
		if ( icon ) {
			this._addClass( this.icon, null, value );
		}

		this._attachIcon( position );

		// If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
		// the iconSpace if there is one.
		if ( displayBlock ) {
			this._addClass( this.icon, null, "ui-widget-icon-block" );
			if ( this.iconSpace ) {
				this.iconSpace.remove();
			}
		} else {

			// Position is beginning or end so remove the ui-widget-icon-block class and add the
			// space if it does not exist
			if ( !this.iconSpace ) {
				this.iconSpace = $( "<span> </span>" );
				this._addClass( this.iconSpace, "ui-button-icon-space" );
			}
			this._removeClass( this.icon, null, "ui-wiget-icon-block" );
			this._attachIconSpace( position );
		}
	},

	_destroy: function() {
		this.element.removeAttr( "role" );

		if ( this.icon ) {
			this.icon.remove();
		}
		if ( this.iconSpace ) {
			this.iconSpace.remove();
		}
		if ( !this.hasTitle ) {
			this.element.removeAttr( "title" );
		}
	},

	_attachIconSpace: function( iconPosition ) {
		this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
	},

	_attachIcon: function( iconPosition ) {
		this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
	},

	_setOptions: function( options ) {
		var newShowLabel = options.showLabel === undefined ?
				this.options.showLabel :
				options.showLabel,
			newIcon = options.icon === undefined ? this.options.icon : options.icon;

		if ( !newShowLabel && !newIcon ) {
			options.showLabel = true;
		}
		this._super( options );
	},

	_setOption: function( key, value ) {
		if ( key === "icon" ) {
			if ( value ) {
				this._updateIcon( key, value );
			} else if ( this.icon ) {
				this.icon.remove();
				if ( this.iconSpace ) {
					this.iconSpace.remove();
				}
			}
		}

		if ( key === "iconPosition" ) {
			this._updateIcon( key, value );
		}

		// Make sure we can't end up with a button that has neither text nor icon
		if ( key === "showLabel" ) {
				this._toggleClass( "ui-button-icon-only", null, !value );
				this._updateTooltip();
		}

		if ( key === "label" ) {
			if ( this.isInput ) {
				this.element.val( value );
			} else {

				// If there is an icon, append it, else nothing then append the value
				// this avoids removal of the icon when setting label text
				this.element.html( value );
				if ( this.icon ) {
					this._attachIcon( this.options.iconPosition );
					this._attachIconSpace( this.options.iconPosition );
				}
			}
		}

		this._super( key, value );

		if ( key === "disabled" ) {
			this._toggleClass( null, "ui-state-disabled", value );
			this.element[ 0 ].disabled = value;
			if ( value ) {
				this.element.blur();
			}
		}
	},

	refresh: function() {

		// Make sure to only check disabled if its an element that supports this otherwise
		// check for the disabled class to determine state
		var isDisabled = this.element.is( "input, button" ) ?
			this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );

		if ( isDisabled !== this.options.disabled ) {
			this._setOptions( { disabled: isDisabled } );
		}

		this._updateTooltip();
	}
} );

// DEPRECATED
if ( $.uiBackCompat !== false ) {

	// Text and Icons options
	$.widget( "ui.button", $.ui.button, {
		options: {
			text: true,
			icons: {
				primary: null,
				secondary: null
			}
		},

		_create: function() {
			if ( this.options.showLabel && !this.options.text ) {
				this.options.showLabel = this.options.text;
			}
			if ( !this.options.showLabel && this.options.text ) {
				this.options.text = this.options.showLabel;
			}
			if ( !this.options.icon && ( this.options.icons.primary ||
					this.options.icons.secondary ) ) {
				if ( this.options.icons.primary ) {
					this.options.icon = this.options.icons.primary;
				} else {
					this.options.icon = this.options.icons.secondary;
					this.options.iconPosition = "end";
				}
			} else if ( this.options.icon ) {
				this.options.icons.primary = this.options.icon;
			}
			this._super();
		},

		_setOption: function( key, value ) {
			if ( key === "text" ) {
				this._super( "showLabel", value );
				return;
			}
			if ( key === "showLabel" ) {
				this.options.text = value;
			}
			if ( key === "icon" ) {
				this.options.icons.primary = value;
			}
			if ( key === "icons" ) {
				if ( value.primary ) {
					this._super( "icon", value.primary );
					this._super( "iconPosition", "beginning" );
				} else if ( value.secondary ) {
					this._super( "icon", value.secondary );
					this._super( "iconPosition", "end" );
				}
			}
			this._superApply( arguments );
		}
	} );

	$.fn.button = ( function( orig ) {
		return function() {
			if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) ||
					( this.length && this[ 0 ].tagName === "INPUT" && (
						this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio"
					) ) ) {
				return orig.apply( this, arguments );
			}
			if ( !$.ui.checkboxradio ) {
				$.error( "Checkboxradio widget missing" );
			}
			if ( arguments.length === 0 ) {
				return this.checkboxradio( {
					"icon": false
				} );
			}
			return this.checkboxradio.apply( this, arguments );
		};
	} )( $.fn.button );

	$.fn.buttonset = function() {
		if ( !$.ui.controlgroup ) {
			$.error( "Controlgroup widget missing" );
		}
		if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
			return this.controlgroup.apply( this,
				[ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
		}
		if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
			return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
		}
		if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
			arguments[ 0 ].items = {
				button: arguments[ 0 ].items
			};
		}
		return this.controlgroup.apply( this, arguments );
	};
}

var widgetsButton = $.ui.button;


// jscs:disable maximumLineLength
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
/*!
 * jQuery UI Datepicker 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Datepicker
//>>group: Widgets
//>>description: Displays a calendar from an input or inline for selecting dates.
//>>docs: http://api.jqueryui.com/datepicker/
//>>demos: http://jqueryui.com/datepicker/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/datepicker.css
//>>css.theme: ../../themes/base/theme.css



$.extend( $.ui, { datepicker: { version: "1.12.1" } } );

var datepicker_instActive;

function datepicker_getZindex( elem ) {
	var position, value;
	while ( elem.length && elem[ 0 ] !== document ) {

		// Ignore z-index if position is set to a value where z-index is ignored by the browser
		// This makes behavior of this function consistent across browsers
		// WebKit always returns auto if the element is positioned
		position = elem.css( "position" );
		if ( position === "absolute" || position === "relative" || position === "fixed" ) {

			// IE returns 0 when zIndex is not specified
			// other browsers return a string
			// we ignore the case of nested elements with an explicit value of 0
			// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
			value = parseInt( elem.css( "zIndex" ), 10 );
			if ( !isNaN( value ) && value !== 0 ) {
				return value;
			}
		}
		elem = elem.parent();
	}

	return 0;
}
/* Date picker manager.
   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
   Settings for (groups of) date pickers are maintained in an instance object,
   allowing multiple different settings on the same page. */

function Datepicker() {
	this._curInst = null; // The current instance in use
	this._keyEvent = false; // If the last event was a key event
	this._disabledInputs = []; // List of date picker inputs that have been disabled
	this._datepickerShowing = false; // True if the popup picker is showing , false if not
	this._inDialog = false; // True if showing within a "dialog", false if not
	this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
	this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
	this._appendClass = "ui-datepicker-append"; // The name of the append marker class
	this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
	this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
	this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
	this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
	this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
	this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
	this.regional = []; // Available regional settings, indexed by language code
	this.regional[ "" ] = { // Default regional settings
		closeText: "Done", // Display text for close link
		prevText: "Prev", // Display text for previous month link
		nextText: "Next", // Display text for next month link
		currentText: "Today", // Display text for current month link
		monthNames: [ "January","February","March","April","May","June",
			"July","August","September","October","November","December" ], // Names of months for drop-down and formatting
		monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting
		dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting
		dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting
		dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday
		weekHeader: "Wk", // Column header for week of the year
		dateFormat: "mm/dd/yy", // See format options on parseDate
		firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
		isRTL: false, // True if right-to-left language, false if left-to-right
		showMonthAfterYear: false, // True if the year select precedes month, false for month then year
		yearSuffix: "" // Additional text to append to the year in the month headers
	};
	this._defaults = { // Global defaults for all the date picker instances
		showOn: "focus", // "focus" for popup on focus,
			// "button" for trigger button, or "both" for either
		showAnim: "fadeIn", // Name of jQuery animation for popup
		showOptions: {}, // Options for enhanced animations
		defaultDate: null, // Used when field is blank: actual date,
			// +/-number for offset from today, null for today
		appendText: "", // Display text following the input box, e.g. showing the format
		buttonText: "...", // Text for trigger button
		buttonImage: "", // URL for trigger button image
		buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
		hideIfNoPrevNext: false, // True to hide next/previous month links
			// if not applicable, false to just disable them
		navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
		gotoCurrent: false, // True if today link goes back to current selection instead
		changeMonth: false, // True if month can be selected directly, false if only prev/next
		changeYear: false, // True if year can be selected directly, false if only prev/next
		yearRange: "c-10:c+10", // Range of years to display in drop-down,
			// either relative to today's year (-nn:+nn), relative to currently displayed year
			// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
		showOtherMonths: false, // True to show dates in other months, false to leave blank
		selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
		showWeek: false, // True to show week of the year, false to not show it
		calculateWeek: this.iso8601Week, // How to calculate the week of the year,
			// takes a Date and returns the number of the week for it
		shortYearCutoff: "+10", // Short year values < this are in the current century,
			// > this are in the previous century,
			// string value starting with "+" for current year + value
		minDate: null, // The earliest selectable date, or null for no limit
		maxDate: null, // The latest selectable date, or null for no limit
		duration: "fast", // Duration of display/closure
		beforeShowDay: null, // Function that takes a date and returns an array with
			// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
			// [2] = cell title (optional), e.g. $.datepicker.noWeekends
		beforeShow: null, // Function that takes an input field and
			// returns a set of custom settings for the date picker
		onSelect: null, // Define a callback function when a date is selected
		onChangeMonthYear: null, // Define a callback function when the month or year is changed
		onClose: null, // Define a callback function when the datepicker is closed
		numberOfMonths: 1, // Number of months to show at a time
		showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
		stepMonths: 1, // Number of months to step back/forward
		stepBigMonths: 12, // Number of months to step back/forward for the big links
		altField: "", // Selector for an alternate field to store selected dates into
		altFormat: "", // The date format to use for the alternate field
		constrainInput: true, // The input is constrained by the current date format
		showButtonPanel: false, // True to show button panel, false to not show it
		autoSize: false, // True to size the input for the date format, false to leave as is
		disabled: false // The initial disabled state
	};
	$.extend( this._defaults, this.regional[ "" ] );
	this.regional.en = $.extend( true, {}, this.regional[ "" ] );
	this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
	this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) );
}

$.extend( Datepicker.prototype, {
	/* Class name added to elements to indicate already configured with a date picker. */
	markerClassName: "hasDatepicker",

	//Keep track of the maximum number of rows displayed (see #7043)
	maxRows: 4,

	// TODO rename to "widget" when switching to widget factory
	_widgetDatepicker: function() {
		return this.dpDiv;
	},

	/* Override the default settings for all instances of the date picker.
	 * @param  settings  object - the new settings to use as defaults (anonymous object)
	 * @return the manager object
	 */
	setDefaults: function( settings ) {
		datepicker_extendRemove( this._defaults, settings || {} );
		return this;
	},

	/* Attach the date picker to a jQuery selection.
	 * @param  target	element - the target input field or division or span
	 * @param  settings  object - the new settings to use for this date picker instance (anonymous)
	 */
	_attachDatepicker: function( target, settings ) {
		var nodeName, inline, inst;
		nodeName = target.nodeName.toLowerCase();
		inline = ( nodeName === "div" || nodeName === "span" );
		if ( !target.id ) {
			this.uuid += 1;
			target.id = "dp" + this.uuid;
		}
		inst = this._newInst( $( target ), inline );
		inst.settings = $.extend( {}, settings || {} );
		if ( nodeName === "input" ) {
			this._connectDatepicker( target, inst );
		} else if ( inline ) {
			this._inlineDatepicker( target, inst );
		}
	},

	/* Create a new instance object. */
	_newInst: function( target, inline ) {
		var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars
		return { id: id, input: target, // associated target
			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
			drawMonth: 0, drawYear: 0, // month being drawn
			inline: inline, // is datepicker inline or not
			dpDiv: ( !inline ? this.dpDiv : // presentation div
			datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) };
	},

	/* Attach the date picker to an input field. */
	_connectDatepicker: function( target, inst ) {
		var input = $( target );
		inst.append = $( [] );
		inst.trigger = $( [] );
		if ( input.hasClass( this.markerClassName ) ) {
			return;
		}
		this._attachments( input, inst );
		input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ).
			on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp );
		this._autoSize( inst );
		$.data( target, "datepicker", inst );

		//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
		if ( inst.settings.disabled ) {
			this._disableDatepicker( target );
		}
	},

	/* Make attachments based on settings. */
	_attachments: function( input, inst ) {
		var showOn, buttonText, buttonImage,
			appendText = this._get( inst, "appendText" ),
			isRTL = this._get( inst, "isRTL" );

		if ( inst.append ) {
			inst.append.remove();
		}
		if ( appendText ) {
			inst.append = $( "<span class='" + this._appendClass + "'>" + appendText + "</span>" );
			input[ isRTL ? "before" : "after" ]( inst.append );
		}

		input.off( "focus", this._showDatepicker );

		if ( inst.trigger ) {
			inst.trigger.remove();
		}

		showOn = this._get( inst, "showOn" );
		if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field
			input.on( "focus", this._showDatepicker );
		}
		if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked
			buttonText = this._get( inst, "buttonText" );
			buttonImage = this._get( inst, "buttonImage" );
			inst.trigger = $( this._get( inst, "buttonImageOnly" ) ?
				$( "<img/>" ).addClass( this._triggerClass ).
					attr( { src: buttonImage, alt: buttonText, title: buttonText } ) :
				$( "<button type='button'></button>" ).addClass( this._triggerClass ).
					html( !buttonImage ? buttonText : $( "<img/>" ).attr(
					{ src:buttonImage, alt:buttonText, title:buttonText } ) ) );
			input[ isRTL ? "before" : "after" ]( inst.trigger );
			inst.trigger.on( "click", function() {
				if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) {
					$.datepicker._hideDatepicker();
				} else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) {
					$.datepicker._hideDatepicker();
					$.datepicker._showDatepicker( input[ 0 ] );
				} else {
					$.datepicker._showDatepicker( input[ 0 ] );
				}
				return false;
			} );
		}
	},

	/* Apply the maximum length for the date format. */
	_autoSize: function( inst ) {
		if ( this._get( inst, "autoSize" ) && !inst.inline ) {
			var findMax, max, maxI, i,
				date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits
				dateFormat = this._get( inst, "dateFormat" );

			if ( dateFormat.match( /[DM]/ ) ) {
				findMax = function( names ) {
					max = 0;
					maxI = 0;
					for ( i = 0; i < names.length; i++ ) {
						if ( names[ i ].length > max ) {
							max = names[ i ].length;
							maxI = i;
						}
					}
					return maxI;
				};
				date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ?
					"monthNames" : "monthNamesShort" ) ) ) );
				date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ?
					"dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() );
			}
			inst.input.attr( "size", this._formatDate( inst, date ).length );
		}
	},

	/* Attach an inline date picker to a div. */
	_inlineDatepicker: function( target, inst ) {
		var divSpan = $( target );
		if ( divSpan.hasClass( this.markerClassName ) ) {
			return;
		}
		divSpan.addClass( this.markerClassName ).append( inst.dpDiv );
		$.data( target, "datepicker", inst );
		this._setDate( inst, this._getDefaultDate( inst ), true );
		this._updateDatepicker( inst );
		this._updateAlternate( inst );

		//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
		if ( inst.settings.disabled ) {
			this._disableDatepicker( target );
		}

		// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
		// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
		inst.dpDiv.css( "display", "block" );
	},

	/* Pop-up the date picker in a "dialog" box.
	 * @param  input element - ignored
	 * @param  date	string or Date - the initial date to display
	 * @param  onSelect  function - the function to call when a date is selected
	 * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
	 * @param  pos int[2] - coordinates for the dialog's position within the screen or
	 *					event - with x/y coordinates or
	 *					leave empty for default (screen centre)
	 * @return the manager object
	 */
	_dialogDatepicker: function( input, date, onSelect, settings, pos ) {
		var id, browserWidth, browserHeight, scrollX, scrollY,
			inst = this._dialogInst; // internal instance

		if ( !inst ) {
			this.uuid += 1;
			id = "dp" + this.uuid;
			this._dialogInput = $( "<input type='text' id='" + id +
				"' style='position: absolute; top: -100px; width: 0px;'/>" );
			this._dialogInput.on( "keydown", this._doKeyDown );
			$( "body" ).append( this._dialogInput );
			inst = this._dialogInst = this._newInst( this._dialogInput, false );
			inst.settings = {};
			$.data( this._dialogInput[ 0 ], "datepicker", inst );
		}
		datepicker_extendRemove( inst.settings, settings || {} );
		date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date );
		this._dialogInput.val( date );

		this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null );
		if ( !this._pos ) {
			browserWidth = document.documentElement.clientWidth;
			browserHeight = document.documentElement.clientHeight;
			scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
			scrollY = document.documentElement.scrollTop || document.body.scrollTop;
			this._pos = // should use actual width/height below
				[ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ];
		}

		// Move input on screen for focus, but hidden behind dialog
		this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" );
		inst.settings.onSelect = onSelect;
		this._inDialog = true;
		this.dpDiv.addClass( this._dialogClass );
		this._showDatepicker( this._dialogInput[ 0 ] );
		if ( $.blockUI ) {
			$.blockUI( this.dpDiv );
		}
		$.data( this._dialogInput[ 0 ], "datepicker", inst );
		return this;
	},

	/* Detach a datepicker from its control.
	 * @param  target	element - the target input field or division or span
	 */
	_destroyDatepicker: function( target ) {
		var nodeName,
			$target = $( target ),
			inst = $.data( target, "datepicker" );

		if ( !$target.hasClass( this.markerClassName ) ) {
			return;
		}

		nodeName = target.nodeName.toLowerCase();
		$.removeData( target, "datepicker" );
		if ( nodeName === "input" ) {
			inst.append.remove();
			inst.trigger.remove();
			$target.removeClass( this.markerClassName ).
				off( "focus", this._showDatepicker ).
				off( "keydown", this._doKeyDown ).
				off( "keypress", this._doKeyPress ).
				off( "keyup", this._doKeyUp );
		} else if ( nodeName === "div" || nodeName === "span" ) {
			$target.removeClass( this.markerClassName ).empty();
		}

		if ( datepicker_instActive === inst ) {
			datepicker_instActive = null;
		}
	},

	/* Enable the date picker to a jQuery selection.
	 * @param  target	element - the target input field or division or span
	 */
	_enableDatepicker: function( target ) {
		var nodeName, inline,
			$target = $( target ),
			inst = $.data( target, "datepicker" );

		if ( !$target.hasClass( this.markerClassName ) ) {
			return;
		}

		nodeName = target.nodeName.toLowerCase();
		if ( nodeName === "input" ) {
			target.disabled = false;
			inst.trigger.filter( "button" ).
				each( function() { this.disabled = false; } ).end().
				filter( "img" ).css( { opacity: "1.0", cursor: "" } );
		} else if ( nodeName === "div" || nodeName === "span" ) {
			inline = $target.children( "." + this._inlineClass );
			inline.children().removeClass( "ui-state-disabled" );
			inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
				prop( "disabled", false );
		}
		this._disabledInputs = $.map( this._disabledInputs,
			function( value ) { return ( value === target ? null : value ); } ); // delete entry
	},

	/* Disable the date picker to a jQuery selection.
	 * @param  target	element - the target input field or division or span
	 */
	_disableDatepicker: function( target ) {
		var nodeName, inline,
			$target = $( target ),
			inst = $.data( target, "datepicker" );

		if ( !$target.hasClass( this.markerClassName ) ) {
			return;
		}

		nodeName = target.nodeName.toLowerCase();
		if ( nodeName === "input" ) {
			target.disabled = true;
			inst.trigger.filter( "button" ).
				each( function() { this.disabled = true; } ).end().
				filter( "img" ).css( { opacity: "0.5", cursor: "default" } );
		} else if ( nodeName === "div" || nodeName === "span" ) {
			inline = $target.children( "." + this._inlineClass );
			inline.children().addClass( "ui-state-disabled" );
			inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ).
				prop( "disabled", true );
		}
		this._disabledInputs = $.map( this._disabledInputs,
			function( value ) { return ( value === target ? null : value ); } ); // delete entry
		this._disabledInputs[ this._disabledInputs.length ] = target;
	},

	/* Is the first field in a jQuery collection disabled as a datepicker?
	 * @param  target	element - the target input field or division or span
	 * @return boolean - true if disabled, false if enabled
	 */
	_isDisabledDatepicker: function( target ) {
		if ( !target ) {
			return false;
		}
		for ( var i = 0; i < this._disabledInputs.length; i++ ) {
			if ( this._disabledInputs[ i ] === target ) {
				return true;
			}
		}
		return false;
	},

	/* Retrieve the instance data for the target control.
	 * @param  target  element - the target input field or division or span
	 * @return  object - the associated instance data
	 * @throws  error if a jQuery problem getting data
	 */
	_getInst: function( target ) {
		try {
			return $.data( target, "datepicker" );
		}
		catch ( err ) {
			throw "Missing instance data for this datepicker";
		}
	},

	/* Update or retrieve the settings for a date picker attached to an input field or division.
	 * @param  target  element - the target input field or division or span
	 * @param  name	object - the new settings to update or
	 *				string - the name of the setting to change or retrieve,
	 *				when retrieving also "all" for all instance settings or
	 *				"defaults" for all global defaults
	 * @param  value   any - the new value for the setting
	 *				(omit if above is an object or to retrieve a value)
	 */
	_optionDatepicker: function( target, name, value ) {
		var settings, date, minDate, maxDate,
			inst = this._getInst( target );

		if ( arguments.length === 2 && typeof name === "string" ) {
			return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) :
				( inst ? ( name === "all" ? $.extend( {}, inst.settings ) :
				this._get( inst, name ) ) : null ) );
		}

		settings = name || {};
		if ( typeof name === "string" ) {
			settings = {};
			settings[ name ] = value;
		}

		if ( inst ) {
			if ( this._curInst === inst ) {
				this._hideDatepicker();
			}

			date = this._getDateDatepicker( target, true );
			minDate = this._getMinMaxDate( inst, "min" );
			maxDate = this._getMinMaxDate( inst, "max" );
			datepicker_extendRemove( inst.settings, settings );

			// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
			if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) {
				inst.settings.minDate = this._formatDate( inst, minDate );
			}
			if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) {
				inst.settings.maxDate = this._formatDate( inst, maxDate );
			}
			if ( "disabled" in settings ) {
				if ( settings.disabled ) {
					this._disableDatepicker( target );
				} else {
					this._enableDatepicker( target );
				}
			}
			this._attachments( $( target ), inst );
			this._autoSize( inst );
			this._setDate( inst, date );
			this._updateAlternate( inst );
			this._updateDatepicker( inst );
		}
	},

	// Change method deprecated
	_changeDatepicker: function( target, name, value ) {
		this._optionDatepicker( target, name, value );
	},

	/* Redraw the date picker attached to an input field or division.
	 * @param  target  element - the target input field or division or span
	 */
	_refreshDatepicker: function( target ) {
		var inst = this._getInst( target );
		if ( inst ) {
			this._updateDatepicker( inst );
		}
	},

	/* Set the dates for a jQuery selection.
	 * @param  target element - the target input field or division or span
	 * @param  date	Date - the new date
	 */
	_setDateDatepicker: function( target, date ) {
		var inst = this._getInst( target );
		if ( inst ) {
			this._setDate( inst, date );
			this._updateDatepicker( inst );
			this._updateAlternate( inst );
		}
	},

	/* Get the date(s) for the first entry in a jQuery selection.
	 * @param  target element - the target input field or division or span
	 * @param  noDefault boolean - true if no default date is to be used
	 * @return Date - the current date
	 */
	_getDateDatepicker: function( target, noDefault ) {
		var inst = this._getInst( target );
		if ( inst && !inst.inline ) {
			this._setDateFromField( inst, noDefault );
		}
		return ( inst ? this._getDate( inst ) : null );
	},

	/* Handle keystrokes. */
	_doKeyDown: function( event ) {
		var onSelect, dateStr, sel,
			inst = $.datepicker._getInst( event.target ),
			handled = true,
			isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" );

		inst._keyEvent = true;
		if ( $.datepicker._datepickerShowing ) {
			switch ( event.keyCode ) {
				case 9: $.datepicker._hideDatepicker();
						handled = false;
						break; // hide on tab out
				case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." +
									$.datepicker._currentClass + ")", inst.dpDiv );
						if ( sel[ 0 ] ) {
							$.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] );
						}

						onSelect = $.datepicker._get( inst, "onSelect" );
						if ( onSelect ) {
							dateStr = $.datepicker._formatDate( inst );

							// Trigger custom callback
							onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );
						} else {
							$.datepicker._hideDatepicker();
						}

						return false; // don't submit the form
				case 27: $.datepicker._hideDatepicker();
						break; // hide on escape
				case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
							-$.datepicker._get( inst, "stepBigMonths" ) :
							-$.datepicker._get( inst, "stepMonths" ) ), "M" );
						break; // previous month/year on page up/+ ctrl
				case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ?
							+$.datepicker._get( inst, "stepBigMonths" ) :
							+$.datepicker._get( inst, "stepMonths" ) ), "M" );
						break; // next month/year on page down/+ ctrl
				case 35: if ( event.ctrlKey || event.metaKey ) {
							$.datepicker._clearDate( event.target );
						}
						handled = event.ctrlKey || event.metaKey;
						break; // clear on ctrl or command +end
				case 36: if ( event.ctrlKey || event.metaKey ) {
							$.datepicker._gotoToday( event.target );
						}
						handled = event.ctrlKey || event.metaKey;
						break; // current on ctrl or command +home
				case 37: if ( event.ctrlKey || event.metaKey ) {
							$.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" );
						}
						handled = event.ctrlKey || event.metaKey;

						// -1 day on ctrl or command +left
						if ( event.originalEvent.altKey ) {
							$.datepicker._adjustDate( event.target, ( event.ctrlKey ?
								-$.datepicker._get( inst, "stepBigMonths" ) :
								-$.datepicker._get( inst, "stepMonths" ) ), "M" );
						}

						// next month/year on alt +left on Mac
						break;
				case 38: if ( event.ctrlKey || event.metaKey ) {
							$.datepicker._adjustDate( event.target, -7, "D" );
						}
						handled = event.ctrlKey || event.metaKey;
						break; // -1 week on ctrl or command +up
				case 39: if ( event.ctrlKey || event.metaKey ) {
							$.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" );
						}
						handled = event.ctrlKey || event.metaKey;

						// +1 day on ctrl or command +right
						if ( event.originalEvent.altKey ) {
							$.datepicker._adjustDate( event.target, ( event.ctrlKey ?
								+$.datepicker._get( inst, "stepBigMonths" ) :
								+$.datepicker._get( inst, "stepMonths" ) ), "M" );
						}

						// next month/year on alt +right
						break;
				case 40: if ( event.ctrlKey || event.metaKey ) {
							$.datepicker._adjustDate( event.target, +7, "D" );
						}
						handled = event.ctrlKey || event.metaKey;
						break; // +1 week on ctrl or command +down
				default: handled = false;
			}
		} else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home
			$.datepicker._showDatepicker( this );
		} else {
			handled = false;
		}

		if ( handled ) {
			event.preventDefault();
			event.stopPropagation();
		}
	},

	/* Filter entered characters - based on date format. */
	_doKeyPress: function( event ) {
		var chars, chr,
			inst = $.datepicker._getInst( event.target );

		if ( $.datepicker._get( inst, "constrainInput" ) ) {
			chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) );
			chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode );
			return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 );
		}
	},

	/* Synchronise manual entry and field/alternate field. */
	_doKeyUp: function( event ) {
		var date,
			inst = $.datepicker._getInst( event.target );

		if ( inst.input.val() !== inst.lastVal ) {
			try {
				date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
					( inst.input ? inst.input.val() : null ),
					$.datepicker._getFormatConfig( inst ) );

				if ( date ) { // only if valid
					$.datepicker._setDateFromField( inst );
					$.datepicker._updateAlternate( inst );
					$.datepicker._updateDatepicker( inst );
				}
			}
			catch ( err ) {
			}
		}
		return true;
	},

	/* Pop-up the date picker for a given input field.
	 * If false returned from beforeShow event handler do not show.
	 * @param  input  element - the input field attached to the date picker or
	 *					event - if triggered by focus
	 */
	_showDatepicker: function( input ) {
		input = input.target || input;
		if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger
			input = $( "input", input.parentNode )[ 0 ];
		}

		if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here
			return;
		}

		var inst, beforeShow, beforeShowSettings, isFixed,
			offset, showAnim, duration;

		inst = $.datepicker._getInst( input );
		if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) {
			$.datepicker._curInst.dpDiv.stop( true, true );
			if ( inst && $.datepicker._datepickerShowing ) {
				$.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] );
			}
		}

		beforeShow = $.datepicker._get( inst, "beforeShow" );
		beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {};
		if ( beforeShowSettings === false ) {
			return;
		}
		datepicker_extendRemove( inst.settings, beforeShowSettings );

		inst.lastVal = null;
		$.datepicker._lastInput = input;
		$.datepicker._setDateFromField( inst );

		if ( $.datepicker._inDialog ) { // hide cursor
			input.value = "";
		}
		if ( !$.datepicker._pos ) { // position below input
			$.datepicker._pos = $.datepicker._findPos( input );
			$.datepicker._pos[ 1 ] += input.offsetHeight; // add the height
		}

		isFixed = false;
		$( input ).parents().each( function() {
			isFixed |= $( this ).css( "position" ) === "fixed";
			return !isFixed;
		} );

		offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] };
		$.datepicker._pos = null;

		//to avoid flashes on Firefox
		inst.dpDiv.empty();

		// determine sizing offscreen
		inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } );
		$.datepicker._updateDatepicker( inst );

		// fix width for dynamic number of date pickers
		// and adjust position before showing
		offset = $.datepicker._checkOffset( inst, offset, isFixed );
		inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ?
			"static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none",
			left: offset.left + "px", top: offset.top + "px" } );

		if ( !inst.inline ) {
			showAnim = $.datepicker._get( inst, "showAnim" );
			duration = $.datepicker._get( inst, "duration" );
			inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
			$.datepicker._datepickerShowing = true;

			if ( $.effects && $.effects.effect[ showAnim ] ) {
				inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration );
			} else {
				inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null );
			}

			if ( $.datepicker._shouldFocusInput( inst ) ) {
				inst.input.trigger( "focus" );
			}

			$.datepicker._curInst = inst;
		}
	},

	/* Generate the date picker content. */
	_updateDatepicker: function( inst ) {
		this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
		datepicker_instActive = inst; // for delegate hover events
		inst.dpDiv.empty().append( this._generateHTML( inst ) );
		this._attachHandlers( inst );

		var origyearshtml,
			numMonths = this._getNumberOfMonths( inst ),
			cols = numMonths[ 1 ],
			width = 17,
			activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );

		if ( activeCell.length > 0 ) {
			datepicker_handleMouseover.apply( activeCell.get( 0 ) );
		}

		inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" );
		if ( cols > 1 ) {
			inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" );
		}
		inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) +
			"Class" ]( "ui-datepicker-multi" );
		inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) +
			"Class" ]( "ui-datepicker-rtl" );

		if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
			inst.input.trigger( "focus" );
		}

		// Deffered render of the years select (to avoid flashes on Firefox)
		if ( inst.yearshtml ) {
			origyearshtml = inst.yearshtml;
			setTimeout( function() {

				//assure that inst.yearshtml didn't change.
				if ( origyearshtml === inst.yearshtml && inst.yearshtml ) {
					inst.dpDiv.find( "select.ui-datepicker-year:first" ).replaceWith( inst.yearshtml );
				}
				origyearshtml = inst.yearshtml = null;
			}, 0 );
		}
	},

	// #6694 - don't focus the input if it's already focused
	// this breaks the change event in IE
	// Support: IE and jQuery <1.9
	_shouldFocusInput: function( inst ) {
		return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
	},

	/* Check positioning to remain on screen. */
	_checkOffset: function( inst, offset, isFixed ) {
		var dpWidth = inst.dpDiv.outerWidth(),
			dpHeight = inst.dpDiv.outerHeight(),
			inputWidth = inst.input ? inst.input.outerWidth() : 0,
			inputHeight = inst.input ? inst.input.outerHeight() : 0,
			viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ),
			viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() );

		offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 );
		offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0;
		offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0;

		// Now check if datepicker is showing outside window viewport - move to a better place if so.
		offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ?
			Math.abs( offset.left + dpWidth - viewWidth ) : 0 );
		offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ?
			Math.abs( dpHeight + inputHeight ) : 0 );

		return offset;
	},

	/* Find an object's position on the screen. */
	_findPos: function( obj ) {
		var position,
			inst = this._getInst( obj ),
			isRTL = this._get( inst, "isRTL" );

		while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden( obj ) ) ) {
			obj = obj[ isRTL ? "previousSibling" : "nextSibling" ];
		}

		position = $( obj ).offset();
		return [ position.left, position.top ];
	},

	/* Hide the date picker from view.
	 * @param  input  element - the input field attached to the date picker
	 */
	_hideDatepicker: function( input ) {
		var showAnim, duration, postProcess, onClose,
			inst = this._curInst;

		if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) {
			return;
		}

		if ( this._datepickerShowing ) {
			showAnim = this._get( inst, "showAnim" );
			duration = this._get( inst, "duration" );
			postProcess = function() {
				$.datepicker._tidyDialog( inst );
			};

			// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
			if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
				inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess );
			} else {
				inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" :
					( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess );
			}

			if ( !showAnim ) {
				postProcess();
			}
			this._datepickerShowing = false;

			onClose = this._get( inst, "onClose" );
			if ( onClose ) {
				onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] );
			}

			this._lastInput = null;
			if ( this._inDialog ) {
				this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } );
				if ( $.blockUI ) {
					$.unblockUI();
					$( "body" ).append( this.dpDiv );
				}
			}
			this._inDialog = false;
		}
	},

	/* Tidy up after a dialog display. */
	_tidyDialog: function( inst ) {
		inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" );
	},

	/* Close date picker if clicked elsewhere. */
	_checkExternalClick: function( event ) {
		if ( !$.datepicker._curInst ) {
			return;
		}

		var $target = $( event.target ),
			inst = $.datepicker._getInst( $target[ 0 ] );

		if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId &&
				$target.parents( "#" + $.datepicker._mainDivId ).length === 0 &&
				!$target.hasClass( $.datepicker.markerClassName ) &&
				!$target.closest( "." + $.datepicker._triggerClass ).length &&
				$.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) ||
			( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) {
				$.datepicker._hideDatepicker();
		}
	},

	/* Adjust one of the date sub-fields. */
	_adjustDate: function( id, offset, period ) {
		var target = $( id ),
			inst = this._getInst( target[ 0 ] );

		if ( this._isDisabledDatepicker( target[ 0 ] ) ) {
			return;
		}
		this._adjustInstDate( inst, offset +
			( period === "M" ? this._get( inst, "showCurrentAtPos" ) : 0 ), // undo positioning
			period );
		this._updateDatepicker( inst );
	},

	/* Action for current link. */
	_gotoToday: function( id ) {
		var date,
			target = $( id ),
			inst = this._getInst( target[ 0 ] );

		if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) {
			inst.selectedDay = inst.currentDay;
			inst.drawMonth = inst.selectedMonth = inst.currentMonth;
			inst.drawYear = inst.selectedYear = inst.currentYear;
		} else {
			date = new Date();
			inst.selectedDay = date.getDate();
			inst.drawMonth = inst.selectedMonth = date.getMonth();
			inst.drawYear = inst.selectedYear = date.getFullYear();
		}
		this._notifyChange( inst );
		this._adjustDate( target );
	},

	/* Action for selecting a new month/year. */
	_selectMonthYear: function( id, select, period ) {
		var target = $( id ),
			inst = this._getInst( target[ 0 ] );

		inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] =
		inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] =
			parseInt( select.options[ select.selectedIndex ].value, 10 );

		this._notifyChange( inst );
		this._adjustDate( target );
	},

	/* Action for selecting a day. */
	_selectDay: function( id, month, year, td ) {
		var inst,
			target = $( id );

		if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) {
			return;
		}

		inst = this._getInst( target[ 0 ] );
		inst.selectedDay = inst.currentDay = $( "a", td ).html();
		inst.selectedMonth = inst.currentMonth = month;
		inst.selectedYear = inst.currentYear = year;
		this._selectDate( id, this._formatDate( inst,
			inst.currentDay, inst.currentMonth, inst.currentYear ) );
	},

	/* Erase the input field and hide the date picker. */
	_clearDate: function( id ) {
		var target = $( id );
		this._selectDate( target, "" );
	},

	/* Update the input field with the selected date. */
	_selectDate: function( id, dateStr ) {
		var onSelect,
			target = $( id ),
			inst = this._getInst( target[ 0 ] );

		dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) );
		if ( inst.input ) {
			inst.input.val( dateStr );
		}
		this._updateAlternate( inst );

		onSelect = this._get( inst, "onSelect" );
		if ( onSelect ) {
			onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] );  // trigger custom callback
		} else if ( inst.input ) {
			inst.input.trigger( "change" ); // fire the change event
		}

		if ( inst.inline ) {
			this._updateDatepicker( inst );
		} else {
			this._hideDatepicker();
			this._lastInput = inst.input[ 0 ];
			if ( typeof( inst.input[ 0 ] ) !== "object" ) {
				inst.input.trigger( "focus" ); // restore focus
			}
			this._lastInput = null;
		}
	},

	/* Update any alternate field to synchronise with the main field. */
	_updateAlternate: function( inst ) {
		var altFormat, date, dateStr,
			altField = this._get( inst, "altField" );

		if ( altField ) { // update alternate field too
			altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" );
			date = this._getDate( inst );
			dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) );
			$( altField ).val( dateStr );
		}
	},

	/* Set as beforeShowDay function to prevent selection of weekends.
	 * @param  date  Date - the date to customise
	 * @return [boolean, string] - is this date selectable?, what is its CSS class?
	 */
	noWeekends: function( date ) {
		var day = date.getDay();
		return [ ( day > 0 && day < 6 ), "" ];
	},

	/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
	 * @param  date  Date - the date to get the week for
	 * @return  number - the number of the week within the year that contains this date
	 */
	iso8601Week: function( date ) {
		var time,
			checkDate = new Date( date.getTime() );

		// Find Thursday of this week starting on Monday
		checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) );

		time = checkDate.getTime();
		checkDate.setMonth( 0 ); // Compare with Jan 1
		checkDate.setDate( 1 );
		return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1;
	},

	/* Parse a string value into a date object.
	 * See formatDate below for the possible formats.
	 *
	 * @param  format string - the expected format of the date
	 * @param  value string - the date in the above format
	 * @param  settings Object - attributes include:
	 *					shortYearCutoff  number - the cutoff year for determining the century (optional)
	 *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
	 *					dayNames		string[7] - names of the days from Sunday (optional)
	 *					monthNamesShort string[12] - abbreviated names of the months (optional)
	 *					monthNames		string[12] - names of the months (optional)
	 * @return  Date - the extracted date value or null if value is blank
	 */
	parseDate: function( format, value, settings ) {
		if ( format == null || value == null ) {
			throw "Invalid arguments";
		}

		value = ( typeof value === "object" ? value.toString() : value + "" );
		if ( value === "" ) {
			return null;
		}

		var iFormat, dim, extra,
			iValue = 0,
			shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff,
			shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
				new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ),
			dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
			dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
			monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
			monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,
			year = -1,
			month = -1,
			day = -1,
			doy = -1,
			literal = false,
			date,

			// Check whether a format character is doubled
			lookAhead = function( match ) {
				var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
				if ( matches ) {
					iFormat++;
				}
				return matches;
			},

			// Extract a number from the string value
			getNumber = function( match ) {
				var isDoubled = lookAhead( match ),
					size = ( match === "@" ? 14 : ( match === "!" ? 20 :
					( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ),
					minSize = ( match === "y" ? size : 1 ),
					digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ),
					num = value.substring( iValue ).match( digits );
				if ( !num ) {
					throw "Missing number at position " + iValue;
				}
				iValue += num[ 0 ].length;
				return parseInt( num[ 0 ], 10 );
			},

			// Extract a name from the string value and convert to an index
			getName = function( match, shortNames, longNames ) {
				var index = -1,
					names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) {
						return [ [ k, v ] ];
					} ).sort( function( a, b ) {
						return -( a[ 1 ].length - b[ 1 ].length );
					} );

				$.each( names, function( i, pair ) {
					var name = pair[ 1 ];
					if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) {
						index = pair[ 0 ];
						iValue += name.length;
						return false;
					}
				} );
				if ( index !== -1 ) {
					return index + 1;
				} else {
					throw "Unknown name at position " + iValue;
				}
			},

			// Confirm that a literal character matches the string value
			checkLiteral = function() {
				if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) {
					throw "Unexpected literal at position " + iValue;
				}
				iValue++;
			};

		for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
			if ( literal ) {
				if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
					literal = false;
				} else {
					checkLiteral();
				}
			} else {
				switch ( format.charAt( iFormat ) ) {
					case "d":
						day = getNumber( "d" );
						break;
					case "D":
						getName( "D", dayNamesShort, dayNames );
						break;
					case "o":
						doy = getNumber( "o" );
						break;
					case "m":
						month = getNumber( "m" );
						break;
					case "M":
						month = getName( "M", monthNamesShort, monthNames );
						break;
					case "y":
						year = getNumber( "y" );
						break;
					case "@":
						date = new Date( getNumber( "@" ) );
						year = date.getFullYear();
						month = date.getMonth() + 1;
						day = date.getDate();
						break;
					case "!":
						date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 );
						year = date.getFullYear();
						month = date.getMonth() + 1;
						day = date.getDate();
						break;
					case "'":
						if ( lookAhead( "'" ) ) {
							checkLiteral();
						} else {
							literal = true;
						}
						break;
					default:
						checkLiteral();
				}
			}
		}

		if ( iValue < value.length ) {
			extra = value.substr( iValue );
			if ( !/^\s+/.test( extra ) ) {
				throw "Extra/unparsed characters found in date: " + extra;
			}
		}

		if ( year === -1 ) {
			year = new Date().getFullYear();
		} else if ( year < 100 ) {
			year += new Date().getFullYear() - new Date().getFullYear() % 100 +
				( year <= shortYearCutoff ? 0 : -100 );
		}

		if ( doy > -1 ) {
			month = 1;
			day = doy;
			do {
				dim = this._getDaysInMonth( year, month - 1 );
				if ( day <= dim ) {
					break;
				}
				month++;
				day -= dim;
			} while ( true );
		}

		date = this._daylightSavingAdjust( new Date( year, month - 1, day ) );
		if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) {
			throw "Invalid date"; // E.g. 31/02/00
		}
		return date;
	},

	/* Standard date formats. */
	ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
	COOKIE: "D, dd M yy",
	ISO_8601: "yy-mm-dd",
	RFC_822: "D, d M y",
	RFC_850: "DD, dd-M-y",
	RFC_1036: "D, d M y",
	RFC_1123: "D, d M yy",
	RFC_2822: "D, d M yy",
	RSS: "D, d M y", // RFC 822
	TICKS: "!",
	TIMESTAMP: "@",
	W3C: "yy-mm-dd", // ISO 8601

	_ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) +
		Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ),

	/* Format a date object into a string value.
	 * The format can be combinations of the following:
	 * d  - day of month (no leading zero)
	 * dd - day of month (two digit)
	 * o  - day of year (no leading zeros)
	 * oo - day of year (three digit)
	 * D  - day name short
	 * DD - day name long
	 * m  - month of year (no leading zero)
	 * mm - month of year (two digit)
	 * M  - month name short
	 * MM - month name long
	 * y  - year (two digit)
	 * yy - year (four digit)
	 * @ - Unix timestamp (ms since 01/01/1970)
	 * ! - Windows ticks (100ns since 01/01/0001)
	 * "..." - literal text
	 * '' - single quote
	 *
	 * @param  format string - the desired format of the date
	 * @param  date Date - the date value to format
	 * @param  settings Object - attributes include:
	 *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
	 *					dayNames		string[7] - names of the days from Sunday (optional)
	 *					monthNamesShort string[12] - abbreviated names of the months (optional)
	 *					monthNames		string[12] - names of the months (optional)
	 * @return  string - the date in the above format
	 */
	formatDate: function( format, date, settings ) {
		if ( !date ) {
			return "";
		}

		var iFormat,
			dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort,
			dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames,
			monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort,
			monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames,

			// Check whether a format character is doubled
			lookAhead = function( match ) {
				var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
				if ( matches ) {
					iFormat++;
				}
				return matches;
			},

			// Format a number, with leading zero if necessary
			formatNumber = function( match, value, len ) {
				var num = "" + value;
				if ( lookAhead( match ) ) {
					while ( num.length < len ) {
						num = "0" + num;
					}
				}
				return num;
			},

			// Format a name, short or long as requested
			formatName = function( match, value, shortNames, longNames ) {
				return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] );
			},
			output = "",
			literal = false;

		if ( date ) {
			for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
				if ( literal ) {
					if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
						literal = false;
					} else {
						output += format.charAt( iFormat );
					}
				} else {
					switch ( format.charAt( iFormat ) ) {
						case "d":
							output += formatNumber( "d", date.getDate(), 2 );
							break;
						case "D":
							output += formatName( "D", date.getDay(), dayNamesShort, dayNames );
							break;
						case "o":
							output += formatNumber( "o",
								Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 );
							break;
						case "m":
							output += formatNumber( "m", date.getMonth() + 1, 2 );
							break;
						case "M":
							output += formatName( "M", date.getMonth(), monthNamesShort, monthNames );
							break;
						case "y":
							output += ( lookAhead( "y" ) ? date.getFullYear() :
								( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 );
							break;
						case "@":
							output += date.getTime();
							break;
						case "!":
							output += date.getTime() * 10000 + this._ticksTo1970;
							break;
						case "'":
							if ( lookAhead( "'" ) ) {
								output += "'";
							} else {
								literal = true;
							}
							break;
						default:
							output += format.charAt( iFormat );
					}
				}
			}
		}
		return output;
	},

	/* Extract all possible characters from the date format. */
	_possibleChars: function( format ) {
		var iFormat,
			chars = "",
			literal = false,

			// Check whether a format character is doubled
			lookAhead = function( match ) {
				var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match );
				if ( matches ) {
					iFormat++;
				}
				return matches;
			};

		for ( iFormat = 0; iFormat < format.length; iFormat++ ) {
			if ( literal ) {
				if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) {
					literal = false;
				} else {
					chars += format.charAt( iFormat );
				}
			} else {
				switch ( format.charAt( iFormat ) ) {
					case "d": case "m": case "y": case "@":
						chars += "0123456789";
						break;
					case "D": case "M":
						return null; // Accept anything
					case "'":
						if ( lookAhead( "'" ) ) {
							chars += "'";
						} else {
							literal = true;
						}
						break;
					default:
						chars += format.charAt( iFormat );
				}
			}
		}
		return chars;
	},

	/* Get a setting value, defaulting if necessary. */
	_get: function( inst, name ) {
		return inst.settings[ name ] !== undefined ?
			inst.settings[ name ] : this._defaults[ name ];
	},

	/* Parse existing date and initialise date picker. */
	_setDateFromField: function( inst, noDefault ) {
		if ( inst.input.val() === inst.lastVal ) {
			return;
		}

		var dateFormat = this._get( inst, "dateFormat" ),
			dates = inst.lastVal = inst.input ? inst.input.val() : null,
			defaultDate = this._getDefaultDate( inst ),
			date = defaultDate,
			settings = this._getFormatConfig( inst );

		try {
			date = this.parseDate( dateFormat, dates, settings ) || defaultDate;
		} catch ( event ) {
			dates = ( noDefault ? "" : dates );
		}
		inst.selectedDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = date.getFullYear();
		inst.currentDay = ( dates ? date.getDate() : 0 );
		inst.currentMonth = ( dates ? date.getMonth() : 0 );
		inst.currentYear = ( dates ? date.getFullYear() : 0 );
		this._adjustInstDate( inst );
	},

	/* Retrieve the default date shown on opening. */
	_getDefaultDate: function( inst ) {
		return this._restrictMinMax( inst,
			this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) );
	},

	/* A date may be specified as an exact value or a relative one. */
	_determineDate: function( inst, date, defaultDate ) {
		var offsetNumeric = function( offset ) {
				var date = new Date();
				date.setDate( date.getDate() + offset );
				return date;
			},
			offsetString = function( offset ) {
				try {
					return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ),
						offset, $.datepicker._getFormatConfig( inst ) );
				}
				catch ( e ) {

					// Ignore
				}

				var date = ( offset.toLowerCase().match( /^c/ ) ?
					$.datepicker._getDate( inst ) : null ) || new Date(),
					year = date.getFullYear(),
					month = date.getMonth(),
					day = date.getDate(),
					pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
					matches = pattern.exec( offset );

				while ( matches ) {
					switch ( matches[ 2 ] || "d" ) {
						case "d" : case "D" :
							day += parseInt( matches[ 1 ], 10 ); break;
						case "w" : case "W" :
							day += parseInt( matches[ 1 ], 10 ) * 7; break;
						case "m" : case "M" :
							month += parseInt( matches[ 1 ], 10 );
							day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
							break;
						case "y": case "Y" :
							year += parseInt( matches[ 1 ], 10 );
							day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) );
							break;
					}
					matches = pattern.exec( offset );
				}
				return new Date( year, month, day );
			},
			newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) :
				( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) );

		newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate );
		if ( newDate ) {
			newDate.setHours( 0 );
			newDate.setMinutes( 0 );
			newDate.setSeconds( 0 );
			newDate.setMilliseconds( 0 );
		}
		return this._daylightSavingAdjust( newDate );
	},

	/* Handle switch to/from daylight saving.
	 * Hours may be non-zero on daylight saving cut-over:
	 * > 12 when midnight changeover, but then cannot generate
	 * midnight datetime, so jump to 1AM, otherwise reset.
	 * @param  date  (Date) the date to check
	 * @return  (Date) the corrected date
	 */
	_daylightSavingAdjust: function( date ) {
		if ( !date ) {
			return null;
		}
		date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 );
		return date;
	},

	/* Set the date(s) directly. */
	_setDate: function( inst, date, noChange ) {
		var clear = !date,
			origMonth = inst.selectedMonth,
			origYear = inst.selectedYear,
			newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) );

		inst.selectedDay = inst.currentDay = newDate.getDate();
		inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
		inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
		if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) {
			this._notifyChange( inst );
		}
		this._adjustInstDate( inst );
		if ( inst.input ) {
			inst.input.val( clear ? "" : this._formatDate( inst ) );
		}
	},

	/* Retrieve the date(s) directly. */
	_getDate: function( inst ) {
		var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null :
			this._daylightSavingAdjust( new Date(
			inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
			return startDate;
	},

	/* Attach the onxxx handlers.  These are declared statically so
	 * they work with static code transformers like Caja.
	 */
	_attachHandlers: function( inst ) {
		var stepMonths = this._get( inst, "stepMonths" ),
			id = "#" + inst.id.replace( /\\\\/g, "\\" );
		inst.dpDiv.find( "[data-handler]" ).map( function() {
			var handler = {
				prev: function() {
					$.datepicker._adjustDate( id, -stepMonths, "M" );
				},
				next: function() {
					$.datepicker._adjustDate( id, +stepMonths, "M" );
				},
				hide: function() {
					$.datepicker._hideDatepicker();
				},
				today: function() {
					$.datepicker._gotoToday( id );
				},
				selectDay: function() {
					$.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
					return false;
				},
				selectMonth: function() {
					$.datepicker._selectMonthYear( id, this, "M" );
					return false;
				},
				selectYear: function() {
					$.datepicker._selectMonthYear( id, this, "Y" );
					return false;
				}
			};
			$( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
		} );
	},

	/* Generate the HTML for the current state of the date picker. */
	_generateHTML: function( inst ) {
		var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
			controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
			monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
			selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
			cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
			printDate, dRow, tbody, daySettings, otherMonth, unselectable,
			tempDate = new Date(),
			today = this._daylightSavingAdjust(
				new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time
			isRTL = this._get( inst, "isRTL" ),
			showButtonPanel = this._get( inst, "showButtonPanel" ),
			hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ),
			navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ),
			numMonths = this._getNumberOfMonths( inst ),
			showCurrentAtPos = this._get( inst, "showCurrentAtPos" ),
			stepMonths = this._get( inst, "stepMonths" ),
			isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ),
			currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) :
				new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ),
			minDate = this._getMinMaxDate( inst, "min" ),
			maxDate = this._getMinMaxDate( inst, "max" ),
			drawMonth = inst.drawMonth - showCurrentAtPos,
			drawYear = inst.drawYear;

		if ( drawMonth < 0 ) {
			drawMonth += 12;
			drawYear--;
		}
		if ( maxDate ) {
			maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(),
				maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) );
			maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw );
			while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) {
				drawMonth--;
				if ( drawMonth < 0 ) {
					drawMonth = 11;
					drawYear--;
				}
			}
		}
		inst.drawMonth = drawMonth;
		inst.drawYear = drawYear;

		prevText = this._get( inst, "prevText" );
		prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
			this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
			this._getFormatConfig( inst ) ) );

		prev = ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ?
			"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
			" title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" :
			( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w" ) + "'>" + prevText + "</span></a>" ) );

		nextText = this._get( inst, "nextText" );
		nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText,
			this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ),
			this._getFormatConfig( inst ) ) );

		next = ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ?
			"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
			" title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" :
			( hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e" ) + "'>" + nextText + "</span></a>" ) );

		currentText = this._get( inst, "currentText" );
		gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today );
		currentText = ( !navigationAsDateFormat ? currentText :
			this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) );

		controls = ( !inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
			this._get( inst, "closeText" ) + "</button>" : "" );

		buttonPanel = ( showButtonPanel ) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + ( isRTL ? controls : "" ) +
			( this._isInRange( inst, gotoDate ) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
			">" + currentText + "</button>" : "" ) + ( isRTL ? "" : controls ) + "</div>" : "";

		firstDay = parseInt( this._get( inst, "firstDay" ), 10 );
		firstDay = ( isNaN( firstDay ) ? 0 : firstDay );

		showWeek = this._get( inst, "showWeek" );
		dayNames = this._get( inst, "dayNames" );
		dayNamesMin = this._get( inst, "dayNamesMin" );
		monthNames = this._get( inst, "monthNames" );
		monthNamesShort = this._get( inst, "monthNamesShort" );
		beforeShowDay = this._get( inst, "beforeShowDay" );
		showOtherMonths = this._get( inst, "showOtherMonths" );
		selectOtherMonths = this._get( inst, "selectOtherMonths" );
		defaultDate = this._getDefaultDate( inst );
		html = "";

		for ( row = 0; row < numMonths[ 0 ]; row++ ) {
			group = "";
			this.maxRows = 4;
			for ( col = 0; col < numMonths[ 1 ]; col++ ) {
				selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) );
				cornerClass = " ui-corner-all";
				calender = "";
				if ( isMultiMonth ) {
					calender += "<div class='ui-datepicker-group";
					if ( numMonths[ 1 ] > 1 ) {
						switch ( col ) {
							case 0: calender += " ui-datepicker-group-first";
								cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break;
							case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last";
								cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break;
							default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
						}
					}
					calender += "'>";
				}
				calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
					( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) +
					( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) +
					this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate,
					row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers
					"</div><table class='ui-datepicker-calendar'><thead>" +
					"<tr>";
				thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" );
				for ( dow = 0; dow < 7; dow++ ) { // days of the week
					day = ( dow + firstDay ) % 7;
					thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" +
						"<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>";
				}
				calender += thead + "</tr></thead><tbody>";
				daysInMonth = this._getDaysInMonth( drawYear, drawMonth );
				if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) {
					inst.selectedDay = Math.min( inst.selectedDay, daysInMonth );
				}
				leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7;
				curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate
				numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043)
				this.maxRows = numRows;
				printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) );
				for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows
					calender += "<tr>";
					tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
						this._get( inst, "calculateWeek" )( printDate ) + "</td>" );
					for ( dow = 0; dow < 7; dow++ ) { // create date picker days
						daySettings = ( beforeShowDay ?
							beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] );
						otherMonth = ( printDate.getMonth() !== drawMonth );
						unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] ||
							( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate );
						tbody += "<td class='" +
							( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends
							( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months
							( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key
							( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ?

							// or defaultDate is current printedDate and defaultDate is selectedDate
							" " + this._dayOverClass : "" ) + // highlight selected day
							( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) +  // highlight unselectable days
							( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates
							( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day
							( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different)
							( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "&#39;" ) + "'" : "" ) + // cell title
							( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions
							( otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
							( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
							( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) +
							( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
							( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
							"' href='#'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
						printDate.setDate( printDate.getDate() + 1 );
						printDate = this._daylightSavingAdjust( printDate );
					}
					calender += tbody + "</tr>";
				}
				drawMonth++;
				if ( drawMonth > 11 ) {
					drawMonth = 0;
					drawYear++;
				}
				calender += "</tbody></table>" + ( isMultiMonth ? "</div>" +
							( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" );
				group += calender;
			}
			html += group;
		}
		html += buttonPanel;
		inst._keyEvent = false;
		return html;
	},

	/* Generate the month and year header. */
	_generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate,
			secondary, monthNames, monthNamesShort ) {

		var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
			changeMonth = this._get( inst, "changeMonth" ),
			changeYear = this._get( inst, "changeYear" ),
			showMonthAfterYear = this._get( inst, "showMonthAfterYear" ),
			html = "<div class='ui-datepicker-title'>",
			monthHtml = "";

		// Month selection
		if ( secondary || !changeMonth ) {
			monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>";
		} else {
			inMinYear = ( minDate && minDate.getFullYear() === drawYear );
			inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear );
			monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
			for ( month = 0; month < 12; month++ ) {
				if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) {
					monthHtml += "<option value='" + month + "'" +
						( month === drawMonth ? " selected='selected'" : "" ) +
						">" + monthNamesShort[ month ] + "</option>";
				}
			}
			monthHtml += "</select>";
		}

		if ( !showMonthAfterYear ) {
			html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" );
		}

		// Year selection
		if ( !inst.yearshtml ) {
			inst.yearshtml = "";
			if ( secondary || !changeYear ) {
				html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
			} else {

				// determine range of years to display
				years = this._get( inst, "yearRange" ).split( ":" );
				thisYear = new Date().getFullYear();
				determineYear = function( value ) {
					var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) :
						( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) :
						parseInt( value, 10 ) ) );
					return ( isNaN( year ) ? thisYear : year );
				};
				year = determineYear( years[ 0 ] );
				endYear = Math.max( year, determineYear( years[ 1 ] || "" ) );
				year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year );
				endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear );
				inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
				for ( ; year <= endYear; year++ ) {
					inst.yearshtml += "<option value='" + year + "'" +
						( year === drawYear ? " selected='selected'" : "" ) +
						">" + year + "</option>";
				}
				inst.yearshtml += "</select>";

				html += inst.yearshtml;
				inst.yearshtml = null;
			}
		}

		html += this._get( inst, "yearSuffix" );
		if ( showMonthAfterYear ) {
			html += ( secondary || !( changeMonth && changeYear ) ? "&#xa0;" : "" ) + monthHtml;
		}
		html += "</div>"; // Close datepicker_header
		return html;
	},

	/* Adjust one of the date sub-fields. */
	_adjustInstDate: function( inst, offset, period ) {
		var year = inst.selectedYear + ( period === "Y" ? offset : 0 ),
			month = inst.selectedMonth + ( period === "M" ? offset : 0 ),
			day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ),
			date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) );

		inst.selectedDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = date.getFullYear();
		if ( period === "M" || period === "Y" ) {
			this._notifyChange( inst );
		}
	},

	/* Ensure a date is within any min/max bounds. */
	_restrictMinMax: function( inst, date ) {
		var minDate = this._getMinMaxDate( inst, "min" ),
			maxDate = this._getMinMaxDate( inst, "max" ),
			newDate = ( minDate && date < minDate ? minDate : date );
		return ( maxDate && newDate > maxDate ? maxDate : newDate );
	},

	/* Notify change of month/year. */
	_notifyChange: function( inst ) {
		var onChange = this._get( inst, "onChangeMonthYear" );
		if ( onChange ) {
			onChange.apply( ( inst.input ? inst.input[ 0 ] : null ),
				[ inst.selectedYear, inst.selectedMonth + 1, inst ] );
		}
	},

	/* Determine the number of months to show. */
	_getNumberOfMonths: function( inst ) {
		var numMonths = this._get( inst, "numberOfMonths" );
		return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) );
	},

	/* Determine the current maximum date - ensure no time components are set. */
	_getMinMaxDate: function( inst, minMax ) {
		return this._determineDate( inst, this._get( inst, minMax + "Date" ), null );
	},

	/* Find the number of days in a given month. */
	_getDaysInMonth: function( year, month ) {
		return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate();
	},

	/* Find the day of the week of the first of a month. */
	_getFirstDayOfMonth: function( year, month ) {
		return new Date( year, month, 1 ).getDay();
	},

	/* Determines if we should allow a "next/prev" month display change. */
	_canAdjustMonth: function( inst, offset, curYear, curMonth ) {
		var numMonths = this._getNumberOfMonths( inst ),
			date = this._daylightSavingAdjust( new Date( curYear,
			curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) );

		if ( offset < 0 ) {
			date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) );
		}
		return this._isInRange( inst, date );
	},

	/* Is the given date in the accepted range? */
	_isInRange: function( inst, date ) {
		var yearSplit, currentYear,
			minDate = this._getMinMaxDate( inst, "min" ),
			maxDate = this._getMinMaxDate( inst, "max" ),
			minYear = null,
			maxYear = null,
			years = this._get( inst, "yearRange" );
			if ( years ) {
				yearSplit = years.split( ":" );
				currentYear = new Date().getFullYear();
				minYear = parseInt( yearSplit[ 0 ], 10 );
				maxYear = parseInt( yearSplit[ 1 ], 10 );
				if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) {
					minYear += currentYear;
				}
				if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) {
					maxYear += currentYear;
				}
			}

		return ( ( !minDate || date.getTime() >= minDate.getTime() ) &&
			( !maxDate || date.getTime() <= maxDate.getTime() ) &&
			( !minYear || date.getFullYear() >= minYear ) &&
			( !maxYear || date.getFullYear() <= maxYear ) );
	},

	/* Provide the configuration settings for formatting/parsing. */
	_getFormatConfig: function( inst ) {
		var shortYearCutoff = this._get( inst, "shortYearCutoff" );
		shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff :
			new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) );
		return { shortYearCutoff: shortYearCutoff,
			dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ),
			monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) };
	},

	/* Format the given date for display. */
	_formatDate: function( inst, day, month, year ) {
		if ( !day ) {
			inst.currentDay = inst.selectedDay;
			inst.currentMonth = inst.selectedMonth;
			inst.currentYear = inst.selectedYear;
		}
		var date = ( day ? ( typeof day === "object" ? day :
			this._daylightSavingAdjust( new Date( year, month, day ) ) ) :
			this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) );
		return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) );
	}
} );

/*
 * Bind hover events for datepicker elements.
 * Done via delegate so the binding only occurs once in the lifetime of the parent div.
 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
 */
function datepicker_bindHover( dpDiv ) {
	var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
	return dpDiv.on( "mouseout", selector, function() {
			$( this ).removeClass( "ui-state-hover" );
			if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
				$( this ).removeClass( "ui-datepicker-prev-hover" );
			}
			if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
				$( this ).removeClass( "ui-datepicker-next-hover" );
			}
		} )
		.on( "mouseover", selector, datepicker_handleMouseover );
}

function datepicker_handleMouseover() {
	if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) {
		$( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" );
		$( this ).addClass( "ui-state-hover" );
		if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) {
			$( this ).addClass( "ui-datepicker-prev-hover" );
		}
		if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) {
			$( this ).addClass( "ui-datepicker-next-hover" );
		}
	}
}

/* jQuery extend now ignores nulls! */
function datepicker_extendRemove( target, props ) {
	$.extend( target, props );
	for ( var name in props ) {
		if ( props[ name ] == null ) {
			target[ name ] = props[ name ];
		}
	}
	return target;
}

/* Invoke the datepicker functionality.
   @param  options  string - a command, optionally followed by additional parameters or
					Object - settings for attaching new datepicker functionality
   @return  jQuery object */
$.fn.datepicker = function( options ) {

	/* Verify an empty collection wasn't passed - Fixes #6976 */
	if ( !this.length ) {
		return this;
	}

	/* Initialise the date picker. */
	if ( !$.datepicker.initialized ) {
		$( document ).on( "mousedown", $.datepicker._checkExternalClick );
		$.datepicker.initialized = true;
	}

	/* Append datepicker main container to body if not exist. */
	if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) {
		$( "body" ).append( $.datepicker.dpDiv );
	}

	var otherArgs = Array.prototype.slice.call( arguments, 1 );
	if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) {
		return $.datepicker[ "_" + options + "Datepicker" ].
			apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
	}
	if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) {
		return $.datepicker[ "_" + options + "Datepicker" ].
			apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) );
	}
	return this.each( function() {
		typeof options === "string" ?
			$.datepicker[ "_" + options + "Datepicker" ].
				apply( $.datepicker, [ this ].concat( otherArgs ) ) :
			$.datepicker._attachDatepicker( this, options );
	} );
};

$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
$.datepicker.version = "1.12.1";

var widgetsDatepicker = $.datepicker;




// This file is deprecated
var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );

/*!
 * jQuery UI Mouse 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Mouse
//>>group: Widgets
//>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
//>>docs: http://api.jqueryui.com/mouse/



var mouseHandled = false;
$( document ).on( "mouseup", function() {
	mouseHandled = false;
} );

var widgetsMouse = $.widget( "ui.mouse", {
	version: "1.12.1",
	options: {
		cancel: "input, textarea, button, select, option",
		distance: 1,
		delay: 0
	},
	_mouseInit: function() {
		var that = this;

		this.element
			.on( "mousedown." + this.widgetName, function( event ) {
				return that._mouseDown( event );
			} )
			.on( "click." + this.widgetName, function( event ) {
				if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
					$.removeData( event.target, that.widgetName + ".preventClickEvent" );
					event.stopImmediatePropagation();
					return false;
				}
			} );

		this.started = false;
	},

	// TODO: make sure destroying one instance of mouse doesn't mess with
	// other instances of mouse
	_mouseDestroy: function() {
		this.element.off( "." + this.widgetName );
		if ( this._mouseMoveDelegate ) {
			this.document
				.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
				.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
		}
	},

	_mouseDown: function( event ) {

		// don't let more than one widget handle mouseStart
		if ( mouseHandled ) {
			return;
		}

		this._mouseMoved = false;

		// We may have missed mouseup (out of window)
		( this._mouseStarted && this._mouseUp( event ) );

		this._mouseDownEvent = event;

		var that = this,
			btnIsLeft = ( event.which === 1 ),

			// event.target.nodeName works around a bug in IE 8 with
			// disabled inputs (#7620)
			elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
				$( event.target ).closest( this.options.cancel ).length : false );
		if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
			return true;
		}

		this.mouseDelayMet = !this.options.delay;
		if ( !this.mouseDelayMet ) {
			this._mouseDelayTimer = setTimeout( function() {
				that.mouseDelayMet = true;
			}, this.options.delay );
		}

		if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
			this._mouseStarted = ( this._mouseStart( event ) !== false );
			if ( !this._mouseStarted ) {
				event.preventDefault();
				return true;
			}
		}

		// Click event may never have fired (Gecko & Opera)
		if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
			$.removeData( event.target, this.widgetName + ".preventClickEvent" );
		}

		// These delegates are required to keep context
		this._mouseMoveDelegate = function( event ) {
			return that._mouseMove( event );
		};
		this._mouseUpDelegate = function( event ) {
			return that._mouseUp( event );
		};

		this.document
			.on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
			.on( "mouseup." + this.widgetName, this._mouseUpDelegate );

		event.preventDefault();

		mouseHandled = true;
		return true;
	},

	_mouseMove: function( event ) {

		// Only check for mouseups outside the document if you've moved inside the document
		// at least once. This prevents the firing of mouseup in the case of IE<9, which will
		// fire a mousemove event if content is placed under the cursor. See #7778
		// Support: IE <9
		if ( this._mouseMoved ) {

			// IE mouseup check - mouseup happened when mouse was out of window
			if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
					!event.button ) {
				return this._mouseUp( event );

			// Iframe mouseup check - mouseup occurred in another document
			} else if ( !event.which ) {

				// Support: Safari <=8 - 9
				// Safari sets which to 0 if you press any of the following keys
				// during a drag (#14461)
				if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
						event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
					this.ignoreMissingWhich = true;
				} else if ( !this.ignoreMissingWhich ) {
					return this._mouseUp( event );
				}
			}
		}

		if ( event.which || event.button ) {
			this._mouseMoved = true;
		}

		if ( this._mouseStarted ) {
			this._mouseDrag( event );
			return event.preventDefault();
		}

		if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
			this._mouseStarted =
				( this._mouseStart( this._mouseDownEvent, event ) !== false );
			( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
		}

		return !this._mouseStarted;
	},

	_mouseUp: function( event ) {
		this.document
			.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
			.off( "mouseup." + this.widgetName, this._mouseUpDelegate );

		if ( this._mouseStarted ) {
			this._mouseStarted = false;

			if ( event.target === this._mouseDownEvent.target ) {
				$.data( event.target, this.widgetName + ".preventClickEvent", true );
			}

			this._mouseStop( event );
		}

		if ( this._mouseDelayTimer ) {
			clearTimeout( this._mouseDelayTimer );
			delete this._mouseDelayTimer;
		}

		this.ignoreMissingWhich = false;
		mouseHandled = false;
		event.preventDefault();
	},

	_mouseDistanceMet: function( event ) {
		return ( Math.max(
				Math.abs( this._mouseDownEvent.pageX - event.pageX ),
				Math.abs( this._mouseDownEvent.pageY - event.pageY )
			) >= this.options.distance
		);
	},

	_mouseDelayMet: function( /* event */ ) {
		return this.mouseDelayMet;
	},

	// These are placeholder methods, to be overriden by extending plugin
	_mouseStart: function( /* event */ ) {},
	_mouseDrag: function( /* event */ ) {},
	_mouseStop: function( /* event */ ) {},
	_mouseCapture: function( /* event */ ) { return true; }
} );




// $.ui.plugin is deprecated. Use $.widget() extensions instead.
var plugin = $.ui.plugin = {
	add: function( module, option, set ) {
		var i,
			proto = $.ui[ module ].prototype;
		for ( i in set ) {
			proto.plugins[ i ] = proto.plugins[ i ] || [];
			proto.plugins[ i ].push( [ option, set[ i ] ] );
		}
	},
	call: function( instance, name, args, allowDisconnected ) {
		var i,
			set = instance.plugins[ name ];

		if ( !set ) {
			return;
		}

		if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||
				instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
			return;
		}

		for ( i = 0; i < set.length; i++ ) {
			if ( instance.options[ set[ i ][ 0 ] ] ) {
				set[ i ][ 1 ].apply( instance.element, args );
			}
		}
	}
};



var safeBlur = $.ui.safeBlur = function( element ) {

	// Support: IE9 - 10 only
	// If the <body> is blurred, IE will switch windows, see #9420
	if ( element && element.nodeName.toLowerCase() !== "body" ) {
		$( element ).trigger( "blur" );
	}
};


/*!
 * jQuery UI Draggable 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Draggable
//>>group: Interactions
//>>description: Enables dragging functionality for any element.
//>>docs: http://api.jqueryui.com/draggable/
//>>demos: http://jqueryui.com/draggable/
//>>css.structure: ../../themes/base/draggable.css



$.widget( "ui.draggable", $.ui.mouse, {
	version: "1.12.1",
	widgetEventPrefix: "drag",
	options: {
		addClasses: true,
		appendTo: "parent",
		axis: false,
		connectToSortable: false,
		containment: false,
		cursor: "auto",
		cursorAt: false,
		grid: false,
		handle: false,
		helper: "original",
		iframeFix: false,
		opacity: false,
		refreshPositions: false,
		revert: false,
		revertDuration: 500,
		scope: "default",
		scroll: true,
		scrollSensitivity: 20,
		scrollSpeed: 20,
		snap: false,
		snapMode: "both",
		snapTolerance: 20,
		stack: false,
		zIndex: false,

		// Callbacks
		drag: null,
		start: null,
		stop: null
	},
	_create: function() {

		if ( this.options.helper === "original" ) {
			this._setPositionRelative();
		}
		if ( this.options.addClasses ) {
			this._addClass( "ui-draggable" );
		}
		this._setHandleClassName();

		this._mouseInit();
	},

	_setOption: function( key, value ) {
		this._super( key, value );
		if ( key === "handle" ) {
			this._removeHandleClassName();
			this._setHandleClassName();
		}
	},

	_destroy: function() {
		if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
			this.destroyOnClear = true;
			return;
		}
		this._removeHandleClassName();
		this._mouseDestroy();
	},

	_mouseCapture: function( event ) {
		var o = this.options;

		// Among others, prevent a drag on a resizable-handle
		if ( this.helper || o.disabled ||
				$( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) {
			return false;
		}

		//Quit if we're not on a valid handle
		this.handle = this._getHandle( event );
		if ( !this.handle ) {
			return false;
		}

		this._blurActiveElement( event );

		this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );

		return true;

	},

	_blockFrames: function( selector ) {
		this.iframeBlocks = this.document.find( selector ).map( function() {
			var iframe = $( this );

			return $( "<div>" )
				.css( "position", "absolute" )
				.appendTo( iframe.parent() )
				.outerWidth( iframe.outerWidth() )
				.outerHeight( iframe.outerHeight() )
				.offset( iframe.offset() )[ 0 ];
		} );
	},

	_unblockFrames: function() {
		if ( this.iframeBlocks ) {
			this.iframeBlocks.remove();
			delete this.iframeBlocks;
		}
	},

	_blurActiveElement: function( event ) {
		var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
			target = $( event.target );

		// Don't blur if the event occurred on an element that is within
		// the currently focused element
		// See #10527, #12472
		if ( target.closest( activeElement ).length ) {
			return;
		}

		// Blur any element that currently has focus, see #4261
		$.ui.safeBlur( activeElement );
	},

	_mouseStart: function( event ) {

		var o = this.options;

		//Create and append the visible helper
		this.helper = this._createHelper( event );

		this._addClass( this.helper, "ui-draggable-dragging" );

		//Cache the helper size
		this._cacheHelperProportions();

		//If ddmanager is used for droppables, set the global draggable
		if ( $.ui.ddmanager ) {
			$.ui.ddmanager.current = this;
		}

		/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */

		//Cache the margins of the original element
		this._cacheMargins();

		//Store the helper's css position
		this.cssPosition = this.helper.css( "position" );
		this.scrollParent = this.helper.scrollParent( true );
		this.offsetParent = this.helper.offsetParent();
		this.hasFixedAncestor = this.helper.parents().filter( function() {
				return $( this ).css( "position" ) === "fixed";
			} ).length > 0;

		//The element's absolute position on the page minus margins
		this.positionAbs = this.element.offset();
		this._refreshOffsets( event );

		//Generate the original position
		this.originalPosition = this.position = this._generatePosition( event, false );
		this.originalPageX = event.pageX;
		this.originalPageY = event.pageY;

		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
		( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );

		//Set a containment if given in the options
		this._setContainment();

		//Trigger event + callbacks
		if ( this._trigger( "start", event ) === false ) {
			this._clear();
			return false;
		}

		//Recache the helper size
		this._cacheHelperProportions();

		//Prepare the droppable offsets
		if ( $.ui.ddmanager && !o.dropBehaviour ) {
			$.ui.ddmanager.prepareOffsets( this, event );
		}

		// Execute the drag once - this causes the helper not to be visible before getting its
		// correct position
		this._mouseDrag( event, true );

		// If the ddmanager is used for droppables, inform the manager that dragging has started
		// (see #5003)
		if ( $.ui.ddmanager ) {
			$.ui.ddmanager.dragStart( this, event );
		}

		return true;
	},

	_refreshOffsets: function( event ) {
		this.offset = {
			top: this.positionAbs.top - this.margins.top,
			left: this.positionAbs.left - this.margins.left,
			scroll: false,
			parent: this._getParentOffset(),
			relative: this._getRelativeOffset()
		};

		this.offset.click = {
			left: event.pageX - this.offset.left,
			top: event.pageY - this.offset.top
		};
	},

	_mouseDrag: function( event, noPropagation ) {

		// reset any necessary cached properties (see #5009)
		if ( this.hasFixedAncestor ) {
			this.offset.parent = this._getParentOffset();
		}

		//Compute the helpers position
		this.position = this._generatePosition( event, true );
		this.positionAbs = this._convertPositionTo( "absolute" );

		//Call plugins and callbacks and use the resulting position if something is returned
		if ( !noPropagation ) {
			var ui = this._uiHash();
			if ( this._trigger( "drag", event, ui ) === false ) {
				this._mouseUp( new $.Event( "mouseup", event ) );
				return false;
			}
			this.position = ui.position;
		}

		this.helper[ 0 ].style.left = this.position.left + "px";
		this.helper[ 0 ].style.top = this.position.top + "px";

		if ( $.ui.ddmanager ) {
			$.ui.ddmanager.drag( this, event );
		}

		return false;
	},

	_mouseStop: function( event ) {

		//If we are using droppables, inform the manager about the drop
		var that = this,
			dropped = false;
		if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
			dropped = $.ui.ddmanager.drop( this, event );
		}

		//if a drop comes from outside (a sortable)
		if ( this.dropped ) {
			dropped = this.dropped;
			this.dropped = false;
		}

		if ( ( this.options.revert === "invalid" && !dropped ) ||
				( this.options.revert === "valid" && dropped ) ||
				this.options.revert === true || ( $.isFunction( this.options.revert ) &&
				this.options.revert.call( this.element, dropped ) )
		) {
			$( this.helper ).animate(
				this.originalPosition,
				parseInt( this.options.revertDuration, 10 ),
				function() {
					if ( that._trigger( "stop", event ) !== false ) {
						that._clear();
					}
				}
			);
		} else {
			if ( this._trigger( "stop", event ) !== false ) {
				this._clear();
			}
		}

		return false;
	},

	_mouseUp: function( event ) {
		this._unblockFrames();

		// If the ddmanager is used for droppables, inform the manager that dragging has stopped
		// (see #5003)
		if ( $.ui.ddmanager ) {
			$.ui.ddmanager.dragStop( this, event );
		}

		// Only need to focus if the event occurred on the draggable itself, see #10527
		if ( this.handleElement.is( event.target ) ) {

			// The interaction is over; whether or not the click resulted in a drag,
			// focus the element
			this.element.trigger( "focus" );
		}

		return $.ui.mouse.prototype._mouseUp.call( this, event );
	},

	cancel: function() {

		if ( this.helper.is( ".ui-draggable-dragging" ) ) {
			this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) );
		} else {
			this._clear();
		}

		return this;

	},

	_getHandle: function( event ) {
		return this.options.handle ?
			!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
			true;
	},

	_setHandleClassName: function() {
		this.handleElement = this.options.handle ?
			this.element.find( this.options.handle ) : this.element;
		this._addClass( this.handleElement, "ui-draggable-handle" );
	},

	_removeHandleClassName: function() {
		this._removeClass( this.handleElement, "ui-draggable-handle" );
	},

	_createHelper: function( event ) {

		var o = this.options,
			helperIsFunction = $.isFunction( o.helper ),
			helper = helperIsFunction ?
				$( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
				( o.helper === "clone" ?
					this.element.clone().removeAttr( "id" ) :
					this.element );

		if ( !helper.parents( "body" ).length ) {
			helper.appendTo( ( o.appendTo === "parent" ?
				this.element[ 0 ].parentNode :
				o.appendTo ) );
		}

		// Http://bugs.jqueryui.com/ticket/9446
		// a helper function can return the original element
		// which wouldn't have been set to relative in _create
		if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
			this._setPositionRelative();
		}

		if ( helper[ 0 ] !== this.element[ 0 ] &&
				!( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) {
			helper.css( "position", "absolute" );
		}

		return helper;

	},

	_setPositionRelative: function() {
		if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
			this.element[ 0 ].style.position = "relative";
		}
	},

	_adjustOffsetFromHelper: function( obj ) {
		if ( typeof obj === "string" ) {
			obj = obj.split( " " );
		}
		if ( $.isArray( obj ) ) {
			obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
		}
		if ( "left" in obj ) {
			this.offset.click.left = obj.left + this.margins.left;
		}
		if ( "right" in obj ) {
			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
		}
		if ( "top" in obj ) {
			this.offset.click.top = obj.top + this.margins.top;
		}
		if ( "bottom" in obj ) {
			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
		}
	},

	_isRootNode: function( element ) {
		return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
	},

	_getParentOffset: function() {

		//Get the offsetParent and cache its position
		var po = this.offsetParent.offset(),
			document = this.document[ 0 ];

		// This is a special case where we need to modify a offset calculated on start, since the
		// following happened:
		// 1. The position of the helper is absolute, so it's position is calculated based on the
		// next positioned parent
		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
		// the document, which means that the scroll is included in the initial calculation of the
		// offset of the parent, and never recalculated upon drag
		if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document &&
				$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
			po.left += this.scrollParent.scrollLeft();
			po.top += this.scrollParent.scrollTop();
		}

		if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
			po = { top: 0, left: 0 };
		}

		return {
			top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
			left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
		};

	},

	_getRelativeOffset: function() {
		if ( this.cssPosition !== "relative" ) {
			return { top: 0, left: 0 };
		}

		var p = this.element.position(),
			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );

		return {
			top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
				( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
			left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
				( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
		};

	},

	_cacheMargins: function() {
		this.margins = {
			left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ),
			top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ),
			right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ),
			bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 )
		};
	},

	_cacheHelperProportions: function() {
		this.helperProportions = {
			width: this.helper.outerWidth(),
			height: this.helper.outerHeight()
		};
	},

	_setContainment: function() {

		var isUserScrollable, c, ce,
			o = this.options,
			document = this.document[ 0 ];

		this.relativeContainer = null;

		if ( !o.containment ) {
			this.containment = null;
			return;
		}

		if ( o.containment === "window" ) {
			this.containment = [
				$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
				$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
				$( window ).scrollLeft() + $( window ).width() -
					this.helperProportions.width - this.margins.left,
				$( window ).scrollTop() +
					( $( window ).height() || document.body.parentNode.scrollHeight ) -
					this.helperProportions.height - this.margins.top
			];
			return;
		}

		if ( o.containment === "document" ) {
			this.containment = [
				0,
				0,
				$( document ).width() - this.helperProportions.width - this.margins.left,
				( $( document ).height() || document.body.parentNode.scrollHeight ) -
					this.helperProportions.height - this.margins.top
			];
			return;
		}

		if ( o.containment.constructor === Array ) {
			this.containment = o.containment;
			return;
		}

		if ( o.containment === "parent" ) {
			o.containment = this.helper[ 0 ].parentNode;
		}

		c = $( o.containment );
		ce = c[ 0 ];

		if ( !ce ) {
			return;
		}

		isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );

		this.containment = [
			( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) +
				( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
			( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) +
				( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
			( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
				( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
				( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
				this.helperProportions.width -
				this.margins.left -
				this.margins.right,
			( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
				( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
				( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
				this.helperProportions.height -
				this.margins.top -
				this.margins.bottom
		];
		this.relativeContainer = c;
	},

	_convertPositionTo: function( d, pos ) {

		if ( !pos ) {
			pos = this.position;
		}

		var mod = d === "absolute" ? 1 : -1,
			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );

		return {
			top: (

				// The absolute mouse position
				pos.top	+

				// Only for relative positioned nodes: Relative offset from element to offset parent
				this.offset.relative.top * mod +

				// The offsetParent's offset without borders (offset + border)
				this.offset.parent.top * mod -
				( ( this.cssPosition === "fixed" ?
					-this.offset.scroll.top :
					( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod )
			),
			left: (

				// The absolute mouse position
				pos.left +

				// Only for relative positioned nodes: Relative offset from element to offset parent
				this.offset.relative.left * mod +

				// The offsetParent's offset without borders (offset + border)
				this.offset.parent.left * mod	-
				( ( this.cssPosition === "fixed" ?
					-this.offset.scroll.left :
					( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod )
			)
		};

	},

	_generatePosition: function( event, constrainPosition ) {

		var containment, co, top, left,
			o = this.options,
			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
			pageX = event.pageX,
			pageY = event.pageY;

		// Cache the scroll
		if ( !scrollIsRootNode || !this.offset.scroll ) {
			this.offset.scroll = {
				top: this.scrollParent.scrollTop(),
				left: this.scrollParent.scrollLeft()
			};
		}

		/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */

		// If we are not dragging yet, we won't check for options
		if ( constrainPosition ) {
			if ( this.containment ) {
				if ( this.relativeContainer ) {
					co = this.relativeContainer.offset();
					containment = [
						this.containment[ 0 ] + co.left,
						this.containment[ 1 ] + co.top,
						this.containment[ 2 ] + co.left,
						this.containment[ 3 ] + co.top
					];
				} else {
					containment = this.containment;
				}

				if ( event.pageX - this.offset.click.left < containment[ 0 ] ) {
					pageX = containment[ 0 ] + this.offset.click.left;
				}
				if ( event.pageY - this.offset.click.top < containment[ 1 ] ) {
					pageY = containment[ 1 ] + this.offset.click.top;
				}
				if ( event.pageX - this.offset.click.left > containment[ 2 ] ) {
					pageX = containment[ 2 ] + this.offset.click.left;
				}
				if ( event.pageY - this.offset.click.top > containment[ 3 ] ) {
					pageY = containment[ 3 ] + this.offset.click.top;
				}
			}

			if ( o.grid ) {

				//Check for grid elements set to 0 to prevent divide by 0 error causing invalid
				// argument errors in IE (see ticket #6950)
				top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY -
					this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY;
				pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] ||
					top - this.offset.click.top > containment[ 3 ] ) ?
						top :
						( ( top - this.offset.click.top >= containment[ 1 ] ) ?
							top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top;

				left = o.grid[ 0 ] ? this.originalPageX +
					Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] :
					this.originalPageX;
				pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] ||
					left - this.offset.click.left > containment[ 2 ] ) ?
						left :
						( ( left - this.offset.click.left >= containment[ 0 ] ) ?
							left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left;
			}

			if ( o.axis === "y" ) {
				pageX = this.originalPageX;
			}

			if ( o.axis === "x" ) {
				pageY = this.originalPageY;
			}
		}

		return {
			top: (

				// The absolute mouse position
				pageY -

				// Click offset (relative to the element)
				this.offset.click.top -

				// Only for relative positioned nodes: Relative offset from element to offset parent
				this.offset.relative.top -

				// The offsetParent's offset without borders (offset + border)
				this.offset.parent.top +
				( this.cssPosition === "fixed" ?
					-this.offset.scroll.top :
					( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
			),
			left: (

				// The absolute mouse position
				pageX -

				// Click offset (relative to the element)
				this.offset.click.left -

				// Only for relative positioned nodes: Relative offset from element to offset parent
				this.offset.relative.left -

				// The offsetParent's offset without borders (offset + border)
				this.offset.parent.left +
				( this.cssPosition === "fixed" ?
					-this.offset.scroll.left :
					( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
			)
		};

	},

	_clear: function() {
		this._removeClass( this.helper, "ui-draggable-dragging" );
		if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) {
			this.helper.remove();
		}
		this.helper = null;
		this.cancelHelperRemoval = false;
		if ( this.destroyOnClear ) {
			this.destroy();
		}
	},

	// From now on bulk stuff - mainly helpers

	_trigger: function( type, event, ui ) {
		ui = ui || this._uiHash();
		$.ui.plugin.call( this, type, [ event, ui, this ], true );

		// Absolute position and offset (see #6884 ) have to be recalculated after plugins
		if ( /^(drag|start|stop)/.test( type ) ) {
			this.positionAbs = this._convertPositionTo( "absolute" );
			ui.offset = this.positionAbs;
		}
		return $.Widget.prototype._trigger.call( this, type, event, ui );
	},

	plugins: {},

	_uiHash: function() {
		return {
			helper: this.helper,
			position: this.position,
			originalPosition: this.originalPosition,
			offset: this.positionAbs
		};
	}

} );

$.ui.plugin.add( "draggable", "connectToSortable", {
	start: function( event, ui, draggable ) {
		var uiSortable = $.extend( {}, ui, {
			item: draggable.element
		} );

		draggable.sortables = [];
		$( draggable.options.connectToSortable ).each( function() {
			var sortable = $( this ).sortable( "instance" );

			if ( sortable && !sortable.options.disabled ) {
				draggable.sortables.push( sortable );

				// RefreshPositions is called at drag start to refresh the containerCache
				// which is used in drag. This ensures it's initialized and synchronized
				// with any changes that might have happened on the page since initialization.
				sortable.refreshPositions();
				sortable._trigger( "activate", event, uiSortable );
			}
		} );
	},
	stop: function( event, ui, draggable ) {
		var uiSortable = $.extend( {}, ui, {
			item: draggable.element
		} );

		draggable.cancelHelperRemoval = false;

		$.each( draggable.sortables, function() {
			var sortable = this;

			if ( sortable.isOver ) {
				sortable.isOver = 0;

				// Allow this sortable to handle removing the helper
				draggable.cancelHelperRemoval = true;
				sortable.cancelHelperRemoval = false;

				// Use _storedCSS To restore properties in the sortable,
				// as this also handles revert (#9675) since the draggable
				// may have modified them in unexpected ways (#8809)
				sortable._storedCSS = {
					position: sortable.placeholder.css( "position" ),
					top: sortable.placeholder.css( "top" ),
					left: sortable.placeholder.css( "left" )
				};

				sortable._mouseStop( event );

				// Once drag has ended, the sortable should return to using
				// its original helper, not the shared helper from draggable
				sortable.options.helper = sortable.options._helper;
			} else {

				// Prevent this Sortable from removing the helper.
				// However, don't set the draggable to remove the helper
				// either as another connected Sortable may yet handle the removal.
				sortable.cancelHelperRemoval = true;

				sortable._trigger( "deactivate", event, uiSortable );
			}
		} );
	},
	drag: function( event, ui, draggable ) {
		$.each( draggable.sortables, function() {
			var innermostIntersecting = false,
				sortable = this;

			// Copy over variables that sortable's _intersectsWith uses
			sortable.positionAbs = draggable.positionAbs;
			sortable.helperProportions = draggable.helperProportions;
			sortable.offset.click = draggable.offset.click;

			if ( sortable._intersectsWith( sortable.containerCache ) ) {
				innermostIntersecting = true;

				$.each( draggable.sortables, function() {

					// Copy over variables that sortable's _intersectsWith uses
					this.positionAbs = draggable.positionAbs;
					this.helperProportions = draggable.helperProportions;
					this.offset.click = draggable.offset.click;

					if ( this !== sortable &&
							this._intersectsWith( this.containerCache ) &&
							$.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
						innermostIntersecting = false;
					}

					return innermostIntersecting;
				} );
			}

			if ( innermostIntersecting ) {

				// If it intersects, we use a little isOver variable and set it once,
				// so that the move-in stuff gets fired only once.
				if ( !sortable.isOver ) {
					sortable.isOver = 1;

					// Store draggable's parent in case we need to reappend to it later.
					draggable._parent = ui.helper.parent();

					sortable.currentItem = ui.helper
						.appendTo( sortable.element )
						.data( "ui-sortable-item", true );

					// Store helper option to later restore it
					sortable.options._helper = sortable.options.helper;

					sortable.options.helper = function() {
						return ui.helper[ 0 ];
					};

					// Fire the start events of the sortable with our passed browser event,
					// and our own helper (so it doesn't create a new one)
					event.target = sortable.currentItem[ 0 ];
					sortable._mouseCapture( event, true );
					sortable._mouseStart( event, true, true );

					// Because the browser event is way off the new appended portlet,
					// modify necessary variables to reflect the changes
					sortable.offset.click.top = draggable.offset.click.top;
					sortable.offset.click.left = draggable.offset.click.left;
					sortable.offset.parent.left -= draggable.offset.parent.left -
						sortable.offset.parent.left;
					sortable.offset.parent.top -= draggable.offset.parent.top -
						sortable.offset.parent.top;

					draggable._trigger( "toSortable", event );

					// Inform draggable that the helper is in a valid drop zone,
					// used solely in the revert option to handle "valid/invalid".
					draggable.dropped = sortable.element;

					// Need to refreshPositions of all sortables in the case that
					// adding to one sortable changes the location of the other sortables (#9675)
					$.each( draggable.sortables, function() {
						this.refreshPositions();
					} );

					// Hack so receive/update callbacks work (mostly)
					draggable.currentItem = draggable.element;
					sortable.fromOutside = draggable;
				}

				if ( sortable.currentItem ) {
					sortable._mouseDrag( event );

					// Copy the sortable's position because the draggable's can potentially reflect
					// a relative position, while sortable is always absolute, which the dragged
					// element has now become. (#8809)
					ui.position = sortable.position;
				}
			} else {

				// If it doesn't intersect with the sortable, and it intersected before,
				// we fake the drag stop of the sortable, but make sure it doesn't remove
				// the helper by using cancelHelperRemoval.
				if ( sortable.isOver ) {

					sortable.isOver = 0;
					sortable.cancelHelperRemoval = true;

					// Calling sortable's mouseStop would trigger a revert,
					// so revert must be temporarily false until after mouseStop is called.
					sortable.options._revert = sortable.options.revert;
					sortable.options.revert = false;

					sortable._trigger( "out", event, sortable._uiHash( sortable ) );
					sortable._mouseStop( event, true );

					// Restore sortable behaviors that were modfied
					// when the draggable entered the sortable area (#9481)
					sortable.options.revert = sortable.options._revert;
					sortable.options.helper = sortable.options._helper;

					if ( sortable.placeholder ) {
						sortable.placeholder.remove();
					}

					// Restore and recalculate the draggable's offset considering the sortable
					// may have modified them in unexpected ways. (#8809, #10669)
					ui.helper.appendTo( draggable._parent );
					draggable._refreshOffsets( event );
					ui.position = draggable._generatePosition( event, true );

					draggable._trigger( "fromSortable", event );

					// Inform draggable that the helper is no longer in a valid drop zone
					draggable.dropped = false;

					// Need to refreshPositions of all sortables just in case removing
					// from one sortable changes the location of other sortables (#9675)
					$.each( draggable.sortables, function() {
						this.refreshPositions();
					} );
				}
			}
		} );
	}
} );

$.ui.plugin.add( "draggable", "cursor", {
	start: function( event, ui, instance ) {
		var t = $( "body" ),
			o = instance.options;

		if ( t.css( "cursor" ) ) {
			o._cursor = t.css( "cursor" );
		}
		t.css( "cursor", o.cursor );
	},
	stop: function( event, ui, instance ) {
		var o = instance.options;
		if ( o._cursor ) {
			$( "body" ).css( "cursor", o._cursor );
		}
	}
} );

$.ui.plugin.add( "draggable", "opacity", {
	start: function( event, ui, instance ) {
		var t = $( ui.helper ),
			o = instance.options;
		if ( t.css( "opacity" ) ) {
			o._opacity = t.css( "opacity" );
		}
		t.css( "opacity", o.opacity );
	},
	stop: function( event, ui, instance ) {
		var o = instance.options;
		if ( o._opacity ) {
			$( ui.helper ).css( "opacity", o._opacity );
		}
	}
} );

$.ui.plugin.add( "draggable", "scroll", {
	start: function( event, ui, i ) {
		if ( !i.scrollParentNotHidden ) {
			i.scrollParentNotHidden = i.helper.scrollParent( false );
		}

		if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] &&
				i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
			i.overflowOffset = i.scrollParentNotHidden.offset();
		}
	},
	drag: function( event, ui, i  ) {

		var o = i.options,
			scrolled = false,
			scrollParent = i.scrollParentNotHidden[ 0 ],
			document = i.document[ 0 ];

		if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
			if ( !o.axis || o.axis !== "x" ) {
				if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY <
						o.scrollSensitivity ) {
					scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
				} else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
					scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
				}
			}

			if ( !o.axis || o.axis !== "y" ) {
				if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX <
						o.scrollSensitivity ) {
					scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
				} else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
					scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
				}
			}

		} else {

			if ( !o.axis || o.axis !== "x" ) {
				if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) {
					scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
				} else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) <
						o.scrollSensitivity ) {
					scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
				}
			}

			if ( !o.axis || o.axis !== "y" ) {
				if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) {
					scrolled = $( document ).scrollLeft(
						$( document ).scrollLeft() - o.scrollSpeed
					);
				} else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) <
						o.scrollSensitivity ) {
					scrolled = $( document ).scrollLeft(
						$( document ).scrollLeft() + o.scrollSpeed
					);
				}
			}

		}

		if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
			$.ui.ddmanager.prepareOffsets( i, event );
		}

	}
} );

$.ui.plugin.add( "draggable", "snap", {
	start: function( event, ui, i ) {

		var o = i.options;

		i.snapElements = [];

		$( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap )
			.each( function() {
				var $t = $( this ),
					$o = $t.offset();
				if ( this !== i.element[ 0 ] ) {
					i.snapElements.push( {
						item: this,
						width: $t.outerWidth(), height: $t.outerHeight(),
						top: $o.top, left: $o.left
					} );
				}
			} );

	},
	drag: function( event, ui, inst ) {

		var ts, bs, ls, rs, l, r, t, b, i, first,
			o = inst.options,
			d = o.snapTolerance,
			x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
			y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;

		for ( i = inst.snapElements.length - 1; i >= 0; i-- ) {

			l = inst.snapElements[ i ].left - inst.margins.left;
			r = l + inst.snapElements[ i ].width;
			t = inst.snapElements[ i ].top - inst.margins.top;
			b = t + inst.snapElements[ i ].height;

			if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
					!$.contains( inst.snapElements[ i ].item.ownerDocument,
					inst.snapElements[ i ].item ) ) {
				if ( inst.snapElements[ i ].snapping ) {
					( inst.options.snap.release &&
						inst.options.snap.release.call(
							inst.element,
							event,
							$.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } )
						) );
				}
				inst.snapElements[ i ].snapping = false;
				continue;
			}

			if ( o.snapMode !== "inner" ) {
				ts = Math.abs( t - y2 ) <= d;
				bs = Math.abs( b - y1 ) <= d;
				ls = Math.abs( l - x2 ) <= d;
				rs = Math.abs( r - x1 ) <= d;
				if ( ts ) {
					ui.position.top = inst._convertPositionTo( "relative", {
						top: t - inst.helperProportions.height,
						left: 0
					} ).top;
				}
				if ( bs ) {
					ui.position.top = inst._convertPositionTo( "relative", {
						top: b,
						left: 0
					} ).top;
				}
				if ( ls ) {
					ui.position.left = inst._convertPositionTo( "relative", {
						top: 0,
						left: l - inst.helperProportions.width
					} ).left;
				}
				if ( rs ) {
					ui.position.left = inst._convertPositionTo( "relative", {
						top: 0,
						left: r
					} ).left;
				}
			}

			first = ( ts || bs || ls || rs );

			if ( o.snapMode !== "outer" ) {
				ts = Math.abs( t - y1 ) <= d;
				bs = Math.abs( b - y2 ) <= d;
				ls = Math.abs( l - x1 ) <= d;
				rs = Math.abs( r - x2 ) <= d;
				if ( ts ) {
					ui.position.top = inst._convertPositionTo( "relative", {
						top: t,
						left: 0
					} ).top;
				}
				if ( bs ) {
					ui.position.top = inst._convertPositionTo( "relative", {
						top: b - inst.helperProportions.height,
						left: 0
					} ).top;
				}
				if ( ls ) {
					ui.position.left = inst._convertPositionTo( "relative", {
						top: 0,
						left: l
					} ).left;
				}
				if ( rs ) {
					ui.position.left = inst._convertPositionTo( "relative", {
						top: 0,
						left: r - inst.helperProportions.width
					} ).left;
				}
			}

			if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) {
				( inst.options.snap.snap &&
					inst.options.snap.snap.call(
						inst.element,
						event,
						$.extend( inst._uiHash(), {
							snapItem: inst.snapElements[ i ].item
						} ) ) );
			}
			inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first );

		}

	}
} );

$.ui.plugin.add( "draggable", "stack", {
	start: function( event, ui, instance ) {
		var min,
			o = instance.options,
			group = $.makeArray( $( o.stack ) ).sort( function( a, b ) {
				return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) -
					( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 );
			} );

		if ( !group.length ) { return; }

		min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0;
		$( group ).each( function( i ) {
			$( this ).css( "zIndex", min + i );
		} );
		this.css( "zIndex", ( min + group.length ) );
	}
} );

$.ui.plugin.add( "draggable", "zIndex", {
	start: function( event, ui, instance ) {
		var t = $( ui.helper ),
			o = instance.options;

		if ( t.css( "zIndex" ) ) {
			o._zIndex = t.css( "zIndex" );
		}
		t.css( "zIndex", o.zIndex );
	},
	stop: function( event, ui, instance ) {
		var o = instance.options;

		if ( o._zIndex ) {
			$( ui.helper ).css( "zIndex", o._zIndex );
		}
	}
} );

var widgetsDraggable = $.ui.draggable;


/*!
 * jQuery UI Resizable 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Resizable
//>>group: Interactions
//>>description: Enables resize functionality for any element.
//>>docs: http://api.jqueryui.com/resizable/
//>>demos: http://jqueryui.com/resizable/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/resizable.css
//>>css.theme: ../../themes/base/theme.css



$.widget( "ui.resizable", $.ui.mouse, {
	version: "1.12.1",
	widgetEventPrefix: "resize",
	options: {
		alsoResize: false,
		animate: false,
		animateDuration: "slow",
		animateEasing: "swing",
		aspectRatio: false,
		autoHide: false,
		classes: {
			"ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
		},
		containment: false,
		ghost: false,
		grid: false,
		handles: "e,s,se",
		helper: false,
		maxHeight: null,
		maxWidth: null,
		minHeight: 10,
		minWidth: 10,

		// See #7960
		zIndex: 90,

		// Callbacks
		resize: null,
		start: null,
		stop: null
	},

	_num: function( value ) {
		return parseFloat( value ) || 0;
	},

	_isNumber: function( value ) {
		return !isNaN( parseFloat( value ) );
	},

	_hasScroll: function( el, a ) {

		if ( $( el ).css( "overflow" ) === "hidden" ) {
			return false;
		}

		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
			has = false;

		if ( el[ scroll ] > 0 ) {
			return true;
		}

		// TODO: determine which cases actually cause this to happen
		// if the element doesn't have the scroll set, see if it's possible to
		// set the scroll
		el[ scroll ] = 1;
		has = ( el[ scroll ] > 0 );
		el[ scroll ] = 0;
		return has;
	},

	_create: function() {

		var margins,
			o = this.options,
			that = this;
		this._addClass( "ui-resizable" );

		$.extend( this, {
			_aspectRatio: !!( o.aspectRatio ),
			aspectRatio: o.aspectRatio,
			originalElement: this.element,
			_proportionallyResizeElements: [],
			_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
		} );

		// Wrap the element if it cannot hold child nodes
		if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {

			this.element.wrap(
				$( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ).css( {
					position: this.element.css( "position" ),
					width: this.element.outerWidth(),
					height: this.element.outerHeight(),
					top: this.element.css( "top" ),
					left: this.element.css( "left" )
				} )
			);

			this.element = this.element.parent().data(
				"ui-resizable", this.element.resizable( "instance" )
			);

			this.elementIsWrapper = true;

			margins = {
				marginTop: this.originalElement.css( "marginTop" ),
				marginRight: this.originalElement.css( "marginRight" ),
				marginBottom: this.originalElement.css( "marginBottom" ),
				marginLeft: this.originalElement.css( "marginLeft" )
			};

			this.element.css( margins );
			this.originalElement.css( "margin", 0 );

			// support: Safari
			// Prevent Safari textarea resize
			this.originalResizeStyle = this.originalElement.css( "resize" );
			this.originalElement.css( "resize", "none" );

			this._proportionallyResizeElements.push( this.originalElement.css( {
				position: "static",
				zoom: 1,
				display: "block"
			} ) );

			// Support: IE9
			// avoid IE jump (hard set the margin)
			this.originalElement.css( margins );

			this._proportionallyResize();
		}

		this._setupHandles();

		if ( o.autoHide ) {
			$( this.element )
				.on( "mouseenter", function() {
					if ( o.disabled ) {
						return;
					}
					that._removeClass( "ui-resizable-autohide" );
					that._handles.show();
				} )
				.on( "mouseleave", function() {
					if ( o.disabled ) {
						return;
					}
					if ( !that.resizing ) {
						that._addClass( "ui-resizable-autohide" );
						that._handles.hide();
					}
				} );
		}

		this._mouseInit();
	},

	_destroy: function() {

		this._mouseDestroy();

		var wrapper,
			_destroy = function( exp ) {
				$( exp )
					.removeData( "resizable" )
					.removeData( "ui-resizable" )
					.off( ".resizable" )
					.find( ".ui-resizable-handle" )
						.remove();
			};

		// TODO: Unwrap at same DOM position
		if ( this.elementIsWrapper ) {
			_destroy( this.element );
			wrapper = this.element;
			this.originalElement.css( {
				position: wrapper.css( "position" ),
				width: wrapper.outerWidth(),
				height: wrapper.outerHeight(),
				top: wrapper.css( "top" ),
				left: wrapper.css( "left" )
			} ).insertAfter( wrapper );
			wrapper.remove();
		}

		this.originalElement.css( "resize", this.originalResizeStyle );
		_destroy( this.originalElement );

		return this;
	},

	_setOption: function( key, value ) {
		this._super( key, value );

		switch ( key ) {
		case "handles":
			this._removeHandles();
			this._setupHandles();
			break;
		default:
			break;
		}
	},

	_setupHandles: function() {
		var o = this.options, handle, i, n, hname, axis, that = this;
		this.handles = o.handles ||
			( !$( ".ui-resizable-handle", this.element ).length ?
				"e,s,se" : {
					n: ".ui-resizable-n",
					e: ".ui-resizable-e",
					s: ".ui-resizable-s",
					w: ".ui-resizable-w",
					se: ".ui-resizable-se",
					sw: ".ui-resizable-sw",
					ne: ".ui-resizable-ne",
					nw: ".ui-resizable-nw"
				} );

		this._handles = $();
		if ( this.handles.constructor === String ) {

			if ( this.handles === "all" ) {
				this.handles = "n,e,s,w,se,sw,ne,nw";
			}

			n = this.handles.split( "," );
			this.handles = {};

			for ( i = 0; i < n.length; i++ ) {

				handle = $.trim( n[ i ] );
				hname = "ui-resizable-" + handle;
				axis = $( "<div>" );
				this._addClass( axis, "ui-resizable-handle " + hname );

				axis.css( { zIndex: o.zIndex } );

				this.handles[ handle ] = ".ui-resizable-" + handle;
				this.element.append( axis );
			}

		}

		this._renderAxis = function( target ) {

			var i, axis, padPos, padWrapper;

			target = target || this.element;

			for ( i in this.handles ) {

				if ( this.handles[ i ].constructor === String ) {
					this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
				} else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
					this.handles[ i ] = $( this.handles[ i ] );
					this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
				}

				if ( this.elementIsWrapper &&
						this.originalElement[ 0 ]
							.nodeName
							.match( /^(textarea|input|select|button)$/i ) ) {
					axis = $( this.handles[ i ], this.element );

					padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
						axis.outerHeight() :
						axis.outerWidth();

					padPos = [ "padding",
						/ne|nw|n/.test( i ) ? "Top" :
						/se|sw|s/.test( i ) ? "Bottom" :
						/^e$/.test( i ) ? "Right" : "Left" ].join( "" );

					target.css( padPos, padWrapper );

					this._proportionallyResize();
				}

				this._handles = this._handles.add( this.handles[ i ] );
			}
		};

		// TODO: make renderAxis a prototype function
		this._renderAxis( this.element );

		this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
		this._handles.disableSelection();

		this._handles.on( "mouseover", function() {
			if ( !that.resizing ) {
				if ( this.className ) {
					axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
				}
				that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
			}
		} );

		if ( o.autoHide ) {
			this._handles.hide();
			this._addClass( "ui-resizable-autohide" );
		}
	},

	_removeHandles: function() {
		this._handles.remove();
	},

	_mouseCapture: function( event ) {
		var i, handle,
			capture = false;

		for ( i in this.handles ) {
			handle = $( this.handles[ i ] )[ 0 ];
			if ( handle === event.target || $.contains( handle, event.target ) ) {
				capture = true;
			}
		}

		return !this.options.disabled && capture;
	},

	_mouseStart: function( event ) {

		var curleft, curtop, cursor,
			o = this.options,
			el = this.element;

		this.resizing = true;

		this._renderProxy();

		curleft = this._num( this.helper.css( "left" ) );
		curtop = this._num( this.helper.css( "top" ) );

		if ( o.containment ) {
			curleft += $( o.containment ).scrollLeft() || 0;
			curtop += $( o.containment ).scrollTop() || 0;
		}

		this.offset = this.helper.offset();
		this.position = { left: curleft, top: curtop };

		this.size = this._helper ? {
				width: this.helper.width(),
				height: this.helper.height()
			} : {
				width: el.width(),
				height: el.height()
			};

		this.originalSize = this._helper ? {
				width: el.outerWidth(),
				height: el.outerHeight()
			} : {
				width: el.width(),
				height: el.height()
			};

		this.sizeDiff = {
			width: el.outerWidth() - el.width(),
			height: el.outerHeight() - el.height()
		};

		this.originalPosition = { left: curleft, top: curtop };
		this.originalMousePosition = { left: event.pageX, top: event.pageY };

		this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
			o.aspectRatio :
			( ( this.originalSize.width / this.originalSize.height ) || 1 );

		cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
		$( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );

		this._addClass( "ui-resizable-resizing" );
		this._propagate( "start", event );
		return true;
	},

	_mouseDrag: function( event ) {

		var data, props,
			smp = this.originalMousePosition,
			a = this.axis,
			dx = ( event.pageX - smp.left ) || 0,
			dy = ( event.pageY - smp.top ) || 0,
			trigger = this._change[ a ];

		this._updatePrevProperties();

		if ( !trigger ) {
			return false;
		}

		data = trigger.apply( this, [ event, dx, dy ] );

		this._updateVirtualBoundaries( event.shiftKey );
		if ( this._aspectRatio || event.shiftKey ) {
			data = this._updateRatio( data, event );
		}

		data = this._respectSize( data, event );

		this._updateCache( data );

		this._propagate( "resize", event );

		props = this._applyChanges();

		if ( !this._helper && this._proportionallyResizeElements.length ) {
			this._proportionallyResize();
		}

		if ( !$.isEmptyObject( props ) ) {
			this._updatePrevProperties();
			this._trigger( "resize", event, this.ui() );
			this._applyChanges();
		}

		return false;
	},

	_mouseStop: function( event ) {

		this.resizing = false;
		var pr, ista, soffseth, soffsetw, s, left, top,
			o = this.options, that = this;

		if ( this._helper ) {

			pr = this._proportionallyResizeElements;
			ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
			soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
			soffsetw = ista ? 0 : that.sizeDiff.width;

			s = {
				width: ( that.helper.width()  - soffsetw ),
				height: ( that.helper.height() - soffseth )
			};
			left = ( parseFloat( that.element.css( "left" ) ) +
				( that.position.left - that.originalPosition.left ) ) || null;
			top = ( parseFloat( that.element.css( "top" ) ) +
				( that.position.top - that.originalPosition.top ) ) || null;

			if ( !o.animate ) {
				this.element.css( $.extend( s, { top: top, left: left } ) );
			}

			that.helper.height( that.size.height );
			that.helper.width( that.size.width );

			if ( this._helper && !o.animate ) {
				this._proportionallyResize();
			}
		}

		$( "body" ).css( "cursor", "auto" );

		this._removeClass( "ui-resizable-resizing" );

		this._propagate( "stop", event );

		if ( this._helper ) {
			this.helper.remove();
		}

		return false;

	},

	_updatePrevProperties: function() {
		this.prevPosition = {
			top: this.position.top,
			left: this.position.left
		};
		this.prevSize = {
			width: this.size.width,
			height: this.size.height
		};
	},

	_applyChanges: function() {
		var props = {};

		if ( this.position.top !== this.prevPosition.top ) {
			props.top = this.position.top + "px";
		}
		if ( this.position.left !== this.prevPosition.left ) {
			props.left = this.position.left + "px";
		}
		if ( this.size.width !== this.prevSize.width ) {
			props.width = this.size.width + "px";
		}
		if ( this.size.height !== this.prevSize.height ) {
			props.height = this.size.height + "px";
		}

		this.helper.css( props );

		return props;
	},

	_updateVirtualBoundaries: function( forceAspectRatio ) {
		var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
			o = this.options;

		b = {
			minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
			maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
			minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
			maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
		};

		if ( this._aspectRatio || forceAspectRatio ) {
			pMinWidth = b.minHeight * this.aspectRatio;
			pMinHeight = b.minWidth / this.aspectRatio;
			pMaxWidth = b.maxHeight * this.aspectRatio;
			pMaxHeight = b.maxWidth / this.aspectRatio;

			if ( pMinWidth > b.minWidth ) {
				b.minWidth = pMinWidth;
			}
			if ( pMinHeight > b.minHeight ) {
				b.minHeight = pMinHeight;
			}
			if ( pMaxWidth < b.maxWidth ) {
				b.maxWidth = pMaxWidth;
			}
			if ( pMaxHeight < b.maxHeight ) {
				b.maxHeight = pMaxHeight;
			}
		}
		this._vBoundaries = b;
	},

	_updateCache: function( data ) {
		this.offset = this.helper.offset();
		if ( this._isNumber( data.left ) ) {
			this.position.left = data.left;
		}
		if ( this._isNumber( data.top ) ) {
			this.position.top = data.top;
		}
		if ( this._isNumber( data.height ) ) {
			this.size.height = data.height;
		}
		if ( this._isNumber( data.width ) ) {
			this.size.width = data.width;
		}
	},

	_updateRatio: function( data ) {

		var cpos = this.position,
			csize = this.size,
			a = this.axis;

		if ( this._isNumber( data.height ) ) {
			data.width = ( data.height * this.aspectRatio );
		} else if ( this._isNumber( data.width ) ) {
			data.height = ( data.width / this.aspectRatio );
		}

		if ( a === "sw" ) {
			data.left = cpos.left + ( csize.width - data.width );
			data.top = null;
		}
		if ( a === "nw" ) {
			data.top = cpos.top + ( csize.height - data.height );
			data.left = cpos.left + ( csize.width - data.width );
		}

		return data;
	},

	_respectSize: function( data ) {

		var o = this._vBoundaries,
			a = this.axis,
			ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
			ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
			isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
			isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
			dw = this.originalPosition.left + this.originalSize.width,
			dh = this.originalPosition.top + this.originalSize.height,
			cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
		if ( isminw ) {
			data.width = o.minWidth;
		}
		if ( isminh ) {
			data.height = o.minHeight;
		}
		if ( ismaxw ) {
			data.width = o.maxWidth;
		}
		if ( ismaxh ) {
			data.height = o.maxHeight;
		}

		if ( isminw && cw ) {
			data.left = dw - o.minWidth;
		}
		if ( ismaxw && cw ) {
			data.left = dw - o.maxWidth;
		}
		if ( isminh && ch ) {
			data.top = dh - o.minHeight;
		}
		if ( ismaxh && ch ) {
			data.top = dh - o.maxHeight;
		}

		// Fixing jump error on top/left - bug #2330
		if ( !data.width && !data.height && !data.left && data.top ) {
			data.top = null;
		} else if ( !data.width && !data.height && !data.top && data.left ) {
			data.left = null;
		}

		return data;
	},

	_getPaddingPlusBorderDimensions: function( element ) {
		var i = 0,
			widths = [],
			borders = [
				element.css( "borderTopWidth" ),
				element.css( "borderRightWidth" ),
				element.css( "borderBottomWidth" ),
				element.css( "borderLeftWidth" )
			],
			paddings = [
				element.css( "paddingTop" ),
				element.css( "paddingRight" ),
				element.css( "paddingBottom" ),
				element.css( "paddingLeft" )
			];

		for ( ; i < 4; i++ ) {
			widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
			widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
		}

		return {
			height: widths[ 0 ] + widths[ 2 ],
			width: widths[ 1 ] + widths[ 3 ]
		};
	},

	_proportionallyResize: function() {

		if ( !this._proportionallyResizeElements.length ) {
			return;
		}

		var prel,
			i = 0,
			element = this.helper || this.element;

		for ( ; i < this._proportionallyResizeElements.length; i++ ) {

			prel = this._proportionallyResizeElements[ i ];

			// TODO: Seems like a bug to cache this.outerDimensions
			// considering that we are in a loop.
			if ( !this.outerDimensions ) {
				this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
			}

			prel.css( {
				height: ( element.height() - this.outerDimensions.height ) || 0,
				width: ( element.width() - this.outerDimensions.width ) || 0
			} );

		}

	},

	_renderProxy: function() {

		var el = this.element, o = this.options;
		this.elementOffset = el.offset();

		if ( this._helper ) {

			this.helper = this.helper || $( "<div style='overflow:hidden;'></div>" );

			this._addClass( this.helper, this._helper );
			this.helper.css( {
				width: this.element.outerWidth(),
				height: this.element.outerHeight(),
				position: "absolute",
				left: this.elementOffset.left + "px",
				top: this.elementOffset.top + "px",
				zIndex: ++o.zIndex //TODO: Don't modify option
			} );

			this.helper
				.appendTo( "body" )
				.disableSelection();

		} else {
			this.helper = this.element;
		}

	},

	_change: {
		e: function( event, dx ) {
			return { width: this.originalSize.width + dx };
		},
		w: function( event, dx ) {
			var cs = this.originalSize, sp = this.originalPosition;
			return { left: sp.left + dx, width: cs.width - dx };
		},
		n: function( event, dx, dy ) {
			var cs = this.originalSize, sp = this.originalPosition;
			return { top: sp.top + dy, height: cs.height - dy };
		},
		s: function( event, dx, dy ) {
			return { height: this.originalSize.height + dy };
		},
		se: function( event, dx, dy ) {
			return $.extend( this._change.s.apply( this, arguments ),
				this._change.e.apply( this, [ event, dx, dy ] ) );
		},
		sw: function( event, dx, dy ) {
			return $.extend( this._change.s.apply( this, arguments ),
				this._change.w.apply( this, [ event, dx, dy ] ) );
		},
		ne: function( event, dx, dy ) {
			return $.extend( this._change.n.apply( this, arguments ),
				this._change.e.apply( this, [ event, dx, dy ] ) );
		},
		nw: function( event, dx, dy ) {
			return $.extend( this._change.n.apply( this, arguments ),
				this._change.w.apply( this, [ event, dx, dy ] ) );
		}
	},

	_propagate: function( n, event ) {
		$.ui.plugin.call( this, n, [ event, this.ui() ] );
		( n !== "resize" && this._trigger( n, event, this.ui() ) );
	},

	plugins: {},

	ui: function() {
		return {
			originalElement: this.originalElement,
			element: this.element,
			helper: this.helper,
			position: this.position,
			size: this.size,
			originalSize: this.originalSize,
			originalPosition: this.originalPosition
		};
	}

} );

/*
 * Resizable Extensions
 */

$.ui.plugin.add( "resizable", "animate", {

	stop: function( event ) {
		var that = $( this ).resizable( "instance" ),
			o = that.options,
			pr = that._proportionallyResizeElements,
			ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
			soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
			soffsetw = ista ? 0 : that.sizeDiff.width,
			style = {
				width: ( that.size.width - soffsetw ),
				height: ( that.size.height - soffseth )
			},
			left = ( parseFloat( that.element.css( "left" ) ) +
				( that.position.left - that.originalPosition.left ) ) || null,
			top = ( parseFloat( that.element.css( "top" ) ) +
				( that.position.top - that.originalPosition.top ) ) || null;

		that.element.animate(
			$.extend( style, top && left ? { top: top, left: left } : {} ), {
				duration: o.animateDuration,
				easing: o.animateEasing,
				step: function() {

					var data = {
						width: parseFloat( that.element.css( "width" ) ),
						height: parseFloat( that.element.css( "height" ) ),
						top: parseFloat( that.element.css( "top" ) ),
						left: parseFloat( that.element.css( "left" ) )
					};

					if ( pr && pr.length ) {
						$( pr[ 0 ] ).css( { width: data.width, height: data.height } );
					}

					// Propagating resize, and updating values for each animation step
					that._updateCache( data );
					that._propagate( "resize", event );

				}
			}
		);
	}

} );

$.ui.plugin.add( "resizable", "containment", {

	start: function() {
		var element, p, co, ch, cw, width, height,
			that = $( this ).resizable( "instance" ),
			o = that.options,
			el = that.element,
			oc = o.containment,
			ce = ( oc instanceof $ ) ?
				oc.get( 0 ) :
				( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;

		if ( !ce ) {
			return;
		}

		that.containerElement = $( ce );

		if ( /document/.test( oc ) || oc === document ) {
			that.containerOffset = {
				left: 0,
				top: 0
			};
			that.containerPosition = {
				left: 0,
				top: 0
			};

			that.parentData = {
				element: $( document ),
				left: 0,
				top: 0,
				width: $( document ).width(),
				height: $( document ).height() || document.body.parentNode.scrollHeight
			};
		} else {
			element = $( ce );
			p = [];
			$( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
				p[ i ] = that._num( element.css( "padding" + name ) );
			} );

			that.containerOffset = element.offset();
			that.containerPosition = element.position();
			that.containerSize = {
				height: ( element.innerHeight() - p[ 3 ] ),
				width: ( element.innerWidth() - p[ 1 ] )
			};

			co = that.containerOffset;
			ch = that.containerSize.height;
			cw = that.containerSize.width;
			width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
			height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;

			that.parentData = {
				element: ce,
				left: co.left,
				top: co.top,
				width: width,
				height: height
			};
		}
	},

	resize: function( event ) {
		var woset, hoset, isParent, isOffsetRelative,
			that = $( this ).resizable( "instance" ),
			o = that.options,
			co = that.containerOffset,
			cp = that.position,
			pRatio = that._aspectRatio || event.shiftKey,
			cop = {
				top: 0,
				left: 0
			},
			ce = that.containerElement,
			continueResize = true;

		if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
			cop = co;
		}

		if ( cp.left < ( that._helper ? co.left : 0 ) ) {
			that.size.width = that.size.width +
				( that._helper ?
					( that.position.left - co.left ) :
					( that.position.left - cop.left ) );

			if ( pRatio ) {
				that.size.height = that.size.width / that.aspectRatio;
				continueResize = false;
			}
			that.position.left = o.helper ? co.left : 0;
		}

		if ( cp.top < ( that._helper ? co.top : 0 ) ) {
			that.size.height = that.size.height +
				( that._helper ?
					( that.position.top - co.top ) :
					that.position.top );

			if ( pRatio ) {
				that.size.width = that.size.height * that.aspectRatio;
				continueResize = false;
			}
			that.position.top = that._helper ? co.top : 0;
		}

		isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
		isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );

		if ( isParent && isOffsetRelative ) {
			that.offset.left = that.parentData.left + that.position.left;
			that.offset.top = that.parentData.top + that.position.top;
		} else {
			that.offset.left = that.element.offset().left;
			that.offset.top = that.element.offset().top;
		}

		woset = Math.abs( that.sizeDiff.width +
			( that._helper ?
				that.offset.left - cop.left :
				( that.offset.left - co.left ) ) );

		hoset = Math.abs( that.sizeDiff.height +
			( that._helper ?
				that.offset.top - cop.top :
				( that.offset.top - co.top ) ) );

		if ( woset + that.size.width >= that.parentData.width ) {
			that.size.width = that.parentData.width - woset;
			if ( pRatio ) {
				that.size.height = that.size.width / that.aspectRatio;
				continueResize = false;
			}
		}

		if ( hoset + that.size.height >= that.parentData.height ) {
			that.size.height = that.parentData.height - hoset;
			if ( pRatio ) {
				that.size.width = that.size.height * that.aspectRatio;
				continueResize = false;
			}
		}

		if ( !continueResize ) {
			that.position.left = that.prevPosition.left;
			that.position.top = that.prevPosition.top;
			that.size.width = that.prevSize.width;
			that.size.height = that.prevSize.height;
		}
	},

	stop: function() {
		var that = $( this ).resizable( "instance" ),
			o = that.options,
			co = that.containerOffset,
			cop = that.containerPosition,
			ce = that.containerElement,
			helper = $( that.helper ),
			ho = helper.offset(),
			w = helper.outerWidth() - that.sizeDiff.width,
			h = helper.outerHeight() - that.sizeDiff.height;

		if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
			$( this ).css( {
				left: ho.left - cop.left - co.left,
				width: w,
				height: h
			} );
		}

		if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
			$( this ).css( {
				left: ho.left - cop.left - co.left,
				width: w,
				height: h
			} );
		}
	}
} );

$.ui.plugin.add( "resizable", "alsoResize", {

	start: function() {
		var that = $( this ).resizable( "instance" ),
			o = that.options;

		$( o.alsoResize ).each( function() {
			var el = $( this );
			el.data( "ui-resizable-alsoresize", {
				width: parseFloat( el.width() ), height: parseFloat( el.height() ),
				left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
			} );
		} );
	},

	resize: function( event, ui ) {
		var that = $( this ).resizable( "instance" ),
			o = that.options,
			os = that.originalSize,
			op = that.originalPosition,
			delta = {
				height: ( that.size.height - os.height ) || 0,
				width: ( that.size.width - os.width ) || 0,
				top: ( that.position.top - op.top ) || 0,
				left: ( that.position.left - op.left ) || 0
			};

			$( o.alsoResize ).each( function() {
				var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
					css = el.parents( ui.originalElement[ 0 ] ).length ?
							[ "width", "height" ] :
							[ "width", "height", "top", "left" ];

				$.each( css, function( i, prop ) {
					var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
					if ( sum && sum >= 0 ) {
						style[ prop ] = sum || null;
					}
				} );

				el.css( style );
			} );
	},

	stop: function() {
		$( this ).removeData( "ui-resizable-alsoresize" );
	}
} );

$.ui.plugin.add( "resizable", "ghost", {

	start: function() {

		var that = $( this ).resizable( "instance" ), cs = that.size;

		that.ghost = that.originalElement.clone();
		that.ghost.css( {
			opacity: 0.25,
			display: "block",
			position: "relative",
			height: cs.height,
			width: cs.width,
			margin: 0,
			left: 0,
			top: 0
		} );

		that._addClass( that.ghost, "ui-resizable-ghost" );

		// DEPRECATED
		// TODO: remove after 1.12
		if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {

			// Ghost option
			that.ghost.addClass( this.options.ghost );
		}

		that.ghost.appendTo( that.helper );

	},

	resize: function() {
		var that = $( this ).resizable( "instance" );
		if ( that.ghost ) {
			that.ghost.css( {
				position: "relative",
				height: that.size.height,
				width: that.size.width
			} );
		}
	},

	stop: function() {
		var that = $( this ).resizable( "instance" );
		if ( that.ghost && that.helper ) {
			that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
		}
	}

} );

$.ui.plugin.add( "resizable", "grid", {

	resize: function() {
		var outerDimensions,
			that = $( this ).resizable( "instance" ),
			o = that.options,
			cs = that.size,
			os = that.originalSize,
			op = that.originalPosition,
			a = that.axis,
			grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
			gridX = ( grid[ 0 ] || 1 ),
			gridY = ( grid[ 1 ] || 1 ),
			ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
			oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
			newWidth = os.width + ox,
			newHeight = os.height + oy,
			isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
			isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
			isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
			isMinHeight = o.minHeight && ( o.minHeight > newHeight );

		o.grid = grid;

		if ( isMinWidth ) {
			newWidth += gridX;
		}
		if ( isMinHeight ) {
			newHeight += gridY;
		}
		if ( isMaxWidth ) {
			newWidth -= gridX;
		}
		if ( isMaxHeight ) {
			newHeight -= gridY;
		}

		if ( /^(se|s|e)$/.test( a ) ) {
			that.size.width = newWidth;
			that.size.height = newHeight;
		} else if ( /^(ne)$/.test( a ) ) {
			that.size.width = newWidth;
			that.size.height = newHeight;
			that.position.top = op.top - oy;
		} else if ( /^(sw)$/.test( a ) ) {
			that.size.width = newWidth;
			that.size.height = newHeight;
			that.position.left = op.left - ox;
		} else {
			if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
				outerDimensions = that._getPaddingPlusBorderDimensions( this );
			}

			if ( newHeight - gridY > 0 ) {
				that.size.height = newHeight;
				that.position.top = op.top - oy;
			} else {
				newHeight = gridY - outerDimensions.height;
				that.size.height = newHeight;
				that.position.top = op.top + os.height - newHeight;
			}
			if ( newWidth - gridX > 0 ) {
				that.size.width = newWidth;
				that.position.left = op.left - ox;
			} else {
				newWidth = gridX - outerDimensions.width;
				that.size.width = newWidth;
				that.position.left = op.left + os.width - newWidth;
			}
		}
	}

} );

var widgetsResizable = $.ui.resizable;


/*!
 * jQuery UI Dialog 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Dialog
//>>group: Widgets
//>>description: Displays customizable dialog windows.
//>>docs: http://api.jqueryui.com/dialog/
//>>demos: http://jqueryui.com/dialog/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/dialog.css
//>>css.theme: ../../themes/base/theme.css



$.widget( "ui.dialog", {
	version: "1.12.1",
	options: {
		appendTo: "body",
		autoOpen: true,
		buttons: [],
		classes: {
			"ui-dialog": "ui-corner-all",
			"ui-dialog-titlebar": "ui-corner-all"
		},
		closeOnEscape: true,
		closeText: "Close",
		draggable: true,
		hide: null,
		height: "auto",
		maxHeight: null,
		maxWidth: null,
		minHeight: 150,
		minWidth: 150,
		modal: false,
		position: {
			my: "center",
			at: "center",
			of: window,
			collision: "fit",

			// Ensure the titlebar is always visible
			using: function( pos ) {
				var topOffset = $( this ).css( pos ).offset().top;
				if ( topOffset < 0 ) {
					$( this ).css( "top", pos.top - topOffset );
				}
			}
		},
		resizable: true,
		show: null,
		title: null,
		width: 300,

		// Callbacks
		beforeClose: null,
		close: null,
		drag: null,
		dragStart: null,
		dragStop: null,
		focus: null,
		open: null,
		resize: null,
		resizeStart: null,
		resizeStop: null
	},

	sizeRelatedOptions: {
		buttons: true,
		height: true,
		maxHeight: true,
		maxWidth: true,
		minHeight: true,
		minWidth: true,
		width: true
	},

	resizableRelatedOptions: {
		maxHeight: true,
		maxWidth: true,
		minHeight: true,
		minWidth: true
	},

	_create: function() {
		this.originalCss = {
			display: this.element[ 0 ].style.display,
			width: this.element[ 0 ].style.width,
			minHeight: this.element[ 0 ].style.minHeight,
			maxHeight: this.element[ 0 ].style.maxHeight,
			height: this.element[ 0 ].style.height
		};
		this.originalPosition = {
			parent: this.element.parent(),
			index: this.element.parent().children().index( this.element )
		};
		this.originalTitle = this.element.attr( "title" );
		if ( this.options.title == null && this.originalTitle != null ) {
			this.options.title = this.originalTitle;
		}

		// Dialogs can't be disabled
		if ( this.options.disabled ) {
			this.options.disabled = false;
		}

		this._createWrapper();

		this.element
			.show()
			.removeAttr( "title" )
			.appendTo( this.uiDialog );

		this._addClass( "ui-dialog-content", "ui-widget-content" );

		this._createTitlebar();
		this._createButtonPane();

		if ( this.options.draggable && $.fn.draggable ) {
			this._makeDraggable();
		}
		if ( this.options.resizable && $.fn.resizable ) {
			this._makeResizable();
		}

		this._isOpen = false;

		this._trackFocus();
	},

	_init: function() {
		if ( this.options.autoOpen ) {
			this.open();
		}
	},

	_appendTo: function() {
		var element = this.options.appendTo;
		if ( element && ( element.jquery || element.nodeType ) ) {
			return $( element );
		}
		return this.document.find( element || "body" ).eq( 0 );
	},

	_destroy: function() {
		var next,
			originalPosition = this.originalPosition;

		this._untrackInstance();
		this._destroyOverlay();

		this.element
			.removeUniqueId()
			.css( this.originalCss )

			// Without detaching first, the following becomes really slow
			.detach();

		this.uiDialog.remove();

		if ( this.originalTitle ) {
			this.element.attr( "title", this.originalTitle );
		}

		next = originalPosition.parent.children().eq( originalPosition.index );

		// Don't try to place the dialog next to itself (#8613)
		if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
			next.before( this.element );
		} else {
			originalPosition.parent.append( this.element );
		}
	},

	widget: function() {
		return this.uiDialog;
	},

	disable: $.noop,
	enable: $.noop,

	close: function( event ) {
		var that = this;

		if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
			return;
		}

		this._isOpen = false;
		this._focusedElement = null;
		this._destroyOverlay();
		this._untrackInstance();

		if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) {

			// Hiding a focused element doesn't trigger blur in WebKit
			// so in case we have nothing to focus on, explicitly blur the active element
			// https://bugs.webkit.org/show_bug.cgi?id=47182
			$.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) );
		}

		this._hide( this.uiDialog, this.options.hide, function() {
			that._trigger( "close", event );
		} );
	},

	isOpen: function() {
		return this._isOpen;
	},

	moveToTop: function() {
		this._moveToTop();
	},

	_moveToTop: function( event, silent ) {
		var moved = false,
			zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() {
				return +$( this ).css( "z-index" );
			} ).get(),
			zIndexMax = Math.max.apply( null, zIndices );

		if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
			this.uiDialog.css( "z-index", zIndexMax + 1 );
			moved = true;
		}

		if ( moved && !silent ) {
			this._trigger( "focus", event );
		}
		return moved;
	},

	open: function() {
		var that = this;
		if ( this._isOpen ) {
			if ( this._moveToTop() ) {
				this._focusTabbable();
			}
			return;
		}

		this._isOpen = true;
		this.opener = $( $.ui.safeActiveElement( this.document[ 0 ] ) );

		this._size();
		this._position();
		this._createOverlay();
		this._moveToTop( null, true );

		// Ensure the overlay is moved to the top with the dialog, but only when
		// opening. The overlay shouldn't move after the dialog is open so that
		// modeless dialogs opened after the modal dialog stack properly.
		if ( this.overlay ) {
			this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
		}

		this._show( this.uiDialog, this.options.show, function() {
			that._focusTabbable();
			that._trigger( "focus" );
		} );

		// Track the dialog immediately upon openening in case a focus event
		// somehow occurs outside of the dialog before an element inside the
		// dialog is focused (#10152)
		this._makeFocusTarget();

		this._trigger( "open" );
	},

	_focusTabbable: function() {

		// Set focus to the first match:
		// 1. An element that was focused previously
		// 2. First element inside the dialog matching [autofocus]
		// 3. Tabbable element inside the content element
		// 4. Tabbable element inside the buttonpane
		// 5. The close button
		// 6. The dialog itself
		var hasFocus = this._focusedElement;
		if ( !hasFocus ) {
			hasFocus = this.element.find( "[autofocus]" );
		}
		if ( !hasFocus.length ) {
			hasFocus = this.element.find( ":tabbable" );
		}
		if ( !hasFocus.length ) {
			hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
		}
		if ( !hasFocus.length ) {
			hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
		}
		if ( !hasFocus.length ) {
			hasFocus = this.uiDialog;
		}
		hasFocus.eq( 0 ).trigger( "focus" );
	},

	_keepFocus: function( event ) {
		function checkFocus() {
			var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
				isActive = this.uiDialog[ 0 ] === activeElement ||
					$.contains( this.uiDialog[ 0 ], activeElement );
			if ( !isActive ) {
				this._focusTabbable();
			}
		}
		event.preventDefault();
		checkFocus.call( this );

		// support: IE
		// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
		// so we check again later
		this._delay( checkFocus );
	},

	_createWrapper: function() {
		this.uiDialog = $( "<div>" )
			.hide()
			.attr( {

				// Setting tabIndex makes the div focusable
				tabIndex: -1,
				role: "dialog"
			} )
			.appendTo( this._appendTo() );

		this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" );
		this._on( this.uiDialog, {
			keydown: function( event ) {
				if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
						event.keyCode === $.ui.keyCode.ESCAPE ) {
					event.preventDefault();
					this.close( event );
					return;
				}

				// Prevent tabbing out of dialogs
				if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
					return;
				}
				var tabbables = this.uiDialog.find( ":tabbable" ),
					first = tabbables.filter( ":first" ),
					last = tabbables.filter( ":last" );

				if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) &&
						!event.shiftKey ) {
					this._delay( function() {
						first.trigger( "focus" );
					} );
					event.preventDefault();
				} else if ( ( event.target === first[ 0 ] ||
						event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) {
					this._delay( function() {
						last.trigger( "focus" );
					} );
					event.preventDefault();
				}
			},
			mousedown: function( event ) {
				if ( this._moveToTop( event ) ) {
					this._focusTabbable();
				}
			}
		} );

		// We assume that any existing aria-describedby attribute means
		// that the dialog content is marked up properly
		// otherwise we brute force the content as the description
		if ( !this.element.find( "[aria-describedby]" ).length ) {
			this.uiDialog.attr( {
				"aria-describedby": this.element.uniqueId().attr( "id" )
			} );
		}
	},

	_createTitlebar: function() {
		var uiDialogTitle;

		this.uiDialogTitlebar = $( "<div>" );
		this._addClass( this.uiDialogTitlebar,
			"ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" );
		this._on( this.uiDialogTitlebar, {
			mousedown: function( event ) {

				// Don't prevent click on close button (#8838)
				// Focusing a dialog that is partially scrolled out of view
				// causes the browser to scroll it into view, preventing the click event
				if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {

					// Dialog isn't getting focus when dragging (#8063)
					this.uiDialog.trigger( "focus" );
				}
			}
		} );

		// Support: IE
		// Use type="button" to prevent enter keypresses in textboxes from closing the
		// dialog in IE (#9312)
		this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
			.button( {
				label: $( "<a>" ).text( this.options.closeText ).html(),
				icon: "ui-icon-closethick",
				showLabel: false
			} )
			.appendTo( this.uiDialogTitlebar );

		this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" );
		this._on( this.uiDialogTitlebarClose, {
			click: function( event ) {
				event.preventDefault();
				this.close( event );
			}
		} );

		uiDialogTitle = $( "<span>" ).uniqueId().prependTo( this.uiDialogTitlebar );
		this._addClass( uiDialogTitle, "ui-dialog-title" );
		this._title( uiDialogTitle );

		this.uiDialogTitlebar.prependTo( this.uiDialog );

		this.uiDialog.attr( {
			"aria-labelledby": uiDialogTitle.attr( "id" )
		} );
	},

	_title: function( title ) {
		if ( this.options.title ) {
			title.text( this.options.title );
		} else {
			title.html( "&#160;" );
		}
	},

	_createButtonPane: function() {
		this.uiDialogButtonPane = $( "<div>" );
		this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane",
			"ui-widget-content ui-helper-clearfix" );

		this.uiButtonSet = $( "<div>" )
			.appendTo( this.uiDialogButtonPane );
		this._addClass( this.uiButtonSet, "ui-dialog-buttonset" );

		this._createButtons();
	},

	_createButtons: function() {
		var that = this,
			buttons = this.options.buttons;

		// If we already have a button pane, remove it
		this.uiDialogButtonPane.remove();
		this.uiButtonSet.empty();

		if ( $.isEmptyObject( buttons ) || ( $.isArray( buttons ) && !buttons.length ) ) {
			this._removeClass( this.uiDialog, "ui-dialog-buttons" );
			return;
		}

		$.each( buttons, function( name, props ) {
			var click, buttonOptions;
			props = $.isFunction( props ) ?
				{ click: props, text: name } :
				props;

			// Default to a non-submitting button
			props = $.extend( { type: "button" }, props );

			// Change the context for the click callback to be the main element
			click = props.click;
			buttonOptions = {
				icon: props.icon,
				iconPosition: props.iconPosition,
				showLabel: props.showLabel,

				// Deprecated options
				icons: props.icons,
				text: props.text
			};

			delete props.click;
			delete props.icon;
			delete props.iconPosition;
			delete props.showLabel;

			// Deprecated options
			delete props.icons;
			if ( typeof props.text === "boolean" ) {
				delete props.text;
			}

			$( "<button></button>", props )
				.button( buttonOptions )
				.appendTo( that.uiButtonSet )
				.on( "click", function() {
					click.apply( that.element[ 0 ], arguments );
				} );
		} );
		this._addClass( this.uiDialog, "ui-dialog-buttons" );
		this.uiDialogButtonPane.appendTo( this.uiDialog );
	},

	_makeDraggable: function() {
		var that = this,
			options = this.options;

		function filteredUi( ui ) {
			return {
				position: ui.position,
				offset: ui.offset
			};
		}

		this.uiDialog.draggable( {
			cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
			handle: ".ui-dialog-titlebar",
			containment: "document",
			start: function( event, ui ) {
				that._addClass( $( this ), "ui-dialog-dragging" );
				that._blockFrames();
				that._trigger( "dragStart", event, filteredUi( ui ) );
			},
			drag: function( event, ui ) {
				that._trigger( "drag", event, filteredUi( ui ) );
			},
			stop: function( event, ui ) {
				var left = ui.offset.left - that.document.scrollLeft(),
					top = ui.offset.top - that.document.scrollTop();

				options.position = {
					my: "left top",
					at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
						"top" + ( top >= 0 ? "+" : "" ) + top,
					of: that.window
				};
				that._removeClass( $( this ), "ui-dialog-dragging" );
				that._unblockFrames();
				that._trigger( "dragStop", event, filteredUi( ui ) );
			}
		} );
	},

	_makeResizable: function() {
		var that = this,
			options = this.options,
			handles = options.resizable,

			// .ui-resizable has position: relative defined in the stylesheet
			// but dialogs have to use absolute or fixed positioning
			position = this.uiDialog.css( "position" ),
			resizeHandles = typeof handles === "string" ?
				handles :
				"n,e,s,w,se,sw,ne,nw";

		function filteredUi( ui ) {
			return {
				originalPosition: ui.originalPosition,
				originalSize: ui.originalSize,
				position: ui.position,
				size: ui.size
			};
		}

		this.uiDialog.resizable( {
			cancel: ".ui-dialog-content",
			containment: "document",
			alsoResize: this.element,
			maxWidth: options.maxWidth,
			maxHeight: options.maxHeight,
			minWidth: options.minWidth,
			minHeight: this._minHeight(),
			handles: resizeHandles,
			start: function( event, ui ) {
				that._addClass( $( this ), "ui-dialog-resizing" );
				that._blockFrames();
				that._trigger( "resizeStart", event, filteredUi( ui ) );
			},
			resize: function( event, ui ) {
				that._trigger( "resize", event, filteredUi( ui ) );
			},
			stop: function( event, ui ) {
				var offset = that.uiDialog.offset(),
					left = offset.left - that.document.scrollLeft(),
					top = offset.top - that.document.scrollTop();

				options.height = that.uiDialog.height();
				options.width = that.uiDialog.width();
				options.position = {
					my: "left top",
					at: "left" + ( left >= 0 ? "+" : "" ) + left + " " +
						"top" + ( top >= 0 ? "+" : "" ) + top,
					of: that.window
				};
				that._removeClass( $( this ), "ui-dialog-resizing" );
				that._unblockFrames();
				that._trigger( "resizeStop", event, filteredUi( ui ) );
			}
		} )
			.css( "position", position );
	},

	_trackFocus: function() {
		this._on( this.widget(), {
			focusin: function( event ) {
				this._makeFocusTarget();
				this._focusedElement = $( event.target );
			}
		} );
	},

	_makeFocusTarget: function() {
		this._untrackInstance();
		this._trackingInstances().unshift( this );
	},

	_untrackInstance: function() {
		var instances = this._trackingInstances(),
			exists = $.inArray( this, instances );
		if ( exists !== -1 ) {
			instances.splice( exists, 1 );
		}
	},

	_trackingInstances: function() {
		var instances = this.document.data( "ui-dialog-instances" );
		if ( !instances ) {
			instances = [];
			this.document.data( "ui-dialog-instances", instances );
		}
		return instances;
	},

	_minHeight: function() {
		var options = this.options;

		return options.height === "auto" ?
			options.minHeight :
			Math.min( options.minHeight, options.height );
	},

	_position: function() {

		// Need to show the dialog to get the actual offset in the position plugin
		var isVisible = this.uiDialog.is( ":visible" );
		if ( !isVisible ) {
			this.uiDialog.show();
		}
		this.uiDialog.position( this.options.position );
		if ( !isVisible ) {
			this.uiDialog.hide();
		}
	},

	_setOptions: function( options ) {
		var that = this,
			resize = false,
			resizableOptions = {};

		$.each( options, function( key, value ) {
			that._setOption( key, value );

			if ( key in that.sizeRelatedOptions ) {
				resize = true;
			}
			if ( key in that.resizableRelatedOptions ) {
				resizableOptions[ key ] = value;
			}
		} );

		if ( resize ) {
			this._size();
			this._position();
		}
		if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
			this.uiDialog.resizable( "option", resizableOptions );
		}
	},

	_setOption: function( key, value ) {
		var isDraggable, isResizable,
			uiDialog = this.uiDialog;

		if ( key === "disabled" ) {
			return;
		}

		this._super( key, value );

		if ( key === "appendTo" ) {
			this.uiDialog.appendTo( this._appendTo() );
		}

		if ( key === "buttons" ) {
			this._createButtons();
		}

		if ( key === "closeText" ) {
			this.uiDialogTitlebarClose.button( {

				// Ensure that we always pass a string
				label: $( "<a>" ).text( "" + this.options.closeText ).html()
			} );
		}

		if ( key === "draggable" ) {
			isDraggable = uiDialog.is( ":data(ui-draggable)" );
			if ( isDraggable && !value ) {
				uiDialog.draggable( "destroy" );
			}

			if ( !isDraggable && value ) {
				this._makeDraggable();
			}
		}

		if ( key === "position" ) {
			this._position();
		}

		if ( key === "resizable" ) {

			// currently resizable, becoming non-resizable
			isResizable = uiDialog.is( ":data(ui-resizable)" );
			if ( isResizable && !value ) {
				uiDialog.resizable( "destroy" );
			}

			// Currently resizable, changing handles
			if ( isResizable && typeof value === "string" ) {
				uiDialog.resizable( "option", "handles", value );
			}

			// Currently non-resizable, becoming resizable
			if ( !isResizable && value !== false ) {
				this._makeResizable();
			}
		}

		if ( key === "title" ) {
			this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
		}
	},

	_size: function() {

		// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
		// divs will both have width and height set, so we need to reset them
		var nonContentHeight, minContentHeight, maxContentHeight,
			options = this.options;

		// Reset content sizing
		this.element.show().css( {
			width: "auto",
			minHeight: 0,
			maxHeight: "none",
			height: 0
		} );

		if ( options.minWidth > options.width ) {
			options.width = options.minWidth;
		}

		// Reset wrapper sizing
		// determine the height of all the non-content elements
		nonContentHeight = this.uiDialog.css( {
			height: "auto",
			width: options.width
		} )
			.outerHeight();
		minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
		maxContentHeight = typeof options.maxHeight === "number" ?
			Math.max( 0, options.maxHeight - nonContentHeight ) :
			"none";

		if ( options.height === "auto" ) {
			this.element.css( {
				minHeight: minContentHeight,
				maxHeight: maxContentHeight,
				height: "auto"
			} );
		} else {
			this.element.height( Math.max( 0, options.height - nonContentHeight ) );
		}

		if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
			this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
		}
	},

	_blockFrames: function() {
		this.iframeBlocks = this.document.find( "iframe" ).map( function() {
			var iframe = $( this );

			return $( "<div>" )
				.css( {
					position: "absolute",
					width: iframe.outerWidth(),
					height: iframe.outerHeight()
				} )
				.appendTo( iframe.parent() )
				.offset( iframe.offset() )[ 0 ];
		} );
	},

	_unblockFrames: function() {
		if ( this.iframeBlocks ) {
			this.iframeBlocks.remove();
			delete this.iframeBlocks;
		}
	},

	_allowInteraction: function( event ) {
		if ( $( event.target ).closest( ".ui-dialog" ).length ) {
			return true;
		}

		// TODO: Remove hack when datepicker implements
		// the .ui-front logic (#8989)
		return !!$( event.target ).closest( ".ui-datepicker" ).length;
	},

	_createOverlay: function() {
		if ( !this.options.modal ) {
			return;
		}

		// We use a delay in case the overlay is created from an
		// event that we're going to be cancelling (#2804)
		var isOpening = true;
		this._delay( function() {
			isOpening = false;
		} );

		if ( !this.document.data( "ui-dialog-overlays" ) ) {

			// Prevent use of anchors and inputs
			// Using _on() for an event handler shared across many instances is
			// safe because the dialogs stack and must be closed in reverse order
			this._on( this.document, {
				focusin: function( event ) {
					if ( isOpening ) {
						return;
					}

					if ( !this._allowInteraction( event ) ) {
						event.preventDefault();
						this._trackingInstances()[ 0 ]._focusTabbable();
					}
				}
			} );
		}

		this.overlay = $( "<div>" )
			.appendTo( this._appendTo() );

		this._addClass( this.overlay, null, "ui-widget-overlay ui-front" );
		this._on( this.overlay, {
			mousedown: "_keepFocus"
		} );
		this.document.data( "ui-dialog-overlays",
			( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 );
	},

	_destroyOverlay: function() {
		if ( !this.options.modal ) {
			return;
		}

		if ( this.overlay ) {
			var overlays = this.document.data( "ui-dialog-overlays" ) - 1;

			if ( !overlays ) {
				this._off( this.document, "focusin" );
				this.document.removeData( "ui-dialog-overlays" );
			} else {
				this.document.data( "ui-dialog-overlays", overlays );
			}

			this.overlay.remove();
			this.overlay = null;
		}
	}
} );

// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {

	// Backcompat for dialogClass option
	$.widget( "ui.dialog", $.ui.dialog, {
		options: {
			dialogClass: ""
		},
		_createWrapper: function() {
			this._super();
			this.uiDialog.addClass( this.options.dialogClass );
		},
		_setOption: function( key, value ) {
			if ( key === "dialogClass" ) {
				this.uiDialog
					.removeClass( this.options.dialogClass )
					.addClass( value );
			}
			this._superApply( arguments );
		}
	} );
}

var widgetsDialog = $.ui.dialog;


/*!
 * jQuery UI Droppable 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Droppable
//>>group: Interactions
//>>description: Enables drop targets for draggable elements.
//>>docs: http://api.jqueryui.com/droppable/
//>>demos: http://jqueryui.com/droppable/



$.widget( "ui.droppable", {
	version: "1.12.1",
	widgetEventPrefix: "drop",
	options: {
		accept: "*",
		addClasses: true,
		greedy: false,
		scope: "default",
		tolerance: "intersect",

		// Callbacks
		activate: null,
		deactivate: null,
		drop: null,
		out: null,
		over: null
	},
	_create: function() {

		var proportions,
			o = this.options,
			accept = o.accept;

		this.isover = false;
		this.isout = true;

		this.accept = $.isFunction( accept ) ? accept : function( d ) {
			return d.is( accept );
		};

		this.proportions = function( /* valueToWrite */ ) {
			if ( arguments.length ) {

				// Store the droppable's proportions
				proportions = arguments[ 0 ];
			} else {

				// Retrieve or derive the droppable's proportions
				return proportions ?
					proportions :
					proportions = {
						width: this.element[ 0 ].offsetWidth,
						height: this.element[ 0 ].offsetHeight
					};
			}
		};

		this._addToManager( o.scope );

		o.addClasses && this._addClass( "ui-droppable" );

	},

	_addToManager: function( scope ) {

		// Add the reference and positions to the manager
		$.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
		$.ui.ddmanager.droppables[ scope ].push( this );
	},

	_splice: function( drop ) {
		var i = 0;
		for ( ; i < drop.length; i++ ) {
			if ( drop[ i ] === this ) {
				drop.splice( i, 1 );
			}
		}
	},

	_destroy: function() {
		var drop = $.ui.ddmanager.droppables[ this.options.scope ];

		this._splice( drop );
	},

	_setOption: function( key, value ) {

		if ( key === "accept" ) {
			this.accept = $.isFunction( value ) ? value : function( d ) {
				return d.is( value );
			};
		} else if ( key === "scope" ) {
			var drop = $.ui.ddmanager.droppables[ this.options.scope ];

			this._splice( drop );
			this._addToManager( value );
		}

		this._super( key, value );
	},

	_activate: function( event ) {
		var draggable = $.ui.ddmanager.current;

		this._addActiveClass();
		if ( draggable ) {
			this._trigger( "activate", event, this.ui( draggable ) );
		}
	},

	_deactivate: function( event ) {
		var draggable = $.ui.ddmanager.current;

		this._removeActiveClass();
		if ( draggable ) {
			this._trigger( "deactivate", event, this.ui( draggable ) );
		}
	},

	_over: function( event ) {

		var draggable = $.ui.ddmanager.current;

		// Bail if draggable and droppable are same element
		if ( !draggable || ( draggable.currentItem ||
				draggable.element )[ 0 ] === this.element[ 0 ] ) {
			return;
		}

		if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
				draggable.element ) ) ) {
			this._addHoverClass();
			this._trigger( "over", event, this.ui( draggable ) );
		}

	},

	_out: function( event ) {

		var draggable = $.ui.ddmanager.current;

		// Bail if draggable and droppable are same element
		if ( !draggable || ( draggable.currentItem ||
				draggable.element )[ 0 ] === this.element[ 0 ] ) {
			return;
		}

		if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
				draggable.element ) ) ) {
			this._removeHoverClass();
			this._trigger( "out", event, this.ui( draggable ) );
		}

	},

	_drop: function( event, custom ) {

		var draggable = custom || $.ui.ddmanager.current,
			childrenIntersection = false;

		// Bail if draggable and droppable are same element
		if ( !draggable || ( draggable.currentItem ||
				draggable.element )[ 0 ] === this.element[ 0 ] ) {
			return false;
		}

		this.element
			.find( ":data(ui-droppable)" )
			.not( ".ui-draggable-dragging" )
			.each( function() {
				var inst = $( this ).droppable( "instance" );
				if (
					inst.options.greedy &&
					!inst.options.disabled &&
					inst.options.scope === draggable.options.scope &&
					inst.accept.call(
						inst.element[ 0 ], ( draggable.currentItem || draggable.element )
					) &&
					intersect(
						draggable,
						$.extend( inst, { offset: inst.element.offset() } ),
						inst.options.tolerance, event
					)
				) {
					childrenIntersection = true;
					return false; }
			} );
		if ( childrenIntersection ) {
			return false;
		}

		if ( this.accept.call( this.element[ 0 ],
				( draggable.currentItem || draggable.element ) ) ) {
			this._removeActiveClass();
			this._removeHoverClass();

			this._trigger( "drop", event, this.ui( draggable ) );
			return this.element;
		}

		return false;

	},

	ui: function( c ) {
		return {
			draggable: ( c.currentItem || c.element ),
			helper: c.helper,
			position: c.position,
			offset: c.positionAbs
		};
	},

	// Extension points just to make backcompat sane and avoid duplicating logic
	// TODO: Remove in 1.13 along with call to it below
	_addHoverClass: function() {
		this._addClass( "ui-droppable-hover" );
	},

	_removeHoverClass: function() {
		this._removeClass( "ui-droppable-hover" );
	},

	_addActiveClass: function() {
		this._addClass( "ui-droppable-active" );
	},

	_removeActiveClass: function() {
		this._removeClass( "ui-droppable-active" );
	}
} );

var intersect = $.ui.intersect = ( function() {
	function isOverAxis( x, reference, size ) {
		return ( x >= reference ) && ( x < ( reference + size ) );
	}

	return function( draggable, droppable, toleranceMode, event ) {

		if ( !droppable.offset ) {
			return false;
		}

		var x1 = ( draggable.positionAbs ||
				draggable.position.absolute ).left + draggable.margins.left,
			y1 = ( draggable.positionAbs ||
				draggable.position.absolute ).top + draggable.margins.top,
			x2 = x1 + draggable.helperProportions.width,
			y2 = y1 + draggable.helperProportions.height,
			l = droppable.offset.left,
			t = droppable.offset.top,
			r = l + droppable.proportions().width,
			b = t + droppable.proportions().height;

		switch ( toleranceMode ) {
		case "fit":
			return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
		case "intersect":
			return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
				x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
				t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
				y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
		case "pointer":
			return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
				isOverAxis( event.pageX, l, droppable.proportions().width );
		case "touch":
			return (
				( y1 >= t && y1 <= b ) || // Top edge touching
				( y2 >= t && y2 <= b ) || // Bottom edge touching
				( y1 < t && y2 > b ) // Surrounded vertically
			) && (
				( x1 >= l && x1 <= r ) || // Left edge touching
				( x2 >= l && x2 <= r ) || // Right edge touching
				( x1 < l && x2 > r ) // Surrounded horizontally
			);
		default:
			return false;
		}
	};
} )();

/*
	This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager = {
	current: null,
	droppables: { "default": [] },
	prepareOffsets: function( t, event ) {

		var i, j,
			m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
			type = event ? event.type : null, // workaround for #2317
			list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();

		droppablesLoop: for ( i = 0; i < m.length; i++ ) {

			// No disabled and non-accepted
			if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
					( t.currentItem || t.element ) ) ) ) {
				continue;
			}

			// Filter out elements in the current dragged item
			for ( j = 0; j < list.length; j++ ) {
				if ( list[ j ] === m[ i ].element[ 0 ] ) {
					m[ i ].proportions().height = 0;
					continue droppablesLoop;
				}
			}

			m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
			if ( !m[ i ].visible ) {
				continue;
			}

			// Activate the droppable if used directly from draggables
			if ( type === "mousedown" ) {
				m[ i ]._activate.call( m[ i ], event );
			}

			m[ i ].offset = m[ i ].element.offset();
			m[ i ].proportions( {
				width: m[ i ].element[ 0 ].offsetWidth,
				height: m[ i ].element[ 0 ].offsetHeight
			} );

		}

	},
	drop: function( draggable, event ) {

		var dropped = false;

		// Create a copy of the droppables in case the list changes during the drop (#9116)
		$.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {

			if ( !this.options ) {
				return;
			}
			if ( !this.options.disabled && this.visible &&
					intersect( draggable, this, this.options.tolerance, event ) ) {
				dropped = this._drop.call( this, event ) || dropped;
			}

			if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
					( draggable.currentItem || draggable.element ) ) ) {
				this.isout = true;
				this.isover = false;
				this._deactivate.call( this, event );
			}

		} );
		return dropped;

	},
	dragStart: function( draggable, event ) {

		// Listen for scrolling so that if the dragging causes scrolling the position of the
		// droppables can be recalculated (see #5003)
		draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
			if ( !draggable.options.refreshPositions ) {
				$.ui.ddmanager.prepareOffsets( draggable, event );
			}
		} );
	},
	drag: function( draggable, event ) {

		// If you have a highly dynamic page, you might try this option. It renders positions
		// every time you move the mouse.
		if ( draggable.options.refreshPositions ) {
			$.ui.ddmanager.prepareOffsets( draggable, event );
		}

		// Run through all droppables and check their positions based on specific tolerance options
		$.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {

			if ( this.options.disabled || this.greedyChild || !this.visible ) {
				return;
			}

			var parentInstance, scope, parent,
				intersects = intersect( draggable, this, this.options.tolerance, event ),
				c = !intersects && this.isover ?
					"isout" :
					( intersects && !this.isover ? "isover" : null );
			if ( !c ) {
				return;
			}

			if ( this.options.greedy ) {

				// find droppable parents with same scope
				scope = this.options.scope;
				parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
					return $( this ).droppable( "instance" ).options.scope === scope;
				} );

				if ( parent.length ) {
					parentInstance = $( parent[ 0 ] ).droppable( "instance" );
					parentInstance.greedyChild = ( c === "isover" );
				}
			}

			// We just moved into a greedy child
			if ( parentInstance && c === "isover" ) {
				parentInstance.isover = false;
				parentInstance.isout = true;
				parentInstance._out.call( parentInstance, event );
			}

			this[ c ] = true;
			this[ c === "isout" ? "isover" : "isout" ] = false;
			this[ c === "isover" ? "_over" : "_out" ].call( this, event );

			// We just moved out of a greedy child
			if ( parentInstance && c === "isout" ) {
				parentInstance.isout = false;
				parentInstance.isover = true;
				parentInstance._over.call( parentInstance, event );
			}
		} );

	},
	dragStop: function( draggable, event ) {
		draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );

		// Call prepareOffsets one final time since IE does not fire return scroll events when
		// overflow was caused by drag (see #5003)
		if ( !draggable.options.refreshPositions ) {
			$.ui.ddmanager.prepareOffsets( draggable, event );
		}
	}
};

// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {

	// Backcompat for activeClass and hoverClass options
	$.widget( "ui.droppable", $.ui.droppable, {
		options: {
			hoverClass: false,
			activeClass: false
		},
		_addActiveClass: function() {
			this._super();
			if ( this.options.activeClass ) {
				this.element.addClass( this.options.activeClass );
			}
		},
		_removeActiveClass: function() {
			this._super();
			if ( this.options.activeClass ) {
				this.element.removeClass( this.options.activeClass );
			}
		},
		_addHoverClass: function() {
			this._super();
			if ( this.options.hoverClass ) {
				this.element.addClass( this.options.hoverClass );
			}
		},
		_removeHoverClass: function() {
			this._super();
			if ( this.options.hoverClass ) {
				this.element.removeClass( this.options.hoverClass );
			}
		}
	} );
}

var widgetsDroppable = $.ui.droppable;


/*!
 * jQuery UI Progressbar 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Progressbar
//>>group: Widgets
// jscs:disable maximumLineLength
//>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
// jscs:enable maximumLineLength
//>>docs: http://api.jqueryui.com/progressbar/
//>>demos: http://jqueryui.com/progressbar/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/progressbar.css
//>>css.theme: ../../themes/base/theme.css



var widgetsProgressbar = $.widget( "ui.progressbar", {
	version: "1.12.1",
	options: {
		classes: {
			"ui-progressbar": "ui-corner-all",
			"ui-progressbar-value": "ui-corner-left",
			"ui-progressbar-complete": "ui-corner-right"
		},
		max: 100,
		value: 0,

		change: null,
		complete: null
	},

	min: 0,

	_create: function() {

		// Constrain initial value
		this.oldValue = this.options.value = this._constrainedValue();

		this.element.attr( {

			// Only set static values; aria-valuenow and aria-valuemax are
			// set inside _refreshValue()
			role: "progressbar",
			"aria-valuemin": this.min
		} );
		this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );

		this.valueDiv = $( "<div>" ).appendTo( this.element );
		this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
		this._refreshValue();
	},

	_destroy: function() {
		this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );

		this.valueDiv.remove();
	},

	value: function( newValue ) {
		if ( newValue === undefined ) {
			return this.options.value;
		}

		this.options.value = this._constrainedValue( newValue );
		this._refreshValue();
	},

	_constrainedValue: function( newValue ) {
		if ( newValue === undefined ) {
			newValue = this.options.value;
		}

		this.indeterminate = newValue === false;

		// Sanitize value
		if ( typeof newValue !== "number" ) {
			newValue = 0;
		}

		return this.indeterminate ? false :
			Math.min( this.options.max, Math.max( this.min, newValue ) );
	},

	_setOptions: function( options ) {

		// Ensure "value" option is set after other values (like max)
		var value = options.value;
		delete options.value;

		this._super( options );

		this.options.value = this._constrainedValue( value );
		this._refreshValue();
	},

	_setOption: function( key, value ) {
		if ( key === "max" ) {

			// Don't allow a max less than min
			value = Math.max( this.min, value );
		}
		this._super( key, value );
	},

	_setOptionDisabled: function( value ) {
		this._super( value );

		this.element.attr( "aria-disabled", value );
		this._toggleClass( null, "ui-state-disabled", !!value );
	},

	_percentage: function() {
		return this.indeterminate ?
			100 :
			100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
	},

	_refreshValue: function() {
		var value = this.options.value,
			percentage = this._percentage();

		this.valueDiv
			.toggle( this.indeterminate || value > this.min )
			.width( percentage.toFixed( 0 ) + "%" );

		this
			._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
				value === this.options.max )
			._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );

		if ( this.indeterminate ) {
			this.element.removeAttr( "aria-valuenow" );
			if ( !this.overlayDiv ) {
				this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
				this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
			}
		} else {
			this.element.attr( {
				"aria-valuemax": this.options.max,
				"aria-valuenow": value
			} );
			if ( this.overlayDiv ) {
				this.overlayDiv.remove();
				this.overlayDiv = null;
			}
		}

		if ( this.oldValue !== value ) {
			this.oldValue = value;
			this._trigger( "change" );
		}
		if ( value === this.options.max ) {
			this._trigger( "complete" );
		}
	}
} );


/*!
 * jQuery UI Selectable 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Selectable
//>>group: Interactions
//>>description: Allows groups of elements to be selected with the mouse.
//>>docs: http://api.jqueryui.com/selectable/
//>>demos: http://jqueryui.com/selectable/
//>>css.structure: ../../themes/base/selectable.css



var widgetsSelectable = $.widget( "ui.selectable", $.ui.mouse, {
	version: "1.12.1",
	options: {
		appendTo: "body",
		autoRefresh: true,
		distance: 0,
		filter: "*",
		tolerance: "touch",

		// Callbacks
		selected: null,
		selecting: null,
		start: null,
		stop: null,
		unselected: null,
		unselecting: null
	},
	_create: function() {
		var that = this;

		this._addClass( "ui-selectable" );

		this.dragged = false;

		// Cache selectee children based on filter
		this.refresh = function() {
			that.elementPos = $( that.element[ 0 ] ).offset();
			that.selectees = $( that.options.filter, that.element[ 0 ] );
			that._addClass( that.selectees, "ui-selectee" );
			that.selectees.each( function() {
				var $this = $( this ),
					selecteeOffset = $this.offset(),
					pos = {
						left: selecteeOffset.left - that.elementPos.left,
						top: selecteeOffset.top - that.elementPos.top
					};
				$.data( this, "selectable-item", {
					element: this,
					$element: $this,
					left: pos.left,
					top: pos.top,
					right: pos.left + $this.outerWidth(),
					bottom: pos.top + $this.outerHeight(),
					startselected: false,
					selected: $this.hasClass( "ui-selected" ),
					selecting: $this.hasClass( "ui-selecting" ),
					unselecting: $this.hasClass( "ui-unselecting" )
				} );
			} );
		};
		this.refresh();

		this._mouseInit();

		this.helper = $( "<div>" );
		this._addClass( this.helper, "ui-selectable-helper" );
	},

	_destroy: function() {
		this.selectees.removeData( "selectable-item" );
		this._mouseDestroy();
	},

	_mouseStart: function( event ) {
		var that = this,
			options = this.options;

		this.opos = [ event.pageX, event.pageY ];
		this.elementPos = $( this.element[ 0 ] ).offset();

		if ( this.options.disabled ) {
			return;
		}

		this.selectees = $( options.filter, this.element[ 0 ] );

		this._trigger( "start", event );

		$( options.appendTo ).append( this.helper );

		// position helper (lasso)
		this.helper.css( {
			"left": event.pageX,
			"top": event.pageY,
			"width": 0,
			"height": 0
		} );

		if ( options.autoRefresh ) {
			this.refresh();
		}

		this.selectees.filter( ".ui-selected" ).each( function() {
			var selectee = $.data( this, "selectable-item" );
			selectee.startselected = true;
			if ( !event.metaKey && !event.ctrlKey ) {
				that._removeClass( selectee.$element, "ui-selected" );
				selectee.selected = false;
				that._addClass( selectee.$element, "ui-unselecting" );
				selectee.unselecting = true;

				// selectable UNSELECTING callback
				that._trigger( "unselecting", event, {
					unselecting: selectee.element
				} );
			}
		} );

		$( event.target ).parents().addBack().each( function() {
			var doSelect,
				selectee = $.data( this, "selectable-item" );
			if ( selectee ) {
				doSelect = ( !event.metaKey && !event.ctrlKey ) ||
					!selectee.$element.hasClass( "ui-selected" );
				that._removeClass( selectee.$element, doSelect ? "ui-unselecting" : "ui-selected" )
					._addClass( selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting" );
				selectee.unselecting = !doSelect;
				selectee.selecting = doSelect;
				selectee.selected = doSelect;

				// selectable (UN)SELECTING callback
				if ( doSelect ) {
					that._trigger( "selecting", event, {
						selecting: selectee.element
					} );
				} else {
					that._trigger( "unselecting", event, {
						unselecting: selectee.element
					} );
				}
				return false;
			}
		} );

	},

	_mouseDrag: function( event ) {

		this.dragged = true;

		if ( this.options.disabled ) {
			return;
		}

		var tmp,
			that = this,
			options = this.options,
			x1 = this.opos[ 0 ],
			y1 = this.opos[ 1 ],
			x2 = event.pageX,
			y2 = event.pageY;

		if ( x1 > x2 ) { tmp = x2; x2 = x1; x1 = tmp; }
		if ( y1 > y2 ) { tmp = y2; y2 = y1; y1 = tmp; }
		this.helper.css( { left: x1, top: y1, width: x2 - x1, height: y2 - y1 } );

		this.selectees.each( function() {
			var selectee = $.data( this, "selectable-item" ),
				hit = false,
				offset = {};

			//prevent helper from being selected if appendTo: selectable
			if ( !selectee || selectee.element === that.element[ 0 ] ) {
				return;
			}

			offset.left   = selectee.left   + that.elementPos.left;
			offset.right  = selectee.right  + that.elementPos.left;
			offset.top    = selectee.top    + that.elementPos.top;
			offset.bottom = selectee.bottom + that.elementPos.top;

			if ( options.tolerance === "touch" ) {
				hit = ( !( offset.left > x2 || offset.right < x1 || offset.top > y2 ||
                    offset.bottom < y1 ) );
			} else if ( options.tolerance === "fit" ) {
				hit = ( offset.left > x1 && offset.right < x2 && offset.top > y1 &&
                    offset.bottom < y2 );
			}

			if ( hit ) {

				// SELECT
				if ( selectee.selected ) {
					that._removeClass( selectee.$element, "ui-selected" );
					selectee.selected = false;
				}
				if ( selectee.unselecting ) {
					that._removeClass( selectee.$element, "ui-unselecting" );
					selectee.unselecting = false;
				}
				if ( !selectee.selecting ) {
					that._addClass( selectee.$element, "ui-selecting" );
					selectee.selecting = true;

					// selectable SELECTING callback
					that._trigger( "selecting", event, {
						selecting: selectee.element
					} );
				}
			} else {

				// UNSELECT
				if ( selectee.selecting ) {
					if ( ( event.metaKey || event.ctrlKey ) && selectee.startselected ) {
						that._removeClass( selectee.$element, "ui-selecting" );
						selectee.selecting = false;
						that._addClass( selectee.$element, "ui-selected" );
						selectee.selected = true;
					} else {
						that._removeClass( selectee.$element, "ui-selecting" );
						selectee.selecting = false;
						if ( selectee.startselected ) {
							that._addClass( selectee.$element, "ui-unselecting" );
							selectee.unselecting = true;
						}

						// selectable UNSELECTING callback
						that._trigger( "unselecting", event, {
							unselecting: selectee.element
						} );
					}
				}
				if ( selectee.selected ) {
					if ( !event.metaKey && !event.ctrlKey && !selectee.startselected ) {
						that._removeClass( selectee.$element, "ui-selected" );
						selectee.selected = false;

						that._addClass( selectee.$element, "ui-unselecting" );
						selectee.unselecting = true;

						// selectable UNSELECTING callback
						that._trigger( "unselecting", event, {
							unselecting: selectee.element
						} );
					}
				}
			}
		} );

		return false;
	},

	_mouseStop: function( event ) {
		var that = this;

		this.dragged = false;

		$( ".ui-unselecting", this.element[ 0 ] ).each( function() {
			var selectee = $.data( this, "selectable-item" );
			that._removeClass( selectee.$element, "ui-unselecting" );
			selectee.unselecting = false;
			selectee.startselected = false;
			that._trigger( "unselected", event, {
				unselected: selectee.element
			} );
		} );
		$( ".ui-selecting", this.element[ 0 ] ).each( function() {
			var selectee = $.data( this, "selectable-item" );
			that._removeClass( selectee.$element, "ui-selecting" )
				._addClass( selectee.$element, "ui-selected" );
			selectee.selecting = false;
			selectee.selected = true;
			selectee.startselected = true;
			that._trigger( "selected", event, {
				selected: selectee.element
			} );
		} );
		this._trigger( "stop", event );

		this.helper.remove();

		return false;
	}

} );


/*!
 * jQuery UI Selectmenu 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Selectmenu
//>>group: Widgets
// jscs:disable maximumLineLength
//>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select.
// jscs:enable maximumLineLength
//>>docs: http://api.jqueryui.com/selectmenu/
//>>demos: http://jqueryui.com/selectmenu/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
//>>css.theme: ../../themes/base/theme.css



var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
	version: "1.12.1",
	defaultElement: "<select>",
	options: {
		appendTo: null,
		classes: {
			"ui-selectmenu-button-open": "ui-corner-top",
			"ui-selectmenu-button-closed": "ui-corner-all"
		},
		disabled: null,
		icons: {
			button: "ui-icon-triangle-1-s"
		},
		position: {
			my: "left top",
			at: "left bottom",
			collision: "none"
		},
		width: false,

		// Callbacks
		change: null,
		close: null,
		focus: null,
		open: null,
		select: null
	},

	_create: function() {
		var selectmenuId = this.element.uniqueId().attr( "id" );
		this.ids = {
			element: selectmenuId,
			button: selectmenuId + "-button",
			menu: selectmenuId + "-menu"
		};

		this._drawButton();
		this._drawMenu();
		this._bindFormResetHandler();

		this._rendered = false;
		this.menuItems = $();
	},

	_drawButton: function() {
		var icon,
			that = this,
			item = this._parseOption(
				this.element.find( "option:selected" ),
				this.element[ 0 ].selectedIndex
			);

		// Associate existing label with the new button
		this.labels = this.element.labels().attr( "for", this.ids.button );
		this._on( this.labels, {
			click: function( event ) {
				this.button.focus();
				event.preventDefault();
			}
		} );

		// Hide original select element
		this.element.hide();

		// Create button
		this.button = $( "<span>", {
			tabindex: this.options.disabled ? -1 : 0,
			id: this.ids.button,
			role: "combobox",
			"aria-expanded": "false",
			"aria-autocomplete": "list",
			"aria-owns": this.ids.menu,
			"aria-haspopup": "true",
			title: this.element.attr( "title" )
		} )
			.insertAfter( this.element );

		this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
			"ui-button ui-widget" );

		icon = $( "<span>" ).appendTo( this.button );
		this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
		this.buttonItem = this._renderButtonItem( item )
			.appendTo( this.button );

		if ( this.options.width !== false ) {
			this._resizeButton();
		}

		this._on( this.button, this._buttonEvents );
		this.button.one( "focusin", function() {

			// Delay rendering the menu items until the button receives focus.
			// The menu may have already been rendered via a programmatic open.
			if ( !that._rendered ) {
				that._refreshMenu();
			}
		} );
	},

	_drawMenu: function() {
		var that = this;

		// Create menu
		this.menu = $( "<ul>", {
			"aria-hidden": "true",
			"aria-labelledby": this.ids.button,
			id: this.ids.menu
		} );

		// Wrap menu
		this.menuWrap = $( "<div>" ).append( this.menu );
		this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );
		this.menuWrap.appendTo( this._appendTo() );

		// Initialize menu widget
		this.menuInstance = this.menu
			.menu( {
				classes: {
					"ui-menu": "ui-corner-bottom"
				},
				role: "listbox",
				select: function( event, ui ) {
					event.preventDefault();

					// Support: IE8
					// If the item was selected via a click, the text selection
					// will be destroyed in IE
					that._setSelection();

					that._select( ui.item.data( "ui-selectmenu-item" ), event );
				},
				focus: function( event, ui ) {
					var item = ui.item.data( "ui-selectmenu-item" );

					// Prevent inital focus from firing and check if its a newly focused item
					if ( that.focusIndex != null && item.index !== that.focusIndex ) {
						that._trigger( "focus", event, { item: item } );
						if ( !that.isOpen ) {
							that._select( item, event );
						}
					}
					that.focusIndex = item.index;

					that.button.attr( "aria-activedescendant",
						that.menuItems.eq( item.index ).attr( "id" ) );
				}
			} )
			.menu( "instance" );

		// Don't close the menu on mouseleave
		this.menuInstance._off( this.menu, "mouseleave" );

		// Cancel the menu's collapseAll on document click
		this.menuInstance._closeOnDocumentClick = function() {
			return false;
		};

		// Selects often contain empty items, but never contain dividers
		this.menuInstance._isDivider = function() {
			return false;
		};
	},

	refresh: function() {
		this._refreshMenu();
		this.buttonItem.replaceWith(
			this.buttonItem = this._renderButtonItem(

				// Fall back to an empty object in case there are no options
				this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
			)
		);
		if ( this.options.width === null ) {
			this._resizeButton();
		}
	},

	_refreshMenu: function() {
		var item,
			options = this.element.find( "option" );

		this.menu.empty();

		this._parseOptions( options );
		this._renderMenu( this.menu, this.items );

		this.menuInstance.refresh();
		this.menuItems = this.menu.find( "li" )
			.not( ".ui-selectmenu-optgroup" )
				.find( ".ui-menu-item-wrapper" );

		this._rendered = true;

		if ( !options.length ) {
			return;
		}

		item = this._getSelectedItem();

		// Update the menu to have the correct item focused
		this.menuInstance.focus( null, item );
		this._setAria( item.data( "ui-selectmenu-item" ) );

		// Set disabled state
		this._setOption( "disabled", this.element.prop( "disabled" ) );
	},

	open: function( event ) {
		if ( this.options.disabled ) {
			return;
		}

		// If this is the first time the menu is being opened, render the items
		if ( !this._rendered ) {
			this._refreshMenu();
		} else {

			// Menu clears focus on close, reset focus to selected item
			this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );
			this.menuInstance.focus( null, this._getSelectedItem() );
		}

		// If there are no options, don't open the menu
		if ( !this.menuItems.length ) {
			return;
		}

		this.isOpen = true;
		this._toggleAttr();
		this._resizeMenu();
		this._position();

		this._on( this.document, this._documentClick );

		this._trigger( "open", event );
	},

	_position: function() {
		this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
	},

	close: function( event ) {
		if ( !this.isOpen ) {
			return;
		}

		this.isOpen = false;
		this._toggleAttr();

		this.range = null;
		this._off( this.document );

		this._trigger( "close", event );
	},

	widget: function() {
		return this.button;
	},

	menuWidget: function() {
		return this.menu;
	},

	_renderButtonItem: function( item ) {
		var buttonItem = $( "<span>" );

		this._setText( buttonItem, item.label );
		this._addClass( buttonItem, "ui-selectmenu-text" );

		return buttonItem;
	},

	_renderMenu: function( ul, items ) {
		var that = this,
			currentOptgroup = "";

		$.each( items, function( index, item ) {
			var li;

			if ( item.optgroup !== currentOptgroup ) {
				li = $( "<li>", {
					text: item.optgroup
				} );
				that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +
					( item.element.parent( "optgroup" ).prop( "disabled" ) ?
						" ui-state-disabled" :
						"" ) );

				li.appendTo( ul );

				currentOptgroup = item.optgroup;
			}

			that._renderItemData( ul, item );
		} );
	},

	_renderItemData: function( ul, item ) {
		return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
	},

	_renderItem: function( ul, item ) {
		var li = $( "<li>" ),
			wrapper = $( "<div>", {
				title: item.element.attr( "title" )
			} );

		if ( item.disabled ) {
			this._addClass( li, null, "ui-state-disabled" );
		}
		this._setText( wrapper, item.label );

		return li.append( wrapper ).appendTo( ul );
	},

	_setText: function( element, value ) {
		if ( value ) {
			element.text( value );
		} else {
			element.html( "&#160;" );
		}
	},

	_move: function( direction, event ) {
		var item, next,
			filter = ".ui-menu-item";

		if ( this.isOpen ) {
			item = this.menuItems.eq( this.focusIndex ).parent( "li" );
		} else {
			item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
			filter += ":not(.ui-state-disabled)";
		}

		if ( direction === "first" || direction === "last" ) {
			next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
		} else {
			next = item[ direction + "All" ]( filter ).eq( 0 );
		}

		if ( next.length ) {
			this.menuInstance.focus( event, next );
		}
	},

	_getSelectedItem: function() {
		return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
	},

	_toggle: function( event ) {
		this[ this.isOpen ? "close" : "open" ]( event );
	},

	_setSelection: function() {
		var selection;

		if ( !this.range ) {
			return;
		}

		if ( window.getSelection ) {
			selection = window.getSelection();
			selection.removeAllRanges();
			selection.addRange( this.range );

		// Support: IE8
		} else {
			this.range.select();
		}

		// Support: IE
		// Setting the text selection kills the button focus in IE, but
		// restoring the focus doesn't kill the selection.
		this.button.focus();
	},

	_documentClick: {
		mousedown: function( event ) {
			if ( !this.isOpen ) {
				return;
			}

			if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
					$.ui.escapeSelector( this.ids.button ) ).length ) {
				this.close( event );
			}
		}
	},

	_buttonEvents: {

		// Prevent text selection from being reset when interacting with the selectmenu (#10144)
		mousedown: function() {
			var selection;

			if ( window.getSelection ) {
				selection = window.getSelection();
				if ( selection.rangeCount ) {
					this.range = selection.getRangeAt( 0 );
				}

			// Support: IE8
			} else {
				this.range = document.selection.createRange();
			}
		},

		click: function( event ) {
			this._setSelection();
			this._toggle( event );
		},

		keydown: function( event ) {
			var preventDefault = true;
			switch ( event.keyCode ) {
			case $.ui.keyCode.TAB:
			case $.ui.keyCode.ESCAPE:
				this.close( event );
				preventDefault = false;
				break;
			case $.ui.keyCode.ENTER:
				if ( this.isOpen ) {
					this._selectFocusedItem( event );
				}
				break;
			case $.ui.keyCode.UP:
				if ( event.altKey ) {
					this._toggle( event );
				} else {
					this._move( "prev", event );
				}
				break;
			case $.ui.keyCode.DOWN:
				if ( event.altKey ) {
					this._toggle( event );
				} else {
					this._move( "next", event );
				}
				break;
			case $.ui.keyCode.SPACE:
				if ( this.isOpen ) {
					this._selectFocusedItem( event );
				} else {
					this._toggle( event );
				}
				break;
			case $.ui.keyCode.LEFT:
				this._move( "prev", event );
				break;
			case $.ui.keyCode.RIGHT:
				this._move( "next", event );
				break;
			case $.ui.keyCode.HOME:
			case $.ui.keyCode.PAGE_UP:
				this._move( "first", event );
				break;
			case $.ui.keyCode.END:
			case $.ui.keyCode.PAGE_DOWN:
				this._move( "last", event );
				break;
			default:
				this.menu.trigger( event );
				preventDefault = false;
			}

			if ( preventDefault ) {
				event.preventDefault();
			}
		}
	},

	_selectFocusedItem: function( event ) {
		var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
		if ( !item.hasClass( "ui-state-disabled" ) ) {
			this._select( item.data( "ui-selectmenu-item" ), event );
		}
	},

	_select: function( item, event ) {
		var oldIndex = this.element[ 0 ].selectedIndex;

		// Change native select element
		this.element[ 0 ].selectedIndex = item.index;
		this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
		this._setAria( item );
		this._trigger( "select", event, { item: item } );

		if ( item.index !== oldIndex ) {
			this._trigger( "change", event, { item: item } );
		}

		this.close( event );
	},

	_setAria: function( item ) {
		var id = this.menuItems.eq( item.index ).attr( "id" );

		this.button.attr( {
			"aria-labelledby": id,
			"aria-activedescendant": id
		} );
		this.menu.attr( "aria-activedescendant", id );
	},

	_setOption: function( key, value ) {
		if ( key === "icons" ) {
			var icon = this.button.find( "span.ui-icon" );
			this._removeClass( icon, null, this.options.icons.button )
				._addClass( icon, null, value.button );
		}

		this._super( key, value );

		if ( key === "appendTo" ) {
			this.menuWrap.appendTo( this._appendTo() );
		}

		if ( key === "width" ) {
			this._resizeButton();
		}
	},

	_setOptionDisabled: function( value ) {
		this._super( value );

		this.menuInstance.option( "disabled", value );
		this.button.attr( "aria-disabled", value );
		this._toggleClass( this.button, null, "ui-state-disabled", value );

		this.element.prop( "disabled", value );
		if ( value ) {
			this.button.attr( "tabindex", -1 );
			this.close();
		} else {
			this.button.attr( "tabindex", 0 );
		}
	},

	_appendTo: function() {
		var element = this.options.appendTo;

		if ( element ) {
			element = element.jquery || element.nodeType ?
				$( element ) :
				this.document.find( element ).eq( 0 );
		}

		if ( !element || !element[ 0 ] ) {
			element = this.element.closest( ".ui-front, dialog" );
		}

		if ( !element.length ) {
			element = this.document[ 0 ].body;
		}

		return element;
	},

	_toggleAttr: function() {
		this.button.attr( "aria-expanded", this.isOpen );

		// We can't use two _toggleClass() calls here, because we need to make sure
		// we always remove classes first and add them second, otherwise if both classes have the
		// same theme class, it will be removed after we add it.
		this._removeClass( this.button, "ui-selectmenu-button-" +
			( this.isOpen ? "closed" : "open" ) )
			._addClass( this.button, "ui-selectmenu-button-" +
				( this.isOpen ? "open" : "closed" ) )
			._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );

		this.menu.attr( "aria-hidden", !this.isOpen );
	},

	_resizeButton: function() {
		var width = this.options.width;

		// For `width: false`, just remove inline style and stop
		if ( width === false ) {
			this.button.css( "width", "" );
			return;
		}

		// For `width: null`, match the width of the original element
		if ( width === null ) {
			width = this.element.show().outerWidth();
			this.element.hide();
		}

		this.button.outerWidth( width );
	},

	_resizeMenu: function() {
		this.menu.outerWidth( Math.max(
			this.button.outerWidth(),

			// Support: IE10
			// IE10 wraps long text (possibly a rounding bug)
			// so we add 1px to avoid the wrapping
			this.menu.width( "" ).outerWidth() + 1
		) );
	},

	_getCreateOptions: function() {
		var options = this._super();

		options.disabled = this.element.prop( "disabled" );

		return options;
	},

	_parseOptions: function( options ) {
		var that = this,
			data = [];
		options.each( function( index, item ) {
			data.push( that._parseOption( $( item ), index ) );
		} );
		this.items = data;
	},

	_parseOption: function( option, index ) {
		var optgroup = option.parent( "optgroup" );

		return {
			element: option,
			index: index,
			value: option.val(),
			label: option.text(),
			optgroup: optgroup.attr( "label" ) || "",
			disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
		};
	},

	_destroy: function() {
		this._unbindFormResetHandler();
		this.menuWrap.remove();
		this.button.remove();
		this.element.show();
		this.element.removeUniqueId();
		this.labels.attr( "for", this.ids.element );
	}
} ] );


/*!
 * jQuery UI Slider 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Slider
//>>group: Widgets
//>>description: Displays a flexible slider with ranges and accessibility via keyboard.
//>>docs: http://api.jqueryui.com/slider/
//>>demos: http://jqueryui.com/slider/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/slider.css
//>>css.theme: ../../themes/base/theme.css



var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, {
	version: "1.12.1",
	widgetEventPrefix: "slide",

	options: {
		animate: false,
		classes: {
			"ui-slider": "ui-corner-all",
			"ui-slider-handle": "ui-corner-all",

			// Note: ui-widget-header isn't the most fittingly semantic framework class for this
			// element, but worked best visually with a variety of themes
			"ui-slider-range": "ui-corner-all ui-widget-header"
		},
		distance: 0,
		max: 100,
		min: 0,
		orientation: "horizontal",
		range: false,
		step: 1,
		value: 0,
		values: null,

		// Callbacks
		change: null,
		slide: null,
		start: null,
		stop: null
	},

	// Number of pages in a slider
	// (how many times can you page up/down to go through the whole range)
	numPages: 5,

	_create: function() {
		this._keySliding = false;
		this._mouseSliding = false;
		this._animateOff = true;
		this._handleIndex = null;
		this._detectOrientation();
		this._mouseInit();
		this._calculateNewMax();

		this._addClass( "ui-slider ui-slider-" + this.orientation,
			"ui-widget ui-widget-content" );

		this._refresh();

		this._animateOff = false;
	},

	_refresh: function() {
		this._createRange();
		this._createHandles();
		this._setupEvents();
		this._refreshValue();
	},

	_createHandles: function() {
		var i, handleCount,
			options = this.options,
			existingHandles = this.element.find( ".ui-slider-handle" ),
			handle = "<span tabindex='0'></span>",
			handles = [];

		handleCount = ( options.values && options.values.length ) || 1;

		if ( existingHandles.length > handleCount ) {
			existingHandles.slice( handleCount ).remove();
			existingHandles = existingHandles.slice( 0, handleCount );
		}

		for ( i = existingHandles.length; i < handleCount; i++ ) {
			handles.push( handle );
		}

		this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );

		this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );

		this.handle = this.handles.eq( 0 );

		this.handles.each( function( i ) {
			$( this )
				.data( "ui-slider-handle-index", i )
				.attr( "tabIndex", 0 );
		} );
	},

	_createRange: function() {
		var options = this.options;

		if ( options.range ) {
			if ( options.range === true ) {
				if ( !options.values ) {
					options.values = [ this._valueMin(), this._valueMin() ];
				} else if ( options.values.length && options.values.length !== 2 ) {
					options.values = [ options.values[ 0 ], options.values[ 0 ] ];
				} else if ( $.isArray( options.values ) ) {
					options.values = options.values.slice( 0 );
				}
			}

			if ( !this.range || !this.range.length ) {
				this.range = $( "<div>" )
					.appendTo( this.element );

				this._addClass( this.range, "ui-slider-range" );
			} else {
				this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );

				// Handle range switching from true to min/max
				this.range.css( {
					"left": "",
					"bottom": ""
				} );
			}
			if ( options.range === "min" || options.range === "max" ) {
				this._addClass( this.range, "ui-slider-range-" + options.range );
			}
		} else {
			if ( this.range ) {
				this.range.remove();
			}
			this.range = null;
		}
	},

	_setupEvents: function() {
		this._off( this.handles );
		this._on( this.handles, this._handleEvents );
		this._hoverable( this.handles );
		this._focusable( this.handles );
	},

	_destroy: function() {
		this.handles.remove();
		if ( this.range ) {
			this.range.remove();
		}

		this._mouseDestroy();
	},

	_mouseCapture: function( event ) {
		var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
			that = this,
			o = this.options;

		if ( o.disabled ) {
			return false;
		}

		this.elementSize = {
			width: this.element.outerWidth(),
			height: this.element.outerHeight()
		};
		this.elementOffset = this.element.offset();

		position = { x: event.pageX, y: event.pageY };
		normValue = this._normValueFromMouse( position );
		distance = this._valueMax() - this._valueMin() + 1;
		this.handles.each( function( i ) {
			var thisDistance = Math.abs( normValue - that.values( i ) );
			if ( ( distance > thisDistance ) ||
				( distance === thisDistance &&
					( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
				distance = thisDistance;
				closestHandle = $( this );
				index = i;
			}
		} );

		allowed = this._start( event, index );
		if ( allowed === false ) {
			return false;
		}
		this._mouseSliding = true;

		this._handleIndex = index;

		this._addClass( closestHandle, null, "ui-state-active" );
		closestHandle.trigger( "focus" );

		offset = closestHandle.offset();
		mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
		this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
			left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
			top: event.pageY - offset.top -
				( closestHandle.height() / 2 ) -
				( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
				( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
				( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
		};

		if ( !this.handles.hasClass( "ui-state-hover" ) ) {
			this._slide( event, index, normValue );
		}
		this._animateOff = true;
		return true;
	},

	_mouseStart: function() {
		return true;
	},

	_mouseDrag: function( event ) {
		var position = { x: event.pageX, y: event.pageY },
			normValue = this._normValueFromMouse( position );

		this._slide( event, this._handleIndex, normValue );

		return false;
	},

	_mouseStop: function( event ) {
		this._removeClass( this.handles, null, "ui-state-active" );
		this._mouseSliding = false;

		this._stop( event, this._handleIndex );
		this._change( event, this._handleIndex );

		this._handleIndex = null;
		this._clickOffset = null;
		this._animateOff = false;

		return false;
	},

	_detectOrientation: function() {
		this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
	},

	_normValueFromMouse: function( position ) {
		var pixelTotal,
			pixelMouse,
			percentMouse,
			valueTotal,
			valueMouse;

		if ( this.orientation === "horizontal" ) {
			pixelTotal = this.elementSize.width;
			pixelMouse = position.x - this.elementOffset.left -
				( this._clickOffset ? this._clickOffset.left : 0 );
		} else {
			pixelTotal = this.elementSize.height;
			pixelMouse = position.y - this.elementOffset.top -
				( this._clickOffset ? this._clickOffset.top : 0 );
		}

		percentMouse = ( pixelMouse / pixelTotal );
		if ( percentMouse > 1 ) {
			percentMouse = 1;
		}
		if ( percentMouse < 0 ) {
			percentMouse = 0;
		}
		if ( this.orientation === "vertical" ) {
			percentMouse = 1 - percentMouse;
		}

		valueTotal = this._valueMax() - this._valueMin();
		valueMouse = this._valueMin() + percentMouse * valueTotal;

		return this._trimAlignValue( valueMouse );
	},

	_uiHash: function( index, value, values ) {
		var uiHash = {
			handle: this.handles[ index ],
			handleIndex: index,
			value: value !== undefined ? value : this.value()
		};

		if ( this._hasMultipleValues() ) {
			uiHash.value = value !== undefined ? value : this.values( index );
			uiHash.values = values || this.values();
		}

		return uiHash;
	},

	_hasMultipleValues: function() {
		return this.options.values && this.options.values.length;
	},

	_start: function( event, index ) {
		return this._trigger( "start", event, this._uiHash( index ) );
	},

	_slide: function( event, index, newVal ) {
		var allowed, otherVal,
			currentValue = this.value(),
			newValues = this.values();

		if ( this._hasMultipleValues() ) {
			otherVal = this.values( index ? 0 : 1 );
			currentValue = this.values( index );

			if ( this.options.values.length === 2 && this.options.range === true ) {
				newVal =  index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
			}

			newValues[ index ] = newVal;
		}

		if ( newVal === currentValue ) {
			return;
		}

		allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );

		// A slide can be canceled by returning false from the slide callback
		if ( allowed === false ) {
			return;
		}

		if ( this._hasMultipleValues() ) {
			this.values( index, newVal );
		} else {
			this.value( newVal );
		}
	},

	_stop: function( event, index ) {
		this._trigger( "stop", event, this._uiHash( index ) );
	},

	_change: function( event, index ) {
		if ( !this._keySliding && !this._mouseSliding ) {

			//store the last changed value index for reference when handles overlap
			this._lastChangedValue = index;
			this._trigger( "change", event, this._uiHash( index ) );
		}
	},

	value: function( newValue ) {
		if ( arguments.length ) {
			this.options.value = this._trimAlignValue( newValue );
			this._refreshValue();
			this._change( null, 0 );
			return;
		}

		return this._value();
	},

	values: function( index, newValue ) {
		var vals,
			newValues,
			i;

		if ( arguments.length > 1 ) {
			this.options.values[ index ] = this._trimAlignValue( newValue );
			this._refreshValue();
			this._change( null, index );
			return;
		}

		if ( arguments.length ) {
			if ( $.isArray( arguments[ 0 ] ) ) {
				vals = this.options.values;
				newValues = arguments[ 0 ];
				for ( i = 0; i < vals.length; i += 1 ) {
					vals[ i ] = this._trimAlignValue( newValues[ i ] );
					this._change( null, i );
				}
				this._refreshValue();
			} else {
				if ( this._hasMultipleValues() ) {
					return this._values( index );
				} else {
					return this.value();
				}
			}
		} else {
			return this._values();
		}
	},

	_setOption: function( key, value ) {
		var i,
			valsLength = 0;

		if ( key === "range" && this.options.range === true ) {
			if ( value === "min" ) {
				this.options.value = this._values( 0 );
				this.options.values = null;
			} else if ( value === "max" ) {
				this.options.value = this._values( this.options.values.length - 1 );
				this.options.values = null;
			}
		}

		if ( $.isArray( this.options.values ) ) {
			valsLength = this.options.values.length;
		}

		this._super( key, value );

		switch ( key ) {
			case "orientation":
				this._detectOrientation();
				this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
					._addClass( "ui-slider-" + this.orientation );
				this._refreshValue();
				if ( this.options.range ) {
					this._refreshRange( value );
				}

				// Reset positioning from previous orientation
				this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
				break;
			case "value":
				this._animateOff = true;
				this._refreshValue();
				this._change( null, 0 );
				this._animateOff = false;
				break;
			case "values":
				this._animateOff = true;
				this._refreshValue();

				// Start from the last handle to prevent unreachable handles (#9046)
				for ( i = valsLength - 1; i >= 0; i-- ) {
					this._change( null, i );
				}
				this._animateOff = false;
				break;
			case "step":
			case "min":
			case "max":
				this._animateOff = true;
				this._calculateNewMax();
				this._refreshValue();
				this._animateOff = false;
				break;
			case "range":
				this._animateOff = true;
				this._refresh();
				this._animateOff = false;
				break;
		}
	},

	_setOptionDisabled: function( value ) {
		this._super( value );

		this._toggleClass( null, "ui-state-disabled", !!value );
	},

	//internal value getter
	// _value() returns value trimmed by min and max, aligned by step
	_value: function() {
		var val = this.options.value;
		val = this._trimAlignValue( val );

		return val;
	},

	//internal values getter
	// _values() returns array of values trimmed by min and max, aligned by step
	// _values( index ) returns single value trimmed by min and max, aligned by step
	_values: function( index ) {
		var val,
			vals,
			i;

		if ( arguments.length ) {
			val = this.options.values[ index ];
			val = this._trimAlignValue( val );

			return val;
		} else if ( this._hasMultipleValues() ) {

			// .slice() creates a copy of the array
			// this copy gets trimmed by min and max and then returned
			vals = this.options.values.slice();
			for ( i = 0; i < vals.length; i += 1 ) {
				vals[ i ] = this._trimAlignValue( vals[ i ] );
			}

			return vals;
		} else {
			return [];
		}
	},

	// Returns the step-aligned value that val is closest to, between (inclusive) min and max
	_trimAlignValue: function( val ) {
		if ( val <= this._valueMin() ) {
			return this._valueMin();
		}
		if ( val >= this._valueMax() ) {
			return this._valueMax();
		}
		var step = ( this.options.step > 0 ) ? this.options.step : 1,
			valModStep = ( val - this._valueMin() ) % step,
			alignValue = val - valModStep;

		if ( Math.abs( valModStep ) * 2 >= step ) {
			alignValue += ( valModStep > 0 ) ? step : ( -step );
		}

		// Since JavaScript has problems with large floats, round
		// the final value to 5 digits after the decimal point (see #4124)
		return parseFloat( alignValue.toFixed( 5 ) );
	},

	_calculateNewMax: function() {
		var max = this.options.max,
			min = this._valueMin(),
			step = this.options.step,
			aboveMin = Math.round( ( max - min ) / step ) * step;
		max = aboveMin + min;
		if ( max > this.options.max ) {

			//If max is not divisible by step, rounding off may increase its value
			max -= step;
		}
		this.max = parseFloat( max.toFixed( this._precision() ) );
	},

	_precision: function() {
		var precision = this._precisionOf( this.options.step );
		if ( this.options.min !== null ) {
			precision = Math.max( precision, this._precisionOf( this.options.min ) );
		}
		return precision;
	},

	_precisionOf: function( num ) {
		var str = num.toString(),
			decimal = str.indexOf( "." );
		return decimal === -1 ? 0 : str.length - decimal - 1;
	},

	_valueMin: function() {
		return this.options.min;
	},

	_valueMax: function() {
		return this.max;
	},

	_refreshRange: function( orientation ) {
		if ( orientation === "vertical" ) {
			this.range.css( { "width": "", "left": "" } );
		}
		if ( orientation === "horizontal" ) {
			this.range.css( { "height": "", "bottom": "" } );
		}
	},

	_refreshValue: function() {
		var lastValPercent, valPercent, value, valueMin, valueMax,
			oRange = this.options.range,
			o = this.options,
			that = this,
			animate = ( !this._animateOff ) ? o.animate : false,
			_set = {};

		if ( this._hasMultipleValues() ) {
			this.handles.each( function( i ) {
				valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
					that._valueMin() ) * 100;
				_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
				$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
				if ( that.options.range === true ) {
					if ( that.orientation === "horizontal" ) {
						if ( i === 0 ) {
							that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
								left: valPercent + "%"
							}, o.animate );
						}
						if ( i === 1 ) {
							that.range[ animate ? "animate" : "css" ]( {
								width: ( valPercent - lastValPercent ) + "%"
							}, {
								queue: false,
								duration: o.animate
							} );
						}
					} else {
						if ( i === 0 ) {
							that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
								bottom: ( valPercent ) + "%"
							}, o.animate );
						}
						if ( i === 1 ) {
							that.range[ animate ? "animate" : "css" ]( {
								height: ( valPercent - lastValPercent ) + "%"
							}, {
								queue: false,
								duration: o.animate
							} );
						}
					}
				}
				lastValPercent = valPercent;
			} );
		} else {
			value = this.value();
			valueMin = this._valueMin();
			valueMax = this._valueMax();
			valPercent = ( valueMax !== valueMin ) ?
					( value - valueMin ) / ( valueMax - valueMin ) * 100 :
					0;
			_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
			this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );

			if ( oRange === "min" && this.orientation === "horizontal" ) {
				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
					width: valPercent + "%"
				}, o.animate );
			}
			if ( oRange === "max" && this.orientation === "horizontal" ) {
				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
					width: ( 100 - valPercent ) + "%"
				}, o.animate );
			}
			if ( oRange === "min" && this.orientation === "vertical" ) {
				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
					height: valPercent + "%"
				}, o.animate );
			}
			if ( oRange === "max" && this.orientation === "vertical" ) {
				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
					height: ( 100 - valPercent ) + "%"
				}, o.animate );
			}
		}
	},

	_handleEvents: {
		keydown: function( event ) {
			var allowed, curVal, newVal, step,
				index = $( event.target ).data( "ui-slider-handle-index" );

			switch ( event.keyCode ) {
				case $.ui.keyCode.HOME:
				case $.ui.keyCode.END:
				case $.ui.keyCode.PAGE_UP:
				case $.ui.keyCode.PAGE_DOWN:
				case $.ui.keyCode.UP:
				case $.ui.keyCode.RIGHT:
				case $.ui.keyCode.DOWN:
				case $.ui.keyCode.LEFT:
					event.preventDefault();
					if ( !this._keySliding ) {
						this._keySliding = true;
						this._addClass( $( event.target ), null, "ui-state-active" );
						allowed = this._start( event, index );
						if ( allowed === false ) {
							return;
						}
					}
					break;
			}

			step = this.options.step;
			if ( this._hasMultipleValues() ) {
				curVal = newVal = this.values( index );
			} else {
				curVal = newVal = this.value();
			}

			switch ( event.keyCode ) {
				case $.ui.keyCode.HOME:
					newVal = this._valueMin();
					break;
				case $.ui.keyCode.END:
					newVal = this._valueMax();
					break;
				case $.ui.keyCode.PAGE_UP:
					newVal = this._trimAlignValue(
						curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
					);
					break;
				case $.ui.keyCode.PAGE_DOWN:
					newVal = this._trimAlignValue(
						curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
					break;
				case $.ui.keyCode.UP:
				case $.ui.keyCode.RIGHT:
					if ( curVal === this._valueMax() ) {
						return;
					}
					newVal = this._trimAlignValue( curVal + step );
					break;
				case $.ui.keyCode.DOWN:
				case $.ui.keyCode.LEFT:
					if ( curVal === this._valueMin() ) {
						return;
					}
					newVal = this._trimAlignValue( curVal - step );
					break;
			}

			this._slide( event, index, newVal );
		},
		keyup: function( event ) {
			var index = $( event.target ).data( "ui-slider-handle-index" );

			if ( this._keySliding ) {
				this._keySliding = false;
				this._stop( event, index );
				this._change( event, index );
				this._removeClass( $( event.target ), null, "ui-state-active" );
			}
		}
	}
} );


/*!
 * jQuery UI Sortable 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Sortable
//>>group: Interactions
//>>description: Enables items in a list to be sorted using the mouse.
//>>docs: http://api.jqueryui.com/sortable/
//>>demos: http://jqueryui.com/sortable/
//>>css.structure: ../../themes/base/sortable.css



var widgetsSortable = $.widget( "ui.sortable", $.ui.mouse, {
	version: "1.12.1",
	widgetEventPrefix: "sort",
	ready: false,
	options: {
		appendTo: "parent",
		axis: false,
		connectWith: false,
		containment: false,
		cursor: "auto",
		cursorAt: false,
		dropOnEmpty: true,
		forcePlaceholderSize: false,
		forceHelperSize: false,
		grid: false,
		handle: false,
		helper: "original",
		items: "> *",
		opacity: false,
		placeholder: false,
		revert: false,
		scroll: true,
		scrollSensitivity: 20,
		scrollSpeed: 20,
		scope: "default",
		tolerance: "intersect",
		zIndex: 1000,

		// Callbacks
		activate: null,
		beforeStop: null,
		change: null,
		deactivate: null,
		out: null,
		over: null,
		receive: null,
		remove: null,
		sort: null,
		start: null,
		stop: null,
		update: null
	},

	_isOverAxis: function( x, reference, size ) {
		return ( x >= reference ) && ( x < ( reference + size ) );
	},

	_isFloating: function( item ) {
		return ( /left|right/ ).test( item.css( "float" ) ) ||
			( /inline|table-cell/ ).test( item.css( "display" ) );
	},

	_create: function() {
		this.containerCache = {};
		this._addClass( "ui-sortable" );

		//Get the items
		this.refresh();

		//Let's determine the parent's offset
		this.offset = this.element.offset();

		//Initialize mouse events for interaction
		this._mouseInit();

		this._setHandleClassName();

		//We're ready to go
		this.ready = true;

	},

	_setOption: function( key, value ) {
		this._super( key, value );

		if ( key === "handle" ) {
			this._setHandleClassName();
		}
	},

	_setHandleClassName: function() {
		var that = this;
		this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" );
		$.each( this.items, function() {
			that._addClass(
				this.instance.options.handle ?
					this.item.find( this.instance.options.handle ) :
					this.item,
				"ui-sortable-handle"
			);
		} );
	},

	_destroy: function() {
		this._mouseDestroy();

		for ( var i = this.items.length - 1; i >= 0; i-- ) {
			this.items[ i ].item.removeData( this.widgetName + "-item" );
		}

		return this;
	},

	_mouseCapture: function( event, overrideHandle ) {
		var currentItem = null,
			validHandle = false,
			that = this;

		if ( this.reverting ) {
			return false;
		}

		if ( this.options.disabled || this.options.type === "static" ) {
			return false;
		}

		//We have to refresh the items data once first
		this._refreshItems( event );

		//Find out if the clicked node (or one of its parents) is a actual item in this.items
		$( event.target ).parents().each( function() {
			if ( $.data( this, that.widgetName + "-item" ) === that ) {
				currentItem = $( this );
				return false;
			}
		} );
		if ( $.data( event.target, that.widgetName + "-item" ) === that ) {
			currentItem = $( event.target );
		}

		if ( !currentItem ) {
			return false;
		}
		if ( this.options.handle && !overrideHandle ) {
			$( this.options.handle, currentItem ).find( "*" ).addBack().each( function() {
				if ( this === event.target ) {
					validHandle = true;
				}
			} );
			if ( !validHandle ) {
				return false;
			}
		}

		this.currentItem = currentItem;
		this._removeCurrentsFromItems();
		return true;

	},

	_mouseStart: function( event, overrideHandle, noActivation ) {

		var i, body,
			o = this.options;

		this.currentContainer = this;

		//We only need to call refreshPositions, because the refreshItems call has been moved to
		// mouseCapture
		this.refreshPositions();

		//Create and append the visible helper
		this.helper = this._createHelper( event );

		//Cache the helper size
		this._cacheHelperProportions();

		/*
		 * - Position generation -
		 * This block generates everything position related - it's the core of draggables.
		 */

		//Cache the margins of the original element
		this._cacheMargins();

		//Get the next scrolling parent
		this.scrollParent = this.helper.scrollParent();

		//The element's absolute position on the page minus margins
		this.offset = this.currentItem.offset();
		this.offset = {
			top: this.offset.top - this.margins.top,
			left: this.offset.left - this.margins.left
		};

		$.extend( this.offset, {
			click: { //Where the click happened, relative to the element
				left: event.pageX - this.offset.left,
				top: event.pageY - this.offset.top
			},
			parent: this._getParentOffset(),

			// This is a relative to absolute position minus the actual position calculation -
			// only used for relative positioned helper
			relative: this._getRelativeOffset()
		} );

		// Only after we got the offset, we can change the helper's position to absolute
		// TODO: Still need to figure out a way to make relative sorting possible
		this.helper.css( "position", "absolute" );
		this.cssPosition = this.helper.css( "position" );

		//Generate the original position
		this.originalPosition = this._generatePosition( event );
		this.originalPageX = event.pageX;
		this.originalPageY = event.pageY;

		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
		( o.cursorAt && this._adjustOffsetFromHelper( o.cursorAt ) );

		//Cache the former DOM position
		this.domPosition = {
			prev: this.currentItem.prev()[ 0 ],
			parent: this.currentItem.parent()[ 0 ]
		};

		// If the helper is not the original, hide the original so it's not playing any role during
		// the drag, won't cause anything bad this way
		if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
			this.currentItem.hide();
		}

		//Create the placeholder
		this._createPlaceholder();

		//Set a containment if given in the options
		if ( o.containment ) {
			this._setContainment();
		}

		if ( o.cursor && o.cursor !== "auto" ) { // cursor option
			body = this.document.find( "body" );

			// Support: IE
			this.storedCursor = body.css( "cursor" );
			body.css( "cursor", o.cursor );

			this.storedStylesheet =
				$( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body );
		}

		if ( o.opacity ) { // opacity option
			if ( this.helper.css( "opacity" ) ) {
				this._storedOpacity = this.helper.css( "opacity" );
			}
			this.helper.css( "opacity", o.opacity );
		}

		if ( o.zIndex ) { // zIndex option
			if ( this.helper.css( "zIndex" ) ) {
				this._storedZIndex = this.helper.css( "zIndex" );
			}
			this.helper.css( "zIndex", o.zIndex );
		}

		//Prepare scrolling
		if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
				this.scrollParent[ 0 ].tagName !== "HTML" ) {
			this.overflowOffset = this.scrollParent.offset();
		}

		//Call callbacks
		this._trigger( "start", event, this._uiHash() );

		//Recache the helper size
		if ( !this._preserveHelperProportions ) {
			this._cacheHelperProportions();
		}

		//Post "activate" events to possible containers
		if ( !noActivation ) {
			for ( i = this.containers.length - 1; i >= 0; i-- ) {
				this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
			}
		}

		//Prepare possible droppables
		if ( $.ui.ddmanager ) {
			$.ui.ddmanager.current = this;
		}

		if ( $.ui.ddmanager && !o.dropBehaviour ) {
			$.ui.ddmanager.prepareOffsets( this, event );
		}

		this.dragging = true;

		this._addClass( this.helper, "ui-sortable-helper" );

		// Execute the drag once - this causes the helper not to be visiblebefore getting its
		// correct position
		this._mouseDrag( event );
		return true;

	},

	_mouseDrag: function( event ) {
		var i, item, itemElement, intersection,
			o = this.options,
			scrolled = false;

		//Compute the helpers position
		this.position = this._generatePosition( event );
		this.positionAbs = this._convertPositionTo( "absolute" );

		if ( !this.lastPositionAbs ) {
			this.lastPositionAbs = this.positionAbs;
		}

		//Do scrolling
		if ( this.options.scroll ) {
			if ( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
					this.scrollParent[ 0 ].tagName !== "HTML" ) {

				if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) -
						event.pageY < o.scrollSensitivity ) {
					this.scrollParent[ 0 ].scrollTop =
						scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed;
				} else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) {
					this.scrollParent[ 0 ].scrollTop =
						scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed;
				}

				if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) -
						event.pageX < o.scrollSensitivity ) {
					this.scrollParent[ 0 ].scrollLeft = scrolled =
						this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed;
				} else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) {
					this.scrollParent[ 0 ].scrollLeft = scrolled =
						this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed;
				}

			} else {

				if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) {
					scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed );
				} else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) <
						o.scrollSensitivity ) {
					scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed );
				}

				if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) {
					scrolled = this.document.scrollLeft(
						this.document.scrollLeft() - o.scrollSpeed
					);
				} else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) <
						o.scrollSensitivity ) {
					scrolled = this.document.scrollLeft(
						this.document.scrollLeft() + o.scrollSpeed
					);
				}

			}

			if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) {
				$.ui.ddmanager.prepareOffsets( this, event );
			}
		}

		//Regenerate the absolute position used for position checks
		this.positionAbs = this._convertPositionTo( "absolute" );

		//Set the helper position
		if ( !this.options.axis || this.options.axis !== "y" ) {
			this.helper[ 0 ].style.left = this.position.left + "px";
		}
		if ( !this.options.axis || this.options.axis !== "x" ) {
			this.helper[ 0 ].style.top = this.position.top + "px";
		}

		//Rearrange
		for ( i = this.items.length - 1; i >= 0; i-- ) {

			//Cache variables and intersection, continue if no intersection
			item = this.items[ i ];
			itemElement = item.item[ 0 ];
			intersection = this._intersectsWithPointer( item );
			if ( !intersection ) {
				continue;
			}

			// Only put the placeholder inside the current Container, skip all
			// items from other containers. This works because when moving
			// an item from one container to another the
			// currentContainer is switched before the placeholder is moved.
			//
			// Without this, moving items in "sub-sortables" can cause
			// the placeholder to jitter between the outer and inner container.
			if ( item.instance !== this.currentContainer ) {
				continue;
			}

			// Cannot intersect with itself
			// no useless actions that have been done before
			// no action if the item moved is the parent of the item checked
			if ( itemElement !== this.currentItem[ 0 ] &&
				this.placeholder[ intersection === 1 ? "next" : "prev" ]()[ 0 ] !== itemElement &&
				!$.contains( this.placeholder[ 0 ], itemElement ) &&
				( this.options.type === "semi-dynamic" ?
					!$.contains( this.element[ 0 ], itemElement ) :
					true
				)
			) {

				this.direction = intersection === 1 ? "down" : "up";

				if ( this.options.tolerance === "pointer" || this._intersectsWithSides( item ) ) {
					this._rearrange( event, item );
				} else {
					break;
				}

				this._trigger( "change", event, this._uiHash() );
				break;
			}
		}

		//Post events to containers
		this._contactContainers( event );

		//Interconnect with droppables
		if ( $.ui.ddmanager ) {
			$.ui.ddmanager.drag( this, event );
		}

		//Call callbacks
		this._trigger( "sort", event, this._uiHash() );

		this.lastPositionAbs = this.positionAbs;
		return false;

	},

	_mouseStop: function( event, noPropagation ) {

		if ( !event ) {
			return;
		}

		//If we are using droppables, inform the manager about the drop
		if ( $.ui.ddmanager && !this.options.dropBehaviour ) {
			$.ui.ddmanager.drop( this, event );
		}

		if ( this.options.revert ) {
			var that = this,
				cur = this.placeholder.offset(),
				axis = this.options.axis,
				animation = {};

			if ( !axis || axis === "x" ) {
				animation.left = cur.left - this.offset.parent.left - this.margins.left +
					( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
						0 :
						this.offsetParent[ 0 ].scrollLeft
					);
			}
			if ( !axis || axis === "y" ) {
				animation.top = cur.top - this.offset.parent.top - this.margins.top +
					( this.offsetParent[ 0 ] === this.document[ 0 ].body ?
						0 :
						this.offsetParent[ 0 ].scrollTop
					);
			}
			this.reverting = true;
			$( this.helper ).animate(
				animation,
				parseInt( this.options.revert, 10 ) || 500,
				function() {
					that._clear( event );
				}
			);
		} else {
			this._clear( event, noPropagation );
		}

		return false;

	},

	cancel: function() {

		if ( this.dragging ) {

			this._mouseUp( new $.Event( "mouseup", { target: null } ) );

			if ( this.options.helper === "original" ) {
				this.currentItem.css( this._storedCSS );
				this._removeClass( this.currentItem, "ui-sortable-helper" );
			} else {
				this.currentItem.show();
			}

			//Post deactivating events to containers
			for ( var i = this.containers.length - 1; i >= 0; i-- ) {
				this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) );
				if ( this.containers[ i ].containerCache.over ) {
					this.containers[ i ]._trigger( "out", null, this._uiHash( this ) );
					this.containers[ i ].containerCache.over = 0;
				}
			}

		}

		if ( this.placeholder ) {

			//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
			// it unbinds ALL events from the original node!
			if ( this.placeholder[ 0 ].parentNode ) {
				this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );
			}
			if ( this.options.helper !== "original" && this.helper &&
					this.helper[ 0 ].parentNode ) {
				this.helper.remove();
			}

			$.extend( this, {
				helper: null,
				dragging: false,
				reverting: false,
				_noFinalSort: null
			} );

			if ( this.domPosition.prev ) {
				$( this.domPosition.prev ).after( this.currentItem );
			} else {
				$( this.domPosition.parent ).prepend( this.currentItem );
			}
		}

		return this;

	},

	serialize: function( o ) {

		var items = this._getItemsAsjQuery( o && o.connected ),
			str = [];
		o = o || {};

		$( items ).each( function() {
			var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" )
				.match( o.expression || ( /(.+)[\-=_](.+)/ ) );
			if ( res ) {
				str.push(
					( o.key || res[ 1 ] + "[]" ) +
					"=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) );
			}
		} );

		if ( !str.length && o.key ) {
			str.push( o.key + "=" );
		}

		return str.join( "&" );

	},

	toArray: function( o ) {

		var items = this._getItemsAsjQuery( o && o.connected ),
			ret = [];

		o = o || {};

		items.each( function() {
			ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" );
		} );
		return ret;

	},

	/* Be careful with the following core functions */
	_intersectsWith: function( item ) {

		var x1 = this.positionAbs.left,
			x2 = x1 + this.helperProportions.width,
			y1 = this.positionAbs.top,
			y2 = y1 + this.helperProportions.height,
			l = item.left,
			r = l + item.width,
			t = item.top,
			b = t + item.height,
			dyClick = this.offset.click.top,
			dxClick = this.offset.click.left,
			isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t &&
				( y1 + dyClick ) < b ),
			isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l &&
				( x1 + dxClick ) < r ),
			isOverElement = isOverElementHeight && isOverElementWidth;

		if ( this.options.tolerance === "pointer" ||
			this.options.forcePointerForContainers ||
			( this.options.tolerance !== "pointer" &&
				this.helperProportions[ this.floating ? "width" : "height" ] >
				item[ this.floating ? "width" : "height" ] )
		) {
			return isOverElement;
		} else {

			return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half
				x2 - ( this.helperProportions.width / 2 ) < r && // Left Half
				t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half
				y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half

		}
	},

	_intersectsWithPointer: function( item ) {
		var verticalDirection, horizontalDirection,
			isOverElementHeight = ( this.options.axis === "x" ) ||
				this._isOverAxis(
					this.positionAbs.top + this.offset.click.top, item.top, item.height ),
			isOverElementWidth = ( this.options.axis === "y" ) ||
				this._isOverAxis(
					this.positionAbs.left + this.offset.click.left, item.left, item.width ),
			isOverElement = isOverElementHeight && isOverElementWidth;

		if ( !isOverElement ) {
			return false;
		}

		verticalDirection = this._getDragVerticalDirection();
		horizontalDirection = this._getDragHorizontalDirection();

		return this.floating ?
			( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 )
			: ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) );

	},

	_intersectsWithSides: function( item ) {

		var isOverBottomHalf = this._isOverAxis( this.positionAbs.top +
				this.offset.click.top, item.top + ( item.height / 2 ), item.height ),
			isOverRightHalf = this._isOverAxis( this.positionAbs.left +
				this.offset.click.left, item.left + ( item.width / 2 ), item.width ),
			verticalDirection = this._getDragVerticalDirection(),
			horizontalDirection = this._getDragHorizontalDirection();

		if ( this.floating && horizontalDirection ) {
			return ( ( horizontalDirection === "right" && isOverRightHalf ) ||
				( horizontalDirection === "left" && !isOverRightHalf ) );
		} else {
			return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) ||
				( verticalDirection === "up" && !isOverBottomHalf ) );
		}

	},

	_getDragVerticalDirection: function() {
		var delta = this.positionAbs.top - this.lastPositionAbs.top;
		return delta !== 0 && ( delta > 0 ? "down" : "up" );
	},

	_getDragHorizontalDirection: function() {
		var delta = this.positionAbs.left - this.lastPositionAbs.left;
		return delta !== 0 && ( delta > 0 ? "right" : "left" );
	},

	refresh: function( event ) {
		this._refreshItems( event );
		this._setHandleClassName();
		this.refreshPositions();
		return this;
	},

	_connectWith: function() {
		var options = this.options;
		return options.connectWith.constructor === String ?
			[ options.connectWith ] :
			options.connectWith;
	},

	_getItemsAsjQuery: function( connected ) {

		var i, j, cur, inst,
			items = [],
			queries = [],
			connectWith = this._connectWith();

		if ( connectWith && connected ) {
			for ( i = connectWith.length - 1; i >= 0; i-- ) {
				cur = $( connectWith[ i ], this.document[ 0 ] );
				for ( j = cur.length - 1; j >= 0; j-- ) {
					inst = $.data( cur[ j ], this.widgetFullName );
					if ( inst && inst !== this && !inst.options.disabled ) {
						queries.push( [ $.isFunction( inst.options.items ) ?
							inst.options.items.call( inst.element ) :
							$( inst.options.items, inst.element )
								.not( ".ui-sortable-helper" )
								.not( ".ui-sortable-placeholder" ), inst ] );
					}
				}
			}
		}

		queries.push( [ $.isFunction( this.options.items ) ?
			this.options.items
				.call( this.element, null, { options: this.options, item: this.currentItem } ) :
			$( this.options.items, this.element )
				.not( ".ui-sortable-helper" )
				.not( ".ui-sortable-placeholder" ), this ] );

		function addItems() {
			items.push( this );
		}
		for ( i = queries.length - 1; i >= 0; i-- ) {
			queries[ i ][ 0 ].each( addItems );
		}

		return $( items );

	},

	_removeCurrentsFromItems: function() {

		var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" );

		this.items = $.grep( this.items, function( item ) {
			for ( var j = 0; j < list.length; j++ ) {
				if ( list[ j ] === item.item[ 0 ] ) {
					return false;
				}
			}
			return true;
		} );

	},

	_refreshItems: function( event ) {

		this.items = [];
		this.containers = [ this ];

		var i, j, cur, inst, targetData, _queries, item, queriesLength,
			items = this.items,
			queries = [ [ $.isFunction( this.options.items ) ?
				this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) :
				$( this.options.items, this.element ), this ] ],
			connectWith = this._connectWith();

		//Shouldn't be run the first time through due to massive slow-down
		if ( connectWith && this.ready ) {
			for ( i = connectWith.length - 1; i >= 0; i-- ) {
				cur = $( connectWith[ i ], this.document[ 0 ] );
				for ( j = cur.length - 1; j >= 0; j-- ) {
					inst = $.data( cur[ j ], this.widgetFullName );
					if ( inst && inst !== this && !inst.options.disabled ) {
						queries.push( [ $.isFunction( inst.options.items ) ?
							inst.options.items
								.call( inst.element[ 0 ], event, { item: this.currentItem } ) :
							$( inst.options.items, inst.element ), inst ] );
						this.containers.push( inst );
					}
				}
			}
		}

		for ( i = queries.length - 1; i >= 0; i-- ) {
			targetData = queries[ i ][ 1 ];
			_queries = queries[ i ][ 0 ];

			for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) {
				item = $( _queries[ j ] );

				// Data for target checking (mouse manager)
				item.data( this.widgetName + "-item", targetData );

				items.push( {
					item: item,
					instance: targetData,
					width: 0, height: 0,
					left: 0, top: 0
				} );
			}
		}

	},

	refreshPositions: function( fast ) {

		// Determine whether items are being displayed horizontally
		this.floating = this.items.length ?
			this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) :
			false;

		//This has to be redone because due to the item being moved out/into the offsetParent,
		// the offsetParent's position will change
		if ( this.offsetParent && this.helper ) {
			this.offset.parent = this._getParentOffset();
		}

		var i, item, t, p;

		for ( i = this.items.length - 1; i >= 0; i-- ) {
			item = this.items[ i ];

			//We ignore calculating positions of all connected containers when we're not over them
			if ( item.instance !== this.currentContainer && this.currentContainer &&
					item.item[ 0 ] !== this.currentItem[ 0 ] ) {
				continue;
			}

			t = this.options.toleranceElement ?
				$( this.options.toleranceElement, item.item ) :
				item.item;

			if ( !fast ) {
				item.width = t.outerWidth();
				item.height = t.outerHeight();
			}

			p = t.offset();
			item.left = p.left;
			item.top = p.top;
		}

		if ( this.options.custom && this.options.custom.refreshContainers ) {
			this.options.custom.refreshContainers.call( this );
		} else {
			for ( i = this.containers.length - 1; i >= 0; i-- ) {
				p = this.containers[ i ].element.offset();
				this.containers[ i ].containerCache.left = p.left;
				this.containers[ i ].containerCache.top = p.top;
				this.containers[ i ].containerCache.width =
					this.containers[ i ].element.outerWidth();
				this.containers[ i ].containerCache.height =
					this.containers[ i ].element.outerHeight();
			}
		}

		return this;
	},

	_createPlaceholder: function( that ) {
		that = that || this;
		var className,
			o = that.options;

		if ( !o.placeholder || o.placeholder.constructor === String ) {
			className = o.placeholder;
			o.placeholder = {
				element: function() {

					var nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(),
						element = $( "<" + nodeName + ">", that.document[ 0 ] );

						that._addClass( element, "ui-sortable-placeholder",
								className || that.currentItem[ 0 ].className )
							._removeClass( element, "ui-sortable-helper" );

					if ( nodeName === "tbody" ) {
						that._createTrPlaceholder(
							that.currentItem.find( "tr" ).eq( 0 ),
							$( "<tr>", that.document[ 0 ] ).appendTo( element )
						);
					} else if ( nodeName === "tr" ) {
						that._createTrPlaceholder( that.currentItem, element );
					} else if ( nodeName === "img" ) {
						element.attr( "src", that.currentItem.attr( "src" ) );
					}

					if ( !className ) {
						element.css( "visibility", "hidden" );
					}

					return element;
				},
				update: function( container, p ) {

					// 1. If a className is set as 'placeholder option, we don't force sizes -
					// the class is responsible for that
					// 2. The option 'forcePlaceholderSize can be enabled to force it even if a
					// class name is specified
					if ( className && !o.forcePlaceholderSize ) {
						return;
					}

					//If the element doesn't have a actual height by itself (without styles coming
					// from a stylesheet), it receives the inline height from the dragged item
					if ( !p.height() ) {
						p.height(
							that.currentItem.innerHeight() -
							parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) -
							parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) );
					}
					if ( !p.width() ) {
						p.width(
							that.currentItem.innerWidth() -
							parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) -
							parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) );
					}
				}
			};
		}

		//Create the placeholder
		that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) );

		//Append it after the actual current item
		that.currentItem.after( that.placeholder );

		//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
		o.placeholder.update( that, that.placeholder );

	},

	_createTrPlaceholder: function( sourceTr, targetTr ) {
		var that = this;

		sourceTr.children().each( function() {
			$( "<td>&#160;</td>", that.document[ 0 ] )
				.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
				.appendTo( targetTr );
		} );
	},

	_contactContainers: function( event ) {
		var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
			floating, axis,
			innermostContainer = null,
			innermostIndex = null;

		// Get innermost container that intersects with item
		for ( i = this.containers.length - 1; i >= 0; i-- ) {

			// Never consider a container that's located within the item itself
			if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) {
				continue;
			}

			if ( this._intersectsWith( this.containers[ i ].containerCache ) ) {

				// If we've already found a container and it's more "inner" than this, then continue
				if ( innermostContainer &&
						$.contains(
							this.containers[ i ].element[ 0 ],
							innermostContainer.element[ 0 ] ) ) {
					continue;
				}

				innermostContainer = this.containers[ i ];
				innermostIndex = i;

			} else {

				// container doesn't intersect. trigger "out" event if necessary
				if ( this.containers[ i ].containerCache.over ) {
					this.containers[ i ]._trigger( "out", event, this._uiHash( this ) );
					this.containers[ i ].containerCache.over = 0;
				}
			}

		}

		// If no intersecting containers found, return
		if ( !innermostContainer ) {
			return;
		}

		// Move the item into the container if it's not there already
		if ( this.containers.length === 1 ) {
			if ( !this.containers[ innermostIndex ].containerCache.over ) {
				this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
				this.containers[ innermostIndex ].containerCache.over = 1;
			}
		} else {

			// When entering a new container, we will find the item with the least distance and
			// append our item near it
			dist = 10000;
			itemWithLeastDistance = null;
			floating = innermostContainer.floating || this._isFloating( this.currentItem );
			posProperty = floating ? "left" : "top";
			sizeProperty = floating ? "width" : "height";
			axis = floating ? "pageX" : "pageY";

			for ( j = this.items.length - 1; j >= 0; j-- ) {
				if ( !$.contains(
						this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] )
				) {
					continue;
				}
				if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) {
					continue;
				}

				cur = this.items[ j ].item.offset()[ posProperty ];
				nearBottom = false;
				if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
					nearBottom = true;
				}

				if ( Math.abs( event[ axis ] - cur ) < dist ) {
					dist = Math.abs( event[ axis ] - cur );
					itemWithLeastDistance = this.items[ j ];
					this.direction = nearBottom ? "up" : "down";
				}
			}

			//Check if dropOnEmpty is enabled
			if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) {
				return;
			}

			if ( this.currentContainer === this.containers[ innermostIndex ] ) {
				if ( !this.currentContainer.containerCache.over ) {
					this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
					this.currentContainer.containerCache.over = 1;
				}
				return;
			}

			itemWithLeastDistance ?
				this._rearrange( event, itemWithLeastDistance, null, true ) :
				this._rearrange( event, null, this.containers[ innermostIndex ].element, true );
			this._trigger( "change", event, this._uiHash() );
			this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) );
			this.currentContainer = this.containers[ innermostIndex ];

			//Update the placeholder
			this.options.placeholder.update( this.currentContainer, this.placeholder );

			this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) );
			this.containers[ innermostIndex ].containerCache.over = 1;
		}

	},

	_createHelper: function( event ) {

		var o = this.options,
			helper = $.isFunction( o.helper ) ?
				$( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) :
				( o.helper === "clone" ? this.currentItem.clone() : this.currentItem );

		//Add the helper to the DOM if that didn't happen already
		if ( !helper.parents( "body" ).length ) {
			$( o.appendTo !== "parent" ?
				o.appendTo :
				this.currentItem[ 0 ].parentNode )[ 0 ].appendChild( helper[ 0 ] );
		}

		if ( helper[ 0 ] === this.currentItem[ 0 ] ) {
			this._storedCSS = {
				width: this.currentItem[ 0 ].style.width,
				height: this.currentItem[ 0 ].style.height,
				position: this.currentItem.css( "position" ),
				top: this.currentItem.css( "top" ),
				left: this.currentItem.css( "left" )
			};
		}

		if ( !helper[ 0 ].style.width || o.forceHelperSize ) {
			helper.width( this.currentItem.width() );
		}
		if ( !helper[ 0 ].style.height || o.forceHelperSize ) {
			helper.height( this.currentItem.height() );
		}

		return helper;

	},

	_adjustOffsetFromHelper: function( obj ) {
		if ( typeof obj === "string" ) {
			obj = obj.split( " " );
		}
		if ( $.isArray( obj ) ) {
			obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 };
		}
		if ( "left" in obj ) {
			this.offset.click.left = obj.left + this.margins.left;
		}
		if ( "right" in obj ) {
			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
		}
		if ( "top" in obj ) {
			this.offset.click.top = obj.top + this.margins.top;
		}
		if ( "bottom" in obj ) {
			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
		}
	},

	_getParentOffset: function() {

		//Get the offsetParent and cache its position
		this.offsetParent = this.helper.offsetParent();
		var po = this.offsetParent.offset();

		// This is a special case where we need to modify a offset calculated on start, since the
		// following happened:
		// 1. The position of the helper is absolute, so it's position is calculated based on the
		// next positioned parent
		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
		// the document, which means that the scroll is included in the initial calculation of the
		// offset of the parent, and never recalculated upon drag
		if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] &&
				$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) {
			po.left += this.scrollParent.scrollLeft();
			po.top += this.scrollParent.scrollTop();
		}

		// This needs to be actually done for all browsers, since pageX/pageY includes this
		// information with an ugly IE fix
		if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ||
				( this.offsetParent[ 0 ].tagName &&
				this.offsetParent[ 0 ].tagName.toLowerCase() === "html" && $.ui.ie ) ) {
			po = { top: 0, left: 0 };
		}

		return {
			top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ),
			left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 )
		};

	},

	_getRelativeOffset: function() {

		if ( this.cssPosition === "relative" ) {
			var p = this.currentItem.position();
			return {
				top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) +
					this.scrollParent.scrollTop(),
				left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) +
					this.scrollParent.scrollLeft()
			};
		} else {
			return { top: 0, left: 0 };
		}

	},

	_cacheMargins: function() {
		this.margins = {
			left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ),
			top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 )
		};
	},

	_cacheHelperProportions: function() {
		this.helperProportions = {
			width: this.helper.outerWidth(),
			height: this.helper.outerHeight()
		};
	},

	_setContainment: function() {

		var ce, co, over,
			o = this.options;
		if ( o.containment === "parent" ) {
			o.containment = this.helper[ 0 ].parentNode;
		}
		if ( o.containment === "document" || o.containment === "window" ) {
			this.containment = [
				0 - this.offset.relative.left - this.offset.parent.left,
				0 - this.offset.relative.top - this.offset.parent.top,
				o.containment === "document" ?
					this.document.width() :
					this.window.width() - this.helperProportions.width - this.margins.left,
				( o.containment === "document" ?
					( this.document.height() || document.body.parentNode.scrollHeight ) :
					this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight
				) - this.helperProportions.height - this.margins.top
			];
		}

		if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
			ce = $( o.containment )[ 0 ];
			co = $( o.containment ).offset();
			over = ( $( ce ).css( "overflow" ) !== "hidden" );

			this.containment = [
				co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) +
					( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left,
				co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) +
					( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top,
				co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
					( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) -
					( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) -
					this.helperProportions.width - this.margins.left,
				co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
					( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) -
					( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) -
					this.helperProportions.height - this.margins.top
			];
		}

	},

	_convertPositionTo: function( d, pos ) {

		if ( !pos ) {
			pos = this.position;
		}
		var mod = d === "absolute" ? 1 : -1,
			scroll = this.cssPosition === "absolute" &&
				!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
				$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
					this.offsetParent :
					this.scrollParent,
			scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );

		return {
			top: (

				// The absolute mouse position
				pos.top	+

				// Only for relative positioned nodes: Relative offset from element to offset parent
				this.offset.relative.top * mod +

				// The offsetParent's offset without borders (offset + border)
				this.offset.parent.top * mod -
				( ( this.cssPosition === "fixed" ?
					-this.scrollParent.scrollTop() :
					( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod )
			),
			left: (

				// The absolute mouse position
				pos.left +

				// Only for relative positioned nodes: Relative offset from element to offset parent
				this.offset.relative.left * mod +

				// The offsetParent's offset without borders (offset + border)
				this.offset.parent.left * mod	-
				( ( this.cssPosition === "fixed" ?
					-this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
					scroll.scrollLeft() ) * mod )
			)
		};

	},

	_generatePosition: function( event ) {

		var top, left,
			o = this.options,
			pageX = event.pageX,
			pageY = event.pageY,
			scroll = this.cssPosition === "absolute" &&
				!( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
				$.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ?
					this.offsetParent :
					this.scrollParent,
				scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName );

		// This is another very weird special case that only happens for relative elements:
		// 1. If the css position is relative
		// 2. and the scroll parent is the document or similar to the offset parent
		// we have to refresh the relative offset during the scroll so there are no jumps
		if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] &&
				this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) {
			this.offset.relative = this._getRelativeOffset();
		}

		/*
		 * - Position constraining -
		 * Constrain the position to a mix of grid, containment.
		 */

		if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options

			if ( this.containment ) {
				if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) {
					pageX = this.containment[ 0 ] + this.offset.click.left;
				}
				if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) {
					pageY = this.containment[ 1 ] + this.offset.click.top;
				}
				if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) {
					pageX = this.containment[ 2 ] + this.offset.click.left;
				}
				if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) {
					pageY = this.containment[ 3 ] + this.offset.click.top;
				}
			}

			if ( o.grid ) {
				top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) /
					o.grid[ 1 ] ) * o.grid[ 1 ];
				pageY = this.containment ?
					( ( top - this.offset.click.top >= this.containment[ 1 ] &&
						top - this.offset.click.top <= this.containment[ 3 ] ) ?
							top :
							( ( top - this.offset.click.top >= this.containment[ 1 ] ) ?
								top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) :
								top;

				left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) /
					o.grid[ 0 ] ) * o.grid[ 0 ];
				pageX = this.containment ?
					( ( left - this.offset.click.left >= this.containment[ 0 ] &&
						left - this.offset.click.left <= this.containment[ 2 ] ) ?
							left :
							( ( left - this.offset.click.left >= this.containment[ 0 ] ) ?
								left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) :
								left;
			}

		}

		return {
			top: (

				// The absolute mouse position
				pageY -

				// Click offset (relative to the element)
				this.offset.click.top -

				// Only for relative positioned nodes: Relative offset from element to offset parent
				this.offset.relative.top -

				// The offsetParent's offset without borders (offset + border)
				this.offset.parent.top +
				( ( this.cssPosition === "fixed" ?
					-this.scrollParent.scrollTop() :
					( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) )
			),
			left: (

				// The absolute mouse position
				pageX -

				// Click offset (relative to the element)
				this.offset.click.left -

				// Only for relative positioned nodes: Relative offset from element to offset parent
				this.offset.relative.left -

				// The offsetParent's offset without borders (offset + border)
				this.offset.parent.left +
				( ( this.cssPosition === "fixed" ?
					-this.scrollParent.scrollLeft() :
					scrollIsRootNode ? 0 : scroll.scrollLeft() ) )
			)
		};

	},

	_rearrange: function( event, i, a, hardRefresh ) {

		a ? a[ 0 ].appendChild( this.placeholder[ 0 ] ) :
			i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ],
				( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) );

		//Various things done here to improve the performance:
		// 1. we create a setTimeout, that calls refreshPositions
		// 2. on the instance, we have a counter variable, that get's higher after every append
		// 3. on the local scope, we copy the counter variable, and check in the timeout,
		// if it's still the same
		// 4. this lets only the last addition to the timeout stack through
		this.counter = this.counter ? ++this.counter : 1;
		var counter = this.counter;

		this._delay( function() {
			if ( counter === this.counter ) {

				//Precompute after each DOM insertion, NOT on mousemove
				this.refreshPositions( !hardRefresh );
			}
		} );

	},

	_clear: function( event, noPropagation ) {

		this.reverting = false;

		// We delay all events that have to be triggered to after the point where the placeholder
		// has been removed and everything else normalized again
		var i,
			delayedTriggers = [];

		// We first have to update the dom position of the actual currentItem
		// Note: don't do it if the current item is already removed (by a user), or it gets
		// reappended (see #4088)
		if ( !this._noFinalSort && this.currentItem.parent().length ) {
			this.placeholder.before( this.currentItem );
		}
		this._noFinalSort = null;

		if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) {
			for ( i in this._storedCSS ) {
				if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) {
					this._storedCSS[ i ] = "";
				}
			}
			this.currentItem.css( this._storedCSS );
			this._removeClass( this.currentItem, "ui-sortable-helper" );
		} else {
			this.currentItem.show();
		}

		if ( this.fromOutside && !noPropagation ) {
			delayedTriggers.push( function( event ) {
				this._trigger( "receive", event, this._uiHash( this.fromOutside ) );
			} );
		}
		if ( ( this.fromOutside ||
				this.domPosition.prev !==
				this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] ||
				this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) {

			// Trigger update callback if the DOM position has changed
			delayedTriggers.push( function( event ) {
				this._trigger( "update", event, this._uiHash() );
			} );
		}

		// Check if the items Container has Changed and trigger appropriate
		// events.
		if ( this !== this.currentContainer ) {
			if ( !noPropagation ) {
				delayedTriggers.push( function( event ) {
					this._trigger( "remove", event, this._uiHash() );
				} );
				delayedTriggers.push( ( function( c ) {
					return function( event ) {
						c._trigger( "receive", event, this._uiHash( this ) );
					};
				} ).call( this, this.currentContainer ) );
				delayedTriggers.push( ( function( c ) {
					return function( event ) {
						c._trigger( "update", event, this._uiHash( this ) );
					};
				} ).call( this, this.currentContainer ) );
			}
		}

		//Post events to containers
		function delayEvent( type, instance, container ) {
			return function( event ) {
				container._trigger( type, event, instance._uiHash( instance ) );
			};
		}
		for ( i = this.containers.length - 1; i >= 0; i-- ) {
			if ( !noPropagation ) {
				delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
			}
			if ( this.containers[ i ].containerCache.over ) {
				delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
				this.containers[ i ].containerCache.over = 0;
			}
		}

		//Do what was originally in plugins
		if ( this.storedCursor ) {
			this.document.find( "body" ).css( "cursor", this.storedCursor );
			this.storedStylesheet.remove();
		}
		if ( this._storedOpacity ) {
			this.helper.css( "opacity", this._storedOpacity );
		}
		if ( this._storedZIndex ) {
			this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex );
		}

		this.dragging = false;

		if ( !noPropagation ) {
			this._trigger( "beforeStop", event, this._uiHash() );
		}

		//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
		// it unbinds ALL events from the original node!
		this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] );

		if ( !this.cancelHelperRemoval ) {
			if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
				this.helper.remove();
			}
			this.helper = null;
		}

		if ( !noPropagation ) {
			for ( i = 0; i < delayedTriggers.length; i++ ) {

				// Trigger all delayed events
				delayedTriggers[ i ].call( this, event );
			}
			this._trigger( "stop", event, this._uiHash() );
		}

		this.fromOutside = false;
		return !this.cancelHelperRemoval;

	},

	_trigger: function() {
		if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) {
			this.cancel();
		}
	},

	_uiHash: function( _inst ) {
		var inst = _inst || this;
		return {
			helper: inst.helper,
			placeholder: inst.placeholder || $( [] ),
			position: inst.position,
			originalPosition: inst.originalPosition,
			offset: inst.positionAbs,
			item: inst.currentItem,
			sender: _inst ? _inst.element : null
		};
	}

} );


/*!
 * jQuery UI Spinner 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Spinner
//>>group: Widgets
//>>description: Displays buttons to easily input numbers via the keyboard or mouse.
//>>docs: http://api.jqueryui.com/spinner/
//>>demos: http://jqueryui.com/spinner/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/spinner.css
//>>css.theme: ../../themes/base/theme.css



function spinnerModifer( fn ) {
	return function() {
		var previous = this.element.val();
		fn.apply( this, arguments );
		this._refresh();
		if ( previous !== this.element.val() ) {
			this._trigger( "change" );
		}
	};
}

$.widget( "ui.spinner", {
	version: "1.12.1",
	defaultElement: "<input>",
	widgetEventPrefix: "spin",
	options: {
		classes: {
			"ui-spinner": "ui-corner-all",
			"ui-spinner-down": "ui-corner-br",
			"ui-spinner-up": "ui-corner-tr"
		},
		culture: null,
		icons: {
			down: "ui-icon-triangle-1-s",
			up: "ui-icon-triangle-1-n"
		},
		incremental: true,
		max: null,
		min: null,
		numberFormat: null,
		page: 10,
		step: 1,

		change: null,
		spin: null,
		start: null,
		stop: null
	},

	_create: function() {

		// handle string values that need to be parsed
		this._setOption( "max", this.options.max );
		this._setOption( "min", this.options.min );
		this._setOption( "step", this.options.step );

		// Only format if there is a value, prevents the field from being marked
		// as invalid in Firefox, see #9573.
		if ( this.value() !== "" ) {

			// Format the value, but don't constrain.
			this._value( this.element.val(), true );
		}

		this._draw();
		this._on( this._events );
		this._refresh();

		// Turning off autocomplete prevents the browser from remembering the
		// value when navigating through history, so we re-enable autocomplete
		// if the page is unloaded before the widget is destroyed. #7790
		this._on( this.window, {
			beforeunload: function() {
				this.element.removeAttr( "autocomplete" );
			}
		} );
	},

	_getCreateOptions: function() {
		var options = this._super();
		var element = this.element;

		$.each( [ "min", "max", "step" ], function( i, option ) {
			var value = element.attr( option );
			if ( value != null && value.length ) {
				options[ option ] = value;
			}
		} );

		return options;
	},

	_events: {
		keydown: function( event ) {
			if ( this._start( event ) && this._keydown( event ) ) {
				event.preventDefault();
			}
		},
		keyup: "_stop",
		focus: function() {
			this.previous = this.element.val();
		},
		blur: function( event ) {
			if ( this.cancelBlur ) {
				delete this.cancelBlur;
				return;
			}

			this._stop();
			this._refresh();
			if ( this.previous !== this.element.val() ) {
				this._trigger( "change", event );
			}
		},
		mousewheel: function( event, delta ) {
			if ( !delta ) {
				return;
			}
			if ( !this.spinning && !this._start( event ) ) {
				return false;
			}

			this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
			clearTimeout( this.mousewheelTimer );
			this.mousewheelTimer = this._delay( function() {
				if ( this.spinning ) {
					this._stop( event );
				}
			}, 100 );
			event.preventDefault();
		},
		"mousedown .ui-spinner-button": function( event ) {
			var previous;

			// We never want the buttons to have focus; whenever the user is
			// interacting with the spinner, the focus should be on the input.
			// If the input is focused then this.previous is properly set from
			// when the input first received focus. If the input is not focused
			// then we need to set this.previous based on the value before spinning.
			previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
				this.previous : this.element.val();
			function checkFocus() {
				var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
				if ( !isActive ) {
					this.element.trigger( "focus" );
					this.previous = previous;

					// support: IE
					// IE sets focus asynchronously, so we need to check if focus
					// moved off of the input because the user clicked on the button.
					this._delay( function() {
						this.previous = previous;
					} );
				}
			}

			// Ensure focus is on (or stays on) the text field
			event.preventDefault();
			checkFocus.call( this );

			// Support: IE
			// IE doesn't prevent moving focus even with event.preventDefault()
			// so we set a flag to know when we should ignore the blur event
			// and check (again) if focus moved off of the input.
			this.cancelBlur = true;
			this._delay( function() {
				delete this.cancelBlur;
				checkFocus.call( this );
			} );

			if ( this._start( event ) === false ) {
				return;
			}

			this._repeat( null, $( event.currentTarget )
				.hasClass( "ui-spinner-up" ) ? 1 : -1, event );
		},
		"mouseup .ui-spinner-button": "_stop",
		"mouseenter .ui-spinner-button": function( event ) {

			// button will add ui-state-active if mouse was down while mouseleave and kept down
			if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
				return;
			}

			if ( this._start( event ) === false ) {
				return false;
			}
			this._repeat( null, $( event.currentTarget )
				.hasClass( "ui-spinner-up" ) ? 1 : -1, event );
		},

		// TODO: do we really want to consider this a stop?
		// shouldn't we just stop the repeater and wait until mouseup before
		// we trigger the stop event?
		"mouseleave .ui-spinner-button": "_stop"
	},

	// Support mobile enhanced option and make backcompat more sane
	_enhance: function() {
		this.uiSpinner = this.element
			.attr( "autocomplete", "off" )
			.wrap( "<span>" )
			.parent()

				// Add buttons
				.append(
					"<a></a><a></a>"
				);
	},

	_draw: function() {
		this._enhance();

		this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );
		this._addClass( "ui-spinner-input" );

		this.element.attr( "role", "spinbutton" );

		// Button bindings
		this.buttons = this.uiSpinner.children( "a" )
			.attr( "tabIndex", -1 )
			.attr( "aria-hidden", true )
			.button( {
				classes: {
					"ui-button": ""
				}
			} );

		// TODO: Right now button does not support classes this is already updated in button PR
		this._removeClass( this.buttons, "ui-corner-all" );

		this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );
		this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );
		this.buttons.first().button( {
			"icon": this.options.icons.up,
			"showLabel": false
		} );
		this.buttons.last().button( {
			"icon": this.options.icons.down,
			"showLabel": false
		} );

		// IE 6 doesn't understand height: 50% for the buttons
		// unless the wrapper has an explicit height
		if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&
				this.uiSpinner.height() > 0 ) {
			this.uiSpinner.height( this.uiSpinner.height() );
		}
	},

	_keydown: function( event ) {
		var options = this.options,
			keyCode = $.ui.keyCode;

		switch ( event.keyCode ) {
		case keyCode.UP:
			this._repeat( null, 1, event );
			return true;
		case keyCode.DOWN:
			this._repeat( null, -1, event );
			return true;
		case keyCode.PAGE_UP:
			this._repeat( null, options.page, event );
			return true;
		case keyCode.PAGE_DOWN:
			this._repeat( null, -options.page, event );
			return true;
		}

		return false;
	},

	_start: function( event ) {
		if ( !this.spinning && this._trigger( "start", event ) === false ) {
			return false;
		}

		if ( !this.counter ) {
			this.counter = 1;
		}
		this.spinning = true;
		return true;
	},

	_repeat: function( i, steps, event ) {
		i = i || 500;

		clearTimeout( this.timer );
		this.timer = this._delay( function() {
			this._repeat( 40, steps, event );
		}, i );

		this._spin( steps * this.options.step, event );
	},

	_spin: function( step, event ) {
		var value = this.value() || 0;

		if ( !this.counter ) {
			this.counter = 1;
		}

		value = this._adjustValue( value + step * this._increment( this.counter ) );

		if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
			this._value( value );
			this.counter++;
		}
	},

	_increment: function( i ) {
		var incremental = this.options.incremental;

		if ( incremental ) {
			return $.isFunction( incremental ) ?
				incremental( i ) :
				Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
		}

		return 1;
	},

	_precision: function() {
		var precision = this._precisionOf( this.options.step );
		if ( this.options.min !== null ) {
			precision = Math.max( precision, this._precisionOf( this.options.min ) );
		}
		return precision;
	},

	_precisionOf: function( num ) {
		var str = num.toString(),
			decimal = str.indexOf( "." );
		return decimal === -1 ? 0 : str.length - decimal - 1;
	},

	_adjustValue: function( value ) {
		var base, aboveMin,
			options = this.options;

		// Make sure we're at a valid step
		// - find out where we are relative to the base (min or 0)
		base = options.min !== null ? options.min : 0;
		aboveMin = value - base;

		// - round to the nearest step
		aboveMin = Math.round( aboveMin / options.step ) * options.step;

		// - rounding is based on 0, so adjust back to our base
		value = base + aboveMin;

		// Fix precision from bad JS floating point math
		value = parseFloat( value.toFixed( this._precision() ) );

		// Clamp the value
		if ( options.max !== null && value > options.max ) {
			return options.max;
		}
		if ( options.min !== null && value < options.min ) {
			return options.min;
		}

		return value;
	},

	_stop: function( event ) {
		if ( !this.spinning ) {
			return;
		}

		clearTimeout( this.timer );
		clearTimeout( this.mousewheelTimer );
		this.counter = 0;
		this.spinning = false;
		this._trigger( "stop", event );
	},

	_setOption: function( key, value ) {
		var prevValue, first, last;

		if ( key === "culture" || key === "numberFormat" ) {
			prevValue = this._parse( this.element.val() );
			this.options[ key ] = value;
			this.element.val( this._format( prevValue ) );
			return;
		}

		if ( key === "max" || key === "min" || key === "step" ) {
			if ( typeof value === "string" ) {
				value = this._parse( value );
			}
		}
		if ( key === "icons" ) {
			first = this.buttons.first().find( ".ui-icon" );
			this._removeClass( first, null, this.options.icons.up );
			this._addClass( first, null, value.up );
			last = this.buttons.last().find( ".ui-icon" );
			this._removeClass( last, null, this.options.icons.down );
			this._addClass( last, null, value.down );
		}

		this._super( key, value );
	},

	_setOptionDisabled: function( value ) {
		this._super( value );

		this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
		this.element.prop( "disabled", !!value );
		this.buttons.button( value ? "disable" : "enable" );
	},

	_setOptions: spinnerModifer( function( options ) {
		this._super( options );
	} ),

	_parse: function( val ) {
		if ( typeof val === "string" && val !== "" ) {
			val = window.Globalize && this.options.numberFormat ?
				Globalize.parseFloat( val, 10, this.options.culture ) : +val;
		}
		return val === "" || isNaN( val ) ? null : val;
	},

	_format: function( value ) {
		if ( value === "" ) {
			return "";
		}
		return window.Globalize && this.options.numberFormat ?
			Globalize.format( value, this.options.numberFormat, this.options.culture ) :
			value;
	},

	_refresh: function() {
		this.element.attr( {
			"aria-valuemin": this.options.min,
			"aria-valuemax": this.options.max,

			// TODO: what should we do with values that can't be parsed?
			"aria-valuenow": this._parse( this.element.val() )
		} );
	},

	isValid: function() {
		var value = this.value();

		// Null is invalid
		if ( value === null ) {
			return false;
		}

		// If value gets adjusted, it's invalid
		return value === this._adjustValue( value );
	},

	// Update the value without triggering change
	_value: function( value, allowAny ) {
		var parsed;
		if ( value !== "" ) {
			parsed = this._parse( value );
			if ( parsed !== null ) {
				if ( !allowAny ) {
					parsed = this._adjustValue( parsed );
				}
				value = this._format( parsed );
			}
		}
		this.element.val( value );
		this._refresh();
	},

	_destroy: function() {
		this.element
			.prop( "disabled", false )
			.removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );

		this.uiSpinner.replaceWith( this.element );
	},

	stepUp: spinnerModifer( function( steps ) {
		this._stepUp( steps );
	} ),
	_stepUp: function( steps ) {
		if ( this._start() ) {
			this._spin( ( steps || 1 ) * this.options.step );
			this._stop();
		}
	},

	stepDown: spinnerModifer( function( steps ) {
		this._stepDown( steps );
	} ),
	_stepDown: function( steps ) {
		if ( this._start() ) {
			this._spin( ( steps || 1 ) * -this.options.step );
			this._stop();
		}
	},

	pageUp: spinnerModifer( function( pages ) {
		this._stepUp( ( pages || 1 ) * this.options.page );
	} ),

	pageDown: spinnerModifer( function( pages ) {
		this._stepDown( ( pages || 1 ) * this.options.page );
	} ),

	value: function( newVal ) {
		if ( !arguments.length ) {
			return this._parse( this.element.val() );
		}
		spinnerModifer( this._value ).call( this, newVal );
	},

	widget: function() {
		return this.uiSpinner;
	}
} );

// DEPRECATED
// TODO: switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {

	// Backcompat for spinner html extension points
	$.widget( "ui.spinner", $.ui.spinner, {
		_enhance: function() {
			this.uiSpinner = this.element
				.attr( "autocomplete", "off" )
				.wrap( this._uiSpinnerHtml() )
				.parent()

					// Add buttons
					.append( this._buttonHtml() );
		},
		_uiSpinnerHtml: function() {
			return "<span>";
		},

		_buttonHtml: function() {
			return "<a></a><a></a>";
		}
	} );
}

var widgetsSpinner = $.ui.spinner;


/*!
 * jQuery UI Tabs 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Tabs
//>>group: Widgets
//>>description: Transforms a set of container elements into a tab structure.
//>>docs: http://api.jqueryui.com/tabs/
//>>demos: http://jqueryui.com/tabs/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/tabs.css
//>>css.theme: ../../themes/base/theme.css



$.widget( "ui.tabs", {
	version: "1.12.1",
	delay: 300,
	options: {
		active: null,
		classes: {
			"ui-tabs": "ui-corner-all",
			"ui-tabs-nav": "ui-corner-all",
			"ui-tabs-panel": "ui-corner-bottom",
			"ui-tabs-tab": "ui-corner-top"
		},
		collapsible: false,
		event: "click",
		heightStyle: "content",
		hide: null,
		show: null,

		// Callbacks
		activate: null,
		beforeActivate: null,
		beforeLoad: null,
		load: null
	},

	_isLocal: ( function() {
		var rhash = /#.*$/;

		return function( anchor ) {
			var anchorUrl, locationUrl;

			anchorUrl = anchor.href.replace( rhash, "" );
			locationUrl = location.href.replace( rhash, "" );

			// Decoding may throw an error if the URL isn't UTF-8 (#9518)
			try {
				anchorUrl = decodeURIComponent( anchorUrl );
			} catch ( error ) {}
			try {
				locationUrl = decodeURIComponent( locationUrl );
			} catch ( error ) {}

			return anchor.hash.length > 1 && anchorUrl === locationUrl;
		};
	} )(),

	_create: function() {
		var that = this,
			options = this.options;

		this.running = false;

		this._addClass( "ui-tabs", "ui-widget ui-widget-content" );
		this._toggleClass( "ui-tabs-collapsible", null, options.collapsible );

		this._processTabs();
		options.active = this._initialActive();

		// Take disabling tabs via class attribute from HTML
		// into account and update option properly.
		if ( $.isArray( options.disabled ) ) {
			options.disabled = $.unique( options.disabled.concat(
				$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
					return that.tabs.index( li );
				} )
			) ).sort();
		}

		// Check for length avoids error when initializing empty list
		if ( this.options.active !== false && this.anchors.length ) {
			this.active = this._findActive( options.active );
		} else {
			this.active = $();
		}

		this._refresh();

		if ( this.active.length ) {
			this.load( options.active );
		}
	},

	_initialActive: function() {
		var active = this.options.active,
			collapsible = this.options.collapsible,
			locationHash = location.hash.substring( 1 );

		if ( active === null ) {

			// check the fragment identifier in the URL
			if ( locationHash ) {
				this.tabs.each( function( i, tab ) {
					if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
						active = i;
						return false;
					}
				} );
			}

			// Check for a tab marked active via a class
			if ( active === null ) {
				active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
			}

			// No active tab, set to false
			if ( active === null || active === -1 ) {
				active = this.tabs.length ? 0 : false;
			}
		}

		// Handle numbers: negative, out of range
		if ( active !== false ) {
			active = this.tabs.index( this.tabs.eq( active ) );
			if ( active === -1 ) {
				active = collapsible ? false : 0;
			}
		}

		// Don't allow collapsible: false and active: false
		if ( !collapsible && active === false && this.anchors.length ) {
			active = 0;
		}

		return active;
	},

	_getCreateEventData: function() {
		return {
			tab: this.active,
			panel: !this.active.length ? $() : this._getPanelForTab( this.active )
		};
	},

	_tabKeydown: function( event ) {
		var focusedTab = $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( "li" ),
			selectedIndex = this.tabs.index( focusedTab ),
			goingForward = true;

		if ( this._handlePageNav( event ) ) {
			return;
		}

		switch ( event.keyCode ) {
		case $.ui.keyCode.RIGHT:
		case $.ui.keyCode.DOWN:
			selectedIndex++;
			break;
		case $.ui.keyCode.UP:
		case $.ui.keyCode.LEFT:
			goingForward = false;
			selectedIndex--;
			break;
		case $.ui.keyCode.END:
			selectedIndex = this.anchors.length - 1;
			break;
		case $.ui.keyCode.HOME:
			selectedIndex = 0;
			break;
		case $.ui.keyCode.SPACE:

			// Activate only, no collapsing
			event.preventDefault();
			clearTimeout( this.activating );
			this._activate( selectedIndex );
			return;
		case $.ui.keyCode.ENTER:

			// Toggle (cancel delayed activation, allow collapsing)
			event.preventDefault();
			clearTimeout( this.activating );

			// Determine if we should collapse or activate
			this._activate( selectedIndex === this.options.active ? false : selectedIndex );
			return;
		default:
			return;
		}

		// Focus the appropriate tab, based on which key was pressed
		event.preventDefault();
		clearTimeout( this.activating );
		selectedIndex = this._focusNextTab( selectedIndex, goingForward );

		// Navigating with control/command key will prevent automatic activation
		if ( !event.ctrlKey && !event.metaKey ) {

			// Update aria-selected immediately so that AT think the tab is already selected.
			// Otherwise AT may confuse the user by stating that they need to activate the tab,
			// but the tab will already be activated by the time the announcement finishes.
			focusedTab.attr( "aria-selected", "false" );
			this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );

			this.activating = this._delay( function() {
				this.option( "active", selectedIndex );
			}, this.delay );
		}
	},

	_panelKeydown: function( event ) {
		if ( this._handlePageNav( event ) ) {
			return;
		}

		// Ctrl+up moves focus to the current tab
		if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
			event.preventDefault();
			this.active.trigger( "focus" );
		}
	},

	// Alt+page up/down moves focus to the previous/next tab (and activates)
	_handlePageNav: function( event ) {
		if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
			this._activate( this._focusNextTab( this.options.active - 1, false ) );
			return true;
		}
		if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
			this._activate( this._focusNextTab( this.options.active + 1, true ) );
			return true;
		}
	},

	_findNextTab: function( index, goingForward ) {
		var lastTabIndex = this.tabs.length - 1;

		function constrain() {
			if ( index > lastTabIndex ) {
				index = 0;
			}
			if ( index < 0 ) {
				index = lastTabIndex;
			}
			return index;
		}

		while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
			index = goingForward ? index + 1 : index - 1;
		}

		return index;
	},

	_focusNextTab: function( index, goingForward ) {
		index = this._findNextTab( index, goingForward );
		this.tabs.eq( index ).trigger( "focus" );
		return index;
	},

	_setOption: function( key, value ) {
		if ( key === "active" ) {

			// _activate() will handle invalid values and update this.options
			this._activate( value );
			return;
		}

		this._super( key, value );

		if ( key === "collapsible" ) {
			this._toggleClass( "ui-tabs-collapsible", null, value );

			// Setting collapsible: false while collapsed; open first panel
			if ( !value && this.options.active === false ) {
				this._activate( 0 );
			}
		}

		if ( key === "event" ) {
			this._setupEvents( value );
		}

		if ( key === "heightStyle" ) {
			this._setupHeightStyle( value );
		}
	},

	_sanitizeSelector: function( hash ) {
		return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
	},

	refresh: function() {
		var options = this.options,
			lis = this.tablist.children( ":has(a[href])" );

		// Get disabled tabs from class attribute from HTML
		// this will get converted to a boolean if needed in _refresh()
		options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
			return lis.index( tab );
		} );

		this._processTabs();

		// Was collapsed or no tabs
		if ( options.active === false || !this.anchors.length ) {
			options.active = false;
			this.active = $();

		// was active, but active tab is gone
		} else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {

			// all remaining tabs are disabled
			if ( this.tabs.length === options.disabled.length ) {
				options.active = false;
				this.active = $();

			// activate previous tab
			} else {
				this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
			}

		// was active, active tab still exists
		} else {

			// make sure active index is correct
			options.active = this.tabs.index( this.active );
		}

		this._refresh();
	},

	_refresh: function() {
		this._setOptionDisabled( this.options.disabled );
		this._setupEvents( this.options.event );
		this._setupHeightStyle( this.options.heightStyle );

		this.tabs.not( this.active ).attr( {
			"aria-selected": "false",
			"aria-expanded": "false",
			tabIndex: -1
		} );
		this.panels.not( this._getPanelForTab( this.active ) )
			.hide()
			.attr( {
				"aria-hidden": "true"
			} );

		// Make sure one tab is in the tab order
		if ( !this.active.length ) {
			this.tabs.eq( 0 ).attr( "tabIndex", 0 );
		} else {
			this.active
				.attr( {
					"aria-selected": "true",
					"aria-expanded": "true",
					tabIndex: 0
				} );
			this._addClass( this.active, "ui-tabs-active", "ui-state-active" );
			this._getPanelForTab( this.active )
				.show()
				.attr( {
					"aria-hidden": "false"
				} );
		}
	},

	_processTabs: function() {
		var that = this,
			prevTabs = this.tabs,
			prevAnchors = this.anchors,
			prevPanels = this.panels;

		this.tablist = this._getList().attr( "role", "tablist" );
		this._addClass( this.tablist, "ui-tabs-nav",
			"ui-helper-reset ui-helper-clearfix ui-widget-header" );

		// Prevent users from focusing disabled tabs via click
		this.tablist
			.on( "mousedown" + this.eventNamespace, "> li", function( event ) {
				if ( $( this ).is( ".ui-state-disabled" ) ) {
					event.preventDefault();
				}
			} )

			// Support: IE <9
			// Preventing the default action in mousedown doesn't prevent IE
			// from focusing the element, so if the anchor gets focused, blur.
			// We don't have to worry about focusing the previously focused
			// element since clicking on a non-focusable element should focus
			// the body anyway.
			.on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
				if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
					this.blur();
				}
			} );

		this.tabs = this.tablist.find( "> li:has(a[href])" )
			.attr( {
				role: "tab",
				tabIndex: -1
			} );
		this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" );

		this.anchors = this.tabs.map( function() {
			return $( "a", this )[ 0 ];
		} )
			.attr( {
				role: "presentation",
				tabIndex: -1
			} );
		this._addClass( this.anchors, "ui-tabs-anchor" );

		this.panels = $();

		this.anchors.each( function( i, anchor ) {
			var selector, panel, panelId,
				anchorId = $( anchor ).uniqueId().attr( "id" ),
				tab = $( anchor ).closest( "li" ),
				originalAriaControls = tab.attr( "aria-controls" );

			// Inline tab
			if ( that._isLocal( anchor ) ) {
				selector = anchor.hash;
				panelId = selector.substring( 1 );
				panel = that.element.find( that._sanitizeSelector( selector ) );

			// remote tab
			} else {

				// If the tab doesn't already have aria-controls,
				// generate an id by using a throw-away element
				panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
				selector = "#" + panelId;
				panel = that.element.find( selector );
				if ( !panel.length ) {
					panel = that._createPanel( panelId );
					panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
				}
				panel.attr( "aria-live", "polite" );
			}

			if ( panel.length ) {
				that.panels = that.panels.add( panel );
			}
			if ( originalAriaControls ) {
				tab.data( "ui-tabs-aria-controls", originalAriaControls );
			}
			tab.attr( {
				"aria-controls": panelId,
				"aria-labelledby": anchorId
			} );
			panel.attr( "aria-labelledby", anchorId );
		} );

		this.panels.attr( "role", "tabpanel" );
		this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" );

		// Avoid memory leaks (#10056)
		if ( prevTabs ) {
			this._off( prevTabs.not( this.tabs ) );
			this._off( prevAnchors.not( this.anchors ) );
			this._off( prevPanels.not( this.panels ) );
		}
	},

	// Allow overriding how to find the list for rare usage scenarios (#7715)
	_getList: function() {
		return this.tablist || this.element.find( "ol, ul" ).eq( 0 );
	},

	_createPanel: function( id ) {
		return $( "<div>" )
			.attr( "id", id )
			.data( "ui-tabs-destroy", true );
	},

	_setOptionDisabled: function( disabled ) {
		var currentItem, li, i;

		if ( $.isArray( disabled ) ) {
			if ( !disabled.length ) {
				disabled = false;
			} else if ( disabled.length === this.anchors.length ) {
				disabled = true;
			}
		}

		// Disable tabs
		for ( i = 0; ( li = this.tabs[ i ] ); i++ ) {
			currentItem = $( li );
			if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
				currentItem.attr( "aria-disabled", "true" );
				this._addClass( currentItem, null, "ui-state-disabled" );
			} else {
				currentItem.removeAttr( "aria-disabled" );
				this._removeClass( currentItem, null, "ui-state-disabled" );
			}
		}

		this.options.disabled = disabled;

		this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
			disabled === true );
	},

	_setupEvents: function( event ) {
		var events = {};
		if ( event ) {
			$.each( event.split( " " ), function( index, eventName ) {
				events[ eventName ] = "_eventHandler";
			} );
		}

		this._off( this.anchors.add( this.tabs ).add( this.panels ) );

		// Always prevent the default action, even when disabled
		this._on( true, this.anchors, {
			click: function( event ) {
				event.preventDefault();
			}
		} );
		this._on( this.anchors, events );
		this._on( this.tabs, { keydown: "_tabKeydown" } );
		this._on( this.panels, { keydown: "_panelKeydown" } );

		this._focusable( this.tabs );
		this._hoverable( this.tabs );
	},

	_setupHeightStyle: function( heightStyle ) {
		var maxHeight,
			parent = this.element.parent();

		if ( heightStyle === "fill" ) {
			maxHeight = parent.height();
			maxHeight -= this.element.outerHeight() - this.element.height();

			this.element.siblings( ":visible" ).each( function() {
				var elem = $( this ),
					position = elem.css( "position" );

				if ( position === "absolute" || position === "fixed" ) {
					return;
				}
				maxHeight -= elem.outerHeight( true );
			} );

			this.element.children().not( this.panels ).each( function() {
				maxHeight -= $( this ).outerHeight( true );
			} );

			this.panels.each( function() {
				$( this ).height( Math.max( 0, maxHeight -
					$( this ).innerHeight() + $( this ).height() ) );
			} )
				.css( "overflow", "auto" );
		} else if ( heightStyle === "auto" ) {
			maxHeight = 0;
			this.panels.each( function() {
				maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
			} ).height( maxHeight );
		}
	},

	_eventHandler: function( event ) {
		var options = this.options,
			active = this.active,
			anchor = $( event.currentTarget ),
			tab = anchor.closest( "li" ),
			clickedIsActive = tab[ 0 ] === active[ 0 ],
			collapsing = clickedIsActive && options.collapsible,
			toShow = collapsing ? $() : this._getPanelForTab( tab ),
			toHide = !active.length ? $() : this._getPanelForTab( active ),
			eventData = {
				oldTab: active,
				oldPanel: toHide,
				newTab: collapsing ? $() : tab,
				newPanel: toShow
			};

		event.preventDefault();

		if ( tab.hasClass( "ui-state-disabled" ) ||

				// tab is already loading
				tab.hasClass( "ui-tabs-loading" ) ||

				// can't switch durning an animation
				this.running ||

				// click on active header, but not collapsible
				( clickedIsActive && !options.collapsible ) ||

				// allow canceling activation
				( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
			return;
		}

		options.active = collapsing ? false : this.tabs.index( tab );

		this.active = clickedIsActive ? $() : tab;
		if ( this.xhr ) {
			this.xhr.abort();
		}

		if ( !toHide.length && !toShow.length ) {
			$.error( "jQuery UI Tabs: Mismatching fragment identifier." );
		}

		if ( toShow.length ) {
			this.load( this.tabs.index( tab ), event );
		}
		this._toggle( event, eventData );
	},

	// Handles show/hide for selecting tabs
	_toggle: function( event, eventData ) {
		var that = this,
			toShow = eventData.newPanel,
			toHide = eventData.oldPanel;

		this.running = true;

		function complete() {
			that.running = false;
			that._trigger( "activate", event, eventData );
		}

		function show() {
			that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" );

			if ( toShow.length && that.options.show ) {
				that._show( toShow, that.options.show, complete );
			} else {
				toShow.show();
				complete();
			}
		}

		// Start out by hiding, then showing, then completing
		if ( toHide.length && this.options.hide ) {
			this._hide( toHide, this.options.hide, function() {
				that._removeClass( eventData.oldTab.closest( "li" ),
					"ui-tabs-active", "ui-state-active" );
				show();
			} );
		} else {
			this._removeClass( eventData.oldTab.closest( "li" ),
				"ui-tabs-active", "ui-state-active" );
			toHide.hide();
			show();
		}

		toHide.attr( "aria-hidden", "true" );
		eventData.oldTab.attr( {
			"aria-selected": "false",
			"aria-expanded": "false"
		} );

		// If we're switching tabs, remove the old tab from the tab order.
		// If we're opening from collapsed state, remove the previous tab from the tab order.
		// If we're collapsing, then keep the collapsing tab in the tab order.
		if ( toShow.length && toHide.length ) {
			eventData.oldTab.attr( "tabIndex", -1 );
		} else if ( toShow.length ) {
			this.tabs.filter( function() {
				return $( this ).attr( "tabIndex" ) === 0;
			} )
				.attr( "tabIndex", -1 );
		}

		toShow.attr( "aria-hidden", "false" );
		eventData.newTab.attr( {
			"aria-selected": "true",
			"aria-expanded": "true",
			tabIndex: 0
		} );
	},

	_activate: function( index ) {
		var anchor,
			active = this._findActive( index );

		// Trying to activate the already active panel
		if ( active[ 0 ] === this.active[ 0 ] ) {
			return;
		}

		// Trying to collapse, simulate a click on the current active header
		if ( !active.length ) {
			active = this.active;
		}

		anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
		this._eventHandler( {
			target: anchor,
			currentTarget: anchor,
			preventDefault: $.noop
		} );
	},

	_findActive: function( index ) {
		return index === false ? $() : this.tabs.eq( index );
	},

	_getIndex: function( index ) {

		// meta-function to give users option to provide a href string instead of a numerical index.
		if ( typeof index === "string" ) {
			index = this.anchors.index( this.anchors.filter( "[href$='" +
				$.ui.escapeSelector( index ) + "']" ) );
		}

		return index;
	},

	_destroy: function() {
		if ( this.xhr ) {
			this.xhr.abort();
		}

		this.tablist
			.removeAttr( "role" )
			.off( this.eventNamespace );

		this.anchors
			.removeAttr( "role tabIndex" )
			.removeUniqueId();

		this.tabs.add( this.panels ).each( function() {
			if ( $.data( this, "ui-tabs-destroy" ) ) {
				$( this ).remove();
			} else {
				$( this ).removeAttr( "role tabIndex " +
					"aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" );
			}
		} );

		this.tabs.each( function() {
			var li = $( this ),
				prev = li.data( "ui-tabs-aria-controls" );
			if ( prev ) {
				li
					.attr( "aria-controls", prev )
					.removeData( "ui-tabs-aria-controls" );
			} else {
				li.removeAttr( "aria-controls" );
			}
		} );

		this.panels.show();

		if ( this.options.heightStyle !== "content" ) {
			this.panels.css( "height", "" );
		}
	},

	enable: function( index ) {
		var disabled = this.options.disabled;
		if ( disabled === false ) {
			return;
		}

		if ( index === undefined ) {
			disabled = false;
		} else {
			index = this._getIndex( index );
			if ( $.isArray( disabled ) ) {
				disabled = $.map( disabled, function( num ) {
					return num !== index ? num : null;
				} );
			} else {
				disabled = $.map( this.tabs, function( li, num ) {
					return num !== index ? num : null;
				} );
			}
		}
		this._setOptionDisabled( disabled );
	},

	disable: function( index ) {
		var disabled = this.options.disabled;
		if ( disabled === true ) {
			return;
		}

		if ( index === undefined ) {
			disabled = true;
		} else {
			index = this._getIndex( index );
			if ( $.inArray( index, disabled ) !== -1 ) {
				return;
			}
			if ( $.isArray( disabled ) ) {
				disabled = $.merge( [ index ], disabled ).sort();
			} else {
				disabled = [ index ];
			}
		}
		this._setOptionDisabled( disabled );
	},

	load: function( index, event ) {
		index = this._getIndex( index );
		var that = this,
			tab = this.tabs.eq( index ),
			anchor = tab.find( ".ui-tabs-anchor" ),
			panel = this._getPanelForTab( tab ),
			eventData = {
				tab: tab,
				panel: panel
			},
			complete = function( jqXHR, status ) {
				if ( status === "abort" ) {
					that.panels.stop( false, true );
				}

				that._removeClass( tab, "ui-tabs-loading" );
				panel.removeAttr( "aria-busy" );

				if ( jqXHR === that.xhr ) {
					delete that.xhr;
				}
			};

		// Not remote
		if ( this._isLocal( anchor[ 0 ] ) ) {
			return;
		}

		this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );

		// Support: jQuery <1.8
		// jQuery <1.8 returns false if the request is canceled in beforeSend,
		// but as of 1.8, $.ajax() always returns a jqXHR object.
		if ( this.xhr && this.xhr.statusText !== "canceled" ) {
			this._addClass( tab, "ui-tabs-loading" );
			panel.attr( "aria-busy", "true" );

			this.xhr
				.done( function( response, status, jqXHR ) {

					// support: jQuery <1.8
					// http://bugs.jquery.com/ticket/11778
					setTimeout( function() {
						panel.html( response );
						that._trigger( "load", event, eventData );

						complete( jqXHR, status );
					}, 1 );
				} )
				.fail( function( jqXHR, status ) {

					// support: jQuery <1.8
					// http://bugs.jquery.com/ticket/11778
					setTimeout( function() {
						complete( jqXHR, status );
					}, 1 );
				} );
		}
	},

	_ajaxSettings: function( anchor, event, eventData ) {
		var that = this;
		return {

			// Support: IE <11 only
			// Strip any hash that exists to prevent errors with the Ajax request
			url: anchor.attr( "href" ).replace( /#.*$/, "" ),
			beforeSend: function( jqXHR, settings ) {
				return that._trigger( "beforeLoad", event,
					$.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
			}
		};
	},

	_getPanelForTab: function( tab ) {
		var id = $( tab ).attr( "aria-controls" );
		return this.element.find( this._sanitizeSelector( "#" + id ) );
	}
} );

// DEPRECATED
// TODO: Switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {

	// Backcompat for ui-tab class (now ui-tabs-tab)
	$.widget( "ui.tabs", $.ui.tabs, {
		_processTabs: function() {
			this._superApply( arguments );
			this._addClass( this.tabs, "ui-tab" );
		}
	} );
}

var widgetsTabs = $.ui.tabs;


/*!
 * jQuery UI Tooltip 1.12.1
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Tooltip
//>>group: Widgets
//>>description: Shows additional information for any element on hover or focus.
//>>docs: http://api.jqueryui.com/tooltip/
//>>demos: http://jqueryui.com/tooltip/
//>>css.structure: ../../themes/base/core.css
//>>css.structure: ../../themes/base/tooltip.css
//>>css.theme: ../../themes/base/theme.css



$.widget( "ui.tooltip", {
	version: "1.12.1",
	options: {
		classes: {
			"ui-tooltip": "ui-corner-all ui-widget-shadow"
		},
		content: function() {

			// support: IE<9, Opera in jQuery <1.7
			// .text() can't accept undefined, so coerce to a string
			var title = $( this ).attr( "title" ) || "";

			// Escape title, since we're going from an attribute to raw HTML
			return $( "<a>" ).text( title ).html();
		},
		hide: true,

		// Disabled elements have inconsistent behavior across browsers (#8661)
		items: "[title]:not([disabled])",
		position: {
			my: "left top+15",
			at: "left bottom",
			collision: "flipfit flip"
		},
		show: true,
		track: false,

		// Callbacks
		close: null,
		open: null
	},

	_addDescribedBy: function( elem, id ) {
		var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
		describedby.push( id );
		elem
			.data( "ui-tooltip-id", id )
			.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
	},

	_removeDescribedBy: function( elem ) {
		var id = elem.data( "ui-tooltip-id" ),
			describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
			index = $.inArray( id, describedby );

		if ( index !== -1 ) {
			describedby.splice( index, 1 );
		}

		elem.removeData( "ui-tooltip-id" );
		describedby = $.trim( describedby.join( " " ) );
		if ( describedby ) {
			elem.attr( "aria-describedby", describedby );
		} else {
			elem.removeAttr( "aria-describedby" );
		}
	},

	_create: function() {
		this._on( {
			mouseover: "open",
			focusin: "open"
		} );

		// IDs of generated tooltips, needed for destroy
		this.tooltips = {};

		// IDs of parent tooltips where we removed the title attribute
		this.parents = {};

		// Append the aria-live region so tooltips announce correctly
		this.liveRegion = $( "<div>" )
			.attr( {
				role: "log",
				"aria-live": "assertive",
				"aria-relevant": "additions"
			} )
			.appendTo( this.document[ 0 ].body );
		this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );

		this.disabledTitles = $( [] );
	},

	_setOption: function( key, value ) {
		var that = this;

		this._super( key, value );

		if ( key === "content" ) {
			$.each( this.tooltips, function( id, tooltipData ) {
				that._updateContent( tooltipData.element );
			} );
		}
	},

	_setOptionDisabled: function( value ) {
		this[ value ? "_disable" : "_enable" ]();
	},

	_disable: function() {
		var that = this;

		// Close open tooltips
		$.each( this.tooltips, function( id, tooltipData ) {
			var event = $.Event( "blur" );
			event.target = event.currentTarget = tooltipData.element[ 0 ];
			that.close( event, true );
		} );

		// Remove title attributes to prevent native tooltips
		this.disabledTitles = this.disabledTitles.add(
			this.element.find( this.options.items ).addBack()
				.filter( function() {
					var element = $( this );
					if ( element.is( "[title]" ) ) {
						return element
							.data( "ui-tooltip-title", element.attr( "title" ) )
							.removeAttr( "title" );
					}
				} )
		);
	},

	_enable: function() {

		// restore title attributes
		this.disabledTitles.each( function() {
			var element = $( this );
			if ( element.data( "ui-tooltip-title" ) ) {
				element.attr( "title", element.data( "ui-tooltip-title" ) );
			}
		} );
		this.disabledTitles = $( [] );
	},

	open: function( event ) {
		var that = this,
			target = $( event ? event.target : this.element )

				// we need closest here due to mouseover bubbling,
				// but always pointing at the same event target
				.closest( this.options.items );

		// No element to show a tooltip for or the tooltip is already open
		if ( !target.length || target.data( "ui-tooltip-id" ) ) {
			return;
		}

		if ( target.attr( "title" ) ) {
			target.data( "ui-tooltip-title", target.attr( "title" ) );
		}

		target.data( "ui-tooltip-open", true );

		// Kill parent tooltips, custom or native, for hover
		if ( event && event.type === "mouseover" ) {
			target.parents().each( function() {
				var parent = $( this ),
					blurEvent;
				if ( parent.data( "ui-tooltip-open" ) ) {
					blurEvent = $.Event( "blur" );
					blurEvent.target = blurEvent.currentTarget = this;
					that.close( blurEvent, true );
				}
				if ( parent.attr( "title" ) ) {
					parent.uniqueId();
					that.parents[ this.id ] = {
						element: this,
						title: parent.attr( "title" )
					};
					parent.attr( "title", "" );
				}
			} );
		}

		this._registerCloseHandlers( event, target );
		this._updateContent( target, event );
	},

	_updateContent: function( target, event ) {
		var content,
			contentOption = this.options.content,
			that = this,
			eventType = event ? event.type : null;

		if ( typeof contentOption === "string" || contentOption.nodeType ||
				contentOption.jquery ) {
			return this._open( event, target, contentOption );
		}

		content = contentOption.call( target[ 0 ], function( response ) {

			// IE may instantly serve a cached response for ajax requests
			// delay this call to _open so the other call to _open runs first
			that._delay( function() {

				// Ignore async response if tooltip was closed already
				if ( !target.data( "ui-tooltip-open" ) ) {
					return;
				}

				// JQuery creates a special event for focusin when it doesn't
				// exist natively. To improve performance, the native event
				// object is reused and the type is changed. Therefore, we can't
				// rely on the type being correct after the event finished
				// bubbling, so we set it back to the previous value. (#8740)
				if ( event ) {
					event.type = eventType;
				}
				this._open( event, target, response );
			} );
		} );
		if ( content ) {
			this._open( event, target, content );
		}
	},

	_open: function( event, target, content ) {
		var tooltipData, tooltip, delayedShow, a11yContent,
			positionOption = $.extend( {}, this.options.position );

		if ( !content ) {
			return;
		}

		// Content can be updated multiple times. If the tooltip already
		// exists, then just update the content and bail.
		tooltipData = this._find( target );
		if ( tooltipData ) {
			tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
			return;
		}

		// If we have a title, clear it to prevent the native tooltip
		// we have to check first to avoid defining a title if none exists
		// (we don't want to cause an element to start matching [title])
		//
		// We use removeAttr only for key events, to allow IE to export the correct
		// accessible attributes. For mouse events, set to empty string to avoid
		// native tooltip showing up (happens only when removing inside mouseover).
		if ( target.is( "[title]" ) ) {
			if ( event && event.type === "mouseover" ) {
				target.attr( "title", "" );
			} else {
				target.removeAttr( "title" );
			}
		}

		tooltipData = this._tooltip( target );
		tooltip = tooltipData.tooltip;
		this._addDescribedBy( target, tooltip.attr( "id" ) );
		tooltip.find( ".ui-tooltip-content" ).html( content );

		// Support: Voiceover on OS X, JAWS on IE <= 9
		// JAWS announces deletions even when aria-relevant="additions"
		// Voiceover will sometimes re-read the entire log region's contents from the beginning
		this.liveRegion.children().hide();
		a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
		a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
		a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
		a11yContent.appendTo( this.liveRegion );

		function position( event ) {
			positionOption.of = event;
			if ( tooltip.is( ":hidden" ) ) {
				return;
			}
			tooltip.position( positionOption );
		}
		if ( this.options.track && event && /^mouse/.test( event.type ) ) {
			this._on( this.document, {
				mousemove: position
			} );

			// trigger once to override element-relative positioning
			position( event );
		} else {
			tooltip.position( $.extend( {
				of: target
			}, this.options.position ) );
		}

		tooltip.hide();

		this._show( tooltip, this.options.show );

		// Handle tracking tooltips that are shown with a delay (#8644). As soon
		// as the tooltip is visible, position the tooltip using the most recent
		// event.
		// Adds the check to add the timers only when both delay and track options are set (#14682)
		if ( this.options.track && this.options.show && this.options.show.delay ) {
			delayedShow = this.delayedShow = setInterval( function() {
				if ( tooltip.is( ":visible" ) ) {
					position( positionOption.of );
					clearInterval( delayedShow );
				}
			}, $.fx.interval );
		}

		this._trigger( "open", event, { tooltip: tooltip } );
	},

	_registerCloseHandlers: function( event, target ) {
		var events = {
			keyup: function( event ) {
				if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
					var fakeEvent = $.Event( event );
					fakeEvent.currentTarget = target[ 0 ];
					this.close( fakeEvent, true );
				}
			}
		};

		// Only bind remove handler for delegated targets. Non-delegated
		// tooltips will handle this in destroy.
		if ( target[ 0 ] !== this.element[ 0 ] ) {
			events.remove = function() {
				this._removeTooltip( this._find( target ).tooltip );
			};
		}

		if ( !event || event.type === "mouseover" ) {
			events.mouseleave = "close";
		}
		if ( !event || event.type === "focusin" ) {
			events.focusout = "close";
		}
		this._on( true, target, events );
	},

	close: function( event ) {
		var tooltip,
			that = this,
			target = $( event ? event.currentTarget : this.element ),
			tooltipData = this._find( target );

		// The tooltip may already be closed
		if ( !tooltipData ) {

			// We set ui-tooltip-open immediately upon open (in open()), but only set the
			// additional data once there's actually content to show (in _open()). So even if the
			// tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
			// the period between open() and _open().
			target.removeData( "ui-tooltip-open" );
			return;
		}

		tooltip = tooltipData.tooltip;

		// Disabling closes the tooltip, so we need to track when we're closing
		// to avoid an infinite loop in case the tooltip becomes disabled on close
		if ( tooltipData.closing ) {
			return;
		}

		// Clear the interval for delayed tracking tooltips
		clearInterval( this.delayedShow );

		// Only set title if we had one before (see comment in _open())
		// If the title attribute has changed since open(), don't restore
		if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
			target.attr( "title", target.data( "ui-tooltip-title" ) );
		}

		this._removeDescribedBy( target );

		tooltipData.hiding = true;
		tooltip.stop( true );
		this._hide( tooltip, this.options.hide, function() {
			that._removeTooltip( $( this ) );
		} );

		target.removeData( "ui-tooltip-open" );
		this._off( target, "mouseleave focusout keyup" );

		// Remove 'remove' binding only on delegated targets
		if ( target[ 0 ] !== this.element[ 0 ] ) {
			this._off( target, "remove" );
		}
		this._off( this.document, "mousemove" );

		if ( event && event.type === "mouseleave" ) {
			$.each( this.parents, function( id, parent ) {
				$( parent.element ).attr( "title", parent.title );
				delete that.parents[ id ];
			} );
		}

		tooltipData.closing = true;
		this._trigger( "close", event, { tooltip: tooltip } );
		if ( !tooltipData.hiding ) {
			tooltipData.closing = false;
		}
	},

	_tooltip: function( element ) {
		var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
			content = $( "<div>" ).appendTo( tooltip ),
			id = tooltip.uniqueId().attr( "id" );

		this._addClass( content, "ui-tooltip-content" );
		this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );

		tooltip.appendTo( this._appendTo( element ) );

		return this.tooltips[ id ] = {
			element: element,
			tooltip: tooltip
		};
	},

	_find: function( target ) {
		var id = target.data( "ui-tooltip-id" );
		return id ? this.tooltips[ id ] : null;
	},

	_removeTooltip: function( tooltip ) {
		tooltip.remove();
		delete this.tooltips[ tooltip.attr( "id" ) ];
	},

	_appendTo: function( target ) {
		var element = target.closest( ".ui-front, dialog" );

		if ( !element.length ) {
			element = this.document[ 0 ].body;
		}

		return element;
	},

	_destroy: function() {
		var that = this;

		// Close open tooltips
		$.each( this.tooltips, function( id, tooltipData ) {

			// Delegate to close method to handle common cleanup
			var event = $.Event( "blur" ),
				element = tooltipData.element;
			event.target = event.currentTarget = element[ 0 ];
			that.close( event, true );

			// Remove immediately; destroying an open tooltip doesn't use the
			// hide animation
			$( "#" + id ).remove();

			// Restore the title
			if ( element.data( "ui-tooltip-title" ) ) {

				// If the title attribute has changed since open(), don't restore
				if ( !element.attr( "title" ) ) {
					element.attr( "title", element.data( "ui-tooltip-title" ) );
				}
				element.removeData( "ui-tooltip-title" );
			}
		} );
		this.liveRegion.remove();
	}
} );

// DEPRECATED
// TODO: Switch return back to widget declaration at top of file when this is removed
if ( $.uiBackCompat !== false ) {

	// Backcompat for tooltipClass option
	$.widget( "ui.tooltip", $.ui.tooltip, {
		options: {
			tooltipClass: null
		},
		_tooltip: function() {
			var tooltipData = this._superApply( arguments );
			if ( this.options.tooltipClass ) {
				tooltipData.tooltip.addClass( this.options.tooltipClass );
			}
			return tooltipData;
		}
	} );
}

var widgetsTooltip = $.ui.tooltip;




}));
});

define('underscore', function (require, exports, module) {
//     Underscore.js 1.8.3
//     http://underscorejs.org
//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.

(function() {

  // Baseline setup
  // --------------

  // Establish the root object, `window` in the browser, or `exports` on the server.
  var root = this;

  // Save the previous value of the `_` variable.
  var previousUnderscore = root._;

  // Save bytes in the minified (but not gzipped) version:
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;

  // Create quick reference variables for speed access to core prototypes.
  var
    push             = ArrayProto.push,
    slice            = ArrayProto.slice,
    toString         = ObjProto.toString,
    hasOwnProperty   = ObjProto.hasOwnProperty;

  // All **ECMAScript 5** native function implementations that we hope to use
  // are declared here.
  var
    nativeIsArray      = Array.isArray,
    nativeKeys         = Object.keys,
    nativeBind         = FuncProto.bind,
    nativeCreate       = Object.create;

  // Naked function reference for surrogate-prototype-swapping.
  var Ctor = function(){};

  // Create a safe reference to the Underscore object for use below.
  var _ = function(obj) {
    if (obj instanceof _) return obj;
    if (!(this instanceof _)) return new _(obj);
    this._wrapped = obj;
  };

  // Export the Underscore object for **Node.js**, with
  // backwards-compatibility for the old `require()` API. If we're in
  // the browser, add `_` as a global object.
  if (typeof exports !== 'undefined') {
    if (typeof module !== 'undefined' && module.exports) {
      exports = module.exports = _;
    }
    exports._ = _;
  } else {
    root._ = _;
  }

  // Current version.
  _.VERSION = '1.8.3';

  // Internal function that returns an efficient (for current engines) version
  // of the passed-in callback, to be repeatedly applied in other Underscore
  // functions.
  var optimizeCb = function(func, context, argCount) {
    if (context === void 0) return func;
    switch (argCount == null ? 3 : argCount) {
      case 1: return function(value) {
        return func.call(context, value);
      };
      case 2: return function(value, other) {
        return func.call(context, value, other);
      };
      case 3: return function(value, index, collection) {
        return func.call(context, value, index, collection);
      };
      case 4: return function(accumulator, value, index, collection) {
        return func.call(context, accumulator, value, index, collection);
      };
    }
    return function() {
      return func.apply(context, arguments);
    };
  };

  // A mostly-internal function to generate callbacks that can be applied
  // to each element in a collection, returning the desired result — either
  // identity, an arbitrary callback, a property matcher, or a property accessor.
  var cb = function(value, context, argCount) {
    if (value == null) return _.identity;
    if (_.isFunction(value)) return optimizeCb(value, context, argCount);
    if (_.isObject(value)) return _.matcher(value);
    return _.property(value);
  };
  _.iteratee = function(value, context) {
    return cb(value, context, Infinity);
  };

  // An internal function for creating assigner functions.
  var createAssigner = function(keysFunc, undefinedOnly) {
    return function(obj) {
      var length = arguments.length;
      if (length < 2 || obj == null) return obj;
      for (var index = 1; index < length; index++) {
        var source = arguments[index],
            keys = keysFunc(source),
            l = keys.length;
        for (var i = 0; i < l; i++) {
          var key = keys[i];
          if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
        }
      }
      return obj;
    };
  };

  // An internal function for creating a new object that inherits from another.
  var baseCreate = function(prototype) {
    if (!_.isObject(prototype)) return {};
    if (nativeCreate) return nativeCreate(prototype);
    Ctor.prototype = prototype;
    var result = new Ctor;
    Ctor.prototype = null;
    return result;
  };

  var property = function(key) {
    return function(obj) {
      return obj == null ? void 0 : obj[key];
    };
  };

  // Helper for collection methods to determine whether a collection
  // should be iterated as an array or as an object
  // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
  // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
  var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
  var getLength = property('length');
  var isArrayLike = function(collection) {
    var length = getLength(collection);
    return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
  };

  // Collection Functions
  // --------------------

  // The cornerstone, an `each` implementation, aka `forEach`.
  // Handles raw objects in addition to array-likes. Treats all
  // sparse array-likes as if they were dense.
  _.each = _.forEach = function(obj, iteratee, context) {
    iteratee = optimizeCb(iteratee, context);
    var i, length;
    if (isArrayLike(obj)) {
      for (i = 0, length = obj.length; i < length; i++) {
        iteratee(obj[i], i, obj);
      }
    } else {
      var keys = _.keys(obj);
      for (i = 0, length = keys.length; i < length; i++) {
        iteratee(obj[keys[i]], keys[i], obj);
      }
    }
    return obj;
  };

  // Return the results of applying the iteratee to each element.
  _.map = _.collect = function(obj, iteratee, context) {
    iteratee = cb(iteratee, context);
    var keys = !isArrayLike(obj) && _.keys(obj),
        length = (keys || obj).length,
        results = Array(length);
    for (var index = 0; index < length; index++) {
      var currentKey = keys ? keys[index] : index;
      results[index] = iteratee(obj[currentKey], currentKey, obj);
    }
    return results;
  };

  // Create a reducing function iterating left or right.
  function createReduce(dir) {
    // Optimized iterator function as using arguments.length
    // in the main function will deoptimize the, see #1991.
    function iterator(obj, iteratee, memo, keys, index, length) {
      for (; index >= 0 && index < length; index += dir) {
        var currentKey = keys ? keys[index] : index;
        memo = iteratee(memo, obj[currentKey], currentKey, obj);
      }
      return memo;
    }

    return function(obj, iteratee, memo, context) {
      iteratee = optimizeCb(iteratee, context, 4);
      var keys = !isArrayLike(obj) && _.keys(obj),
          length = (keys || obj).length,
          index = dir > 0 ? 0 : length - 1;
      // Determine the initial value if none is provided.
      if (arguments.length < 3) {
        memo = obj[keys ? keys[index] : index];
        index += dir;
      }
      return iterator(obj, iteratee, memo, keys, index, length);
    };
  }

  // **Reduce** builds up a single result from a list of values, aka `inject`,
  // or `foldl`.
  _.reduce = _.foldl = _.inject = createReduce(1);

  // The right-associative version of reduce, also known as `foldr`.
  _.reduceRight = _.foldr = createReduce(-1);

  // Return the first value which passes a truth test. Aliased as `detect`.
  _.find = _.detect = function(obj, predicate, context) {
    var key;
    if (isArrayLike(obj)) {
      key = _.findIndex(obj, predicate, context);
    } else {
      key = _.findKey(obj, predicate, context);
    }
    if (key !== void 0 && key !== -1) return obj[key];
  };

  // Return all the elements that pass a truth test.
  // Aliased as `select`.
  _.filter = _.select = function(obj, predicate, context) {
    var results = [];
    predicate = cb(predicate, context);
    _.each(obj, function(value, index, list) {
      if (predicate(value, index, list)) results.push(value);
    });
    return results;
  };

  // Return all the elements for which a truth test fails.
  _.reject = function(obj, predicate, context) {
    return _.filter(obj, _.negate(cb(predicate)), context);
  };

  // Determine whether all of the elements match a truth test.
  // Aliased as `all`.
  _.every = _.all = function(obj, predicate, context) {
    predicate = cb(predicate, context);
    var keys = !isArrayLike(obj) && _.keys(obj),
        length = (keys || obj).length;
    for (var index = 0; index < length; index++) {
      var currentKey = keys ? keys[index] : index;
      if (!predicate(obj[currentKey], currentKey, obj)) return false;
    }
    return true;
  };

  // Determine if at least one element in the object matches a truth test.
  // Aliased as `any`.
  _.some = _.any = function(obj, predicate, context) {
    predicate = cb(predicate, context);
    var keys = !isArrayLike(obj) && _.keys(obj),
        length = (keys || obj).length;
    for (var index = 0; index < length; index++) {
      var currentKey = keys ? keys[index] : index;
      if (predicate(obj[currentKey], currentKey, obj)) return true;
    }
    return false;
  };

  // Determine if the array or object contains a given item (using `===`).
  // Aliased as `includes` and `include`.
  _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {
    if (!isArrayLike(obj)) obj = _.values(obj);
    if (typeof fromIndex != 'number' || guard) fromIndex = 0;
    return _.indexOf(obj, item, fromIndex) >= 0;
  };

  // Invoke a method (with arguments) on every item in a collection.
  _.invoke = function(obj, method) {
    var args = slice.call(arguments, 2);
    var isFunc = _.isFunction(method);
    return _.map(obj, function(value) {
      var func = isFunc ? method : value[method];
      return func == null ? func : func.apply(value, args);
    });
  };

  // Convenience version of a common use case of `map`: fetching a property.
  _.pluck = function(obj, key) {
    return _.map(obj, _.property(key));
  };

  // Convenience version of a common use case of `filter`: selecting only objects
  // containing specific `key:value` pairs.
  _.where = function(obj, attrs) {
    return _.filter(obj, _.matcher(attrs));
  };

  // Convenience version of a common use case of `find`: getting the first object
  // containing specific `key:value` pairs.
  _.findWhere = function(obj, attrs) {
    return _.find(obj, _.matcher(attrs));
  };

  // Return the maximum element (or element-based computation).
  _.max = function(obj, iteratee, context) {
    var result = -Infinity, lastComputed = -Infinity,
        value, computed;
    if (iteratee == null && obj != null) {
      obj = isArrayLike(obj) ? obj : _.values(obj);
      for (var i = 0, length = obj.length; i < length; i++) {
        value = obj[i];
        if (value > result) {
          result = value;
        }
      }
    } else {
      iteratee = cb(iteratee, context);
      _.each(obj, function(value, index, list) {
        computed = iteratee(value, index, list);
        if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
          result = value;
          lastComputed = computed;
        }
      });
    }
    return result;
  };

  // Return the minimum element (or element-based computation).
  _.min = function(obj, iteratee, context) {
    var result = Infinity, lastComputed = Infinity,
        value, computed;
    if (iteratee == null && obj != null) {
      obj = isArrayLike(obj) ? obj : _.values(obj);
      for (var i = 0, length = obj.length; i < length; i++) {
        value = obj[i];
        if (value < result) {
          result = value;
        }
      }
    } else {
      iteratee = cb(iteratee, context);
      _.each(obj, function(value, index, list) {
        computed = iteratee(value, index, list);
        if (computed < lastComputed || computed === Infinity && result === Infinity) {
          result = value;
          lastComputed = computed;
        }
      });
    }
    return result;
  };

  // Shuffle a collection, using the modern version of the
  // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
  _.shuffle = function(obj) {
    var set = isArrayLike(obj) ? obj : _.values(obj);
    var length = set.length;
    var shuffled = Array(length);
    for (var index = 0, rand; index < length; index++) {
      rand = _.random(0, index);
      if (rand !== index) shuffled[index] = shuffled[rand];
      shuffled[rand] = set[index];
    }
    return shuffled;
  };

  // Sample **n** random values from a collection.
  // If **n** is not specified, returns a single random element.
  // The internal `guard` argument allows it to work with `map`.
  _.sample = function(obj, n, guard) {
    if (n == null || guard) {
      if (!isArrayLike(obj)) obj = _.values(obj);
      return obj[_.random(obj.length - 1)];
    }
    return _.shuffle(obj).slice(0, Math.max(0, n));
  };

  // Sort the object's values by a criterion produced by an iteratee.
  _.sortBy = function(obj, iteratee, context) {
    iteratee = cb(iteratee, context);
    return _.pluck(_.map(obj, function(value, index, list) {
      return {
        value: value,
        index: index,
        criteria: iteratee(value, index, list)
      };
    }).sort(function(left, right) {
      var a = left.criteria;
      var b = right.criteria;
      if (a !== b) {
        if (a > b || a === void 0) return 1;
        if (a < b || b === void 0) return -1;
      }
      return left.index - right.index;
    }), 'value');
  };

  // An internal function used for aggregate "group by" operations.
  var group = function(behavior) {
    return function(obj, iteratee, context) {
      var result = {};
      iteratee = cb(iteratee, context);
      _.each(obj, function(value, index) {
        var key = iteratee(value, index, obj);
        behavior(result, value, key);
      });
      return result;
    };
  };

  // Groups the object's values by a criterion. Pass either a string attribute
  // to group by, or a function that returns the criterion.
  _.groupBy = group(function(result, value, key) {
    if (_.has(result, key)) result[key].push(value); else result[key] = [value];
  });

  // Indexes the object's values by a criterion, similar to `groupBy`, but for
  // when you know that your index values will be unique.
  _.indexBy = group(function(result, value, key) {
    result[key] = value;
  });

  // Counts instances of an object that group by a certain criterion. Pass
  // either a string attribute to count by, or a function that returns the
  // criterion.
  _.countBy = group(function(result, value, key) {
    if (_.has(result, key)) result[key]++; else result[key] = 1;
  });

  // Safely create a real, live array from anything iterable.
  _.toArray = function(obj) {
    if (!obj) return [];
    if (_.isArray(obj)) return slice.call(obj);
    if (isArrayLike(obj)) return _.map(obj, _.identity);
    return _.values(obj);
  };

  // Return the number of elements in an object.
  _.size = function(obj) {
    if (obj == null) return 0;
    return isArrayLike(obj) ? obj.length : _.keys(obj).length;
  };

  // Split a collection into two arrays: one whose elements all satisfy the given
  // predicate, and one whose elements all do not satisfy the predicate.
  _.partition = function(obj, predicate, context) {
    predicate = cb(predicate, context);
    var pass = [], fail = [];
    _.each(obj, function(value, key, obj) {
      (predicate(value, key, obj) ? pass : fail).push(value);
    });
    return [pass, fail];
  };

  // Array Functions
  // ---------------

  // Get the first element of an array. Passing **n** will return the first N
  // values in the array. Aliased as `head` and `take`. The **guard** check
  // allows it to work with `_.map`.
  _.first = _.head = _.take = function(array, n, guard) {
    if (array == null) return void 0;
    if (n == null || guard) return array[0];
    return _.initial(array, array.length - n);
  };

  // Returns everything but the last entry of the array. Especially useful on
  // the arguments object. Passing **n** will return all the values in
  // the array, excluding the last N.
  _.initial = function(array, n, guard) {
    return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
  };

  // Get the last element of an array. Passing **n** will return the last N
  // values in the array.
  _.last = function(array, n, guard) {
    if (array == null) return void 0;
    if (n == null || guard) return array[array.length - 1];
    return _.rest(array, Math.max(0, array.length - n));
  };

  // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
  // Especially useful on the arguments object. Passing an **n** will return
  // the rest N values in the array.
  _.rest = _.tail = _.drop = function(array, n, guard) {
    return slice.call(array, n == null || guard ? 1 : n);
  };

  // Trim out all falsy values from an array.
  _.compact = function(array) {
    return _.filter(array, _.identity);
  };

  // Internal implementation of a recursive `flatten` function.
  var flatten = function(input, shallow, strict, startIndex) {
    var output = [], idx = 0;
    for (var i = startIndex || 0, length = getLength(input); i < length; i++) {
      var value = input[i];
      if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
        //flatten current level of array or arguments object
        if (!shallow) value = flatten(value, shallow, strict);
        var j = 0, len = value.length;
        output.length += len;
        while (j < len) {
          output[idx++] = value[j++];
        }
      } else if (!strict) {
        output[idx++] = value;
      }
    }
    return output;
  };

  // Flatten out an array, either recursively (by default), or just one level.
  _.flatten = function(array, shallow) {
    return flatten(array, shallow, false);
  };

  // Return a version of the array that does not contain the specified value(s).
  _.without = function(array) {
    return _.difference(array, slice.call(arguments, 1));
  };

  // Produce a duplicate-free version of the array. If the array has already
  // been sorted, you have the option of using a faster algorithm.
  // Aliased as `unique`.
  _.uniq = _.unique = function(array, isSorted, iteratee, context) {
    if (!_.isBoolean(isSorted)) {
      context = iteratee;
      iteratee = isSorted;
      isSorted = false;
    }
    if (iteratee != null) iteratee = cb(iteratee, context);
    var result = [];
    var seen = [];
    for (var i = 0, length = getLength(array); i < length; i++) {
      var value = array[i],
          computed = iteratee ? iteratee(value, i, array) : value;
      if (isSorted) {
        if (!i || seen !== computed) result.push(value);
        seen = computed;
      } else if (iteratee) {
        if (!_.contains(seen, computed)) {
          seen.push(computed);
          result.push(value);
        }
      } else if (!_.contains(result, value)) {
        result.push(value);
      }
    }
    return result;
  };

  // Produce an array that contains the union: each distinct element from all of
  // the passed-in arrays.
  _.union = function() {
    return _.uniq(flatten(arguments, true, true));
  };

  // Produce an array that contains every item shared between all the
  // passed-in arrays.
  _.intersection = function(array) {
    var result = [];
    var argsLength = arguments.length;
    for (var i = 0, length = getLength(array); i < length; i++) {
      var item = array[i];
      if (_.contains(result, item)) continue;
      for (var j = 1; j < argsLength; j++) {
        if (!_.contains(arguments[j], item)) break;
      }
      if (j === argsLength) result.push(item);
    }
    return result;
  };

  // Take the difference between one array and a number of other arrays.
  // Only the elements present in just the first array will remain.
  _.difference = function(array) {
    var rest = flatten(arguments, true, true, 1);
    return _.filter(array, function(value){
      return !_.contains(rest, value);
    });
  };

  // Zip together multiple lists into a single array -- elements that share
  // an index go together.
  _.zip = function() {
    return _.unzip(arguments);
  };

  // Complement of _.zip. Unzip accepts an array of arrays and groups
  // each array's elements on shared indices
  _.unzip = function(array) {
    var length = array && _.max(array, getLength).length || 0;
    var result = Array(length);

    for (var index = 0; index < length; index++) {
      result[index] = _.pluck(array, index);
    }
    return result;
  };

  // Converts lists into objects. Pass either a single array of `[key, value]`
  // pairs, or two parallel arrays of the same length -- one of keys, and one of
  // the corresponding values.
  _.object = function(list, values) {
    var result = {};
    for (var i = 0, length = getLength(list); i < length; i++) {
      if (values) {
        result[list[i]] = values[i];
      } else {
        result[list[i][0]] = list[i][1];
      }
    }
    return result;
  };

  // Generator function to create the findIndex and findLastIndex functions
  function createPredicateIndexFinder(dir) {
    return function(array, predicate, context) {
      predicate = cb(predicate, context);
      var length = getLength(array);
      var index = dir > 0 ? 0 : length - 1;
      for (; index >= 0 && index < length; index += dir) {
        if (predicate(array[index], index, array)) return index;
      }
      return -1;
    };
  }

  // Returns the first index on an array-like that passes a predicate test
  _.findIndex = createPredicateIndexFinder(1);
  _.findLastIndex = createPredicateIndexFinder(-1);

  // Use a comparator function to figure out the smallest index at which
  // an object should be inserted so as to maintain order. Uses binary search.
  _.sortedIndex = function(array, obj, iteratee, context) {
    iteratee = cb(iteratee, context, 1);
    var value = iteratee(obj);
    var low = 0, high = getLength(array);
    while (low < high) {
      var mid = Math.floor((low + high) / 2);
      if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
    }
    return low;
  };

  // Generator function to create the indexOf and lastIndexOf functions
  function createIndexFinder(dir, predicateFind, sortedIndex) {
    return function(array, item, idx) {
      var i = 0, length = getLength(array);
      if (typeof idx == 'number') {
        if (dir > 0) {
            i = idx >= 0 ? idx : Math.max(idx + length, i);
        } else {
            length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
        }
      } else if (sortedIndex && idx && length) {
        idx = sortedIndex(array, item);
        return array[idx] === item ? idx : -1;
      }
      if (item !== item) {
        idx = predicateFind(slice.call(array, i, length), _.isNaN);
        return idx >= 0 ? idx + i : -1;
      }
      for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
        if (array[idx] === item) return idx;
      }
      return -1;
    };
  }

  // Return the position of the first occurrence of an item in an array,
  // or -1 if the item is not included in the array.
  // If the array is large and already in sort order, pass `true`
  // for **isSorted** to use binary search.
  _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);
  _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);

  // Generate an integer Array containing an arithmetic progression. A port of
  // the native Python `range()` function. See
  // [the Python documentation](http://docs.python.org/library/functions.html#range).
  _.range = function(start, stop, step) {
    if (stop == null) {
      stop = start || 0;
      start = 0;
    }
    step = step || 1;

    var length = Math.max(Math.ceil((stop - start) / step), 0);
    var range = Array(length);

    for (var idx = 0; idx < length; idx++, start += step) {
      range[idx] = start;
    }

    return range;
  };

  // Function (ahem) Functions
  // ------------------

  // Determines whether to execute a function as a constructor
  // or a normal function with the provided arguments
  var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {
    if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
    var self = baseCreate(sourceFunc.prototype);
    var result = sourceFunc.apply(self, args);
    if (_.isObject(result)) return result;
    return self;
  };

  // Create a function bound to a given object (assigning `this`, and arguments,
  // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
  // available.
  _.bind = function(func, context) {
    if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
    if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
    var args = slice.call(arguments, 2);
    var bound = function() {
      return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));
    };
    return bound;
  };

  // Partially apply a function by creating a version that has had some of its
  // arguments pre-filled, without changing its dynamic `this` context. _ acts
  // as a placeholder, allowing any combination of arguments to be pre-filled.
  _.partial = function(func) {
    var boundArgs = slice.call(arguments, 1);
    var bound = function() {
      var position = 0, length = boundArgs.length;
      var args = Array(length);
      for (var i = 0; i < length; i++) {
        args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];
      }
      while (position < arguments.length) args.push(arguments[position++]);
      return executeBound(func, bound, this, this, args);
    };
    return bound;
  };

  // Bind a number of an object's methods to that object. Remaining arguments
  // are the method names to be bound. Useful for ensuring that all callbacks
  // defined on an object belong to it.
  _.bindAll = function(obj) {
    var i, length = arguments.length, key;
    if (length <= 1) throw new Error('bindAll must be passed function names');
    for (i = 1; i < length; i++) {
      key = arguments[i];
      obj[key] = _.bind(obj[key], obj);
    }
    return obj;
  };

  // Memoize an expensive function by storing its results.
  _.memoize = function(func, hasher) {
    var memoize = function(key) {
      var cache = memoize.cache;
      var address = '' + (hasher ? hasher.apply(this, arguments) : key);
      if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
      return cache[address];
    };
    memoize.cache = {};
    return memoize;
  };

  // Delays a function for the given number of milliseconds, and then calls
  // it with the arguments supplied.
  _.delay = function(func, wait) {
    var args = slice.call(arguments, 2);
    return setTimeout(function(){
      return func.apply(null, args);
    }, wait);
  };

  // Defers a function, scheduling it to run after the current call stack has
  // cleared.
  _.defer = _.partial(_.delay, _, 1);

  // Returns a function, that, when invoked, will only be triggered at most once
  // during a given window of time. Normally, the throttled function will run
  // as much as it can, without ever going more than once per `wait` duration;
  // but if you'd like to disable the execution on the leading edge, pass
  // `{leading: false}`. To disable execution on the trailing edge, ditto.
  _.throttle = function(func, wait, options) {
    var context, args, result;
    var timeout = null;
    var previous = 0;
    if (!options) options = {};
    var later = function() {
      previous = options.leading === false ? 0 : _.now();
      timeout = null;
      result = func.apply(context, args);
      if (!timeout) context = args = null;
    };
    return function() {
      var now = _.now();
      if (!previous && options.leading === false) previous = now;
      var remaining = wait - (now - previous);
      context = this;
      args = arguments;
      if (remaining <= 0 || remaining > wait) {
        if (timeout) {
          clearTimeout(timeout);
          timeout = null;
        }
        previous = now;
        result = func.apply(context, args);
        if (!timeout) context = args = null;
      } else if (!timeout && options.trailing !== false) {
        timeout = setTimeout(later, remaining);
      }
      return result;
    };
  };

  // Returns a function, that, as long as it continues to be invoked, will not
  // be triggered. The function will be called after it stops being called for
  // N milliseconds. If `immediate` is passed, trigger the function on the
  // leading edge, instead of the trailing.
  _.debounce = function(func, wait, immediate) {
    var timeout, args, context, timestamp, result;

    var later = function() {
      var last = _.now() - timestamp;

      if (last < wait && last >= 0) {
        timeout = setTimeout(later, wait - last);
      } else {
        timeout = null;
        if (!immediate) {
          result = func.apply(context, args);
          if (!timeout) context = args = null;
        }
      }
    };

    return function() {
      context = this;
      args = arguments;
      timestamp = _.now();
      var callNow = immediate && !timeout;
      if (!timeout) timeout = setTimeout(later, wait);
      if (callNow) {
        result = func.apply(context, args);
        context = args = null;
      }

      return result;
    };
  };

  // Returns the first function passed as an argument to the second,
  // allowing you to adjust arguments, run code before and after, and
  // conditionally execute the original function.
  _.wrap = function(func, wrapper) {
    return _.partial(wrapper, func);
  };

  // Returns a negated version of the passed-in predicate.
  _.negate = function(predicate) {
    return function() {
      return !predicate.apply(this, arguments);
    };
  };

  // Returns a function that is the composition of a list of functions, each
  // consuming the return value of the function that follows.
  _.compose = function() {
    var args = arguments;
    var start = args.length - 1;
    return function() {
      var i = start;
      var result = args[start].apply(this, arguments);
      while (i--) result = args[i].call(this, result);
      return result;
    };
  };

  // Returns a function that will only be executed on and after the Nth call.
  _.after = function(times, func) {
    return function() {
      if (--times < 1) {
        return func.apply(this, arguments);
      }
    };
  };

  // Returns a function that will only be executed up to (but not including) the Nth call.
  _.before = function(times, func) {
    var memo;
    return function() {
      if (--times > 0) {
        memo = func.apply(this, arguments);
      }
      if (times <= 1) func = null;
      return memo;
    };
  };

  // Returns a function that will be executed at most one time, no matter how
  // often you call it. Useful for lazy initialization.
  _.once = _.partial(_.before, 2);

  // Object Functions
  // ----------------

  // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
  var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
  var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
                      'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];

  function collectNonEnumProps(obj, keys) {
    var nonEnumIdx = nonEnumerableProps.length;
    var constructor = obj.constructor;
    var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;

    // Constructor is a special case.
    var prop = 'constructor';
    if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);

    while (nonEnumIdx--) {
      prop = nonEnumerableProps[nonEnumIdx];
      if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
        keys.push(prop);
      }
    }
  }

  // Retrieve the names of an object's own properties.
  // Delegates to **ECMAScript 5**'s native `Object.keys`
  _.keys = function(obj) {
    if (!_.isObject(obj)) return [];
    if (nativeKeys) return nativeKeys(obj);
    var keys = [];
    for (var key in obj) if (_.has(obj, key)) keys.push(key);
    // Ahem, IE < 9.
    if (hasEnumBug) collectNonEnumProps(obj, keys);
    return keys;
  };

  // Retrieve all the property names of an object.
  _.allKeys = function(obj) {
    if (!_.isObject(obj)) return [];
    var keys = [];
    for (var key in obj) keys.push(key);
    // Ahem, IE < 9.
    if (hasEnumBug) collectNonEnumProps(obj, keys);
    return keys;
  };

  // Retrieve the values of an object's properties.
  _.values = function(obj) {
    var keys = _.keys(obj);
    var length = keys.length;
    var values = Array(length);
    for (var i = 0; i < length; i++) {
      values[i] = obj[keys[i]];
    }
    return values;
  };

  // Returns the results of applying the iteratee to each element of the object
  // In contrast to _.map it returns an object
  _.mapObject = function(obj, iteratee, context) {
    iteratee = cb(iteratee, context);
    var keys =  _.keys(obj),
          length = keys.length,
          results = {},
          currentKey;
      for (var index = 0; index < length; index++) {
        currentKey = keys[index];
        results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
      }
      return results;
  };

  // Convert an object into a list of `[key, value]` pairs.
  _.pairs = function(obj) {
    var keys = _.keys(obj);
    var length = keys.length;
    var pairs = Array(length);
    for (var i = 0; i < length; i++) {
      pairs[i] = [keys[i], obj[keys[i]]];
    }
    return pairs;
  };

  // Invert the keys and values of an object. The values must be serializable.
  _.invert = function(obj) {
    var result = {};
    var keys = _.keys(obj);
    for (var i = 0, length = keys.length; i < length; i++) {
      result[obj[keys[i]]] = keys[i];
    }
    return result;
  };

  // Return a sorted list of the function names available on the object.
  // Aliased as `methods`
  _.functions = _.methods = function(obj) {
    var names = [];
    for (var key in obj) {
      if (_.isFunction(obj[key])) names.push(key);
    }
    return names.sort();
  };

  // Extend a given object with all the properties in passed-in object(s).
  _.extend = createAssigner(_.allKeys);

  // Assigns a given object with all the own properties in the passed-in object(s)
  // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
  _.extendOwn = _.assign = createAssigner(_.keys);

  // Returns the first key on an object that passes a predicate test
  _.findKey = function(obj, predicate, context) {
    predicate = cb(predicate, context);
    var keys = _.keys(obj), key;
    for (var i = 0, length = keys.length; i < length; i++) {
      key = keys[i];
      if (predicate(obj[key], key, obj)) return key;
    }
  };

  // Return a copy of the object only containing the whitelisted properties.
  _.pick = function(object, oiteratee, context) {
    var result = {}, obj = object, iteratee, keys;
    if (obj == null) return result;
    if (_.isFunction(oiteratee)) {
      keys = _.allKeys(obj);
      iteratee = optimizeCb(oiteratee, context);
    } else {
      keys = flatten(arguments, false, false, 1);
      iteratee = function(value, key, obj) { return key in obj; };
      obj = Object(obj);
    }
    for (var i = 0, length = keys.length; i < length; i++) {
      var key = keys[i];
      var value = obj[key];
      if (iteratee(value, key, obj)) result[key] = value;
    }
    return result;
  };

   // Return a copy of the object without the blacklisted properties.
  _.omit = function(obj, iteratee, context) {
    if (_.isFunction(iteratee)) {
      iteratee = _.negate(iteratee);
    } else {
      var keys = _.map(flatten(arguments, false, false, 1), String);
      iteratee = function(value, key) {
        return !_.contains(keys, key);
      };
    }
    return _.pick(obj, iteratee, context);
  };

  // Fill in a given object with default properties.
  _.defaults = createAssigner(_.allKeys, true);

  // Creates an object that inherits from the given prototype object.
  // If additional properties are provided then they will be added to the
  // created object.
  _.create = function(prototype, props) {
    var result = baseCreate(prototype);
    if (props) _.extendOwn(result, props);
    return result;
  };

  // Create a (shallow-cloned) duplicate of an object.
  _.clone = function(obj) {
    if (!_.isObject(obj)) return obj;
    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
  };

  // Invokes interceptor with the obj, and then returns obj.
  // The primary purpose of this method is to "tap into" a method chain, in
  // order to perform operations on intermediate results within the chain.
  _.tap = function(obj, interceptor) {
    interceptor(obj);
    return obj;
  };

  // Returns whether an object has a given set of `key:value` pairs.
  _.isMatch = function(object, attrs) {
    var keys = _.keys(attrs), length = keys.length;
    if (object == null) return !length;
    var obj = Object(object);
    for (var i = 0; i < length; i++) {
      var key = keys[i];
      if (attrs[key] !== obj[key] || !(key in obj)) return false;
    }
    return true;
  };


  // Internal recursive comparison function for `isEqual`.
  var eq = function(a, b, aStack, bStack) {
    // Identical objects are equal. `0 === -0`, but they aren't identical.
    // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
    if (a === b) return a !== 0 || 1 / a === 1 / b;
    // A strict comparison is necessary because `null == undefined`.
    if (a == null || b == null) return a === b;
    // Unwrap any wrapped objects.
    if (a instanceof _) a = a._wrapped;
    if (b instanceof _) b = b._wrapped;
    // Compare `[[Class]]` names.
    var className = toString.call(a);
    if (className !== toString.call(b)) return false;
    switch (className) {
      // Strings, numbers, regular expressions, dates, and booleans are compared by value.
      case '[object RegExp]':
      // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
      case '[object String]':
        // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
        // equivalent to `new String("5")`.
        return '' + a === '' + b;
      case '[object Number]':
        // `NaN`s are equivalent, but non-reflexive.
        // Object(NaN) is equivalent to NaN
        if (+a !== +a) return +b !== +b;
        // An `egal` comparison is performed for other numeric values.
        return +a === 0 ? 1 / +a === 1 / b : +a === +b;
      case '[object Date]':
      case '[object Boolean]':
        // Coerce dates and booleans to numeric primitive values. Dates are compared by their
        // millisecond representations. Note that invalid dates with millisecond representations
        // of `NaN` are not equivalent.
        return +a === +b;
    }

    var areArrays = className === '[object Array]';
    if (!areArrays) {
      if (typeof a != 'object' || typeof b != 'object') return false;

      // Objects with different constructors are not equivalent, but `Object`s or `Array`s
      // from different frames are.
      var aCtor = a.constructor, bCtor = b.constructor;
      if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
                               _.isFunction(bCtor) && bCtor instanceof bCtor)
                          && ('constructor' in a && 'constructor' in b)) {
        return false;
      }
    }
    // Assume equality for cyclic structures. The algorithm for detecting cyclic
    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.

    // Initializing stack of traversed objects.
    // It's done here since we only need them for objects and arrays comparison.
    aStack = aStack || [];
    bStack = bStack || [];
    var length = aStack.length;
    while (length--) {
      // Linear search. Performance is inversely proportional to the number of
      // unique nested structures.
      if (aStack[length] === a) return bStack[length] === b;
    }

    // Add the first object to the stack of traversed objects.
    aStack.push(a);
    bStack.push(b);

    // Recursively compare objects and arrays.
    if (areArrays) {
      // Compare array lengths to determine if a deep comparison is necessary.
      length = a.length;
      if (length !== b.length) return false;
      // Deep compare the contents, ignoring non-numeric properties.
      while (length--) {
        if (!eq(a[length], b[length], aStack, bStack)) return false;
      }
    } else {
      // Deep compare objects.
      var keys = _.keys(a), key;
      length = keys.length;
      // Ensure that both objects contain the same number of properties before comparing deep equality.
      if (_.keys(b).length !== length) return false;
      while (length--) {
        // Deep compare each member
        key = keys[length];
        if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
      }
    }
    // Remove the first object from the stack of traversed objects.
    aStack.pop();
    bStack.pop();
    return true;
  };

  // Perform a deep comparison to check if two objects are equal.
  _.isEqual = function(a, b) {
    return eq(a, b);
  };

  // Is a given array, string, or object empty?
  // An "empty" object has no enumerable own-properties.
  _.isEmpty = function(obj) {
    if (obj == null) return true;
    if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;
    return _.keys(obj).length === 0;
  };

  // Is a given value a DOM element?
  _.isElement = function(obj) {
    return !!(obj && obj.nodeType === 1);
  };

  // Is a given value an array?
  // Delegates to ECMA5's native Array.isArray
  _.isArray = nativeIsArray || function(obj) {
    return toString.call(obj) === '[object Array]';
  };

  // Is a given variable an object?
  _.isObject = function(obj) {
    var type = typeof obj;
    return type === 'function' || type === 'object' && !!obj;
  };

  // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.
  _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {
    _['is' + name] = function(obj) {
      return toString.call(obj) === '[object ' + name + ']';
    };
  });

  // Define a fallback version of the method in browsers (ahem, IE < 9), where
  // there isn't any inspectable "Arguments" type.
  if (!_.isArguments(arguments)) {
    _.isArguments = function(obj) {
      return _.has(obj, 'callee');
    };
  }

  // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,
  // IE 11 (#1621), and in Safari 8 (#1929).
  if (typeof /./ != 'function' && typeof Int8Array != 'object') {
    _.isFunction = function(obj) {
      return typeof obj == 'function' || false;
    };
  }

  // Is a given object a finite number?
  _.isFinite = function(obj) {
    return isFinite(obj) && !isNaN(parseFloat(obj));
  };

  // Is the given value `NaN`? (NaN is the only number which does not equal itself).
  _.isNaN = function(obj) {
    return _.isNumber(obj) && obj !== +obj;
  };

  // Is a given value a boolean?
  _.isBoolean = function(obj) {
    return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
  };

  // Is a given value equal to null?
  _.isNull = function(obj) {
    return obj === null;
  };

  // Is a given variable undefined?
  _.isUndefined = function(obj) {
    return obj === void 0;
  };

  // Shortcut function for checking if an object has a given property directly
  // on itself (in other words, not on a prototype).
  _.has = function(obj, key) {
    return obj != null && hasOwnProperty.call(obj, key);
  };

  // Utility Functions
  // -----------------

  // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
  // previous owner. Returns a reference to the Underscore object.
  _.noConflict = function() {
    root._ = previousUnderscore;
    return this;
  };

  // Keep the identity function around for default iteratees.
  _.identity = function(value) {
    return value;
  };

  // Predicate-generating functions. Often useful outside of Underscore.
  _.constant = function(value) {
    return function() {
      return value;
    };
  };

  _.noop = function(){};

  _.property = property;

  // Generates a function for a given object that returns a given property.
  _.propertyOf = function(obj) {
    return obj == null ? function(){} : function(key) {
      return obj[key];
    };
  };

  // Returns a predicate for checking whether an object has a given set of
  // `key:value` pairs.
  _.matcher = _.matches = function(attrs) {
    attrs = _.extendOwn({}, attrs);
    return function(obj) {
      return _.isMatch(obj, attrs);
    };
  };

  // Run a function **n** times.
  _.times = function(n, iteratee, context) {
    var accum = Array(Math.max(0, n));
    iteratee = optimizeCb(iteratee, context, 1);
    for (var i = 0; i < n; i++) accum[i] = iteratee(i);
    return accum;
  };

  // Return a random integer between min and max (inclusive).
  _.random = function(min, max) {
    if (max == null) {
      max = min;
      min = 0;
    }
    return min + Math.floor(Math.random() * (max - min + 1));
  };

  // A (possibly faster) way to get the current timestamp as an integer.
  _.now = Date.now || function() {
    return new Date().getTime();
  };

   // List of HTML entities for escaping.
  var escapeMap = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    '"': '&quot;',
    "'": '&#x27;',
    '`': '&#x60;'
  };
  var unescapeMap = _.invert(escapeMap);

  // Functions for escaping and unescaping strings to/from HTML interpolation.
  var createEscaper = function(map) {
    var escaper = function(match) {
      return map[match];
    };
    // Regexes for identifying a key that needs to be escaped
    var source = '(?:' + _.keys(map).join('|') + ')';
    var testRegexp = RegExp(source);
    var replaceRegexp = RegExp(source, 'g');
    return function(string) {
      string = string == null ? '' : '' + string;
      return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
    };
  };
  _.escape = createEscaper(escapeMap);
  _.unescape = createEscaper(unescapeMap);

  // If the value of the named `property` is a function then invoke it with the
  // `object` as context; otherwise, return it.
  _.result = function(object, property, fallback) {
    var value = object == null ? void 0 : object[property];
    if (value === void 0) {
      value = fallback;
    }
    return _.isFunction(value) ? value.call(object) : value;
  };

  // Generate a unique integer id (unique within the entire client session).
  // Useful for temporary DOM ids.
  var idCounter = 0;
  _.uniqueId = function(prefix) {
    var id = ++idCounter + '';
    return prefix ? prefix + id : id;
  };

  // By default, Underscore uses ERB-style template delimiters, change the
  // following template settings to use alternative delimiters.
  _.templateSettings = {
    evaluate    : /<%([\s\S]+?)%>/g,
    interpolate : /<%=([\s\S]+?)%>/g,
    escape      : /<%-([\s\S]+?)%>/g
  };

  // When customizing `templateSettings`, if you don't want to define an
  // interpolation, evaluation or escaping regex, we need one that is
  // guaranteed not to match.
  var noMatch = /(.)^/;

  // Certain characters need to be escaped so that they can be put into a
  // string literal.
  var escapes = {
    "'":      "'",
    '\\':     '\\',
    '\r':     'r',
    '\n':     'n',
    '\u2028': 'u2028',
    '\u2029': 'u2029'
  };

  var escaper = /\\|'|\r|\n|\u2028|\u2029/g;

  var escapeChar = function(match) {
    return '\\' + escapes[match];
  };

  // JavaScript micro-templating, similar to John Resig's implementation.
  // Underscore templating handles arbitrary delimiters, preserves whitespace,
  // and correctly escapes quotes within interpolated code.
  // NB: `oldSettings` only exists for backwards compatibility.
  _.template = function(text, settings, oldSettings) {
    if (!settings && oldSettings) settings = oldSettings;
    settings = _.defaults({}, settings, _.templateSettings);

    // Combine delimiters into one regular expression via alternation.
    var matcher = RegExp([
      (settings.escape || noMatch).source,
      (settings.interpolate || noMatch).source,
      (settings.evaluate || noMatch).source
    ].join('|') + '|$', 'g');

    // Compile the template source, escaping string literals appropriately.
    var index = 0;
    var source = "__p+='";
    text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
      source += text.slice(index, offset).replace(escaper, escapeChar);
      index = offset + match.length;

      if (escape) {
        source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
      } else if (interpolate) {
        source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
      } else if (evaluate) {
        source += "';\n" + evaluate + "\n__p+='";
      }

      // Adobe VMs need the match returned to produce the correct offest.
      return match;
    });
    source += "';\n";

    // If a variable is not specified, place data values in local scope.
    if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';

    source = "var __t,__p='',__j=Array.prototype.join," +
      "print=function(){__p+=__j.call(arguments,'');};\n" +
      source + 'return __p;\n';

    try {
      var render = new Function(settings.variable || 'obj', '_', source);
    } catch (e) {
      e.source = source;
      throw e;
    }

    var template = function(data) {
      return render.call(this, data, _);
    };

    // Provide the compiled source as a convenience for precompilation.
    var argument = settings.variable || 'obj';
    template.source = 'function(' + argument + '){\n' + source + '}';

    return template;
  };

  // Add a "chain" function. Start chaining a wrapped Underscore object.
  _.chain = function(obj) {
    var instance = _(obj);
    instance._chain = true;
    return instance;
  };

  // OOP
  // ---------------
  // If Underscore is called as a function, it returns a wrapped object that
  // can be used OO-style. This wrapper holds altered versions of all the
  // underscore functions. Wrapped objects may be chained.

  // Helper function to continue chaining intermediate results.
  var result = function(instance, obj) {
    return instance._chain ? _(obj).chain() : obj;
  };

  // Add your own custom functions to the Underscore object.
  _.mixin = function(obj) {
    _.each(_.functions(obj), function(name) {
      var func = _[name] = obj[name];
      _.prototype[name] = function() {
        var args = [this._wrapped];
        push.apply(args, arguments);
        return result(this, func.apply(_, args));
      };
    });
  };

  // Add all of the Underscore functions to the wrapper object.
  _.mixin(_);

  // Add all mutator Array functions to the wrapper.
  _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
    var method = ArrayProto[name];
    _.prototype[name] = function() {
      var obj = this._wrapped;
      method.apply(obj, arguments);
      if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
      return result(this, obj);
    };
  });

  // Add all accessor Array functions to the wrapper.
  _.each(['concat', 'join', 'slice'], function(name) {
    var method = ArrayProto[name];
    _.prototype[name] = function() {
      return result(this, method.apply(this._wrapped, arguments));
    };
  });

  // Extracts the result from a wrapped and chained object.
  _.prototype.value = function() {
    return this._wrapped;
  };

  // Provide unwrapping proxy for some methods used in engine operations
  // such as arithmetic and JSON stringification.
  _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;

  _.prototype.toString = function() {
    return '' + this._wrapped;
  };

  // AMD registration happens at the end for compatibility with AMD loaders
  // that may not enforce next-turn semantics on modules. Even though general
  // practice for AMD registration is to be anonymous, underscore registers
  // as a named module because, like jQuery, it is a base library that is
  // popular enough to be bundled in a third party lib, but not be part of
  // an AMD load request. Those cases could generate an error when an
  // anonymous define() is called outside of a loader request.
  if (typeof define === 'function' && define.amd) {
    define('underscore', [], function() {
      return _;
    });
  }
}.call(this));

});

define('openlayers6-es5', function (require, exports, module) {
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({

/***/ "./node_modules/elm-pep/dist/elm-pep.js":
/*!**********************************************!*\
  !*** ./node_modules/elm-pep/dist/elm-pep.js ***!
  \**********************************************/
/*! no static exports found */
/***/ (function(module, exports) {

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
// Variable to hold current primary touch event identifier.
// iOS needs this since it does not attribute
// identifier 0 to primary touch event.
var primaryTouchId = null;
// Variable to hold mouse pointer captures.
var mouseCaptureTarget = null;
if (!("PointerEvent" in window)) {
    // Define {set,release}PointerCapture
    definePointerCapture();
    // Create Pointer polyfill from mouse events only on non-touch device
    if (!("TouchEvent" in window)) {
        addMouseToPointerListener(document, "mousedown", "pointerdown");
        addMouseToPointerListener(document, "mousemove", "pointermove");
        addMouseToPointerListener(document, "mouseup", "pointerup");
    }
    // Define Pointer polyfill from touch events
    addTouchToPointerListener(document, "touchstart", "pointerdown");
    addTouchToPointerListener(document, "touchmove", "pointermove");
    addTouchToPointerListener(document, "touchend", "pointerup");
}
// Function defining {set,release}PointerCapture from {set,releas}Capture
function definePointerCapture() {
    Element.prototype.setPointerCapture = Element.prototype.setCapture;
    Element.prototype.releasePointerCapture = Element.prototype.releaseCapture;
}
// Function converting a Mouse event to a Pointer event.
function addMouseToPointerListener(target, mouseType, pointerType) {
    target.addEventListener(mouseType, function (mouseEvent) {
        var pointerEvent = new MouseEvent(pointerType, mouseEvent);
        pointerEvent.pointerId = 1;
        pointerEvent.isPrimary = true;
        pointerEvent.pointerType = "mouse";
        pointerEvent.width = 1;
        pointerEvent.height = 1;
        pointerEvent.tiltX = 0;
        pointerEvent.tiltY = 0;
        // pressure is 0.5 if a button is holded
        "buttons" in mouseEvent && mouseEvent.buttons !== 0
            ? (pointerEvent.pressure = 0.5)
            : (pointerEvent.pressure = 0);
        // if already capturing mouse event, transfer target
        // and don't forget implicit release on mouseup.
        var target = mouseEvent.target;
        if (mouseCaptureTarget !== null) {
            target = mouseCaptureTarget;
            if (mouseType === "mouseup") {
                mouseCaptureTarget = null;
            }
        }
        target.dispatchEvent(pointerEvent);
        if (pointerEvent.defaultPrevented) {
            mouseEvent.preventDefault();
        }
    });
}
// Function converting a Touch event to a Pointer event.
function addTouchToPointerListener(target, touchType, pointerType) {
    target.addEventListener(touchType, function (touchEvent) {
        var changedTouches = touchEvent.changedTouches;
        var nbTouches = changedTouches.length;
        for (var t = 0; t < nbTouches; t++) {
            var pointerEvent = new CustomEvent(pointerType, {
                bubbles: true,
                cancelable: true
            });
            pointerEvent.ctrlKey = touchEvent.ctrlKey;
            pointerEvent.shiftKey = touchEvent.shiftKey;
            pointerEvent.altKey = touchEvent.altKey;
            pointerEvent.metaKey = touchEvent.metaKey;
            var touch = changedTouches.item(t);
            pointerEvent.clientX = touch.clientX;
            pointerEvent.clientY = touch.clientY;
            pointerEvent.screenX = touch.screenX;
            pointerEvent.screenY = touch.screenY;
            pointerEvent.pageX = touch.pageX;
            pointerEvent.pageY = touch.pageY;
            var rect = touch.target.getBoundingClientRect();
            pointerEvent.offsetX = touch.clientX - rect.left;
            pointerEvent.offsetY = touch.clientY - rect.top;
            pointerEvent.pointerId = 1 + touch.identifier;
            // Default values for standard MouseEvent fields.
            pointerEvent.button = 0;
            pointerEvent.buttons = 1;
            pointerEvent.movementX = 0;
            pointerEvent.movementY = 0;
            pointerEvent.region = null;
            pointerEvent.relatedTarget = null;
            pointerEvent.x = pointerEvent.clientX;
            pointerEvent.y = pointerEvent.clientY;
            // Pointer event details
            pointerEvent.pointerType = "touch";
            pointerEvent.width = 1;
            pointerEvent.height = 1;
            pointerEvent.tiltX = 0;
            pointerEvent.tiltY = 0;
            pointerEvent.pressure = 1;
            // First touch is the primary pointer event.
            if (touchType === "touchstart" && primaryTouchId === null) {
                primaryTouchId = touch.identifier;
            }
            pointerEvent.isPrimary = touch.identifier === primaryTouchId;
            // If first touch ends, reset primary touch id.
            if (touchType === "touchend" && pointerEvent.isPrimary) {
                primaryTouchId = null;
            }
            touchEvent.target.dispatchEvent(pointerEvent);
            if (pointerEvent.defaultPrevented) {
                touchEvent.preventDefault();
            }
        }
    });
}
//# sourceMappingURL=elm-pep.js.map

/***/ }),

/***/ "./node_modules/ieee754/index.js":
/*!***************************************!*\
  !*** ./node_modules/ieee754/index.js ***!
  \***************************************/
/*! no static exports found */
/***/ (function(module, exports) {

exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  var e, m
  var eLen = (nBytes * 8) - mLen - 1
  var eMax = (1 << eLen) - 1
  var eBias = eMax >> 1
  var nBits = -7
  var i = isLE ? (nBytes - 1) : 0
  var d = isLE ? -1 : 1
  var s = buffer[offset + i]

  i += d

  e = s & ((1 << (-nBits)) - 1)
  s >>= (-nBits)
  nBits += eLen
  for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}

  m = e & ((1 << (-nBits)) - 1)
  e >>= (-nBits)
  nBits += mLen
  for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}

  if (e === 0) {
    e = 1 - eBias
  } else if (e === eMax) {
    return m ? NaN : ((s ? -1 : 1) * Infinity)
  } else {
    m = m + Math.pow(2, mLen)
    e = e - eBias
  }
  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}

exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  var e, m, c
  var eLen = (nBytes * 8) - mLen - 1
  var eMax = (1 << eLen) - 1
  var eBias = eMax >> 1
  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  var i = isLE ? 0 : (nBytes - 1)
  var d = isLE ? 1 : -1
  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0

  value = Math.abs(value)

  if (isNaN(value) || value === Infinity) {
    m = isNaN(value) ? 1 : 0
    e = eMax
  } else {
    e = Math.floor(Math.log(value) / Math.LN2)
    if (value * (c = Math.pow(2, -e)) < 1) {
      e--
      c *= 2
    }
    if (e + eBias >= 1) {
      value += rt / c
    } else {
      value += rt * Math.pow(2, 1 - eBias)
    }
    if (value * c >= 2) {
      e++
      c /= 2
    }

    if (e + eBias >= eMax) {
      m = 0
      e = eMax
    } else if (e + eBias >= 1) {
      m = ((value * c) - 1) * Math.pow(2, mLen)
      e = e + eBias
    } else {
      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
      e = 0
    }
  }

  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}

  e = (e << mLen) | m
  eLen += mLen
  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}

  buffer[offset + i - d] |= s * 128
}


/***/ }),

/***/ "./node_modules/ol/AssertionError.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/AssertionError.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util.js */ "./node_modules/ol/util.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/AssertionError
 */

/**
 * Error object thrown when an assertion failed. This is an ECMA-262 Error,
 * extended with a `code` property.
 * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error.
 */
var AssertionError = /** @class */ (function (_super) {
    __extends(AssertionError, _super);
    /**
     * @param {number} code Error code.
     */
    function AssertionError(code) {
        var _this = this;
        var path = _util_js__WEBPACK_IMPORTED_MODULE_0__["VERSION"] === 'latest' ? _util_js__WEBPACK_IMPORTED_MODULE_0__["VERSION"] : 'v' + _util_js__WEBPACK_IMPORTED_MODULE_0__["VERSION"].split('-')[0];
        var message = 'Assertion failed. See https://openlayers.org/en/' + path +
            '/doc/errors/#' + code + ' for details.';
        _this = _super.call(this, message) || this;
        /**
         * Error code. The meaning of the code can be found on
         * https://openlayers.org/en/latest/doc/errors/ (replace `latest` with
         * the version found in the OpenLayers script's header comment if a version
         * other than the latest is used).
         * @type {number}
         * @api
         */
        _this.code = code;
        /**
         * @type {string}
         */
        _this.name = 'AssertionError';
        // Re-assign message, see https://github.com/Rich-Harris/buble/issues/40
        _this.message = message;
        return _this;
    }
    return AssertionError;
}(Error));
/* harmony default export */ __webpack_exports__["default"] = (AssertionError);
//# sourceMappingURL=AssertionError.js.map

/***/ }),

/***/ "./node_modules/ol/Collection.js":
/*!***************************************!*\
  !*** ./node_modules/ol/Collection.js ***!
  \***************************************/
/*! exports provided: CollectionEvent, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CollectionEvent", function() { return CollectionEvent; });
/* harmony import */ var _AssertionError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AssertionError.js */ "./node_modules/ol/AssertionError.js");
/* harmony import */ var _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CollectionEventType.js */ "./node_modules/ol/CollectionEventType.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./events/Event.js */ "./node_modules/ol/events/Event.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Collection
 */




/**
 * @enum {string}
 * @private
 */
var Property = {
    LENGTH: 'length'
};
/**
 * @classdesc
 * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this
 * type.
 */
var CollectionEvent = /** @class */ (function (_super) {
    __extends(CollectionEvent, _super);
    /**
     * @param {CollectionEventType} type Type.
     * @param {*=} opt_element Element.
     * @param {number=} opt_index The index of the added or removed element.
     */
    function CollectionEvent(type, opt_element, opt_index) {
        var _this = _super.call(this, type) || this;
        /**
         * The element that is added to or removed from the collection.
         * @type {*}
         * @api
         */
        _this.element = opt_element;
        /**
         * The index of the added or removed element.
         * @type {number}
         * @api
         */
        _this.index = opt_index;
        return _this;
    }
    return CollectionEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_3__["default"]));

/**
 * @typedef {Object} Options
 * @property {boolean} [unique=false] Disallow the same item from being added to
 * the collection twice.
 */
/**
 * @classdesc
 * An expanded version of standard JS Array, adding convenience methods for
 * manipulation. Add and remove changes to the Collection trigger a Collection
 * event. Note that this does not cover changes to the objects _within_ the
 * Collection; they trigger events on the appropriate object, not on the
 * Collection as a whole.
 *
 * @fires CollectionEvent
 *
 * @template T
 * @api
 */
var Collection = /** @class */ (function (_super) {
    __extends(Collection, _super);
    /**
     * @param {Array<T>=} opt_array Array.
     * @param {Options=} opt_options Collection options.
     */
    function Collection(opt_array, opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options || {};
        /**
         * @private
         * @type {boolean}
         */
        _this.unique_ = !!options.unique;
        /**
         * @private
         * @type {!Array<T>}
         */
        _this.array_ = opt_array ? opt_array : [];
        if (_this.unique_) {
            for (var i = 0, ii = _this.array_.length; i < ii; ++i) {
                _this.assertUnique_(_this.array_[i], i);
            }
        }
        _this.updateLength_();
        return _this;
    }
    /**
     * Remove all elements from the collection.
     * @api
     */
    Collection.prototype.clear = function () {
        while (this.getLength() > 0) {
            this.pop();
        }
    };
    /**
     * Add elements to the collection.  This pushes each item in the provided array
     * to the end of the collection.
     * @param {!Array<T>} arr Array.
     * @return {Collection<T>} This collection.
     * @api
     */
    Collection.prototype.extend = function (arr) {
        for (var i = 0, ii = arr.length; i < ii; ++i) {
            this.push(arr[i]);
        }
        return this;
    };
    /**
     * Iterate over each element, calling the provided callback.
     * @param {function(T, number, Array<T>): *} f The function to call
     *     for every element. This function takes 3 arguments (the element, the
     *     index and the array). The return value is ignored.
     * @api
     */
    Collection.prototype.forEach = function (f) {
        var array = this.array_;
        for (var i = 0, ii = array.length; i < ii; ++i) {
            f(array[i], i, array);
        }
    };
    /**
     * Get a reference to the underlying Array object. Warning: if the array
     * is mutated, no events will be dispatched by the collection, and the
     * collection's "length" property won't be in sync with the actual length
     * of the array.
     * @return {!Array<T>} Array.
     * @api
     */
    Collection.prototype.getArray = function () {
        return this.array_;
    };
    /**
     * Get the element at the provided index.
     * @param {number} index Index.
     * @return {T} Element.
     * @api
     */
    Collection.prototype.item = function (index) {
        return this.array_[index];
    };
    /**
     * Get the length of this collection.
     * @return {number} The length of the array.
     * @observable
     * @api
     */
    Collection.prototype.getLength = function () {
        return this.get(Property.LENGTH);
    };
    /**
     * Insert an element at the provided index.
     * @param {number} index Index.
     * @param {T} elem Element.
     * @api
     */
    Collection.prototype.insertAt = function (index, elem) {
        if (this.unique_) {
            this.assertUnique_(elem);
        }
        this.array_.splice(index, 0, elem);
        this.updateLength_();
        this.dispatchEvent(new CollectionEvent(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ADD, elem, index));
    };
    /**
     * Remove the last element of the collection and return it.
     * Return `undefined` if the collection is empty.
     * @return {T|undefined} Element.
     * @api
     */
    Collection.prototype.pop = function () {
        return this.removeAt(this.getLength() - 1);
    };
    /**
     * Insert the provided element at the end of the collection.
     * @param {T} elem Element.
     * @return {number} New length of the collection.
     * @api
     */
    Collection.prototype.push = function (elem) {
        if (this.unique_) {
            this.assertUnique_(elem);
        }
        var n = this.getLength();
        this.insertAt(n, elem);
        return this.getLength();
    };
    /**
     * Remove the first occurrence of an element from the collection.
     * @param {T} elem Element.
     * @return {T|undefined} The removed element or undefined if none found.
     * @api
     */
    Collection.prototype.remove = function (elem) {
        var arr = this.array_;
        for (var i = 0, ii = arr.length; i < ii; ++i) {
            if (arr[i] === elem) {
                return this.removeAt(i);
            }
        }
        return undefined;
    };
    /**
     * Remove the element at the provided index and return it.
     * Return `undefined` if the collection does not contain this index.
     * @param {number} index Index.
     * @return {T|undefined} Value.
     * @api
     */
    Collection.prototype.removeAt = function (index) {
        var prev = this.array_[index];
        this.array_.splice(index, 1);
        this.updateLength_();
        this.dispatchEvent(new CollectionEvent(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].REMOVE, prev, index));
        return prev;
    };
    /**
     * Set the element at the provided index.
     * @param {number} index Index.
     * @param {T} elem Element.
     * @api
     */
    Collection.prototype.setAt = function (index, elem) {
        var n = this.getLength();
        if (index < n) {
            if (this.unique_) {
                this.assertUnique_(elem, index);
            }
            var prev = this.array_[index];
            this.array_[index] = elem;
            this.dispatchEvent(new CollectionEvent(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].REMOVE, prev, index));
            this.dispatchEvent(new CollectionEvent(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ADD, elem, index));
        }
        else {
            for (var j = n; j < index; ++j) {
                this.insertAt(j, undefined);
            }
            this.insertAt(index, elem);
        }
    };
    /**
     * @private
     */
    Collection.prototype.updateLength_ = function () {
        this.set(Property.LENGTH, this.array_.length);
    };
    /**
     * @private
     * @param {T} elem Element.
     * @param {number=} opt_except Optional index to ignore.
     */
    Collection.prototype.assertUnique_ = function (elem, opt_except) {
        for (var i = 0, ii = this.array_.length; i < ii; ++i) {
            if (this.array_[i] === elem && i !== opt_except) {
                throw new _AssertionError_js__WEBPACK_IMPORTED_MODULE_0__["default"](58);
            }
        }
    };
    return Collection;
}(_Object_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Collection);
//# sourceMappingURL=Collection.js.map

/***/ }),

/***/ "./node_modules/ol/CollectionEventType.js":
/*!************************************************!*\
  !*** ./node_modules/ol/CollectionEventType.js ***!
  \************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/CollectionEventType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Triggered when an item is added to the collection.
     * @event module:ol/Collection.CollectionEvent#add
     * @api
     */
    ADD: 'add',
    /**
     * Triggered when an item is removed from the collection.
     * @event module:ol/Collection.CollectionEvent#remove
     * @api
     */
    REMOVE: 'remove'
});
//# sourceMappingURL=CollectionEventType.js.map

/***/ }),

/***/ "./node_modules/ol/Disposable.js":
/*!***************************************!*\
  !*** ./node_modules/ol/Disposable.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/Disposable
 */
/**
 * @classdesc
 * Objects that need to clean up after themselves.
 */
var Disposable = /** @class */ (function () {
    function Disposable() {
        /**
         * The object has already been disposed.
         * @type {boolean}
         * @private
         */
        this.disposed_ = false;
    }
    /**
     * Clean up.
     */
    Disposable.prototype.dispose = function () {
        if (!this.disposed_) {
            this.disposed_ = true;
            this.disposeInternal();
        }
    };
    /**
     * Extension point for disposable objects.
     * @protected
     */
    Disposable.prototype.disposeInternal = function () { };
    return Disposable;
}());
/* harmony default export */ __webpack_exports__["default"] = (Disposable);
//# sourceMappingURL=Disposable.js.map

/***/ }),

/***/ "./node_modules/ol/Feature.js":
/*!************************************!*\
  !*** ./node_modules/ol/Feature.js ***!
  \************************************/
/*! exports provided: createStyleFunction, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createStyleFunction", function() { return createStyleFunction; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Object.js */ "./node_modules/ol/Object.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Feature
 */




/**
 * @typedef {typeof Feature|typeof import("./render/Feature.js").default} FeatureClass
 */
/**
 * @typedef {Feature|import("./render/Feature.js").default} FeatureLike
 */
/**
 * @classdesc
 * A vector object for geographic features with a geometry and other
 * attribute properties, similar to the features in vector file formats like
 * GeoJSON.
 *
 * Features can be styled individually with `setStyle`; otherwise they use the
 * style of their vector layer.
 *
 * Note that attribute properties are set as {@link module:ol/Object} properties on
 * the feature object, so they are observable, and have get/set accessors.
 *
 * Typically, a feature has a single geometry property. You can set the
 * geometry using the `setGeometry` method and get it with `getGeometry`.
 * It is possible to store more than one geometry on a feature using attribute
 * properties. By default, the geometry used for rendering is identified by
 * the property name `geometry`. If you want to use another geometry property
 * for rendering, use the `setGeometryName` method to change the attribute
 * property associated with the geometry for the feature.  For example:
 *
 * ```js
 *
 * import Feature from 'ol/Feature';
 * import Polygon from 'ol/geom/Polygon';
 * import Point from 'ol/geom/Point';
 *
 * var feature = new Feature({
 *   geometry: new Polygon(polyCoords),
 *   labelPoint: new Point(labelCoords),
 *   name: 'My Polygon'
 * });
 *
 * // get the polygon geometry
 * var poly = feature.getGeometry();
 *
 * // Render the feature as a point using the coordinates from labelPoint
 * feature.setGeometryName('labelPoint');
 *
 * // get the point geometry
 * var point = feature.getGeometry();
 * ```
 *
 * @api
 * @template {import("./geom/Geometry.js").default} Geometry
 */
var Feature = /** @class */ (function (_super) {
    __extends(Feature, _super);
    /**
     * @param {Geometry|Object<string, *>=} opt_geometryOrProperties
     *     You may pass a Geometry object directly, or an object literal containing
     *     properties. If you pass an object literal, you may include a Geometry
     *     associated with a `geometry` key.
     */
    function Feature(opt_geometryOrProperties) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {number|string|undefined}
         */
        _this.id_ = undefined;
        /**
         * @type {string}
         * @private
         */
        _this.geometryName_ = 'geometry';
        /**
         * User provided style.
         * @private
         * @type {import("./style/Style.js").StyleLike}
         */
        _this.style_ = null;
        /**
         * @private
         * @type {import("./style/Style.js").StyleFunction|undefined}
         */
        _this.styleFunction_ = undefined;
        /**
         * @private
         * @type {?import("./events.js").EventsKey}
         */
        _this.geometryChangeKey_ = null;
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_3__["getChangeEventType"])(_this.geometryName_), _this.handleGeometryChanged_);
        if (opt_geometryOrProperties) {
            if (typeof /** @type {?} */ (opt_geometryOrProperties).getSimplifiedGeometry === 'function') {
                var geometry = /** @type {Geometry} */ (opt_geometryOrProperties);
                _this.setGeometry(geometry);
            }
            else {
                /** @type {Object<string, *>} */
                var properties = opt_geometryOrProperties;
                _this.setProperties(properties);
            }
        }
        return _this;
    }
    /**
     * Clone this feature. If the original feature has a geometry it
     * is also cloned. The feature id is not set in the clone.
     * @return {Feature} The clone.
     * @api
     */
    Feature.prototype.clone = function () {
        var clone = new Feature(this.getProperties());
        clone.setGeometryName(this.getGeometryName());
        var geometry = this.getGeometry();
        if (geometry) {
            clone.setGeometry(geometry.clone());
        }
        var style = this.getStyle();
        if (style) {
            clone.setStyle(style);
        }
        return clone;
    };
    /**
     * Get the feature's default geometry.  A feature may have any number of named
     * geometries.  The "default" geometry (the one that is rendered by default) is
     * set when calling {@link module:ol/Feature~Feature#setGeometry}.
     * @return {Geometry|undefined} The default geometry for the feature.
     * @api
     * @observable
     */
    Feature.prototype.getGeometry = function () {
        return (
        /** @type {Geometry|undefined} */ (this.get(this.geometryName_)));
    };
    /**
     * Get the feature identifier.  This is a stable identifier for the feature and
     * is either set when reading data from a remote source or set explicitly by
     * calling {@link module:ol/Feature~Feature#setId}.
     * @return {number|string|undefined} Id.
     * @api
     */
    Feature.prototype.getId = function () {
        return this.id_;
    };
    /**
     * Get the name of the feature's default geometry.  By default, the default
     * geometry is named `geometry`.
     * @return {string} Get the property name associated with the default geometry
     *     for this feature.
     * @api
     */
    Feature.prototype.getGeometryName = function () {
        return this.geometryName_;
    };
    /**
     * Get the feature's style. Will return what was provided to the
     * {@link module:ol/Feature~Feature#setStyle} method.
     * @return {import("./style/Style.js").StyleLike} The feature style.
     * @api
     */
    Feature.prototype.getStyle = function () {
        return this.style_;
    };
    /**
     * Get the feature's style function.
     * @return {import("./style/Style.js").StyleFunction|undefined} Return a function
     * representing the current style of this feature.
     * @api
     */
    Feature.prototype.getStyleFunction = function () {
        return this.styleFunction_;
    };
    /**
     * @private
     */
    Feature.prototype.handleGeometryChange_ = function () {
        this.changed();
    };
    /**
     * @private
     */
    Feature.prototype.handleGeometryChanged_ = function () {
        if (this.geometryChangeKey_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_1__["unlistenByKey"])(this.geometryChangeKey_);
            this.geometryChangeKey_ = null;
        }
        var geometry = this.getGeometry();
        if (geometry) {
            this.geometryChangeKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_1__["listen"])(geometry, _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].CHANGE, this.handleGeometryChange_, this);
        }
        this.changed();
    };
    /**
     * Set the default geometry for the feature.  This will update the property
     * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.
     * @param {Geometry|undefined} geometry The new geometry.
     * @api
     * @observable
     */
    Feature.prototype.setGeometry = function (geometry) {
        this.set(this.geometryName_, geometry);
    };
    /**
     * Set the style for the feature.  This can be a single style object, an array
     * of styles, or a function that takes a resolution and returns an array of
     * styles. If it is `null` the feature has no style (a `null` style).
     * @param {import("./style/Style.js").StyleLike} style Style for this feature.
     * @api
     * @fires module:ol/events/Event~BaseEvent#event:change
     */
    Feature.prototype.setStyle = function (style) {
        this.style_ = style;
        this.styleFunction_ = !style ? undefined : createStyleFunction(style);
        this.changed();
    };
    /**
     * Set the feature id.  The feature id is considered stable and may be used when
     * requesting features or comparing identifiers returned from a remote source.
     * The feature id can be used with the
     * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.
     * @param {number|string|undefined} id The feature id.
     * @api
     * @fires module:ol/events/Event~BaseEvent#event:change
     */
    Feature.prototype.setId = function (id) {
        this.id_ = id;
        this.changed();
    };
    /**
     * Set the property name to be used when getting the feature's default geometry.
     * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with
     * this name will be returned.
     * @param {string} name The property name of the default geometry.
     * @api
     */
    Feature.prototype.setGeometryName = function (name) {
        this.removeEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_3__["getChangeEventType"])(this.geometryName_), this.handleGeometryChanged_);
        this.geometryName_ = name;
        this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_3__["getChangeEventType"])(this.geometryName_), this.handleGeometryChanged_);
        this.handleGeometryChanged_();
    };
    return Feature;
}(_Object_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * Convert the provided object into a feature style function.  Functions passed
 * through unchanged.  Arrays of Style or single style objects wrapped
 * in a new feature style function.
 * @param {!import("./style/Style.js").StyleFunction|!Array<import("./style/Style.js").default>|!import("./style/Style.js").default} obj
 *     A feature style function, a single style, or an array of styles.
 * @return {import("./style/Style.js").StyleFunction} A style function.
 */
function createStyleFunction(obj) {
    if (typeof obj === 'function') {
        return obj;
    }
    else {
        /**
         * @type {Array<import("./style/Style.js").default>}
         */
        var styles_1;
        if (Array.isArray(obj)) {
            styles_1 = obj;
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(typeof /** @type {?} */ (obj).getZIndex === 'function', 41); // Expected an `import("./style/Style.js").Style` or an array of `import("./style/Style.js").Style`
            var style = /** @type {import("./style/Style.js").default} */ (obj);
            styles_1 = [style];
        }
        return function () {
            return styles_1;
        };
    }
}
/* harmony default export */ __webpack_exports__["default"] = (Feature);
//# sourceMappingURL=Feature.js.map

/***/ }),

/***/ "./node_modules/ol/Geolocation.js":
/*!****************************************!*\
  !*** ./node_modules/ol/Geolocation.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Geolocation
 */






/**
 * @enum {string}
 */
var Property = {
    ACCURACY: 'accuracy',
    ACCURACY_GEOMETRY: 'accuracyGeometry',
    ALTITUDE: 'altitude',
    ALTITUDE_ACCURACY: 'altitudeAccuracy',
    HEADING: 'heading',
    POSITION: 'position',
    PROJECTION: 'projection',
    SPEED: 'speed',
    TRACKING: 'tracking',
    TRACKING_OPTIONS: 'trackingOptions'
};
/**
 * @classdesc
 * Events emitted on Geolocation error.
 */
var GeolocationError = /** @class */ (function (_super) {
    __extends(GeolocationError, _super);
    /**
     * @param {PositionError} error error object.
     */
    function GeolocationError(error) {
        var _this = _super.call(this, _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].ERROR) || this;
        /**
         * @type {number}
         */
        _this.code = error.code;
        /**
         * @type {string}
         */
        _this.message = error.message;
        return _this;
    }
    return GeolocationError;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * @typedef {Object} Options
 * @property {boolean} [tracking=false] Start Tracking right after
 * instantiation.
 * @property {PositionOptions} [trackingOptions] Tracking options.
 * See http://www.w3.org/TR/geolocation-API/#position_options_interface.
 * @property {import("./proj.js").ProjectionLike} [projection] The projection the position
 * is reported in.
 */
/**
 * @classdesc
 * Helper class for providing HTML5 Geolocation capabilities.
 * The [Geolocation API](http://www.w3.org/TR/geolocation-API/)
 * is used to locate a user's position.
 *
 * To get notified of position changes, register a listener for the generic
 * `change` event on your instance of {@link module:ol/Geolocation~Geolocation}.
 *
 * Example:
 *
 *     var geolocation = new Geolocation({
 *       // take the projection to use from the map's view
 *       projection: view.getProjection()
 *     });
 *     // listen to changes in position
 *     geolocation.on('change', function(evt) {
 *       window.console.log(geolocation.getPosition());
 *     });
 *
 * @fires module:ol/events/Event~BaseEvent#event:error
 * @api
 */
var Geolocation = /** @class */ (function (_super) {
    __extends(Geolocation, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function Geolocation(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options || {};
        /**
         * The unprojected (EPSG:4326) device position.
         * @private
         * @type {?import("./coordinate.js").Coordinate}
         */
        _this.position_ = null;
        /**
         * @private
         * @type {import("./proj.js").TransformFunction}
         */
        _this.transform_ = _proj_js__WEBPACK_IMPORTED_MODULE_5__["identityTransform"];
        /**
         * @private
         * @type {number|undefined}
         */
        _this.watchId_ = undefined;
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_0__["getChangeEventType"])(Property.PROJECTION), _this.handleProjectionChanged_);
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_0__["getChangeEventType"])(Property.TRACKING), _this.handleTrackingChanged_);
        if (options.projection !== undefined) {
            _this.setProjection(options.projection);
        }
        if (options.trackingOptions !== undefined) {
            _this.setTrackingOptions(options.trackingOptions);
        }
        _this.setTracking(options.tracking !== undefined ? options.tracking : false);
        return _this;
    }
    /**
     * @inheritDoc
     */
    Geolocation.prototype.disposeInternal = function () {
        this.setTracking(false);
        _super.prototype.disposeInternal.call(this);
    };
    /**
     * @private
     */
    Geolocation.prototype.handleProjectionChanged_ = function () {
        var projection = this.getProjection();
        if (projection) {
            this.transform_ = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["getTransformFromProjections"])(Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])('EPSG:4326'), projection);
            if (this.position_) {
                this.set(Property.POSITION, this.transform_(this.position_));
            }
        }
    };
    /**
     * @private
     */
    Geolocation.prototype.handleTrackingChanged_ = function () {
        if ('geolocation' in navigator) {
            var tracking = this.getTracking();
            if (tracking && this.watchId_ === undefined) {
                this.watchId_ = navigator.geolocation.watchPosition(this.positionChange_.bind(this), this.positionError_.bind(this), this.getTrackingOptions());
            }
            else if (!tracking && this.watchId_ !== undefined) {
                navigator.geolocation.clearWatch(this.watchId_);
                this.watchId_ = undefined;
            }
        }
    };
    /**
     * @private
     * @param {Position} position position event.
     */
    Geolocation.prototype.positionChange_ = function (position) {
        var coords = position.coords;
        this.set(Property.ACCURACY, coords.accuracy);
        this.set(Property.ALTITUDE, coords.altitude === null ? undefined : coords.altitude);
        this.set(Property.ALTITUDE_ACCURACY, coords.altitudeAccuracy === null ?
            undefined : coords.altitudeAccuracy);
        this.set(Property.HEADING, coords.heading === null ?
            undefined : Object(_math_js__WEBPACK_IMPORTED_MODULE_4__["toRadians"])(coords.heading));
        if (!this.position_) {
            this.position_ = [coords.longitude, coords.latitude];
        }
        else {
            this.position_[0] = coords.longitude;
            this.position_[1] = coords.latitude;
        }
        var projectedPosition = this.transform_(this.position_);
        this.set(Property.POSITION, projectedPosition);
        this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);
        var geometry = Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_3__["circular"])(this.position_, coords.accuracy);
        geometry.applyTransform(this.transform_);
        this.set(Property.ACCURACY_GEOMETRY, geometry);
        this.changed();
    };
    /**
     * @private
     * @param {PositionError} error error object.
     */
    Geolocation.prototype.positionError_ = function (error) {
        this.setTracking(false);
        this.dispatchEvent(new GeolocationError(error));
    };
    /**
     * Get the accuracy of the position in meters.
     * @return {number|undefined} The accuracy of the position measurement in
     *     meters.
     * @observable
     * @api
     */
    Geolocation.prototype.getAccuracy = function () {
        return /** @type {number|undefined} */ (this.get(Property.ACCURACY));
    };
    /**
     * Get a geometry of the position accuracy.
     * @return {?import("./geom/Polygon.js").default} A geometry of the position accuracy.
     * @observable
     * @api
     */
    Geolocation.prototype.getAccuracyGeometry = function () {
        return (
        /** @type {?import("./geom/Polygon.js").default} */ (this.get(Property.ACCURACY_GEOMETRY) || null));
    };
    /**
     * Get the altitude associated with the position.
     * @return {number|undefined} The altitude of the position in meters above mean
     *     sea level.
     * @observable
     * @api
     */
    Geolocation.prototype.getAltitude = function () {
        return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));
    };
    /**
     * Get the altitude accuracy of the position.
     * @return {number|undefined} The accuracy of the altitude measurement in
     *     meters.
     * @observable
     * @api
     */
    Geolocation.prototype.getAltitudeAccuracy = function () {
        return /** @type {number|undefined} */ (this.get(Property.ALTITUDE_ACCURACY));
    };
    /**
     * Get the heading as radians clockwise from North.
     * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`
     * is set to `true` in the tracking options.
     * @return {number|undefined} The heading of the device in radians from north.
     * @observable
     * @api
     */
    Geolocation.prototype.getHeading = function () {
        return /** @type {number|undefined} */ (this.get(Property.HEADING));
    };
    /**
     * Get the position of the device.
     * @return {import("./coordinate.js").Coordinate|undefined} The current position of the device reported
     *     in the current projection.
     * @observable
     * @api
     */
    Geolocation.prototype.getPosition = function () {
        return (
        /** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(Property.POSITION)));
    };
    /**
     * Get the projection associated with the position.
     * @return {import("./proj/Projection.js").default|undefined} The projection the position is
     *     reported in.
     * @observable
     * @api
     */
    Geolocation.prototype.getProjection = function () {
        return (
        /** @type {import("./proj/Projection.js").default|undefined} */ (this.get(Property.PROJECTION)));
    };
    /**
     * Get the speed in meters per second.
     * @return {number|undefined} The instantaneous speed of the device in meters
     *     per second.
     * @observable
     * @api
     */
    Geolocation.prototype.getSpeed = function () {
        return /** @type {number|undefined} */ (this.get(Property.SPEED));
    };
    /**
     * Determine if the device location is being tracked.
     * @return {boolean} The device location is being tracked.
     * @observable
     * @api
     */
    Geolocation.prototype.getTracking = function () {
        return /** @type {boolean} */ (this.get(Property.TRACKING));
    };
    /**
     * Get the tracking options.
     * See http://www.w3.org/TR/geolocation-API/#position-options.
     * @return {PositionOptions|undefined} PositionOptions as defined by
     *     the [HTML5 Geolocation spec
     *     ](http://www.w3.org/TR/geolocation-API/#position_options_interface).
     * @observable
     * @api
     */
    Geolocation.prototype.getTrackingOptions = function () {
        return /** @type {PositionOptions|undefined} */ (this.get(Property.TRACKING_OPTIONS));
    };
    /**
     * Set the projection to use for transforming the coordinates.
     * @param {import("./proj.js").ProjectionLike} projection The projection the position is
     *     reported in.
     * @observable
     * @api
     */
    Geolocation.prototype.setProjection = function (projection) {
        this.set(Property.PROJECTION, Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])(projection));
    };
    /**
     * Enable or disable tracking.
     * @param {boolean} tracking Enable tracking.
     * @observable
     * @api
     */
    Geolocation.prototype.setTracking = function (tracking) {
        this.set(Property.TRACKING, tracking);
    };
    /**
     * Set the tracking options.
     * See http://www.w3.org/TR/geolocation-API/#position-options.
     * @param {PositionOptions} options PositionOptions as defined by the
     *     [HTML5 Geolocation spec
     *     ](http://www.w3.org/TR/geolocation-API/#position_options_interface).
     * @observable
     * @api
     */
    Geolocation.prototype.setTrackingOptions = function (options) {
        this.set(Property.TRACKING_OPTIONS, options);
    };
    return Geolocation;
}(_Object_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Geolocation);
//# sourceMappingURL=Geolocation.js.map

/***/ }),

/***/ "./node_modules/ol/Image.js":
/*!**********************************!*\
  !*** ./node_modules/ol/Image.js ***!
  \**********************************/
/*! exports provided: listenImage, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "listenImage", function() { return listenImage; });
/* harmony import */ var _ImageBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ImageBase.js */ "./node_modules/ol/ImageBase.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./has.js */ "./node_modules/ol/has.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Image
 */






/**
 * A function that takes an {@link module:ol/Image~Image} for the image and a
 * `{string}` for the src as arguments. It is supposed to make it so the
 * underlying image {@link module:ol/Image~Image#getImage} is assigned the
 * content specified by the src. If not specified, the default is
 *
 *     function(image, src) {
 *       image.getImage().src = src;
 *     }
 *
 * Providing a custom `imageLoadFunction` can be useful to load images with
 * post requests or - in general - through XHR requests, where the src of the
 * image element would be set to a data URI when the content is loaded.
 *
 * @typedef {function(ImageWrapper, string): void} LoadFunction
 * @api
 */
var ImageWrapper = /** @class */ (function (_super) {
    __extends(ImageWrapper, _super);
    /**
     * @param {import("./extent.js").Extent} extent Extent.
     * @param {number|undefined} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {string} src Image source URI.
     * @param {?string} crossOrigin Cross origin.
     * @param {LoadFunction} imageLoadFunction Image load function.
     */
    function ImageWrapper(extent, resolution, pixelRatio, src, crossOrigin, imageLoadFunction) {
        var _this = _super.call(this, extent, resolution, pixelRatio, _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE) || this;
        /**
         * @private
         * @type {string}
         */
        _this.src_ = src;
        /**
         * @private
         * @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement}
         */
        _this.image_ = new Image();
        if (crossOrigin !== null) {
            _this.image_.crossOrigin = crossOrigin;
        }
        /**
         * @private
         * @type {?function():void}
         */
        _this.unlisten_ = null;
        /**
         * @protected
         * @type {ImageState}
         */
        _this.state = _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE;
        /**
         * @private
         * @type {LoadFunction}
         */
        _this.imageLoadFunction_ = imageLoadFunction;
        return _this;
    }
    /**
     * @inheritDoc
     * @api
     */
    ImageWrapper.prototype.getImage = function () {
        return this.image_;
    };
    /**
     * Tracks loading or read errors.
     *
     * @private
     */
    ImageWrapper.prototype.handleImageError_ = function () {
        this.state = _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR;
        this.unlistenImage_();
        this.changed();
    };
    /**
     * Tracks successful image load.
     *
     * @private
     */
    ImageWrapper.prototype.handleImageLoad_ = function () {
        if (this.resolution === undefined) {
            this.resolution = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getHeight"])(this.extent) / this.image_.height;
        }
        this.state = _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED;
        this.unlistenImage_();
        this.changed();
    };
    /**
     * Load the image or retry if loading previously failed.
     * Loading is taken care of by the tile queue, and calling this method is
     * only needed for preloading or for reloading in case of an error.
     * @override
     * @api
     */
    ImageWrapper.prototype.load = function () {
        if (this.state == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE || this.state == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR) {
            this.state = _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADING;
            this.changed();
            this.imageLoadFunction_(this, this.src_);
            this.unlisten_ = listenImage(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this));
        }
    };
    /**
     * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image.
     */
    ImageWrapper.prototype.setImage = function (image) {
        this.image_ = image;
    };
    /**
     * Discards event handlers which listen for load completion or errors.
     *
     * @private
     */
    ImageWrapper.prototype.unlistenImage_ = function () {
        if (this.unlisten_) {
            this.unlisten_();
            this.unlisten_ = null;
        }
    };
    return ImageWrapper;
}(_ImageBase_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image element.
 * @param {function():any} loadHandler Load callback function.
 * @param {function():any} errorHandler Error callback function.
 * @return {function():void} Callback to stop listening.
 */
function listenImage(image, loadHandler, errorHandler) {
    var img = /** @type {HTMLImageElement} */ (image);
    if (img.src && _has_js__WEBPACK_IMPORTED_MODULE_5__["IMAGE_DECODE"]) {
        var promise = img.decode();
        var listening_1 = true;
        var unlisten = function () {
            listening_1 = false;
        };
        promise.then(function () {
            if (listening_1) {
                loadHandler();
            }
        }).catch(function (error) {
            if (listening_1) {
                // FIXME: Unconditionally call errorHandler() when this bug is fixed upstream:
                //        https://bugs.webkit.org/show_bug.cgi?id=198527
                if (error.name === 'EncodingError' && error.message === 'Invalid image type.') {
                    loadHandler();
                }
                else {
                    errorHandler();
                }
            }
        });
        return unlisten;
    }
    var listenerKeys = [
        Object(_events_js__WEBPACK_IMPORTED_MODULE_2__["listenOnce"])(img, _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOAD, loadHandler),
        Object(_events_js__WEBPACK_IMPORTED_MODULE_2__["listenOnce"])(img, _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].ERROR, errorHandler)
    ];
    return function unlisten() {
        listenerKeys.forEach(_events_js__WEBPACK_IMPORTED_MODULE_2__["unlistenByKey"]);
    };
}
/* harmony default export */ __webpack_exports__["default"] = (ImageWrapper);
//# sourceMappingURL=Image.js.map

/***/ }),

/***/ "./node_modules/ol/ImageBase.js":
/*!**************************************!*\
  !*** ./node_modules/ol/ImageBase.js ***!
  \**************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _events_Target_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events/Target.js */ "./node_modules/ol/events/Target.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/ImageBase
 */



/**
 * @abstract
 */
var ImageBase = /** @class */ (function (_super) {
    __extends(ImageBase, _super);
    /**
     * @param {import("./extent.js").Extent} extent Extent.
     * @param {number|undefined} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("./ImageState.js").default} state State.
     */
    function ImageBase(extent, resolution, pixelRatio, state) {
        var _this = _super.call(this) || this;
        /**
         * @protected
         * @type {import("./extent.js").Extent}
         */
        _this.extent = extent;
        /**
         * @private
         * @type {number}
         */
        _this.pixelRatio_ = pixelRatio;
        /**
         * @protected
         * @type {number|undefined}
         */
        _this.resolution = resolution;
        /**
         * @protected
         * @type {import("./ImageState.js").default}
         */
        _this.state = state;
        return _this;
    }
    /**
     * @protected
     */
    ImageBase.prototype.changed = function () {
        this.dispatchEvent(_events_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].CHANGE);
    };
    /**
     * @return {import("./extent.js").Extent} Extent.
     */
    ImageBase.prototype.getExtent = function () {
        return this.extent;
    };
    /**
     * @abstract
     * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
     */
    ImageBase.prototype.getImage = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @return {number} PixelRatio.
     */
    ImageBase.prototype.getPixelRatio = function () {
        return this.pixelRatio_;
    };
    /**
     * @return {number} Resolution.
     */
    ImageBase.prototype.getResolution = function () {
        return /** @type {number} */ (this.resolution);
    };
    /**
     * @return {import("./ImageState.js").default} State.
     */
    ImageBase.prototype.getState = function () {
        return this.state;
    };
    /**
     * Load not yet loaded URI.
     * @abstract
     */
    ImageBase.prototype.load = function () {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    return ImageBase;
}(_events_Target_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ImageBase);
//# sourceMappingURL=ImageBase.js.map

/***/ }),

/***/ "./node_modules/ol/ImageCanvas.js":
/*!****************************************!*\
  !*** ./node_modules/ol/ImageCanvas.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ImageBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ImageBase.js */ "./node_modules/ol/ImageBase.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ImageState.js */ "./node_modules/ol/ImageState.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/ImageCanvas
 */


/**
 * A function that is called to trigger asynchronous canvas drawing.  It is
 * called with a "done" callback that should be called when drawing is done.
 * If any error occurs during drawing, the "done" callback should be called with
 * that error.
 *
 * @typedef {function(function(Error=): void): void} Loader
 */
var ImageCanvas = /** @class */ (function (_super) {
    __extends(ImageCanvas, _super);
    /**
     * @param {import("./extent.js").Extent} extent Extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {HTMLCanvasElement} canvas Canvas.
     * @param {Loader=} opt_loader Optional loader function to
     *     support asynchronous canvas drawing.
     */
    function ImageCanvas(extent, resolution, pixelRatio, canvas, opt_loader) {
        var _this = this;
        var state = opt_loader !== undefined ? _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE : _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED;
        _this = _super.call(this, extent, resolution, pixelRatio, state) || this;
        /**
         * Optional canvas loader function.
         * @type {?Loader}
         * @private
         */
        _this.loader_ = opt_loader !== undefined ? opt_loader : null;
        /**
         * @private
         * @type {HTMLCanvasElement}
         */
        _this.canvas_ = canvas;
        /**
         * @private
         * @type {?Error}
         */
        _this.error_ = null;
        return _this;
    }
    /**
     * Get any error associated with asynchronous rendering.
     * @return {?Error} Any error that occurred during rendering.
     */
    ImageCanvas.prototype.getError = function () {
        return this.error_;
    };
    /**
     * Handle async drawing complete.
     * @param {Error=} err Any error during drawing.
     * @private
     */
    ImageCanvas.prototype.handleLoad_ = function (err) {
        if (err) {
            this.error_ = err;
            this.state = _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR;
        }
        else {
            this.state = _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED;
        }
        this.changed();
    };
    /**
     * @inheritDoc
     */
    ImageCanvas.prototype.load = function () {
        if (this.state == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE) {
            this.state = _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADING;
            this.changed();
            this.loader_(this.handleLoad_.bind(this));
        }
    };
    /**
     * @return {HTMLCanvasElement} Canvas element.
     */
    ImageCanvas.prototype.getImage = function () {
        return this.canvas_;
    };
    return ImageCanvas;
}(_ImageBase_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ImageCanvas);
//# sourceMappingURL=ImageCanvas.js.map

/***/ }),

/***/ "./node_modules/ol/ImageState.js":
/*!***************************************!*\
  !*** ./node_modules/ol/ImageState.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/ImageState
 */
/**
 * @enum {number}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    IDLE: 0,
    LOADING: 1,
    LOADED: 2,
    ERROR: 3,
    EMPTY: 4
});
//# sourceMappingURL=ImageState.js.map

/***/ }),

/***/ "./node_modules/ol/ImageTile.js":
/*!**************************************!*\
  !*** ./node_modules/ol/ImageTile.js ***!
  \**************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Tile.js */ "./node_modules/ol/Tile.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/Image.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/ImageTile
 */




var ImageTile = /** @class */ (function (_super) {
    __extends(ImageTile, _super);
    /**
     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {TileState} state State.
     * @param {string} src Image source URI.
     * @param {?string} crossOrigin Cross origin.
     * @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
     * @param {import("./Tile.js").Options=} opt_options Tile options.
     */
    function ImageTile(tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
        var _this = _super.call(this, tileCoord, state, opt_options) || this;
        /**
         * @private
         * @type {?string}
         */
        _this.crossOrigin_ = crossOrigin;
        /**
         * Image URI
         *
         * @private
         * @type {string}
         */
        _this.src_ = src;
        /**
         * @private
         * @type {HTMLImageElement|HTMLCanvasElement}
         */
        _this.image_ = new Image();
        if (crossOrigin !== null) {
            _this.image_.crossOrigin = crossOrigin;
        }
        /**
         * @private
         * @type {?function():void}
         */
        _this.unlisten_ = null;
        /**
         * @private
         * @type {import("./Tile.js").LoadFunction}
         */
        _this.tileLoadFunction_ = tileLoadFunction;
        return _this;
    }
    /**
     * Get the HTML image element for this tile (may be a Canvas, Image, or Video).
     * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
     * @api
     */
    ImageTile.prototype.getImage = function () {
        return this.image_;
    };
    /**
     * @inheritDoc
     */
    ImageTile.prototype.getKey = function () {
        return this.src_;
    };
    /**
     * Tracks loading or read errors.
     *
     * @private
     */
    ImageTile.prototype.handleImageError_ = function () {
        this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR;
        this.unlistenImage_();
        this.image_ = getBlankImage();
        this.changed();
    };
    /**
     * Tracks successful image load.
     *
     * @private
     */
    ImageTile.prototype.handleImageLoad_ = function () {
        var image = /** @type {HTMLImageElement} */ (this.image_);
        if (image.naturalWidth && image.naturalHeight) {
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED;
        }
        else {
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].EMPTY;
        }
        this.unlistenImage_();
        this.changed();
    };
    /**
     * @inheritDoc
     * @api
     */
    ImageTile.prototype.load = function () {
        if (this.state == _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR) {
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE;
            this.image_ = new Image();
            if (this.crossOrigin_ !== null) {
                this.image_.crossOrigin = this.crossOrigin_;
            }
        }
        if (this.state == _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE) {
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADING;
            this.changed();
            this.tileLoadFunction_(this, this.src_);
            this.unlisten_ = Object(_Image_js__WEBPACK_IMPORTED_MODULE_3__["listenImage"])(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this));
        }
    };
    /**
     * Discards event handlers which listen for load completion or errors.
     *
     * @private
     */
    ImageTile.prototype.unlistenImage_ = function () {
        if (this.unlisten_) {
            this.unlisten_();
            this.unlisten_ = null;
        }
    };
    return ImageTile;
}(_Tile_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * Get a 1-pixel blank image.
 * @return {HTMLCanvasElement} Blank image.
 */
function getBlankImage() {
    var ctx = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(1, 1);
    ctx.fillStyle = 'rgba(0,0,0,0)';
    ctx.fillRect(0, 0, 1, 1);
    return ctx.canvas;
}
/* harmony default export */ __webpack_exports__["default"] = (ImageTile);
//# sourceMappingURL=ImageTile.js.map

/***/ }),

/***/ "./node_modules/ol/Kinetic.js":
/*!************************************!*\
  !*** ./node_modules/ol/Kinetic.js ***!
  \************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/Kinetic
 */
/**
 * @classdesc
 * Implementation of inertial deceleration for map movement.
 *
 * @api
 */
var Kinetic = /** @class */ (function () {
    /**
     * @param {number} decay Rate of decay (must be negative).
     * @param {number} minVelocity Minimum velocity (pixels/millisecond).
     * @param {number} delay Delay to consider to calculate the kinetic
     *     initial values (milliseconds).
     */
    function Kinetic(decay, minVelocity, delay) {
        /**
         * @private
         * @type {number}
         */
        this.decay_ = decay;
        /**
         * @private
         * @type {number}
         */
        this.minVelocity_ = minVelocity;
        /**
         * @private
         * @type {number}
         */
        this.delay_ = delay;
        /**
         * @private
         * @type {Array<number>}
         */
        this.points_ = [];
        /**
         * @private
         * @type {number}
         */
        this.angle_ = 0;
        /**
         * @private
         * @type {number}
         */
        this.initialVelocity_ = 0;
    }
    /**
     * FIXME empty description for jsdoc
     */
    Kinetic.prototype.begin = function () {
        this.points_.length = 0;
        this.angle_ = 0;
        this.initialVelocity_ = 0;
    };
    /**
     * @param {number} x X.
     * @param {number} y Y.
     */
    Kinetic.prototype.update = function (x, y) {
        this.points_.push(x, y, Date.now());
    };
    /**
     * @return {boolean} Whether we should do kinetic animation.
     */
    Kinetic.prototype.end = function () {
        if (this.points_.length < 6) {
            // at least 2 points are required (i.e. there must be at least 6 elements
            // in the array)
            return false;
        }
        var delay = Date.now() - this.delay_;
        var lastIndex = this.points_.length - 3;
        if (this.points_[lastIndex + 2] < delay) {
            // the last tracked point is too old, which means that the user stopped
            // panning before releasing the map
            return false;
        }
        // get the first point which still falls into the delay time
        var firstIndex = lastIndex - 3;
        while (firstIndex > 0 && this.points_[firstIndex + 2] > delay) {
            firstIndex -= 3;
        }
        var duration = this.points_[lastIndex + 2] - this.points_[firstIndex + 2];
        // we don't want a duration of 0 (divide by zero)
        // we also make sure the user panned for a duration of at least one frame
        // (1/60s) to compute sane displacement values
        if (duration < 1000 / 60) {
            return false;
        }
        var dx = this.points_[lastIndex] - this.points_[firstIndex];
        var dy = this.points_[lastIndex + 1] - this.points_[firstIndex + 1];
        this.angle_ = Math.atan2(dy, dx);
        this.initialVelocity_ = Math.sqrt(dx * dx + dy * dy) / duration;
        return this.initialVelocity_ > this.minVelocity_;
    };
    /**
     * @return {number} Total distance travelled (pixels).
     */
    Kinetic.prototype.getDistance = function () {
        return (this.minVelocity_ - this.initialVelocity_) / this.decay_;
    };
    /**
     * @return {number} Angle of the kinetic panning animation (radians).
     */
    Kinetic.prototype.getAngle = function () {
        return this.angle_;
    };
    return Kinetic;
}());
/* harmony default export */ __webpack_exports__["default"] = (Kinetic);
//# sourceMappingURL=Kinetic.js.map

/***/ }),

/***/ "./node_modules/ol/Map.js":
/*!********************************!*\
  !*** ./node_modules/ol/Map.js ***!
  \********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _PluggableMap_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PluggableMap.js */ "./node_modules/ol/PluggableMap.js");
/* harmony import */ var _control_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./control.js */ "./node_modules/ol/control.js");
/* harmony import */ var _interaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interaction.js */ "./node_modules/ol/interaction.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _renderer_Composite_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./renderer/Composite.js */ "./node_modules/ol/renderer/Composite.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Map
 */





/**
 * @classdesc
 * The map is the core component of OpenLayers. For a map to render, a view,
 * one or more layers, and a target container are needed:
 *
 *     import Map from 'ol/Map';
 *     import View from 'ol/View';
 *     import TileLayer from 'ol/layer/Tile';
 *     import OSM from 'ol/source/OSM';
 *
 *     var map = new Map({
 *       view: new View({
 *         center: [0, 0],
 *         zoom: 1
 *       }),
 *       layers: [
 *         new TileLayer({
 *           source: new OSM()
 *         })
 *       ],
 *       target: 'map'
 *     });
 *
 * The above snippet creates a map using a {@link module:ol/layer/Tile} to
 * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM
 * element with the id `map`.
 *
 * The constructor places a viewport container (with CSS class name
 * `ol-viewport`) in the target element (see `getViewport()`), and then two
 * further elements within the viewport: one with CSS class name
 * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with
 * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent`
 * option of {@link module:ol/Overlay~Overlay} for the difference). The map
 * itself is placed in a further element within the viewport.
 *
 * Layers are stored as a {@link module:ol/Collection~Collection} in
 * layerGroups. A top-level group is provided by the library. This is what is
 * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the
 * options are added to this group, and `addLayer` and `removeLayer` change the
 * layer collection in the group. `getLayers` is a convenience function for
 * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~Group}
 * is a subclass of {@link module:ol/layer/Base}, so layers entered in the
 * options or added with `addLayer` can be groups, which can contain further
 * groups, and so on.
 *
 * @api
 */
var Map = /** @class */ (function (_super) {
    __extends(Map, _super);
    /**
     * @param {import("./PluggableMap.js").MapOptions} options Map options.
     */
    function Map(options) {
        var _this = this;
        options = Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])({}, options);
        if (!options.controls) {
            options.controls = Object(_control_js__WEBPACK_IMPORTED_MODULE_1__["defaults"])();
        }
        if (!options.interactions) {
            options.interactions = Object(_interaction_js__WEBPACK_IMPORTED_MODULE_2__["defaults"])();
        }
        _this = _super.call(this, options) || this;
        return _this;
    }
    Map.prototype.createRenderer = function () {
        return new _renderer_Composite_js__WEBPACK_IMPORTED_MODULE_4__["default"](this);
    };
    return Map;
}(_PluggableMap_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Map);
//# sourceMappingURL=Map.js.map

/***/ }),

/***/ "./node_modules/ol/MapBrowserEvent.js":
/*!********************************************!*\
  !*** ./node_modules/ol/MapBrowserEvent.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _MapEvent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./MapEvent.js */ "./node_modules/ol/MapEvent.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/MapBrowserEvent
 */

/**
 * @classdesc
 * Events emitted as map browser events are instances of this type.
 * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map browser event.
 */
var MapBrowserEvent = /** @class */ (function (_super) {
    __extends(MapBrowserEvent, _super);
    /**
     * @param {string} type Event type.
     * @param {import("./PluggableMap.js").default} map Map.
     * @param {Event} browserEvent Browser event.
     * @param {boolean=} opt_dragging Is the map currently being dragged?
     * @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
     */
    function MapBrowserEvent(type, map, browserEvent, opt_dragging, opt_frameState) {
        var _this = _super.call(this, type, map, opt_frameState) || this;
        /**
         * The original browser event.
         * @const
         * @type {Event}
         * @api
         */
        _this.originalEvent = browserEvent;
        /**
         * The map pixel relative to the viewport corresponding to the original browser event.
         * @type {?import("./pixel.js").Pixel}
         */
        _this.pixel_ = null;
        /**
         * The coordinate in the user projection corresponding to the original browser event.
         * @type {?import("./coordinate.js").Coordinate}
         */
        _this.coordinate_ = null;
        /**
         * Indicates if the map is currently being dragged. Only set for
         * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.
         *
         * @type {boolean}
         * @api
         */
        _this.dragging = opt_dragging !== undefined ? opt_dragging : false;
        return _this;
    }
    Object.defineProperty(MapBrowserEvent.prototype, "pixel", {
        /**
         * The map pixel relative to the viewport corresponding to the original browser event.
         * @type {import("./pixel.js").Pixel}
         * @api
         */
        get: function () {
            if (!this.pixel_) {
                this.pixel_ = this.map.getEventPixel(this.originalEvent);
            }
            return this.pixel_;
        },
        set: function (pixel) {
            this.pixel_ = pixel;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MapBrowserEvent.prototype, "coordinate", {
        /**
         * The coordinate corresponding to the original browser event.  This will be in the user
         * projection if one is set.  Otherwise it will be in the view projection.
         * @type {import("./coordinate.js").Coordinate}
         * @api
         */
        get: function () {
            if (!this.coordinate_) {
                this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);
            }
            return this.coordinate_;
        },
        set: function (coordinate) {
            this.coordinate_ = coordinate;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Prevents the default browser action.
     * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.
     * @override
     * @api
     */
    MapBrowserEvent.prototype.preventDefault = function () {
        _super.prototype.preventDefault.call(this);
        this.originalEvent.preventDefault();
    };
    /**
     * Prevents further propagation of the current event.
     * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.
     * @override
     * @api
     */
    MapBrowserEvent.prototype.stopPropagation = function () {
        _super.prototype.stopPropagation.call(this);
        this.originalEvent.stopPropagation();
    };
    return MapBrowserEvent;
}(_MapEvent_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (MapBrowserEvent);
//# sourceMappingURL=MapBrowserEvent.js.map

/***/ }),

/***/ "./node_modules/ol/MapBrowserEventHandler.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/MapBrowserEventHandler.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var elm_pep__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! elm-pep */ "./node_modules/elm-pep/dist/elm-pep.js");
/* harmony import */ var elm_pep__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(elm_pep__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./has.js */ "./node_modules/ol/has.js");
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
/* harmony import */ var _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./MapBrowserPointerEvent.js */ "./node_modules/ol/MapBrowserPointerEvent.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_Target_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./events/Target.js */ "./node_modules/ol/events/Target.js");
/* harmony import */ var _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pointer/EventType.js */ "./node_modules/ol/pointer/EventType.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
/**
 * @module ol/MapBrowserEventHandler
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();








var MapBrowserEventHandler = /** @class */ (function (_super) {
    __extends(MapBrowserEventHandler, _super);
    /**
     * @param {import("./PluggableMap.js").default} map The map with the viewport to listen to events on.
     * @param {number=} moveTolerance The minimal distance the pointer must travel to trigger a move.
     */
    function MapBrowserEventHandler(map, moveTolerance) {
        var _this = _super.call(this, map) || this;
        /**
         * This is the element that we will listen to the real events on.
         * @type {import("./PluggableMap.js").default}
         * @private
         */
        _this.map_ = map;
        /**
         * @type {any}
         * @private
         */
        _this.clickTimeoutId_;
        /**
         * @type {boolean}
         * @private
         */
        _this.dragging_ = false;
        /**
         * @type {!Array<import("./events.js").EventsKey>}
         * @private
         */
        _this.dragListenerKeys_ = [];
        /**
         * @type {number}
         * @private
         */
        _this.moveTolerance_ = moveTolerance ?
            moveTolerance * _has_js__WEBPACK_IMPORTED_MODULE_1__["DEVICE_PIXEL_RATIO"] : _has_js__WEBPACK_IMPORTED_MODULE_1__["DEVICE_PIXEL_RATIO"];
        /**
         * The most recent "down" type event (or null if none have occurred).
         * Set on pointerdown.
         * @type {PointerEvent}
         * @private
         */
        _this.down_ = null;
        var element = _this.map_.getViewport();
        /**
         * @type {number}
         * @private
         */
        _this.activePointers_ = 0;
        /**
         * @type {!Object<number, boolean>}
         * @private
         */
        _this.trackedTouches_ = {};
        _this.element_ = element;
        /**
         * @type {?import("./events.js").EventsKey}
         * @private
         */
        _this.pointerdownListenerKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listen"])(element, _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POINTERDOWN, _this.handlePointerDown_, _this);
        /**
         * @type {PointerEvent}
         * @private
         */
        _this.originalPointerMoveEvent_;
        /**
         * @type {?import("./events.js").EventsKey}
         * @private
         */
        _this.relayedListenerKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listen"])(element, _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POINTERMOVE, _this.relayEvent_, _this);
        /**
         * @private
         */
        _this.boundHandleTouchMove_ = _this.handleTouchMove_.bind(_this);
        _this.element_.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_7__["default"].TOUCHMOVE, _this.boundHandleTouchMove_, _has_js__WEBPACK_IMPORTED_MODULE_1__["PASSIVE_EVENT_LISTENERS"] ? { passive: false } : false);
        return _this;
    }
    /**
     * @param {PointerEvent} pointerEvent Pointer
     * event.
     * @private
     */
    MapBrowserEventHandler.prototype.emulateClick_ = function (pointerEvent) {
        var newEvent = new _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__["default"](_MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].CLICK, this.map_, pointerEvent);
        this.dispatchEvent(newEvent);
        if (this.clickTimeoutId_ !== undefined) {
            // double-click
            clearTimeout(this.clickTimeoutId_);
            this.clickTimeoutId_ = undefined;
            newEvent = new _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__["default"](_MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].DBLCLICK, this.map_, pointerEvent);
            this.dispatchEvent(newEvent);
        }
        else {
            // click
            this.clickTimeoutId_ = setTimeout(function () {
                this.clickTimeoutId_ = undefined;
                var newEvent = new _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__["default"](_MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].SINGLECLICK, this.map_, pointerEvent);
                this.dispatchEvent(newEvent);
            }.bind(this), 250);
        }
    };
    /**
     * Keeps track on how many pointers are currently active.
     *
     * @param {PointerEvent} pointerEvent Pointer
     * event.
     * @private
     */
    MapBrowserEventHandler.prototype.updateActivePointers_ = function (pointerEvent) {
        var event = pointerEvent;
        if (event.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERUP ||
            event.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERCANCEL) {
            delete this.trackedTouches_[event.pointerId];
        }
        else if (event.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERDOWN) {
            this.trackedTouches_[event.pointerId] = true;
        }
        this.activePointers_ = Object.keys(this.trackedTouches_).length;
    };
    /**
     * @param {PointerEvent} pointerEvent Pointer
     * event.
     * @private
     */
    MapBrowserEventHandler.prototype.handlePointerUp_ = function (pointerEvent) {
        this.updateActivePointers_(pointerEvent);
        var newEvent = new _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__["default"](_MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERUP, this.map_, pointerEvent);
        this.dispatchEvent(newEvent);
        // We emulate click events on left mouse button click, touch contact, and pen
        // contact. isMouseActionButton returns true in these cases (evt.button is set
        // to 0).
        // See http://www.w3.org/TR/pointerevents/#button-states
        // We only fire click, singleclick, and doubleclick if nobody has called
        // event.stopPropagation() or event.preventDefault().
        if (!newEvent.propagationStopped && !this.dragging_ && this.isMouseActionButton_(pointerEvent)) {
            this.emulateClick_(this.down_);
        }
        if (this.activePointers_ === 0) {
            this.dragListenerKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_4__["unlistenByKey"]);
            this.dragListenerKeys_.length = 0;
            this.dragging_ = false;
            this.down_ = null;
        }
    };
    /**
     * @param {PointerEvent} pointerEvent Pointer
     * event.
     * @return {boolean} If the left mouse button was pressed.
     * @private
     */
    MapBrowserEventHandler.prototype.isMouseActionButton_ = function (pointerEvent) {
        return pointerEvent.button === 0;
    };
    /**
     * @param {PointerEvent} pointerEvent Pointer
     * event.
     * @private
     */
    MapBrowserEventHandler.prototype.handlePointerDown_ = function (pointerEvent) {
        this.updateActivePointers_(pointerEvent);
        var newEvent = new _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__["default"](_MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERDOWN, this.map_, pointerEvent);
        this.dispatchEvent(newEvent);
        this.down_ = pointerEvent;
        if (this.dragListenerKeys_.length === 0) {
            this.dragListenerKeys_.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listen"])(document, _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERMOVE, this.handlePointerMove_, this), Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listen"])(document, _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERUP, this.handlePointerUp_, this), 
            /* Note that the listener for `pointercancel is set up on
             * `pointerEventHandler_` and not `documentPointerEventHandler_` like
             * the `pointerup` and `pointermove` listeners.
             *
             * The reason for this is the following: `TouchSource.vacuumTouches_()`
             * issues `pointercancel` events, when there was no `touchend` for a
             * `touchstart`. Now, let's say a first `touchstart` is registered on
             * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.
             * But `documentPointerEventHandler_` doesn't know about the first
             * `touchstart`. If there is no `touchend` for the `touchstart`, we can
             * only receive a `touchcancel` from `pointerEventHandler_`, because it is
             * only registered there.
             */
            Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listen"])(this.element_, _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERCANCEL, this.handlePointerUp_, this));
        }
    };
    /**
     * @param {PointerEvent} pointerEvent Pointer
     * event.
     * @private
     */
    MapBrowserEventHandler.prototype.handlePointerMove_ = function (pointerEvent) {
        // Between pointerdown and pointerup, pointermove events are triggered.
        // To avoid a 'false' touchmove event to be dispatched, we test if the pointer
        // moved a significant distance.
        if (this.isMoving_(pointerEvent)) {
            this.dragging_ = true;
            var newEvent = new _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__["default"](_MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERDRAG, this.map_, pointerEvent, this.dragging_);
            this.dispatchEvent(newEvent);
        }
    };
    /**
     * Wrap and relay a pointer event.  Note that this requires that the type
     * string for the MapBrowserPointerEvent matches the PointerEvent type.
     * @param {PointerEvent} pointerEvent Pointer
     * event.
     * @private
     */
    MapBrowserEventHandler.prototype.relayEvent_ = function (pointerEvent) {
        this.originalPointerMoveEvent_ = pointerEvent;
        var dragging = !!(this.down_ && this.isMoving_(pointerEvent));
        this.dispatchEvent(new _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__["default"](pointerEvent.type, this.map_, pointerEvent, dragging));
    };
    /**
     * Flexible handling of a `touch-action: none` css equivalent: because calling
     * `preventDefault()` on a `pointermove` event does not stop native page scrolling
     * and zooming, we also listen for `touchmove` and call `preventDefault()` on it
     * when an interaction (currently `DragPan` handles the event.
     * @param {TouchEvent} event Event.
     * @private
     */
    MapBrowserEventHandler.prototype.handleTouchMove_ = function (event) {
        // Due to https://github.com/mpizenberg/elm-pep/issues/2, `this.originalPointerMoveEvent_`
        // may not be initialized yet when we get here on a platform without native pointer events.
        if (!this.originalPointerMoveEvent_ || this.originalPointerMoveEvent_.defaultPrevented) {
            event.preventDefault();
        }
    };
    /**
     * @param {PointerEvent} pointerEvent Pointer
     * event.
     * @return {boolean} Is moving.
     * @private
     */
    MapBrowserEventHandler.prototype.isMoving_ = function (pointerEvent) {
        return this.dragging_ ||
            Math.abs(pointerEvent.clientX - this.down_.clientX) > this.moveTolerance_ ||
            Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_;
    };
    /**
     * @inheritDoc
     */
    MapBrowserEventHandler.prototype.disposeInternal = function () {
        if (this.relayedListenerKey_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["unlistenByKey"])(this.relayedListenerKey_);
            this.relayedListenerKey_ = null;
        }
        this.element_.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_7__["default"].TOUCHMOVE, this.boundHandleTouchMove_);
        if (this.pointerdownListenerKey_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["unlistenByKey"])(this.pointerdownListenerKey_);
            this.pointerdownListenerKey_ = null;
        }
        this.dragListenerKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_4__["unlistenByKey"]);
        this.dragListenerKeys_.length = 0;
        this.element_ = null;
        _super.prototype.disposeInternal.call(this);
    };
    return MapBrowserEventHandler;
}(_events_Target_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (MapBrowserEventHandler);
//# sourceMappingURL=MapBrowserEventHandler.js.map

/***/ }),

/***/ "./node_modules/ol/MapBrowserEventType.js":
/*!************************************************!*\
  !*** ./node_modules/ol/MapBrowserEventType.js ***!
  \************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
/**
 * @module ol/MapBrowserEventType
 */

/**
 * Constants for event names.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * A true single click with no dragging and no double click. Note that this
     * event is delayed by 250 ms to ensure that it is not a double click.
     * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick
     * @api
     */
    SINGLECLICK: 'singleclick',
    /**
     * A click with no dragging. A double click will fire two of this.
     * @event module:ol/MapBrowserEvent~MapBrowserEvent#click
     * @api
     */
    CLICK: _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].CLICK,
    /**
     * A true double click, with no dragging.
     * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick
     * @api
     */
    DBLCLICK: _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].DBLCLICK,
    /**
     * Triggered when a pointer is dragged.
     * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag
     * @api
     */
    POINTERDRAG: 'pointerdrag',
    /**
     * Triggered when a pointer is moved. Note that on touch devices this is
     * triggered when the map is panned, so is not the same as mousemove.
     * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove
     * @api
     */
    POINTERMOVE: 'pointermove',
    POINTERDOWN: 'pointerdown',
    POINTERUP: 'pointerup',
    POINTEROVER: 'pointerover',
    POINTEROUT: 'pointerout',
    POINTERENTER: 'pointerenter',
    POINTERLEAVE: 'pointerleave',
    POINTERCANCEL: 'pointercancel'
});
//# sourceMappingURL=MapBrowserEventType.js.map

/***/ }),

/***/ "./node_modules/ol/MapBrowserPointerEvent.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/MapBrowserPointerEvent.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./MapBrowserEvent.js */ "./node_modules/ol/MapBrowserEvent.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/MapBrowserPointerEvent
 */

var MapBrowserPointerEvent = /** @class */ (function (_super) {
    __extends(MapBrowserPointerEvent, _super);
    /**
     * @param {string} type Event type.
     * @param {import("./PluggableMap.js").default} map Map.
     * @param {PointerEvent} pointerEvent Pointer event.
     * @param {boolean=} opt_dragging Is the map currently being dragged?
     * @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
     */
    function MapBrowserPointerEvent(type, map, pointerEvent, opt_dragging, opt_frameState) {
        var _this = _super.call(this, type, map, pointerEvent, opt_dragging, opt_frameState) || this;
        /**
         * @const
         * @type {PointerEvent}
         */
        _this.pointerEvent = pointerEvent;
        return _this;
    }
    return MapBrowserPointerEvent;
}(_MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (MapBrowserPointerEvent);
//# sourceMappingURL=MapBrowserPointerEvent.js.map

/***/ }),

/***/ "./node_modules/ol/MapEvent.js":
/*!*************************************!*\
  !*** ./node_modules/ol/MapEvent.js ***!
  \*************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./events/Event.js */ "./node_modules/ol/events/Event.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/MapEvent
 */

/**
 * @classdesc
 * Events emitted as map events are instances of this type.
 * See {@link module:ol/PluggableMap~PluggableMap} for which events trigger a map event.
 */
var MapEvent = /** @class */ (function (_super) {
    __extends(MapEvent, _super);
    /**
     * @param {string} type Event type.
     * @param {import("./PluggableMap.js").default} map Map.
     * @param {?import("./PluggableMap.js").FrameState=} opt_frameState Frame state.
     */
    function MapEvent(type, map, opt_frameState) {
        var _this = _super.call(this, type) || this;
        /**
         * The map where the event occurred.
         * @type {import("./PluggableMap.js").default}
         * @api
         */
        _this.map = map;
        /**
         * The frame state at the time of the event.
         * @type {?import("./PluggableMap.js").FrameState}
         * @api
         */
        _this.frameState = opt_frameState !== undefined ? opt_frameState : null;
        return _this;
    }
    return MapEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (MapEvent);
//# sourceMappingURL=MapEvent.js.map

/***/ }),

/***/ "./node_modules/ol/MapEventType.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/MapEventType.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/MapEventType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Triggered after a map frame is rendered.
     * @event module:ol/MapEvent~MapEvent#postrender
     * @api
     */
    POSTRENDER: 'postrender',
    /**
     * Triggered when the map starts moving.
     * @event module:ol/MapEvent~MapEvent#movestart
     * @api
     */
    MOVESTART: 'movestart',
    /**
     * Triggered after the map is moved.
     * @event module:ol/MapEvent~MapEvent#moveend
     * @api
     */
    MOVEEND: 'moveend'
});
//# sourceMappingURL=MapEventType.js.map

/***/ }),

/***/ "./node_modules/ol/MapProperty.js":
/*!****************************************!*\
  !*** ./node_modules/ol/MapProperty.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/MapProperty
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    LAYERGROUP: 'layergroup',
    SIZE: 'size',
    TARGET: 'target',
    VIEW: 'view'
});
//# sourceMappingURL=MapProperty.js.map

/***/ }),

/***/ "./node_modules/ol/Object.js":
/*!***********************************!*\
  !*** ./node_modules/ol/Object.js ***!
  \***********************************/
/*! exports provided: ObjectEvent, getChangeEventType, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObjectEvent", function() { return ObjectEvent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getChangeEventType", function() { return getChangeEventType; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ObjectEventType.js */ "./node_modules/ol/ObjectEventType.js");
/* harmony import */ var _Observable_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Observable.js */ "./node_modules/ol/Observable.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./obj.js */ "./node_modules/ol/obj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Object
 */





/**
 * @classdesc
 * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.
 */
var ObjectEvent = /** @class */ (function (_super) {
    __extends(ObjectEvent, _super);
    /**
     * @param {string} type The event type.
     * @param {string} key The property name.
     * @param {*} oldValue The old value for `key`.
     */
    function ObjectEvent(type, key, oldValue) {
        var _this = _super.call(this, type) || this;
        /**
         * The name of the property whose value is changing.
         * @type {string}
         * @api
         */
        _this.key = key;
        /**
         * The old value. To get the new value use `e.target.get(e.key)` where
         * `e` is the event object.
         * @type {*}
         * @api
         */
        _this.oldValue = oldValue;
        return _this;
    }
    return ObjectEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_3__["default"]));

/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Most non-trivial classes inherit from this.
 *
 * This extends {@link module:ol/Observable} with observable
 * properties, where each property is observable as well as the object as a
 * whole.
 *
 * Classes that inherit from this have pre-defined properties, to which you can
 * add your owns. The pre-defined properties are listed in this documentation as
 * 'Observable Properties', and have their own accessors; for example,
 * {@link module:ol/Map~Map} has a `target` property, accessed with
 * `getTarget()` and changed with `setTarget()`. Not all properties are however
 * settable. There are also general-purpose accessors `get()` and `set()`. For
 * example, `get('target')` is equivalent to `getTarget()`.
 *
 * The `set` accessors trigger a change event, and you can monitor this by
 * registering a listener. For example, {@link module:ol/View~View} has a
 * `center` property, so `view.on('change:center', function(evt) {...});` would
 * call the function whenever the value of the center property changes. Within
 * the function, `evt.target` would be the view, so `evt.target.getCenter()`
 * would return the new center.
 *
 * You can add your own observable properties with
 * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.
 * You can listen for changes on that property value with
 * `object.on('change:prop', listener)`. You can get a list of all
 * properties with {@link module:ol/Object~BaseObject#getProperties}.
 *
 * Note that the observable properties are separate from standard JS properties.
 * You can, for example, give your map object a title with
 * `map.title='New title'` and with `map.set('title', 'Another title')`. The
 * first will be a `hasOwnProperty`; the second will appear in
 * `getProperties()`. Only the second is observable.
 *
 * Properties can be deleted by using the unset method. E.g.
 * object.unset('foo').
 *
 * @fires ObjectEvent
 * @api
 */
var BaseObject = /** @class */ (function (_super) {
    __extends(BaseObject, _super);
    /**
     * @param {Object<string, *>=} opt_values An object with key-value pairs.
     */
    function BaseObject(opt_values) {
        var _this = _super.call(this) || this;
        // Call {@link module:ol/util~getUid} to ensure that the order of objects' ids is
        // the same as the order in which they were created.  This also helps to
        // ensure that object properties are always added in the same order, which
        // helps many JavaScript engines generate faster code.
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(_this);
        /**
         * @private
         * @type {!Object<string, *>}
         */
        _this.values_ = {};
        if (opt_values !== undefined) {
            _this.setProperties(opt_values);
        }
        return _this;
    }
    /**
     * Gets a value.
     * @param {string} key Key name.
     * @return {*} Value.
     * @api
     */
    BaseObject.prototype.get = function (key) {
        var value;
        if (this.values_.hasOwnProperty(key)) {
            value = this.values_[key];
        }
        return value;
    };
    /**
     * Get a list of object property names.
     * @return {Array<string>} List of property names.
     * @api
     */
    BaseObject.prototype.getKeys = function () {
        return Object.keys(this.values_);
    };
    /**
     * Get an object of all property names and values.
     * @return {Object<string, *>} Object.
     * @api
     */
    BaseObject.prototype.getProperties = function () {
        return Object(_obj_js__WEBPACK_IMPORTED_MODULE_4__["assign"])({}, this.values_);
    };
    /**
     * @param {string} key Key name.
     * @param {*} oldValue Old value.
     */
    BaseObject.prototype.notify = function (key, oldValue) {
        var eventType;
        eventType = getChangeEventType(key);
        this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));
        eventType = _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].PROPERTYCHANGE;
        this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));
    };
    /**
     * Sets a value.
     * @param {string} key Key name.
     * @param {*} value Value.
     * @param {boolean=} opt_silent Update without triggering an event.
     * @api
     */
    BaseObject.prototype.set = function (key, value, opt_silent) {
        if (opt_silent) {
            this.values_[key] = value;
        }
        else {
            var oldValue = this.values_[key];
            this.values_[key] = value;
            if (oldValue !== value) {
                this.notify(key, oldValue);
            }
        }
    };
    /**
     * Sets a collection of key-value pairs.  Note that this changes any existing
     * properties and adds new ones (it does not remove any existing properties).
     * @param {Object<string, *>} values Values.
     * @param {boolean=} opt_silent Update without triggering an event.
     * @api
     */
    BaseObject.prototype.setProperties = function (values, opt_silent) {
        for (var key in values) {
            this.set(key, values[key], opt_silent);
        }
    };
    /**
     * Unsets a property.
     * @param {string} key Key name.
     * @param {boolean=} opt_silent Unset without triggering an event.
     * @api
     */
    BaseObject.prototype.unset = function (key, opt_silent) {
        if (key in this.values_) {
            var oldValue = this.values_[key];
            delete this.values_[key];
            if (!opt_silent) {
                this.notify(key, oldValue);
            }
        }
    };
    return BaseObject;
}(_Observable_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * @type {Object<string, string>}
 */
var changeEventTypeCache = {};
/**
 * @param {string} key Key name.
 * @return {string} Change name.
 */
function getChangeEventType(key) {
    return changeEventTypeCache.hasOwnProperty(key) ?
        changeEventTypeCache[key] :
        (changeEventTypeCache[key] = 'change:' + key);
}
/* harmony default export */ __webpack_exports__["default"] = (BaseObject);
//# sourceMappingURL=Object.js.map

/***/ }),

/***/ "./node_modules/ol/ObjectEventType.js":
/*!********************************************!*\
  !*** ./node_modules/ol/ObjectEventType.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/ObjectEventType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Triggered when a property is changed.
     * @event module:ol/Object.ObjectEvent#propertychange
     * @api
     */
    PROPERTYCHANGE: 'propertychange'
});
//# sourceMappingURL=ObjectEventType.js.map

/***/ }),

/***/ "./node_modules/ol/Observable.js":
/*!***************************************!*\
  !*** ./node_modules/ol/Observable.js ***!
  \***************************************/
/*! exports provided: unByKey, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unByKey", function() { return unByKey; });
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_Target_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events/Target.js */ "./node_modules/ol/events/Target.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Observable
 */



/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * An event target providing convenient methods for listener registration
 * and unregistration. A generic `change` event is always available through
 * {@link module:ol/Observable~Observable#changed}.
 *
 * @fires import("./events/Event.js").default
 * @api
 */
var Observable = /** @class */ (function (_super) {
    __extends(Observable, _super);
    function Observable() {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {number}
         */
        _this.revision_ = 0;
        return _this;
    }
    /**
     * Increases the revision counter and dispatches a 'change' event.
     * @api
     */
    Observable.prototype.changed = function () {
        ++this.revision_;
        this.dispatchEvent(_events_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].CHANGE);
    };
    /**
     * Get the version number for this object.  Each time the object is modified,
     * its version number will be incremented.
     * @return {number} Revision.
     * @api
     */
    Observable.prototype.getRevision = function () {
        return this.revision_;
    };
    /**
     * Listen for a certain type of event.
     * @param {string|Array<string>} type The event type or array of event types.
     * @param {import("./events.js").ListenerFunction} listener The listener function.
     * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
     *     called with an array of event types as the first argument, the return
     *     will be an array of keys.
     * @api
     */
    Observable.prototype.on = function (type, listener) {
        if (Array.isArray(type)) {
            var len = type.length;
            var keys = new Array(len);
            for (var i = 0; i < len; ++i) {
                keys[i] = Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["listen"])(this, type[i], listener);
            }
            return keys;
        }
        else {
            return Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["listen"])(this, /** @type {string} */ (type), listener);
        }
    };
    /**
     * Listen once for a certain type of event.
     * @param {string|Array<string>} type The event type or array of event types.
     * @param {function(?): ?} listener The listener function.
     * @return {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} Unique key for the listener. If
     *     called with an array of event types as the first argument, the return
     *     will be an array of keys.
     * @api
     */
    Observable.prototype.once = function (type, listener) {
        if (Array.isArray(type)) {
            var len = type.length;
            var keys = new Array(len);
            for (var i = 0; i < len; ++i) {
                keys[i] = Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["listenOnce"])(this, type[i], listener);
            }
            return keys;
        }
        else {
            return Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["listenOnce"])(this, /** @type {string} */ (type), listener);
        }
    };
    /**
     * Unlisten for a certain type of event.
     * @param {string|Array<string>} type The event type or array of event types.
     * @param {function(?): ?} listener The listener function.
     * @api
     */
    Observable.prototype.un = function (type, listener) {
        if (Array.isArray(type)) {
            for (var i = 0, ii = type.length; i < ii; ++i) {
                this.removeEventListener(type[i], listener);
            }
        }
        else {
            this.removeEventListener(type, listener);
        }
    };
    return Observable;
}(_events_Target_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * Removes an event listener using the key returned by `on()` or `once()`.
 * @param {import("./events.js").EventsKey|Array<import("./events.js").EventsKey>} key The key returned by `on()`
 *     or `once()` (or an array of keys).
 * @api
 */
function unByKey(key) {
    if (Array.isArray(key)) {
        for (var i = 0, ii = key.length; i < ii; ++i) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["unlistenByKey"])(key[i]);
        }
    }
    else {
        Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["unlistenByKey"])(/** @type {import("./events.js").EventsKey} */ (key));
    }
}
/* harmony default export */ __webpack_exports__["default"] = (Observable);
//# sourceMappingURL=Observable.js.map

/***/ }),

/***/ "./node_modules/ol/Overlay.js":
/*!************************************!*\
  !*** ./node_modules/ol/Overlay.js ***!
  \************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _MapEventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./MapEventType.js */ "./node_modules/ol/MapEventType.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./OverlayPositioning.js */ "./node_modules/ol/OverlayPositioning.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Overlay
 */







/**
 * @typedef {Object} Options
 * @property {number|string} [id] Set the overlay id. The overlay id can be used
 * with the {@link module:ol/Map~Map#getOverlayById} method.
 * @property {HTMLElement} [element] The overlay element.
 * @property {Array<number>} [offset=[0, 0]] Offsets in pixels used when positioning
 * the overlay. The first element in the
 * array is the horizontal offset. A positive value shifts the overlay right.
 * The second element in the array is the vertical offset. A positive value
 * shifts the overlay down.
 * @property {import("./coordinate.js").Coordinate} [position] The overlay position
 * in map projection.
 * @property {OverlayPositioning} [positioning='top-left'] Defines how
 * the overlay is actually positioned with respect to its `position` property.
 * Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,
 * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,
 * `'top-center'`, and `'top-right'`.
 * @property {boolean} [stopEvent=true] Whether event propagation to the map
 * viewport should be stopped. If `true` the overlay is placed in the same
 * container as that of the controls (CSS class name
 * `ol-overlaycontainer-stopevent`); if `false` it is placed in the container
 * with CSS class name specified by the `className` property.
 * @property {boolean} [insertFirst=true] Whether the overlay is inserted first
 * in the overlay container, or appended. If the overlay is placed in the same
 * container as that of the controls (see the `stopEvent` option) you will
 * probably set `insertFirst` to `true` so the overlay is displayed below the
 * controls.
 * @property {PanIntoViewOptions|boolean} [autoPan=false] Pan the map when calling
 * `setPosition`, so that the overlay is entirely visible in the current viewport?
 * If `true` (deprecated), then `autoPanAnimation` and `autoPanMargin` will be
 * used to determine the panning parameters; if an object is supplied then other
 * parameters are ignored.
 * @property {PanOptions} [autoPanAnimation] The animation options used to pan
 * the overlay into view. This animation is only used when `autoPan` is enabled.
 * A `duration` and `easing` may be provided to customize the animation.
 * Deprecated and ignored if `autoPan` is supplied as an object.
 * @property {number} [autoPanMargin=20] The margin (in pixels) between the
 * overlay and the borders of the map when autopanning. Deprecated and ignored
 * if `autoPan` is supplied as an object.
 * @property {PanIntoViewOptions} [autoPanOptions] The options to use for the
 * autoPan. This is only used when `autoPan` is enabled and has preference over
 * the individual `autoPanMargin` and `autoPanOptions`.
 * @property {string} [className='ol-overlay-container ol-selectable'] CSS class
 * name.
 */
/**
 * @typedef {Object} PanOptions
 * @property {number} [duration=1000] The duration of the animation in
 * milliseconds.
 * @property {function(number):number} [easing] The easing function to use. Can
 * be one from {@link module:ol/easing} or a custom function.
 * Default is {@link module:ol/easing~inAndOut}.
 */
/**
 * @typedef {Object} PanIntoViewOptions
 * @property {PanOptions} [animation={}] The animation parameters for the pan
 * @property {number} [margin=20] The margin (in pixels) between the
 * overlay and the borders of the map when panning into view.
 */
/**
 * @enum {string}
 * @protected
 */
var Property = {
    ELEMENT: 'element',
    MAP: 'map',
    OFFSET: 'offset',
    POSITION: 'position',
    POSITIONING: 'positioning'
};
/**
 * @classdesc
 * An element to be displayed over the map and attached to a single map
 * location.  Like {@link module:ol/control/Control~Control}, Overlays are
 * visible widgets. Unlike Controls, they are not in a fixed position on the
 * screen, but are tied to a geographical coordinate, so panning the map will
 * move an Overlay but not a Control.
 *
 * Example:
 *
 *     import Overlay from 'ol/Overlay';
 *
 *     var popup = new Overlay({
 *       element: document.getElementById('popup')
 *     });
 *     popup.setPosition(coordinate);
 *     map.addOverlay(popup);
 *
 * @api
 */
var Overlay = /** @class */ (function (_super) {
    __extends(Overlay, _super);
    /**
     * @param {Options} options Overlay options.
     */
    function Overlay(options) {
        var _this = _super.call(this) || this;
        /**
         * @protected
         * @type {Options}
         */
        _this.options = options;
        /**
         * @protected
         * @type {number|string|undefined}
         */
        _this.id = options.id;
        /**
         * @protected
         * @type {boolean}
         */
        _this.insertFirst = options.insertFirst !== undefined ?
            options.insertFirst : true;
        /**
         * @protected
         * @type {boolean}
         */
        _this.stopEvent = options.stopEvent !== undefined ? options.stopEvent : true;
        /**
         * @protected
         * @type {HTMLElement}
         */
        _this.element = document.createElement('div');
        _this.element.className = options.className !== undefined ?
            options.className : 'ol-overlay-container ' + _css_js__WEBPACK_IMPORTED_MODULE_3__["CLASS_SELECTABLE"];
        _this.element.style.position = 'absolute';
        var autoPan = options.autoPan;
        if (autoPan && ('object' !== typeof autoPan)) {
            autoPan = {
                animation: options.autoPanAnimation,
                margin: options.autoPanMargin
            };
        }
        /**
         * @protected
         * @type {PanIntoViewOptions|false}
         */
        _this.autoPan = /** @type {PanIntoViewOptions} */ (autoPan) || false;
        /**
         * @protected
         * @type {{transform_: string,
         *         visible: boolean}}
         */
        _this.rendered = {
            transform_: '',
            visible: true
        };
        /**
         * @protected
         * @type {?import("./events.js").EventsKey}
         */
        _this.mapPostrenderListenerKey = null;
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_1__["getChangeEventType"])(Property.ELEMENT), _this.handleElementChanged);
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_1__["getChangeEventType"])(Property.MAP), _this.handleMapChanged);
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_1__["getChangeEventType"])(Property.OFFSET), _this.handleOffsetChanged);
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_1__["getChangeEventType"])(Property.POSITION), _this.handlePositionChanged);
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_1__["getChangeEventType"])(Property.POSITIONING), _this.handlePositioningChanged);
        if (options.element !== undefined) {
            _this.setElement(options.element);
        }
        _this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);
        _this.setPositioning(options.positioning !== undefined ?
            /** @type {OverlayPositioning} */ (options.positioning) :
            _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].TOP_LEFT);
        if (options.position !== undefined) {
            _this.setPosition(options.position);
        }
        return _this;
    }
    /**
     * Get the DOM element of this overlay.
     * @return {HTMLElement|undefined} The Element containing the overlay.
     * @observable
     * @api
     */
    Overlay.prototype.getElement = function () {
        return /** @type {HTMLElement|undefined} */ (this.get(Property.ELEMENT));
    };
    /**
     * Get the overlay identifier which is set on constructor.
     * @return {number|string|undefined} Id.
     * @api
     */
    Overlay.prototype.getId = function () {
        return this.id;
    };
    /**
     * Get the map associated with this overlay.
     * @return {import("./PluggableMap.js").default|undefined} The map that the
     * overlay is part of.
     * @observable
     * @api
     */
    Overlay.prototype.getMap = function () {
        return (
        /** @type {import("./PluggableMap.js").default|undefined} */ (this.get(Property.MAP)));
    };
    /**
     * Get the offset of this overlay.
     * @return {Array<number>} The offset.
     * @observable
     * @api
     */
    Overlay.prototype.getOffset = function () {
        return /** @type {Array<number>} */ (this.get(Property.OFFSET));
    };
    /**
     * Get the current position of this overlay.
     * @return {import("./coordinate.js").Coordinate|undefined} The spatial point that the overlay is
     *     anchored at.
     * @observable
     * @api
     */
    Overlay.prototype.getPosition = function () {
        return (
        /** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(Property.POSITION)));
    };
    /**
     * Get the current positioning of this overlay.
     * @return {OverlayPositioning} How the overlay is positioned
     *     relative to its point on the map.
     * @observable
     * @api
     */
    Overlay.prototype.getPositioning = function () {
        return (
        /** @type {OverlayPositioning} */ (this.get(Property.POSITIONING)));
    };
    /**
     * @protected
     */
    Overlay.prototype.handleElementChanged = function () {
        Object(_dom_js__WEBPACK_IMPORTED_MODULE_4__["removeChildren"])(this.element);
        var element = this.getElement();
        if (element) {
            this.element.appendChild(element);
        }
    };
    /**
     * @protected
     */
    Overlay.prototype.handleMapChanged = function () {
        if (this.mapPostrenderListenerKey) {
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_4__["removeNode"])(this.element);
            Object(_events_js__WEBPACK_IMPORTED_MODULE_5__["unlistenByKey"])(this.mapPostrenderListenerKey);
            this.mapPostrenderListenerKey = null;
        }
        var map = this.getMap();
        if (map) {
            this.mapPostrenderListenerKey = Object(_events_js__WEBPACK_IMPORTED_MODULE_5__["listen"])(map, _MapEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POSTRENDER, this.render, this);
            this.updatePixelPosition();
            var container = this.stopEvent ?
                map.getOverlayContainerStopEvent() : map.getOverlayContainer();
            if (this.insertFirst) {
                container.insertBefore(this.element, container.childNodes[0] || null);
            }
            else {
                container.appendChild(this.element);
            }
            this.performAutoPan();
        }
    };
    /**
     * @protected
     */
    Overlay.prototype.render = function () {
        this.updatePixelPosition();
    };
    /**
     * @protected
     */
    Overlay.prototype.handleOffsetChanged = function () {
        this.updatePixelPosition();
    };
    /**
     * @protected
     */
    Overlay.prototype.handlePositionChanged = function () {
        this.updatePixelPosition();
        this.performAutoPan();
    };
    /**
     * @protected
     */
    Overlay.prototype.handlePositioningChanged = function () {
        this.updatePixelPosition();
    };
    /**
     * Set the DOM element to be associated with this overlay.
     * @param {HTMLElement|undefined} element The Element containing the overlay.
     * @observable
     * @api
     */
    Overlay.prototype.setElement = function (element) {
        this.set(Property.ELEMENT, element);
    };
    /**
     * Set the map to be associated with this overlay.
     * @param {import("./PluggableMap.js").default|undefined} map The map that the
     * overlay is part of.
     * @observable
     * @api
     */
    Overlay.prototype.setMap = function (map) {
        this.set(Property.MAP, map);
    };
    /**
     * Set the offset for this overlay.
     * @param {Array<number>} offset Offset.
     * @observable
     * @api
     */
    Overlay.prototype.setOffset = function (offset) {
        this.set(Property.OFFSET, offset);
    };
    /**
     * Set the position for this overlay. If the position is `undefined` the
     * overlay is hidden.
     * @param {import("./coordinate.js").Coordinate|undefined} position The spatial point that the overlay
     *     is anchored at.
     * @observable
     * @api
     */
    Overlay.prototype.setPosition = function (position) {
        this.set(Property.POSITION, position);
    };
    /**
     * Pan the map so that the overlay is entirely visisble in the current viewport
     * (if necessary) using the configured autoPan parameters
     * @protected
     */
    Overlay.prototype.performAutoPan = function () {
        if (this.autoPan) {
            this.panIntoView(this.autoPan);
        }
    };
    /**
     * Pan the map so that the overlay is entirely visible in the current viewport
     * (if necessary).
     * @param {PanIntoViewOptions|undefined} panIntoViewOptions Options for the pan action
     * @api
     */
    Overlay.prototype.panIntoView = function (panIntoViewOptions) {
        var map = this.getMap();
        if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) {
            return;
        }
        var mapRect = this.getRect(map.getTargetElement(), map.getSize());
        var element = this.getElement();
        var overlayRect = this.getRect(element, [Object(_dom_js__WEBPACK_IMPORTED_MODULE_4__["outerWidth"])(element), Object(_dom_js__WEBPACK_IMPORTED_MODULE_4__["outerHeight"])(element)]);
        var myMargin = (panIntoViewOptions.margin === undefined) ? 20 : panIntoViewOptions.margin;
        if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["containsExtent"])(mapRect, overlayRect)) {
            // the overlay is not completely inside the viewport, so pan the map
            var offsetLeft = overlayRect[0] - mapRect[0];
            var offsetRight = mapRect[2] - overlayRect[2];
            var offsetTop = overlayRect[1] - mapRect[1];
            var offsetBottom = mapRect[3] - overlayRect[3];
            var delta = [0, 0];
            if (offsetLeft < 0) {
                // move map to the left
                delta[0] = offsetLeft - myMargin;
            }
            else if (offsetRight < 0) {
                // move map to the right
                delta[0] = Math.abs(offsetRight) + myMargin;
            }
            if (offsetTop < 0) {
                // move map up
                delta[1] = offsetTop - myMargin;
            }
            else if (offsetBottom < 0) {
                // move map down
                delta[1] = Math.abs(offsetBottom) + myMargin;
            }
            if (delta[0] !== 0 || delta[1] !== 0) {
                var center = /** @type {import("./coordinate.js").Coordinate} */ (map.getView().getCenterInternal());
                var centerPx = map.getPixelFromCoordinateInternal(center);
                var newCenterPx = [
                    centerPx[0] + delta[0],
                    centerPx[1] + delta[1]
                ];
                var panOptions = panIntoViewOptions.animation || {};
                map.getView().animateInternal({
                    center: map.getCoordinateFromPixelInternal(newCenterPx),
                    duration: panOptions.duration,
                    easing: panOptions.easing
                });
            }
        }
    };
    /**
     * Get the extent of an element relative to the document
     * @param {HTMLElement} element The element.
     * @param {import("./size.js").Size} size The size of the element.
     * @return {import("./extent.js").Extent} The extent.
     * @protected
     */
    Overlay.prototype.getRect = function (element, size) {
        var box = element.getBoundingClientRect();
        var offsetX = box.left + window.pageXOffset;
        var offsetY = box.top + window.pageYOffset;
        return [
            offsetX,
            offsetY,
            offsetX + size[0],
            offsetY + size[1]
        ];
    };
    /**
     * Set the positioning for this overlay.
     * @param {OverlayPositioning} positioning how the overlay is
     *     positioned relative to its point on the map.
     * @observable
     * @api
     */
    Overlay.prototype.setPositioning = function (positioning) {
        this.set(Property.POSITIONING, positioning);
    };
    /**
     * Modify the visibility of the element.
     * @param {boolean} visible Element visibility.
     * @protected
     */
    Overlay.prototype.setVisible = function (visible) {
        if (this.rendered.visible !== visible) {
            this.element.style.display = visible ? '' : 'none';
            this.rendered.visible = visible;
        }
    };
    /**
     * Update pixel position.
     * @protected
     */
    Overlay.prototype.updatePixelPosition = function () {
        var map = this.getMap();
        var position = this.getPosition();
        if (!map || !map.isRendered() || !position) {
            this.setVisible(false);
            return;
        }
        var pixel = map.getPixelFromCoordinate(position);
        var mapSize = map.getSize();
        this.updateRenderedPosition(pixel, mapSize);
    };
    /**
     * @param {import("./pixel.js").Pixel} pixel The pixel location.
     * @param {import("./size.js").Size|undefined} mapSize The map size.
     * @protected
     */
    Overlay.prototype.updateRenderedPosition = function (pixel, mapSize) {
        var style = this.element.style;
        var offset = this.getOffset();
        var positioning = this.getPositioning();
        this.setVisible(true);
        var x = Math.round(pixel[0] + offset[0]) + 'px';
        var y = Math.round(pixel[1] + offset[1]) + 'px';
        var posX = '0%';
        var posY = '0%';
        if (positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].BOTTOM_RIGHT ||
            positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].CENTER_RIGHT ||
            positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].TOP_RIGHT) {
            posX = '-100%';
        }
        else if (positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].BOTTOM_CENTER ||
            positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].CENTER_CENTER ||
            positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].TOP_CENTER) {
            posX = '-50%';
        }
        if (positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].BOTTOM_LEFT ||
            positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].BOTTOM_CENTER ||
            positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].BOTTOM_RIGHT) {
            posY = '-100%';
        }
        else if (positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].CENTER_LEFT ||
            positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].CENTER_CENTER ||
            positioning == _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_2__["default"].CENTER_RIGHT) {
            posY = '-50%';
        }
        var transform = "translate(" + posX + ", " + posY + ") translate(" + x + ", " + y + ")";
        if (this.rendered.transform_ != transform) {
            this.rendered.transform_ = transform;
            style.transform = transform;
            // @ts-ignore IE9
            style.msTransform = transform;
        }
    };
    /**
     * returns the options this Overlay has been created with
     * @return {Options} overlay options
     */
    Overlay.prototype.getOptions = function () {
        return this.options;
    };
    return Overlay;
}(_Object_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Overlay);
//# sourceMappingURL=Overlay.js.map

/***/ }),

/***/ "./node_modules/ol/OverlayPositioning.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/OverlayPositioning.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/OverlayPositioning
 */
/**
 * Overlay position: `'bottom-left'`, `'bottom-center'`,  `'bottom-right'`,
 * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,
 * `'top-center'`, `'top-right'`
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    BOTTOM_LEFT: 'bottom-left',
    BOTTOM_CENTER: 'bottom-center',
    BOTTOM_RIGHT: 'bottom-right',
    CENTER_LEFT: 'center-left',
    CENTER_CENTER: 'center-center',
    CENTER_RIGHT: 'center-right',
    TOP_LEFT: 'top-left',
    TOP_CENTER: 'top-center',
    TOP_RIGHT: 'top-right'
});
//# sourceMappingURL=OverlayPositioning.js.map

/***/ }),

/***/ "./node_modules/ol/PluggableMap.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/PluggableMap.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CollectionEventType.js */ "./node_modules/ol/CollectionEventType.js");
/* harmony import */ var _MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MapBrowserEvent.js */ "./node_modules/ol/MapBrowserEvent.js");
/* harmony import */ var _MapBrowserEventHandler_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./MapBrowserEventHandler.js */ "./node_modules/ol/MapBrowserEventHandler.js");
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
/* harmony import */ var _MapEvent_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./MapEvent.js */ "./node_modules/ol/MapEvent.js");
/* harmony import */ var _MapEventType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./MapEventType.js */ "./node_modules/ol/MapEventType.js");
/* harmony import */ var _MapProperty_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./MapProperty.js */ "./node_modules/ol/MapProperty.js");
/* harmony import */ var _render_EventType_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./render/EventType.js */ "./node_modules/ol/render/EventType.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./ObjectEventType.js */ "./node_modules/ol/ObjectEventType.js");
/* harmony import */ var _TileQueue_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./TileQueue.js */ "./node_modules/ol/TileQueue.js");
/* harmony import */ var _View_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./View.js */ "./node_modules/ol/View.js");
/* harmony import */ var _ViewHint_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./ViewHint.js */ "./node_modules/ol/ViewHint.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./has.js */ "./node_modules/ol/has.js");
/* harmony import */ var _layer_Group_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./layer/Group.js */ "./node_modules/ol/layer/Group.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/PluggableMap
 */

























/**
 * State of the current frame. Only `pixelRatio`, `time` and `viewState` should
 * be used in applications.
 * @typedef {Object} FrameState
 * @property {number} pixelRatio The pixel ratio of the frame.
 * @property {number} time The time when rendering of the frame was requested.
 * @property {import("./View.js").State} viewState The state of the current view.
 * @property {boolean} animate
 * @property {import("./transform.js").Transform} coordinateToPixelTransform
 * @property {null|import("./extent.js").Extent} extent
 * @property {Array<DeclutterItems>} declutterItems
 * @property {number} index
 * @property {Array<import("./layer/Layer.js").State>} layerStatesArray
 * @property {number} layerIndex
 * @property {import("./transform.js").Transform} pixelToCoordinateTransform
 * @property {Array<PostRenderFunction>} postRenderFunctions
 * @property {import("./size.js").Size} size
 * @property {TileQueue} tileQueue
 * @property {!Object<string, Object<string, boolean>>} usedTiles
 * @property {Array<number>} viewHints
 * @property {!Object<string, Object<string, boolean>>} wantedTiles
 */
/**
 * @typedef {Object} DeclutterItems
 * @property {Array<*>} items Declutter items of an executor.
 * @property {number} opacity Layer opacity.
 */
/**
 * @typedef {function(PluggableMap, ?FrameState): any} PostRenderFunction
 */
/**
 * @typedef {Object} AtPixelOptions
 * @property {undefined|function(import("./layer/Layer.js").default): boolean} [layerFilter] Layer filter
 * function. The filter function will receive one argument, the
 * {@link module:ol/layer/Layer layer-candidate} and it should return a boolean value.
 * Only layers which are visible and for which this function returns `true`
 * will be tested for features. By default, all visible layers will be tested.
 * @property {number} [hitTolerance=0] Hit-detection tolerance in pixels. Pixels
 * inside the radius around the given position will be checked for features.
 * @property {boolean} [checkWrapped=true] Check-Wrapped Will check for for wrapped geometries inside the range of
 *   +/- 1 world width. Works only if a projection is used that can be wrapped.
 */
/**
 * @typedef {Object} MapOptionsInternal
 * @property {Collection<import("./control/Control.js").default>} [controls]
 * @property {Collection<import("./interaction/Interaction.js").default>} [interactions]
 * @property {HTMLElement|Document} keyboardEventTarget
 * @property {Collection<import("./Overlay.js").default>} overlays
 * @property {Object<string, *>} values
 */
/**
 * Object literal with config options for the map.
 * @typedef {Object} MapOptions
 * @property {Collection<import("./control/Control.js").default>|Array<import("./control/Control.js").default>} [controls]
 * Controls initially added to the map. If not specified,
 * {@link module:ol/control~defaults} is used.
 * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between
 * physical pixels and device-independent pixels (dips) on the device.
 * @property {Collection<import("./interaction/Interaction.js").default>|Array<import("./interaction/Interaction.js").default>} [interactions]
 * Interactions that are initially added to the map. If not specified,
 * {@link module:ol/interaction~defaults} is used.
 * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to
 * listen to keyboard events on. This determines when the `KeyboardPan` and
 * `KeyboardZoom` interactions trigger. For example, if this option is set to
 * `document` the keyboard interactions will always trigger. If this option is
 * not specified, the element the library listens to keyboard events on is the
 * map target (i.e. the user-provided div for the map). If this is not
 * `document`, the target element needs to be focused for key events to be
 * emitted, requiring that the target element has a `tabindex` attribute.
 * @property {Array<import("./layer/Base.js").default>|Collection<import("./layer/Base.js").default>|LayerGroup} [layers]
 * Layers. If this is not defined, a map with no layers will be rendered. Note
 * that layers are rendered in the order supplied, so if you want, for example,
 * a vector layer to appear on top of a tile layer, it must come after the tile
 * layer.
 * @property {number} [maxTilesLoading=16] Maximum number tiles to load
 * simultaneously.
 * @property {number} [moveTolerance=1] The minimum distance in pixels the
 * cursor must move to be detected as a map move event instead of a click.
 * Increasing this value can make it easier to click on the map.
 * @property {Collection<import("./Overlay.js").default>|Array<import("./Overlay.js").default>} [overlays]
 * Overlays initially added to the map. By default, no overlays are added.
 * @property {HTMLElement|string} [target] The container for the map, either the
 * element itself or the `id` of the element. If not specified at construction
 * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be
 * rendered.
 * @property {View} [view] The map's view.  No layer sources will be
 * fetched unless this is specified at construction time or through
 * {@link module:ol/Map~Map#setView}.
 */
/**
 * @fires import("./MapBrowserEvent.js").MapBrowserEvent
 * @fires import("./MapEvent.js").MapEvent
 * @fires import("./render/Event.js").default#precompose
 * @fires import("./render/Event.js").default#postcompose
 * @fires import("./render/Event.js").default#rendercomplete
 * @api
 */
var PluggableMap = /** @class */ (function (_super) {
    __extends(PluggableMap, _super);
    /**
     * @param {MapOptions} options Map options.
     */
    function PluggableMap(options) {
        var _this = _super.call(this) || this;
        var optionsInternal = createOptionsInternal(options);
        /** @private */
        _this.boundHandleBrowserEvent_ = _this.handleBrowserEvent.bind(_this);
        /**
         * @type {number}
         * @private
         */
        _this.maxTilesLoading_ = options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16;
        /**
         * @private
         * @type {number}
         */
        _this.pixelRatio_ = options.pixelRatio !== undefined ?
            options.pixelRatio : _has_js__WEBPACK_IMPORTED_MODULE_20__["DEVICE_PIXEL_RATIO"];
        /**
         * @private
         * @type {*}
         */
        _this.postRenderTimeoutHandle_;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.animationDelayKey_;
        /**
         * @private
         */
        _this.animationDelay_ = function () {
            this.animationDelayKey_ = undefined;
            this.renderFrame_(Date.now());
        }.bind(_this);
        /**
         * @private
         * @type {import("./transform.js").Transform}
         */
        _this.coordinateToPixelTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_23__["create"])();
        /**
         * @private
         * @type {import("./transform.js").Transform}
         */
        _this.pixelToCoordinateTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_23__["create"])();
        /**
         * @private
         * @type {number}
         */
        _this.frameIndex_ = 0;
        /**
         * @private
         * @type {?FrameState}
         */
        _this.frameState_ = null;
        /**
         * The extent at the previous 'moveend' event.
         * @private
         * @type {import("./extent.js").Extent}
         */
        _this.previousExtent_ = null;
        /**
         * @private
         * @type {?import("./events.js").EventsKey}
         */
        _this.viewPropertyListenerKey_ = null;
        /**
         * @private
         * @type {?import("./events.js").EventsKey}
         */
        _this.viewChangeListenerKey_ = null;
        /**
         * @private
         * @type {?Array<import("./events.js").EventsKey>}
         */
        _this.layerGroupPropertyListenerKeys_ = null;
        /**
         * @private
         * @type {!HTMLElement}
         */
        _this.viewport_ = document.createElement('div');
        _this.viewport_.className = 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : '');
        _this.viewport_.style.position = 'relative';
        _this.viewport_.style.overflow = 'hidden';
        _this.viewport_.style.width = '100%';
        _this.viewport_.style.height = '100%';
        /**
         * @private
         * @type {!HTMLElement}
         */
        _this.overlayContainer_ = document.createElement('div');
        _this.overlayContainer_.style.position = 'absolute';
        _this.overlayContainer_.style.zIndex = '0';
        _this.overlayContainer_.style.width = '100%';
        _this.overlayContainer_.style.height = '100%';
        _this.overlayContainer_.className = 'ol-overlaycontainer';
        _this.viewport_.appendChild(_this.overlayContainer_);
        /**
         * @private
         * @type {!HTMLElement}
         */
        _this.overlayContainerStopEvent_ = document.createElement('div');
        _this.overlayContainerStopEvent_.style.position = 'absolute';
        _this.overlayContainerStopEvent_.style.zIndex = '0';
        _this.overlayContainerStopEvent_.style.width = '100%';
        _this.overlayContainerStopEvent_.style.height = '100%';
        _this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';
        _this.viewport_.appendChild(_this.overlayContainerStopEvent_);
        /**
         * @private
         * @type {MapBrowserEventHandler}
         */
        _this.mapBrowserEventHandler_ = new _MapBrowserEventHandler_js__WEBPACK_IMPORTED_MODULE_3__["default"](_this, options.moveTolerance);
        var handleMapBrowserEvent = _this.handleMapBrowserEvent.bind(_this);
        for (var key in _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"]) {
            _this.mapBrowserEventHandler_.addEventListener(_MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"][key], handleMapBrowserEvent);
        }
        /**
         * @private
         * @type {HTMLElement|Document}
         */
        _this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget;
        /**
         * @private
         * @type {?Array<import("./events.js").EventsKey>}
         */
        _this.keyHandlerKeys_ = null;
        var handleBrowserEvent = _this.handleBrowserEvent.bind(_this);
        _this.viewport_.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].CONTEXTMENU, handleBrowserEvent, false);
        _this.viewport_.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].WHEEL, handleBrowserEvent, _has_js__WEBPACK_IMPORTED_MODULE_20__["PASSIVE_EVENT_LISTENERS"] ? { passive: false } : false);
        /**
         * @type {Collection<import("./control/Control.js").default>}
         * @protected
         */
        _this.controls = optionsInternal.controls || new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
        /**
         * @type {Collection<import("./interaction/Interaction.js").default>}
         * @protected
         */
        _this.interactions = optionsInternal.interactions || new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
        /**
         * @type {Collection<import("./Overlay.js").default>}
         * @private
         */
        _this.overlays_ = optionsInternal.overlays;
        /**
         * A lookup of overlays by id.
         * @private
         * @type {Object<string, import("./Overlay.js").default>}
         */
        _this.overlayIdIndex_ = {};
        /**
         * @type {import("./renderer/Map.js").default}
         * @private
         */
        _this.renderer_ = null;
        /**
         * @type {undefined|function(Event): void}
         * @private
         */
        _this.handleResize_;
        /**
         * @private
         * @type {!Array<PostRenderFunction>}
         */
        _this.postRenderFunctions_ = [];
        /**
         * @private
         * @type {TileQueue}
         */
        _this.tileQueue_ = new _TileQueue_js__WEBPACK_IMPORTED_MODULE_11__["default"](_this.getTilePriority.bind(_this), _this.handleTileChange_.bind(_this));
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_9__["getChangeEventType"])(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].LAYERGROUP), _this.handleLayerGroupChanged_);
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_9__["getChangeEventType"])(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].VIEW), _this.handleViewChanged_);
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_9__["getChangeEventType"])(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].SIZE), _this.handleSizeChanged_);
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_9__["getChangeEventType"])(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].TARGET), _this.handleTargetChanged_);
        // setProperties will trigger the rendering of the map if the map
        // is "defined" already.
        _this.setProperties(optionsInternal.values);
        _this.controls.forEach(
        /**
         * @param {import("./control/Control.js").default} control Control.
         * @this {PluggableMap}
         */
        function (control) {
            control.setMap(this);
        }.bind(_this));
        _this.controls.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ADD, 
        /**
         * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
         */
        function (event) {
            event.element.setMap(this);
        }.bind(_this));
        _this.controls.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].REMOVE, 
        /**
         * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
         */
        function (event) {
            event.element.setMap(null);
        }.bind(_this));
        _this.interactions.forEach(
        /**
         * @param {import("./interaction/Interaction.js").default} interaction Interaction.
         * @this {PluggableMap}
         */
        function (interaction) {
            interaction.setMap(this);
        }.bind(_this));
        _this.interactions.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ADD, 
        /**
         * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
         */
        function (event) {
            event.element.setMap(this);
        }.bind(_this));
        _this.interactions.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].REMOVE, 
        /**
         * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
         */
        function (event) {
            event.element.setMap(null);
        }.bind(_this));
        _this.overlays_.forEach(_this.addOverlayInternal_.bind(_this));
        _this.overlays_.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ADD, 
        /**
         * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
         */
        function (event) {
            this.addOverlayInternal_(/** @type {import("./Overlay.js").default} */ (event.element));
        }.bind(_this));
        _this.overlays_.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].REMOVE, 
        /**
         * @param {import("./Collection.js").CollectionEvent} event CollectionEvent.
         */
        function (event) {
            var overlay = /** @type {import("./Overlay.js").default} */ (event.element);
            var id = overlay.getId();
            if (id !== undefined) {
                delete this.overlayIdIndex_[id.toString()];
            }
            event.element.setMap(null);
        }.bind(_this));
        return _this;
    }
    /**
     * @abstract
     * @return {import("./renderer/Map.js").default} The map renderer
     */
    PluggableMap.prototype.createRenderer = function () {
        throw new Error('Use a map type that has a createRenderer method');
    };
    /**
     * Add the given control to the map.
     * @param {import("./control/Control.js").default} control Control.
     * @api
     */
    PluggableMap.prototype.addControl = function (control) {
        this.getControls().push(control);
    };
    /**
     * Add the given interaction to the map. If you want to add an interaction
     * at another point of the collection use `getInteraction()` and the methods
     * available on {@link module:ol/Collection~Collection}. This can be used to
     * stop the event propagation from the handleEvent function. The interactions
     * get to handle the events in the reverse order of this collection.
     * @param {import("./interaction/Interaction.js").default} interaction Interaction to add.
     * @api
     */
    PluggableMap.prototype.addInteraction = function (interaction) {
        this.getInteractions().push(interaction);
    };
    /**
     * Adds the given layer to the top of this map. If you want to add a layer
     * elsewhere in the stack, use `getLayers()` and the methods available on
     * {@link module:ol/Collection~Collection}.
     * @param {import("./layer/Base.js").default} layer Layer.
     * @api
     */
    PluggableMap.prototype.addLayer = function (layer) {
        var layers = this.getLayerGroup().getLayers();
        layers.push(layer);
    };
    /**
     * Add the given overlay to the map.
     * @param {import("./Overlay.js").default} overlay Overlay.
     * @api
     */
    PluggableMap.prototype.addOverlay = function (overlay) {
        this.getOverlays().push(overlay);
    };
    /**
     * This deals with map's overlay collection changes.
     * @param {import("./Overlay.js").default} overlay Overlay.
     * @private
     */
    PluggableMap.prototype.addOverlayInternal_ = function (overlay) {
        var id = overlay.getId();
        if (id !== undefined) {
            this.overlayIdIndex_[id.toString()] = overlay;
        }
        overlay.setMap(this);
    };
    /**
     *
     * @inheritDoc
     */
    PluggableMap.prototype.disposeInternal = function () {
        this.mapBrowserEventHandler_.dispose();
        this.viewport_.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].CONTEXTMENU, this.boundHandleBrowserEvent_);
        this.viewport_.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].WHEEL, this.boundHandleBrowserEvent_);
        if (this.handleResize_ !== undefined) {
            removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].RESIZE, this.handleResize_, false);
            this.handleResize_ = undefined;
        }
        this.setTarget(null);
        _super.prototype.disposeInternal.call(this);
    };
    /**
     * Detect features that intersect a pixel on the viewport, and execute a
     * callback with each intersecting feature. Layers included in the detection can
     * be configured through the `layerFilter` option in `opt_options`.
     * @param {import("./pixel.js").Pixel} pixel Pixel.
     * @param {function(this: S, import("./Feature.js").FeatureLike,
     *     import("./layer/Layer.js").default): T} callback Feature callback. The callback will be
     *     called with two arguments. The first argument is one
     *     {@link module:ol/Feature feature} or
     *     {@link module:ol/render/Feature render feature} at the pixel, the second is
     *     the {@link module:ol/layer/Layer layer} of the feature and will be null for
     *     unmanaged layers. To stop detection, callback functions can return a
     *     truthy value.
     * @param {AtPixelOptions=} opt_options Optional options.
     * @return {T|undefined} Callback result, i.e. the return value of last
     * callback execution, or the first truthy callback return value.
     * @template S,T
     * @api
     */
    PluggableMap.prototype.forEachFeatureAtPixel = function (pixel, callback, opt_options) {
        if (!this.frameState_) {
            return;
        }
        var coordinate = this.getCoordinateFromPixelInternal(pixel);
        opt_options = opt_options !== undefined ? opt_options : {};
        var hitTolerance = opt_options.hitTolerance !== undefined ?
            opt_options.hitTolerance * this.frameState_.pixelRatio : 0;
        var layerFilter = opt_options.layerFilter !== undefined ?
            opt_options.layerFilter : _functions_js__WEBPACK_IMPORTED_MODULE_19__["TRUE"];
        var checkWrapped = opt_options.checkWrapped !== false;
        return this.renderer_.forEachFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, checkWrapped, callback, null, layerFilter, null);
    };
    /**
     * Get all features that intersect a pixel on the viewport.
     * @param {import("./pixel.js").Pixel} pixel Pixel.
     * @param {AtPixelOptions=} opt_options Optional options.
     * @return {Array<import("./Feature.js").FeatureLike>} The detected features or
     * an empty array if none were found.
     * @api
     */
    PluggableMap.prototype.getFeaturesAtPixel = function (pixel, opt_options) {
        var features = [];
        this.forEachFeatureAtPixel(pixel, function (feature) {
            features.push(feature);
        }, opt_options);
        return features;
    };
    /**
     * Detect layers that have a color value at a pixel on the viewport, and
     * execute a callback with each matching layer. Layers included in the
     * detection can be configured through `opt_layerFilter`.
     *
     * Note: this may give false positives unless the map layers have had different `className`
     * properties assigned to them.
     *
     * @param {import("./pixel.js").Pixel} pixel Pixel.
     * @param {function(this: S, import("./layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback
     *     Layer callback. This callback will receive two arguments: first is the
     *     {@link module:ol/layer/Layer layer}, second argument is an array representing
     *     [R, G, B, A] pixel values (0 - 255) and will be `null` for layer types
     *     that do not currently support this argument. To stop detection, callback
     *     functions can return a truthy value.
     * @param {AtPixelOptions=} opt_options Configuration options.
     * @return {T|undefined} Callback result, i.e. the return value of last
     * callback execution, or the first truthy callback return value.
     * @template S,T
     * @api
     */
    PluggableMap.prototype.forEachLayerAtPixel = function (pixel, callback, opt_options) {
        if (!this.frameState_) {
            return;
        }
        var options = opt_options || {};
        var hitTolerance = options.hitTolerance !== undefined ?
            options.hitTolerance * this.frameState_.pixelRatio : 0;
        var layerFilter = options.layerFilter || _functions_js__WEBPACK_IMPORTED_MODULE_19__["TRUE"];
        return this.renderer_.forEachLayerAtPixel(pixel, this.frameState_, hitTolerance, callback, layerFilter);
    };
    /**
     * Detect if features intersect a pixel on the viewport. Layers included in the
     * detection can be configured through `opt_layerFilter`.
     * @param {import("./pixel.js").Pixel} pixel Pixel.
     * @param {AtPixelOptions=} opt_options Optional options.
     * @return {boolean} Is there a feature at the given pixel?
     * @api
     */
    PluggableMap.prototype.hasFeatureAtPixel = function (pixel, opt_options) {
        if (!this.frameState_) {
            return false;
        }
        var coordinate = this.getCoordinateFromPixelInternal(pixel);
        opt_options = opt_options !== undefined ? opt_options : {};
        var layerFilter = opt_options.layerFilter !== undefined ? opt_options.layerFilter : _functions_js__WEBPACK_IMPORTED_MODULE_19__["TRUE"];
        var hitTolerance = opt_options.hitTolerance !== undefined ?
            opt_options.hitTolerance * this.frameState_.pixelRatio : 0;
        var checkWrapped = opt_options.checkWrapped !== false;
        return this.renderer_.hasFeatureAtCoordinate(coordinate, this.frameState_, hitTolerance, checkWrapped, layerFilter, null);
    };
    /**
     * Returns the coordinate in user projection for a browser event.
     * @param {Event} event Event.
     * @return {import("./coordinate.js").Coordinate} Coordinate.
     * @api
     */
    PluggableMap.prototype.getEventCoordinate = function (event) {
        return this.getCoordinateFromPixel(this.getEventPixel(event));
    };
    /**
     * Returns the coordinate in view projection for a browser event.
     * @param {Event} event Event.
     * @return {import("./coordinate.js").Coordinate} Coordinate.
     */
    PluggableMap.prototype.getEventCoordinateInternal = function (event) {
        return this.getCoordinateFromPixelInternal(this.getEventPixel(event));
    };
    /**
     * Returns the map pixel position for a browser event relative to the viewport.
     * @param {Event|TouchEvent} event Event.
     * @return {import("./pixel.js").Pixel} Pixel.
     * @api
     */
    PluggableMap.prototype.getEventPixel = function (event) {
        var viewportPosition = this.viewport_.getBoundingClientRect();
        var eventPosition = 'changedTouches' in event ?
            /** @type {TouchEvent} */ (event).changedTouches[0] :
            /** @type {MouseEvent} */ (event);
        return [
            eventPosition.clientX - viewportPosition.left,
            eventPosition.clientY - viewportPosition.top
        ];
    };
    /**
     * Get the target in which this map is rendered.
     * Note that this returns what is entered as an option or in setTarget:
     * if that was an element, it returns an element; if a string, it returns that.
     * @return {HTMLElement|string|undefined} The Element or id of the Element that the
     *     map is rendered in.
     * @observable
     * @api
     */
    PluggableMap.prototype.getTarget = function () {
        return /** @type {HTMLElement|string|undefined} */ (this.get(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].TARGET));
    };
    /**
     * Get the DOM element into which this map is rendered. In contrast to
     * `getTarget` this method always return an `Element`, or `null` if the
     * map has no target.
     * @return {HTMLElement} The element that the map is rendered in.
     * @api
     */
    PluggableMap.prototype.getTargetElement = function () {
        var target = this.getTarget();
        if (target !== undefined) {
            return typeof target === 'string' ? document.getElementById(target) : target;
        }
        else {
            return null;
        }
    };
    /**
     * Get the coordinate for a given pixel.  This returns a coordinate in the
     * user projection.
     * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport.
     * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position.
     * @api
     */
    PluggableMap.prototype.getCoordinateFromPixel = function (pixel) {
        return Object(_proj_js__WEBPACK_IMPORTED_MODULE_24__["toUserCoordinate"])(this.getCoordinateFromPixelInternal(pixel), this.getView().getProjection());
    };
    /**
     * Get the coordinate for a given pixel.  This returns a coordinate in the
     * map view projection.
     * @param {import("./pixel.js").Pixel} pixel Pixel position in the map viewport.
     * @return {import("./coordinate.js").Coordinate} The coordinate for the pixel position.
     */
    PluggableMap.prototype.getCoordinateFromPixelInternal = function (pixel) {
        var frameState = this.frameState_;
        if (!frameState) {
            return null;
        }
        else {
            return Object(_transform_js__WEBPACK_IMPORTED_MODULE_23__["apply"])(frameState.pixelToCoordinateTransform, pixel.slice());
        }
    };
    /**
     * Get the map controls. Modifying this collection changes the controls
     * associated with the map.
     * @return {Collection<import("./control/Control.js").default>} Controls.
     * @api
     */
    PluggableMap.prototype.getControls = function () {
        return this.controls;
    };
    /**
     * Get the map overlays. Modifying this collection changes the overlays
     * associated with the map.
     * @return {Collection<import("./Overlay.js").default>} Overlays.
     * @api
     */
    PluggableMap.prototype.getOverlays = function () {
        return this.overlays_;
    };
    /**
     * Get an overlay by its identifier (the value returned by overlay.getId()).
     * Note that the index treats string and numeric identifiers as the same. So
     * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.
     * @param {string|number} id Overlay identifier.
     * @return {import("./Overlay.js").default} Overlay.
     * @api
     */
    PluggableMap.prototype.getOverlayById = function (id) {
        var overlay = this.overlayIdIndex_[id.toString()];
        return overlay !== undefined ? overlay : null;
    };
    /**
     * Get the map interactions. Modifying this collection changes the interactions
     * associated with the map.
     *
     * Interactions are used for e.g. pan, zoom and rotate.
     * @return {Collection<import("./interaction/Interaction.js").default>} Interactions.
     * @api
     */
    PluggableMap.prototype.getInteractions = function () {
        return this.interactions;
    };
    /**
     * Get the layergroup associated with this map.
     * @return {LayerGroup} A layer group containing the layers in this map.
     * @observable
     * @api
     */
    PluggableMap.prototype.getLayerGroup = function () {
        return (
        /** @type {LayerGroup} */ (this.get(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].LAYERGROUP)));
    };
    /**
     * Get the collection of layers associated with this map.
     * @return {!Collection<import("./layer/Base.js").default>} Layers.
     * @api
     */
    PluggableMap.prototype.getLayers = function () {
        var layers = this.getLayerGroup().getLayers();
        return layers;
    };
    /**
     * @return {boolean} Layers have sources that are still loading.
     */
    PluggableMap.prototype.getLoading = function () {
        var layerStatesArray = this.getLayerGroup().getLayerStatesArray();
        for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
            var layer = layerStatesArray[i].layer;
            var source = /** @type {import("./layer/Layer.js").default} */ (layer).getSource();
            if (source && source.loading) {
                return true;
            }
        }
        return false;
    };
    /**
     * Get the pixel for a coordinate.  This takes a coordinate in the user
     * projection and returns the corresponding pixel.
     * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate.
     * @return {import("./pixel.js").Pixel} A pixel position in the map viewport.
     * @api
     */
    PluggableMap.prototype.getPixelFromCoordinate = function (coordinate) {
        var viewCoordinate = Object(_proj_js__WEBPACK_IMPORTED_MODULE_24__["fromUserCoordinate"])(coordinate, this.getView().getProjection());
        return this.getPixelFromCoordinateInternal(viewCoordinate);
    };
    /**
     * Get the pixel for a coordinate.  This takes a coordinate in the map view
     * projection and returns the corresponding pixel.
     * @param {import("./coordinate.js").Coordinate} coordinate A map coordinate.
     * @return {import("./pixel.js").Pixel} A pixel position in the map viewport.
     */
    PluggableMap.prototype.getPixelFromCoordinateInternal = function (coordinate) {
        var frameState = this.frameState_;
        if (!frameState) {
            return null;
        }
        else {
            return Object(_transform_js__WEBPACK_IMPORTED_MODULE_23__["apply"])(frameState.coordinateToPixelTransform, coordinate.slice(0, 2));
        }
    };
    /**
     * Get the map renderer.
     * @return {import("./renderer/Map.js").default} Renderer
     */
    PluggableMap.prototype.getRenderer = function () {
        return this.renderer_;
    };
    /**
     * Get the size of this map.
     * @return {import("./size.js").Size|undefined} The size in pixels of the map in the DOM.
     * @observable
     * @api
     */
    PluggableMap.prototype.getSize = function () {
        return (
        /** @type {import("./size.js").Size|undefined} */ (this.get(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].SIZE)));
    };
    /**
     * Get the view associated with this map. A view manages properties such as
     * center and resolution.
     * @return {View} The view that controls this map.
     * @observable
     * @api
     */
    PluggableMap.prototype.getView = function () {
        return (
        /** @type {View} */ (this.get(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].VIEW)));
    };
    /**
     * Get the element that serves as the map viewport.
     * @return {HTMLElement} Viewport.
     * @api
     */
    PluggableMap.prototype.getViewport = function () {
        return this.viewport_;
    };
    /**
     * Get the element that serves as the container for overlays.  Elements added to
     * this container will let mousedown and touchstart events through to the map,
     * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}
     * events.
     * @return {!HTMLElement} The map's overlay container.
     */
    PluggableMap.prototype.getOverlayContainer = function () {
        return this.overlayContainer_;
    };
    /**
     * Get the element that serves as a container for overlays that don't allow
     * event propagation. Elements added to this container won't let mousedown and
     * touchstart events through to the map, so clicks and gestures on an overlay
     * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.
     * @return {!HTMLElement} The map's overlay container that stops events.
     */
    PluggableMap.prototype.getOverlayContainerStopEvent = function () {
        return this.overlayContainerStopEvent_;
    };
    /**
     * @param {import("./Tile.js").default} tile Tile.
     * @param {string} tileSourceKey Tile source key.
     * @param {import("./coordinate.js").Coordinate} tileCenter Tile center.
     * @param {number} tileResolution Tile resolution.
     * @return {number} Tile priority.
     */
    PluggableMap.prototype.getTilePriority = function (tile, tileSourceKey, tileCenter, tileResolution) {
        return Object(_TileQueue_js__WEBPACK_IMPORTED_MODULE_11__["getTilePriority"])(this.frameState_, tile, tileSourceKey, tileCenter, tileResolution);
    };
    /**
     * @param {Event} browserEvent Browser event.
     * @param {string=} opt_type Type.
     */
    PluggableMap.prototype.handleBrowserEvent = function (browserEvent, opt_type) {
        var type = opt_type || browserEvent.type;
        var mapBrowserEvent = new _MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_2__["default"](type, this, browserEvent);
        this.handleMapBrowserEvent(mapBrowserEvent);
    };
    /**
     * @param {MapBrowserEvent} mapBrowserEvent The event to handle.
     */
    PluggableMap.prototype.handleMapBrowserEvent = function (mapBrowserEvent) {
        if (!this.frameState_) {
            // With no view defined, we cannot translate pixels into geographical
            // coordinates so interactions cannot be used.
            return;
        }
        var target = /** @type {Node} */ (mapBrowserEvent.originalEvent.target);
        if (!mapBrowserEvent.dragging) {
            if (this.overlayContainerStopEvent_.contains(target) || !(document.body.contains(target) || this.viewport_.getRootNode && this.viewport_.getRootNode().contains(target))) {
                // Abort if the event target is a child of the container that doesn't allow
                // event propagation or is no longer in the page. It's possible for the target to no longer
                // be in the page if it has been removed in an event listener, this might happen in a Control
                // that recreates it's content based on user interaction either manually or via a render
                // in something like https://reactjs.org/
                return;
            }
        }
        mapBrowserEvent.frameState = this.frameState_;
        var interactionsArray = this.getInteractions().getArray();
        if (this.dispatchEvent(mapBrowserEvent) !== false) {
            for (var i = interactionsArray.length - 1; i >= 0; i--) {
                var interaction = interactionsArray[i];
                if (!interaction.getActive()) {
                    continue;
                }
                var cont = interaction.handleEvent(mapBrowserEvent);
                if (!cont) {
                    break;
                }
            }
        }
    };
    /**
     * @protected
     */
    PluggableMap.prototype.handlePostRender = function () {
        var frameState = this.frameState_;
        // Manage the tile queue
        // Image loads are expensive and a limited resource, so try to use them
        // efficiently:
        // * When the view is static we allow a large number of parallel tile loads
        //   to complete the frame as quickly as possible.
        // * When animating or interacting, image loads can cause janks, so we reduce
        //   the maximum number of loads per frame and limit the number of parallel
        //   tile loads to remain reactive to view changes and to reduce the chance of
        //   loading tiles that will quickly disappear from view.
        var tileQueue = this.tileQueue_;
        if (!tileQueue.isEmpty()) {
            var maxTotalLoading = this.maxTilesLoading_;
            var maxNewLoads = maxTotalLoading;
            if (frameState) {
                var hints = frameState.viewHints;
                if (hints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_13__["default"].ANIMATING] || hints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_13__["default"].INTERACTING]) {
                    var lowOnFrameBudget = !_has_js__WEBPACK_IMPORTED_MODULE_20__["IMAGE_DECODE"] && Date.now() - frameState.time > 8;
                    maxTotalLoading = lowOnFrameBudget ? 0 : 8;
                    maxNewLoads = lowOnFrameBudget ? 0 : 2;
                }
            }
            if (tileQueue.getTilesLoading() < maxTotalLoading) {
                tileQueue.reprioritize(); // FIXME only call if view has changed
                tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);
            }
        }
        if (frameState && this.hasListener(_render_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].RENDERCOMPLETE) && !frameState.animate &&
            !this.tileQueue_.getTilesLoading() && !this.getLoading()) {
            this.renderer_.dispatchRenderEvent(_render_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].RENDERCOMPLETE, frameState);
        }
        var postRenderFunctions = this.postRenderFunctions_;
        for (var i = 0, ii = postRenderFunctions.length; i < ii; ++i) {
            postRenderFunctions[i](this, frameState);
        }
        postRenderFunctions.length = 0;
    };
    /**
     * @private
     */
    PluggableMap.prototype.handleSizeChanged_ = function () {
        if (this.getView()) {
            this.getView().resolveConstraints(0);
        }
        this.render();
    };
    /**
     * @private
     */
    PluggableMap.prototype.handleTargetChanged_ = function () {
        // target may be undefined, null, a string or an Element.
        // If it's a string we convert it to an Element before proceeding.
        // If it's not now an Element we remove the viewport from the DOM.
        // If it's an Element we append the viewport element to it.
        var targetElement;
        if (this.getTarget()) {
            targetElement = this.getTargetElement();
        }
        if (this.keyHandlerKeys_) {
            for (var i = 0, ii = this.keyHandlerKeys_.length; i < ii; ++i) {
                Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["unlistenByKey"])(this.keyHandlerKeys_[i]);
            }
            this.keyHandlerKeys_ = null;
        }
        if (!targetElement) {
            if (this.renderer_) {
                clearTimeout(this.postRenderTimeoutHandle_);
                this.postRenderFunctions_.length = 0;
                this.renderer_.dispose();
                this.renderer_ = null;
            }
            if (this.animationDelayKey_) {
                cancelAnimationFrame(this.animationDelayKey_);
                this.animationDelayKey_ = undefined;
            }
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_15__["removeNode"])(this.viewport_);
            if (this.handleResize_ !== undefined) {
                removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].RESIZE, this.handleResize_, false);
                this.handleResize_ = undefined;
            }
        }
        else {
            targetElement.appendChild(this.viewport_);
            if (!this.renderer_) {
                this.renderer_ = this.createRenderer();
            }
            var keyboardEventTarget = !this.keyboardEventTarget_ ?
                targetElement : this.keyboardEventTarget_;
            this.keyHandlerKeys_ = [
                Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["listen"])(keyboardEventTarget, _events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].KEYDOWN, this.handleBrowserEvent, this),
                Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["listen"])(keyboardEventTarget, _events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].KEYPRESS, this.handleBrowserEvent, this)
            ];
            if (!this.handleResize_) {
                this.handleResize_ = this.updateSize.bind(this);
                window.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].RESIZE, this.handleResize_, false);
            }
        }
        this.updateSize();
        // updateSize calls setSize, so no need to call this.render
        // ourselves here.
    };
    /**
     * @private
     */
    PluggableMap.prototype.handleTileChange_ = function () {
        this.render();
    };
    /**
     * @private
     */
    PluggableMap.prototype.handleViewPropertyChanged_ = function () {
        this.render();
    };
    /**
     * @private
     */
    PluggableMap.prototype.handleViewChanged_ = function () {
        if (this.viewPropertyListenerKey_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["unlistenByKey"])(this.viewPropertyListenerKey_);
            this.viewPropertyListenerKey_ = null;
        }
        if (this.viewChangeListenerKey_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["unlistenByKey"])(this.viewChangeListenerKey_);
            this.viewChangeListenerKey_ = null;
        }
        var view = this.getView();
        if (view) {
            this.updateViewportSize_();
            this.viewPropertyListenerKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["listen"])(view, _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].PROPERTYCHANGE, this.handleViewPropertyChanged_, this);
            this.viewChangeListenerKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["listen"])(view, _events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].CHANGE, this.handleViewPropertyChanged_, this);
            view.resolveConstraints(0);
        }
        this.render();
    };
    /**
     * @private
     */
    PluggableMap.prototype.handleLayerGroupChanged_ = function () {
        if (this.layerGroupPropertyListenerKeys_) {
            this.layerGroupPropertyListenerKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_16__["unlistenByKey"]);
            this.layerGroupPropertyListenerKeys_ = null;
        }
        var layerGroup = this.getLayerGroup();
        if (layerGroup) {
            this.layerGroupPropertyListenerKeys_ = [
                Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["listen"])(layerGroup, _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_10__["default"].PROPERTYCHANGE, this.render, this),
                Object(_events_js__WEBPACK_IMPORTED_MODULE_16__["listen"])(layerGroup, _events_EventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].CHANGE, this.render, this)
            ];
        }
        this.render();
    };
    /**
     * @return {boolean} Is rendered.
     */
    PluggableMap.prototype.isRendered = function () {
        return !!this.frameState_;
    };
    /**
     * Requests an immediate render in a synchronous manner.
     * @api
     */
    PluggableMap.prototype.renderSync = function () {
        if (this.animationDelayKey_) {
            cancelAnimationFrame(this.animationDelayKey_);
        }
        this.animationDelay_();
    };
    /**
     * Redraws all text after new fonts have loaded
     */
    PluggableMap.prototype.redrawText = function () {
        var layerStates = this.getLayerGroup().getLayerStatesArray();
        for (var i = 0, ii = layerStates.length; i < ii; ++i) {
            var layer = layerStates[i].layer;
            if (layer.hasRenderer()) {
                layer.getRenderer().handleFontsChanged();
            }
        }
    };
    /**
     * Request a map rendering (at the next animation frame).
     * @api
     */
    PluggableMap.prototype.render = function () {
        if (this.renderer_ && this.animationDelayKey_ === undefined) {
            this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_);
        }
    };
    /**
     * Remove the given control from the map.
     * @param {import("./control/Control.js").default} control Control.
     * @return {import("./control/Control.js").default|undefined} The removed control (or undefined
     *     if the control was not found).
     * @api
     */
    PluggableMap.prototype.removeControl = function (control) {
        return this.getControls().remove(control);
    };
    /**
     * Remove the given interaction from the map.
     * @param {import("./interaction/Interaction.js").default} interaction Interaction to remove.
     * @return {import("./interaction/Interaction.js").default|undefined} The removed interaction (or
     *     undefined if the interaction was not found).
     * @api
     */
    PluggableMap.prototype.removeInteraction = function (interaction) {
        return this.getInteractions().remove(interaction);
    };
    /**
     * Removes the given layer from the map.
     * @param {import("./layer/Base.js").default} layer Layer.
     * @return {import("./layer/Base.js").default|undefined} The removed layer (or undefined if the
     *     layer was not found).
     * @api
     */
    PluggableMap.prototype.removeLayer = function (layer) {
        var layers = this.getLayerGroup().getLayers();
        return layers.remove(layer);
    };
    /**
     * Remove the given overlay from the map.
     * @param {import("./Overlay.js").default} overlay Overlay.
     * @return {import("./Overlay.js").default|undefined} The removed overlay (or undefined
     *     if the overlay was not found).
     * @api
     */
    PluggableMap.prototype.removeOverlay = function (overlay) {
        return this.getOverlays().remove(overlay);
    };
    /**
     * @param {number} time Time.
     * @private
     */
    PluggableMap.prototype.renderFrame_ = function (time) {
        var size = this.getSize();
        var view = this.getView();
        var previousFrameState = this.frameState_;
        /** @type {?FrameState} */
        var frameState = null;
        if (size !== undefined && Object(_size_js__WEBPACK_IMPORTED_MODULE_22__["hasArea"])(size) && view && view.isDef()) {
            var viewHints = view.getHints(this.frameState_ ? this.frameState_.viewHints : undefined);
            var viewState = view.getState();
            frameState = {
                animate: false,
                coordinateToPixelTransform: this.coordinateToPixelTransform_,
                declutterItems: previousFrameState ? previousFrameState.declutterItems : [],
                extent: Object(_extent_js__WEBPACK_IMPORTED_MODULE_18__["getForViewAndSize"])(viewState.center, viewState.resolution, viewState.rotation, size),
                index: this.frameIndex_++,
                layerIndex: 0,
                layerStatesArray: this.getLayerGroup().getLayerStatesArray(),
                pixelRatio: this.pixelRatio_,
                pixelToCoordinateTransform: this.pixelToCoordinateTransform_,
                postRenderFunctions: [],
                size: size,
                tileQueue: this.tileQueue_,
                time: time,
                usedTiles: {},
                viewState: viewState,
                viewHints: viewHints,
                wantedTiles: {}
            };
        }
        this.frameState_ = frameState;
        this.renderer_.renderFrame(frameState);
        if (frameState) {
            if (frameState.animate) {
                this.render();
            }
            Array.prototype.push.apply(this.postRenderFunctions_, frameState.postRenderFunctions);
            if (previousFrameState) {
                var moveStart = !this.previousExtent_ ||
                    (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_18__["isEmpty"])(this.previousExtent_) &&
                        !Object(_extent_js__WEBPACK_IMPORTED_MODULE_18__["equals"])(frameState.extent, this.previousExtent_));
                if (moveStart) {
                    this.dispatchEvent(new _MapEvent_js__WEBPACK_IMPORTED_MODULE_5__["default"](_MapEventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MOVESTART, this, previousFrameState));
                    this.previousExtent_ = Object(_extent_js__WEBPACK_IMPORTED_MODULE_18__["createOrUpdateEmpty"])(this.previousExtent_);
                }
            }
            var idle = this.previousExtent_ &&
                !frameState.viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_13__["default"].ANIMATING] &&
                !frameState.viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_13__["default"].INTERACTING] &&
                !Object(_extent_js__WEBPACK_IMPORTED_MODULE_18__["equals"])(frameState.extent, this.previousExtent_);
            if (idle) {
                this.dispatchEvent(new _MapEvent_js__WEBPACK_IMPORTED_MODULE_5__["default"](_MapEventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MOVEEND, this, frameState));
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_18__["clone"])(frameState.extent, this.previousExtent_);
            }
        }
        this.dispatchEvent(new _MapEvent_js__WEBPACK_IMPORTED_MODULE_5__["default"](_MapEventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POSTRENDER, this, frameState));
        this.postRenderTimeoutHandle_ = setTimeout(this.handlePostRender.bind(this), 0);
    };
    /**
     * Sets the layergroup of this map.
     * @param {LayerGroup} layerGroup A layer group containing the layers in this map.
     * @observable
     * @api
     */
    PluggableMap.prototype.setLayerGroup = function (layerGroup) {
        this.set(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].LAYERGROUP, layerGroup);
    };
    /**
     * Set the size of this map.
     * @param {import("./size.js").Size|undefined} size The size in pixels of the map in the DOM.
     * @observable
     * @api
     */
    PluggableMap.prototype.setSize = function (size) {
        this.set(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].SIZE, size);
    };
    /**
     * Set the target element to render this map into.
     * @param {HTMLElement|string|undefined} target The Element or id of the Element
     *     that the map is rendered in.
     * @observable
     * @api
     */
    PluggableMap.prototype.setTarget = function (target) {
        this.set(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].TARGET, target);
    };
    /**
     * Set the view for this map.
     * @param {View} view The view that controls this map.
     * @observable
     * @api
     */
    PluggableMap.prototype.setView = function (view) {
        this.set(_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].VIEW, view);
    };
    /**
     * Force a recalculation of the map viewport size.  This should be called when
     * third-party code changes the size of the map viewport.
     * @api
     */
    PluggableMap.prototype.updateSize = function () {
        var targetElement = this.getTargetElement();
        if (!targetElement) {
            this.setSize(undefined);
        }
        else {
            var computedStyle = getComputedStyle(targetElement);
            this.setSize([
                targetElement.offsetWidth -
                    parseFloat(computedStyle['borderLeftWidth']) -
                    parseFloat(computedStyle['paddingLeft']) -
                    parseFloat(computedStyle['paddingRight']) -
                    parseFloat(computedStyle['borderRightWidth']),
                targetElement.offsetHeight -
                    parseFloat(computedStyle['borderTopWidth']) -
                    parseFloat(computedStyle['paddingTop']) -
                    parseFloat(computedStyle['paddingBottom']) -
                    parseFloat(computedStyle['borderBottomWidth'])
            ]);
        }
        this.updateViewportSize_();
    };
    /**
     * Recomputes the viewport size and save it on the view object (if any)
     * @private
     */
    PluggableMap.prototype.updateViewportSize_ = function () {
        var view = this.getView();
        if (view) {
            var size = undefined;
            var computedStyle = getComputedStyle(this.viewport_);
            if (computedStyle.width && computedStyle.height) {
                size = [
                    parseInt(computedStyle.width, 10),
                    parseInt(computedStyle.height, 10)
                ];
            }
            view.setViewportSize(size);
        }
    };
    return PluggableMap;
}(_Object_js__WEBPACK_IMPORTED_MODULE_9__["default"]));
/**
 * @param {MapOptions} options Map options.
 * @return {MapOptionsInternal} Internal map options.
 */
function createOptionsInternal(options) {
    /**
     * @type {HTMLElement|Document}
     */
    var keyboardEventTarget = null;
    if (options.keyboardEventTarget !== undefined) {
        keyboardEventTarget = typeof options.keyboardEventTarget === 'string' ?
            document.getElementById(options.keyboardEventTarget) :
            options.keyboardEventTarget;
    }
    /**
     * @type {Object<string, *>}
     */
    var values = {};
    var layerGroup = options.layers && typeof /** @type {?} */ (options.layers).getLayers === 'function' ?
        /** @type {LayerGroup} */ (options.layers) : new _layer_Group_js__WEBPACK_IMPORTED_MODULE_21__["default"]({ layers: /** @type {Collection} */ (options.layers) });
    values[_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].LAYERGROUP] = layerGroup;
    values[_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].TARGET] = options.target;
    values[_MapProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].VIEW] = options.view !== undefined ?
        options.view : new _View_js__WEBPACK_IMPORTED_MODULE_12__["default"]();
    var controls;
    if (options.controls !== undefined) {
        if (Array.isArray(options.controls)) {
            controls = new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"](options.controls.slice());
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_14__["assert"])(typeof /** @type {?} */ (options.controls).getArray === 'function', 47); // Expected `controls` to be an array or an `import("./Collection.js").Collection`
            controls = /** @type {Collection} */ (options.controls);
        }
    }
    var interactions;
    if (options.interactions !== undefined) {
        if (Array.isArray(options.interactions)) {
            interactions = new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"](options.interactions.slice());
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_14__["assert"])(typeof /** @type {?} */ (options.interactions).getArray === 'function', 48); // Expected `interactions` to be an array or an `import("./Collection.js").Collection`
            interactions = /** @type {Collection} */ (options.interactions);
        }
    }
    var overlays;
    if (options.overlays !== undefined) {
        if (Array.isArray(options.overlays)) {
            overlays = new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"](options.overlays.slice());
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_14__["assert"])(typeof /** @type {?} */ (options.overlays).getArray === 'function', 49); // Expected `overlays` to be an array or an `import("./Collection.js").Collection`
            overlays = options.overlays;
        }
    }
    else {
        overlays = new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
    }
    return {
        controls: controls,
        interactions: interactions,
        keyboardEventTarget: keyboardEventTarget,
        overlays: overlays,
        values: values
    };
}
/* harmony default export */ __webpack_exports__["default"] = (PluggableMap);
//# sourceMappingURL=PluggableMap.js.map

/***/ }),

/***/ "./node_modules/ol/Tile.js":
/*!*********************************!*\
  !*** ./node_modules/ol/Tile.js ***!
  \*********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _easing_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./easing.js */ "./node_modules/ol/easing.js");
/* harmony import */ var _events_Target_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./events/Target.js */ "./node_modules/ol/events/Target.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util.js */ "./node_modules/ol/util.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/Tile
 */





/**
 * A function that takes an {@link module:ol/Tile} for the tile and a
 * `{string}` for the url as arguments. The default is
 * ```js
 * source.setTileLoadFunction(function(tile, src) {
 *   tile.getImage().src = src;
 * });
 * ```
 * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve
 * error handling:
 *
 * ```js
 * import TileState from 'ol/TileState';
 *
 * source.setTileLoadFunction(function(tile, src) {
 *   var xhr = new XMLHttpRequest();
 *   xhr.responseType = 'blob';
 *   xhr.addEventListener('loadend', function (evt) {
 *     var data = this.response;
 *     if (data !== undefined) {
 *       tile.getImage().src = URL.createObjectURL(data);
 *     } else {
 *       tile.setState(TileState.ERROR);
 *     }
 *   });
 *   xhr.addEventListener('error', function () {
 *     tile.setState(TileState.ERROR);
 *   });
 *   xhr.open('GET', src);
 *   xhr.send();
 * });
 * ```
 *
 * @typedef {function(Tile, string): void} LoadFunction
 * @api
 */
/**
 * {@link module:ol/source/Tile~Tile} sources use a function of this type to get
 * the url that provides a tile for a given tile coordinate.
 *
 * This function takes an {@link module:ol/tilecoord~TileCoord} for the tile
 * coordinate, a `{number}` representing the pixel ratio and a
 * {@link module:ol/proj/Projection} for the projection  as arguments
 * and returns a `{string}` representing the tile URL, or undefined if no tile
 * should be requested for the passed tile coordinate.
 *
 * @typedef {function(import("./tilecoord.js").TileCoord, number,
 *           import("./proj/Projection.js").default): (string|undefined)} UrlFunction
 * @api
 */
/**
 * @typedef {Object} Options
 * @property {number} [transition=250] A duration for tile opacity
 * transitions in milliseconds. A duration of 0 disables the opacity transition.
 * @api
 */
/**
 * @classdesc
 * Base class for tiles.
 *
 * @abstract
 */
var Tile = /** @class */ (function (_super) {
    __extends(Tile, _super);
    /**
     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {TileState} state State.
     * @param {Options=} opt_options Tile options.
     */
    function Tile(tileCoord, state, opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @type {import("./tilecoord.js").TileCoord}
         */
        _this.tileCoord = tileCoord;
        /**
         * @protected
         * @type {TileState}
         */
        _this.state = state;
        /**
         * An "interim" tile for this tile. The interim tile may be used while this
         * one is loading, for "smooth" transitions when changing params/dimensions
         * on the source.
         * @type {Tile}
         */
        _this.interimTile = null;
        /**
         * The tile is available at the highest possible resolution. Subclasses can
         * set this to `false` initially. Tile load listeners will not be
         * unregistered before this is set to `true` and a `#changed()` is called.
         * @type {boolean}
         */
        _this.hifi = true;
        /**
         * A key assigned to the tile. This is used by the tile source to determine
         * if this tile can effectively be used, or if a new tile should be created
         * and this one be used as an interim tile for this new tile.
         * @type {string}
         */
        _this.key = '';
        /**
         * The duration for the opacity transition.
         * @type {number}
         */
        _this.transition_ = options.transition === undefined ? 250 : options.transition;
        /**
         * Lookup of start times for rendering transitions.  If the start time is
         * equal to -1, the transition is complete.
         * @type {Object<string, number>}
         */
        _this.transitionStarts_ = {};
        return _this;
    }
    /**
     * @protected
     */
    Tile.prototype.changed = function () {
        this.dispatchEvent(_events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].CHANGE);
    };
    /**
     * Called by the tile cache when the tile is removed from the cache due to expiry
     */
    Tile.prototype.release = function () {
    };
    /**
     * @return {string} Key.
     */
    Tile.prototype.getKey = function () {
        return this.key + '/' + this.tileCoord;
    };
    /**
     * Get the interim tile most suitable for rendering using the chain of interim
     * tiles. This corresponds to the  most recent tile that has been loaded, if no
     * such tile exists, the original tile is returned.
     * @return {!Tile} Best tile for rendering.
     */
    Tile.prototype.getInterimTile = function () {
        if (!this.interimTile) {
            //empty chain
            return this;
        }
        var tile = this.interimTile;
        // find the first loaded tile and return it. Since the chain is sorted in
        // decreasing order of creation time, there is no need to search the remainder
        // of the list (all those tiles correspond to older requests and will be
        // cleaned up by refreshInterimChain)
        do {
            if (tile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED) {
                // Show tile immediately instead of fading it in after loading, because
                // the interim tile is in place already
                this.transition_ = 0;
                return tile;
            }
            tile = tile.interimTile;
        } while (tile);
        // we can not find a better tile
        return this;
    };
    /**
     * Goes through the chain of interim tiles and discards sections of the chain
     * that are no longer relevant.
     */
    Tile.prototype.refreshInterimChain = function () {
        if (!this.interimTile) {
            return;
        }
        var tile = this.interimTile;
        var prev = /** @type {Tile} */ (this);
        do {
            if (tile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED) {
                //we have a loaded tile, we can discard the rest of the list
                //we would could abort any LOADING tile request
                //older than this tile (i.e. any LOADING tile following this entry in the chain)
                tile.interimTile = null;
                break;
            }
            else if (tile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADING) {
                //keep this LOADING tile any loaded tiles later in the chain are
                //older than this tile, so we're still interested in the request
                prev = tile;
            }
            else if (tile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].IDLE) {
                //the head of the list is the most current tile, we don't need
                //to start any other requests for this chain
                prev.interimTile = tile.interimTile;
            }
            else {
                prev = tile;
            }
            tile = prev.interimTile;
        } while (tile);
    };
    /**
     * Get the tile coordinate for this tile.
     * @return {import("./tilecoord.js").TileCoord} The tile coordinate.
     * @api
     */
    Tile.prototype.getTileCoord = function () {
        return this.tileCoord;
    };
    /**
     * @return {TileState} State.
     */
    Tile.prototype.getState = function () {
        return this.state;
    };
    /**
     * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,
     * it is important to set the state correctly to {@link module:ol/TileState~ERROR}
     * when the tile cannot be loaded. Otherwise the tile cannot be removed from
     * the tile queue and will block other requests.
     * @param {TileState} state State.
     * @api
     */
    Tile.prototype.setState = function (state) {
        if (this.state !== _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].ERROR && this.state > state) {
            throw new Error('Tile load sequence violation');
        }
        this.state = state;
        this.changed();
    };
    /**
     * Load the image or retry if loading previously failed.
     * Loading is taken care of by the tile queue, and calling this method is
     * only needed for preloading or for reloading in case of an error.
     * @abstract
     * @api
     */
    Tile.prototype.load = function () {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_4__["abstract"])();
    };
    /**
     * Get the alpha value for rendering.
     * @param {string} id An id for the renderer.
     * @param {number} time The render frame time.
     * @return {number} A number between 0 and 1.
     */
    Tile.prototype.getAlpha = function (id, time) {
        if (!this.transition_) {
            return 1;
        }
        var start = this.transitionStarts_[id];
        if (!start) {
            start = time;
            this.transitionStarts_[id] = start;
        }
        else if (start === -1) {
            return 1;
        }
        var delta = time - start + (1000 / 60); // avoid rendering at 0
        if (delta >= this.transition_) {
            return 1;
        }
        return Object(_easing_js__WEBPACK_IMPORTED_MODULE_1__["easeIn"])(delta / this.transition_);
    };
    /**
     * Determine if a tile is in an alpha transition.  A tile is considered in
     * transition if tile.getAlpha() has not yet been called or has been called
     * and returned 1.
     * @param {string} id An id for the renderer.
     * @return {boolean} The tile is in transition.
     */
    Tile.prototype.inTransition = function (id) {
        if (!this.transition_) {
            return false;
        }
        return this.transitionStarts_[id] !== -1;
    };
    /**
     * Mark a transition as complete.
     * @param {string} id An id for the renderer.
     */
    Tile.prototype.endTransition = function (id) {
        if (this.transition_) {
            this.transitionStarts_[id] = -1;
        }
    };
    return Tile;
}(_events_Target_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Tile);
//# sourceMappingURL=Tile.js.map

/***/ }),

/***/ "./node_modules/ol/TileCache.js":
/*!**************************************!*\
  !*** ./node_modules/ol/TileCache.js ***!
  \**************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _structs_LRUCache_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./structs/LRUCache.js */ "./node_modules/ol/structs/LRUCache.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tilecoord.js */ "./node_modules/ol/tilecoord.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/TileCache
 */


var TileCache = /** @class */ (function (_super) {
    __extends(TileCache, _super);
    function TileCache() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    /**
     * @param {!Object<string, boolean>} usedTiles Used tiles.
     */
    TileCache.prototype.expireCache = function (usedTiles) {
        while (this.canExpireCache()) {
            var tile = this.peekLast();
            if (tile.getKey() in usedTiles) {
                break;
            }
            else {
                this.pop().release();
            }
        }
    };
    /**
     * Prune all tiles from the cache that don't have the same z as the newest tile.
     */
    TileCache.prototype.pruneExceptNewestZ = function () {
        if (this.getCount() === 0) {
            return;
        }
        var key = this.peekFirstKey();
        var tileCoord = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_1__["fromKey"])(key);
        var z = tileCoord[0];
        this.forEach(function (tile) {
            if (tile.tileCoord[0] !== z) {
                this.remove(Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_1__["getKey"])(tile.tileCoord));
                tile.release();
            }
        }.bind(this));
    };
    return TileCache;
}(_structs_LRUCache_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (TileCache);
//# sourceMappingURL=TileCache.js.map

/***/ }),

/***/ "./node_modules/ol/TileQueue.js":
/*!**************************************!*\
  !*** ./node_modules/ol/TileQueue.js ***!
  \**************************************/
/*! exports provided: default, getTilePriority */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTilePriority", function() { return getTilePriority; });
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _structs_PriorityQueue_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./structs/PriorityQueue.js */ "./node_modules/ol/structs/PriorityQueue.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/TileQueue
 */



/**
 * @typedef {function(import("./Tile.js").default, string, import("./coordinate.js").Coordinate, number): number} PriorityFunction
 */
var TileQueue = /** @class */ (function (_super) {
    __extends(TileQueue, _super);
    /**
     * @param {PriorityFunction} tilePriorityFunction Tile priority function.
     * @param {function(): ?} tileChangeCallback Function called on each tile change event.
     */
    function TileQueue(tilePriorityFunction, tileChangeCallback) {
        var _this = _super.call(this, 
        /**
         * @param {Array} element Element.
         * @return {number} Priority.
         */
        function (element) {
            return tilePriorityFunction.apply(null, element);
        }, 
        /**
         * @param {Array} element Element.
         * @return {string} Key.
         */
        function (element) {
            return ( /** @type {import("./Tile.js").default} */(element[0]).getKey());
        }) || this;
        /** @private */
        _this.boundHandleTileChange_ = _this.handleTileChange.bind(_this);
        /**
         * @private
         * @type {function(): ?}
         */
        _this.tileChangeCallback_ = tileChangeCallback;
        /**
         * @private
         * @type {number}
         */
        _this.tilesLoading_ = 0;
        /**
         * @private
         * @type {!Object<string,boolean>}
         */
        _this.tilesLoadingKeys_ = {};
        return _this;
    }
    /**
     * @inheritDoc
     */
    TileQueue.prototype.enqueue = function (element) {
        var added = _super.prototype.enqueue.call(this, element);
        if (added) {
            var tile = element[0];
            tile.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].CHANGE, this.boundHandleTileChange_);
        }
        return added;
    };
    /**
     * @return {number} Number of tiles loading.
     */
    TileQueue.prototype.getTilesLoading = function () {
        return this.tilesLoading_;
    };
    /**
     * @param {import("./events/Event.js").default} event Event.
     * @protected
     */
    TileQueue.prototype.handleTileChange = function (event) {
        var tile = /** @type {import("./Tile.js").default} */ (event.target);
        var state = tile.getState();
        if (tile.hifi && state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED || state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].ERROR || state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].EMPTY) {
            tile.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].CHANGE, this.boundHandleTileChange_);
            var tileKey = tile.getKey();
            if (tileKey in this.tilesLoadingKeys_) {
                delete this.tilesLoadingKeys_[tileKey];
                --this.tilesLoading_;
            }
            this.tileChangeCallback_();
        }
    };
    /**
     * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.
     * @param {number} maxNewLoads Maximum number of new tiles to load.
     */
    TileQueue.prototype.loadMoreTiles = function (maxTotalLoading, maxNewLoads) {
        var newLoads = 0;
        var state, tile, tileKey;
        while (this.tilesLoading_ < maxTotalLoading && newLoads < maxNewLoads &&
            this.getCount() > 0) {
            tile = /** @type {import("./Tile.js").default} */ (this.dequeue()[0]);
            tileKey = tile.getKey();
            state = tile.getState();
            if (state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].IDLE && !(tileKey in this.tilesLoadingKeys_)) {
                this.tilesLoadingKeys_[tileKey] = true;
                ++this.tilesLoading_;
                ++newLoads;
                tile.load();
            }
        }
    };
    return TileQueue;
}(_structs_PriorityQueue_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (TileQueue);
/**
 * @param {import('./PluggableMap.js').FrameState} frameState Frame state.
 * @param {import("./Tile.js").default} tile Tile.
 * @param {string} tileSourceKey Tile source key.
 * @param {import("./coordinate.js").Coordinate} tileCenter Tile center.
 * @param {number} tileResolution Tile resolution.
 * @return {number} Tile priority.
 */
function getTilePriority(frameState, tile, tileSourceKey, tileCenter, tileResolution) {
    // Filter out tiles at higher zoom levels than the current zoom level, or that
    // are outside the visible extent.
    if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {
        return _structs_PriorityQueue_js__WEBPACK_IMPORTED_MODULE_2__["DROP"];
    }
    if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {
        return _structs_PriorityQueue_js__WEBPACK_IMPORTED_MODULE_2__["DROP"];
    }
    // Prioritize the highest zoom level tiles closest to the focus.
    // Tiles at higher zoom levels are prioritized using Math.log(tileResolution).
    // Within a zoom level, tiles are prioritized by the distance in pixels between
    // the center of the tile and the center of the viewport.  The factor of 65536
    // means that the prioritization should behave as desired for tiles up to
    // 65536 * Math.log(2) = 45426 pixels from the focus.
    var center = frameState.viewState.center;
    var deltaX = tileCenter[0] - center[0];
    var deltaY = tileCenter[1] - center[1];
    return 65536 * Math.log(tileResolution) +
        Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution;
}
//# sourceMappingURL=TileQueue.js.map

/***/ }),

/***/ "./node_modules/ol/TileRange.js":
/*!**************************************!*\
  !*** ./node_modules/ol/TileRange.js ***!
  \**************************************/
/*! exports provided: createOrUpdate, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOrUpdate", function() { return createOrUpdate; });
/**
 * @module ol/TileRange
 */
/**
 * A representation of a contiguous block of tiles.  A tile range is specified
 * by its min/max tile coordinates and is inclusive of coordinates.
 */
var TileRange = /** @class */ (function () {
    /**
     * @param {number} minX Minimum X.
     * @param {number} maxX Maximum X.
     * @param {number} minY Minimum Y.
     * @param {number} maxY Maximum Y.
     */
    function TileRange(minX, maxX, minY, maxY) {
        /**
         * @type {number}
         */
        this.minX = minX;
        /**
         * @type {number}
         */
        this.maxX = maxX;
        /**
         * @type {number}
         */
        this.minY = minY;
        /**
         * @type {number}
         */
        this.maxY = maxY;
    }
    /**
     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @return {boolean} Contains tile coordinate.
     */
    TileRange.prototype.contains = function (tileCoord) {
        return this.containsXY(tileCoord[1], tileCoord[2]);
    };
    /**
     * @param {TileRange} tileRange Tile range.
     * @return {boolean} Contains.
     */
    TileRange.prototype.containsTileRange = function (tileRange) {
        return this.minX <= tileRange.minX && tileRange.maxX <= this.maxX &&
            this.minY <= tileRange.minY && tileRange.maxY <= this.maxY;
    };
    /**
     * @param {number} x Tile coordinate x.
     * @param {number} y Tile coordinate y.
     * @return {boolean} Contains coordinate.
     */
    TileRange.prototype.containsXY = function (x, y) {
        return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY;
    };
    /**
     * @param {TileRange} tileRange Tile range.
     * @return {boolean} Equals.
     */
    TileRange.prototype.equals = function (tileRange) {
        return this.minX == tileRange.minX && this.minY == tileRange.minY &&
            this.maxX == tileRange.maxX && this.maxY == tileRange.maxY;
    };
    /**
     * @param {TileRange} tileRange Tile range.
     */
    TileRange.prototype.extend = function (tileRange) {
        if (tileRange.minX < this.minX) {
            this.minX = tileRange.minX;
        }
        if (tileRange.maxX > this.maxX) {
            this.maxX = tileRange.maxX;
        }
        if (tileRange.minY < this.minY) {
            this.minY = tileRange.minY;
        }
        if (tileRange.maxY > this.maxY) {
            this.maxY = tileRange.maxY;
        }
    };
    /**
     * @return {number} Height.
     */
    TileRange.prototype.getHeight = function () {
        return this.maxY - this.minY + 1;
    };
    /**
     * @return {import("./size.js").Size} Size.
     */
    TileRange.prototype.getSize = function () {
        return [this.getWidth(), this.getHeight()];
    };
    /**
     * @return {number} Width.
     */
    TileRange.prototype.getWidth = function () {
        return this.maxX - this.minX + 1;
    };
    /**
     * @param {TileRange} tileRange Tile range.
     * @return {boolean} Intersects.
     */
    TileRange.prototype.intersects = function (tileRange) {
        return this.minX <= tileRange.maxX &&
            this.maxX >= tileRange.minX &&
            this.minY <= tileRange.maxY &&
            this.maxY >= tileRange.minY;
    };
    return TileRange;
}());
/**
 * @param {number} minX Minimum X.
 * @param {number} maxX Maximum X.
 * @param {number} minY Minimum Y.
 * @param {number} maxY Maximum Y.
 * @param {TileRange=} tileRange TileRange.
 * @return {TileRange} Tile range.
 */
function createOrUpdate(minX, maxX, minY, maxY, tileRange) {
    if (tileRange !== undefined) {
        tileRange.minX = minX;
        tileRange.maxX = maxX;
        tileRange.minY = minY;
        tileRange.maxY = maxY;
        return tileRange;
    }
    else {
        return new TileRange(minX, maxX, minY, maxY);
    }
}
/* harmony default export */ __webpack_exports__["default"] = (TileRange);
//# sourceMappingURL=TileRange.js.map

/***/ }),

/***/ "./node_modules/ol/TileState.js":
/*!**************************************!*\
  !*** ./node_modules/ol/TileState.js ***!
  \**************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/TileState
 */
/**
 * @enum {number}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    IDLE: 0,
    LOADING: 1,
    LOADED: 2,
    /**
     * Indicates that tile loading failed
     * @type {number}
     */
    ERROR: 3,
    EMPTY: 4
});
//# sourceMappingURL=TileState.js.map

/***/ }),

/***/ "./node_modules/ol/VectorRenderTile.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/VectorRenderTile.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Tile.js */ "./node_modules/ol/Tile.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dom.js */ "./node_modules/ol/dom.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/VectorRenderTile
 */



/**
 * @typedef {Object} ReplayState
 * @property {boolean} dirty
 * @property {null|import("./render.js").OrderFunction} renderedRenderOrder
 * @property {number} renderedTileRevision
 * @property {number} renderedResolution
 * @property {number} renderedRevision
 * @property {number} renderedZ
 * @property {number} renderedTileResolution
 * @property {number} renderedTileZ
 */
/**
 * @type {Array<HTMLCanvasElement>}
 */
var canvasPool = [];
var VectorRenderTile = /** @class */ (function (_super) {
    __extends(VectorRenderTile, _super);
    /**
     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {import("./TileState.js").default} state State.
     * @param {import("./tilecoord.js").TileCoord} urlTileCoord Wrapped tile coordinate for source urls.
     * @param {function(VectorRenderTile):Array<import("./VectorTile").default>} getSourceTiles Function
     * to get source tiles for this tile.
     */
    function VectorRenderTile(tileCoord, state, urlTileCoord, getSourceTiles) {
        var _this = _super.call(this, tileCoord, state, { transition: 0 }) || this;
        /**
         * @private
         * @type {!Object<string, CanvasRenderingContext2D>}
         */
        _this.context_ = {};
        /**
         * Executor groups by layer uid. Entries are read/written by the renderer.
         * @type {Object<string, Array<import("./render/canvas/ExecutorGroup.js").default>>}
         */
        _this.executorGroups = {};
        /**
         * Number of loading source tiles. Read/written by the source.
         * @type {number}
         */
        _this.loadingSourceTiles = 0;
        /**
         * Tile keys of error source tiles. Read/written by the source.
         * @type {Object<string, boolean>}
         */
        _this.errorSourceTileKeys = {};
        /**
         * @type {Object<number, ImageData>}
         */
        _this.hitDetectionImageData = {};
        /**
         * @private
         * @type {!Object<string, ReplayState>}
         */
        _this.replayState_ = {};
        /**
         * @type {Array<import("./VectorTile.js").default>}
         */
        _this.sourceTiles = null;
        /**
         * @type {number}
         */
        _this.wantedResolution;
        /**
         * @type {!function():Array<import("./VectorTile.js").default>}
         */
        _this.getSourceTiles = getSourceTiles.bind(undefined, _this);
        /**
         * z of the source tiles of the last getSourceTiles call.
         * @type {number}
         */
        _this.sourceZ = -1;
        /**
         * True when all tiles for this tile's nominal resolution are available.
         * @type {boolean}
         */
        _this.hifi = false;
        /**
         * @type {import("./tilecoord.js").TileCoord}
         */
        _this.wrappedTileCoord = urlTileCoord;
        return _this;
    }
    /**
     * @param {import("./layer/Layer.js").default} layer Layer.
     * @return {CanvasRenderingContext2D} The rendering context.
     */
    VectorRenderTile.prototype.getContext = function (layer) {
        var key = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer);
        if (!(key in this.context_)) {
            this.context_[key] = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(1, 1, canvasPool);
        }
        return this.context_[key];
    };
    /**
     * @param {import("./layer/Layer.js").default} layer Layer.
     * @return {boolean} Tile has a rendering context for the given layer.
     */
    VectorRenderTile.prototype.hasContext = function (layer) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer) in this.context_;
    };
    /**
     * Get the Canvas for this tile.
     * @param {import("./layer/Layer.js").default} layer Layer.
     * @return {HTMLCanvasElement} Canvas.
     */
    VectorRenderTile.prototype.getImage = function (layer) {
        return this.hasContext(layer) ? this.getContext(layer).canvas : null;
    };
    /**
     * @param {import("./layer/Layer.js").default} layer Layer.
     * @return {ReplayState} The replay state.
     */
    VectorRenderTile.prototype.getReplayState = function (layer) {
        var key = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer);
        if (!(key in this.replayState_)) {
            this.replayState_[key] = {
                dirty: false,
                renderedRenderOrder: null,
                renderedResolution: NaN,
                renderedRevision: -1,
                renderedTileResolution: NaN,
                renderedTileRevision: -1,
                renderedZ: -1,
                renderedTileZ: -1
            };
        }
        return this.replayState_[key];
    };
    /**
     * @inheritDoc
     */
    VectorRenderTile.prototype.load = function () {
        this.getSourceTiles();
    };
    /**
     * @inheritDoc
     */
    VectorRenderTile.prototype.release = function () {
        for (var key in this.context_) {
            canvasPool.push(this.context_[key].canvas);
        }
        _super.prototype.release.call(this);
    };
    return VectorRenderTile;
}(_Tile_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (VectorRenderTile);
//# sourceMappingURL=VectorRenderTile.js.map

/***/ }),

/***/ "./node_modules/ol/VectorTile.js":
/*!***************************************!*\
  !*** ./node_modules/ol/VectorTile.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Tile.js */ "./node_modules/ol/Tile.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TileState.js */ "./node_modules/ol/TileState.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/VectorTile
 */


var VectorTile = /** @class */ (function (_super) {
    __extends(VectorTile, _super);
    /**
     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {TileState} state State.
     * @param {string} src Data source url.
     * @param {import("./format/Feature.js").default} format Feature format.
     * @param {import("./Tile.js").LoadFunction} tileLoadFunction Tile load function.
     * @param {import("./Tile.js").Options=} opt_options Tile options.
     */
    function VectorTile(tileCoord, state, src, format, tileLoadFunction, opt_options) {
        var _this = _super.call(this, tileCoord, state, opt_options) || this;
        /**
         * Extent of this tile; set by the source.
         * @type {import("./extent.js").Extent}
         */
        _this.extent = null;
        /**
         * @private
         * @type {import("./format/Feature.js").default}
         */
        _this.format_ = format;
        /**
         * @private
         * @type {Array<import("./Feature.js").default>}
         */
        _this.features_ = null;
        /**
         * @private
         * @type {import("./featureloader.js").FeatureLoader}
         */
        _this.loader_;
        /**
         * Feature projection of this tile; set by the source.
         * @type {import("./proj/Projection.js").default}
         */
        _this.projection = null;
        /**
         * Resolution of this tile; set by the source.
         * @type {number}
         */
        _this.resolution;
        /**
         * @private
         * @type {import("./Tile.js").LoadFunction}
         */
        _this.tileLoadFunction_ = tileLoadFunction;
        /**
         * @private
         * @type {string}
         */
        _this.url_ = src;
        return _this;
    }
    /**
     * Get the feature format assigned for reading this tile's features.
     * @return {import("./format/Feature.js").default} Feature format.
     * @api
     */
    VectorTile.prototype.getFormat = function () {
        return this.format_;
    };
    /**
     * Get the features for this tile. Geometries will be in the view projection.
     * @return {Array<import("./Feature.js").FeatureLike>} Features.
     * @api
     */
    VectorTile.prototype.getFeatures = function () {
        return this.features_;
    };
    /**
     * @inheritDoc
     */
    VectorTile.prototype.getKey = function () {
        return this.url_;
    };
    /**
     * @inheritDoc
     */
    VectorTile.prototype.load = function () {
        if (this.state == _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE) {
            this.setState(_TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADING);
            this.tileLoadFunction_(this, this.url_);
            if (this.loader_) {
                this.loader_(this.extent, this.resolution, this.projection);
            }
        }
    };
    /**
     * Handler for successful tile load.
     * @param {Array<import("./Feature.js").default>} features The loaded features.
     * @param {import("./proj/Projection.js").default} dataProjection Data projection.
     */
    VectorTile.prototype.onLoad = function (features, dataProjection) {
        this.setFeatures(features);
    };
    /**
     * Handler for tile load errors.
     */
    VectorTile.prototype.onError = function () {
        this.setState(_TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR);
    };
    /**
     * Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`.
     * Sets the features for the tile.
     * @param {Array<import("./Feature.js").default>} features Features.
     * @api
     */
    VectorTile.prototype.setFeatures = function (features) {
        this.features_ = features;
        this.setState(_TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED);
    };
    /**
     * Set the feature loader for reading this tile's features.
     * @param {import("./featureloader.js").FeatureLoader} loader Feature loader.
     * @api
     */
    VectorTile.prototype.setLoader = function (loader) {
        this.loader_ = loader;
    };
    return VectorTile;
}(_Tile_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (VectorTile);
//# sourceMappingURL=VectorTile.js.map

/***/ }),

/***/ "./node_modules/ol/View.js":
/*!*********************************!*\
  !*** ./node_modules/ol/View.js ***!
  \*********************************/
/*! exports provided: createCenterConstraint, createResolutionConstraint, createRotationConstraint, isNoopAnimation, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCenterConstraint", function() { return createCenterConstraint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createResolutionConstraint", function() { return createResolutionConstraint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRotationConstraint", function() { return createRotationConstraint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNoopAnimation", function() { return isNoopAnimation; });
/* harmony import */ var _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tilegrid/common.js */ "./node_modules/ol/tilegrid/common.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _centerconstraint_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./centerconstraint.js */ "./node_modules/ol/centerconstraint.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _resolutionconstraint_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./resolutionconstraint.js */ "./node_modules/ol/resolutionconstraint.js");
/* harmony import */ var _rotationconstraint_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./rotationconstraint.js */ "./node_modules/ol/rotationconstraint.js");
/* harmony import */ var _ViewHint_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ViewHint.js */ "./node_modules/ol/ViewHint.js");
/* harmony import */ var _ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ViewProperty.js */ "./node_modules/ol/ViewProperty.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _easing_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./easing.js */ "./node_modules/ol/easing.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _proj_Units_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./proj/Units.js */ "./node_modules/ol/proj/Units.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/View
 */






















/**
 * An animation configuration
 *
 * @typedef {Object} Animation
 * @property {import("./coordinate.js").Coordinate} [sourceCenter]
 * @property {import("./coordinate.js").Coordinate} [targetCenter]
 * @property {number} [sourceResolution]
 * @property {number} [targetResolution]
 * @property {number} [sourceRotation]
 * @property {number} [targetRotation]
 * @property {import("./coordinate.js").Coordinate} [anchor]
 * @property {number} start
 * @property {number} duration
 * @property {boolean} complete
 * @property {function(number):number} easing
 * @property {function(boolean)} callback
 */
/**
 * @typedef {Object} Constraints
 * @property {import("./centerconstraint.js").Type} center
 * @property {import("./resolutionconstraint.js").Type} resolution
 * @property {import("./rotationconstraint.js").Type} rotation
 */
/**
 * @typedef {Object} FitOptions
 * @property {import("./size.js").Size} [size] The size in pixels of the box to fit
 * the extent into. Default is the current size of the first map in the DOM that
 * uses this view, or `[100, 100]` if no such map is found.
 * @property {!Array<number>} [padding=[0, 0, 0, 0]] Padding (in pixels) to be
 * cleared inside the view. Values in the array are top, right, bottom and left
 * padding.
 * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`,
 * get the nearest extent instead of the closest that actually fits the view.
 * @property {number} [minResolution=0] Minimum resolution that we zoom to.
 * @property {number} [maxZoom] Maximum zoom level that we zoom to. If
 * `minResolution` is given, this property is ignored.
 * @property {number} [duration] The duration of the animation in milliseconds.
 * By default, there is no animation to the target extent.
 * @property {function(number):number} [easing] The easing function used during
 * the animation (defaults to {@link module:ol/easing~inAndOut}).
 * The function will be called for each frame with a number representing a
 * fraction of the animation's duration.  The function should return a number
 * between 0 and 1 representing the progress toward the destination state.
 * @property {function(boolean)} [callback] Function called when the view is in
 * its final position. The callback will be called with `true` if the animation
 * series completed on its own or `false` if it was cancelled.
 */
/**
 * @typedef {Object} ViewOptions
 * @property {import("./coordinate.js").Coordinate} [center] The initial center for
 * the view. If a user projection is not set, the coordinate system for the center is
 * specified with the `projection` option. Layer sources will not be fetched if this
 * is not set, but the center can be set later with {@link #setCenter}.
 * @property {boolean|number} [constrainRotation=true] Rotation constraint.
 * `false` means no constraint. `true` means no constraint, but snap to zero
 * near zero. A number constrains the rotation to that number of values. For
 * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.
 * @property {boolean} [enableRotation=true] Enable rotation.
 * If `false`, a rotation constraint that always sets the rotation to zero is
 * used. The `constrainRotation` option has no effect if `enableRotation` is
 * `false`.
 * @property {import("./extent.js").Extent} [extent] The extent that constrains the
 * view, in other words, nothing outside of this extent can be visible on the map.
 * @property {boolean} [constrainOnlyCenter=false] If true, the extent
 * constraint will only apply to the view center and not the whole extent.
 * @property {boolean} [smoothExtentConstraint=true] If true, the extent
 * constraint will be applied smoothly, i.e. allow the view to go slightly outside
 * of the given `extent`.
 * @property {number} [maxResolution] The maximum resolution used to determine
 * the resolution constraint. It is used together with `minResolution` (or
 * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way
 * that the projection's validity extent fits in a 256x256 px tile. If the
 * projection is Spherical Mercator (the default) then `maxResolution` defaults
 * to `40075016.68557849 / 256 = 156543.03392804097`.
 * @property {number} [minResolution] The minimum resolution used to determine
 * the resolution constraint.  It is used together with `maxResolution` (or
 * `minZoom`) and `zoomFactor`.  If unspecified it is calculated assuming 29
 * zoom levels (with a factor of 2). If the projection is Spherical Mercator
 * (the default) then `minResolution` defaults to
 * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.
 * @property {number} [maxZoom=28] The maximum zoom level used to determine the
 * resolution constraint. It is used together with `minZoom` (or
 * `maxResolution`) and `zoomFactor`.  Note that if `minResolution` is also
 * provided, it is given precedence over `maxZoom`.
 * @property {number} [minZoom=0] The minimum zoom level used to determine the
 * resolution constraint. It is used together with `maxZoom` (or
 * `minResolution`) and `zoomFactor`.  Note that if `maxResolution` is also
 * provided, it is given precedence over `minZoom`.
 * @property {boolean} [multiWorld=false] If `false` the view is constrained so
 * only one world is visible, and you cannot pan off the edge.  If `true` the map
 * may show multiple worlds at low zoom levels.  Only used if the `projection` is
 * global.  Note that if `extent` is also provided it is given precedence.
 * @property {boolean} [constrainResolution=false] If true, the view will always
 * animate to the closest zoom level after an interaction; false means
 * intermediary zoom levels are allowed.
 * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution
 * min/max values will be applied smoothly, i. e. allow the view to exceed slightly
 * the given resolution or zoom bounds.
 * @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to
 * show the full configured extent. By default, when a view is configured with an
 * extent, users will not be able to zoom out so the viewport exceeds the extent in
 * either dimension. This means the full extent may not be visible if the viewport
 * is taller or wider than the aspect ratio of the configured extent. If
 * showFullExtent is true, the user will be able to zoom out so that the viewport
 * exceeds the height or width of the configured extent, but not both, allowing the
 * full extent to be shown.
 * @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857'] The
 * projection. The default is Spherical Mercator.
 * @property {number} [resolution] The initial resolution for the view. The
 * units are `projection` units per pixel (e.g. meters per pixel). An
 * alternative to setting this is to set `zoom`. Layer sources will not be
 * fetched if neither this nor `zoom` are defined, but they can be set later
 * with {@link #setZoom} or {@link #setResolution}.
 * @property {Array<number>} [resolutions] Resolutions to determine the
 * resolution constraint. If set the `maxResolution`, `minResolution`,
 * `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.
 * @property {number} [rotation=0] The initial rotation for the view in radians
 * (positive rotation clockwise, 0 means North).
 * @property {number} [zoom] Only used if `resolution` is not defined. Zoom
 * level used to calculate the initial resolution for the view.
 * @property {number} [zoomFactor=2] The zoom factor used to compute the
 * corresponding resolution.
 */
/**
 * @typedef {Object} AnimationOptions
 * @property {import("./coordinate.js").Coordinate} [center] The center of the view at the end of
 * the animation.
 * @property {number} [zoom] The zoom level of the view at the end of the
 * animation. This takes precedence over `resolution`.
 * @property {number} [resolution] The resolution of the view at the end
 * of the animation.  If `zoom` is also provided, this option will be ignored.
 * @property {number} [rotation] The rotation of the view at the end of
 * the animation.
 * @property {import("./coordinate.js").Coordinate} [anchor] Optional anchor to remain fixed
 * during a rotation or resolution animation.
 * @property {number} [duration=1000] The duration of the animation in milliseconds.
 * @property {function(number):number} [easing] The easing function used
 * during the animation (defaults to {@link module:ol/easing~inAndOut}).
 * The function will be called for each frame with a number representing a
 * fraction of the animation's duration.  The function should return a number
 * between 0 and 1 representing the progress toward the destination state.
 */
/**
 * @typedef {Object} State
 * @property {import("./coordinate.js").Coordinate} center
 * @property {import("./proj/Projection.js").default} projection
 * @property {number} resolution
 * @property {number} rotation
 * @property {number} zoom
 */
/**
 * Default min zoom level for the map view.
 * @type {number}
 */
var DEFAULT_MIN_ZOOM = 0;
/**
 * @classdesc
 * A View object represents a simple 2D view of the map.
 *
 * This is the object to act upon to change the center, resolution,
 * and rotation of the map.
 *
 * A View has a `projection`. The projection determines the
 * coordinate system of the center, and its units determine the units of the
 * resolution (projection units per pixel). The default projection is
 * Spherical Mercator (EPSG:3857).
 *
 * ### The view states
 *
 * A View is determined by three states: `center`, `resolution`,
 * and `rotation`. Each state has a corresponding getter and setter, e.g.
 * `getCenter` and `setCenter` for the `center` state.
 *
 * The `zoom` state is actually not saved on the view: all computations
 * internally use the `resolution` state. Still, the `setZoom` and `getZoom`
 * methods are available, as well as `getResolutionForZoom` and
 * `getZoomForResolution` to switch from one system to the other.
 *
 * ### The constraints
 *
 * `setCenter`, `setResolution` and `setRotation` can be used to change the
 * states of the view, but any constraint defined in the constructor will
 * be applied along the way.
 *
 * A View object can have a *resolution constraint*, a *rotation constraint*
 * and a *center constraint*.
 *
 * The *resolution constraint* typically restricts min/max values and
 * snaps to specific resolutions. It is determined by the following
 * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`.
 * If `resolutions` is set, the other three options are ignored. See
 * documentation for each option for more information. By default, the view
 * only has a min/max restriction and allow intermediary zoom levels when
 * pinch-zooming for example.
 *
 * The *rotation constraint* snaps to specific angles. It is determined
 * by the following options: `enableRotation` and `constrainRotation`.
 * By default rotation is allowed and its value is snapped to zero when approaching the
 * horizontal.
 *
 * The *center constraint* is determined by the `extent` option. By
 * default the view center is not constrained at all.
 *
 * ### Changing the view state
 *
 * It is important to note that `setZoom`, `setResolution`, `setCenter` and
 * `setRotation` are subject to the above mentioned constraints. As such, it
 * may sometimes not be possible to know in advance the resulting state of the
 * View. For example, calling `setResolution(10)` does not guarantee that
 * `getResolution()` will return `10`.
 *
 * A consequence of this is that, when applying a delta on the view state, one
 * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution`
 * rather than the corresponding setters. This will let view do its internal
 * computations. Besides, the `adjust*` methods also take an `opt_anchor`
 * argument which allows specifying an origin for the transformation.
 *
 * ### Interacting with the view
 *
 * View constraints are usually only applied when the view is *at rest*, meaning that
 * no interaction or animation is ongoing. As such, if the user puts the view in a
 * state that is not equivalent to a constrained one (e.g. rotating the view when
 * the snap angle is 0), an animation will be triggered at the interaction end to
 * put back the view to a stable state;
 *
 * @api
 */
var View = /** @class */ (function (_super) {
    __extends(View, _super);
    /**
     * @param {ViewOptions=} opt_options View options.
     */
    function View(opt_options) {
        var _this = _super.call(this) || this;
        var options = Object(_obj_js__WEBPACK_IMPORTED_MODULE_16__["assign"])({}, opt_options);
        /**
         * @private
         * @type {Array<number>}
         */
        _this.hints_ = [0, 0];
        /**
         * @private
         * @type {Array<Array<Animation>>}
         */
        _this.animations_ = [];
        /**
         * @private
         * @type {number|undefined}
         */
        _this.updateAnimationKey_;
        /**
         * @private
         * @const
         * @type {import("./proj/Projection.js").default}
         */
        _this.projection_ = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["createProjection"])(options.projection, 'EPSG:3857');
        /**
         * @private
         * @type {import("./size.js").Size}
         */
        _this.viewportSize_ = [100, 100];
        /**
         * @private
         * @type {import("./coordinate.js").Coordinate|undefined}
         */
        _this.targetCenter_ = null;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.targetResolution_;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.targetRotation_;
        /**
         * @private
         * @type {import("./coordinate.js").Coordinate|undefined}
         */
        _this.cancelAnchor_ = undefined;
        if (options.center) {
            options.center = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserCoordinate"])(options.center, _this.projection_);
        }
        if (options.extent) {
            options.extent = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserExtent"])(options.extent, _this.projection_);
        }
        _this.applyOptions_(options);
        return _this;
    }
    /**
     * Set up the view with the given options.
     * @param {ViewOptions} options View options.
     */
    View.prototype.applyOptions_ = function (options) {
        /**
         * @type {Object<string, *>}
         */
        var properties = {};
        var resolutionConstraintInfo = createResolutionConstraint(options);
        /**
         * @private
         * @type {number}
         */
        this.maxResolution_ = resolutionConstraintInfo.maxResolution;
        /**
         * @private
         * @type {number}
         */
        this.minResolution_ = resolutionConstraintInfo.minResolution;
        /**
         * @private
         * @type {number}
         */
        this.zoomFactor_ = resolutionConstraintInfo.zoomFactor;
        /**
         * @private
         * @type {Array<number>|undefined}
         */
        this.resolutions_ = options.resolutions;
        /**
         * @private
         * @type {number}
         */
        this.minZoom_ = resolutionConstraintInfo.minZoom;
        var centerConstraint = createCenterConstraint(options);
        var resolutionConstraint = resolutionConstraintInfo.constraint;
        var rotationConstraint = createRotationConstraint(options);
        /**
         * @private
         * @type {Constraints}
         */
        this.constraints_ = {
            center: centerConstraint,
            resolution: resolutionConstraint,
            rotation: rotationConstraint
        };
        this.setRotation(options.rotation !== undefined ? options.rotation : 0);
        this.setCenterInternal(options.center !== undefined ? options.center : null);
        if (options.resolution !== undefined) {
            this.setResolution(options.resolution);
        }
        else if (options.zoom !== undefined) {
            this.setZoom(options.zoom);
        }
        this.setProperties(properties);
        /**
         * @private
         * @type {ViewOptions}
         */
        this.options_ = options;
    };
    /**
     * Get an updated version of the view options used to construct the view.  The
     * current resolution (or zoom), center, and rotation are applied to any stored
     * options.  The provided options can be used to apply new min/max zoom or
     * resolution limits.
     * @param {ViewOptions} newOptions New options to be applied.
     * @return {ViewOptions} New options updated with the current view state.
     */
    View.prototype.getUpdatedOptions_ = function (newOptions) {
        var options = Object(_obj_js__WEBPACK_IMPORTED_MODULE_16__["assign"])({}, this.options_);
        // preserve resolution (or zoom)
        if (options.resolution !== undefined) {
            options.resolution = this.getResolution();
        }
        else {
            options.zoom = this.getZoom();
        }
        // preserve center
        options.center = this.getCenterInternal();
        // preserve rotation
        options.rotation = this.getRotation();
        return Object(_obj_js__WEBPACK_IMPORTED_MODULE_16__["assign"])({}, options, newOptions);
    };
    /**
     * Animate the view.  The view's center, zoom (or resolution), and rotation
     * can be animated for smooth transitions between view states.  For example,
     * to animate the view to a new zoom level:
     *
     *     view.animate({zoom: view.getZoom() + 1});
     *
     * By default, the animation lasts one second and uses in-and-out easing.  You
     * can customize this behavior by including `duration` (in milliseconds) and
     * `easing` options (see {@link module:ol/easing}).
     *
     * To chain together multiple animations, call the method with multiple
     * animation objects.  For example, to first zoom and then pan:
     *
     *     view.animate({zoom: 10}, {center: [0, 0]});
     *
     * If you provide a function as the last argument to the animate method, it
     * will get called at the end of an animation series.  The callback will be
     * called with `true` if the animation series completed on its own or `false`
     * if it was cancelled.
     *
     * Animations are cancelled by user interactions (e.g. dragging the map) or by
     * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`
     * (or another method that calls one of these).
     *
     * @param {...(AnimationOptions|function(boolean): void)} var_args Animation
     *     options.  Multiple animations can be run in series by passing multiple
     *     options objects.  To run multiple animations in parallel, call the method
     *     multiple times.  An optional callback can be provided as a final
     *     argument.  The callback will be called with a boolean indicating whether
     *     the animation completed without being cancelled.
     * @api
     */
    View.prototype.animate = function (var_args) {
        if (this.isDef() && !this.getAnimating()) {
            this.resolveConstraints(0);
        }
        var args = new Array(arguments.length);
        for (var i = 0; i < args.length; ++i) {
            var options = arguments[i];
            if (options.center) {
                options = Object(_obj_js__WEBPACK_IMPORTED_MODULE_16__["assign"])({}, options);
                options.center = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserCoordinate"])(options.center, this.getProjection());
            }
            if (options.anchor) {
                options = Object(_obj_js__WEBPACK_IMPORTED_MODULE_16__["assign"])({}, options);
                options.anchor = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserCoordinate"])(options.anchor, this.getProjection());
            }
            args[i] = options;
        }
        this.animateInternal.apply(this, args);
    };
    /**
     * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.
     */
    View.prototype.animateInternal = function (var_args) {
        var animationCount = arguments.length;
        var callback;
        if (animationCount > 1 && typeof arguments[animationCount - 1] === 'function') {
            callback = arguments[animationCount - 1];
            --animationCount;
        }
        if (!this.isDef()) {
            // if view properties are not yet set, shortcut to the final state
            var state = arguments[animationCount - 1];
            if (state.center) {
                this.setCenterInternal(state.center);
            }
            if (state.zoom !== undefined) {
                this.setZoom(state.zoom);
            }
            if (state.rotation !== undefined) {
                this.setRotation(state.rotation);
            }
            if (callback) {
                animationCallback(callback, true);
            }
            return;
        }
        var start = Date.now();
        var center = this.targetCenter_.slice();
        var resolution = this.targetResolution_;
        var rotation = this.targetRotation_;
        var series = [];
        for (var i = 0; i < animationCount; ++i) {
            var options = /** @type {AnimationOptions} */ (arguments[i]);
            var animation = {
                start: start,
                complete: false,
                anchor: options.anchor,
                duration: options.duration !== undefined ? options.duration : 1000,
                easing: options.easing || _easing_js__WEBPACK_IMPORTED_MODULE_11__["inAndOut"],
                callback: callback
            };
            if (options.center) {
                animation.sourceCenter = center;
                animation.targetCenter = options.center.slice();
                center = animation.targetCenter;
            }
            if (options.zoom !== undefined) {
                animation.sourceResolution = resolution;
                animation.targetResolution = this.getResolutionForZoom(options.zoom);
                resolution = animation.targetResolution;
            }
            else if (options.resolution) {
                animation.sourceResolution = resolution;
                animation.targetResolution = options.resolution;
                resolution = animation.targetResolution;
            }
            if (options.rotation !== undefined) {
                animation.sourceRotation = rotation;
                var delta = Object(_math_js__WEBPACK_IMPORTED_MODULE_15__["modulo"])(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;
                animation.targetRotation = rotation + delta;
                rotation = animation.targetRotation;
            }
            // check if animation is a no-op
            if (isNoopAnimation(animation)) {
                animation.complete = true;
                // we still push it onto the series for callback handling
            }
            else {
                start += animation.duration;
            }
            series.push(animation);
        }
        this.animations_.push(series);
        this.setHint(_ViewHint_js__WEBPACK_IMPORTED_MODULE_6__["default"].ANIMATING, 1);
        this.updateAnimations_();
    };
    /**
     * Determine if the view is being animated.
     * @return {boolean} The view is being animated.
     * @api
     */
    View.prototype.getAnimating = function () {
        return this.hints_[_ViewHint_js__WEBPACK_IMPORTED_MODULE_6__["default"].ANIMATING] > 0;
    };
    /**
     * Determine if the user is interacting with the view, such as panning or zooming.
     * @return {boolean} The view is being interacted with.
     * @api
     */
    View.prototype.getInteracting = function () {
        return this.hints_[_ViewHint_js__WEBPACK_IMPORTED_MODULE_6__["default"].INTERACTING] > 0;
    };
    /**
     * Cancel any ongoing animations.
     * @api
     */
    View.prototype.cancelAnimations = function () {
        this.setHint(_ViewHint_js__WEBPACK_IMPORTED_MODULE_6__["default"].ANIMATING, -this.hints_[_ViewHint_js__WEBPACK_IMPORTED_MODULE_6__["default"].ANIMATING]);
        var anchor;
        for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
            var series = this.animations_[i];
            if (series[0].callback) {
                animationCallback(series[0].callback, false);
            }
            if (!anchor) {
                for (var j = 0, jj = series.length; j < jj; ++j) {
                    var animation = series[j];
                    if (!animation.complete) {
                        anchor = animation.anchor;
                        break;
                    }
                }
            }
        }
        this.animations_.length = 0;
        this.cancelAnchor_ = anchor;
    };
    /**
     * Update all animations.
     */
    View.prototype.updateAnimations_ = function () {
        if (this.updateAnimationKey_ !== undefined) {
            cancelAnimationFrame(this.updateAnimationKey_);
            this.updateAnimationKey_ = undefined;
        }
        if (!this.getAnimating()) {
            return;
        }
        var now = Date.now();
        var more = false;
        for (var i = this.animations_.length - 1; i >= 0; --i) {
            var series = this.animations_[i];
            var seriesComplete = true;
            for (var j = 0, jj = series.length; j < jj; ++j) {
                var animation = series[j];
                if (animation.complete) {
                    continue;
                }
                var elapsed = now - animation.start;
                var fraction = animation.duration > 0 ? elapsed / animation.duration : 1;
                if (fraction >= 1) {
                    animation.complete = true;
                    fraction = 1;
                }
                else {
                    seriesComplete = false;
                }
                var progress = animation.easing(fraction);
                if (animation.sourceCenter) {
                    var x0 = animation.sourceCenter[0];
                    var y0 = animation.sourceCenter[1];
                    var x1 = animation.targetCenter[0];
                    var y1 = animation.targetCenter[1];
                    var x = x0 + progress * (x1 - x0);
                    var y = y0 + progress * (y1 - y0);
                    this.targetCenter_ = [x, y];
                }
                if (animation.sourceResolution && animation.targetResolution) {
                    var resolution = progress === 1 ?
                        animation.targetResolution :
                        animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution);
                    if (animation.anchor) {
                        var size = this.getViewportSize_(this.getRotation());
                        var constrainedResolution = this.constraints_.resolution(resolution, 0, size, true);
                        this.targetCenter_ = this.calculateCenterZoom(constrainedResolution, animation.anchor);
                    }
                    this.targetResolution_ = resolution;
                    this.applyTargetState_(true);
                }
                if (animation.sourceRotation !== undefined && animation.targetRotation !== undefined) {
                    var rotation = progress === 1 ?
                        Object(_math_js__WEBPACK_IMPORTED_MODULE_15__["modulo"])(animation.targetRotation + Math.PI, 2 * Math.PI) - Math.PI :
                        animation.sourceRotation + progress * (animation.targetRotation - animation.sourceRotation);
                    if (animation.anchor) {
                        var constrainedRotation = this.constraints_.rotation(rotation, true);
                        this.targetCenter_ = this.calculateCenterRotate(constrainedRotation, animation.anchor);
                    }
                    this.targetRotation_ = rotation;
                }
                this.applyTargetState_(true);
                more = true;
                if (!animation.complete) {
                    break;
                }
            }
            if (seriesComplete) {
                this.animations_[i] = null;
                this.setHint(_ViewHint_js__WEBPACK_IMPORTED_MODULE_6__["default"].ANIMATING, -1);
                var callback = series[0].callback;
                if (callback) {
                    animationCallback(callback, true);
                }
            }
        }
        // prune completed series
        this.animations_ = this.animations_.filter(Boolean);
        if (more && this.updateAnimationKey_ === undefined) {
            this.updateAnimationKey_ = requestAnimationFrame(this.updateAnimations_.bind(this));
        }
    };
    /**
     * @param {number} rotation Target rotation.
     * @param {import("./coordinate.js").Coordinate} anchor Rotation anchor.
     * @return {import("./coordinate.js").Coordinate|undefined} Center for rotation and anchor.
     */
    View.prototype.calculateCenterRotate = function (rotation, anchor) {
        var center;
        var currentCenter = this.getCenterInternal();
        if (currentCenter !== undefined) {
            center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];
            Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_10__["rotate"])(center, rotation - this.getRotation());
            Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_10__["add"])(center, anchor);
        }
        return center;
    };
    /**
     * @param {number} resolution Target resolution.
     * @param {import("./coordinate.js").Coordinate} anchor Zoom anchor.
     * @return {import("./coordinate.js").Coordinate|undefined} Center for resolution and anchor.
     */
    View.prototype.calculateCenterZoom = function (resolution, anchor) {
        var center;
        var currentCenter = this.getCenterInternal();
        var currentResolution = this.getResolution();
        if (currentCenter !== undefined && currentResolution !== undefined) {
            var x = anchor[0] - resolution * (anchor[0] - currentCenter[0]) / currentResolution;
            var y = anchor[1] - resolution * (anchor[1] - currentCenter[1]) / currentResolution;
            center = [x, y];
        }
        return center;
    };
    /**
     * Returns the current viewport size.
     * @private
     * @param {number=} opt_rotation Take into account the rotation of the viewport when giving the size
     * @return {import("./size.js").Size} Viewport size or `[100, 100]` when no viewport is found.
     */
    View.prototype.getViewportSize_ = function (opt_rotation) {
        var size = this.viewportSize_;
        if (opt_rotation) {
            var w = size[0];
            var h = size[1];
            return [
                Math.abs(w * Math.cos(opt_rotation)) + Math.abs(h * Math.sin(opt_rotation)),
                Math.abs(w * Math.sin(opt_rotation)) + Math.abs(h * Math.cos(opt_rotation))
            ];
        }
        else {
            return size;
        }
    };
    /**
     * Stores the viewport size on the view. The viewport size is not read every time from the DOM
     * to avoid performance hit and layout reflow.
     * This should be done on map size change.
     * @param {import("./size.js").Size=} opt_size Viewport size; if undefined, [100, 100] is assumed
     */
    View.prototype.setViewportSize = function (opt_size) {
        this.viewportSize_ = Array.isArray(opt_size) ? opt_size.slice() : [100, 100];
        this.resolveConstraints(0);
    };
    /**
     * Get the view center.
     * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
     * @observable
     * @api
     */
    View.prototype.getCenter = function () {
        var center = this.getCenterInternal();
        if (!center) {
            return center;
        }
        return Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["toUserCoordinate"])(center, this.getProjection());
    };
    /**
     * Get the view center without transforming to user projection.
     * @return {import("./coordinate.js").Coordinate|undefined} The center of the view.
     */
    View.prototype.getCenterInternal = function () {
        return /** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].CENTER));
    };
    /**
     * @return {Constraints} Constraints.
     */
    View.prototype.getConstraints = function () {
        return this.constraints_;
    };
    /**
     * @return {boolean} Resolution constraint is set
     */
    View.prototype.getConstrainResolution = function () {
        return this.options_.constrainResolution;
    };
    /**
     * @param {Array<number>=} opt_hints Destination array.
     * @return {Array<number>} Hint.
     */
    View.prototype.getHints = function (opt_hints) {
        if (opt_hints !== undefined) {
            opt_hints[0] = this.hints_[0];
            opt_hints[1] = this.hints_[1];
            return opt_hints;
        }
        else {
            return this.hints_.slice();
        }
    };
    /**
     * Calculate the extent for the current view state and the passed size.
     * The size is the pixel dimensions of the box into which the calculated extent
     * should fit. In most cases you want to get the extent of the entire map,
     * that is `map.getSize()`.
     * @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size
     * of the map that uses this view will be used.
     * @return {import("./extent.js").Extent} Extent.
     * @api
     */
    View.prototype.calculateExtent = function (opt_size) {
        var extent = this.calculateExtentInternal(opt_size);
        return Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["toUserExtent"])(extent, this.getProjection());
    };
    /**
     * @param {import("./size.js").Size=} opt_size Box pixel size. If not provided, the size of the
     * first map that uses this view will be used.
     * @return {import("./extent.js").Extent} Extent.
     */
    View.prototype.calculateExtentInternal = function (opt_size) {
        var size = opt_size || this.getViewportSize_();
        var center = /** @type {!import("./coordinate.js").Coordinate} */ (this.getCenterInternal());
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_9__["assert"])(center, 1); // The view center is not defined
        var resolution = /** @type {!number} */ (this.getResolution());
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_9__["assert"])(resolution !== undefined, 2); // The view resolution is not defined
        var rotation = /** @type {!number} */ (this.getRotation());
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_9__["assert"])(rotation !== undefined, 3); // The view rotation is not defined
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_12__["getForViewAndSize"])(center, resolution, rotation, size);
    };
    /**
     * Get the maximum resolution of the view.
     * @return {number} The maximum resolution of the view.
     * @api
     */
    View.prototype.getMaxResolution = function () {
        return this.maxResolution_;
    };
    /**
     * Get the minimum resolution of the view.
     * @return {number} The minimum resolution of the view.
     * @api
     */
    View.prototype.getMinResolution = function () {
        return this.minResolution_;
    };
    /**
     * Get the maximum zoom level for the view.
     * @return {number} The maximum zoom level.
     * @api
     */
    View.prototype.getMaxZoom = function () {
        return /** @type {number} */ (this.getZoomForResolution(this.minResolution_));
    };
    /**
     * Set a new maximum zoom level for the view.
     * @param {number} zoom The maximum zoom level.
     * @api
     */
    View.prototype.setMaxZoom = function (zoom) {
        this.applyOptions_(this.getUpdatedOptions_({ maxZoom: zoom }));
    };
    /**
     * Get the minimum zoom level for the view.
     * @return {number} The minimum zoom level.
     * @api
     */
    View.prototype.getMinZoom = function () {
        return /** @type {number} */ (this.getZoomForResolution(this.maxResolution_));
    };
    /**
     * Set a new minimum zoom level for the view.
     * @param {number} zoom The minimum zoom level.
     * @api
     */
    View.prototype.setMinZoom = function (zoom) {
        this.applyOptions_(this.getUpdatedOptions_({ minZoom: zoom }));
    };
    /**
     * Set whether the view shoud allow intermediary zoom levels.
     * @param {boolean} enabled Whether the resolution is constrained.
     * @api
     */
    View.prototype.setConstrainResolution = function (enabled) {
        this.applyOptions_(this.getUpdatedOptions_({ constrainResolution: enabled }));
    };
    /**
     * Get the view projection.
     * @return {import("./proj/Projection.js").default} The projection of the view.
     * @api
     */
    View.prototype.getProjection = function () {
        return this.projection_;
    };
    /**
     * Get the view resolution.
     * @return {number|undefined} The resolution of the view.
     * @observable
     * @api
     */
    View.prototype.getResolution = function () {
        return /** @type {number|undefined} */ (this.get(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].RESOLUTION));
    };
    /**
     * Get the resolutions for the view. This returns the array of resolutions
     * passed to the constructor of the View, or undefined if none were given.
     * @return {Array<number>|undefined} The resolutions of the view.
     * @api
     */
    View.prototype.getResolutions = function () {
        return this.resolutions_;
    };
    /**
     * Get the resolution for a provided extent (in map units) and size (in pixels).
     * @param {import("./extent.js").Extent} extent Extent.
     * @param {import("./size.js").Size=} opt_size Box pixel size.
     * @return {number} The resolution at which the provided extent will render at
     *     the given size.
     * @api
     */
    View.prototype.getResolutionForExtent = function (extent, opt_size) {
        return this.getResolutionForExtentInternal(Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserExtent"])(extent, this.getProjection()), opt_size);
    };
    /**
     * Get the resolution for a provided extent (in map units) and size (in pixels).
     * @param {import("./extent.js").Extent} extent Extent.
     * @param {import("./size.js").Size=} opt_size Box pixel size.
     * @return {number} The resolution at which the provided extent will render at
     *     the given size.
     */
    View.prototype.getResolutionForExtentInternal = function (extent, opt_size) {
        var size = opt_size || this.getViewportSize_();
        var xResolution = Object(_extent_js__WEBPACK_IMPORTED_MODULE_12__["getWidth"])(extent) / size[0];
        var yResolution = Object(_extent_js__WEBPACK_IMPORTED_MODULE_12__["getHeight"])(extent) / size[1];
        return Math.max(xResolution, yResolution);
    };
    /**
     * Return a function that returns a value between 0 and 1 for a
     * resolution. Exponential scaling is assumed.
     * @param {number=} opt_power Power.
     * @return {function(number): number} Resolution for value function.
     */
    View.prototype.getResolutionForValueFunction = function (opt_power) {
        var power = opt_power || 2;
        var maxResolution = this.getConstrainedResolution(this.maxResolution_);
        var minResolution = this.minResolution_;
        var max = Math.log(maxResolution / minResolution) / Math.log(power);
        return (
        /**
         * @param {number} value Value.
         * @return {number} Resolution.
         */
        function (value) {
            var resolution = maxResolution / Math.pow(power, value * max);
            return resolution;
        });
    };
    /**
     * Get the view rotation.
     * @return {number} The rotation of the view in radians.
     * @observable
     * @api
     */
    View.prototype.getRotation = function () {
        return /** @type {number} */ (this.get(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].ROTATION));
    };
    /**
     * Return a function that returns a resolution for a value between
     * 0 and 1. Exponential scaling is assumed.
     * @param {number=} opt_power Power.
     * @return {function(number): number} Value for resolution function.
     */
    View.prototype.getValueForResolutionFunction = function (opt_power) {
        var logPower = Math.log(opt_power || 2);
        var maxResolution = this.getConstrainedResolution(this.maxResolution_);
        var minResolution = this.minResolution_;
        var max = Math.log(maxResolution / minResolution) / logPower;
        return (
        /**
         * @param {number} resolution Resolution.
         * @return {number} Value.
         */
        function (resolution) {
            var value = (Math.log(maxResolution / resolution) / logPower) / max;
            return value;
        });
    };
    /**
     * @return {State} View state.
     */
    View.prototype.getState = function () {
        var center = /** @type {import("./coordinate.js").Coordinate} */ (this.getCenterInternal());
        var projection = this.getProjection();
        var resolution = /** @type {number} */ (this.getResolution());
        var rotation = this.getRotation();
        return {
            center: center.slice(0),
            projection: projection !== undefined ? projection : null,
            resolution: resolution,
            rotation: rotation,
            zoom: this.getZoom()
        };
    };
    /**
     * Get the current zoom level. This method may return non-integer zoom levels
     * if the view does not constrain the resolution, or if an interaction or
     * animation is underway.
     * @return {number|undefined} Zoom.
     * @api
     */
    View.prototype.getZoom = function () {
        var zoom;
        var resolution = this.getResolution();
        if (resolution !== undefined) {
            zoom = this.getZoomForResolution(resolution);
        }
        return zoom;
    };
    /**
     * Get the zoom level for a resolution.
     * @param {number} resolution The resolution.
     * @return {number|undefined} The zoom level for the provided resolution.
     * @api
     */
    View.prototype.getZoomForResolution = function (resolution) {
        var offset = this.minZoom_ || 0;
        var max, zoomFactor;
        if (this.resolutions_) {
            var nearest = Object(_array_js__WEBPACK_IMPORTED_MODULE_8__["linearFindNearest"])(this.resolutions_, resolution, 1);
            offset = nearest;
            max = this.resolutions_[nearest];
            if (nearest == this.resolutions_.length - 1) {
                zoomFactor = 2;
            }
            else {
                zoomFactor = max / this.resolutions_[nearest + 1];
            }
        }
        else {
            max = this.maxResolution_;
            zoomFactor = this.zoomFactor_;
        }
        return offset + Math.log(max / resolution) / Math.log(zoomFactor);
    };
    /**
     * Get the resolution for a zoom level.
     * @param {number} zoom Zoom level.
     * @return {number} The view resolution for the provided zoom level.
     * @api
     */
    View.prototype.getResolutionForZoom = function (zoom) {
        if (this.resolutions_) {
            if (this.resolutions_.length <= 1) {
                return 0;
            }
            var baseLevel = Object(_math_js__WEBPACK_IMPORTED_MODULE_15__["clamp"])(Math.floor(zoom), 0, this.resolutions_.length - 2);
            var zoomFactor = this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1];
            return this.resolutions_[baseLevel] / Math.pow(zoomFactor, Object(_math_js__WEBPACK_IMPORTED_MODULE_15__["clamp"])(zoom - baseLevel, 0, 1));
        }
        else {
            return this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_);
        }
    };
    /**
     * Fit the given geometry or extent based on the given map size and border.
     * The size is pixel dimensions of the box to fit the extent into.
     * In most cases you will want to use the map size, that is `map.getSize()`.
     * Takes care of the map angle.
     * @param {import("./geom/SimpleGeometry.js").default|import("./extent.js").Extent} geometryOrExtent The geometry or
     *     extent to fit the view to.
     * @param {FitOptions=} opt_options Options.
     * @api
     */
    View.prototype.fit = function (geometryOrExtent, opt_options) {
        var options = Object(_obj_js__WEBPACK_IMPORTED_MODULE_16__["assign"])({ size: this.getViewportSize_() }, opt_options || {});
        /** @type {import("./geom/SimpleGeometry.js").default} */
        var geometry;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_9__["assert"])(Array.isArray(geometryOrExtent) || typeof /** @type {?} */ (geometryOrExtent).getSimplifiedGeometry === 'function', 24); // Invalid extent or geometry provided as `geometry`
        if (Array.isArray(geometryOrExtent)) {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_9__["assert"])(!Object(_extent_js__WEBPACK_IMPORTED_MODULE_12__["isEmpty"])(geometryOrExtent), 25); // Cannot fit empty extent provided as `geometry`
            var extent = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserExtent"])(geometryOrExtent, this.getProjection());
            geometry = Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_14__["fromExtent"])(extent);
        }
        else if (geometryOrExtent.getType() === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].CIRCLE) {
            var extent = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserExtent"])(geometryOrExtent.getExtent(), this.getProjection());
            geometry = Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_14__["fromExtent"])(extent);
            geometry.rotate(this.getRotation(), Object(_extent_js__WEBPACK_IMPORTED_MODULE_12__["getCenter"])(extent));
        }
        else {
            var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["getUserProjection"])();
            if (userProjection) {
                geometry = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometryOrExtent.clone().transform(userProjection, this.getProjection()));
            }
            else {
                geometry = geometryOrExtent;
            }
        }
        this.fitInternal(geometry, options);
    };
    /**
     * @param {import("./geom/SimpleGeometry.js").default} geometry The geometry.
     * @param {FitOptions=} opt_options Options.
     */
    View.prototype.fitInternal = function (geometry, opt_options) {
        var options = opt_options || {};
        var size = options.size;
        if (!size) {
            size = this.getViewportSize_();
        }
        var padding = options.padding !== undefined ? options.padding : [0, 0, 0, 0];
        var nearest = options.nearest !== undefined ? options.nearest : false;
        var minResolution;
        if (options.minResolution !== undefined) {
            minResolution = options.minResolution;
        }
        else if (options.maxZoom !== undefined) {
            minResolution = this.getResolutionForZoom(options.maxZoom);
        }
        else {
            minResolution = 0;
        }
        var coords = geometry.getFlatCoordinates();
        // calculate rotated extent
        var rotation = this.getRotation();
        var cosAngle = Math.cos(-rotation);
        var sinAngle = Math.sin(-rotation);
        var minRotX = +Infinity;
        var minRotY = +Infinity;
        var maxRotX = -Infinity;
        var maxRotY = -Infinity;
        var stride = geometry.getStride();
        for (var i = 0, ii = coords.length; i < ii; i += stride) {
            var rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;
            var rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;
            minRotX = Math.min(minRotX, rotX);
            minRotY = Math.min(minRotY, rotY);
            maxRotX = Math.max(maxRotX, rotX);
            maxRotY = Math.max(maxRotY, rotY);
        }
        // calculate resolution
        var resolution = this.getResolutionForExtentInternal([minRotX, minRotY, maxRotX, maxRotY], [size[0] - padding[1] - padding[3], size[1] - padding[0] - padding[2]]);
        resolution = isNaN(resolution) ? minResolution :
            Math.max(resolution, minResolution);
        resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1);
        // calculate center
        sinAngle = -sinAngle; // go back to original rotation
        var centerRotX = (minRotX + maxRotX) / 2;
        var centerRotY = (minRotY + maxRotY) / 2;
        centerRotX += (padding[1] - padding[3]) / 2 * resolution;
        centerRotY += (padding[0] - padding[2]) / 2 * resolution;
        var centerX = centerRotX * cosAngle - centerRotY * sinAngle;
        var centerY = centerRotY * cosAngle + centerRotX * sinAngle;
        var center = [centerX, centerY];
        var callback = options.callback ? options.callback : _functions_js__WEBPACK_IMPORTED_MODULE_1__["VOID"];
        if (options.duration !== undefined) {
            this.animateInternal({
                resolution: resolution,
                center: this.getConstrainedCenter(center, resolution),
                duration: options.duration,
                easing: options.easing
            }, callback);
        }
        else {
            this.targetResolution_ = resolution;
            this.targetCenter_ = center;
            this.applyTargetState_(false, true);
            animationCallback(callback, true);
        }
    };
    /**
     * Center on coordinate and view position.
     * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
     * @param {import("./size.js").Size} size Box pixel size.
     * @param {import("./pixel.js").Pixel} position Position on the view to center on.
     * @api
     */
    View.prototype.centerOn = function (coordinate, size, position) {
        this.centerOnInternal(Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserCoordinate"])(coordinate, this.getProjection()), size, position);
    };
    /**
     * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
     * @param {import("./size.js").Size} size Box pixel size.
     * @param {import("./pixel.js").Pixel} position Position on the view to center on.
     */
    View.prototype.centerOnInternal = function (coordinate, size, position) {
        // calculate rotated position
        var rotation = this.getRotation();
        var cosAngle = Math.cos(-rotation);
        var sinAngle = Math.sin(-rotation);
        var rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;
        var rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;
        var resolution = this.getResolution();
        rotX += (size[0] / 2 - position[0]) * resolution;
        rotY += (position[1] - size[1] / 2) * resolution;
        // go back to original angle
        sinAngle = -sinAngle; // go back to original rotation
        var centerX = rotX * cosAngle - rotY * sinAngle;
        var centerY = rotY * cosAngle + rotX * sinAngle;
        this.setCenterInternal([centerX, centerY]);
    };
    /**
     * @return {boolean} Is defined.
     */
    View.prototype.isDef = function () {
        return !!this.getCenterInternal() && this.getResolution() !== undefined;
    };
    /**
     * Adds relative coordinates to the center of the view. Any extent constraint will apply.
     * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
     * @api
     */
    View.prototype.adjustCenter = function (deltaCoordinates) {
        var center = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["toUserCoordinate"])(this.targetCenter_, this.getProjection());
        this.setCenter([center[0] + deltaCoordinates[0], center[1] + deltaCoordinates[1]]);
    };
    /**
     * Adds relative coordinates to the center of the view. Any extent constraint will apply.
     * @param {import("./coordinate.js").Coordinate} deltaCoordinates Relative value to add.
     */
    View.prototype.adjustCenterInternal = function (deltaCoordinates) {
        var center = this.targetCenter_;
        this.setCenterInternal([center[0] + deltaCoordinates[0], center[1] + deltaCoordinates[1]]);
    };
    /**
     * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
     * constraint will apply.
     * @param {number} ratio The ratio to apply on the view resolution.
     * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation.
     * @api
     */
    View.prototype.adjustResolution = function (ratio, opt_anchor) {
        var anchor = opt_anchor && Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserCoordinate"])(opt_anchor, this.getProjection());
        this.adjustResolutionInternal(ratio, anchor);
    };
    /**
     * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution
     * constraint will apply.
     * @param {number} ratio The ratio to apply on the view resolution.
     * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation.
     */
    View.prototype.adjustResolutionInternal = function (ratio, opt_anchor) {
        var isMoving = this.getAnimating() || this.getInteracting();
        var size = this.getViewportSize_(this.getRotation());
        var newResolution = this.constraints_.resolution(this.targetResolution_ * ratio, 0, size, isMoving);
        if (opt_anchor) {
            this.targetCenter_ = this.calculateCenterZoom(newResolution, opt_anchor);
        }
        this.targetResolution_ *= ratio;
        this.applyTargetState_();
    };
    /**
     * Adds a value to the view zoom level, optionally using an anchor. Any resolution
     * constraint will apply.
     * @param {number} delta Relative value to add to the zoom level.
     * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation.
     * @api
     */
    View.prototype.adjustZoom = function (delta, opt_anchor) {
        this.adjustResolution(Math.pow(this.zoomFactor_, -delta), opt_anchor);
    };
    /**
     * Adds a value to the view rotation, optionally using an anchor. Any rotation
     * constraint will apply.
     * @param {number} delta Relative value to add to the zoom rotation, in radians.
     * @param {import("./coordinate.js").Coordinate=} opt_anchor The rotation center.
     * @api
     */
    View.prototype.adjustRotation = function (delta, opt_anchor) {
        if (opt_anchor) {
            opt_anchor = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserCoordinate"])(opt_anchor, this.getProjection());
        }
        this.adjustRotationInternal(delta, opt_anchor);
    };
    /**
     * @param {number} delta Relative value to add to the zoom rotation, in radians.
     * @param {import("./coordinate.js").Coordinate=} opt_anchor The rotation center.
     */
    View.prototype.adjustRotationInternal = function (delta, opt_anchor) {
        var isMoving = this.getAnimating() || this.getInteracting();
        var newRotation = this.constraints_.rotation(this.targetRotation_ + delta, isMoving);
        if (opt_anchor) {
            this.targetCenter_ = this.calculateCenterRotate(newRotation, opt_anchor);
        }
        this.targetRotation_ += delta;
        this.applyTargetState_();
    };
    /**
     * Set the center of the current view. Any extent constraint will apply.
     * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
     * @observable
     * @api
     */
    View.prototype.setCenter = function (center) {
        this.setCenterInternal(Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserCoordinate"])(center, this.getProjection()));
    };
    /**
     * Set the center using the view projection (not the user projection).
     * @param {import("./coordinate.js").Coordinate|undefined} center The center of the view.
     */
    View.prototype.setCenterInternal = function (center) {
        this.targetCenter_ = center;
        this.applyTargetState_();
    };
    /**
     * @param {ViewHint} hint Hint.
     * @param {number} delta Delta.
     * @return {number} New value.
     */
    View.prototype.setHint = function (hint, delta) {
        this.hints_[hint] += delta;
        this.changed();
        return this.hints_[hint];
    };
    /**
     * Set the resolution for this view. Any resolution constraint will apply.
     * @param {number|undefined} resolution The resolution of the view.
     * @observable
     * @api
     */
    View.prototype.setResolution = function (resolution) {
        this.targetResolution_ = resolution;
        this.applyTargetState_();
    };
    /**
     * Set the rotation for this view. Any rotation constraint will apply.
     * @param {number} rotation The rotation of the view in radians.
     * @observable
     * @api
     */
    View.prototype.setRotation = function (rotation) {
        this.targetRotation_ = rotation;
        this.applyTargetState_();
    };
    /**
     * Zoom to a specific zoom level. Any resolution constrain will apply.
     * @param {number} zoom Zoom level.
     * @api
     */
    View.prototype.setZoom = function (zoom) {
        this.setResolution(this.getResolutionForZoom(zoom));
    };
    /**
     * Recompute rotation/resolution/center based on target values.
     * Note: we have to compute rotation first, then resolution and center considering that
     * parameters can influence one another in case a view extent constraint is present.
     * @param {boolean=} opt_doNotCancelAnims Do not cancel animations.
     * @param {boolean=} opt_forceMoving Apply constraints as if the view is moving.
     * @private
     */
    View.prototype.applyTargetState_ = function (opt_doNotCancelAnims, opt_forceMoving) {
        var isMoving = this.getAnimating() || this.getInteracting() || opt_forceMoving;
        // compute rotation
        var newRotation = this.constraints_.rotation(this.targetRotation_, isMoving);
        var size = this.getViewportSize_(newRotation);
        var newResolution = this.constraints_.resolution(this.targetResolution_, 0, size, isMoving);
        var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size, isMoving);
        if (this.get(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].ROTATION) !== newRotation) {
            this.set(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].ROTATION, newRotation);
        }
        if (this.get(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].RESOLUTION) !== newResolution) {
            this.set(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].RESOLUTION, newResolution);
        }
        if (!this.get(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].CENTER) || !Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_10__["equals"])(this.get(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].CENTER), newCenter)) {
            this.set(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_7__["default"].CENTER, newCenter);
        }
        if (this.getAnimating() && !opt_doNotCancelAnims) {
            this.cancelAnimations();
        }
        this.cancelAnchor_ = undefined;
    };
    /**
     * If any constraints need to be applied, an animation will be triggered.
     * This is typically done on interaction end.
     * Note: calling this with a duration of 0 will apply the constrained values straight away,
     * without animation.
     * @param {number=} opt_duration The animation duration in ms.
     * @param {number=} opt_resolutionDirection Which direction to zoom.
     * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation.
     */
    View.prototype.resolveConstraints = function (opt_duration, opt_resolutionDirection, opt_anchor) {
        var duration = opt_duration !== undefined ? opt_duration : 200;
        var direction = opt_resolutionDirection || 0;
        var newRotation = this.constraints_.rotation(this.targetRotation_);
        var size = this.getViewportSize_(newRotation);
        var newResolution = this.constraints_.resolution(this.targetResolution_, direction, size);
        var newCenter = this.constraints_.center(this.targetCenter_, newResolution, size);
        if (duration === 0 && !this.cancelAnchor_) {
            this.targetResolution_ = newResolution;
            this.targetRotation_ = newRotation;
            this.targetCenter_ = newCenter;
            this.applyTargetState_();
            return;
        }
        var anchor = opt_anchor || (duration === 0 ? this.cancelAnchor_ : undefined);
        this.cancelAnchor_ = undefined;
        if (this.getResolution() !== newResolution ||
            this.getRotation() !== newRotation ||
            !this.getCenterInternal() ||
            !Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_10__["equals"])(this.getCenterInternal(), newCenter)) {
            if (this.getAnimating()) {
                this.cancelAnimations();
            }
            this.animateInternal({
                rotation: newRotation,
                center: newCenter,
                resolution: newResolution,
                duration: duration,
                easing: _easing_js__WEBPACK_IMPORTED_MODULE_11__["easeOut"],
                anchor: anchor
            });
        }
    };
    /**
     * Notify the View that an interaction has started.
     * The view state will be resolved to a stable one if needed
     * (depending on its constraints).
     * @api
     */
    View.prototype.beginInteraction = function () {
        this.resolveConstraints(0);
        this.setHint(_ViewHint_js__WEBPACK_IMPORTED_MODULE_6__["default"].INTERACTING, 1);
    };
    /**
     * Notify the View that an interaction has ended. The view state will be resolved
     * to a stable one if needed (depending on its constraints).
     * @param {number=} opt_duration Animation duration in ms.
     * @param {number=} opt_resolutionDirection Which direction to zoom.
     * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation.
     * @api
     */
    View.prototype.endInteraction = function (opt_duration, opt_resolutionDirection, opt_anchor) {
        var anchor = opt_anchor && Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["fromUserCoordinate"])(opt_anchor, this.getProjection());
        this.endInteractionInternal(opt_duration, opt_resolutionDirection, anchor);
    };
    /**
     * Notify the View that an interaction has ended. The view state will be resolved
     * to a stable one if needed (depending on its constraints).
     * @param {number=} opt_duration Animation duration in ms.
     * @param {number=} opt_resolutionDirection Which direction to zoom.
     * @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation.
     */
    View.prototype.endInteractionInternal = function (opt_duration, opt_resolutionDirection, opt_anchor) {
        this.setHint(_ViewHint_js__WEBPACK_IMPORTED_MODULE_6__["default"].INTERACTING, -1);
        this.resolveConstraints(opt_duration, opt_resolutionDirection, opt_anchor);
    };
    /**
     * Get a valid position for the view center according to the current constraints.
     * @param {import("./coordinate.js").Coordinate|undefined} targetCenter Target center position.
     * @param {number=} opt_targetResolution Target resolution. If not supplied, the current one will be used.
     * This is useful to guess a valid center position at a different zoom level.
     * @return {import("./coordinate.js").Coordinate|undefined} Valid center position.
     */
    View.prototype.getConstrainedCenter = function (targetCenter, opt_targetResolution) {
        var size = this.getViewportSize_(this.getRotation());
        return this.constraints_.center(targetCenter, opt_targetResolution || this.getResolution(), size);
    };
    /**
     * Get a valid zoom level according to the current view constraints.
     * @param {number|undefined} targetZoom Target zoom.
     * @param {number=} [opt_direction=0] Indicate which resolution should be used
     * by a renderer if the view resolution does not match any resolution of the tile source.
     * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
     * will be used. If -1, the nearest higher resolution will be used.
     * @return {number|undefined} Valid zoom level.
     */
    View.prototype.getConstrainedZoom = function (targetZoom, opt_direction) {
        var targetRes = this.getResolutionForZoom(targetZoom);
        return this.getZoomForResolution(this.getConstrainedResolution(targetRes, opt_direction));
    };
    /**
     * Get a valid resolution according to the current view constraints.
     * @param {number|undefined} targetResolution Target resolution.
     * @param {number=} [opt_direction=0] Indicate which resolution should be used
     * by a renderer if the view resolution does not match any resolution of the tile source.
     * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
     * will be used. If -1, the nearest higher resolution will be used.
     * @return {number|undefined} Valid resolution.
     */
    View.prototype.getConstrainedResolution = function (targetResolution, opt_direction) {
        var direction = opt_direction || 0;
        var size = this.getViewportSize_(this.getRotation());
        return this.constraints_.resolution(targetResolution, direction, size);
    };
    return View;
}(_Object_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * @param {Function} callback Callback.
 * @param {*} returnValue Return value.
 */
function animationCallback(callback, returnValue) {
    setTimeout(function () {
        callback(returnValue);
    }, 0);
}
/**
 * @param {ViewOptions} options View options.
 * @return {import("./centerconstraint.js").Type} The constraint.
 */
function createCenterConstraint(options) {
    if (options.extent !== undefined) {
        var smooth = options.smoothExtentConstraint !== undefined ? options.smoothExtentConstraint : true;
        return Object(_centerconstraint_js__WEBPACK_IMPORTED_MODULE_2__["createExtent"])(options.extent, options.constrainOnlyCenter, smooth);
    }
    var projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["createProjection"])(options.projection, 'EPSG:3857');
    if (options.multiWorld !== true && projection.isGlobal()) {
        var extent = projection.getExtent().slice();
        extent[0] = -Infinity;
        extent[2] = Infinity;
        return Object(_centerconstraint_js__WEBPACK_IMPORTED_MODULE_2__["createExtent"])(extent, false, false);
    }
    return _centerconstraint_js__WEBPACK_IMPORTED_MODULE_2__["none"];
}
/**
 * @param {ViewOptions} options View options.
 * @return {{constraint: import("./resolutionconstraint.js").Type, maxResolution: number,
 *     minResolution: number, minZoom: number, zoomFactor: number}} The constraint.
 */
function createResolutionConstraint(options) {
    var resolutionConstraint;
    var maxResolution;
    var minResolution;
    // TODO: move these to be ol constants
    // see https://github.com/openlayers/openlayers/issues/2076
    var defaultMaxZoom = 28;
    var defaultZoomFactor = 2;
    var minZoom = options.minZoom !== undefined ?
        options.minZoom : DEFAULT_MIN_ZOOM;
    var maxZoom = options.maxZoom !== undefined ?
        options.maxZoom : defaultMaxZoom;
    var zoomFactor = options.zoomFactor !== undefined ?
        options.zoomFactor : defaultZoomFactor;
    var multiWorld = options.multiWorld !== undefined ?
        options.multiWorld : false;
    var smooth = options.smoothResolutionConstraint !== undefined ? options.smoothResolutionConstraint : true;
    var showFullExtent = options.showFullExtent !== undefined ? options.showFullExtent : false;
    var projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["createProjection"])(options.projection, 'EPSG:3857');
    var projExtent = projection.getExtent();
    var constrainOnlyCenter = options.constrainOnlyCenter;
    var extent = options.extent;
    if (!multiWorld && !extent && projection.isGlobal()) {
        constrainOnlyCenter = false;
        extent = projExtent;
    }
    if (options.resolutions !== undefined) {
        var resolutions = options.resolutions;
        maxResolution = resolutions[minZoom];
        minResolution = resolutions[maxZoom] !== undefined ?
            resolutions[maxZoom] : resolutions[resolutions.length - 1];
        if (options.constrainResolution) {
            resolutionConstraint = Object(_resolutionconstraint_js__WEBPACK_IMPORTED_MODULE_4__["createSnapToResolutions"])(resolutions, smooth, !constrainOnlyCenter && extent, showFullExtent);
        }
        else {
            resolutionConstraint = Object(_resolutionconstraint_js__WEBPACK_IMPORTED_MODULE_4__["createMinMaxResolution"])(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent);
        }
    }
    else {
        // calculate the default min and max resolution
        var size = !projExtent ?
            // use an extent that can fit the whole world if need be
            360 * _proj_js__WEBPACK_IMPORTED_MODULE_17__["METERS_PER_UNIT"][_proj_Units_js__WEBPACK_IMPORTED_MODULE_18__["default"].DEGREES] /
                projection.getMetersPerUnit() :
            Math.max(Object(_extent_js__WEBPACK_IMPORTED_MODULE_12__["getWidth"])(projExtent), Object(_extent_js__WEBPACK_IMPORTED_MODULE_12__["getHeight"])(projExtent));
        var defaultMaxResolution = size / _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_TILE_SIZE"] / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM);
        var defaultMinResolution = defaultMaxResolution / Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);
        // user provided maxResolution takes precedence
        maxResolution = options.maxResolution;
        if (maxResolution !== undefined) {
            minZoom = 0;
        }
        else {
            maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);
        }
        // user provided minResolution takes precedence
        minResolution = options.minResolution;
        if (minResolution === undefined) {
            if (options.maxZoom !== undefined) {
                if (options.maxResolution !== undefined) {
                    minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);
                }
                else {
                    minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom);
                }
            }
            else {
                minResolution = defaultMinResolution;
            }
        }
        // given discrete zoom levels, minResolution may be different than provided
        maxZoom = minZoom + Math.floor(Math.log(maxResolution / minResolution) / Math.log(zoomFactor));
        minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);
        if (options.constrainResolution) {
            resolutionConstraint = Object(_resolutionconstraint_js__WEBPACK_IMPORTED_MODULE_4__["createSnapToPower"])(zoomFactor, maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent);
        }
        else {
            resolutionConstraint = Object(_resolutionconstraint_js__WEBPACK_IMPORTED_MODULE_4__["createMinMaxResolution"])(maxResolution, minResolution, smooth, !constrainOnlyCenter && extent, showFullExtent);
        }
    }
    return { constraint: resolutionConstraint, maxResolution: maxResolution,
        minResolution: minResolution, minZoom: minZoom, zoomFactor: zoomFactor };
}
/**
 * @param {ViewOptions} options View options.
 * @return {import("./rotationconstraint.js").Type} Rotation constraint.
 */
function createRotationConstraint(options) {
    var enableRotation = options.enableRotation !== undefined ?
        options.enableRotation : true;
    if (enableRotation) {
        var constrainRotation = options.constrainRotation;
        if (constrainRotation === undefined || constrainRotation === true) {
            return Object(_rotationconstraint_js__WEBPACK_IMPORTED_MODULE_5__["createSnapToZero"])();
        }
        else if (constrainRotation === false) {
            return _rotationconstraint_js__WEBPACK_IMPORTED_MODULE_5__["none"];
        }
        else if (typeof constrainRotation === 'number') {
            return Object(_rotationconstraint_js__WEBPACK_IMPORTED_MODULE_5__["createSnapToN"])(constrainRotation);
        }
        else {
            return _rotationconstraint_js__WEBPACK_IMPORTED_MODULE_5__["none"];
        }
    }
    else {
        return _rotationconstraint_js__WEBPACK_IMPORTED_MODULE_5__["disable"];
    }
}
/**
 * Determine if an animation involves no view change.
 * @param {Animation} animation The animation.
 * @return {boolean} The animation involves no view change.
 */
function isNoopAnimation(animation) {
    if (animation.sourceCenter && animation.targetCenter) {
        if (!Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_10__["equals"])(animation.sourceCenter, animation.targetCenter)) {
            return false;
        }
    }
    if (animation.sourceResolution !== animation.targetResolution) {
        return false;
    }
    if (animation.sourceRotation !== animation.targetRotation) {
        return false;
    }
    return true;
}
/* harmony default export */ __webpack_exports__["default"] = (View);
//# sourceMappingURL=View.js.map

/***/ }),

/***/ "./node_modules/ol/ViewHint.js":
/*!*************************************!*\
  !*** ./node_modules/ol/ViewHint.js ***!
  \*************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/ViewHint
 */
/**
 * @enum {number}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    ANIMATING: 0,
    INTERACTING: 1
});
//# sourceMappingURL=ViewHint.js.map

/***/ }),

/***/ "./node_modules/ol/ViewProperty.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/ViewProperty.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/ViewProperty
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    CENTER: 'center',
    RESOLUTION: 'resolution',
    ROTATION: 'rotation'
});
//# sourceMappingURL=ViewProperty.js.map

/***/ }),

/***/ "./node_modules/ol/array.js":
/*!**********************************!*\
  !*** ./node_modules/ol/array.js ***!
  \**********************************/
/*! exports provided: binarySearch, numberSafeCompareFunction, includes, linearFindNearest, reverseSubArray, extend, remove, find, equals, stableSort, findIndex, isSorted */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "binarySearch", function() { return binarySearch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numberSafeCompareFunction", function() { return numberSafeCompareFunction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return includes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearFindNearest", function() { return linearFindNearest; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reverseSubArray", function() { return reverseSubArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return extend; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "remove", function() { return remove; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return find; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stableSort", function() { return stableSort; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return findIndex; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSorted", function() { return isSorted; });
/**
 * @module ol/array
 */
/**
 * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.
 * https://github.com/darkskyapp/binary-search
 *
 * @param {Array<*>} haystack Items to search through.
 * @param {*} needle The item to look for.
 * @param {Function=} opt_comparator Comparator function.
 * @return {number} The index of the item if found, -1 if not.
 */
function binarySearch(haystack, needle, opt_comparator) {
    var mid, cmp;
    var comparator = opt_comparator || numberSafeCompareFunction;
    var low = 0;
    var high = haystack.length;
    var found = false;
    while (low < high) {
        /* Note that "(low + high) >>> 1" may overflow, and results in a typecast
         * to double (which gives the wrong results). */
        mid = low + (high - low >> 1);
        cmp = +comparator(haystack[mid], needle);
        if (cmp < 0.0) { /* Too low. */
            low = mid + 1;
        }
        else { /* Key found or too high */
            high = mid;
            found = !cmp;
        }
    }
    /* Key not found. */
    return found ? low : ~low;
}
/**
 * Compare function for array sort that is safe for numbers.
 * @param {*} a The first object to be compared.
 * @param {*} b The second object to be compared.
 * @return {number} A negative number, zero, or a positive number as the first
 *     argument is less than, equal to, or greater than the second.
 */
function numberSafeCompareFunction(a, b) {
    return a > b ? 1 : a < b ? -1 : 0;
}
/**
 * Whether the array contains the given object.
 * @param {Array<*>} arr The array to test for the presence of the element.
 * @param {*} obj The object for which to test.
 * @return {boolean} The object is in the array.
 */
function includes(arr, obj) {
    return arr.indexOf(obj) >= 0;
}
/**
 * @param {Array<number>} arr Array.
 * @param {number} target Target.
 * @param {number} direction 0 means return the nearest, > 0
 *    means return the largest nearest, < 0 means return the
 *    smallest nearest.
 * @return {number} Index.
 */
function linearFindNearest(arr, target, direction) {
    var n = arr.length;
    if (arr[0] <= target) {
        return 0;
    }
    else if (target <= arr[n - 1]) {
        return n - 1;
    }
    else {
        var i = void 0;
        if (direction > 0) {
            for (i = 1; i < n; ++i) {
                if (arr[i] < target) {
                    return i - 1;
                }
            }
        }
        else if (direction < 0) {
            for (i = 1; i < n; ++i) {
                if (arr[i] <= target) {
                    return i;
                }
            }
        }
        else {
            for (i = 1; i < n; ++i) {
                if (arr[i] == target) {
                    return i;
                }
                else if (arr[i] < target) {
                    if (arr[i - 1] - target < target - arr[i]) {
                        return i - 1;
                    }
                    else {
                        return i;
                    }
                }
            }
        }
        return n - 1;
    }
}
/**
 * @param {Array<*>} arr Array.
 * @param {number} begin Begin index.
 * @param {number} end End index.
 */
function reverseSubArray(arr, begin, end) {
    while (begin < end) {
        var tmp = arr[begin];
        arr[begin] = arr[end];
        arr[end] = tmp;
        ++begin;
        --end;
    }
}
/**
 * @param {Array<VALUE>} arr The array to modify.
 * @param {!Array<VALUE>|VALUE} data The elements or arrays of elements to add to arr.
 * @template VALUE
 */
function extend(arr, data) {
    var extension = Array.isArray(data) ? data : [data];
    var length = extension.length;
    for (var i = 0; i < length; i++) {
        arr[arr.length] = extension[i];
    }
}
/**
 * @param {Array<VALUE>} arr The array to modify.
 * @param {VALUE} obj The element to remove.
 * @template VALUE
 * @return {boolean} If the element was removed.
 */
function remove(arr, obj) {
    var i = arr.indexOf(obj);
    var found = i > -1;
    if (found) {
        arr.splice(i, 1);
    }
    return found;
}
/**
 * @param {Array<VALUE>} arr The array to search in.
 * @param {function(VALUE, number, ?) : boolean} func The function to compare.
 * @template VALUE
 * @return {VALUE|null} The element found or null.
 */
function find(arr, func) {
    var length = arr.length >>> 0;
    var value;
    for (var i = 0; i < length; i++) {
        value = arr[i];
        if (func(value, i, arr)) {
            return value;
        }
    }
    return null;
}
/**
 * @param {Array|Uint8ClampedArray} arr1 The first array to compare.
 * @param {Array|Uint8ClampedArray} arr2 The second array to compare.
 * @return {boolean} Whether the two arrays are equal.
 */
function equals(arr1, arr2) {
    var len1 = arr1.length;
    if (len1 !== arr2.length) {
        return false;
    }
    for (var i = 0; i < len1; i++) {
        if (arr1[i] !== arr2[i]) {
            return false;
        }
    }
    return true;
}
/**
 * Sort the passed array such that the relative order of equal elements is preverved.
 * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.
 * @param {Array<*>} arr The array to sort (modifies original).
 * @param {!function(*, *): number} compareFnc Comparison function.
 * @api
 */
function stableSort(arr, compareFnc) {
    var length = arr.length;
    var tmp = Array(arr.length);
    var i;
    for (i = 0; i < length; i++) {
        tmp[i] = { index: i, value: arr[i] };
    }
    tmp.sort(function (a, b) {
        return compareFnc(a.value, b.value) || a.index - b.index;
    });
    for (i = 0; i < arr.length; i++) {
        arr[i] = tmp[i].value;
    }
}
/**
 * @param {Array<*>} arr The array to search in.
 * @param {Function} func Comparison function.
 * @return {number} Return index.
 */
function findIndex(arr, func) {
    var index;
    var found = !arr.every(function (el, idx) {
        index = idx;
        return !func(el, idx, arr);
    });
    return found ? index : -1;
}
/**
 * @param {Array<*>} arr The array to test.
 * @param {Function=} opt_func Comparison function.
 * @param {boolean=} opt_strict Strictly sorted (default false).
 * @return {boolean} Return index.
 */
function isSorted(arr, opt_func, opt_strict) {
    var compare = opt_func || numberSafeCompareFunction;
    return arr.every(function (currentVal, index) {
        if (index === 0) {
            return true;
        }
        var res = compare(arr[index - 1], currentVal);
        return !(res > 0 || opt_strict && res === 0);
    });
}
//# sourceMappingURL=array.js.map

/***/ }),

/***/ "./node_modules/ol/asserts.js":
/*!************************************!*\
  !*** ./node_modules/ol/asserts.js ***!
  \************************************/
/*! exports provided: assert */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assert", function() { return assert; });
/* harmony import */ var _AssertionError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AssertionError.js */ "./node_modules/ol/AssertionError.js");
/**
 * @module ol/asserts
 */

/**
 * @param {*} assertion Assertion we expected to be truthy.
 * @param {number} errorCode Error code.
 */
function assert(assertion, errorCode) {
    if (!assertion) {
        throw new _AssertionError_js__WEBPACK_IMPORTED_MODULE_0__["default"](errorCode);
    }
}
//# sourceMappingURL=asserts.js.map

/***/ }),

/***/ "./node_modules/ol/centerconstraint.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/centerconstraint.js ***!
  \*********************************************/
/*! exports provided: createExtent, none */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createExtent", function() { return createExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "none", function() { return none; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/**
 * @module ol/centerconstraint
 */

/**
 * @typedef {function((import("./coordinate.js").Coordinate|undefined), number, import("./size.js").Size, boolean=): (import("./coordinate.js").Coordinate|undefined)} Type
 */
/**
 * @param {import("./extent.js").Extent} extent Extent.
 * @param {boolean} onlyCenter If true, the constraint will only apply to the view center.
 * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent
 * (only during interaction and animation).
 * @return {Type} The constraint.
 */
function createExtent(extent, onlyCenter, smooth) {
    return (
    /**
     * @param {import("./coordinate.js").Coordinate|undefined} center Center.
     * @param {number} resolution Resolution.
     * @param {import("./size.js").Size} size Viewport size; unused if `onlyCenter` was specified.
     * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.
     * @return {import("./coordinate.js").Coordinate|undefined} Center.
     */
    function (center, resolution, size, opt_isMoving) {
        if (center) {
            var viewWidth = onlyCenter ? 0 : size[0] * resolution;
            var viewHeight = onlyCenter ? 0 : size[1] * resolution;
            var minX = extent[0] + viewWidth / 2;
            var maxX = extent[2] - viewWidth / 2;
            var minY = extent[1] + viewHeight / 2;
            var maxY = extent[3] - viewHeight / 2;
            // note: when zooming out of bounds, min and max values for x and y may
            // end up inverted (min > max); this has to be accounted for
            if (minX > maxX) {
                minX = (maxX + minX) / 2;
                maxX = minX;
            }
            if (minY > maxY) {
                minY = (maxY + minY) / 2;
                maxY = minY;
            }
            var x = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["clamp"])(center[0], minX, maxX);
            var y = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["clamp"])(center[1], minY, maxY);
            var ratio = 30 * resolution;
            // during an interaction, allow some overscroll
            if (opt_isMoving && smooth) {
                x += -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +
                    ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);
                y += -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +
                    ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);
            }
            return [x, y];
        }
        else {
            return undefined;
        }
    });
}
/**
 * @param {import("./coordinate.js").Coordinate=} center Center.
 * @return {import("./coordinate.js").Coordinate|undefined} Center.
 */
function none(center) {
    return center;
}
//# sourceMappingURL=centerconstraint.js.map

/***/ }),

/***/ "./node_modules/ol/color.js":
/*!**********************************!*\
  !*** ./node_modules/ol/color.js ***!
  \**********************************/
/*! exports provided: asString, fromString, asArray, normalize, toString, isStringColor */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asString", function() { return asString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromString", function() { return fromString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asArray", function() { return asArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalize", function() { return normalize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toString", function() { return toString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isStringColor", function() { return isStringColor; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/**
 * @module ol/color
 */


/**
 * A color represented as a short array [red, green, blue, alpha].
 * red, green, and blue should be integers in the range 0..255 inclusive.
 * alpha should be a float in the range 0..1 inclusive. If no alpha value is
 * given then `1` will be used.
 * @typedef {Array<number>} Color
 * @api
 */
/**
 * This RegExp matches # followed by 3, 4, 6, or 8 hex digits.
 * @const
 * @type {RegExp}
 * @private
 */
var HEX_COLOR_RE_ = /^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i;
/**
 * Regular expression for matching potential named color style strings.
 * @const
 * @type {RegExp}
 * @private
 */
var NAMED_COLOR_RE_ = /^([a-z]*)$|^hsla?\(.*\)$/i;
/**
 * Return the color as an rgba string.
 * @param {Color|string} color Color.
 * @return {string} Rgba string.
 * @api
 */
function asString(color) {
    if (typeof color === 'string') {
        return color;
    }
    else {
        return toString(color);
    }
}
/**
 * Return named color as an rgba string.
 * @param {string} color Named color.
 * @return {string} Rgb string.
 */
function fromNamed(color) {
    var el = document.createElement('div');
    el.style.color = color;
    if (el.style.color !== '') {
        document.body.appendChild(el);
        var rgb = getComputedStyle(el).color;
        document.body.removeChild(el);
        return rgb;
    }
    else {
        return '';
    }
}
/**
 * @param {string} s String.
 * @return {Color} Color.
 */
var fromString = (function () {
    // We maintain a small cache of parsed strings.  To provide cheap LRU-like
    // semantics, whenever the cache grows too large we simply delete an
    // arbitrary 25% of the entries.
    /**
     * @const
     * @type {number}
     */
    var MAX_CACHE_SIZE = 1024;
    /**
     * @type {Object<string, Color>}
     */
    var cache = {};
    /**
     * @type {number}
     */
    var cacheSize = 0;
    return (
    /**
     * @param {string} s String.
     * @return {Color} Color.
     */
    function (s) {
        var color;
        if (cache.hasOwnProperty(s)) {
            color = cache[s];
        }
        else {
            if (cacheSize >= MAX_CACHE_SIZE) {
                var i = 0;
                for (var key in cache) {
                    if ((i++ & 3) === 0) {
                        delete cache[key];
                        --cacheSize;
                    }
                }
            }
            color = fromStringInternal_(s);
            cache[s] = color;
            ++cacheSize;
        }
        return color;
    });
})();
/**
 * Return the color as an array. This function maintains a cache of calculated
 * arrays which means the result should not be modified.
 * @param {Color|string} color Color.
 * @return {Color} Color.
 * @api
 */
function asArray(color) {
    if (Array.isArray(color)) {
        return color;
    }
    else {
        return fromString(color);
    }
}
/**
 * @param {string} s String.
 * @private
 * @return {Color} Color.
 */
function fromStringInternal_(s) {
    var r, g, b, a, color;
    if (NAMED_COLOR_RE_.exec(s)) {
        s = fromNamed(s);
    }
    if (HEX_COLOR_RE_.exec(s)) { // hex
        var n = s.length - 1; // number of hex digits
        var d = // number of digits per channel
         void 0; // number of digits per channel
        if (n <= 4) {
            d = 1;
        }
        else {
            d = 2;
        }
        var hasAlpha = n === 4 || n === 8;
        r = parseInt(s.substr(1 + 0 * d, d), 16);
        g = parseInt(s.substr(1 + 1 * d, d), 16);
        b = parseInt(s.substr(1 + 2 * d, d), 16);
        if (hasAlpha) {
            a = parseInt(s.substr(1 + 3 * d, d), 16);
        }
        else {
            a = 255;
        }
        if (d == 1) {
            r = (r << 4) + r;
            g = (g << 4) + g;
            b = (b << 4) + b;
            if (hasAlpha) {
                a = (a << 4) + a;
            }
        }
        color = [r, g, b, a / 255];
    }
    else if (s.indexOf('rgba(') == 0) { // rgba()
        color = s.slice(5, -1).split(',').map(Number);
        normalize(color);
    }
    else if (s.indexOf('rgb(') == 0) { // rgb()
        color = s.slice(4, -1).split(',').map(Number);
        color.push(1);
        normalize(color);
    }
    else {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(false, 14); // Invalid color
    }
    return color;
}
/**
 * TODO this function is only used in the test, we probably shouldn't export it
 * @param {Color} color Color.
 * @return {Color} Clamped color.
 */
function normalize(color) {
    color[0] = Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["clamp"])((color[0] + 0.5) | 0, 0, 255);
    color[1] = Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["clamp"])((color[1] + 0.5) | 0, 0, 255);
    color[2] = Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["clamp"])((color[2] + 0.5) | 0, 0, 255);
    color[3] = Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["clamp"])(color[3], 0, 1);
    return color;
}
/**
 * @param {Color} color Color.
 * @return {string} String.
 */
function toString(color) {
    var r = color[0];
    if (r != (r | 0)) {
        r = (r + 0.5) | 0;
    }
    var g = color[1];
    if (g != (g | 0)) {
        g = (g + 0.5) | 0;
    }
    var b = color[2];
    if (b != (b | 0)) {
        b = (b + 0.5) | 0;
    }
    var a = color[3] === undefined ? 1 : color[3];
    return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
}
/**
 * @param {string} s String.
 * @return {boolean} Whether the string is actually a valid color
 */
function isStringColor(s) {
    if (NAMED_COLOR_RE_.test(s)) {
        s = fromNamed(s);
    }
    return HEX_COLOR_RE_.test(s) || s.indexOf('rgba(') === 0 || s.indexOf('rgb(') === 0;
}
//# sourceMappingURL=color.js.map

/***/ }),

/***/ "./node_modules/ol/colorlike.js":
/*!**************************************!*\
  !*** ./node_modules/ol/colorlike.js ***!
  \**************************************/
/*! exports provided: asColorLike */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asColorLike", function() { return asColorLike; });
/* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./color.js */ "./node_modules/ol/color.js");
/**
 * @module ol/colorlike
 */

/**
 * A type accepted by CanvasRenderingContext2D.fillStyle
 * or CanvasRenderingContext2D.strokeStyle.
 * Represents a color, pattern, or gradient. The origin for patterns and
 * gradients as fill style is an increment of 512 css pixels from map coordinate
 * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image
 * must be a factor of two (2, 4, 8, ..., 512).
 *
 * @typedef {string|CanvasPattern|CanvasGradient} ColorLike
 * @api
 */
/**
 * @param {import("./color.js").Color|ColorLike} color Color.
 * @return {ColorLike} The color as an {@link ol/colorlike~ColorLike}.
 * @api
 */
function asColorLike(color) {
    if (Array.isArray(color)) {
        return Object(_color_js__WEBPACK_IMPORTED_MODULE_0__["toString"])(color);
    }
    else {
        return color;
    }
}
//# sourceMappingURL=colorlike.js.map

/***/ }),

/***/ "./node_modules/ol/control.js":
/*!************************************!*\
  !*** ./node_modules/ol/control.js ***!
  \************************************/
/*! exports provided: Attribution, Control, FullScreen, MousePosition, OverviewMap, Rotate, ScaleLine, Zoom, ZoomSlider, ZoomToExtent, defaults */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return defaults; });
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var _control_Attribution_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./control/Attribution.js */ "./node_modules/ol/control/Attribution.js");
/* harmony import */ var _control_Rotate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./control/Rotate.js */ "./node_modules/ol/control/Rotate.js");
/* harmony import */ var _control_Zoom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./control/Zoom.js */ "./node_modules/ol/control/Zoom.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Attribution", function() { return _control_Attribution_js__WEBPACK_IMPORTED_MODULE_1__["default"]; });

/* harmony import */ var _control_Control_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./control/Control.js */ "./node_modules/ol/control/Control.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Control", function() { return _control_Control_js__WEBPACK_IMPORTED_MODULE_4__["default"]; });

/* harmony import */ var _control_FullScreen_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./control/FullScreen.js */ "./node_modules/ol/control/FullScreen.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FullScreen", function() { return _control_FullScreen_js__WEBPACK_IMPORTED_MODULE_5__["default"]; });

/* harmony import */ var _control_MousePosition_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./control/MousePosition.js */ "./node_modules/ol/control/MousePosition.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MousePosition", function() { return _control_MousePosition_js__WEBPACK_IMPORTED_MODULE_6__["default"]; });

/* harmony import */ var _control_OverviewMap_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./control/OverviewMap.js */ "./node_modules/ol/control/OverviewMap.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OverviewMap", function() { return _control_OverviewMap_js__WEBPACK_IMPORTED_MODULE_7__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Rotate", function() { return _control_Rotate_js__WEBPACK_IMPORTED_MODULE_2__["default"]; });

/* harmony import */ var _control_ScaleLine_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./control/ScaleLine.js */ "./node_modules/ol/control/ScaleLine.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ScaleLine", function() { return _control_ScaleLine_js__WEBPACK_IMPORTED_MODULE_8__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Zoom", function() { return _control_Zoom_js__WEBPACK_IMPORTED_MODULE_3__["default"]; });

/* harmony import */ var _control_ZoomSlider_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./control/ZoomSlider.js */ "./node_modules/ol/control/ZoomSlider.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ZoomSlider", function() { return _control_ZoomSlider_js__WEBPACK_IMPORTED_MODULE_9__["default"]; });

/* harmony import */ var _control_ZoomToExtent_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./control/ZoomToExtent.js */ "./node_modules/ol/control/ZoomToExtent.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ZoomToExtent", function() { return _control_ZoomToExtent_js__WEBPACK_IMPORTED_MODULE_10__["default"]; });

/**
 * @module ol/control
 */














/**
 * @typedef {Object} DefaultsOptions
 * @property {boolean} [attribution=true] Include
 * {@link module:ol/control/Attribution~Attribution}.
 * @property {import("./control/Attribution.js").Options} [attributionOptions]
 * Options for {@link module:ol/control/Attribution~Attribution}.
 * @property {boolean} [rotate=true] Include
 * {@link module:ol/control/Rotate~Rotate}.
 * @property {import("./control/Rotate.js").Options} [rotateOptions] Options
 * for {@link module:ol/control/Rotate~Rotate}.
 * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.
 * @property {import("./control/Zoom.js").Options} [zoomOptions] Options for
 * {@link module:ol/control/Zoom~Zoom}.
 * @api
 */
/**
 * Set of controls included in maps by default. Unless configured otherwise,
 * this returns a collection containing an instance of each of the following
 * controls:
 * * {@link module:ol/control/Zoom~Zoom}
 * * {@link module:ol/control/Rotate~Rotate}
 * * {@link module:ol/control/Attribution~Attribution}
 *
 * @param {DefaultsOptions=} opt_options
 * Defaults options.
 * @return {Collection<import("./control/Control.js").default>}
 * Controls.
 * @api
 */
function defaults(opt_options) {
    var options = opt_options ? opt_options : {};
    var controls = new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
    var zoomControl = options.zoom !== undefined ? options.zoom : true;
    if (zoomControl) {
        controls.push(new _control_Zoom_js__WEBPACK_IMPORTED_MODULE_3__["default"](options.zoomOptions));
    }
    var rotateControl = options.rotate !== undefined ? options.rotate : true;
    if (rotateControl) {
        controls.push(new _control_Rotate_js__WEBPACK_IMPORTED_MODULE_2__["default"](options.rotateOptions));
    }
    var attributionControl = options.attribution !== undefined ?
        options.attribution : true;
    if (attributionControl) {
        controls.push(new _control_Attribution_js__WEBPACK_IMPORTED_MODULE_1__["default"](options.attributionOptions));
    }
    return controls;
}
//# sourceMappingURL=control.js.map

/***/ }),

/***/ "./node_modules/ol/control/Attribution.js":
/*!************************************************!*\
  !*** ./node_modules/ol/control/Attribution.js ***!
  \************************************************/
/*! exports provided: render, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _layer_Layer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../layer/Layer.js */ "./node_modules/ol/layer/Layer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/control/Attribution
 */






/**
 * @typedef {Object} Options
 * @property {string} [className='ol-attribution'] CSS class name.
 * @property {HTMLElement|string} [target] Specify a target if you
 * want the control to be rendered outside of the map's
 * viewport.
 * @property {boolean} [collapsible] Specify if attributions can
 * be collapsed. If not specified, sources control this behavior with their
 * `attributionsCollapsible` setting.
 * @property {boolean} [collapsed=true] Specify if attributions should
 * be collapsed at startup.
 * @property {string} [tipLabel='Attributions'] Text label to use for the button tip.
 * @property {string} [label='i'] Text label to use for the
 * collapsed attributions button.
 * Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {string|HTMLElement} [collapseLabel='»'] Text label to use
 * for the expanded attributions button.
 * Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {function(import("../MapEvent.js").default)} [render] Function called when
 * the control should be re-rendered. This is called in a `requestAnimationFrame`
 * callback.
 */
/**
 * @classdesc
 * Control to show all the attributions associated with the layer sources
 * in the map. This control is one of the default controls included in maps.
 * By default it will show in the bottom right portion of the map, but this can
 * be changed by using a css selector for `.ol-attribution`.
 *
 * @api
 */
var Attribution = /** @class */ (function (_super) {
    __extends(Attribution, _super);
    /**
     * @param {Options=} opt_options Attribution options.
     */
    function Attribution(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            element: document.createElement('div'),
            render: options.render || render,
            target: options.target
        }) || this;
        /**
         * @private
         * @type {HTMLElement}
         */
        _this.ulElement_ = document.createElement('ul');
        /**
         * @private
         * @type {boolean}
         */
        _this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true;
        /**
         * @private
         * @type {boolean}
         */
        _this.overrideCollapsible_ = options.collapsible !== undefined;
        /**
         * @private
         * @type {boolean}
         */
        _this.collapsible_ = options.collapsible !== undefined ?
            options.collapsible : true;
        if (!_this.collapsible_) {
            _this.collapsed_ = false;
        }
        var className = options.className !== undefined ? options.className : 'ol-attribution';
        var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Attributions';
        var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00BB';
        if (typeof collapseLabel === 'string') {
            /**
             * @private
             * @type {HTMLElement}
             */
            _this.collapseLabel_ = document.createElement('span');
            _this.collapseLabel_.textContent = collapseLabel;
        }
        else {
            _this.collapseLabel_ = collapseLabel;
        }
        var label = options.label !== undefined ? options.label : 'i';
        if (typeof label === 'string') {
            /**
             * @private
             * @type {HTMLElement}
             */
            _this.label_ = document.createElement('span');
            _this.label_.textContent = label;
        }
        else {
            _this.label_ = label;
        }
        var activeLabel = (_this.collapsible_ && !_this.collapsed_) ?
            _this.collapseLabel_ : _this.label_;
        var button = document.createElement('button');
        button.setAttribute('type', 'button');
        button.title = tipLabel;
        button.appendChild(activeLabel);
        button.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CLICK, _this.handleClick_.bind(_this), false);
        var cssClasses = className + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_UNSELECTABLE"] + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_CONTROL"] +
            (_this.collapsed_ && _this.collapsible_ ? ' ' + _css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_COLLAPSED"] : '') +
            (_this.collapsible_ ? '' : ' ol-uncollapsible');
        var element = _this.element;
        element.className = cssClasses;
        element.appendChild(_this.ulElement_);
        element.appendChild(button);
        /**
         * A list of currently rendered resolutions.
         * @type {Array<string>}
         * @private
         */
        _this.renderedAttributions_ = [];
        /**
         * @private
         * @type {boolean}
         */
        _this.renderedVisible_ = true;
        return _this;
    }
    /**
     * Collect a list of visible attributions and set the collapsible state.
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @return {Array<string>} Attributions.
     * @private
     */
    Attribution.prototype.collectSourceAttributions_ = function (frameState) {
        /**
         * Used to determine if an attribution already exists.
         * @type {!Object<string, boolean>}
         */
        var lookup = {};
        /**
         * A list of visible attributions.
         * @type {Array<string>}
         */
        var visibleAttributions = [];
        var layerStatesArray = frameState.layerStatesArray;
        for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
            var layerState = layerStatesArray[i];
            if (!Object(_layer_Layer_js__WEBPACK_IMPORTED_MODULE_5__["inView"])(layerState, frameState.viewState)) {
                continue;
            }
            var source = /** @type {import("../layer/Layer.js").default} */ (layerState.layer).getSource();
            if (!source) {
                continue;
            }
            var attributionGetter = source.getAttributions();
            if (!attributionGetter) {
                continue;
            }
            var attributions = attributionGetter(frameState);
            if (!attributions) {
                continue;
            }
            if (!this.overrideCollapsible_ && source.getAttributionsCollapsible() === false) {
                this.setCollapsible(false);
            }
            if (Array.isArray(attributions)) {
                for (var j = 0, jj = attributions.length; j < jj; ++j) {
                    if (!(attributions[j] in lookup)) {
                        visibleAttributions.push(attributions[j]);
                        lookup[attributions[j]] = true;
                    }
                }
            }
            else {
                if (!(attributions in lookup)) {
                    visibleAttributions.push(attributions);
                    lookup[attributions] = true;
                }
            }
        }
        return visibleAttributions;
    };
    /**
     * @private
     * @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
     */
    Attribution.prototype.updateElement_ = function (frameState) {
        if (!frameState) {
            if (this.renderedVisible_) {
                this.element.style.display = 'none';
                this.renderedVisible_ = false;
            }
            return;
        }
        var attributions = this.collectSourceAttributions_(frameState);
        var visible = attributions.length > 0;
        if (this.renderedVisible_ != visible) {
            this.element.style.display = visible ? '' : 'none';
            this.renderedVisible_ = visible;
        }
        if (Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["equals"])(attributions, this.renderedAttributions_)) {
            return;
        }
        Object(_dom_js__WEBPACK_IMPORTED_MODULE_3__["removeChildren"])(this.ulElement_);
        // append the attributions
        for (var i = 0, ii = attributions.length; i < ii; ++i) {
            var element = document.createElement('li');
            element.innerHTML = attributions[i];
            this.ulElement_.appendChild(element);
        }
        this.renderedAttributions_ = attributions;
    };
    /**
     * @param {MouseEvent} event The event to handle
     * @private
     */
    Attribution.prototype.handleClick_ = function (event) {
        event.preventDefault();
        this.handleToggle_();
    };
    /**
     * @private
     */
    Attribution.prototype.handleToggle_ = function () {
        this.element.classList.toggle(_css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_COLLAPSED"]);
        if (this.collapsed_) {
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_3__["replaceNode"])(this.collapseLabel_, this.label_);
        }
        else {
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_3__["replaceNode"])(this.label_, this.collapseLabel_);
        }
        this.collapsed_ = !this.collapsed_;
    };
    /**
     * Return `true` if the attribution is collapsible, `false` otherwise.
     * @return {boolean} True if the widget is collapsible.
     * @api
     */
    Attribution.prototype.getCollapsible = function () {
        return this.collapsible_;
    };
    /**
     * Set whether the attribution should be collapsible.
     * @param {boolean} collapsible True if the widget is collapsible.
     * @api
     */
    Attribution.prototype.setCollapsible = function (collapsible) {
        if (this.collapsible_ === collapsible) {
            return;
        }
        this.collapsible_ = collapsible;
        this.element.classList.toggle('ol-uncollapsible');
        if (!collapsible && this.collapsed_) {
            this.handleToggle_();
        }
    };
    /**
     * Collapse or expand the attribution according to the passed parameter. Will
     * not do anything if the attribution isn't collapsible or if the current
     * collapsed state is already the one requested.
     * @param {boolean} collapsed True if the widget is collapsed.
     * @api
     */
    Attribution.prototype.setCollapsed = function (collapsed) {
        if (!this.collapsible_ || this.collapsed_ === collapsed) {
            return;
        }
        this.handleToggle_();
    };
    /**
     * Return `true` when the attribution is currently collapsed or `false`
     * otherwise.
     * @return {boolean} True if the widget is collapsed.
     * @api
     */
    Attribution.prototype.getCollapsed = function () {
        return this.collapsed_;
    };
    return Attribution;
}(_Control_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * Update the attribution element.
 * @param {import("../MapEvent.js").default} mapEvent Map event.
 * @this {Attribution}
 */
function render(mapEvent) {
    this.updateElement_(mapEvent.frameState);
}
/* harmony default export */ __webpack_exports__["default"] = (Attribution);
//# sourceMappingURL=Attribution.js.map

/***/ }),

/***/ "./node_modules/ol/control/Control.js":
/*!********************************************!*\
  !*** ./node_modules/ol/control/Control.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _MapEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../MapEventType.js */ "./node_modules/ol/MapEventType.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/control/Control
 */





/**
 * @typedef {Object} Options
 * @property {HTMLElement} [element] The element is the control's
 * container element. This only needs to be specified if you're developing
 * a custom control.
 * @property {function(import("../MapEvent.js").default)} [render] Function called when
 * the control should be re-rendered. This is called in a `requestAnimationFrame`
 * callback.
 * @property {HTMLElement|string} [target] Specify a target if you want
 * the control to be rendered outside of the map's viewport.
 */
/**
 * @classdesc
 * A control is a visible widget with a DOM element in a fixed position on the
 * screen. They can involve user input (buttons), or be informational only;
 * the position is determined using CSS. By default these are placed in the
 * container with CSS class name `ol-overlaycontainer-stopevent`, but can use
 * any outside DOM element.
 *
 * This is the base class for controls. You can use it for simple custom
 * controls by creating the element with listeners, creating an instance:
 * ```js
 * var myControl = new Control({element: myElement});
 * ```
 * and then adding this to the map.
 *
 * The main advantage of having this as a control rather than a simple separate
 * DOM element is that preventing propagation is handled for you. Controls
 * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.
 *
 * You can also extend this base for your own control class. See
 * examples/custom-controls for an example of how to do this.
 *
 * @api
 */
var Control = /** @class */ (function (_super) {
    __extends(Control, _super);
    /**
     * @param {Options} options Control options.
     */
    function Control(options) {
        var _this = _super.call(this) || this;
        /**
         * @protected
         * @type {HTMLElement}
         */
        _this.element = options.element ? options.element : null;
        /**
         * @private
         * @type {HTMLElement}
         */
        _this.target_ = null;
        /**
         * @private
         * @type {import("../PluggableMap.js").default}
         */
        _this.map_ = null;
        /**
         * @protected
         * @type {!Array<import("../events.js").EventsKey>}
         */
        _this.listenerKeys = [];
        /**
         * @private
         * @type {function(import("../MapEvent.js").default): void}
         */
        _this.render_ = options.render ? options.render : _functions_js__WEBPACK_IMPORTED_MODULE_0__["VOID"];
        if (options.target) {
            _this.setTarget(options.target);
        }
        return _this;
    }
    /**
     * @inheritDoc
     */
    Control.prototype.disposeInternal = function () {
        Object(_dom_js__WEBPACK_IMPORTED_MODULE_3__["removeNode"])(this.element);
        _super.prototype.disposeInternal.call(this);
    };
    /**
     * Get the map associated with this control.
     * @return {import("../PluggableMap.js").default} Map.
     * @api
     */
    Control.prototype.getMap = function () {
        return this.map_;
    };
    /**
     * Remove the control from its current map and attach it to the new map.
     * Subclasses may set up event handlers to get notified about changes to
     * the map here.
     * @param {import("../PluggableMap.js").default} map Map.
     * @api
     */
    Control.prototype.setMap = function (map) {
        if (this.map_) {
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_3__["removeNode"])(this.element);
        }
        for (var i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["unlistenByKey"])(this.listenerKeys[i]);
        }
        this.listenerKeys.length = 0;
        this.map_ = map;
        if (this.map_) {
            var target = this.target_ ?
                this.target_ : map.getOverlayContainerStopEvent();
            target.appendChild(this.element);
            if (this.render !== _functions_js__WEBPACK_IMPORTED_MODULE_0__["VOID"]) {
                this.listenerKeys.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listen"])(map, _MapEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POSTRENDER, this.render, this));
            }
            map.render();
        }
    };
    /**
     * Update the projection. Rendering of the coordinates is done in
     * `handleMouseMove` and `handleMouseUp`.
     * @param {import("../MapEvent.js").default} mapEvent Map event.
     * @api
     */
    Control.prototype.render = function (mapEvent) {
        this.render_.call(this, mapEvent);
    };
    /**
     * This function is used to set a target element for the control. It has no
     * effect if it is called after the control has been added to the map (i.e.
     * after `setMap` is called on the control). If no `target` is set in the
     * options passed to the control constructor and if `setTarget` is not called
     * then the control is added to the map's overlay container.
     * @param {HTMLElement|string} target Target.
     * @api
     */
    Control.prototype.setTarget = function (target) {
        this.target_ = typeof target === 'string' ?
            document.getElementById(target) :
            target;
    };
    return Control;
}(_Object_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Control);
//# sourceMappingURL=Control.js.map

/***/ }),

/***/ "./node_modules/ol/control/FullScreen.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/control/FullScreen.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/control/FullScreen
 */





var events = ['fullscreenchange', 'webkitfullscreenchange', 'MSFullscreenChange'];
/**
 * @enum {string}
 */
var FullScreenEventType = {
    /**
     * Triggered after the map entered fullscreen.
     * @event FullScreenEventType#enterfullscreen
     * @api
     */
    ENTERFULLSCREEN: 'enterfullscreen',
    /**
     * Triggered after the map leave fullscreen.
     * @event FullScreenEventType#leavefullscreen
     * @api
     */
    LEAVEFULLSCREEN: 'leavefullscreen'
};
/**
 * @typedef {Object} Options
 * @property {string} [className='ol-full-screen'] CSS class name.
 * @property {string|Text} [label='\u2922'] Text label to use for the button.
 * Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {string|Text} [labelActive='\u00d7'] Text label to use for the
 * button when full-screen is active.
 * Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.
 * @property {boolean} [keys=false] Full keyboard access.
 * @property {HTMLElement|string} [target] Specify a target if you want the
 * control to be rendered outside of the map's viewport.
 * @property {HTMLElement|string} [source] The element to be displayed
 * fullscreen. When not provided, the element containing the map viewport will
 * be displayed fullscreen.
 */
/**
 * @classdesc
 * Provides a button that when clicked fills up the full screen with the map.
 * The full screen source element is by default the element containing the map viewport unless
 * overridden by providing the `source` option. In which case, the dom
 * element introduced using this parameter will be displayed in full screen.
 *
 * When in full screen mode, a close button is shown to exit full screen mode.
 * The [Fullscreen API](http://www.w3.org/TR/fullscreen/) is used to
 * toggle the map in full screen mode.
 *
 * @fires FullScreenEventType#enterfullscreen
 * @fires FullScreenEventType#leavefullscreen
 * @api
 */
var FullScreen = /** @class */ (function (_super) {
    __extends(FullScreen, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function FullScreen(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            element: document.createElement('div'),
            target: options.target
        }) || this;
        /**
         * @private
         * @type {string}
         */
        _this.cssClassName_ = options.className !== undefined ? options.className :
            'ol-full-screen';
        var label = options.label !== undefined ? options.label : '\u2922';
        /**
         * @private
         * @type {Text}
         */
        _this.labelNode_ = typeof label === 'string' ?
            document.createTextNode(label) : label;
        var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7';
        /**
         * @private
         * @type {Text}
         */
        _this.labelActiveNode_ = typeof labelActive === 'string' ?
            document.createTextNode(labelActive) : labelActive;
        /**
         * @private
         * @type {HTMLElement}
         */
        _this.button_ = document.createElement('button');
        var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
        _this.setClassName_(_this.button_, isFullScreen());
        _this.button_.setAttribute('type', 'button');
        _this.button_.title = tipLabel;
        _this.button_.appendChild(_this.labelNode_);
        _this.button_.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CLICK, _this.handleClick_.bind(_this), false);
        var cssClasses = _this.cssClassName_ + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_UNSELECTABLE"] +
            ' ' + _css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_CONTROL"] + ' ' +
            (!isFullScreenSupported() ? _css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_UNSUPPORTED"] : '');
        var element = _this.element;
        element.className = cssClasses;
        element.appendChild(_this.button_);
        /**
         * @private
         * @type {boolean}
         */
        _this.keys_ = options.keys !== undefined ? options.keys : false;
        /**
         * @private
         * @type {HTMLElement|string|undefined}
         */
        _this.source_ = options.source;
        return _this;
    }
    /**
     * @param {MouseEvent} event The event to handle
     * @private
     */
    FullScreen.prototype.handleClick_ = function (event) {
        event.preventDefault();
        this.handleFullScreen_();
    };
    /**
     * @private
     */
    FullScreen.prototype.handleFullScreen_ = function () {
        if (!isFullScreenSupported()) {
            return;
        }
        var map = this.getMap();
        if (!map) {
            return;
        }
        if (isFullScreen()) {
            exitFullScreen();
        }
        else {
            var element = void 0;
            if (this.source_) {
                element = typeof this.source_ === 'string' ?
                    document.getElementById(this.source_) :
                    this.source_;
            }
            else {
                element = map.getTargetElement();
            }
            if (this.keys_) {
                requestFullScreenWithKeys(element);
            }
            else {
                requestFullScreen(element);
            }
        }
    };
    /**
     * @private
     */
    FullScreen.prototype.handleFullScreenChange_ = function () {
        var map = this.getMap();
        if (isFullScreen()) {
            this.setClassName_(this.button_, true);
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["replaceNode"])(this.labelActiveNode_, this.labelNode_);
            this.dispatchEvent(FullScreenEventType.ENTERFULLSCREEN);
        }
        else {
            this.setClassName_(this.button_, false);
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["replaceNode"])(this.labelNode_, this.labelActiveNode_);
            this.dispatchEvent(FullScreenEventType.LEAVEFULLSCREEN);
        }
        if (map) {
            map.updateSize();
        }
    };
    /**
     * @param {HTMLElement} element Target element
     * @param {boolean} fullscreen True if fullscreen class name should be active
     * @private
     */
    FullScreen.prototype.setClassName_ = function (element, fullscreen) {
        var activeClassName = this.cssClassName_ + '-true';
        var inactiveClassName = this.cssClassName_ + '-false';
        var nextClassName = fullscreen ? activeClassName : inactiveClassName;
        element.classList.remove(activeClassName);
        element.classList.remove(inactiveClassName);
        element.classList.add(nextClassName);
    };
    /**
     * @inheritDoc
     * @api
     */
    FullScreen.prototype.setMap = function (map) {
        _super.prototype.setMap.call(this, map);
        if (map) {
            for (var i = 0, ii = events.length; i < ii; ++i) {
                this.listenerKeys.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(document, events[i], this.handleFullScreenChange_, this));
            }
        }
    };
    return FullScreen;
}(_Control_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * @return {boolean} Fullscreen is supported by the current platform.
 */
function isFullScreenSupported() {
    var body = document.body;
    return !!(body.webkitRequestFullscreen ||
        (body.msRequestFullscreen && document.msFullscreenEnabled) ||
        (body.requestFullscreen && document.fullscreenEnabled));
}
/**
 * @return {boolean} Element is currently in fullscreen.
 */
function isFullScreen() {
    return !!(document.webkitIsFullScreen || document.msFullscreenElement || document.fullscreenElement);
}
/**
 * Request to fullscreen an element.
 * @param {HTMLElement} element Element to request fullscreen
 */
function requestFullScreen(element) {
    if (element.requestFullscreen) {
        element.requestFullscreen();
    }
    else if (element.msRequestFullscreen) {
        element.msRequestFullscreen();
    }
    else if (element.webkitRequestFullscreen) {
        element.webkitRequestFullscreen();
    }
}
/**
 * Request to fullscreen an element with keyboard input.
 * @param {HTMLElement} element Element to request fullscreen
 */
function requestFullScreenWithKeys(element) {
    if (element.webkitRequestFullscreen) {
        element.webkitRequestFullscreen();
    }
    else {
        requestFullScreen(element);
    }
}
/**
 * Exit fullscreen.
 */
function exitFullScreen() {
    if (document.exitFullscreen) {
        document.exitFullscreen();
    }
    else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    }
    else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
    }
}
/* harmony default export */ __webpack_exports__["default"] = (FullScreen);
//# sourceMappingURL=FullScreen.js.map

/***/ }),

/***/ "./node_modules/ol/control/MousePosition.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/control/MousePosition.js ***!
  \**************************************************/
/*! exports provided: render, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony import */ var elm_pep__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! elm-pep */ "./node_modules/elm-pep/dist/elm-pep.js");
/* harmony import */ var elm_pep__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(elm_pep__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../pointer/EventType.js */ "./node_modules/ol/pointer/EventType.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/**
 * @module ol/control/MousePosition
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();






/**
 * @type {string}
 */
var PROJECTION = 'projection';
/**
 * @type {string}
 */
var COORDINATE_FORMAT = 'coordinateFormat';
/**
 * @typedef {Object} Options
 * @property {string} [className='ol-mouse-position'] CSS class name.
 * @property {import("../coordinate.js").CoordinateFormat} [coordinateFormat] Coordinate format.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {function(import("../MapEvent.js").default)} [render] Function called when the
 * control should be re-rendered. This is called in a `requestAnimationFrame`
 * callback.
 * @property {HTMLElement|string} [target] Specify a target if you want the
 * control to be rendered outside of the map's viewport.
 * @property {string} [undefinedHTML='&#160;'] Markup to show when coordinates are not
 * available (e.g. when the pointer leaves the map viewport).  By default, the last position
 * will be replaced with `'&#160;'` (`&nbsp;`) when the pointer leaves the viewport.  To
 * retain the last rendered position, set this option to something falsey (like an empty
 * string `''`).
 */
/**
 * @classdesc
 * A control to show the 2D coordinates of the mouse cursor. By default, these
 * are in the view projection, but can be in any supported projection.
 * By default the control is shown in the top right corner of the map, but this
 * can be changed by using the css selector `.ol-mouse-position`.
 *
 * On touch devices, which usually do not have a mouse cursor, the coordinates
 * of the currently touched position are shown.
 *
 * @api
 */
var MousePosition = /** @class */ (function (_super) {
    __extends(MousePosition, _super);
    /**
     * @param {Options=} opt_options Mouse position options.
     */
    function MousePosition(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var element = document.createElement('div');
        element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
        _this = _super.call(this, {
            element: element,
            render: options.render || render,
            target: options.target
        }) || this;
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_3__["getChangeEventType"])(PROJECTION), _this.handleProjectionChanged_);
        if (options.coordinateFormat) {
            _this.setCoordinateFormat(options.coordinateFormat);
        }
        if (options.projection) {
            _this.setProjection(options.projection);
        }
        /**
         * @private
         * @type {string}
         */
        _this.undefinedHTML_ = options.undefinedHTML !== undefined ? options.undefinedHTML : '&#160;';
        /**
         * @private
         * @type {boolean}
         */
        _this.renderOnMouseOut_ = !!_this.undefinedHTML_;
        /**
         * @private
         * @type {string}
         */
        _this.renderedHTML_ = element.innerHTML;
        /**
         * @private
         * @type {?import("../proj/Projection.js").default}
         */
        _this.mapProjection_ = null;
        /**
         * @private
         * @type {?import("../proj.js").TransformFunction}
         */
        _this.transform_ = null;
        return _this;
    }
    /**
     * @private
     */
    MousePosition.prototype.handleProjectionChanged_ = function () {
        this.transform_ = null;
    };
    /**
     * Return the coordinate format type used to render the current position or
     * undefined.
     * @return {import("../coordinate.js").CoordinateFormat|undefined} The format to render the current
     *     position in.
     * @observable
     * @api
     */
    MousePosition.prototype.getCoordinateFormat = function () {
        return (
        /** @type {import("../coordinate.js").CoordinateFormat|undefined} */ (this.get(COORDINATE_FORMAT)));
    };
    /**
     * Return the projection that is used to report the mouse position.
     * @return {import("../proj/Projection.js").default|undefined} The projection to report mouse
     *     position in.
     * @observable
     * @api
     */
    MousePosition.prototype.getProjection = function () {
        return (
        /** @type {import("../proj/Projection.js").default|undefined} */ (this.get(PROJECTION)));
    };
    /**
     * @param {Event} event Browser event.
     * @protected
     */
    MousePosition.prototype.handleMouseMove = function (event) {
        var map = this.getMap();
        this.updateHTML_(map.getEventPixel(event));
    };
    /**
     * @param {Event} event Browser event.
     * @protected
     */
    MousePosition.prototype.handleMouseOut = function (event) {
        this.updateHTML_(null);
    };
    /**
     * @inheritDoc
     * @api
     */
    MousePosition.prototype.setMap = function (map) {
        _super.prototype.setMap.call(this, map);
        if (map) {
            var viewport = map.getViewport();
            this.listenerKeys.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_1__["listen"])(viewport, _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERMOVE, this.handleMouseMove, this));
            if (this.renderOnMouseOut_) {
                this.listenerKeys.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_1__["listen"])(viewport, _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTEROUT, this.handleMouseOut, this));
            }
        }
    };
    /**
     * Set the coordinate format type used to render the current position.
     * @param {import("../coordinate.js").CoordinateFormat} format The format to render the current
     *     position in.
     * @observable
     * @api
     */
    MousePosition.prototype.setCoordinateFormat = function (format) {
        this.set(COORDINATE_FORMAT, format);
    };
    /**
     * Set the projection that is used to report the mouse position.
     * @param {import("../proj.js").ProjectionLike} projection The projection to report mouse
     *     position in.
     * @observable
     * @api
     */
    MousePosition.prototype.setProjection = function (projection) {
        this.set(PROJECTION, Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])(projection));
    };
    /**
     * @param {?import("../pixel.js").Pixel} pixel Pixel.
     * @private
     */
    MousePosition.prototype.updateHTML_ = function (pixel) {
        var html = this.undefinedHTML_;
        if (pixel && this.mapProjection_) {
            if (!this.transform_) {
                var projection = this.getProjection();
                if (projection) {
                    this.transform_ = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["getTransformFromProjections"])(this.mapProjection_, projection);
                }
                else {
                    this.transform_ = _proj_js__WEBPACK_IMPORTED_MODULE_5__["identityTransform"];
                }
            }
            var map = this.getMap();
            var coordinate = map.getCoordinateFromPixelInternal(pixel);
            if (coordinate) {
                var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["getUserProjection"])();
                if (userProjection) {
                    this.transform_ = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["getTransformFromProjections"])(this.mapProjection_, userProjection);
                }
                this.transform_(coordinate, coordinate);
                var coordinateFormat = this.getCoordinateFormat();
                if (coordinateFormat) {
                    html = coordinateFormat(coordinate);
                }
                else {
                    html = coordinate.toString();
                }
            }
        }
        if (!this.renderedHTML_ || html !== this.renderedHTML_) {
            this.element.innerHTML = html;
            this.renderedHTML_ = html;
        }
    };
    return MousePosition;
}(_Control_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/**
 * Update the projection. Rendering of the coordinates is done in
 * `handleMouseMove` and `handleMouseUp`.
 * @param {import("../MapEvent.js").default} mapEvent Map event.
 * @this {MousePosition}
 */
function render(mapEvent) {
    var frameState = mapEvent.frameState;
    if (!frameState) {
        this.mapProjection_ = null;
    }
    else {
        if (this.mapProjection_ != frameState.viewState.projection) {
            this.mapProjection_ = frameState.viewState.projection;
            this.transform_ = null;
        }
    }
}
/* harmony default export */ __webpack_exports__["default"] = (MousePosition);
//# sourceMappingURL=MousePosition.js.map

/***/ }),

/***/ "./node_modules/ol/control/OverviewMap.js":
/*!************************************************!*\
  !*** ./node_modules/ol/control/OverviewMap.js ***!
  \************************************************/
/*! exports provided: render, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony import */ var _PluggableMap_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../PluggableMap.js */ "./node_modules/ol/PluggableMap.js");
/* harmony import */ var _renderer_Composite_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderer/Composite.js */ "./node_modules/ol/renderer/Composite.js");
/* harmony import */ var _MapEventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../MapEventType.js */ "./node_modules/ol/MapEventType.js");
/* harmony import */ var _MapProperty_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../MapProperty.js */ "./node_modules/ol/MapProperty.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ObjectEventType.js */ "./node_modules/ol/ObjectEventType.js");
/* harmony import */ var _Overlay_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Overlay.js */ "./node_modules/ol/Overlay.js");
/* harmony import */ var _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../OverlayPositioning.js */ "./node_modules/ol/OverlayPositioning.js");
/* harmony import */ var _ViewProperty_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../ViewProperty.js */ "./node_modules/ol/ViewProperty.js");
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _View_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../View.js */ "./node_modules/ol/View.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/control/OverviewMap
 */

















/**
 * Maximum width and/or height extent ratio that determines when the overview
 * map should be zoomed out.
 * @type {number}
 */
var MAX_RATIO = 0.75;
/**
 * Minimum width and/or height extent ratio that determines when the overview
 * map should be zoomed in.
 * @type {number}
 */
var MIN_RATIO = 0.1;
var ControlledMap = /** @class */ (function (_super) {
    __extends(ControlledMap, _super);
    function ControlledMap() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ControlledMap.prototype.createRenderer = function () {
        return new _renderer_Composite_js__WEBPACK_IMPORTED_MODULE_1__["default"](this);
    };
    return ControlledMap;
}(_PluggableMap_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * @typedef {Object} Options
 * @property {string} [className='ol-overviewmap'] CSS class name.
 * @property {boolean} [collapsed=true] Whether the control should start collapsed or not (expanded).
 * @property {string|HTMLElement} [collapseLabel='«'] Text label to use for the
 * expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {boolean} [collapsible=true] Whether the control can be collapsed or not.
 * @property {string|HTMLElement} [label='»'] Text label to use for the collapsed
 * overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {Array<import("../layer/Layer.js").default>|import("../Collection.js").default<import("../layer/Layer.js").default>} [layers]
 * Layers for the overview map.
 * @property {function(import("../MapEvent.js").default)} [render] Function called when the control
 * should be re-rendered. This is called in a `requestAnimationFrame` callback.
 * @property {boolean} [rotateWithView=false] Whether the control view should rotate with the main map view.
 * @property {HTMLElement|string} [target] Specify a target if you want the control
 * to be rendered outside of the map's viewport.
 * @property {string} [tipLabel='Overview map'] Text label to use for the button tip.
 * @property {View} [view] Custom view for the overview map (should use same projection as main map). If not provided,
 * a default view with the same projection as the main map will be used.
 */
/**
 * Create a new control with a map acting as an overview map for another
 * defined map.
 *
 * @api
 */
var OverviewMap = /** @class */ (function (_super) {
    __extends(OverviewMap, _super);
    /**
     * @param {Options=} opt_options OverviewMap options.
     */
    function OverviewMap(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            element: document.createElement('div'),
            render: options.render || render,
            target: options.target
        }) || this;
        /**
         * @private
         */
        _this.boundHandleRotationChanged_ = _this.handleRotationChanged_.bind(_this);
        /**
         * @type {boolean}
         * @private
         */
        _this.collapsed_ = options.collapsed !== undefined ? options.collapsed : true;
        /**
         * @private
         * @type {boolean}
         */
        _this.collapsible_ = options.collapsible !== undefined ?
            options.collapsible : true;
        if (!_this.collapsible_) {
            _this.collapsed_ = false;
        }
        /**
         * @private
         * @type {boolean}
         */
        _this.rotateWithView_ = options.rotateWithView !== undefined ?
            options.rotateWithView : false;
        /**
         * @private
         * @type {import("../extent.js").Extent|undefined}
         */
        _this.viewExtent_ = undefined;
        var className = options.className !== undefined ? options.className : 'ol-overviewmap';
        var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Overview map';
        var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\u00AB';
        if (typeof collapseLabel === 'string') {
            /**
             * @private
             * @type {HTMLElement}
             */
            _this.collapseLabel_ = document.createElement('span');
            _this.collapseLabel_.textContent = collapseLabel;
        }
        else {
            _this.collapseLabel_ = collapseLabel;
        }
        var label = options.label !== undefined ? options.label : '\u00BB';
        if (typeof label === 'string') {
            /**
             * @private
             * @type {HTMLElement}
             */
            _this.label_ = document.createElement('span');
            _this.label_.textContent = label;
        }
        else {
            _this.label_ = label;
        }
        var activeLabel = (_this.collapsible_ && !_this.collapsed_) ?
            _this.collapseLabel_ : _this.label_;
        var button = document.createElement('button');
        button.setAttribute('type', 'button');
        button.title = tipLabel;
        button.appendChild(activeLabel);
        button.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].CLICK, _this.handleClick_.bind(_this), false);
        /**
         * @type {HTMLElement}
         * @private
         */
        _this.ovmapDiv_ = document.createElement('div');
        _this.ovmapDiv_.className = 'ol-overviewmap-map';
        /**
         * Explicitly given view to be used instead of a view derived from the main map.
         * @type {View}
         * @private
         */
        _this.view_ = options.view;
        /**
         * @type {ControlledMap}
         * @private
         */
        _this.ovmap_ = new ControlledMap({
            view: options.view
        });
        var ovmap = _this.ovmap_;
        if (options.layers) {
            options.layers.forEach(function (layer) {
                ovmap.addLayer(layer);
            });
        }
        var box = document.createElement('div');
        box.className = 'ol-overviewmap-box';
        box.style.boxSizing = 'border-box';
        /**
         * @type {import("../Overlay.js").default}
         * @private
         */
        _this.boxOverlay_ = new _Overlay_js__WEBPACK_IMPORTED_MODULE_6__["default"]({
            position: [0, 0],
            positioning: _OverlayPositioning_js__WEBPACK_IMPORTED_MODULE_7__["default"].CENTER_CENTER,
            element: box
        });
        _this.ovmap_.addOverlay(_this.boxOverlay_);
        var cssClasses = className + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_11__["CLASS_UNSELECTABLE"] + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_11__["CLASS_CONTROL"] +
            (_this.collapsed_ && _this.collapsible_ ? ' ' + _css_js__WEBPACK_IMPORTED_MODULE_11__["CLASS_COLLAPSED"] : '') +
            (_this.collapsible_ ? '' : ' ol-uncollapsible');
        var element = _this.element;
        element.className = cssClasses;
        element.appendChild(_this.ovmapDiv_);
        element.appendChild(button);
        /* Interactive map */
        var scope = _this;
        var overlay = _this.boxOverlay_;
        var overlayBox = _this.boxOverlay_.getElement();
        /* Functions definition */
        var computeDesiredMousePosition = function (mousePosition) {
            return {
                clientX: mousePosition.clientX,
                clientY: mousePosition.clientY
            };
        };
        var move = function (event) {
            var position = /** @type {?} */ (computeDesiredMousePosition(event));
            var coordinates = ovmap.getEventCoordinateInternal(/** @type {Event} */ (position));
            overlay.setPosition(coordinates);
        };
        var endMoving = function (event) {
            var coordinates = ovmap.getEventCoordinateInternal(event);
            scope.getMap().getView().setCenterInternal(coordinates);
            window.removeEventListener('mousemove', move);
            window.removeEventListener('mouseup', endMoving);
        };
        /* Binding */
        overlayBox.addEventListener('mousedown', function () {
            window.addEventListener('mousemove', move);
            window.addEventListener('mouseup', endMoving);
        });
        return _this;
    }
    /**
     * @inheritDoc
     * @api
     */
    OverviewMap.prototype.setMap = function (map) {
        var oldMap = this.getMap();
        if (map === oldMap) {
            return;
        }
        if (oldMap) {
            var oldView = oldMap.getView();
            if (oldView) {
                this.unbindView_(oldView);
            }
            this.ovmap_.setTarget(null);
        }
        _super.prototype.setMap.call(this, map);
        if (map) {
            this.ovmap_.setTarget(this.ovmapDiv_);
            this.listenerKeys.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_13__["listen"])(map, _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].PROPERTYCHANGE, this.handleMapPropertyChange_, this));
            var view = map.getView();
            if (view) {
                this.bindView_(view);
                if (view.isDef()) {
                    this.ovmap_.updateSize();
                    this.resetExtent_();
                }
            }
        }
    };
    /**
     * Handle map property changes.  This only deals with changes to the map's view.
     * @param {import("../Object.js").ObjectEvent} event The propertychange event.
     * @private
     */
    OverviewMap.prototype.handleMapPropertyChange_ = function (event) {
        if (event.key === _MapProperty_js__WEBPACK_IMPORTED_MODULE_3__["default"].VIEW) {
            var oldView = /** @type {import("../View.js").default} */ (event.oldValue);
            if (oldView) {
                this.unbindView_(oldView);
            }
            var newView = this.getMap().getView();
            this.bindView_(newView);
        }
    };
    /**
     * Register listeners for view property changes.
     * @param {import("../View.js").default} view The view.
     * @private
     */
    OverviewMap.prototype.bindView_ = function (view) {
        if (!this.view_) {
            // Unless an explicit view definition was given, derive default from whatever main map uses.
            var newView = new _View_js__WEBPACK_IMPORTED_MODULE_16__["default"]({
                projection: view.getProjection()
            });
            this.ovmap_.setView(newView);
        }
        view.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_4__["getChangeEventType"])(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_8__["default"].ROTATION), this.boundHandleRotationChanged_);
        // Sync once with the new view
        this.handleRotationChanged_();
    };
    /**
     * Unregister listeners for view property changes.
     * @param {import("../View.js").default} view The view.
     * @private
     */
    OverviewMap.prototype.unbindView_ = function (view) {
        view.removeEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_4__["getChangeEventType"])(_ViewProperty_js__WEBPACK_IMPORTED_MODULE_8__["default"].ROTATION), this.boundHandleRotationChanged_);
    };
    /**
     * Handle rotation changes to the main map.
     * @private
     */
    OverviewMap.prototype.handleRotationChanged_ = function () {
        if (this.rotateWithView_) {
            this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());
        }
    };
    /**
     * Reset the overview map extent if the box size (width or
     * height) is less than the size of the overview map size times minRatio
     * or is greater than the size of the overview size times maxRatio.
     *
     * If the map extent was not reset, the box size can fits in the defined
     * ratio sizes. This method then checks if is contained inside the overview
     * map current extent. If not, recenter the overview map to the current
     * main map center location.
     * @private
     */
    OverviewMap.prototype.validateExtent_ = function () {
        var map = this.getMap();
        var ovmap = this.ovmap_;
        if (!map.isRendered() || !ovmap.isRendered()) {
            return;
        }
        var mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
        var view = map.getView();
        var extent = view.calculateExtentInternal(mapSize);
        if (this.viewExtent_ && Object(_extent_js__WEBPACK_IMPORTED_MODULE_15__["equals"])(extent, this.viewExtent_)) {
            // repeats of the same extent may indicate constraint conflicts leading to an endless cycle
            return;
        }
        this.viewExtent_ = extent;
        var ovmapSize = /** @type {import("../size.js").Size} */ (ovmap.getSize());
        var ovview = ovmap.getView();
        var ovextent = ovview.calculateExtentInternal(ovmapSize);
        var topLeftPixel = ovmap.getPixelFromCoordinateInternal(Object(_extent_js__WEBPACK_IMPORTED_MODULE_15__["getTopLeft"])(extent));
        var bottomRightPixel = ovmap.getPixelFromCoordinateInternal(Object(_extent_js__WEBPACK_IMPORTED_MODULE_15__["getBottomRight"])(extent));
        var boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);
        var boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);
        var ovmapWidth = ovmapSize[0];
        var ovmapHeight = ovmapSize[1];
        if (boxWidth < ovmapWidth * MIN_RATIO ||
            boxHeight < ovmapHeight * MIN_RATIO ||
            boxWidth > ovmapWidth * MAX_RATIO ||
            boxHeight > ovmapHeight * MAX_RATIO) {
            this.resetExtent_();
        }
        else if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_15__["containsExtent"])(ovextent, extent)) {
            this.recenter_();
        }
    };
    /**
     * Reset the overview map extent to half calculated min and max ratio times
     * the extent of the main map.
     * @private
     */
    OverviewMap.prototype.resetExtent_ = function () {
        if (MAX_RATIO === 0 || MIN_RATIO === 0) {
            return;
        }
        var map = this.getMap();
        var ovmap = this.ovmap_;
        var mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
        var view = map.getView();
        var extent = view.calculateExtentInternal(mapSize);
        var ovview = ovmap.getView();
        // get how many times the current map overview could hold different
        // box sizes using the min and max ratio, pick the step in the middle used
        // to calculate the extent from the main map to set it to the overview map,
        var steps = Math.log(MAX_RATIO / MIN_RATIO) / Math.LN2;
        var ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO);
        Object(_extent_js__WEBPACK_IMPORTED_MODULE_15__["scaleFromCenter"])(extent, ratio);
        ovview.fitInternal(Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_10__["fromExtent"])(extent));
    };
    /**
     * Set the center of the overview map to the map center without changing its
     * resolution.
     * @private
     */
    OverviewMap.prototype.recenter_ = function () {
        var map = this.getMap();
        var ovmap = this.ovmap_;
        var view = map.getView();
        var ovview = ovmap.getView();
        ovview.setCenterInternal(view.getCenterInternal());
    };
    /**
     * Update the box using the main map extent
     * @private
     */
    OverviewMap.prototype.updateBox_ = function () {
        var map = this.getMap();
        var ovmap = this.ovmap_;
        if (!map.isRendered() || !ovmap.isRendered()) {
            return;
        }
        var mapSize = /** @type {import("../size.js").Size} */ (map.getSize());
        var view = map.getView();
        var ovview = ovmap.getView();
        var rotation = this.rotateWithView_ ? 0 : -view.getRotation();
        var overlay = this.boxOverlay_;
        var box = this.boxOverlay_.getElement();
        var center = view.getCenterInternal();
        var resolution = view.getResolution();
        var ovresolution = ovview.getResolution();
        var width = mapSize[0] * resolution / ovresolution;
        var height = mapSize[1] * resolution / ovresolution;
        // set position using center coordinates
        overlay.setPosition(center);
        // set box size calculated from map extent size and overview map resolution
        if (box) {
            box.style.width = width + 'px';
            box.style.height = height + 'px';
            var transform = 'rotate(' + rotation + 'rad)';
            box.style.transform = transform;
        }
    };
    /**
     * @param {MouseEvent} event The event to handle
     * @private
     */
    OverviewMap.prototype.handleClick_ = function (event) {
        event.preventDefault();
        this.handleToggle_();
    };
    /**
     * @private
     */
    OverviewMap.prototype.handleToggle_ = function () {
        this.element.classList.toggle(_css_js__WEBPACK_IMPORTED_MODULE_11__["CLASS_COLLAPSED"]);
        if (this.collapsed_) {
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_12__["replaceNode"])(this.collapseLabel_, this.label_);
        }
        else {
            Object(_dom_js__WEBPACK_IMPORTED_MODULE_12__["replaceNode"])(this.label_, this.collapseLabel_);
        }
        this.collapsed_ = !this.collapsed_;
        // manage overview map if it had not been rendered before and control
        // is expanded
        var ovmap = this.ovmap_;
        if (!this.collapsed_) {
            if (ovmap.isRendered()) {
                this.viewExtent_ = undefined;
                ovmap.render();
                return;
            }
            ovmap.updateSize();
            this.resetExtent_();
            Object(_events_js__WEBPACK_IMPORTED_MODULE_13__["listenOnce"])(ovmap, _MapEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POSTRENDER, function (event) {
                this.updateBox_();
            }, this);
        }
    };
    /**
     * Return `true` if the overview map is collapsible, `false` otherwise.
     * @return {boolean} True if the widget is collapsible.
     * @api
     */
    OverviewMap.prototype.getCollapsible = function () {
        return this.collapsible_;
    };
    /**
     * Set whether the overview map should be collapsible.
     * @param {boolean} collapsible True if the widget is collapsible.
     * @api
     */
    OverviewMap.prototype.setCollapsible = function (collapsible) {
        if (this.collapsible_ === collapsible) {
            return;
        }
        this.collapsible_ = collapsible;
        this.element.classList.toggle('ol-uncollapsible');
        if (!collapsible && this.collapsed_) {
            this.handleToggle_();
        }
    };
    /**
     * Collapse or expand the overview map according to the passed parameter. Will
     * not do anything if the overview map isn't collapsible or if the current
     * collapsed state is already the one requested.
     * @param {boolean} collapsed True if the widget is collapsed.
     * @api
     */
    OverviewMap.prototype.setCollapsed = function (collapsed) {
        if (!this.collapsible_ || this.collapsed_ === collapsed) {
            return;
        }
        this.handleToggle_();
    };
    /**
     * Determine if the overview map is collapsed.
     * @return {boolean} The overview map is collapsed.
     * @api
     */
    OverviewMap.prototype.getCollapsed = function () {
        return this.collapsed_;
    };
    /**
     * Return `true` if the overview map view can rotate, `false` otherwise.
     * @return {boolean} True if the control view can rotate.
     * @api
     */
    OverviewMap.prototype.getRotateWithView = function () {
        return this.rotateWithView_;
    };
    /**
     * Set whether the overview map view should rotate with the main map view.
     * @param {boolean} rotateWithView True if the control view should rotate.
     * @api
     */
    OverviewMap.prototype.setRotateWithView = function (rotateWithView) {
        if (this.rotateWithView_ === rotateWithView) {
            return;
        }
        this.rotateWithView_ = rotateWithView;
        if (this.getMap().getView().getRotation() !== 0) {
            if (this.rotateWithView_) {
                this.handleRotationChanged_();
            }
            else {
                this.ovmap_.getView().setRotation(0);
            }
            this.viewExtent_ = undefined;
            this.validateExtent_();
            this.updateBox_();
        }
    };
    /**
     * Return the overview map.
     * @return {import("../PluggableMap.js").default} Overview map.
     * @api
     */
    OverviewMap.prototype.getOverviewMap = function () {
        return this.ovmap_;
    };
    return OverviewMap;
}(_Control_js__WEBPACK_IMPORTED_MODULE_9__["default"]));
/**
 * Update the overview map element.
 * @param {import("../MapEvent.js").default} mapEvent Map event.
 * @this {OverviewMap}
 */
function render(mapEvent) {
    this.validateExtent_();
    this.updateBox_();
}
/* harmony default export */ __webpack_exports__["default"] = (OverviewMap);
//# sourceMappingURL=OverviewMap.js.map

/***/ }),

/***/ "./node_modules/ol/control/Rotate.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/control/Rotate.js ***!
  \*******************************************/
/*! exports provided: render, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _easing_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../easing.js */ "./node_modules/ol/easing.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/control/Rotate
 */




/**
 * @typedef {Object} Options
 * @property {string} [className='ol-rotate'] CSS class name.
 * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.
 * Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.
 * @property {number} [duration=250] Animation duration in milliseconds.
 * @property {boolean} [autoHide=true] Hide the control when rotation is 0.
 * @property {function(import("../MapEvent.js").default)} [render] Function called when the control should
 * be re-rendered. This is called in a `requestAnimationFrame` callback.
 * @property {function()} [resetNorth] Function called when the control is clicked.
 * This will override the default `resetNorth`.
 * @property {HTMLElement|string} [target] Specify a target if you want the control to be
 * rendered outside of the map's viewport.
 */
/**
 * @classdesc
 * A button control to reset rotation to 0.
 * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css
 * selector is added to the button when the rotation is 0.
 *
 * @api
 */
var Rotate = /** @class */ (function (_super) {
    __extends(Rotate, _super);
    /**
     * @param {Options=} opt_options Rotate options.
     */
    function Rotate(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            element: document.createElement('div'),
            render: options.render || render,
            target: options.target
        }) || this;
        var className = options.className !== undefined ? options.className : 'ol-rotate';
        var label = options.label !== undefined ? options.label : '\u21E7';
        /**
         * @type {HTMLElement}
         * @private
         */
        _this.label_ = null;
        if (typeof label === 'string') {
            _this.label_ = document.createElement('span');
            _this.label_.className = 'ol-compass';
            _this.label_.textContent = label;
        }
        else {
            _this.label_ = label;
            _this.label_.classList.add('ol-compass');
        }
        var tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';
        var button = document.createElement('button');
        button.className = className + '-reset';
        button.setAttribute('type', 'button');
        button.title = tipLabel;
        button.appendChild(_this.label_);
        button.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].CLICK, _this.handleClick_.bind(_this), false);
        var cssClasses = className + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_UNSELECTABLE"] + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_CONTROL"];
        var element = _this.element;
        element.className = cssClasses;
        element.appendChild(button);
        _this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
        /**
         * @type {number}
         * @private
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 250;
        /**
         * @type {boolean}
         * @private
         */
        _this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.rotation_ = undefined;
        if (_this.autoHide_) {
            _this.element.classList.add(_css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_HIDDEN"]);
        }
        return _this;
    }
    /**
     * @param {MouseEvent} event The event to handle
     * @private
     */
    Rotate.prototype.handleClick_ = function (event) {
        event.preventDefault();
        if (this.callResetNorth_ !== undefined) {
            this.callResetNorth_();
        }
        else {
            this.resetNorth_();
        }
    };
    /**
     * @private
     */
    Rotate.prototype.resetNorth_ = function () {
        var map = this.getMap();
        var view = map.getView();
        if (!view) {
            // the map does not have a view, so we can't act
            // upon it
            return;
        }
        var rotation = view.getRotation();
        if (rotation !== undefined) {
            if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) {
                view.animate({
                    rotation: 0,
                    duration: this.duration_,
                    easing: _easing_js__WEBPACK_IMPORTED_MODULE_2__["easeOut"]
                });
            }
            else {
                view.setRotation(0);
            }
        }
    };
    return Rotate;
}(_Control_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * Update the rotate control element.
 * @param {import("../MapEvent.js").default} mapEvent Map event.
 * @this {Rotate}
 */
function render(mapEvent) {
    var frameState = mapEvent.frameState;
    if (!frameState) {
        return;
    }
    var rotation = frameState.viewState.rotation;
    if (rotation != this.rotation_) {
        var transform = 'rotate(' + rotation + 'rad)';
        if (this.autoHide_) {
            var contains = this.element.classList.contains(_css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_HIDDEN"]);
            if (!contains && rotation === 0) {
                this.element.classList.add(_css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_HIDDEN"]);
            }
            else if (contains && rotation !== 0) {
                this.element.classList.remove(_css_js__WEBPACK_IMPORTED_MODULE_1__["CLASS_HIDDEN"]);
            }
        }
        this.label_.style.transform = transform;
    }
    this.rotation_ = rotation;
}
/* harmony default export */ __webpack_exports__["default"] = (Rotate);
//# sourceMappingURL=Rotate.js.map

/***/ }),

/***/ "./node_modules/ol/control/ScaleLine.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/control/ScaleLine.js ***!
  \**********************************************/
/*! exports provided: Units, render, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Units", function() { return Units; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _proj_Units_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../proj/Units.js */ "./node_modules/ol/proj/Units.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/control/ScaleLine
 */






/**
 * @type {string}
 */
var UNITS_PROP = 'units';
/**
 * Units for the scale line. Supported values are `'degrees'`, `'imperial'`,
 * `'nautical'`, `'metric'`, `'us'`.
 * @enum {string}
 */
var Units = {
    DEGREES: 'degrees',
    IMPERIAL: 'imperial',
    NAUTICAL: 'nautical',
    METRIC: 'metric',
    US: 'us'
};
/**
 * @const
 * @type {Array<number>}
 */
var LEADING_DIGITS = [1, 2, 5];
/**
 * @typedef {Object} Options
 * @property {string} [className='ol-scale-line'] CSS Class name.
 * @property {number} [minWidth=64] Minimum width in pixels.
 * @property {function(import("../MapEvent.js").default)} [render] Function called when the control
 * should be re-rendered. This is called in a `requestAnimationFrame` callback.
 * @property {HTMLElement|string} [target] Specify a target if you want the control
 * to be rendered outside of the map's viewport.
 * @property {Units|string} [units='metric'] Units.
 * @property {boolean} [bar=false] Render scalebars instead of a line.
 * @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers
 * for best results. Only applies when `bar` is `true`.
 * @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies
 * when `bar` is `true`.
 */
/**
 * @classdesc
 * A control displaying rough y-axis distances, calculated for the center of the
 * viewport. For conformal projections (e.g. EPSG:3857, the default view
 * projection in OpenLayers), the scale is valid for all directions.
 * No scale line will be shown when the y-axis distance of a pixel at the
 * viewport center cannot be calculated in the view projection.
 * By default the scale line will show in the bottom left portion of the map,
 * but this can be changed by using the css selector `.ol-scale-line`.
 * When specifying `bar` as `true`, a scalebar will be rendered instead
 * of a scaleline.
 *
 * @api
 */
var ScaleLine = /** @class */ (function (_super) {
    __extends(ScaleLine, _super);
    /**
     * @param {Options=} opt_options Scale line options.
     */
    function ScaleLine(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var className = options.className !== undefined ? options.className :
            options.bar ? 'ol-scale-bar' : 'ol-scale-line';
        _this = _super.call(this, {
            element: document.createElement('div'),
            render: options.render || render,
            target: options.target
        }) || this;
        /**
         * @private
         * @type {HTMLElement}
         */
        _this.innerElement_ = document.createElement('div');
        _this.innerElement_.className = className + '-inner';
        _this.element.className = className + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_3__["CLASS_UNSELECTABLE"];
        _this.element.appendChild(_this.innerElement_);
        /**
         * @private
         * @type {?import("../View.js").State}
         */
        _this.viewState_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;
        /**
         * @private
         * @type {boolean}
         */
        _this.renderedVisible_ = false;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.renderedWidth_ = undefined;
        /**
         * @private
         * @type {string}
         */
        _this.renderedHTML_ = '';
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_0__["getChangeEventType"])(UNITS_PROP), _this.handleUnitsChanged_);
        _this.setUnits(options.units || Units.METRIC);
        /**
         * @private
         * @type {boolean}
         */
        _this.scaleBar_ = options.bar || false;
        /**
         * @private
         * @type {number}
         */
        _this.scaleBarSteps_ = options.steps || 4;
        /**
         * @private
         * @type {boolean}
         */
        _this.scaleBarText_ = options.text || false;
        return _this;
    }
    /**
     * Return the units to use in the scale line.
     * @return {Units} The units
     * to use in the scale line.
     * @observable
     * @api
     */
    ScaleLine.prototype.getUnits = function () {
        return this.get(UNITS_PROP);
    };
    /**
     * @private
     */
    ScaleLine.prototype.handleUnitsChanged_ = function () {
        this.updateElement_();
    };
    /**
     * Set the units to use in the scale line.
     * @param {Units} units The units to use in the scale line.
     * @observable
     * @api
     */
    ScaleLine.prototype.setUnits = function (units) {
        this.set(UNITS_PROP, units);
    };
    /**
     * @private
     */
    ScaleLine.prototype.updateElement_ = function () {
        var viewState = this.viewState_;
        if (!viewState) {
            if (this.renderedVisible_) {
                this.element.style.display = 'none';
                this.renderedVisible_ = false;
            }
            return;
        }
        var center = viewState.center;
        var projection = viewState.projection;
        var units = this.getUnits();
        var pointResolutionUnits = units == Units.DEGREES ?
            _proj_Units_js__WEBPACK_IMPORTED_MODULE_5__["default"].DEGREES :
            _proj_Units_js__WEBPACK_IMPORTED_MODULE_5__["default"].METERS;
        var pointResolution = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["getPointResolution"])(projection, viewState.resolution, center, pointResolutionUnits);
        var nominalCount = this.minWidth_ * pointResolution;
        var suffix = '';
        if (units == Units.DEGREES) {
            var metersPerDegree = _proj_js__WEBPACK_IMPORTED_MODULE_4__["METERS_PER_UNIT"][_proj_Units_js__WEBPACK_IMPORTED_MODULE_5__["default"].DEGREES];
            nominalCount *= metersPerDegree;
            if (nominalCount < metersPerDegree / 60) {
                suffix = '\u2033'; // seconds
                pointResolution *= 3600;
            }
            else if (nominalCount < metersPerDegree) {
                suffix = '\u2032'; // minutes
                pointResolution *= 60;
            }
            else {
                suffix = '\u00b0'; // degrees
            }
        }
        else if (units == Units.IMPERIAL) {
            if (nominalCount < 0.9144) {
                suffix = 'in';
                pointResolution /= 0.0254;
            }
            else if (nominalCount < 1609.344) {
                suffix = 'ft';
                pointResolution /= 0.3048;
            }
            else {
                suffix = 'mi';
                pointResolution /= 1609.344;
            }
        }
        else if (units == Units.NAUTICAL) {
            pointResolution /= 1852;
            suffix = 'nm';
        }
        else if (units == Units.METRIC) {
            if (nominalCount < 0.001) {
                suffix = 'μm';
                pointResolution *= 1000000;
            }
            else if (nominalCount < 1) {
                suffix = 'mm';
                pointResolution *= 1000;
            }
            else if (nominalCount < 1000) {
                suffix = 'm';
            }
            else {
                suffix = 'km';
                pointResolution /= 1000;
            }
        }
        else if (units == Units.US) {
            if (nominalCount < 0.9144) {
                suffix = 'in';
                pointResolution *= 39.37;
            }
            else if (nominalCount < 1609.344) {
                suffix = 'ft';
                pointResolution /= 0.30480061;
            }
            else {
                suffix = 'mi';
                pointResolution /= 1609.3472;
            }
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(false, 33); // Invalid units
        }
        var i = 3 * Math.floor(Math.log(this.minWidth_ * pointResolution) / Math.log(10));
        var count, width, decimalCount;
        while (true) {
            decimalCount = Math.floor(i / 3);
            var decimal = Math.pow(10, decimalCount);
            count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;
            width = Math.round(count / pointResolution);
            if (isNaN(width)) {
                this.element.style.display = 'none';
                this.renderedVisible_ = false;
                return;
            }
            else if (width >= this.minWidth_) {
                break;
            }
            ++i;
        }
        var html;
        if (this.scaleBar_) {
            html = this.createScaleBar(width, count, suffix);
        }
        else {
            html = count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;
        }
        if (this.renderedHTML_ != html) {
            this.innerElement_.innerHTML = html;
            this.renderedHTML_ = html;
        }
        if (this.renderedWidth_ != width) {
            this.innerElement_.style.width = width + 'px';
            this.renderedWidth_ = width;
        }
        if (!this.renderedVisible_) {
            this.element.style.display = '';
            this.renderedVisible_ = true;
        }
    };
    /**
     * @private
     * @param {number} width The current width of the scalebar.
     * @param {number} scale The current scale.
     * @param {string} suffix The suffix to append to the scale text.
     * @returns {string} The stringified HTML of the scalebar.
     */
    ScaleLine.prototype.createScaleBar = function (width, scale, suffix) {
        var mapScale = '1 : ' + Math.round(this.getScaleForResolution()).toLocaleString();
        var scaleSteps = [];
        var stepWidth = width / this.scaleBarSteps_;
        var backgroundColor = '#ffffff';
        for (var i = 0; i < this.scaleBarSteps_; i++) {
            if (i === 0) {
                // create the first marker at position 0
                scaleSteps.push(this.createMarker('absolute', i));
            }
            scaleSteps.push('<div>' +
                '<div ' +
                'class="ol-scale-singlebar" ' +
                'style=' +
                '"width: ' + stepWidth + 'px;' +
                'background-color: ' + backgroundColor + ';"' +
                '>' +
                '</div>' +
                this.createMarker('relative', i) +
                /*render text every second step, except when only 2 steps */
                (i % 2 === 0 || this.scaleBarSteps_ === 2 ?
                    this.createStepText(i, width, false, scale, suffix) :
                    '') +
                '</div>');
            if (i === this.scaleBarSteps_ - 1) {
                { /*render text at the end */ }
                scaleSteps.push(this.createStepText(i + 1, width, true, scale, suffix));
            }
            // switch colors of steps between black and white
            if (backgroundColor === '#ffffff') {
                backgroundColor = '#000000';
            }
            else {
                backgroundColor = '#ffffff';
            }
        }
        var scaleBarText;
        if (this.scaleBarText_) {
            scaleBarText = '<div ' +
                'class="ol-scale-text" ' +
                'style="width: ' + width + 'px;">' +
                mapScale +
                '</div>';
        }
        else {
            scaleBarText = '';
        }
        var container = '<div ' +
            'style="display: flex;">' +
            scaleBarText +
            scaleSteps.join('') +
            '</div>';
        return container;
    };
    /**
     * Creates a marker at given position
     * @param {string} position - The position, absolute or relative
     * @param {number} i - The iterator
     * @returns {string} The stringified div containing the marker
     */
    ScaleLine.prototype.createMarker = function (position, i) {
        var top = position === 'absolute' ? 3 : -10;
        return '<div ' +
            'class="ol-scale-step-marker" ' +
            'style="position: ' + position + ';' +
            'top: ' + top + 'px;"' +
            '></div>';
    };
    /**
     * Creates the label for a marker marker at given position
     * @param {number} i - The iterator
     * @param {number} width - The width the scalebar will currently use
     * @param {boolean} isLast - Flag indicating if we add the last step text
     * @param {number} scale - The current scale for the whole scalebar
     * @param {string} suffix - The suffix for the scale
     * @returns {string} The stringified div containing the step text
     */
    ScaleLine.prototype.createStepText = function (i, width, isLast, scale, suffix) {
        var length = i === 0 ? 0 : Math.round((scale / this.scaleBarSteps_ * i) * 100) / 100;
        var lengthString = length + (i === 0 ? '' : ' ' + suffix);
        var margin = i === 0 ? -3 : width / this.scaleBarSteps_ * -1;
        var minWidth = i === 0 ? 0 : width / this.scaleBarSteps_ * 2;
        return '<div ' +
            'class="ol-scale-step-text" ' +
            'style="' +
            'margin-left: ' + margin + 'px;' +
            'text-align: ' + (i === 0 ? 'left' : 'center') + '; ' +
            'min-width: ' + minWidth + 'px;' +
            'left: ' + (isLast ? width + 'px' : 'unset') + ';"' +
            '>' +
            lengthString +
            '</div>';
    };
    /**
     * Returns the appropriate scale for the given resolution and units.
     * @return {number} The appropriate scale.
     */
    ScaleLine.prototype.getScaleForResolution = function () {
        var resolution = this.getMap().getView().getResolution();
        var dpi = 25.4 / 0.28;
        var mpu = this.viewState_.projection.getMetersPerUnit();
        var inchesPerMeter = 39.37;
        return parseFloat(resolution.toString()) * mpu * inchesPerMeter * dpi;
    };
    return ScaleLine;
}(_Control_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * Update the scale line element.
 * @param {import("../MapEvent.js").default} mapEvent Map event.
 * @this {ScaleLine}
 */
function render(mapEvent) {
    var frameState = mapEvent.frameState;
    if (!frameState) {
        this.viewState_ = null;
    }
    else {
        this.viewState_ = frameState.viewState;
    }
    this.updateElement_();
}
/* harmony default export */ __webpack_exports__["default"] = (ScaleLine);
//# sourceMappingURL=ScaleLine.js.map

/***/ }),

/***/ "./node_modules/ol/control/Zoom.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/control/Zoom.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _easing_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../easing.js */ "./node_modules/ol/easing.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/control/Zoom
 */




/**
 * @typedef {Object} Options
 * @property {number} [duration=250] Animation duration in milliseconds.
 * @property {string} [className='ol-zoom'] CSS class name.
 * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in
 * button. Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {string|HTMLElement} [zoomOutLabel='-'] Text label to use for the zoom-out button.
 * Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.
 * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.
 * @property {number} [delta=1] The zoom delta applied on each click.
 * @property {HTMLElement|string} [target] Specify a target if you want the control to be
 * rendered outside of the map's viewport.
 */
/**
 * @classdesc
 * A control with 2 buttons, one for zoom in and one for zoom out.
 * This control is one of the default controls of a map. To style this control
 * use css selectors `.ol-zoom-in` and `.ol-zoom-out`.
 *
 * @api
 */
var Zoom = /** @class */ (function (_super) {
    __extends(Zoom, _super);
    /**
     * @param {Options=} opt_options Zoom options.
     */
    function Zoom(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            element: document.createElement('div'),
            target: options.target
        }) || this;
        var className = options.className !== undefined ? options.className : 'ol-zoom';
        var delta = options.delta !== undefined ? options.delta : 1;
        var zoomInLabel = options.zoomInLabel !== undefined ? options.zoomInLabel : '+';
        var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2212';
        var zoomInTipLabel = options.zoomInTipLabel !== undefined ?
            options.zoomInTipLabel : 'Zoom in';
        var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ?
            options.zoomOutTipLabel : 'Zoom out';
        var inElement = document.createElement('button');
        inElement.className = className + '-in';
        inElement.setAttribute('type', 'button');
        inElement.title = zoomInTipLabel;
        inElement.appendChild(typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel);
        inElement.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].CLICK, _this.handleClick_.bind(_this, delta), false);
        var outElement = document.createElement('button');
        outElement.className = className + '-out';
        outElement.setAttribute('type', 'button');
        outElement.title = zoomOutTipLabel;
        outElement.appendChild(typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel);
        outElement.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].CLICK, _this.handleClick_.bind(_this, -delta), false);
        var cssClasses = className + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_UNSELECTABLE"] + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_CONTROL"];
        var element = _this.element;
        element.className = cssClasses;
        element.appendChild(inElement);
        element.appendChild(outElement);
        /**
         * @type {number}
         * @private
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 250;
        return _this;
    }
    /**
     * @param {number} delta Zoom delta.
     * @param {MouseEvent} event The event to handle
     * @private
     */
    Zoom.prototype.handleClick_ = function (delta, event) {
        event.preventDefault();
        this.zoomByDelta_(delta);
    };
    /**
     * @param {number} delta Zoom delta.
     * @private
     */
    Zoom.prototype.zoomByDelta_ = function (delta) {
        var map = this.getMap();
        var view = map.getView();
        if (!view) {
            // the map does not have a view, so we can't act
            // upon it
            return;
        }
        var currentZoom = view.getZoom();
        if (currentZoom !== undefined) {
            var newZoom = view.getConstrainedZoom(currentZoom + delta);
            if (this.duration_ > 0) {
                if (view.getAnimating()) {
                    view.cancelAnimations();
                }
                view.animate({
                    zoom: newZoom,
                    duration: this.duration_,
                    easing: _easing_js__WEBPACK_IMPORTED_MODULE_3__["easeOut"]
                });
            }
            else {
                view.setZoom(newZoom);
            }
        }
    };
    return Zoom;
}(_Control_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Zoom);
//# sourceMappingURL=Zoom.js.map

/***/ }),

/***/ "./node_modules/ol/control/ZoomSlider.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/control/ZoomSlider.js ***!
  \***********************************************/
/*! exports provided: render, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony import */ var elm_pep__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! elm-pep */ "./node_modules/elm-pep/dist/elm-pep.js");
/* harmony import */ var elm_pep__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(elm_pep__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _easing_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../easing.js */ "./node_modules/ol/easing.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../pointer/EventType.js */ "./node_modules/ol/pointer/EventType.js");
/**
 * @module ol/control/ZoomSlider
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();









/**
 * The enum for available directions.
 *
 * @enum {number}
 */
var Direction = {
    VERTICAL: 0,
    HORIZONTAL: 1
};
/**
 * @typedef {Object} Options
 * @property {string} [className='ol-zoomslider'] CSS class name.
 * @property {number} [duration=200] Animation duration in milliseconds.
 * @property {function(import("../MapEvent.js").default)} [render] Function called when the control
 * should be re-rendered. This is called in a `requestAnimationFrame` callback.
 */
/**
 * @classdesc
 * A slider type of control for zooming.
 *
 * Example:
 *
 *     map.addControl(new ZoomSlider());
 *
 * @api
 */
var ZoomSlider = /** @class */ (function (_super) {
    __extends(ZoomSlider, _super);
    /**
     * @param {Options=} opt_options Zoom slider options.
     */
    function ZoomSlider(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            element: document.createElement('div'),
            render: options.render || render
        }) || this;
        /**
          * @type {!Array.<import("../events.js").EventsKey>}
          * @private
          */
        _this.dragListenerKeys_ = [];
        /**
         * Will hold the current resolution of the view.
         *
         * @type {number|undefined}
         * @private
         */
        _this.currentResolution_ = undefined;
        /**
         * The direction of the slider. Will be determined from actual display of the
         * container and defaults to Direction.VERTICAL.
         *
         * @type {Direction}
         * @private
         */
        _this.direction_ = Direction.VERTICAL;
        /**
         * @type {boolean}
         * @private
         */
        _this.dragging_;
        /**
         * @type {number}
         * @private
         */
        _this.heightLimit_ = 0;
        /**
         * @type {number}
         * @private
         */
        _this.widthLimit_ = 0;
        /**
         * @type {number|undefined}
         * @private
         */
        _this.startX_;
        /**
         * @type {number|undefined}
         * @private
         */
        _this.startY_;
        /**
         * The calculated thumb size (border box plus margins).  Set when initSlider_
         * is called.
         * @type {import("../size.js").Size}
         * @private
         */
        _this.thumbSize_ = null;
        /**
         * Whether the slider is initialized.
         * @type {boolean}
         * @private
         */
        _this.sliderInitialized_ = false;
        /**
         * @type {number}
         * @private
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 200;
        var className = options.className !== undefined ? options.className : 'ol-zoomslider';
        var thumbElement = document.createElement('button');
        thumbElement.setAttribute('type', 'button');
        thumbElement.className = className + '-thumb ' + _css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_UNSELECTABLE"];
        var containerElement = _this.element;
        containerElement.className = className + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_UNSELECTABLE"] + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_2__["CLASS_CONTROL"];
        containerElement.appendChild(thumbElement);
        containerElement.addEventListener(_pointer_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].POINTERDOWN, _this.handleDraggerStart_.bind(_this), false);
        containerElement.addEventListener(_pointer_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].POINTERMOVE, _this.handleDraggerDrag_.bind(_this), false);
        containerElement.addEventListener(_pointer_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].POINTERUP, _this.handleDraggerEnd_.bind(_this), false);
        containerElement.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].CLICK, _this.handleContainerClick_.bind(_this), false);
        thumbElement.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].CLICK, _events_Event_js__WEBPACK_IMPORTED_MODULE_5__["stopPropagation"], false);
        return _this;
    }
    /**
     * @inheritDoc
     */
    ZoomSlider.prototype.setMap = function (map) {
        _super.prototype.setMap.call(this, map);
        if (map) {
            map.render();
        }
    };
    /**
     * Initializes the slider element. This will determine and set this controls
     * direction_ and also constrain the dragging of the thumb to always be within
     * the bounds of the container.
     *
     * @private
     */
    ZoomSlider.prototype.initSlider_ = function () {
        var container = this.element;
        var containerSize = {
            width: container.offsetWidth, height: container.offsetHeight
        };
        var thumb = /** @type {HTMLElement} */ (container.firstElementChild);
        var computedStyle = getComputedStyle(thumb);
        var thumbWidth = thumb.offsetWidth +
            parseFloat(computedStyle['marginRight']) +
            parseFloat(computedStyle['marginLeft']);
        var thumbHeight = thumb.offsetHeight +
            parseFloat(computedStyle['marginTop']) +
            parseFloat(computedStyle['marginBottom']);
        this.thumbSize_ = [thumbWidth, thumbHeight];
        if (containerSize.width > containerSize.height) {
            this.direction_ = Direction.HORIZONTAL;
            this.widthLimit_ = containerSize.width - thumbWidth;
        }
        else {
            this.direction_ = Direction.VERTICAL;
            this.heightLimit_ = containerSize.height - thumbHeight;
        }
        this.sliderInitialized_ = true;
    };
    /**
     * @param {PointerEvent} event The browser event to handle.
     * @private
     */
    ZoomSlider.prototype.handleContainerClick_ = function (event) {
        var view = this.getMap().getView();
        var relativePosition = this.getRelativePosition_(event.offsetX - this.thumbSize_[0] / 2, event.offsetY - this.thumbSize_[1] / 2);
        var resolution = this.getResolutionForPosition_(relativePosition);
        var zoom = view.getConstrainedZoom(view.getZoomForResolution(resolution));
        view.animateInternal({
            zoom: zoom,
            duration: this.duration_,
            easing: _easing_js__WEBPACK_IMPORTED_MODULE_3__["easeOut"]
        });
    };
    /**
     * Handle dragger start events.
     * @param {PointerEvent} event The drag event.
     * @private
     */
    ZoomSlider.prototype.handleDraggerStart_ = function (event) {
        if (!this.dragging_ && event.target === this.element.firstElementChild) {
            var element = /** @type {HTMLElement} */ (this.element.firstElementChild);
            this.getMap().getView().beginInteraction();
            this.startX_ = event.clientX - parseFloat(element.style.left);
            this.startY_ = event.clientY - parseFloat(element.style.top);
            this.dragging_ = true;
            if (this.dragListenerKeys_.length === 0) {
                var drag = this.handleDraggerDrag_;
                var end = this.handleDraggerEnd_;
                this.dragListenerKeys_.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listen"])(document, _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].POINTERMOVE, drag, this), Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listen"])(document, _pointer_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].POINTERUP, end, this));
            }
        }
    };
    /**
     * Handle dragger drag events.
     *
     * @param {PointerEvent} event The drag event.
     * @private
     */
    ZoomSlider.prototype.handleDraggerDrag_ = function (event) {
        if (this.dragging_) {
            var deltaX = event.clientX - this.startX_;
            var deltaY = event.clientY - this.startY_;
            var relativePosition = this.getRelativePosition_(deltaX, deltaY);
            this.currentResolution_ = this.getResolutionForPosition_(relativePosition);
            this.getMap().getView().setResolution(this.currentResolution_);
        }
    };
    /**
     * Handle dragger end events.
     * @param {PointerEvent} event The drag event.
     * @private
     */
    ZoomSlider.prototype.handleDraggerEnd_ = function (event) {
        if (this.dragging_) {
            var view = this.getMap().getView();
            view.endInteraction();
            this.dragging_ = false;
            this.startX_ = undefined;
            this.startY_ = undefined;
            this.dragListenerKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_4__["unlistenByKey"]);
            this.dragListenerKeys_.length = 0;
        }
    };
    /**
     * Positions the thumb inside its container according to the given resolution.
     *
     * @param {number} res The res.
     * @private
     */
    ZoomSlider.prototype.setThumbPosition_ = function (res) {
        var position = this.getPositionForResolution_(res);
        var thumb = /** @type {HTMLElement} */ (this.element.firstElementChild);
        if (this.direction_ == Direction.HORIZONTAL) {
            thumb.style.left = this.widthLimit_ * position + 'px';
        }
        else {
            thumb.style.top = this.heightLimit_ * position + 'px';
        }
    };
    /**
     * Calculates the relative position of the thumb given x and y offsets.  The
     * relative position scales from 0 to 1.  The x and y offsets are assumed to be
     * in pixel units within the dragger limits.
     *
     * @param {number} x Pixel position relative to the left of the slider.
     * @param {number} y Pixel position relative to the top of the slider.
     * @return {number} The relative position of the thumb.
     * @private
     */
    ZoomSlider.prototype.getRelativePosition_ = function (x, y) {
        var amount;
        if (this.direction_ === Direction.HORIZONTAL) {
            amount = x / this.widthLimit_;
        }
        else {
            amount = y / this.heightLimit_;
        }
        return Object(_math_js__WEBPACK_IMPORTED_MODULE_7__["clamp"])(amount, 0, 1);
    };
    /**
     * Calculates the corresponding resolution of the thumb given its relative
     * position (where 0 is the minimum and 1 is the maximum).
     *
     * @param {number} position The relative position of the thumb.
     * @return {number} The corresponding resolution.
     * @private
     */
    ZoomSlider.prototype.getResolutionForPosition_ = function (position) {
        var fn = this.getMap().getView().getResolutionForValueFunction();
        return fn(1 - position);
    };
    /**
     * Determines the relative position of the slider for the given resolution.  A
     * relative position of 0 corresponds to the minimum view resolution.  A
     * relative position of 1 corresponds to the maximum view resolution.
     *
     * @param {number} res The resolution.
     * @return {number} The relative position value (between 0 and 1).
     * @private
     */
    ZoomSlider.prototype.getPositionForResolution_ = function (res) {
        var fn = this.getMap().getView().getValueForResolutionFunction();
        return Object(_math_js__WEBPACK_IMPORTED_MODULE_7__["clamp"])(1 - fn(res), 0, 1);
    };
    return ZoomSlider;
}(_Control_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * Update the zoomslider element.
 * @param {import("../MapEvent.js").default} mapEvent Map event.
 * @this {ZoomSlider}
 */
function render(mapEvent) {
    if (!mapEvent.frameState) {
        return;
    }
    if (!this.sliderInitialized_) {
        this.initSlider_();
    }
    var res = mapEvent.frameState.viewState.resolution;
    this.currentResolution_ = res;
    this.setThumbPosition_(res);
}
/* harmony default export */ __webpack_exports__["default"] = (ZoomSlider);
//# sourceMappingURL=ZoomSlider.js.map

/***/ }),

/***/ "./node_modules/ol/control/ZoomToExtent.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/control/ZoomToExtent.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/control/ZoomToExtent
 */




/**
 * @typedef {Object} Options
 * @property {string} [className='ol-zoom-extent'] Class name.
 * @property {HTMLElement|string} [target] Specify a target if you want the control
 * to be rendered outside of the map's viewport.
 * @property {string|HTMLElement} [label='E'] Text label to use for the button.
 * Instead of text, also an element (e.g. a `span` element) can be used.
 * @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip.
 * @property {import("../extent.js").Extent} [extent] The extent to zoom to. If undefined the validity
 * extent of the view projection is used.
 */
/**
 * @classdesc
 * A button control which, when pressed, changes the map view to a specific
 * extent. To style this control use the css selector `.ol-zoom-extent`.
 *
 * @api
 */
var ZoomToExtent = /** @class */ (function (_super) {
    __extends(ZoomToExtent, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function ZoomToExtent(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            element: document.createElement('div'),
            target: options.target
        }) || this;
        /**
         * @type {?import("../extent.js").Extent}
         * @protected
         */
        _this.extent = options.extent ? options.extent : null;
        var className = options.className !== undefined ? options.className : 'ol-zoom-extent';
        var label = options.label !== undefined ? options.label : 'E';
        var tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Fit to extent';
        var button = document.createElement('button');
        button.setAttribute('type', 'button');
        button.title = tipLabel;
        button.appendChild(typeof label === 'string' ? document.createTextNode(label) : label);
        button.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].CLICK, _this.handleClick_.bind(_this), false);
        var cssClasses = className + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_3__["CLASS_UNSELECTABLE"] + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_3__["CLASS_CONTROL"];
        var element = _this.element;
        element.className = cssClasses;
        element.appendChild(button);
        return _this;
    }
    /**
     * @param {MouseEvent} event The event to handle
     * @private
     */
    ZoomToExtent.prototype.handleClick_ = function (event) {
        event.preventDefault();
        this.handleZoomToExtent();
    };
    /**
     * @protected
     */
    ZoomToExtent.prototype.handleZoomToExtent = function () {
        var map = this.getMap();
        var view = map.getView();
        var extent = !this.extent ? view.getProjection().getExtent() : this.extent;
        view.fitInternal(Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_1__["fromExtent"])(extent));
    };
    return ZoomToExtent;
}(_Control_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ZoomToExtent);
//# sourceMappingURL=ZoomToExtent.js.map

/***/ }),

/***/ "./node_modules/ol/coordinate.js":
/*!***************************************!*\
  !*** ./node_modules/ol/coordinate.js ***!
  \***************************************/
/*! exports provided: add, closestOnCircle, closestOnSegment, createStringXY, degreesToStringHDMS, format, equals, rotate, scale, squaredDistance, distance, squaredDistanceToSegment, toStringHDMS, toStringXY, wrapX */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closestOnCircle", function() { return closestOnCircle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closestOnSegment", function() { return closestOnSegment; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createStringXY", function() { return createStringXY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "degreesToStringHDMS", function() { return degreesToStringHDMS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "format", function() { return format; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotate", function() { return rotate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredDistance", function() { return squaredDistance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distance", function() { return distance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredDistanceToSegment", function() { return squaredDistanceToSegment; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toStringHDMS", function() { return toStringHDMS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toStringXY", function() { return toStringXY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapX", function() { return wrapX; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _string_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./string.js */ "./node_modules/ol/string.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
/**
 * @module ol/coordinate
 */



/**
 * An array of numbers representing an xy coordinate. Example: `[16, 48]`.
 * @typedef {Array<number>} Coordinate
 * @api
 */
/**
 * A function that takes a {@link module:ol/coordinate~Coordinate} and
 * transforms it into a `{string}`.
 *
 * @typedef {function((Coordinate|undefined)): string} CoordinateFormat
 * @api
 */
/**
 * Add `delta` to `coordinate`. `coordinate` is modified in place and returned
 * by the function.
 *
 * Example:
 *
 *     import {add} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     add(coord, [-2, 4]);
 *     // coord is now [5.85, 51.983333]
 *
 * @param {Coordinate} coordinate Coordinate.
 * @param {Coordinate} delta Delta.
 * @return {Coordinate} The input coordinate adjusted by
 * the given delta.
 * @api
 */
function add(coordinate, delta) {
    coordinate[0] += +delta[0];
    coordinate[1] += +delta[1];
    return coordinate;
}
/**
 * Calculates the point closest to the passed coordinate on the passed circle.
 *
 * @param {Coordinate} coordinate The coordinate.
 * @param {import("./geom/Circle.js").default} circle The circle.
 * @return {Coordinate} Closest point on the circumference.
 */
function closestOnCircle(coordinate, circle) {
    var r = circle.getRadius();
    var center = circle.getCenter();
    var x0 = center[0];
    var y0 = center[1];
    var x1 = coordinate[0];
    var y1 = coordinate[1];
    var dx = x1 - x0;
    var dy = y1 - y0;
    if (dx === 0 && dy === 0) {
        dx = 1;
    }
    var d = Math.sqrt(dx * dx + dy * dy);
    var x = x0 + r * dx / d;
    var y = y0 + r * dy / d;
    return [x, y];
}
/**
 * Calculates the point closest to the passed coordinate on the passed segment.
 * This is the foot of the perpendicular of the coordinate to the segment when
 * the foot is on the segment, or the closest segment coordinate when the foot
 * is outside the segment.
 *
 * @param {Coordinate} coordinate The coordinate.
 * @param {Array<Coordinate>} segment The two coordinates
 * of the segment.
 * @return {Coordinate} The foot of the perpendicular of
 * the coordinate to the segment.
 */
function closestOnSegment(coordinate, segment) {
    var x0 = coordinate[0];
    var y0 = coordinate[1];
    var start = segment[0];
    var end = segment[1];
    var x1 = start[0];
    var y1 = start[1];
    var x2 = end[0];
    var y2 = end[1];
    var dx = x2 - x1;
    var dy = y2 - y1;
    var along = (dx === 0 && dy === 0) ? 0 :
        ((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0);
    var x, y;
    if (along <= 0) {
        x = x1;
        y = y1;
    }
    else if (along >= 1) {
        x = x2;
        y = y2;
    }
    else {
        x = x1 + along * dx;
        y = y1 + along * dy;
    }
    return [x, y];
}
/**
 * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be
 * used to format
 * a {Coordinate} to a string.
 *
 * Example without specifying the fractional digits:
 *
 *     import {createStringXY} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var stringifyFunc = createStringXY();
 *     var out = stringifyFunc(coord);
 *     // out is now '8, 48'
 *
 * Example with explicitly specifying 2 fractional digits:
 *
 *     import {createStringXY} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var stringifyFunc = createStringXY(2);
 *     var out = stringifyFunc(coord);
 *     // out is now '7.85, 47.98'
 *
 * @param {number=} opt_fractionDigits The number of digits to include
 *    after the decimal point. Default is `0`.
 * @return {CoordinateFormat} Coordinate format.
 * @api
 */
function createStringXY(opt_fractionDigits) {
    return (
    /**
     * @param {Coordinate} coordinate Coordinate.
     * @return {string} String XY.
     */
    function (coordinate) {
        return toStringXY(coordinate, opt_fractionDigits);
    });
}
/**
 * @param {string} hemispheres Hemispheres.
 * @param {number} degrees Degrees.
 * @param {number=} opt_fractionDigits The number of digits to include
 *    after the decimal point. Default is `0`.
 * @return {string} String.
 */
function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) {
    var normalizedDegrees = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["modulo"])(degrees + 180, 360) - 180;
    var x = Math.abs(3600 * normalizedDegrees);
    var dflPrecision = opt_fractionDigits || 0;
    var precision = Math.pow(10, dflPrecision);
    var deg = Math.floor(x / 3600);
    var min = Math.floor((x - deg * 3600) / 60);
    var sec = x - (deg * 3600) - (min * 60);
    sec = Math.ceil(sec * precision) / precision;
    if (sec >= 60) {
        sec = 0;
        min += 1;
    }
    if (min >= 60) {
        min = 0;
        deg += 1;
    }
    return deg + '\u00b0 ' + Object(_string_js__WEBPACK_IMPORTED_MODULE_1__["padNumber"])(min, 2) + '\u2032 ' +
        Object(_string_js__WEBPACK_IMPORTED_MODULE_1__["padNumber"])(sec, 2, dflPrecision) + '\u2033' +
        (normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0));
}
/**
 * Transforms the given {@link module:ol/coordinate~Coordinate} to a string
 * using the given string template. The strings `{x}` and `{y}` in the template
 * will be replaced with the first and second coordinate values respectively.
 *
 * Example without specifying the fractional digits:
 *
 *     import {format} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var template = 'Coordinate is ({x}|{y}).';
 *     var out = format(coord, template);
 *     // out is now 'Coordinate is (8|48).'
 *
 * Example explicitly specifying the fractional digits:
 *
 *     import {format} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var template = 'Coordinate is ({x}|{y}).';
 *     var out = format(coord, template, 2);
 *     // out is now 'Coordinate is (7.85|47.98).'
 *
 * @param {Coordinate} coordinate Coordinate.
 * @param {string} template A template string with `{x}` and `{y}` placeholders
 *     that will be replaced by first and second coordinate values.
 * @param {number=} opt_fractionDigits The number of digits to include
 *    after the decimal point. Default is `0`.
 * @return {string} Formatted coordinate.
 * @api
 */
function format(coordinate, template, opt_fractionDigits) {
    if (coordinate) {
        return template
            .replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
            .replace('{y}', coordinate[1].toFixed(opt_fractionDigits));
    }
    else {
        return '';
    }
}
/**
 * @param {Coordinate} coordinate1 First coordinate.
 * @param {Coordinate} coordinate2 Second coordinate.
 * @return {boolean} The two coordinates are equal.
 */
function equals(coordinate1, coordinate2) {
    var equals = true;
    for (var i = coordinate1.length - 1; i >= 0; --i) {
        if (coordinate1[i] != coordinate2[i]) {
            equals = false;
            break;
        }
    }
    return equals;
}
/**
 * Rotate `coordinate` by `angle`. `coordinate` is modified in place and
 * returned by the function.
 *
 * Example:
 *
 *     import {rotate} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var rotateRadians = Math.PI / 2; // 90 degrees
 *     rotate(coord, rotateRadians);
 *     // coord is now [-47.983333, 7.85]
 *
 * @param {Coordinate} coordinate Coordinate.
 * @param {number} angle Angle in radian.
 * @return {Coordinate} Coordinate.
 * @api
 */
function rotate(coordinate, angle) {
    var cosAngle = Math.cos(angle);
    var sinAngle = Math.sin(angle);
    var x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;
    var y = coordinate[1] * cosAngle + coordinate[0] * sinAngle;
    coordinate[0] = x;
    coordinate[1] = y;
    return coordinate;
}
/**
 * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned
 * by the function.
 *
 * Example:
 *
 *     import {scale as scaleCoordinate} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var scale = 1.2;
 *     scaleCoordinate(coord, scale);
 *     // coord is now [9.42, 57.5799996]
 *
 * @param {Coordinate} coordinate Coordinate.
 * @param {number} scale Scale factor.
 * @return {Coordinate} Coordinate.
 */
function scale(coordinate, scale) {
    coordinate[0] *= scale;
    coordinate[1] *= scale;
    return coordinate;
}
/**
 * @param {Coordinate} coord1 First coordinate.
 * @param {Coordinate} coord2 Second coordinate.
 * @return {number} Squared distance between coord1 and coord2.
 */
function squaredDistance(coord1, coord2) {
    var dx = coord1[0] - coord2[0];
    var dy = coord1[1] - coord2[1];
    return dx * dx + dy * dy;
}
/**
 * @param {Coordinate} coord1 First coordinate.
 * @param {Coordinate} coord2 Second coordinate.
 * @return {number} Distance between coord1 and coord2.
 */
function distance(coord1, coord2) {
    return Math.sqrt(squaredDistance(coord1, coord2));
}
/**
 * Calculate the squared distance from a coordinate to a line segment.
 *
 * @param {Coordinate} coordinate Coordinate of the point.
 * @param {Array<Coordinate>} segment Line segment (2
 * coordinates).
 * @return {number} Squared distance from the point to the line segment.
 */
function squaredDistanceToSegment(coordinate, segment) {
    return squaredDistance(coordinate, closestOnSegment(coordinate, segment));
}
/**
 * Format a geographic coordinate with the hemisphere, degrees, minutes, and
 * seconds.
 *
 * Example without specifying fractional digits:
 *
 *     import {toStringHDMS} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var out = toStringHDMS(coord);
 *     // out is now '47° 58′ 60″ N 7° 50′ 60″ E'
 *
 * Example explicitly specifying 1 fractional digit:
 *
 *     import {toStringHDMS} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var out = toStringHDMS(coord, 1);
 *     // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'
 *
 * @param {Coordinate} coordinate Coordinate.
 * @param {number=} opt_fractionDigits The number of digits to include
 *    after the decimal point. Default is `0`.
 * @return {string} Hemisphere, degrees, minutes and seconds.
 * @api
 */
function toStringHDMS(coordinate, opt_fractionDigits) {
    if (coordinate) {
        return degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' +
            degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits);
    }
    else {
        return '';
    }
}
/**
 * Format a coordinate as a comma delimited string.
 *
 * Example without specifying fractional digits:
 *
 *     import {toStringXY} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var out = toStringXY(coord);
 *     // out is now '8, 48'
 *
 * Example explicitly specifying 1 fractional digit:
 *
 *     import {toStringXY} from 'ol/coordinate';
 *
 *     var coord = [7.85, 47.983333];
 *     var out = toStringXY(coord, 1);
 *     // out is now '7.8, 48.0'
 *
 * @param {Coordinate} coordinate Coordinate.
 * @param {number=} opt_fractionDigits The number of digits to include
 *    after the decimal point. Default is `0`.
 * @return {string} XY.
 * @api
 */
function toStringXY(coordinate, opt_fractionDigits) {
    return format(coordinate, '{x}, {y}', opt_fractionDigits);
}
/**
 * Modifies the provided coordinate in-place to be within the real world
 * extent. The lower projection extent boundary is inclusive, the upper one
 * exclusive.
 *
 * @param {Coordinate} coordinate Coordinate.
 * @param {import("./proj/Projection.js").default} projection Projection
 * @return {Coordinate} The coordinate within the real world extent.
 */
function wrapX(coordinate, projection) {
    var projectionExtent = projection.getExtent();
    if (projection.canWrapX() && (coordinate[0] < projectionExtent[0] || coordinate[0] >= projectionExtent[2])) {
        var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(projectionExtent);
        var worldsAway = Math.floor((coordinate[0] - projectionExtent[0]) / worldWidth);
        coordinate[0] -= (worldsAway * worldWidth);
    }
    return coordinate;
}
//# sourceMappingURL=coordinate.js.map

/***/ }),

/***/ "./node_modules/ol/css.js":
/*!********************************!*\
  !*** ./node_modules/ol/css.js ***!
  \********************************/
/*! exports provided: CLASS_HIDDEN, CLASS_SELECTABLE, CLASS_UNSELECTABLE, CLASS_UNSUPPORTED, CLASS_CONTROL, CLASS_COLLAPSED, getFontParameters */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CLASS_HIDDEN", function() { return CLASS_HIDDEN; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CLASS_SELECTABLE", function() { return CLASS_SELECTABLE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CLASS_UNSELECTABLE", function() { return CLASS_UNSELECTABLE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CLASS_UNSUPPORTED", function() { return CLASS_UNSUPPORTED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CLASS_CONTROL", function() { return CLASS_CONTROL; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CLASS_COLLAPSED", function() { return CLASS_COLLAPSED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFontParameters", function() { return getFontParameters; });
/**
 * @module ol/css
 */
/**
 * @typedef {Object} FontParameters
 * @property {string} style
 * @property {string} variant
 * @property {string} weight
 * @property {string} size
 * @property {string} lineHeight
 * @property {string} family
 * @property {Array<string>} families
 */
/**
 * The CSS class for hidden feature.
 *
 * @const
 * @type {string}
 */
var CLASS_HIDDEN = 'ol-hidden';
/**
 * The CSS class that we'll give the DOM elements to have them selectable.
 *
 * @const
 * @type {string}
 */
var CLASS_SELECTABLE = 'ol-selectable';
/**
 * The CSS class that we'll give the DOM elements to have them unselectable.
 *
 * @const
 * @type {string}
 */
var CLASS_UNSELECTABLE = 'ol-unselectable';
/**
 * The CSS class for unsupported feature.
 *
 * @const
 * @type {string}
 */
var CLASS_UNSUPPORTED = 'ol-unsupported';
/**
 * The CSS class for controls.
 *
 * @const
 * @type {string}
 */
var CLASS_CONTROL = 'ol-control';
/**
 * The CSS class that we'll give the DOM elements that are collapsed, i.e.
 * to those elements which usually can be expanded.
 *
 * @const
 * @type {string}
 */
var CLASS_COLLAPSED = 'ol-collapsed';
/**
 * From http://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font
 * @type {RegExp}
 */
var fontRegEx = new RegExp([
    '^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)',
    '(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)',
    '(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',
    '(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?',
    '(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))',
    '(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))',
    '?\\s*([-,\\"\\\'\\sa-z]+?)\\s*$'
].join(''), 'i');
var fontRegExMatchIndex = [
    'style',
    'variant',
    'weight',
    'size',
    'lineHeight',
    'family'
];
/**
 * Get the list of font families from a font spec.  Note that this doesn't work
 * for font families that have commas in them.
 * @param {string} fontSpec The CSS font property.
 * @return {FontParameters} The font parameters (or null if the input spec is invalid).
 */
var getFontParameters = function (fontSpec) {
    var match = fontSpec.match(fontRegEx);
    if (!match) {
        return null;
    }
    var style = /** @type {FontParameters} */ ({
        lineHeight: 'normal',
        size: '1.2em',
        style: 'normal',
        weight: 'normal',
        variant: 'normal'
    });
    for (var i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) {
        var value = match[i + 1];
        if (value !== undefined) {
            style[fontRegExMatchIndex[i]] = value;
        }
    }
    style.families = style.family.split(/,\s?/);
    return style;
};
//# sourceMappingURL=css.js.map

/***/ }),

/***/ "./node_modules/ol/dom.js":
/*!********************************!*\
  !*** ./node_modules/ol/dom.js ***!
  \********************************/
/*! exports provided: createCanvasContext2D, outerWidth, outerHeight, replaceNode, removeNode, removeChildren, replaceChildren */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCanvasContext2D", function() { return createCanvasContext2D; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "outerWidth", function() { return outerWidth; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "outerHeight", function() { return outerHeight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "replaceNode", function() { return replaceNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeNode", function() { return removeNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeChildren", function() { return removeChildren; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "replaceChildren", function() { return replaceChildren; });
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./has.js */ "./node_modules/ol/has.js");

/**
 * @module ol/dom
 */
//FIXME Move this function to the canvas module
/**
 * Create an html canvas element and returns its 2d context.
 * @param {number=} opt_width Canvas width.
 * @param {number=} opt_height Canvas height.
 * @param {Array<HTMLCanvasElement>=} opt_canvasPool Canvas pool to take existing canvas from.
 * @return {CanvasRenderingContext2D} The context.
 */
function createCanvasContext2D(opt_width, opt_height, opt_canvasPool) {
    var canvas = opt_canvasPool && opt_canvasPool.length ?
        opt_canvasPool.shift() :
        _has_js__WEBPACK_IMPORTED_MODULE_0__["WORKER_OFFSCREEN_CANVAS"] ?
            new OffscreenCanvas(opt_width || 300, opt_height || 300) :
            document.createElement('canvas');
    if (opt_width) {
        canvas.width = opt_width;
    }
    if (opt_height) {
        canvas.height = opt_height;
    }
    //FIXME Allow OffscreenCanvasRenderingContext2D as return type
    return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d'));
}
/**
 * Get the current computed width for the given element including margin,
 * padding and border.
 * Equivalent to jQuery's `$(el).outerWidth(true)`.
 * @param {!HTMLElement} element Element.
 * @return {number} The width.
 */
function outerWidth(element) {
    var width = element.offsetWidth;
    var style = getComputedStyle(element);
    width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
    return width;
}
/**
 * Get the current computed height for the given element including margin,
 * padding and border.
 * Equivalent to jQuery's `$(el).outerHeight(true)`.
 * @param {!HTMLElement} element Element.
 * @return {number} The height.
 */
function outerHeight(element) {
    var height = element.offsetHeight;
    var style = getComputedStyle(element);
    height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
    return height;
}
/**
 * @param {Node} newNode Node to replace old node
 * @param {Node} oldNode The node to be replaced
 */
function replaceNode(newNode, oldNode) {
    var parent = oldNode.parentNode;
    if (parent) {
        parent.replaceChild(newNode, oldNode);
    }
}
/**
 * @param {Node} node The node to remove.
 * @returns {Node} The node that was removed or null.
 */
function removeNode(node) {
    return node && node.parentNode ? node.parentNode.removeChild(node) : null;
}
/**
 * @param {Node} node The node to remove the children from.
 */
function removeChildren(node) {
    while (node.lastChild) {
        node.removeChild(node.lastChild);
    }
}
/**
 * Transform the children of a parent node so they match the
 * provided list of children.  This function aims to efficiently
 * remove, add, and reorder child nodes while maintaining a simple
 * implementation (it is not guaranteed to minimize DOM operations).
 * @param {Node} node The parent node whose children need reworking.
 * @param {Array<Node>} children The desired children.
 */
function replaceChildren(node, children) {
    var oldChildren = node.childNodes;
    for (var i = 0; true; ++i) {
        var oldChild = oldChildren[i];
        var newChild = children[i];
        // check if our work is done
        if (!oldChild && !newChild) {
            break;
        }
        // check if children match
        if (oldChild === newChild) {
            continue;
        }
        // check if a new child needs to be added
        if (!oldChild) {
            node.appendChild(newChild);
            continue;
        }
        // check if an old child needs to be removed
        if (!newChild) {
            node.removeChild(oldChild);
            --i;
            continue;
        }
        // reorder
        node.insertBefore(newChild, oldChild);
    }
}
//# sourceMappingURL=dom.js.map

/***/ }),

/***/ "./node_modules/ol/easing.js":
/*!***********************************!*\
  !*** ./node_modules/ol/easing.js ***!
  \***********************************/
/*! exports provided: easeIn, easeOut, inAndOut, linear, upAndDown */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "easeIn", function() { return easeIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "easeOut", function() { return easeOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inAndOut", function() { return inAndOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linear", function() { return linear; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "upAndDown", function() { return upAndDown; });
/**
 * @module ol/easing
 */
/**
 * Start slow and speed up.
 * @param {number} t Input between 0 and 1.
 * @return {number} Output between 0 and 1.
 * @api
 */
function easeIn(t) {
    return Math.pow(t, 3);
}
/**
 * Start fast and slow down.
 * @param {number} t Input between 0 and 1.
 * @return {number} Output between 0 and 1.
 * @api
 */
function easeOut(t) {
    return 1 - easeIn(1 - t);
}
/**
 * Start slow, speed up, and then slow down again.
 * @param {number} t Input between 0 and 1.
 * @return {number} Output between 0 and 1.
 * @api
 */
function inAndOut(t) {
    return 3 * t * t - 2 * t * t * t;
}
/**
 * Maintain a constant speed over time.
 * @param {number} t Input between 0 and 1.
 * @return {number} Output between 0 and 1.
 * @api
 */
function linear(t) {
    return t;
}
/**
 * Start slow, speed up, and at the very end slow down again.  This has the
 * same general behavior as {@link module:ol/easing~inAndOut}, but the final
 * slowdown is delayed.
 * @param {number} t Input between 0 and 1.
 * @return {number} Output between 0 and 1.
 * @api
 */
function upAndDown(t) {
    if (t < 0.5) {
        return inAndOut(2 * t);
    }
    else {
        return 1 - inAndOut(2 * (t - 0.5));
    }
}
//# sourceMappingURL=easing.js.map

/***/ }),

/***/ "./node_modules/ol/events.js":
/*!***********************************!*\
  !*** ./node_modules/ol/events.js ***!
  \***********************************/
/*! exports provided: listen, listenOnce, unlistenByKey */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "listen", function() { return listen; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "listenOnce", function() { return listenOnce; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unlistenByKey", function() { return unlistenByKey; });
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./obj.js */ "./node_modules/ol/obj.js");
/**
 * @module ol/events
 */

/**
 * Key to use with {@link module:ol/Observable~Observable#unByKey}.
 * @typedef {Object} EventsKey
 * @property {ListenerFunction} listener
 * @property {import("./events/Target.js").EventTargetLike} target
 * @property {string} type
 * @api
 */
/**
 * Listener function. This function is called with an event object as argument.
 * When the function returns `false`, event propagation will stop.
 *
 * @typedef {function((Event|import("./events/Event.js").default)): (void|boolean)} ListenerFunction
 * @api
 */
/**
 * @typedef {Object} ListenerObject
 * @property {ListenerFunction} handleEvent
 */
/**
 * @typedef {ListenerFunction|ListenerObject} Listener
 */
/**
 * Registers an event listener on an event target. Inspired by
 * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
 *
 * This function efficiently binds a `listener` to a `this` object, and returns
 * a key for use with {@link module:ol/events~unlistenByKey}.
 *
 * @param {import("./events/Target.js").EventTargetLike} target Event target.
 * @param {string} type Event type.
 * @param {ListenerFunction} listener Listener.
 * @param {Object=} opt_this Object referenced by the `this` keyword in the
 *     listener. Default is the `target`.
 * @param {boolean=} opt_once If true, add the listener as one-off listener.
 * @return {EventsKey} Unique key for the listener.
 */
function listen(target, type, listener, opt_this, opt_once) {
    if (opt_this && opt_this !== target) {
        listener = listener.bind(opt_this);
    }
    if (opt_once) {
        var originalListener_1 = listener;
        listener = function () {
            target.removeEventListener(type, listener);
            originalListener_1.apply(this, arguments);
        };
    }
    var eventsKey = {
        target: target,
        type: type,
        listener: listener
    };
    target.addEventListener(type, listener);
    return eventsKey;
}
/**
 * Registers a one-off event listener on an event target. Inspired by
 * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
 *
 * This function efficiently binds a `listener` as self-unregistering listener
 * to a `this` object, and returns a key for use with
 * {@link module:ol/events~unlistenByKey} in case the listener needs to be
 * unregistered before it is called.
 *
 * When {@link module:ol/events~listen} is called with the same arguments after this
 * function, the self-unregistering listener will be turned into a permanent
 * listener.
 *
 * @param {import("./events/Target.js").EventTargetLike} target Event target.
 * @param {string} type Event type.
 * @param {ListenerFunction} listener Listener.
 * @param {Object=} opt_this Object referenced by the `this` keyword in the
 *     listener. Default is the `target`.
 * @return {EventsKey} Key for unlistenByKey.
 */
function listenOnce(target, type, listener, opt_this) {
    return listen(target, type, listener, opt_this, true);
}
/**
 * Unregisters event listeners on an event target. Inspired by
 * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html
 *
 * The argument passed to this function is the key returned from
 * {@link module:ol/events~listen} or {@link module:ol/events~listenOnce}.
 *
 * @param {EventsKey} key The key.
 */
function unlistenByKey(key) {
    if (key && key.target) {
        key.target.removeEventListener(key.type, key.listener);
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_0__["clear"])(key);
    }
}
//# sourceMappingURL=events.js.map

/***/ }),

/***/ "./node_modules/ol/events/Event.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/events/Event.js ***!
  \*****************************************/
/*! exports provided: stopPropagation, preventDefault, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stopPropagation", function() { return stopPropagation; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "preventDefault", function() { return preventDefault; });
/**
 * @module ol/events/Event
 */
/**
 * @classdesc
 * Stripped down implementation of the W3C DOM Level 2 Event interface.
 * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.
 *
 * This implementation only provides `type` and `target` properties, and
 * `stopPropagation` and `preventDefault` methods. It is meant as base class
 * for higher level events defined in the library, and works with
 * {@link module:ol/events/Target~Target}.
 */
var BaseEvent = /** @class */ (function () {
    /**
     * @param {string} type Type.
     */
    function BaseEvent(type) {
        /**
         * @type {boolean}
         */
        this.propagationStopped;
        /**
         * The event type.
         * @type {string}
         * @api
         */
        this.type = type;
        /**
         * The event target.
         * @type {Object}
         * @api
         */
        this.target = null;
    }
    /**
     * Stop event propagation.
     * @api
     */
    BaseEvent.prototype.preventDefault = function () {
        this.propagationStopped = true;
    };
    /**
     * Stop event propagation.
     * @api
     */
    BaseEvent.prototype.stopPropagation = function () {
        this.propagationStopped = true;
    };
    return BaseEvent;
}());
/**
 * @param {Event|import("./Event.js").default} evt Event
 */
function stopPropagation(evt) {
    evt.stopPropagation();
}
/**
 * @param {Event|import("./Event.js").default} evt Event
 */
function preventDefault(evt) {
    evt.preventDefault();
}
/* harmony default export */ __webpack_exports__["default"] = (BaseEvent);
//# sourceMappingURL=Event.js.map

/***/ }),

/***/ "./node_modules/ol/events/EventType.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/events/EventType.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/events/EventType
 */
/**
 * @enum {string}
 * @const
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Generic change event. Triggered when the revision counter is increased.
     * @event module:ol/events/Event~BaseEvent#change
     * @api
     */
    CHANGE: 'change',
    /**
     * Generic error event. Triggered when an error occurs.
     * @event module:ol/events/Event~BaseEvent#error
     * @api
     */
    ERROR: 'error',
    BLUR: 'blur',
    CLEAR: 'clear',
    CONTEXTMENU: 'contextmenu',
    CLICK: 'click',
    DBLCLICK: 'dblclick',
    DRAGENTER: 'dragenter',
    DRAGOVER: 'dragover',
    DROP: 'drop',
    FOCUS: 'focus',
    KEYDOWN: 'keydown',
    KEYPRESS: 'keypress',
    LOAD: 'load',
    RESIZE: 'resize',
    TOUCHMOVE: 'touchmove',
    WHEEL: 'wheel'
});
//# sourceMappingURL=EventType.js.map

/***/ }),

/***/ "./node_modules/ol/events/KeyCode.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/events/KeyCode.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/events/KeyCode
 */
/**
 * @enum {number}
 * @const
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    LEFT: 37,
    UP: 38,
    RIGHT: 39,
    DOWN: 40
});
//# sourceMappingURL=KeyCode.js.map

/***/ }),

/***/ "./node_modules/ol/events/Target.js":
/*!******************************************!*\
  !*** ./node_modules/ol/events/Target.js ***!
  \******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Disposable_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Disposable.js */ "./node_modules/ol/Disposable.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _Event_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/events/Target
 */




/**
 * @typedef {EventTarget|Target} EventTargetLike
 */
/**
 * @classdesc
 * A simplified implementation of the W3C DOM Level 2 EventTarget interface.
 * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.
 *
 * There are two important simplifications compared to the specification:
 *
 * 1. The handling of `useCapture` in `addEventListener` and
 *    `removeEventListener`. There is no real capture model.
 * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.
 *    There is no event target hierarchy. When a listener calls
 *    `stopPropagation` or `preventDefault` on an event object, it means that no
 *    more listeners after this one will be called. Same as when the listener
 *    returns false.
 */
var Target = /** @class */ (function (_super) {
    __extends(Target, _super);
    /**
     * @param {*=} opt_target Default event target for dispatched events.
     */
    function Target(opt_target) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {*}
         */
        _this.eventTarget_ = opt_target;
        /**
         * @private
         * @type {!Object<string, number>}
         */
        _this.pendingRemovals_ = {};
        /**
         * @private
         * @type {!Object<string, number>}
         */
        _this.dispatching_ = {};
        /**
         * @private
         * @type {!Object<string, Array<import("../events.js").Listener>>}
         */
        _this.listeners_ = {};
        return _this;
    }
    /**
     * @param {string} type Type.
     * @param {import("../events.js").Listener} listener Listener.
     */
    Target.prototype.addEventListener = function (type, listener) {
        if (!type || !listener) {
            return;
        }
        var listeners = this.listeners_[type];
        if (!listeners) {
            listeners = [];
            this.listeners_[type] = listeners;
        }
        if (listeners.indexOf(listener) === -1) {
            listeners.push(listener);
        }
    };
    /**
     * Dispatches an event and calls all listeners listening for events
     * of this type. The event parameter can either be a string or an
     * Object with a `type` property.
     *
     * @param {import("./Event.js").default|string} event Event object.
     * @return {boolean|undefined} `false` if anyone called preventDefault on the
     *     event object or if any of the listeners returned false.
     * @api
     */
    Target.prototype.dispatchEvent = function (event) {
        /** @type {import("./Event.js").default|Event} */
        var evt = typeof event === 'string' ? new _Event_js__WEBPACK_IMPORTED_MODULE_2__["default"](event) : event;
        var type = evt.type;
        if (!evt.target) {
            evt.target = this.eventTarget_ || this;
        }
        var listeners = this.listeners_[type];
        var propagate;
        if (listeners) {
            if (!(type in this.dispatching_)) {
                this.dispatching_[type] = 0;
                this.pendingRemovals_[type] = 0;
            }
            ++this.dispatching_[type];
            for (var i = 0, ii = listeners.length; i < ii; ++i) {
                if ('handleEvent' in listeners[i]) {
                    propagate = /** @type {import("../events.js").ListenerObject} */ (listeners[i]).handleEvent(evt);
                }
                else {
                    propagate = /** @type {import("../events.js").ListenerFunction} */ (listeners[i]).call(this, evt);
                }
                if (propagate === false || evt.propagationStopped) {
                    propagate = false;
                    break;
                }
            }
            --this.dispatching_[type];
            if (this.dispatching_[type] === 0) {
                var pendingRemovals = this.pendingRemovals_[type];
                delete this.pendingRemovals_[type];
                while (pendingRemovals--) {
                    this.removeEventListener(type, _functions_js__WEBPACK_IMPORTED_MODULE_1__["VOID"]);
                }
                delete this.dispatching_[type];
            }
            return propagate;
        }
    };
    /**
     * @inheritDoc
     */
    Target.prototype.disposeInternal = function () {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["clear"])(this.listeners_);
    };
    /**
     * Get the listeners for a specified event type. Listeners are returned in the
     * order that they will be called in.
     *
     * @param {string} type Type.
     * @return {Array<import("../events.js").Listener>} Listeners.
     */
    Target.prototype.getListeners = function (type) {
        return this.listeners_[type];
    };
    /**
     * @param {string=} opt_type Type. If not provided,
     *     `true` will be returned if this event target has any listeners.
     * @return {boolean} Has listeners.
     */
    Target.prototype.hasListener = function (opt_type) {
        return opt_type ?
            opt_type in this.listeners_ :
            Object.keys(this.listeners_).length > 0;
    };
    /**
     * @param {string} type Type.
     * @param {import("../events.js").Listener} listener Listener.
     */
    Target.prototype.removeEventListener = function (type, listener) {
        var listeners = this.listeners_[type];
        if (listeners) {
            var index = listeners.indexOf(listener);
            if (index !== -1) {
                if (type in this.pendingRemovals_) {
                    // make listener a no-op, and remove later in #dispatchEvent()
                    listeners[index] = _functions_js__WEBPACK_IMPORTED_MODULE_1__["VOID"];
                    ++this.pendingRemovals_[type];
                }
                else {
                    listeners.splice(index, 1);
                    if (listeners.length === 0) {
                        delete this.listeners_[type];
                    }
                }
            }
        }
    };
    return Target;
}(_Disposable_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Target);
//# sourceMappingURL=Target.js.map

/***/ }),

/***/ "./node_modules/ol/events/condition.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/events/condition.js ***!
  \*********************************************/
/*! exports provided: altKeyOnly, altShiftKeysOnly, focus, always, click, mouseActionButton, never, pointerMove, singleClick, doubleClick, noModifierKeys, platformModifierKeyOnly, shiftKeyOnly, targetNotEditable, mouseOnly, touchOnly, penOnly, primaryAction */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "altKeyOnly", function() { return altKeyOnly; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "altShiftKeysOnly", function() { return altShiftKeysOnly; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "focus", function() { return focus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "always", function() { return always; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "click", function() { return click; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mouseActionButton", function() { return mouseActionButton; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "never", function() { return never; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pointerMove", function() { return pointerMove; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "singleClick", function() { return singleClick; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doubleClick", function() { return doubleClick; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "noModifierKeys", function() { return noModifierKeys; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformModifierKeyOnly", function() { return platformModifierKeyOnly; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shiftKeyOnly", function() { return shiftKeyOnly; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "targetNotEditable", function() { return targetNotEditable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mouseOnly", function() { return mouseOnly; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "touchOnly", function() { return touchOnly; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "penOnly", function() { return penOnly; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "primaryAction", function() { return primaryAction; });
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../has.js */ "./node_modules/ol/has.js");
/**
 * @module ol/events/condition
 */




/**
 * A function that takes an {@link module:ol/MapBrowserEvent} and returns a
 * `{boolean}`. If the condition is met, true should be returned.
 *
 * @typedef {function(this: ?, import("../MapBrowserEvent.js").default): boolean} Condition
 */
/**
 * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when
 * additionally the shift-key is pressed).
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if only the alt key is pressed.
 * @api
 */
var altKeyOnly = function (mapBrowserEvent) {
    var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
    return (originalEvent.altKey &&
        !(originalEvent.metaKey || originalEvent.ctrlKey) &&
        !originalEvent.shiftKey);
};
/**
 * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise
 * (e.g. when additionally the platform-modifier-key is pressed).
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if only the alt and shift keys are pressed.
 * @api
 */
var altShiftKeysOnly = function (mapBrowserEvent) {
    var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
    return (originalEvent.altKey &&
        !(originalEvent.metaKey || originalEvent.ctrlKey) &&
        originalEvent.shiftKey);
};
/**
 * Return `true` if the map has the focus. This condition requires a map target
 * element with a `tabindex` attribute, e.g. `<div id="map" tabindex="1">`.
 *
 * @param {import("../MapBrowserEvent.js").default} event Map browser event.
 * @return {boolean} The map has the focus.
 * @api
 */
var focus = function (event) {
    return event.target.getTargetElement() === document.activeElement;
};
/**
 * Return always true.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True.
 * @api
 */
var always = _functions_js__WEBPACK_IMPORTED_MODULE_2__["TRUE"];
/**
 * Return `true` if the event is a `click` event, `false` otherwise.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if the event is a map `click` event.
 * @api
 */
var click = function (mapBrowserEvent) {
    return mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].CLICK;
};
/**
 * Return `true` if the event has an "action"-producing mouse button.
 *
 * By definition, this includes left-click on windows/linux, and left-click
 * without the ctrl key on Macs.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} The result.
 */
var mouseActionButton = function (mapBrowserEvent) {
    var originalEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
    return originalEvent.button == 0 &&
        !(_has_js__WEBPACK_IMPORTED_MODULE_3__["WEBKIT"] && _has_js__WEBPACK_IMPORTED_MODULE_3__["MAC"] && originalEvent.ctrlKey);
};
/**
 * Return always false.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} False.
 * @api
 */
var never = _functions_js__WEBPACK_IMPORTED_MODULE_2__["FALSE"];
/**
 * Return `true` if the browser event is a `pointermove` event, `false`
 * otherwise.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if the browser event is a `pointermove` event.
 * @api
 */
var pointerMove = function (mapBrowserEvent) {
    return mapBrowserEvent.type == 'pointermove';
};
/**
 * Return `true` if the event is a map `singleclick` event, `false` otherwise.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if the event is a map `singleclick` event.
 * @api
 */
var singleClick = function (mapBrowserEvent) {
    return mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].SINGLECLICK;
};
/**
 * Return `true` if the event is a map `dblclick` event, `false` otherwise.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if the event is a map `dblclick` event.
 * @api
 */
var doubleClick = function (mapBrowserEvent) {
    return mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].DBLCLICK;
};
/**
 * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is
 * pressed.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True only if there no modifier keys are pressed.
 * @api
 */
var noModifierKeys = function (mapBrowserEvent) {
    var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
    return (!originalEvent.altKey &&
        !(originalEvent.metaKey || originalEvent.ctrlKey) &&
        !originalEvent.shiftKey);
};
/**
 * Return `true` if only the platform-modifier-key (the meta-key on Mac,
 * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally
 * the shift-key is pressed).
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if only the platform modifier key is pressed.
 * @api
 */
var platformModifierKeyOnly = function (mapBrowserEvent) {
    var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
    return !originalEvent.altKey &&
        (_has_js__WEBPACK_IMPORTED_MODULE_3__["MAC"] ? originalEvent.metaKey : originalEvent.ctrlKey) &&
        !originalEvent.shiftKey;
};
/**
 * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when
 * additionally the alt-key is pressed).
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if only the shift key is pressed.
 * @api
 */
var shiftKeyOnly = function (mapBrowserEvent) {
    var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
    return (!originalEvent.altKey &&
        !(originalEvent.metaKey || originalEvent.ctrlKey) &&
        originalEvent.shiftKey);
};
/**
 * Return `true` if the target element is not editable, i.e. not a `<input>`-,
 * `<select>`- or `<textarea>`-element, `false` otherwise.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True only if the target element is not editable.
 * @api
 */
var targetNotEditable = function (mapBrowserEvent) {
    var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent);
    var tagName = /** @type {Element} */ (originalEvent.target).tagName;
    return tagName !== 'INPUT' && tagName !== 'SELECT' && tagName !== 'TEXTAREA';
};
/**
 * Return `true` if the event originates from a mouse device.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if the event originates from a mouse device.
 * @api
 */
var mouseOnly = function (mapBrowserEvent) {
    var pointerEvent = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent).pointerEvent;
    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event
    // see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
    return pointerEvent.pointerType == 'mouse';
};
/**
 * Return `true` if the event originates from a touchable device.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if the event originates from a touchable device.
 * @api
 */
var touchOnly = function (mapBrowserEvent) {
    var pointerEvt = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent).pointerEvent;
    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
    // see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
    return pointerEvt.pointerType === 'touch';
};
/**
 * Return `true` if the event originates from a digital pen.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if the event originates from a digital pen.
 * @api
 */
var penOnly = function (mapBrowserEvent) {
    var pointerEvt = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent).pointerEvent;
    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
    // see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
    return pointerEvt.pointerType === 'pen';
};
/**
 * Return `true` if the event originates from a primary pointer in
 * contact with the surface or if the left mouse button is pressed.
 * See http://www.w3.org/TR/pointerevents/#button-states.
 *
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} True if the event originates from a primary pointer.
 * @api
 */
var primaryAction = function (mapBrowserEvent) {
    var pointerEvent = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent).pointerEvent;
    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event
    return pointerEvent.isPrimary && pointerEvent.button === 0;
};
//# sourceMappingURL=condition.js.map

/***/ }),

/***/ "./node_modules/ol/extent.js":
/*!***********************************!*\
  !*** ./node_modules/ol/extent.js ***!
  \***********************************/
/*! exports provided: boundingExtent, buffer, clone, closestSquaredDistanceXY, containsCoordinate, containsExtent, containsXY, coordinateRelationship, createEmpty, createOrUpdate, createOrUpdateEmpty, createOrUpdateFromCoordinate, createOrUpdateFromCoordinates, createOrUpdateFromFlatCoordinates, createOrUpdateFromRings, equals, approximatelyEquals, extend, extendCoordinate, extendCoordinates, extendFlatCoordinates, extendRings, extendXY, forEachCorner, getArea, getBottomLeft, getBottomRight, getCenter, getCorner, getEnlargedArea, getForViewAndSize, getHeight, getIntersectionArea, getIntersection, getMargin, getSize, getTopLeft, getTopRight, getWidth, intersects, isEmpty, returnOrUpdate, scaleFromCenter, intersectsSegment, applyTransform, wrapX */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "boundingExtent", function() { return boundingExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buffer", function() { return buffer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return clone; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closestSquaredDistanceXY", function() { return closestSquaredDistanceXY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "containsCoordinate", function() { return containsCoordinate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "containsExtent", function() { return containsExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "containsXY", function() { return containsXY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coordinateRelationship", function() { return coordinateRelationship; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createEmpty", function() { return createEmpty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOrUpdate", function() { return createOrUpdate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOrUpdateEmpty", function() { return createOrUpdateEmpty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOrUpdateFromCoordinate", function() { return createOrUpdateFromCoordinate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOrUpdateFromCoordinates", function() { return createOrUpdateFromCoordinates; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOrUpdateFromFlatCoordinates", function() { return createOrUpdateFromFlatCoordinates; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOrUpdateFromRings", function() { return createOrUpdateFromRings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return equals; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "approximatelyEquals", function() { return approximatelyEquals; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return extend; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendCoordinate", function() { return extendCoordinate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendCoordinates", function() { return extendCoordinates; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendFlatCoordinates", function() { return extendFlatCoordinates; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendRings", function() { return extendRings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extendXY", function() { return extendXY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forEachCorner", function() { return forEachCorner; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getArea", function() { return getArea; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBottomLeft", function() { return getBottomLeft; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBottomRight", function() { return getBottomRight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCenter", function() { return getCenter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCorner", function() { return getCorner; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getEnlargedArea", function() { return getEnlargedArea; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getForViewAndSize", function() { return getForViewAndSize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHeight", function() { return getHeight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getIntersectionArea", function() { return getIntersectionArea; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getIntersection", function() { return getIntersection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMargin", function() { return getMargin; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSize", function() { return getSize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTopLeft", function() { return getTopLeft; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTopRight", function() { return getTopRight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getWidth", function() { return getWidth; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersects", function() { return intersects; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return isEmpty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "returnOrUpdate", function() { return returnOrUpdate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scaleFromCenter", function() { return scaleFromCenter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersectsSegment", function() { return intersectsSegment; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyTransform", function() { return applyTransform; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapX", function() { return wrapX; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _extent_Corner_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extent/Corner.js */ "./node_modules/ol/extent/Corner.js");
/* harmony import */ var _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extent/Relationship.js */ "./node_modules/ol/extent/Relationship.js");
/**
 * @module ol/extent
 */



/**
 * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.
 * @typedef {Array<number>} Extent
 * @api
 */
/**
 * Build an extent that includes all given coordinates.
 *
 * @param {Array<import("./coordinate.js").Coordinate>} coordinates Coordinates.
 * @return {Extent} Bounding extent.
 * @api
 */
function boundingExtent(coordinates) {
    var extent = createEmpty();
    for (var i = 0, ii = coordinates.length; i < ii; ++i) {
        extendCoordinate(extent, coordinates[i]);
    }
    return extent;
}
/**
 * @param {Array<number>} xs Xs.
 * @param {Array<number>} ys Ys.
 * @param {Extent=} opt_extent Destination extent.
 * @private
 * @return {Extent} Extent.
 */
function _boundingExtentXYs(xs, ys, opt_extent) {
    var minX = Math.min.apply(null, xs);
    var minY = Math.min.apply(null, ys);
    var maxX = Math.max.apply(null, xs);
    var maxY = Math.max.apply(null, ys);
    return createOrUpdate(minX, minY, maxX, maxY, opt_extent);
}
/**
 * Return extent increased by the provided value.
 * @param {Extent} extent Extent.
 * @param {number} value The amount by which the extent should be buffered.
 * @param {Extent=} opt_extent Extent.
 * @return {Extent} Extent.
 * @api
 */
function buffer(extent, value, opt_extent) {
    if (opt_extent) {
        opt_extent[0] = extent[0] - value;
        opt_extent[1] = extent[1] - value;
        opt_extent[2] = extent[2] + value;
        opt_extent[3] = extent[3] + value;
        return opt_extent;
    }
    else {
        return [
            extent[0] - value,
            extent[1] - value,
            extent[2] + value,
            extent[3] + value
        ];
    }
}
/**
 * Creates a clone of an extent.
 *
 * @param {Extent} extent Extent to clone.
 * @param {Extent=} opt_extent Extent.
 * @return {Extent} The clone.
 */
function clone(extent, opt_extent) {
    if (opt_extent) {
        opt_extent[0] = extent[0];
        opt_extent[1] = extent[1];
        opt_extent[2] = extent[2];
        opt_extent[3] = extent[3];
        return opt_extent;
    }
    else {
        return extent.slice();
    }
}
/**
 * @param {Extent} extent Extent.
 * @param {number} x X.
 * @param {number} y Y.
 * @return {number} Closest squared distance.
 */
function closestSquaredDistanceXY(extent, x, y) {
    var dx, dy;
    if (x < extent[0]) {
        dx = extent[0] - x;
    }
    else if (extent[2] < x) {
        dx = x - extent[2];
    }
    else {
        dx = 0;
    }
    if (y < extent[1]) {
        dy = extent[1] - y;
    }
    else if (extent[3] < y) {
        dy = y - extent[3];
    }
    else {
        dy = 0;
    }
    return dx * dx + dy * dy;
}
/**
 * Check if the passed coordinate is contained or on the edge of the extent.
 *
 * @param {Extent} extent Extent.
 * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
 * @return {boolean} The coordinate is contained in the extent.
 * @api
 */
function containsCoordinate(extent, coordinate) {
    return containsXY(extent, coordinate[0], coordinate[1]);
}
/**
 * Check if one extent contains another.
 *
 * An extent is deemed contained if it lies completely within the other extent,
 * including if they share one or more edges.
 *
 * @param {Extent} extent1 Extent 1.
 * @param {Extent} extent2 Extent 2.
 * @return {boolean} The second extent is contained by or on the edge of the
 *     first.
 * @api
 */
function containsExtent(extent1, extent2) {
    return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] &&
        extent1[1] <= extent2[1] && extent2[3] <= extent1[3];
}
/**
 * Check if the passed coordinate is contained or on the edge of the extent.
 *
 * @param {Extent} extent Extent.
 * @param {number} x X coordinate.
 * @param {number} y Y coordinate.
 * @return {boolean} The x, y values are contained in the extent.
 * @api
 */
function containsXY(extent, x, y) {
    return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];
}
/**
 * Get the relationship between a coordinate and extent.
 * @param {Extent} extent The extent.
 * @param {import("./coordinate.js").Coordinate} coordinate The coordinate.
 * @return {Relationship} The relationship (bitwise compare with
 *     import("./extent/Relationship.js").Relationship).
 */
function coordinateRelationship(extent, coordinate) {
    var minX = extent[0];
    var minY = extent[1];
    var maxX = extent[2];
    var maxY = extent[3];
    var x = coordinate[0];
    var y = coordinate[1];
    var relationship = _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].UNKNOWN;
    if (x < minX) {
        relationship = relationship | _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].LEFT;
    }
    else if (x > maxX) {
        relationship = relationship | _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].RIGHT;
    }
    if (y < minY) {
        relationship = relationship | _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].BELOW;
    }
    else if (y > maxY) {
        relationship = relationship | _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].ABOVE;
    }
    if (relationship === _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].UNKNOWN) {
        relationship = _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].INTERSECTING;
    }
    return relationship;
}
/**
 * Create an empty extent.
 * @return {Extent} Empty extent.
 * @api
 */
function createEmpty() {
    return [Infinity, Infinity, -Infinity, -Infinity];
}
/**
 * Create a new extent or update the provided extent.
 * @param {number} minX Minimum X.
 * @param {number} minY Minimum Y.
 * @param {number} maxX Maximum X.
 * @param {number} maxY Maximum Y.
 * @param {Extent=} opt_extent Destination extent.
 * @return {Extent} Extent.
 */
function createOrUpdate(minX, minY, maxX, maxY, opt_extent) {
    if (opt_extent) {
        opt_extent[0] = minX;
        opt_extent[1] = minY;
        opt_extent[2] = maxX;
        opt_extent[3] = maxY;
        return opt_extent;
    }
    else {
        return [minX, minY, maxX, maxY];
    }
}
/**
 * Create a new empty extent or make the provided one empty.
 * @param {Extent=} opt_extent Extent.
 * @return {Extent} Extent.
 */
function createOrUpdateEmpty(opt_extent) {
    return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, opt_extent);
}
/**
 * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
 * @param {Extent=} opt_extent Extent.
 * @return {Extent} Extent.
 */
function createOrUpdateFromCoordinate(coordinate, opt_extent) {
    var x = coordinate[0];
    var y = coordinate[1];
    return createOrUpdate(x, y, x, y, opt_extent);
}
/**
 * @param {Array<import("./coordinate.js").Coordinate>} coordinates Coordinates.
 * @param {Extent=} opt_extent Extent.
 * @return {Extent} Extent.
 */
function createOrUpdateFromCoordinates(coordinates, opt_extent) {
    var extent = createOrUpdateEmpty(opt_extent);
    return extendCoordinates(extent, coordinates);
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {Extent=} opt_extent Extent.
 * @return {Extent} Extent.
 */
function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, stride, opt_extent) {
    var extent = createOrUpdateEmpty(opt_extent);
    return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);
}
/**
 * @param {Array<Array<import("./coordinate.js").Coordinate>>} rings Rings.
 * @param {Extent=} opt_extent Extent.
 * @return {Extent} Extent.
 */
function createOrUpdateFromRings(rings, opt_extent) {
    var extent = createOrUpdateEmpty(opt_extent);
    return extendRings(extent, rings);
}
/**
 * Determine if two extents are equivalent.
 * @param {Extent} extent1 Extent 1.
 * @param {Extent} extent2 Extent 2.
 * @return {boolean} The two extents are equivalent.
 * @api
 */
function equals(extent1, extent2) {
    return extent1[0] == extent2[0] && extent1[2] == extent2[2] &&
        extent1[1] == extent2[1] && extent1[3] == extent2[3];
}
/**
 * Determine if two extents are approximately equivalent.
 * @param {Extent} extent1 Extent 1.
 * @param {Extent} extent2 Extent 2.
 * @param {number} tolerance Tolerance in extent coordinate units.
 * @return {boolean} The two extents differ by less than the tolerance.
 */
function approximatelyEquals(extent1, extent2, tolerance) {
    return Math.abs(extent1[0] - extent2[0]) < tolerance && Math.abs(extent1[2] - extent2[2]) < tolerance &&
        Math.abs(extent1[1] - extent2[1]) < tolerance && Math.abs(extent1[3] - extent2[3]) < tolerance;
}
/**
 * Modify an extent to include another extent.
 * @param {Extent} extent1 The extent to be modified.
 * @param {Extent} extent2 The extent that will be included in the first.
 * @return {Extent} A reference to the first (extended) extent.
 * @api
 */
function extend(extent1, extent2) {
    if (extent2[0] < extent1[0]) {
        extent1[0] = extent2[0];
    }
    if (extent2[2] > extent1[2]) {
        extent1[2] = extent2[2];
    }
    if (extent2[1] < extent1[1]) {
        extent1[1] = extent2[1];
    }
    if (extent2[3] > extent1[3]) {
        extent1[3] = extent2[3];
    }
    return extent1;
}
/**
 * @param {Extent} extent Extent.
 * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
 */
function extendCoordinate(extent, coordinate) {
    if (coordinate[0] < extent[0]) {
        extent[0] = coordinate[0];
    }
    if (coordinate[0] > extent[2]) {
        extent[2] = coordinate[0];
    }
    if (coordinate[1] < extent[1]) {
        extent[1] = coordinate[1];
    }
    if (coordinate[1] > extent[3]) {
        extent[3] = coordinate[1];
    }
}
/**
 * @param {Extent} extent Extent.
 * @param {Array<import("./coordinate.js").Coordinate>} coordinates Coordinates.
 * @return {Extent} Extent.
 */
function extendCoordinates(extent, coordinates) {
    for (var i = 0, ii = coordinates.length; i < ii; ++i) {
        extendCoordinate(extent, coordinates[i]);
    }
    return extent;
}
/**
 * @param {Extent} extent Extent.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @return {Extent} Extent.
 */
function extendFlatCoordinates(extent, flatCoordinates, offset, end, stride) {
    for (; offset < end; offset += stride) {
        extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);
    }
    return extent;
}
/**
 * @param {Extent} extent Extent.
 * @param {Array<Array<import("./coordinate.js").Coordinate>>} rings Rings.
 * @return {Extent} Extent.
 */
function extendRings(extent, rings) {
    for (var i = 0, ii = rings.length; i < ii; ++i) {
        extendCoordinates(extent, rings[i]);
    }
    return extent;
}
/**
 * @param {Extent} extent Extent.
 * @param {number} x X.
 * @param {number} y Y.
 */
function extendXY(extent, x, y) {
    extent[0] = Math.min(extent[0], x);
    extent[1] = Math.min(extent[1], y);
    extent[2] = Math.max(extent[2], x);
    extent[3] = Math.max(extent[3], y);
}
/**
 * This function calls `callback` for each corner of the extent. If the
 * callback returns a truthy value the function returns that value
 * immediately. Otherwise the function returns `false`.
 * @param {Extent} extent Extent.
 * @param {function(import("./coordinate.js").Coordinate): S} callback Callback.
 * @return {S|boolean} Value.
 * @template S
 */
function forEachCorner(extent, callback) {
    var val;
    val = callback(getBottomLeft(extent));
    if (val) {
        return val;
    }
    val = callback(getBottomRight(extent));
    if (val) {
        return val;
    }
    val = callback(getTopRight(extent));
    if (val) {
        return val;
    }
    val = callback(getTopLeft(extent));
    if (val) {
        return val;
    }
    return false;
}
/**
 * Get the size of an extent.
 * @param {Extent} extent Extent.
 * @return {number} Area.
 * @api
 */
function getArea(extent) {
    var area = 0;
    if (!isEmpty(extent)) {
        area = getWidth(extent) * getHeight(extent);
    }
    return area;
}
/**
 * Get the bottom left coordinate of an extent.
 * @param {Extent} extent Extent.
 * @return {import("./coordinate.js").Coordinate} Bottom left coordinate.
 * @api
 */
function getBottomLeft(extent) {
    return [extent[0], extent[1]];
}
/**
 * Get the bottom right coordinate of an extent.
 * @param {Extent} extent Extent.
 * @return {import("./coordinate.js").Coordinate} Bottom right coordinate.
 * @api
 */
function getBottomRight(extent) {
    return [extent[2], extent[1]];
}
/**
 * Get the center coordinate of an extent.
 * @param {Extent} extent Extent.
 * @return {import("./coordinate.js").Coordinate} Center.
 * @api
 */
function getCenter(extent) {
    return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];
}
/**
 * Get a corner coordinate of an extent.
 * @param {Extent} extent Extent.
 * @param {Corner} corner Corner.
 * @return {import("./coordinate.js").Coordinate} Corner coordinate.
 */
function getCorner(extent, corner) {
    var coordinate;
    if (corner === _extent_Corner_js__WEBPACK_IMPORTED_MODULE_1__["default"].BOTTOM_LEFT) {
        coordinate = getBottomLeft(extent);
    }
    else if (corner === _extent_Corner_js__WEBPACK_IMPORTED_MODULE_1__["default"].BOTTOM_RIGHT) {
        coordinate = getBottomRight(extent);
    }
    else if (corner === _extent_Corner_js__WEBPACK_IMPORTED_MODULE_1__["default"].TOP_LEFT) {
        coordinate = getTopLeft(extent);
    }
    else if (corner === _extent_Corner_js__WEBPACK_IMPORTED_MODULE_1__["default"].TOP_RIGHT) {
        coordinate = getTopRight(extent);
    }
    else {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(false, 13); // Invalid corner
    }
    return coordinate;
}
/**
 * @param {Extent} extent1 Extent 1.
 * @param {Extent} extent2 Extent 2.
 * @return {number} Enlarged area.
 */
function getEnlargedArea(extent1, extent2) {
    var minX = Math.min(extent1[0], extent2[0]);
    var minY = Math.min(extent1[1], extent2[1]);
    var maxX = Math.max(extent1[2], extent2[2]);
    var maxY = Math.max(extent1[3], extent2[3]);
    return (maxX - minX) * (maxY - minY);
}
/**
 * @param {import("./coordinate.js").Coordinate} center Center.
 * @param {number} resolution Resolution.
 * @param {number} rotation Rotation.
 * @param {import("./size.js").Size} size Size.
 * @param {Extent=} opt_extent Destination extent.
 * @return {Extent} Extent.
 */
function getForViewAndSize(center, resolution, rotation, size, opt_extent) {
    var dx = resolution * size[0] / 2;
    var dy = resolution * size[1] / 2;
    var cosRotation = Math.cos(rotation);
    var sinRotation = Math.sin(rotation);
    var xCos = dx * cosRotation;
    var xSin = dx * sinRotation;
    var yCos = dy * cosRotation;
    var ySin = dy * sinRotation;
    var x = center[0];
    var y = center[1];
    var x0 = x - xCos + ySin;
    var x1 = x - xCos - ySin;
    var x2 = x + xCos - ySin;
    var x3 = x + xCos + ySin;
    var y0 = y - xSin - yCos;
    var y1 = y - xSin + yCos;
    var y2 = y + xSin + yCos;
    var y3 = y + xSin - yCos;
    return createOrUpdate(Math.min(x0, x1, x2, x3), Math.min(y0, y1, y2, y3), Math.max(x0, x1, x2, x3), Math.max(y0, y1, y2, y3), opt_extent);
}
/**
 * Get the height of an extent.
 * @param {Extent} extent Extent.
 * @return {number} Height.
 * @api
 */
function getHeight(extent) {
    return extent[3] - extent[1];
}
/**
 * @param {Extent} extent1 Extent 1.
 * @param {Extent} extent2 Extent 2.
 * @return {number} Intersection area.
 */
function getIntersectionArea(extent1, extent2) {
    var intersection = getIntersection(extent1, extent2);
    return getArea(intersection);
}
/**
 * Get the intersection of two extents.
 * @param {Extent} extent1 Extent 1.
 * @param {Extent} extent2 Extent 2.
 * @param {Extent=} opt_extent Optional extent to populate with intersection.
 * @return {Extent} Intersecting extent.
 * @api
 */
function getIntersection(extent1, extent2, opt_extent) {
    var intersection = opt_extent ? opt_extent : createEmpty();
    if (intersects(extent1, extent2)) {
        if (extent1[0] > extent2[0]) {
            intersection[0] = extent1[0];
        }
        else {
            intersection[0] = extent2[0];
        }
        if (extent1[1] > extent2[1]) {
            intersection[1] = extent1[1];
        }
        else {
            intersection[1] = extent2[1];
        }
        if (extent1[2] < extent2[2]) {
            intersection[2] = extent1[2];
        }
        else {
            intersection[2] = extent2[2];
        }
        if (extent1[3] < extent2[3]) {
            intersection[3] = extent1[3];
        }
        else {
            intersection[3] = extent2[3];
        }
    }
    else {
        createOrUpdateEmpty(intersection);
    }
    return intersection;
}
/**
 * @param {Extent} extent Extent.
 * @return {number} Margin.
 */
function getMargin(extent) {
    return getWidth(extent) + getHeight(extent);
}
/**
 * Get the size (width, height) of an extent.
 * @param {Extent} extent The extent.
 * @return {import("./size.js").Size} The extent size.
 * @api
 */
function getSize(extent) {
    return [extent[2] - extent[0], extent[3] - extent[1]];
}
/**
 * Get the top left coordinate of an extent.
 * @param {Extent} extent Extent.
 * @return {import("./coordinate.js").Coordinate} Top left coordinate.
 * @api
 */
function getTopLeft(extent) {
    return [extent[0], extent[3]];
}
/**
 * Get the top right coordinate of an extent.
 * @param {Extent} extent Extent.
 * @return {import("./coordinate.js").Coordinate} Top right coordinate.
 * @api
 */
function getTopRight(extent) {
    return [extent[2], extent[3]];
}
/**
 * Get the width of an extent.
 * @param {Extent} extent Extent.
 * @return {number} Width.
 * @api
 */
function getWidth(extent) {
    return extent[2] - extent[0];
}
/**
 * Determine if one extent intersects another.
 * @param {Extent} extent1 Extent 1.
 * @param {Extent} extent2 Extent.
 * @return {boolean} The two extents intersect.
 * @api
 */
function intersects(extent1, extent2) {
    return extent1[0] <= extent2[2] &&
        extent1[2] >= extent2[0] &&
        extent1[1] <= extent2[3] &&
        extent1[3] >= extent2[1];
}
/**
 * Determine if an extent is empty.
 * @param {Extent} extent Extent.
 * @return {boolean} Is empty.
 * @api
 */
function isEmpty(extent) {
    return extent[2] < extent[0] || extent[3] < extent[1];
}
/**
 * @param {Extent} extent Extent.
 * @param {Extent=} opt_extent Extent.
 * @return {Extent} Extent.
 */
function returnOrUpdate(extent, opt_extent) {
    if (opt_extent) {
        opt_extent[0] = extent[0];
        opt_extent[1] = extent[1];
        opt_extent[2] = extent[2];
        opt_extent[3] = extent[3];
        return opt_extent;
    }
    else {
        return extent;
    }
}
/**
 * @param {Extent} extent Extent.
 * @param {number} value Value.
 */
function scaleFromCenter(extent, value) {
    var deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);
    var deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);
    extent[0] -= deltaX;
    extent[2] += deltaX;
    extent[1] -= deltaY;
    extent[3] += deltaY;
}
/**
 * Determine if the segment between two coordinates intersects (crosses,
 * touches, or is contained by) the provided extent.
 * @param {Extent} extent The extent.
 * @param {import("./coordinate.js").Coordinate} start Segment start coordinate.
 * @param {import("./coordinate.js").Coordinate} end Segment end coordinate.
 * @return {boolean} The segment intersects the extent.
 */
function intersectsSegment(extent, start, end) {
    var intersects = false;
    var startRel = coordinateRelationship(extent, start);
    var endRel = coordinateRelationship(extent, end);
    if (startRel === _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].INTERSECTING ||
        endRel === _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].INTERSECTING) {
        intersects = true;
    }
    else {
        var minX = extent[0];
        var minY = extent[1];
        var maxX = extent[2];
        var maxY = extent[3];
        var startX = start[0];
        var startY = start[1];
        var endX = end[0];
        var endY = end[1];
        var slope = (endY - startY) / (endX - startX);
        var x = void 0, y = void 0;
        if (!!(endRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].ABOVE) &&
            !(startRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].ABOVE)) {
            // potentially intersects top
            x = endX - ((endY - maxY) / slope);
            intersects = x >= minX && x <= maxX;
        }
        if (!intersects && !!(endRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].RIGHT) &&
            !(startRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].RIGHT)) {
            // potentially intersects right
            y = endY - ((endX - maxX) * slope);
            intersects = y >= minY && y <= maxY;
        }
        if (!intersects && !!(endRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].BELOW) &&
            !(startRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].BELOW)) {
            // potentially intersects bottom
            x = endX - ((endY - minY) / slope);
            intersects = x >= minX && x <= maxX;
        }
        if (!intersects && !!(endRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].LEFT) &&
            !(startRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_2__["default"].LEFT)) {
            // potentially intersects left
            y = endY - ((endX - minX) * slope);
            intersects = y >= minY && y <= maxY;
        }
    }
    return intersects;
}
/**
 * Apply a transform function to the extent.
 * @param {Extent} extent Extent.
 * @param {import("./proj.js").TransformFunction} transformFn Transform function.
 * Called with `[minX, minY, maxX, maxY]` extent coordinates.
 * @param {Extent=} opt_extent Destination extent.
 * @param {number=} opt_stops Number of stops per side used for the transform.
 * By default only the corners are used.
 * @return {Extent} Extent.
 * @api
 */
function applyTransform(extent, transformFn, opt_extent, opt_stops) {
    var coordinates = [];
    if (opt_stops > 1) {
        var width = extent[2] - extent[0];
        var height = extent[3] - extent[1];
        for (var i = 0; i < opt_stops; ++i) {
            coordinates.push(extent[0] + width * i / opt_stops, extent[1], extent[2], extent[1] + height * i / opt_stops, extent[2] - width * i / opt_stops, extent[3], extent[0], extent[3] - height * i / opt_stops);
        }
    }
    else {
        coordinates = [
            extent[0], extent[1],
            extent[2], extent[1],
            extent[2], extent[3],
            extent[0], extent[3]
        ];
    }
    transformFn(coordinates, coordinates, 2);
    var xs = [];
    var ys = [];
    for (var i = 0, l = coordinates.length; i < l; i += 2) {
        xs.push(coordinates[i]);
        ys.push(coordinates[i + 1]);
    }
    return _boundingExtentXYs(xs, ys, opt_extent);
}
/**
 * Modifies the provided extent in-place to be within the real world
 * extent.
 *
 * @param {Extent} extent Extent.
 * @param {import("./proj/Projection.js").default} projection Projection
 * @return {Extent} The extent within the real world extent.
 */
function wrapX(extent, projection) {
    var projectionExtent = projection.getExtent();
    var center = getCenter(extent);
    if (projection.canWrapX() && (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])) {
        var worldWidth = getWidth(projectionExtent);
        var worldsAway = Math.floor((center[0] - projectionExtent[0]) / worldWidth);
        var offset = (worldsAway * worldWidth);
        extent[0] -= offset;
        extent[2] -= offset;
    }
    return extent;
}
//# sourceMappingURL=extent.js.map

/***/ }),

/***/ "./node_modules/ol/extent/Corner.js":
/*!******************************************!*\
  !*** ./node_modules/ol/extent/Corner.js ***!
  \******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/extent/Corner
 */
/**
 * Extent corner.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    BOTTOM_LEFT: 'bottom-left',
    BOTTOM_RIGHT: 'bottom-right',
    TOP_LEFT: 'top-left',
    TOP_RIGHT: 'top-right'
});
//# sourceMappingURL=Corner.js.map

/***/ }),

/***/ "./node_modules/ol/extent/Relationship.js":
/*!************************************************!*\
  !*** ./node_modules/ol/extent/Relationship.js ***!
  \************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/extent/Relationship
 */
/**
 * Relationship to an extent.
 * @enum {number}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    UNKNOWN: 0,
    INTERSECTING: 1,
    ABOVE: 2,
    RIGHT: 4,
    BELOW: 8,
    LEFT: 16
});
//# sourceMappingURL=Relationship.js.map

/***/ }),

/***/ "./node_modules/ol/featureloader.js":
/*!******************************************!*\
  !*** ./node_modules/ol/featureloader.js ***!
  \******************************************/
/*! exports provided: loadFeaturesXhr, xhr, setWithCredentials */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadFeaturesXhr", function() { return loadFeaturesXhr; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "xhr", function() { return xhr; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setWithCredentials", function() { return setWithCredentials; });
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _format_FormatType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./format/FormatType.js */ "./node_modules/ol/format/FormatType.js");
/**
 * @module ol/featureloader
 */


/**
 *
 * @type {boolean}
 * @private
 */
var withCredentials = false;
/**
 * {@link module:ol/source/Vector} sources use a function of this type to
 * load features.
 *
 * This function takes an {@link module:ol/extent~Extent} representing the area to be loaded,
 * a `{number}` representing the resolution (map units per pixel) and an
 * {@link module:ol/proj/Projection} for the projection  as
 * arguments. `this` within the function is bound to the
 * {@link module:ol/source/Vector} it's called from.
 *
 * The function is responsible for loading the features and adding them to the
 * source.
 * @typedef {function(this:(import("./source/Vector").default|import("./VectorTile.js").default), import("./extent.js").Extent, number,
 *                    import("./proj/Projection.js").default): void} FeatureLoader
 * @api
 */
/**
 * {@link module:ol/source/Vector} sources use a function of this type to
 * get the url to load features from.
 *
 * This function takes an {@link module:ol/extent~Extent} representing the area
 * to be loaded, a `{number}` representing the resolution (map units per pixel)
 * and an {@link module:ol/proj/Projection} for the projection  as
 * arguments and returns a `{string}` representing the URL.
 * @typedef {function(import("./extent.js").Extent, number, import("./proj/Projection.js").default): string} FeatureUrlFunction
 * @api
 */
/**
 * @param {string|FeatureUrlFunction} url Feature URL service.
 * @param {import("./format/Feature.js").default} format Feature format.
 * @param {function(this:import("./VectorTile.js").default, Array<import("./Feature.js").default>, import("./proj/Projection.js").default, import("./extent.js").Extent): void|function(this:import("./source/Vector").default, Array<import("./Feature.js").default>): void} success
 *     Function called with the loaded features and optionally with the data
 *     projection. Called with the vector tile or source as `this`.
 * @param {function(this:import("./VectorTile.js").default): void|function(this:import("./source/Vector").default): void} failure
 *     Function called when loading failed. Called with the vector tile or
 *     source as `this`.
 * @return {FeatureLoader} The feature loader.
 */
function loadFeaturesXhr(url, format, success, failure) {
    return (
    /**
     * @param {import("./extent.js").Extent} extent Extent.
     * @param {number} resolution Resolution.
     * @param {import("./proj/Projection.js").default} projection Projection.
     * @this {import("./source/Vector").default|import("./VectorTile.js").default}
     */
    function (extent, resolution, projection) {
        var xhr = new XMLHttpRequest();
        xhr.open('GET', typeof url === 'function' ? url(extent, resolution, projection) : url, true);
        if (format.getType() == _format_FormatType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ARRAY_BUFFER) {
            xhr.responseType = 'arraybuffer';
        }
        xhr.withCredentials = withCredentials;
        /**
         * @param {Event} event Event.
         * @private
         */
        xhr.onload = function (event) {
            // status will be 0 for file:// urls
            if (!xhr.status || xhr.status >= 200 && xhr.status < 300) {
                var type = format.getType();
                /** @type {Document|Node|Object|string|undefined} */
                var source = void 0;
                if (type == _format_FormatType_js__WEBPACK_IMPORTED_MODULE_1__["default"].JSON || type == _format_FormatType_js__WEBPACK_IMPORTED_MODULE_1__["default"].TEXT) {
                    source = xhr.responseText;
                }
                else if (type == _format_FormatType_js__WEBPACK_IMPORTED_MODULE_1__["default"].XML) {
                    source = xhr.responseXML;
                    if (!source) {
                        source = new DOMParser().parseFromString(xhr.responseText, 'application/xml');
                    }
                }
                else if (type == _format_FormatType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ARRAY_BUFFER) {
                    source = /** @type {ArrayBuffer} */ (xhr.response);
                }
                if (source) {
                    success.call(this, format.readFeatures(source, {
                        extent: extent,
                        featureProjection: projection
                    }), format.readProjection(source));
                }
                else {
                    failure.call(this);
                }
            }
            else {
                failure.call(this);
            }
        }.bind(this);
        /**
         * @private
         */
        xhr.onerror = function () {
            failure.call(this);
        }.bind(this);
        xhr.send();
    });
}
/**
 * Create an XHR feature loader for a `url` and `format`. The feature loader
 * loads features (with XHR), parses the features, and adds them to the
 * vector source.
 * @param {string|FeatureUrlFunction} url Feature URL service.
 * @param {import("./format/Feature.js").default} format Feature format.
 * @return {FeatureLoader} The feature loader.
 * @api
 */
function xhr(url, format) {
    return loadFeaturesXhr(url, format, 
    /**
     * @param {Array<import("./Feature.js").default>} features The loaded features.
     * @param {import("./proj/Projection.js").default} dataProjection Data
     * projection.
     * @this {import("./source/Vector").default|import("./VectorTile.js").default}
     */
    function (features, dataProjection) {
        var sourceOrTile = /** @type {?} */ (this);
        if (typeof sourceOrTile.addFeatures === 'function') {
            /** @type {import("./source/Vector").default} */ (sourceOrTile).addFeatures(features);
        }
    }, /* FIXME handle error */ _functions_js__WEBPACK_IMPORTED_MODULE_0__["VOID"]);
}
/**
 * Setter for the withCredentials configuration for the XHR.
 *
 * @param {boolean} xhrWithCredentials The value of withCredentials to set.
 * Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/
 * @api
 */
function setWithCredentials(xhrWithCredentials) {
    withCredentials = xhrWithCredentials;
}
//# sourceMappingURL=featureloader.js.map

/***/ }),

/***/ "./node_modules/ol/format.js":
/*!***********************************!*\
  !*** ./node_modules/ol/format.js ***!
  \***********************************/
/*! exports provided: EsriJSON, GeoJSON, GML, GPX, IGC, IIIFInfo, KML, MVT, OWS, Polyline, TopoJSON, WFS, WKT, WMSCapabilities, WMSGetFeatureInfo, WMTSCapabilities */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _format_EsriJSON_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./format/EsriJSON.js */ "./node_modules/ol/format/EsriJSON.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EsriJSON", function() { return _format_EsriJSON_js__WEBPACK_IMPORTED_MODULE_0__["default"]; });

/* harmony import */ var _format_GeoJSON_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./format/GeoJSON.js */ "./node_modules/ol/format/GeoJSON.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GeoJSON", function() { return _format_GeoJSON_js__WEBPACK_IMPORTED_MODULE_1__["default"]; });

/* harmony import */ var _format_GML_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./format/GML.js */ "./node_modules/ol/format/GML.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GML", function() { return _format_GML_js__WEBPACK_IMPORTED_MODULE_2__["default"]; });

/* harmony import */ var _format_GPX_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./format/GPX.js */ "./node_modules/ol/format/GPX.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GPX", function() { return _format_GPX_js__WEBPACK_IMPORTED_MODULE_3__["default"]; });

/* harmony import */ var _format_IGC_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./format/IGC.js */ "./node_modules/ol/format/IGC.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IGC", function() { return _format_IGC_js__WEBPACK_IMPORTED_MODULE_4__["default"]; });

/* harmony import */ var _format_IIIFInfo_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./format/IIIFInfo.js */ "./node_modules/ol/format/IIIFInfo.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IIIFInfo", function() { return _format_IIIFInfo_js__WEBPACK_IMPORTED_MODULE_5__["default"]; });

/* harmony import */ var _format_KML_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./format/KML.js */ "./node_modules/ol/format/KML.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KML", function() { return _format_KML_js__WEBPACK_IMPORTED_MODULE_6__["default"]; });

/* harmony import */ var _format_MVT_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./format/MVT.js */ "./node_modules/ol/format/MVT.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MVT", function() { return _format_MVT_js__WEBPACK_IMPORTED_MODULE_7__["default"]; });

/* harmony import */ var _format_OWS_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./format/OWS.js */ "./node_modules/ol/format/OWS.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OWS", function() { return _format_OWS_js__WEBPACK_IMPORTED_MODULE_8__["default"]; });

/* harmony import */ var _format_Polyline_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./format/Polyline.js */ "./node_modules/ol/format/Polyline.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Polyline", function() { return _format_Polyline_js__WEBPACK_IMPORTED_MODULE_9__["default"]; });

/* harmony import */ var _format_TopoJSON_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./format/TopoJSON.js */ "./node_modules/ol/format/TopoJSON.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TopoJSON", function() { return _format_TopoJSON_js__WEBPACK_IMPORTED_MODULE_10__["default"]; });

/* harmony import */ var _format_WFS_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./format/WFS.js */ "./node_modules/ol/format/WFS.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WFS", function() { return _format_WFS_js__WEBPACK_IMPORTED_MODULE_11__["default"]; });

/* harmony import */ var _format_WKT_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./format/WKT.js */ "./node_modules/ol/format/WKT.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WKT", function() { return _format_WKT_js__WEBPACK_IMPORTED_MODULE_12__["default"]; });

/* harmony import */ var _format_WMSCapabilities_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./format/WMSCapabilities.js */ "./node_modules/ol/format/WMSCapabilities.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WMSCapabilities", function() { return _format_WMSCapabilities_js__WEBPACK_IMPORTED_MODULE_13__["default"]; });

/* harmony import */ var _format_WMSGetFeatureInfo_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./format/WMSGetFeatureInfo.js */ "./node_modules/ol/format/WMSGetFeatureInfo.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WMSGetFeatureInfo", function() { return _format_WMSGetFeatureInfo_js__WEBPACK_IMPORTED_MODULE_14__["default"]; });

/* harmony import */ var _format_WMTSCapabilities_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./format/WMTSCapabilities.js */ "./node_modules/ol/format/WMTSCapabilities.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WMTSCapabilities", function() { return _format_WMTSCapabilities_js__WEBPACK_IMPORTED_MODULE_15__["default"]; });

/**
 * @module ol/format
 */
















//# sourceMappingURL=format.js.map

/***/ }),

/***/ "./node_modules/ol/format/EsriJSON.js":
/*!********************************************!*\
  !*** ./node_modules/ol/format/EsriJSON.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _JSONFeature_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./JSONFeature.js */ "./node_modules/ol/format/JSONFeature.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_LinearRing_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/LinearRing.js */ "./node_modules/ol/geom/LinearRing.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _geom_flat_deflate_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../geom/flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _geom_flat_orient_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../geom/flat/orient.js */ "./node_modules/ol/geom/flat/orient.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/EsriJSON
 */


















/**
 * @typedef {import("arcgis-rest-api").Feature} EsriJSONFeature
 * @typedef {import("arcgis-rest-api").FeatureSet} EsriJSONFeatureSet
 * @typedef {import("arcgis-rest-api").Geometry} EsriJSONGeometry
 * @typedef {import("arcgis-rest-api").Point} EsriJSONPoint
 * @typedef {import("arcgis-rest-api").Polyline} EsriJSONPolyline
 * @typedef {import("arcgis-rest-api").Polygon} EsriJSONPolygon
 * @typedef {import("arcgis-rest-api").Multipoint} EsriJSONMultipoint
 * @typedef {import("arcgis-rest-api").HasZM} EsriJSONHasZM
 * @typedef {import("arcgis-rest-api").Position} EsriJSONPosition
 * @typedef {import("arcgis-rest-api").SpatialReferenceWkid} EsriJSONSpatialReferenceWkid
 */
/**
 * @typedef {Object} EsriJSONMultiPolygon
 * @property {Array<Array<Array<Array<number>>>>} rings Rings for the MultiPolygon.
 * @property {boolean} [hasM] If the polygon coordinates have an M value.
 * @property {boolean} [hasZ] If the polygon coordinates have a Z value.
 * @property {EsriJSONSpatialReferenceWkid} [spatialReference] The coordinate reference system.
 */
/**
 * @const
 * @type {Object<import("../geom/GeometryType.js").default, function(EsriJSONGeometry): import("../geom/Geometry.js").default>}
 */
var GEOMETRY_READERS = {};
GEOMETRY_READERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POINT] = readPointGeometry;
GEOMETRY_READERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].LINE_STRING] = readLineStringGeometry;
GEOMETRY_READERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POLYGON] = readPolygonGeometry;
GEOMETRY_READERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_POINT] = readMultiPointGeometry;
GEOMETRY_READERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_LINE_STRING] = readMultiLineStringGeometry;
GEOMETRY_READERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_POLYGON] = readMultiPolygonGeometry;
/**
 * @const
 * @type {Object<string, function(import("../geom/Geometry.js").default, import("./Feature.js").WriteOptions=): (EsriJSONGeometry)>}
 */
var GEOMETRY_WRITERS = {};
GEOMETRY_WRITERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POINT] = writePointGeometry;
GEOMETRY_WRITERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].LINE_STRING] = writeLineStringGeometry;
GEOMETRY_WRITERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POLYGON] = writePolygonGeometry;
GEOMETRY_WRITERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_POINT] = writeMultiPointGeometry;
GEOMETRY_WRITERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_LINE_STRING] = writeMultiLineStringGeometry;
GEOMETRY_WRITERS[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_POLYGON] = writeMultiPolygonGeometry;
/**
 * @typedef {Object} Options
 * @property {string} [geometryName] Geometry name to use when creating features.
 */
/**
 * @classdesc
 * Feature format for reading and writing data in the EsriJSON format.
 *
 * @api
 */
var EsriJSON = /** @class */ (function (_super) {
    __extends(EsriJSON, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function EsriJSON(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this) || this;
        /**
         * Name of the geometry attribute for features.
         * @type {string|undefined}
         * @private
         */
        _this.geometryName_ = options.geometryName;
        return _this;
    }
    /**
     * @inheritDoc
     */
    EsriJSON.prototype.readFeatureFromObject = function (object, opt_options) {
        var esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
        var geometry = readGeometry(esriJSONFeature.geometry, opt_options);
        var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
        if (this.geometryName_) {
            feature.setGeometryName(this.geometryName_);
        }
        feature.setGeometry(geometry);
        if (opt_options && opt_options.idField &&
            esriJSONFeature.attributes[opt_options.idField]) {
            feature.setId(/** @type {number} */ (esriJSONFeature.attributes[opt_options.idField]));
        }
        if (esriJSONFeature.attributes) {
            feature.setProperties(esriJSONFeature.attributes, true);
        }
        return feature;
    };
    /**
     * @inheritDoc
     */
    EsriJSON.prototype.readFeaturesFromObject = function (object, opt_options) {
        var options = opt_options ? opt_options : {};
        if (object['features']) {
            var esriJSONFeatureSet = /** @type {EsriJSONFeatureSet} */ (object);
            /** @type {Array<import("../Feature.js").default>} */
            var features = [];
            var esriJSONFeatures = esriJSONFeatureSet.features;
            options.idField = object.objectIdFieldName;
            for (var i = 0, ii = esriJSONFeatures.length; i < ii; ++i) {
                features.push(this.readFeatureFromObject(esriJSONFeatures[i], options));
            }
            return features;
        }
        else {
            return [this.readFeatureFromObject(object, options)];
        }
    };
    /**
     * @inheritDoc
     */
    EsriJSON.prototype.readGeometryFromObject = function (object, opt_options) {
        return readGeometry(/** @type {EsriJSONGeometry} */ (object), opt_options);
    };
    /**
     * @inheritDoc
     */
    EsriJSON.prototype.readProjectionFromObject = function (object) {
        if (object['spatialReference'] && object['spatialReference']['wkid'] !== undefined) {
            var spatialReference = /** @type {EsriJSONSpatialReferenceWkid} */ (object['spatialReference']);
            var crs = spatialReference.wkid;
            return Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["get"])('EPSG:' + crs);
        }
        else {
            return null;
        }
    };
    /**
     * Encode a geometry as a EsriJSON object.
     *
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {EsriJSONGeometry} Object.
     * @override
     * @api
     */
    EsriJSON.prototype.writeGeometryObject = function (geometry, opt_options) {
        return writeGeometry(geometry, this.adaptOptions(opt_options));
    };
    /**
     * Encode a feature as a esriJSON Feature object.
     *
     * @param {import("../Feature.js").default} feature Feature.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {Object} Object.
     * @override
     * @api
     */
    EsriJSON.prototype.writeFeatureObject = function (feature, opt_options) {
        opt_options = this.adaptOptions(opt_options);
        var object = {};
        var geometry = feature.getGeometry();
        if (geometry) {
            object['geometry'] = writeGeometry(geometry, opt_options);
            if (opt_options && opt_options.featureProjection) {
                object['geometry']['spatialReference'] = /** @type {EsriJSONSpatialReferenceWkid} */ ({
                    wkid: Number(Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["get"])(opt_options.featureProjection).getCode().split(':').pop())
                });
            }
        }
        var properties = feature.getProperties();
        delete properties[feature.getGeometryName()];
        if (!Object(_obj_js__WEBPACK_IMPORTED_MODULE_16__["isEmpty"])(properties)) {
            object['attributes'] = properties;
        }
        else {
            object['attributes'] = {};
        }
        return object;
    };
    /**
     * Encode an array of features as a EsriJSON object.
     *
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {EsriJSONFeatureSet} EsriJSON Object.
     * @override
     * @api
     */
    EsriJSON.prototype.writeFeaturesObject = function (features, opt_options) {
        opt_options = this.adaptOptions(opt_options);
        var objects = [];
        for (var i = 0, ii = features.length; i < ii; ++i) {
            objects.push(this.writeFeatureObject(features[i], opt_options));
        }
        return {
            'features': objects
        };
    };
    return EsriJSON;
}(_JSONFeature_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/**
 * @param {EsriJSONGeometry} object Object.
 * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
 * @return {import("../geom/Geometry.js").default} Geometry.
 */
function readGeometry(object, opt_options) {
    var _a, _b;
    if (!object) {
        return null;
    }
    /** @type {import("../geom/GeometryType.js").default} */
    var type;
    if (typeof object['x'] === 'number' && typeof object['y'] === 'number') {
        type = _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POINT;
    }
    else if (object['points']) {
        type = _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_POINT;
    }
    else if (object['paths']) {
        var esriJSONPolyline = /** @type {EsriJSONPolyline} */ (object);
        if (esriJSONPolyline.paths.length === 1) {
            type = _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].LINE_STRING;
        }
        else {
            type = _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_LINE_STRING;
        }
    }
    else if (object['rings']) {
        var esriJSONPolygon = /** @type {EsriJSONPolygon} */ (object);
        var layout = getGeometryLayout(esriJSONPolygon);
        var rings = convertRings(esriJSONPolygon.rings, layout);
        if (rings.length === 1) {
            type = _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POLYGON;
            object = Object.assign({}, object, (_a = {}, _a['rings'] = rings[0], _a));
        }
        else {
            type = _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_POLYGON;
            object = Object.assign({}, object, (_b = {}, _b['rings'] = rings, _b));
        }
    }
    var geometryReader = GEOMETRY_READERS[type];
    return Object(_Feature_js__WEBPACK_IMPORTED_MODULE_3__["transformGeometryWithOptions"])(geometryReader(object), false, opt_options);
}
/**
 * Determines inner and outer rings.
 * Checks if any polygons in this array contain any other polygons in this
 * array. It is used for checking for holes.
 * Logic inspired by: https://github.com/Esri/terraformer-arcgis-parser
 * @param {Array<!Array<!Array<number>>>} rings Rings.
 * @param {import("../geom/GeometryLayout.js").default} layout Geometry layout.
 * @return {Array<!Array<!Array<!Array<number>>>>} Transformed rings.
 */
function convertRings(rings, layout) {
    var flatRing = [];
    var outerRings = [];
    var holes = [];
    var i, ii;
    for (i = 0, ii = rings.length; i < ii; ++i) {
        flatRing.length = 0;
        Object(_geom_flat_deflate_js__WEBPACK_IMPORTED_MODULE_14__["deflateCoordinates"])(flatRing, 0, rings[i], layout.length);
        // is this ring an outer ring? is it clockwise?
        var clockwise = Object(_geom_flat_orient_js__WEBPACK_IMPORTED_MODULE_15__["linearRingIsClockwise"])(flatRing, 0, flatRing.length, layout.length);
        if (clockwise) {
            outerRings.push([rings[i]]);
        }
        else {
            holes.push(rings[i]);
        }
    }
    while (holes.length) {
        var hole = holes.shift();
        var matched = false;
        // loop over all outer rings and see if they contain our hole.
        for (i = outerRings.length - 1; i >= 0; i--) {
            var outerRing = outerRings[i][0];
            var containsHole = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsExtent"])(new _geom_LinearRing_js__WEBPACK_IMPORTED_MODULE_8__["default"](outerRing).getExtent(), new _geom_LinearRing_js__WEBPACK_IMPORTED_MODULE_8__["default"](hole).getExtent());
            if (containsHole) {
                // the hole is contained push it into our polygon
                outerRings[i].push(hole);
                matched = true;
                break;
            }
        }
        if (!matched) {
            // no outer rings contain this hole turn it into and outer
            // ring (reverse it)
            outerRings.push([hole.reverse()]);
        }
    }
    return outerRings;
}
/**
 * @param {EsriJSONPoint} object Object.
 * @return {import("../geom/Geometry.js").default} Point.
 */
function readPointGeometry(object) {
    var point;
    if (object.m !== undefined && object.z !== undefined) {
        point = new _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__["default"]([object.x, object.y, object.z, object.m], _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM);
    }
    else if (object.z !== undefined) {
        point = new _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__["default"]([object.x, object.y, object.z], _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ);
    }
    else if (object.m !== undefined) {
        point = new _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__["default"]([object.x, object.y, object.m], _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYM);
    }
    else {
        point = new _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__["default"]([object.x, object.y]);
    }
    return point;
}
/**
 * @param {EsriJSONPolyline} object Object.
 * @return {import("../geom/Geometry.js").default} LineString.
 */
function readLineStringGeometry(object) {
    var layout = getGeometryLayout(object);
    return new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_7__["default"](object.paths[0], layout);
}
/**
 * @param {EsriJSONPolyline} object Object.
 * @return {import("../geom/Geometry.js").default} MultiLineString.
 */
function readMultiLineStringGeometry(object) {
    var layout = getGeometryLayout(object);
    return new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_9__["default"](object.paths, layout);
}
/**
 * @param {EsriJSONHasZM} object Object.
 * @return {import("../geom/GeometryLayout.js").default} The geometry layout to use.
 */
function getGeometryLayout(object) {
    var layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XY;
    if (object.hasZ === true && object.hasM === true) {
        layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM;
    }
    else if (object.hasZ === true) {
        layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ;
    }
    else if (object.hasM === true) {
        layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYM;
    }
    return layout;
}
/**
 * @param {EsriJSONMultipoint} object Object.
 * @return {import("../geom/Geometry.js").default} MultiPoint.
 */
function readMultiPointGeometry(object) {
    var layout = getGeometryLayout(object);
    return new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_10__["default"](object.points, layout);
}
/**
 * @param {EsriJSONMultiPolygon} object Object.
 * @return {import("../geom/Geometry.js").default} MultiPolygon.
 */
function readMultiPolygonGeometry(object) {
    var layout = getGeometryLayout(object);
    return new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_11__["default"](object.rings, layout);
}
/**
 * @param {EsriJSONPolygon} object Object.
 * @return {import("../geom/Geometry.js").default} Polygon.
 */
function readPolygonGeometry(object) {
    var layout = getGeometryLayout(object);
    return new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_13__["default"](object.rings, layout);
}
/**
 * @param {import("../geom/Point.js").default} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {EsriJSONPoint} EsriJSON geometry.
 */
function writePointGeometry(geometry, opt_options) {
    var coordinates = geometry.getCoordinates();
    /** @type {EsriJSONPoint} */
    var esriJSON;
    var layout = geometry.getLayout();
    if (layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ) {
        esriJSON = {
            x: coordinates[0],
            y: coordinates[1],
            z: coordinates[2]
        };
    }
    else if (layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYM) {
        esriJSON = {
            x: coordinates[0],
            y: coordinates[1],
            m: coordinates[2]
        };
    }
    else if (layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM) {
        esriJSON = {
            x: coordinates[0],
            y: coordinates[1],
            z: coordinates[2],
            m: coordinates[3]
        };
    }
    else if (layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XY) {
        esriJSON = {
            x: coordinates[0],
            y: coordinates[1]
        };
    }
    else {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(false, 34); // Invalid geometry layout
    }
    return esriJSON;
}
/**
 * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
 * @return {Object} Object with boolean hasZ and hasM keys.
 */
function getHasZM(geometry) {
    var layout = geometry.getLayout();
    return {
        hasZ: (layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ ||
            layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM),
        hasM: (layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYM ||
            layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM)
    };
}
/**
 * @param {import("../geom/LineString.js").default} lineString Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {EsriJSONPolyline} EsriJSON geometry.
 */
function writeLineStringGeometry(lineString, opt_options) {
    var hasZM = getHasZM(lineString);
    return {
        hasZ: hasZM.hasZ,
        hasM: hasZM.hasM,
        paths: [
            /** @type {Array<EsriJSONPosition>} */ (lineString.getCoordinates())
        ]
    };
}
/**
 * @param {import("../geom/Polygon.js").default} polygon Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {EsriJSONPolygon} EsriJSON geometry.
 */
function writePolygonGeometry(polygon, opt_options) {
    // Esri geometries use the left-hand rule
    var hasZM = getHasZM(polygon);
    return {
        hasZ: hasZM.hasZ,
        hasM: hasZM.hasM,
        rings: /** @type {Array<Array<EsriJSONPosition>>} */ (polygon.getCoordinates(false))
    };
}
/**
 * @param {import("../geom/MultiLineString.js").default} multiLineString Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {EsriJSONPolyline} EsriJSON geometry.
 */
function writeMultiLineStringGeometry(multiLineString, opt_options) {
    var hasZM = getHasZM(multiLineString);
    return {
        hasZ: hasZM.hasZ,
        hasM: hasZM.hasM,
        paths: /** @type {Array<Array<EsriJSONPosition>>} */ (multiLineString.getCoordinates())
    };
}
/**
 * @param {import("../geom/MultiPoint.js").default} multiPoint Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {EsriJSONMultipoint} EsriJSON geometry.
 */
function writeMultiPointGeometry(multiPoint, opt_options) {
    var hasZM = getHasZM(multiPoint);
    return {
        hasZ: hasZM.hasZ,
        hasM: hasZM.hasM,
        points: /** @type {Array<EsriJSONPosition>} */ (multiPoint.getCoordinates())
    };
}
/**
 * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {EsriJSONPolygon} EsriJSON geometry.
 */
function writeMultiPolygonGeometry(geometry, opt_options) {
    var hasZM = getHasZM(geometry);
    var coordinates = geometry.getCoordinates(false);
    var output = [];
    for (var i = 0; i < coordinates.length; i++) {
        for (var x = coordinates[i].length - 1; x >= 0; x--) {
            output.push(coordinates[i][x]);
        }
    }
    return {
        hasZ: hasZM.hasZ,
        hasM: hasZM.hasM,
        rings: /** @type {Array<Array<EsriJSONPosition>>} */ (output)
    };
}
/**
 * @param {import("../geom/Geometry.js").default} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {EsriJSONGeometry} EsriJSON geometry.
 */
function writeGeometry(geometry, opt_options) {
    var geometryWriter = GEOMETRY_WRITERS[geometry.getType()];
    return geometryWriter(Object(_Feature_js__WEBPACK_IMPORTED_MODULE_3__["transformGeometryWithOptions"])(geometry, true, opt_options), opt_options);
}
/* harmony default export */ __webpack_exports__["default"] = (EsriJSON);
//# sourceMappingURL=EsriJSON.js.map

/***/ }),

/***/ "./node_modules/ol/format/Feature.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/format/Feature.js ***!
  \*******************************************/
/*! exports provided: default, transformGeometryWithOptions, transformExtentWithOptions */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformGeometryWithOptions", function() { return transformGeometryWithOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformExtentWithOptions", function() { return transformExtentWithOptions; });
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _proj_Units_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../proj/Units.js */ "./node_modules/ol/proj/Units.js");
/**
 * @module ol/format/Feature
 */




/**
 * @typedef {Object} ReadOptions
 * @property {import("../proj.js").ProjectionLike} [dataProjection] Projection of the data we are reading.
 * If not provided, the projection will be derived from the data (where possible) or
 * the `dataProjection` of the format is assigned (where set). If the projection
 * can not be derived from the data and if no `dataProjection` is set for a format,
 * the features will not be reprojected.
 * @property {import("../extent.js").Extent} [extent] Tile extent in map units of the tile being read.
 * This is only required when reading data with tile pixels as geometry units. When configured,
 * a `dataProjection` with `TILE_PIXELS` as `units` and the tile's pixel extent as `extent` needs to be
 * provided.
 * @property {import("../proj.js").ProjectionLike} [featureProjection] Projection of the feature geometries
 * created by the format reader. If not provided, features will be returned in the
 * `dataProjection`.
 */
/**
 * @typedef {Object} WriteOptions
 * @property {import("../proj.js").ProjectionLike} [dataProjection] Projection of the data we are writing.
 * If not provided, the `dataProjection` of the format is assigned (where set).
 * If no `dataProjection` is set for a format, the features will be returned
 * in the `featureProjection`.
 * @property {import("../proj.js").ProjectionLike} [featureProjection] Projection of the feature geometries
 * that will be serialized by the format writer. If not provided, geometries are assumed
 * to be in the `dataProjection` if that is set; in other words, they are not transformed.
 * @property {boolean} [rightHanded] When writing geometries, follow the right-hand
 * rule for linear ring orientation.  This means that polygons will have counter-clockwise
 * exterior rings and clockwise interior rings.  By default, coordinates are serialized
 * as they are provided at construction.  If `true`, the right-hand rule will
 * be applied.  If `false`, the left-hand rule will be applied (clockwise for
 * exterior and counter-clockwise for interior rings).  Note that not all
 * formats support this.  The GeoJSON format does use this property when writing
 * geometries.
 * @property {number} [decimals] Maximum number of decimal places for coordinates.
 * Coordinates are stored internally as floats, but floating-point arithmetic can create
 * coordinates with a large number of decimal places, not generally wanted on output.
 * Set a number here to round coordinates. Can also be used to ensure that
 * coordinates read in can be written back out with the same number of decimals.
 * Default is no rounding.
 */
/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Base class for feature formats.
 * {@link module:ol/format/Feature~FeatureFormat} subclasses provide the ability to decode and encode
 * {@link module:ol/Feature~Feature} objects from a variety of commonly used geospatial
 * file formats.  See the documentation for each format for more details.
 *
 * @abstract
 * @api
 */
var FeatureFormat = /** @class */ (function () {
    function FeatureFormat() {
        /**
         * @protected
         * @type {import("../proj/Projection.js").default}
         */
        this.dataProjection = null;
        /**
         * @protected
         * @type {import("../proj/Projection.js").default}
         */
        this.defaultFeatureProjection = null;
    }
    /**
     * Adds the data projection to the read options.
     * @param {Document|Node|Object|string} source Source.
     * @param {ReadOptions=} opt_options Options.
     * @return {ReadOptions|undefined} Options.
     * @protected
     */
    FeatureFormat.prototype.getReadOptions = function (source, opt_options) {
        var options;
        if (opt_options) {
            var dataProjection = opt_options.dataProjection ?
                Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["get"])(opt_options.dataProjection) : this.readProjection(source);
            if (opt_options.extent &&
                dataProjection && dataProjection.getUnits() === _proj_Units_js__WEBPACK_IMPORTED_MODULE_3__["default"].TILE_PIXELS) {
                dataProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["get"])(dataProjection);
                dataProjection.setWorldExtent(opt_options.extent);
            }
            options = {
                dataProjection: dataProjection,
                featureProjection: opt_options.featureProjection
            };
        }
        return this.adaptOptions(options);
    };
    /**
     * Sets the `dataProjection` on the options, if no `dataProjection`
     * is set.
     * @param {WriteOptions|ReadOptions|undefined} options
     *     Options.
     * @protected
     * @return {WriteOptions|ReadOptions|undefined}
     *     Updated options.
     */
    FeatureFormat.prototype.adaptOptions = function (options) {
        return Object(_obj_js__WEBPACK_IMPORTED_MODULE_0__["assign"])({
            dataProjection: this.dataProjection,
            featureProjection: this.defaultFeatureProjection
        }, options);
    };
    /**
     * @abstract
     * @return {import("./FormatType.js").default} Format.
     */
    FeatureFormat.prototype.getType = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["abstract"])();
    };
    /**
     * Read a single feature from a source.
     *
     * @abstract
     * @param {Document|Node|Object|string} source Source.
     * @param {ReadOptions=} opt_options Read options.
     * @return {import("../Feature.js").FeatureLike} Feature.
     */
    FeatureFormat.prototype.readFeature = function (source, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["abstract"])();
    };
    /**
     * Read all features from a source.
     *
     * @abstract
     * @param {Document|Node|ArrayBuffer|Object|string} source Source.
     * @param {ReadOptions=} opt_options Read options.
     * @return {Array<import("../Feature.js").FeatureLike>} Features.
     */
    FeatureFormat.prototype.readFeatures = function (source, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["abstract"])();
    };
    /**
     * Read a single geometry from a source.
     *
     * @abstract
     * @param {Document|Node|Object|string} source Source.
     * @param {ReadOptions=} opt_options Read options.
     * @return {import("../geom/Geometry.js").default} Geometry.
     */
    FeatureFormat.prototype.readGeometry = function (source, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["abstract"])();
    };
    /**
     * Read the projection from a source.
     *
     * @abstract
     * @param {Document|Node|Object|string} source Source.
     * @return {import("../proj/Projection.js").default} Projection.
     */
    FeatureFormat.prototype.readProjection = function (source) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["abstract"])();
    };
    /**
     * Encode a feature in this format.
     *
     * @abstract
     * @param {import("../Feature.js").default} feature Feature.
     * @param {WriteOptions=} opt_options Write options.
     * @return {string} Result.
     */
    FeatureFormat.prototype.writeFeature = function (feature, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["abstract"])();
    };
    /**
     * Encode an array of features in this format.
     *
     * @abstract
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {WriteOptions=} opt_options Write options.
     * @return {string} Result.
     */
    FeatureFormat.prototype.writeFeatures = function (features, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["abstract"])();
    };
    /**
     * Write a single geometry in this format.
     *
     * @abstract
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {WriteOptions=} opt_options Write options.
     * @return {string} Result.
     */
    FeatureFormat.prototype.writeGeometry = function (geometry, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["abstract"])();
    };
    return FeatureFormat;
}());
/* harmony default export */ __webpack_exports__["default"] = (FeatureFormat);
/**
 * @param {import("../geom/Geometry.js").default} geometry Geometry.
 * @param {boolean} write Set to true for writing, false for reading.
 * @param {(WriteOptions|ReadOptions)=} opt_options Options.
 * @return {import("../geom/Geometry.js").default} Transformed geometry.
 */
function transformGeometryWithOptions(geometry, write, opt_options) {
    var featureProjection = opt_options ? Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["get"])(opt_options.featureProjection) : null;
    var dataProjection = opt_options ? Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["get"])(opt_options.dataProjection) : null;
    var transformed;
    if (featureProjection && dataProjection && !Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["equivalent"])(featureProjection, dataProjection)) {
        transformed = (write ? geometry.clone() : geometry).transform(write ? featureProjection : dataProjection, write ? dataProjection : featureProjection);
    }
    else {
        transformed = geometry;
    }
    if (write && opt_options && /** @type {WriteOptions} */ (opt_options).decimals !== undefined) {
        var power_1 = Math.pow(10, /** @type {WriteOptions} */ (opt_options).decimals);
        // if decimals option on write, round each coordinate appropriately
        /**
         * @param {Array<number>} coordinates Coordinates.
         * @return {Array<number>} Transformed coordinates.
         */
        var transform = function (coordinates) {
            for (var i = 0, ii = coordinates.length; i < ii; ++i) {
                coordinates[i] = Math.round(coordinates[i] * power_1) / power_1;
            }
            return coordinates;
        };
        if (transformed === geometry) {
            transformed = geometry.clone();
        }
        transformed.applyTransform(transform);
    }
    return transformed;
}
/**
 * @param {import("../extent.js").Extent} extent Extent.
 * @param {ReadOptions=} opt_options Read options.
 * @return {import("../extent.js").Extent} Transformed extent.
 */
function transformExtentWithOptions(extent, opt_options) {
    var featureProjection = opt_options ? Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["get"])(opt_options.featureProjection) : null;
    var dataProjection = opt_options ? Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["get"])(opt_options.dataProjection) : null;
    if (featureProjection && dataProjection && !Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["equivalent"])(featureProjection, dataProjection)) {
        return Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["transformExtent"])(extent, dataProjection, featureProjection);
    }
    else {
        return extent;
    }
}
//# sourceMappingURL=Feature.js.map

/***/ }),

/***/ "./node_modules/ol/format/FormatType.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/format/FormatType.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/format/FormatType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    ARRAY_BUFFER: 'arraybuffer',
    JSON: 'json',
    TEXT: 'text',
    XML: 'xml'
});
//# sourceMappingURL=FormatType.js.map

/***/ }),

/***/ "./node_modules/ol/format/GML.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/GML.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _GML3_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./GML3.js */ "./node_modules/ol/format/GML3.js");
/**
 * @module ol/format/GML
 */

/**
 * @classdesc
 * Feature format for reading and writing data in the GML format
 * version 3.1.1.
 * Currently only supports GML 3.1.1 Simple Features profile.
 *
 * @param {import("./GMLBase.js").Options=} opt_options
 *     Optional configuration object.
 * @api
 */
var GML = _GML3_js__WEBPACK_IMPORTED_MODULE_0__["default"];
/**
 * Encode an array of features in GML 3.1.1 Simple Features.
 *
 * @function
 * @param {Array<import("../Feature.js").default>} features Features.
 * @param {import("./Feature.js").WriteOptions=} opt_options Options.
 * @return {string} Result.
 * @api
 */
GML.prototype.writeFeatures;
/**
 * Encode an array of features in the GML 3.1.1 format as an XML node.
 *
 * @function
 * @param {Array<import("../Feature.js").default>} features Features.
 * @param {import("./Feature.js").WriteOptions=} opt_options Options.
 * @return {Node} Node.
 * @api
 */
GML.prototype.writeFeaturesNode;
/* harmony default export */ __webpack_exports__["default"] = (GML);
//# sourceMappingURL=GML.js.map

/***/ }),

/***/ "./node_modules/ol/format/GML2.js":
/*!****************************************!*\
  !*** ./node_modules/ol/format/GML2.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _GMLBase_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GMLBase.js */ "./node_modules/ol/format/GMLBase.js");
/* harmony import */ var _xsd_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./xsd.js */ "./node_modules/ol/format/xsd.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/GML2
 */







/**
 * @const
 * @type {string}
 */
var schemaLocation = _GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["GMLNS"] + ' http://schemas.opengis.net/gml/2.1.2/feature.xsd';
/**
 * @const
 * @type {Object<string, string>}
 */
var MULTIGEOMETRY_TO_MEMBER_NODENAME = {
    'MultiLineString': 'lineStringMember',
    'MultiCurve': 'curveMember',
    'MultiPolygon': 'polygonMember',
    'MultiSurface': 'surfaceMember'
};
/**
 * @classdesc
 * Feature format for reading and writing data in the GML format,
 * version 2.1.2.
 *
 * @api
 */
var GML2 = /** @class */ (function (_super) {
    __extends(GML2, _super);
    /**
     * @param {import("./GMLBase.js").Options=} opt_options Optional configuration object.
     */
    function GML2(opt_options) {
        var _this = this;
        var options = /** @type {import("./GMLBase.js").Options} */ (opt_options ? opt_options : {});
        _this = _super.call(this, options) || this;
        _this.FEATURE_COLLECTION_PARSERS[_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["GMLNS"]]['featureMember'] =
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeArrayPusher"])(_this.readFeaturesInternal);
        /**
         * @inheritDoc
         */
        _this.schemaLocation = options.schemaLocation ?
            options.schemaLocation : schemaLocation;
        return _this;
    }
    /**
     * @param {Node} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<number>|undefined} Flat coordinates.
     */
    GML2.prototype.readFlatCoordinates_ = function (node, objectStack) {
        var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["getAllTextContent"])(node, false).replace(/^\s*|\s*$/g, '');
        var context = /** @type {import("../xml.js").NodeStackItem} */ (objectStack[0]);
        var containerSrs = context['srsName'];
        var axisOrientation = 'enu';
        if (containerSrs) {
            var proj = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])(containerSrs);
            if (proj) {
                axisOrientation = proj.getAxisOrientation();
            }
        }
        var coordsGroups = s.trim().split(/\s+/);
        var flatCoordinates = [];
        for (var i = 0, ii = coordsGroups.length; i < ii; i++) {
            var coords = coordsGroups[i].split(/,+/);
            var x = parseFloat(coords[0]);
            var y = parseFloat(coords[1]);
            var z = (coords.length === 3) ? parseFloat(coords[2]) : 0;
            if (axisOrientation.substr(0, 2) === 'en') {
                flatCoordinates.push(x, y, z);
            }
            else {
                flatCoordinates.push(y, x, z);
            }
        }
        return flatCoordinates;
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {import("../extent.js").Extent|undefined} Envelope.
     */
    GML2.prototype.readBox_ = function (node, objectStack) {
        /** @type {Array<number>} */
        var flatCoordinates = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushParseAndPop"])([null], this.BOX_PARSERS_, node, objectStack, this);
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createOrUpdate"])(flatCoordinates[1][0], flatCoordinates[1][1], flatCoordinates[1][3], flatCoordinates[1][4]);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GML2.prototype.innerBoundaryIsParser_ = function (node, objectStack) {
        /** @type {Array<number>|undefined} */
        var flatLinearRing = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushParseAndPop"])(undefined, this.RING_PARSERS, node, objectStack, this);
        if (flatLinearRing) {
            var flatLinearRings = /** @type {Array<Array<number>>} */ (objectStack[objectStack.length - 1]);
            flatLinearRings.push(flatLinearRing);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GML2.prototype.outerBoundaryIsParser_ = function (node, objectStack) {
        /** @type {Array<number>|undefined} */
        var flatLinearRing = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushParseAndPop"])(undefined, this.RING_PARSERS, node, objectStack, this);
        if (flatLinearRing) {
            var flatLinearRings = /** @type {Array<Array<number>>} */ (objectStack[objectStack.length - 1]);
            flatLinearRings[0] = flatLinearRing;
        }
    };
    /**
     * @const
     * @param {*} value Value.
     * @param {Array<*>} objectStack Object stack.
     * @param {string=} opt_nodeName Node name.
     * @return {Element|undefined} Node.
     * @private
     */
    GML2.prototype.GEOMETRY_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) {
        var context = objectStack[objectStack.length - 1];
        var multiSurface = context['multiSurface'];
        var surface = context['surface'];
        var multiCurve = context['multiCurve'];
        var nodeName;
        if (!Array.isArray(value)) {
            nodeName = /** @type {import("../geom/Geometry.js").default} */ (value).getType();
            if (nodeName === 'MultiPolygon' && multiSurface === true) {
                nodeName = 'MultiSurface';
            }
            else if (nodeName === 'Polygon' && surface === true) {
                nodeName = 'Surface';
            }
            else if (nodeName === 'MultiLineString' && multiCurve === true) {
                nodeName = 'MultiCurve';
            }
        }
        else {
            nodeName = 'Envelope';
        }
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])('http://www.opengis.net/gml', nodeName);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../Feature.js").default} feature Feature.
     * @param {Array<*>} objectStack Node stack.
     */
    GML2.prototype.writeFeatureElement = function (node, feature, objectStack) {
        var fid = feature.getId();
        if (fid) {
            node.setAttribute('fid', /** @type {string} */ (fid));
        }
        var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
        var featureNS = context['featureNS'];
        var geometryName = feature.getGeometryName();
        if (!context.serializers) {
            context.serializers = {};
            context.serializers[featureNS] = {};
        }
        var properties = feature.getProperties();
        var keys = [];
        var values = [];
        for (var key in properties) {
            var value = properties[key];
            if (value !== null) {
                keys.push(key);
                values.push(value);
                if (key == geometryName || typeof /** @type {?} */ (value).getSimplifiedGeometry === 'function') {
                    if (!(key in context.serializers[featureNS])) {
                        context.serializers[featureNS][key] = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(this.writeGeometryElement, this);
                    }
                }
                else {
                    if (!(key in context.serializers[featureNS])) {
                        context.serializers[featureNS][key] = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_3__["writeStringTextNode"]);
                    }
                }
            }
        }
        var item = Object(_obj_js__WEBPACK_IMPORTED_MODULE_4__["assign"])({}, context);
        item.node = node;
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ (item), context.serializers, Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeSimpleNodeFactory"])(undefined, featureNS), values, objectStack, keys);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/LineString.js").default} geometry LineString geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeCurveOrLineString_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var srsName = context['srsName'];
        if (node.nodeName !== 'LineStringSegment' && srsName) {
            node.setAttribute('srsName', srsName);
        }
        if (node.nodeName === 'LineString' ||
            node.nodeName === 'LineStringSegment') {
            var coordinates = this.createCoordinatesNode_(node.namespaceURI);
            node.appendChild(coordinates);
            this.writeCoordinates_(coordinates, geometry, objectStack);
        }
        else if (node.nodeName === 'Curve') {
            var segments = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])(node.namespaceURI, 'segments');
            node.appendChild(segments);
            this.writeCurveSegments_(segments, geometry, objectStack);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/LineString.js").default} line LineString geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeLineStringOrCurveMember_ = function (node, line, objectStack) {
        var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
        if (child) {
            node.appendChild(child);
            this.writeCurveOrLineString_(child, line, objectStack);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/MultiLineString.js").default} geometry MultiLineString geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeMultiCurveOrLineString_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        var curve = context['curve'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var lines = geometry.getLineStrings();
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushSerializeAndPop"])({ node: node, hasZ: hasZ, srsName: srsName, curve: curve }, this.LINESTRINGORCURVEMEMBER_SERIALIZERS_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, objectStack, undefined, this);
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/Geometry.js").default|import("../extent.js").Extent} geometry Geometry.
     * @param {Array<*>} objectStack Node stack.
     */
    GML2.prototype.writeGeometryElement = function (node, geometry, objectStack) {
        var context = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[objectStack.length - 1]);
        var item = Object(_obj_js__WEBPACK_IMPORTED_MODULE_4__["assign"])({}, context);
        item['node'] = node;
        var value;
        if (Array.isArray(geometry)) {
            value = Object(_Feature_js__WEBPACK_IMPORTED_MODULE_1__["transformExtentWithOptions"])(/** @type {import("../extent.js").Extent} */ (geometry), context);
        }
        else {
            value = Object(_Feature_js__WEBPACK_IMPORTED_MODULE_1__["transformGeometryWithOptions"])(/** @type {import("../geom/Geometry.js").default} */ (geometry), true, context);
        }
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ (item), this.GEOMETRY_SERIALIZERS_, this.GEOMETRY_NODE_FACTORY_, [value], objectStack, undefined, this);
    };
    /**
     * @param {string} namespaceURI XML namespace.
     * @returns {Element} coordinates node.
     * @private
     */
    GML2.prototype.createCoordinatesNode_ = function (namespaceURI) {
        var coordinates = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])(namespaceURI, 'coordinates');
        coordinates.setAttribute('decimal', '.');
        coordinates.setAttribute('cs', ',');
        coordinates.setAttribute('ts', ' ');
        return coordinates;
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/LineString.js").default|import("../geom/LinearRing.js").default} value Geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeCoordinates_ = function (node, value, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        // only 2d for simple features profile
        var points = value.getCoordinates();
        var len = points.length;
        var parts = new Array(len);
        for (var i = 0; i < len; ++i) {
            var point = points[i];
            parts[i] = this.getCoords_(point, srsName, hasZ);
        }
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_3__["writeStringTextNode"])(node, parts.join(' '));
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/LineString.js").default} line LineString geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeCurveSegments_ = function (node, line, objectStack) {
        var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])(node.namespaceURI, 'LineStringSegment');
        node.appendChild(child);
        this.writeCurveOrLineString_(child, line, objectStack);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/Polygon.js").default} geometry Polygon geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeSurfaceOrPolygon_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        if (node.nodeName !== 'PolygonPatch' && srsName) {
            node.setAttribute('srsName', srsName);
        }
        if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
            var rings = geometry.getLinearRings();
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushSerializeAndPop"])({ node: node, hasZ: hasZ, srsName: srsName }, this.RING_SERIALIZERS_, this.RING_NODE_FACTORY_, rings, objectStack, undefined, this);
        }
        else if (node.nodeName === 'Surface') {
            var patches = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])(node.namespaceURI, 'patches');
            node.appendChild(patches);
            this.writeSurfacePatches_(patches, geometry, objectStack);
        }
    };
    /**
     * @param {*} value Value.
     * @param {Array<*>} objectStack Object stack.
     * @param {string=} opt_nodeName Node name.
     * @return {Node} Node.
     * @private
     */
    GML2.prototype.RING_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) {
        var context = objectStack[objectStack.length - 1];
        var parentNode = context.node;
        var exteriorWritten = context['exteriorWritten'];
        if (exteriorWritten === undefined) {
            context['exteriorWritten'] = true;
        }
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])(parentNode.namespaceURI, exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs');
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/Polygon.js").default} polygon Polygon geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeSurfacePatches_ = function (node, polygon, objectStack) {
        var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])(node.namespaceURI, 'PolygonPatch');
        node.appendChild(child);
        this.writeSurfaceOrPolygon_(child, polygon, objectStack);
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/LinearRing.js").default} ring LinearRing geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeRing_ = function (node, ring, objectStack) {
        var linearRing = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])(node.namespaceURI, 'LinearRing');
        node.appendChild(linearRing);
        this.writeLinearRing_(linearRing, ring, objectStack);
    };
    /**
     * @param {Array<number>} point Point geometry.
     * @param {string=} opt_srsName Optional srsName
     * @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
     * @return {string} The coords string.
     * @private
     */
    GML2.prototype.getCoords_ = function (point, opt_srsName, opt_hasZ) {
        var axisOrientation = 'enu';
        if (opt_srsName) {
            axisOrientation = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])(opt_srsName).getAxisOrientation();
        }
        var coords = ((axisOrientation.substr(0, 2) === 'en') ?
            point[0] + ',' + point[1] :
            point[1] + ',' + point[0]);
        if (opt_hasZ) {
            // For newly created points, Z can be undefined.
            var z = point[2] || 0;
            coords += ',' + z;
        }
        return coords;
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/Point.js").default} geometry Point geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writePoint_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var coordinates = this.createCoordinatesNode_(node.namespaceURI);
        node.appendChild(coordinates);
        var point = geometry.getCoordinates();
        var coord = this.getCoords_(point, srsName, hasZ);
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_3__["writeStringTextNode"])(coordinates, coord);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/MultiPoint.js").default} geometry MultiPoint geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeMultiPoint_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var points = geometry.getPoints();
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushSerializeAndPop"])({ node: node, hasZ: hasZ, srsName: srsName }, this.POINTMEMBER_SERIALIZERS_, Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeSimpleNodeFactory"])('pointMember'), points, objectStack, undefined, this);
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/Point.js").default} point Point geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writePointMember_ = function (node, point, objectStack) {
        var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])(node.namespaceURI, 'Point');
        node.appendChild(child);
        this.writePoint_(child, point, objectStack);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/LinearRing.js").default} geometry LinearRing geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeLinearRing_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var srsName = context['srsName'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var coordinates = this.createCoordinatesNode_(node.namespaceURI);
        node.appendChild(coordinates);
        this.writeCoordinates_(coordinates, geometry, objectStack);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeMultiSurfaceOrPolygon_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        var surface = context['surface'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var polygons = geometry.getPolygons();
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushSerializeAndPop"])({ node: node, hasZ: hasZ, srsName: srsName, surface: surface }, this.SURFACEORPOLYGONMEMBER_SERIALIZERS_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, objectStack, undefined, this);
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/Polygon.js").default} polygon Polygon geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeSurfaceOrPolygonMember_ = function (node, polygon, objectStack) {
        var child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack);
        if (child) {
            node.appendChild(child);
            this.writeSurfaceOrPolygon_(child, polygon, objectStack);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML2.prototype.writeEnvelope = function (node, extent, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var srsName = context['srsName'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var keys = ['lowerCorner', 'upperCorner'];
        var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ ({ node: node }), this.ENVELOPE_SERIALIZERS_, _xml_js__WEBPACK_IMPORTED_MODULE_6__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, keys, this);
    };
    /**
     * @const
     * @param {*} value Value.
     * @param {Array<*>} objectStack Object stack.
     * @param {string=} opt_nodeName Node name.
     * @return {Node|undefined} Node.
     * @private
     */
    GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) {
        var parentNode = objectStack[objectStack.length - 1].node;
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["createElementNS"])('http://www.opengis.net/gml', MULTIGEOMETRY_TO_MEMBER_NODENAME[parentNode.nodeName]);
    };
    return GML2;
}(_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
    'http://www.opengis.net/gml': {
        'coordinates': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(GML2.prototype.readFlatCoordinates_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GML2.prototype.FLAT_LINEAR_RINGS_PARSERS = {
    'http://www.opengis.net/gml': {
        'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser_,
        'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser_
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML2.prototype.BOX_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'coordinates': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeArrayPusher"])(GML2.prototype.readFlatCoordinates_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GML2.prototype.GEOMETRY_PARSERS = {
    'http://www.opengis.net/gml': {
        'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.readPoint),
        'MultiPoint': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.readMultiPoint),
        'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.readLineString),
        'MultiLineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.readMultiLineString),
        'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.readLinearRing),
        'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.readPolygon),
        'MultiPolygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.readMultiPolygon),
        'Box': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeReplacer"])(GML2.prototype.readBox_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML2.prototype.GEOMETRY_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'Curve': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeCurveOrLineString_),
        'MultiCurve': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeMultiCurveOrLineString_),
        'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writePoint_),
        'MultiPoint': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeMultiPoint_),
        'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeCurveOrLineString_),
        'MultiLineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeMultiCurveOrLineString_),
        'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeLinearRing_),
        'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeSurfaceOrPolygon_),
        'MultiPolygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeMultiSurfaceOrPolygon_),
        'Surface': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeSurfaceOrPolygon_),
        'MultiSurface': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeMultiSurfaceOrPolygon_),
        'Envelope': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeEnvelope)
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'lineStringMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeLineStringOrCurveMember_),
        'curveMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeLineStringOrCurveMember_)
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML2.prototype.RING_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'outerBoundaryIs': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeRing_),
        'innerBoundaryIs': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeRing_)
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML2.prototype.POINTMEMBER_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'pointMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writePointMember_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'surfaceMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeSurfaceOrPolygonMember_),
        'polygonMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(GML2.prototype.writeSurfaceOrPolygonMember_)
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML2.prototype.ENVELOPE_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'lowerCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_3__["writeStringTextNode"]),
        'upperCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_6__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_3__["writeStringTextNode"])
    }
};
/* harmony default export */ __webpack_exports__["default"] = (GML2);
//# sourceMappingURL=GML2.js.map

/***/ }),

/***/ "./node_modules/ol/format/GML3.js":
/*!****************************************!*\
  !*** ./node_modules/ol/format/GML3.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _GMLBase_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GMLBase.js */ "./node_modules/ol/format/GMLBase.js");
/* harmony import */ var _xsd_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./xsd.js */ "./node_modules/ol/format/xsd.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/GML3
 */













/**
 * @const
 * @type {string}
 * @private
 */
var schemaLocation = _GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["GMLNS"] +
    ' http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' +
    '1.0.0/gmlsf.xsd';
/**
 * @const
 * @type {Object<string, string>}
 */
var MULTIGEOMETRY_TO_MEMBER_NODENAME = {
    'MultiLineString': 'lineStringMember',
    'MultiCurve': 'curveMember',
    'MultiPolygon': 'polygonMember',
    'MultiSurface': 'surfaceMember'
};
/**
 * @classdesc
 * Feature format for reading and writing data in the GML format
 * version 3.1.1.
 * Currently only supports GML 3.1.1 Simple Features profile.
 *
 * @api
 */
var GML3 = /** @class */ (function (_super) {
    __extends(GML3, _super);
    /**
     * @param {import("./GMLBase.js").Options=} opt_options Optional configuration object.
     */
    function GML3(opt_options) {
        var _this = this;
        var options = /** @type {import("./GMLBase.js").Options} */ (opt_options ? opt_options : {});
        _this = _super.call(this, options) || this;
        /**
         * @private
         * @type {boolean}
         */
        _this.surface_ = options.surface !== undefined ? options.surface : false;
        /**
         * @private
         * @type {boolean}
         */
        _this.curve_ = options.curve !== undefined ? options.curve : false;
        /**
         * @private
         * @type {boolean}
         */
        _this.multiCurve_ = options.multiCurve !== undefined ?
            options.multiCurve : true;
        /**
         * @private
         * @type {boolean}
         */
        _this.multiSurface_ = options.multiSurface !== undefined ?
            options.multiSurface : true;
        /**
         * @inheritDoc
         */
        _this.schemaLocation = options.schemaLocation ?
            options.schemaLocation : schemaLocation;
        /**
         * @private
         * @type {boolean}
         */
        _this.hasZ = options.hasZ !== undefined ?
            options.hasZ : false;
        return _this;
    }
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {MultiLineString|undefined} MultiLineString.
     */
    GML3.prototype.readMultiCurve_ = function (node, objectStack) {
        /** @type {Array<LineString>} */
        var lineStrings = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([], this.MULTICURVE_PARSERS_, node, objectStack, this);
        if (lineStrings) {
            var multiLineString = new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_7__["default"](lineStrings);
            return multiLineString;
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {MultiPolygon|undefined} MultiPolygon.
     */
    GML3.prototype.readMultiSurface_ = function (node, objectStack) {
        /** @type {Array<Polygon>} */
        var polygons = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([], this.MULTISURFACE_PARSERS_, node, objectStack, this);
        if (polygons) {
            return new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_8__["default"](polygons);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GML3.prototype.curveMemberParser_ = function (node, objectStack) {
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["parseNode"])(this.CURVEMEMBER_PARSERS_, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GML3.prototype.surfaceMemberParser_ = function (node, objectStack) {
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["parseNode"])(this.SURFACEMEMBER_PARSERS_, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<(Array<number>)>|undefined} flat coordinates.
     */
    GML3.prototype.readPatch_ = function (node, objectStack) {
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([null], this.PATCHES_PARSERS_, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<number>|undefined} flat coordinates.
     */
    GML3.prototype.readSegment_ = function (node, objectStack) {
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([null], this.SEGMENTS_PARSERS_, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<(Array<number>)>|undefined} flat coordinates.
     */
    GML3.prototype.readPolygonPatch_ = function (node, objectStack) {
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([null], this.FLAT_LINEAR_RINGS_PARSERS, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<number>|undefined} flat coordinates.
     */
    GML3.prototype.readLineStringSegment_ = function (node, objectStack) {
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([null], this.GEOMETRY_FLAT_COORDINATES_PARSERS, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GML3.prototype.interiorParser_ = function (node, objectStack) {
        /** @type {Array<number>|undefined} */
        var flatLinearRing = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])(undefined, this.RING_PARSERS, node, objectStack, this);
        if (flatLinearRing) {
            var flatLinearRings = /** @type {Array<Array<number>>} */ (objectStack[objectStack.length - 1]);
            flatLinearRings.push(flatLinearRing);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GML3.prototype.exteriorParser_ = function (node, objectStack) {
        /** @type {Array<number>|undefined} */
        var flatLinearRing = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])(undefined, this.RING_PARSERS, node, objectStack, this);
        if (flatLinearRing) {
            var flatLinearRings = /** @type {Array<Array<number>>} */ (objectStack[objectStack.length - 1]);
            flatLinearRings[0] = flatLinearRing;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Polygon|undefined} Polygon.
     */
    GML3.prototype.readSurface_ = function (node, objectStack) {
        /** @type {Array<Array<number>>} */
        var flatLinearRings = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([null], this.SURFACE_PARSERS_, node, objectStack, this);
        if (flatLinearRings && flatLinearRings[0]) {
            var flatCoordinates = flatLinearRings[0];
            var ends = [flatCoordinates.length];
            var i = void 0, ii = void 0;
            for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
                Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(flatCoordinates, flatLinearRings[i]);
                ends.push(flatCoordinates.length);
            }
            return new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_9__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ, ends);
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {LineString|undefined} LineString.
     */
    GML3.prototype.readCurve_ = function (node, objectStack) {
        /** @type {Array<number>} */
        var flatCoordinates = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([null], this.CURVE_PARSERS_, node, objectStack, this);
        if (flatCoordinates) {
            var lineString = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ);
            return lineString;
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {import("../extent.js").Extent|undefined} Envelope.
     */
    GML3.prototype.readEnvelope_ = function (node, objectStack) {
        /** @type {Array<number>} */
        var flatCoordinates = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushParseAndPop"])([null], this.ENVELOPE_PARSERS_, node, objectStack, this);
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createOrUpdate"])(flatCoordinates[1][0], flatCoordinates[1][1], flatCoordinates[2][0], flatCoordinates[2][1]);
    };
    /**
     * @param {Node} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<number>|undefined} Flat coordinates.
     */
    GML3.prototype.readFlatPos_ = function (node, objectStack) {
        var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["getAllTextContent"])(node, false);
        var re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/;
        /** @type {Array<number>} */
        var flatCoordinates = [];
        var m;
        while ((m = re.exec(s))) {
            flatCoordinates.push(parseFloat(m[1]));
            s = s.substr(m[0].length);
        }
        if (s !== '') {
            return undefined;
        }
        var context = objectStack[0];
        var containerSrs = context['srsName'];
        var axisOrientation = 'enu';
        if (containerSrs) {
            var proj = Object(_proj_js__WEBPACK_IMPORTED_MODULE_11__["get"])(containerSrs);
            axisOrientation = proj.getAxisOrientation();
        }
        if (axisOrientation === 'neu') {
            var i = void 0, ii = void 0;
            for (i = 0, ii = flatCoordinates.length; i < ii; i += 3) {
                var y = flatCoordinates[i];
                var x = flatCoordinates[i + 1];
                flatCoordinates[i] = x;
                flatCoordinates[i + 1] = y;
            }
        }
        var len = flatCoordinates.length;
        if (len == 2) {
            flatCoordinates.push(0);
        }
        if (len === 0) {
            return undefined;
        }
        return flatCoordinates;
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<number>|undefined} Flat coordinates.
     */
    GML3.prototype.readFlatPosList_ = function (node, objectStack) {
        var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["getAllTextContent"])(node, false).replace(/^\s*|\s*$/g, '');
        var context = objectStack[0];
        var containerSrs = context['srsName'];
        var contextDimension = context['srsDimension'];
        var axisOrientation = 'enu';
        if (containerSrs) {
            var proj = Object(_proj_js__WEBPACK_IMPORTED_MODULE_11__["get"])(containerSrs);
            axisOrientation = proj.getAxisOrientation();
        }
        var coords = s.split(/\s+/);
        // The "dimension" attribute is from the GML 3.0.1 spec.
        var dim = 2;
        if (node.getAttribute('srsDimension')) {
            dim = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeIntegerString"])(node.getAttribute('srsDimension'));
        }
        else if (node.getAttribute('dimension')) {
            dim = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeIntegerString"])(node.getAttribute('dimension'));
        }
        else if ( /** @type {Element} */(node.parentNode).getAttribute('srsDimension')) {
            dim = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeIntegerString"])(
            /** @type {Element} */ (node.parentNode).getAttribute('srsDimension'));
        }
        else if (contextDimension) {
            dim = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeIntegerString"])(contextDimension);
        }
        var x, y, z;
        var flatCoordinates = [];
        for (var i = 0, ii = coords.length; i < ii; i += dim) {
            x = parseFloat(coords[i]);
            y = parseFloat(coords[i + 1]);
            z = (dim === 3) ? parseFloat(coords[i + 2]) : 0;
            if (axisOrientation.substr(0, 2) === 'en') {
                flatCoordinates.push(x, y, z);
            }
            else {
                flatCoordinates.push(y, x, z);
            }
        }
        return flatCoordinates;
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/Point.js").default} value Point geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writePos_ = function (node, value, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsDimension = hasZ ? '3' : '2';
        node.setAttribute('srsDimension', srsDimension);
        var srsName = context['srsName'];
        var axisOrientation = 'enu';
        if (srsName) {
            axisOrientation = Object(_proj_js__WEBPACK_IMPORTED_MODULE_11__["get"])(srsName).getAxisOrientation();
        }
        var point = value.getCoordinates();
        var coords;
        // only 2d for simple features profile
        if (axisOrientation.substr(0, 2) === 'en') {
            coords = (point[0] + ' ' + point[1]);
        }
        else {
            coords = (point[1] + ' ' + point[0]);
        }
        if (hasZ) {
            // For newly created points, Z can be undefined.
            var z = point[2] || 0;
            coords += ' ' + z;
        }
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"])(node, coords);
    };
    /**
     * @param {Array<number>} point Point geometry.
     * @param {string=} opt_srsName Optional srsName
     * @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
     * @return {string} The coords string.
     * @private
     */
    GML3.prototype.getCoords_ = function (point, opt_srsName, opt_hasZ) {
        var axisOrientation = 'enu';
        if (opt_srsName) {
            axisOrientation = Object(_proj_js__WEBPACK_IMPORTED_MODULE_11__["get"])(opt_srsName).getAxisOrientation();
        }
        var coords = ((axisOrientation.substr(0, 2) === 'en') ?
            point[0] + ' ' + point[1] :
            point[1] + ' ' + point[0]);
        if (opt_hasZ) {
            // For newly created points, Z can be undefined.
            var z = point[2] || 0;
            coords += ' ' + z;
        }
        return coords;
    };
    /**
     * @param {Element} node Node.
     * @param {LineString|import("../geom/LinearRing.js").default} value Geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writePosList_ = function (node, value, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsDimension = hasZ ? '3' : '2';
        node.setAttribute('srsDimension', srsDimension);
        var srsName = context['srsName'];
        // only 2d for simple features profile
        var points = value.getCoordinates();
        var len = points.length;
        var parts = new Array(len);
        var point;
        for (var i = 0; i < len; ++i) {
            point = points[i];
            parts[i] = this.getCoords_(point, srsName, hasZ);
        }
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"])(node, parts.join(' '));
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/Point.js").default} geometry Point geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writePoint_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var srsName = context['srsName'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var pos = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'pos');
        node.appendChild(pos);
        this.writePos_(pos, geometry, objectStack);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {Array<*>} objectStack Node stack.
     */
    GML3.prototype.writeEnvelope = function (node, extent, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var srsName = context['srsName'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var keys = ['lowerCorner', 'upperCorner'];
        var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ ({ node: node }), this.ENVELOPE_SERIALIZERS_, _xml_js__WEBPACK_IMPORTED_MODULE_12__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, keys, this);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/LinearRing.js").default} geometry LinearRing geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeLinearRing_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var srsName = context['srsName'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var posList = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'posList');
        node.appendChild(posList);
        this.writePosList_(posList, geometry, objectStack);
    };
    /**
     * @param {*} value Value.
     * @param {Array<*>} objectStack Object stack.
     * @param {string=} opt_nodeName Node name.
     * @return {Node} Node.
     * @private
     */
    GML3.prototype.RING_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) {
        var context = objectStack[objectStack.length - 1];
        var parentNode = context.node;
        var exteriorWritten = context['exteriorWritten'];
        if (exteriorWritten === undefined) {
            context['exteriorWritten'] = true;
        }
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(parentNode.namespaceURI, exteriorWritten !== undefined ? 'interior' : 'exterior');
    };
    /**
     * @param {Element} node Node.
     * @param {Polygon} geometry Polygon geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeSurfaceOrPolygon_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        if (node.nodeName !== 'PolygonPatch' && srsName) {
            node.setAttribute('srsName', srsName);
        }
        if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
            var rings = geometry.getLinearRings();
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushSerializeAndPop"])({ node: node, hasZ: hasZ, srsName: srsName }, this.RING_SERIALIZERS_, this.RING_NODE_FACTORY_, rings, objectStack, undefined, this);
        }
        else if (node.nodeName === 'Surface') {
            var patches = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'patches');
            node.appendChild(patches);
            this.writeSurfacePatches_(patches, geometry, objectStack);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {LineString} geometry LineString geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeCurveOrLineString_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var srsName = context['srsName'];
        if (node.nodeName !== 'LineStringSegment' && srsName) {
            node.setAttribute('srsName', srsName);
        }
        if (node.nodeName === 'LineString' ||
            node.nodeName === 'LineStringSegment') {
            var posList = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'posList');
            node.appendChild(posList);
            this.writePosList_(posList, geometry, objectStack);
        }
        else if (node.nodeName === 'Curve') {
            var segments = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'segments');
            node.appendChild(segments);
            this.writeCurveSegments_(segments, geometry, objectStack);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {MultiPolygon} geometry MultiPolygon geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeMultiSurfaceOrPolygon_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        var surface = context['surface'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var polygons = geometry.getPolygons();
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushSerializeAndPop"])({ node: node, hasZ: hasZ, srsName: srsName, surface: surface }, this.SURFACEORPOLYGONMEMBER_SERIALIZERS_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, objectStack, undefined, this);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../geom/MultiPoint.js").default} geometry MultiPoint geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeMultiPoint_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var srsName = context['srsName'];
        var hasZ = context['hasZ'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var points = geometry.getPoints();
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushSerializeAndPop"])({ node: node, hasZ: hasZ, srsName: srsName }, this.POINTMEMBER_SERIALIZERS_, Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeSimpleNodeFactory"])('pointMember'), points, objectStack, undefined, this);
    };
    /**
     * @param {Element} node Node.
     * @param {MultiLineString} geometry MultiLineString geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeMultiCurveOrLineString_ = function (node, geometry, objectStack) {
        var context = objectStack[objectStack.length - 1];
        var hasZ = context['hasZ'];
        var srsName = context['srsName'];
        var curve = context['curve'];
        if (srsName) {
            node.setAttribute('srsName', srsName);
        }
        var lines = geometry.getLineStrings();
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushSerializeAndPop"])({ node: node, hasZ: hasZ, srsName: srsName, curve: curve }, this.LINESTRINGORCURVEMEMBER_SERIALIZERS_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, objectStack, undefined, this);
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/LinearRing.js").default} ring LinearRing geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeRing_ = function (node, ring, objectStack) {
        var linearRing = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'LinearRing');
        node.appendChild(linearRing);
        this.writeLinearRing_(linearRing, ring, objectStack);
    };
    /**
     * @param {Node} node Node.
     * @param {Polygon} polygon Polygon geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeSurfaceOrPolygonMember_ = function (node, polygon, objectStack) {
        var child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack);
        if (child) {
            node.appendChild(child);
            this.writeSurfaceOrPolygon_(child, polygon, objectStack);
        }
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/Point.js").default} point Point geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writePointMember_ = function (node, point, objectStack) {
        var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'Point');
        node.appendChild(child);
        this.writePoint_(child, point, objectStack);
    };
    /**
     * @param {Node} node Node.
     * @param {LineString} line LineString geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeLineStringOrCurveMember_ = function (node, line, objectStack) {
        var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
        if (child) {
            node.appendChild(child);
            this.writeCurveOrLineString_(child, line, objectStack);
        }
    };
    /**
     * @param {Node} node Node.
     * @param {Polygon} polygon Polygon geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeSurfacePatches_ = function (node, polygon, objectStack) {
        var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'PolygonPatch');
        node.appendChild(child);
        this.writeSurfaceOrPolygon_(child, polygon, objectStack);
    };
    /**
     * @param {Node} node Node.
     * @param {LineString} line LineString geometry.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeCurveSegments_ = function (node, line, objectStack) {
        var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(node.namespaceURI, 'LineStringSegment');
        node.appendChild(child);
        this.writeCurveOrLineString_(child, line, objectStack);
    };
    /**
     * @param {Node} node Node.
     * @param {import("../geom/Geometry.js").default|import("../extent.js").Extent} geometry Geometry.
     * @param {Array<*>} objectStack Node stack.
     */
    GML3.prototype.writeGeometryElement = function (node, geometry, objectStack) {
        var context = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[objectStack.length - 1]);
        var item = Object(_obj_js__WEBPACK_IMPORTED_MODULE_10__["assign"])({}, context);
        item['node'] = node;
        var value;
        if (Array.isArray(geometry)) {
            value = Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformExtentWithOptions"])(/** @type {import("../extent.js").Extent} */ (geometry), context);
        }
        else {
            value = Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(/** @type {import("../geom/Geometry.js").default} */ (geometry), true, context);
        }
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ (item), this.GEOMETRY_SERIALIZERS_, this.GEOMETRY_NODE_FACTORY_, [value], objectStack, undefined, this);
    };
    /**
     * @param {Element} node Node.
     * @param {import("../Feature.js").default} feature Feature.
     * @param {Array<*>} objectStack Node stack.
     */
    GML3.prototype.writeFeatureElement = function (node, feature, objectStack) {
        var fid = feature.getId();
        if (fid) {
            node.setAttribute('fid', /** @type {string} */ (fid));
        }
        var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
        var featureNS = context['featureNS'];
        var geometryName = feature.getGeometryName();
        if (!context.serializers) {
            context.serializers = {};
            context.serializers[featureNS] = {};
        }
        var properties = feature.getProperties();
        var keys = [];
        var values = [];
        for (var key in properties) {
            var value = properties[key];
            if (value !== null) {
                keys.push(key);
                values.push(value);
                if (key == geometryName || typeof /** @type {?} */ (value).getSimplifiedGeometry === 'function') {
                    if (!(key in context.serializers[featureNS])) {
                        context.serializers[featureNS][key] = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(this.writeGeometryElement, this);
                    }
                }
                else {
                    if (!(key in context.serializers[featureNS])) {
                        context.serializers[featureNS][key] = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]);
                    }
                }
            }
        }
        var item = Object(_obj_js__WEBPACK_IMPORTED_MODULE_10__["assign"])({}, context);
        item.node = node;
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ (item), context.serializers, Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeSimpleNodeFactory"])(undefined, featureNS), values, objectStack, keys);
    };
    /**
     * @param {Node} node Node.
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {Array<*>} objectStack Node stack.
     * @private
     */
    GML3.prototype.writeFeatureMembers_ = function (node, features, objectStack) {
        var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
        var featureType = context['featureType'];
        var featureNS = context['featureNS'];
        /** @type {Object<string, Object<string, import("../xml.js").Serializer>>} */
        var serializers = {};
        serializers[featureNS] = {};
        serializers[featureNS][featureType] = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(this.writeFeatureElement, this);
        var item = Object(_obj_js__WEBPACK_IMPORTED_MODULE_10__["assign"])({}, context);
        item.node = node;
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ (item), serializers, Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeSimpleNodeFactory"])(featureType, featureNS), features, objectStack);
    };
    /**
     * @const
     * @param {*} value Value.
     * @param {Array<*>} objectStack Object stack.
     * @param {string=} opt_nodeName Node name.
     * @return {Node|undefined} Node.
     * @private
     */
    GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) {
        var parentNode = objectStack[objectStack.length - 1].node;
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(this.namespace, MULTIGEOMETRY_TO_MEMBER_NODENAME[parentNode.nodeName]);
    };
    /**
     * @const
     * @param {*} value Value.
     * @param {Array<*>} objectStack Object stack.
     * @param {string=} opt_nodeName Node name.
     * @return {Element|undefined} Node.
     * @private
     */
    GML3.prototype.GEOMETRY_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) {
        var context = objectStack[objectStack.length - 1];
        var multiSurface = context['multiSurface'];
        var surface = context['surface'];
        var curve = context['curve'];
        var multiCurve = context['multiCurve'];
        var nodeName;
        if (!Array.isArray(value)) {
            nodeName = /** @type {import("../geom/Geometry.js").default} */ (value).getType();
            if (nodeName === 'MultiPolygon' && multiSurface === true) {
                nodeName = 'MultiSurface';
            }
            else if (nodeName === 'Polygon' && surface === true) {
                nodeName = 'Surface';
            }
            else if (nodeName === 'LineString' && curve === true) {
                nodeName = 'Curve';
            }
            else if (nodeName === 'MultiLineString' && multiCurve === true) {
                nodeName = 'MultiCurve';
            }
        }
        else {
            nodeName = 'Envelope';
        }
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(this.namespace, nodeName);
    };
    /**
     * Encode a geometry in GML 3.1.1 Simple Features.
     *
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {import("./Feature.js").WriteOptions=} opt_options Options.
     * @return {Node} Node.
     * @override
     * @api
     */
    GML3.prototype.writeGeometryNode = function (geometry, opt_options) {
        opt_options = this.adaptOptions(opt_options);
        var geom = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(this.namespace, 'geom');
        var context = { node: geom, hasZ: this.hasZ, srsName: this.srsName,
            curve: this.curve_, surface: this.surface_,
            multiSurface: this.multiSurface_, multiCurve: this.multiCurve_ };
        if (opt_options) {
            Object(_obj_js__WEBPACK_IMPORTED_MODULE_10__["assign"])(context, opt_options);
        }
        this.writeGeometryElement(geom, geometry, [context]);
        return geom;
    };
    /**
     * Encode an array of features in the GML 3.1.1 format as an XML node.
     *
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Options.
     * @return {Element} Node.
     * @override
     * @api
     */
    GML3.prototype.writeFeaturesNode = function (features, opt_options) {
        opt_options = this.adaptOptions(opt_options);
        var node = Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["createElementNS"])(this.namespace, 'featureMembers');
        node.setAttributeNS(_xml_js__WEBPACK_IMPORTED_MODULE_12__["XML_SCHEMA_INSTANCE_URI"], 'xsi:schemaLocation', this.schemaLocation);
        var context = {
            srsName: this.srsName,
            hasZ: this.hasZ,
            curve: this.curve_,
            surface: this.surface_,
            multiSurface: this.multiSurface_,
            multiCurve: this.multiCurve_,
            featureNS: this.featureNS,
            featureType: this.featureType
        };
        if (opt_options) {
            Object(_obj_js__WEBPACK_IMPORTED_MODULE_10__["assign"])(context, opt_options);
        }
        this.writeFeatureMembers_(node, features, [context]);
        return node;
    };
    return GML3;
}(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
    'http://www.opengis.net/gml': {
        'pos': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readFlatPos_),
        'posList': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readFlatPosList_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GML3.prototype.FLAT_LINEAR_RINGS_PARSERS = {
    'http://www.opengis.net/gml': {
        'interior': GML3.prototype.interiorParser_,
        'exterior': GML3.prototype.exteriorParser_
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GML3.prototype.GEOMETRY_PARSERS = {
    'http://www.opengis.net/gml': {
        'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readPoint),
        'MultiPoint': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readMultiPoint),
        'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readLineString),
        'MultiLineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readMultiLineString),
        'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readLinearRing),
        'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readPolygon),
        'MultiPolygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readMultiPolygon),
        'Surface': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readSurface_),
        'MultiSurface': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readMultiSurface_),
        'Curve': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readCurve_),
        'MultiCurve': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readMultiCurve_),
        'Envelope': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readEnvelope_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.MULTICURVE_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'curveMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(GML3.prototype.curveMemberParser_),
        'curveMembers': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(GML3.prototype.curveMemberParser_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.MULTISURFACE_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'surfaceMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(GML3.prototype.surfaceMemberParser_),
        'surfaceMembers': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(GML3.prototype.surfaceMemberParser_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.CURVEMEMBER_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readLineString),
        'Curve': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(GML3.prototype.readCurve_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.SURFACEMEMBER_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readPolygon),
        'Surface': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(GML3.prototype.readSurface_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.SURFACE_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'patches': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readPatch_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.CURVE_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'segments': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readSegment_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.ENVELOPE_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'lowerCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(GML3.prototype.readFlatPosList_),
        'upperCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeArrayPusher"])(GML3.prototype.readFlatPosList_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.PATCHES_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'PolygonPatch': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readPolygonPatch_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GML3.prototype.SEGMENTS_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'LineStringSegment': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeReplacer"])(GML3.prototype.readLineStringSegment_)
    }
};
/**
 * Encode an array of features in GML 3.1.1 Simple Features.
 *
 * @function
 * @param {Array<import("../Feature.js").default>} features Features.
 * @param {import("./Feature.js").WriteOptions=} opt_options Options.
 * @return {string} Result.
 * @api
 */
GML3.prototype.writeFeatures;
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML3.prototype.RING_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'exterior': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeRing_),
        'interior': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeRing_)
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML3.prototype.ENVELOPE_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'lowerCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
        'upperCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"])
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'surfaceMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeSurfaceOrPolygonMember_),
        'polygonMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeSurfaceOrPolygonMember_)
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML3.prototype.POINTMEMBER_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'pointMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writePointMember_)
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'lineStringMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeLineStringOrCurveMember_),
        'curveMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeLineStringOrCurveMember_)
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 * @private
 */
GML3.prototype.GEOMETRY_SERIALIZERS_ = {
    'http://www.opengis.net/gml': {
        'Curve': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeCurveOrLineString_),
        'MultiCurve': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeMultiCurveOrLineString_),
        'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writePoint_),
        'MultiPoint': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeMultiPoint_),
        'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeCurveOrLineString_),
        'MultiLineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeMultiCurveOrLineString_),
        'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeLinearRing_),
        'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeSurfaceOrPolygon_),
        'MultiPolygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeMultiSurfaceOrPolygon_),
        'Surface': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeSurfaceOrPolygon_),
        'MultiSurface': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeMultiSurfaceOrPolygon_),
        'Envelope': Object(_xml_js__WEBPACK_IMPORTED_MODULE_12__["makeChildAppender"])(GML3.prototype.writeEnvelope)
    }
};
/* harmony default export */ __webpack_exports__["default"] = (GML3);
//# sourceMappingURL=GML3.js.map

/***/ }),

/***/ "./node_modules/ol/format/GMLBase.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/format/GMLBase.js ***!
  \*******************************************/
/*! exports provided: GMLNS, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GMLNS", function() { return GMLNS; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _XMLFeature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./XMLFeature.js */ "./node_modules/ol/format/XMLFeature.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_LinearRing_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/LinearRing.js */ "./node_modules/ol/geom/LinearRing.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/GMLBase
 */
// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part
// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect
// envelopes/extents, only geometries!















/**
 * @const
 * @type {string}
 */
var GMLNS = 'http://www.opengis.net/gml';
/**
 * A regular expression that matches if a string only contains whitespace
 * characters. It will e.g. match `''`, `' '`, `'\n'` etc. The non-breaking
 * space (0xa0) is explicitly included as IE doesn't include it in its
 * definition of `\s`.
 *
 * Information from `goog.string.isEmptyOrWhitespace`: https://github.com/google/closure-library/blob/e877b1e/closure/goog/string/string.js#L156-L160
 *
 * @const
 * @type {RegExp}
 */
var ONLY_WHITESPACE_RE = /^[\s\xa0]*$/;
/**
 * @typedef {Object} Options
 * @property {Object<string, string>|string} [featureNS] Feature
 * namespace. If not defined will be derived from GML. If multiple
 * feature types have been configured which come from different feature
 * namespaces, this will be an object with the keys being the prefixes used
 * in the entries of featureType array. The values of the object will be the
 * feature namespaces themselves. So for instance there might be a featureType
 * item `topp:states` in the `featureType` array and then there will be a key
 * `topp` in the featureNS object with value `http://www.openplans.org/topp`.
 * @property {Array<string>|string} [featureType] Feature type(s) to parse.
 * If multiple feature types need to be configured
 * which come from different feature namespaces, `featureNS` will be an object
 * with the keys being the prefixes used in the entries of featureType array.
 * The values of the object will be the feature namespaces themselves.
 * So for instance there might be a featureType item `topp:states` and then
 * there will be a key named `topp` in the featureNS object with value
 * `http://www.openplans.org/topp`.
 * @property {string} srsName srsName to use when writing geometries.
 * @property {boolean} [surface=false] Write gml:Surface instead of gml:Polygon
 * elements. This also affects the elements in multi-part geometries.
 * @property {boolean} [curve=false] Write gml:Curve instead of gml:LineString
 * elements. This also affects the elements in multi-part geometries.
 * @property {boolean} [multiCurve=true] Write gml:MultiCurve instead of gml:MultiLineString.
 * Since the latter is deprecated in GML 3.
 * @property {boolean} [multiSurface=true] Write gml:multiSurface instead of
 * gml:MultiPolygon. Since the latter is deprecated in GML 3.
 * @property {string} [schemaLocation] Optional schemaLocation to use when
 * writing out the GML, this will override the default provided.
 * @property {boolean} [hasZ=false] If coordinates have a Z value.
 */
/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Feature base format for reading and writing data in the GML format.
 * This class cannot be instantiated, it contains only base content that
 * is shared with versioned format classes GML2 and GML3.
 *
 * @abstract
 */
var GMLBase = /** @class */ (function (_super) {
    __extends(GMLBase, _super);
    /**
     * @param {Options=} opt_options Optional configuration object.
     */
    function GMLBase(opt_options) {
        var _this = _super.call(this) || this;
        var options = /** @type {Options} */ (opt_options ? opt_options : {});
        /**
         * @protected
         * @type {Array<string>|string|undefined}
         */
        _this.featureType = options.featureType;
        /**
         * @protected
         * @type {Object<string, string>|string|undefined}
         */
        _this.featureNS = options.featureNS;
        /**
         * @protected
         * @type {string}
         */
        _this.srsName = options.srsName;
        /**
         * @protected
         * @type {string}
         */
        _this.schemaLocation = '';
        /**
         * @type {Object<string, Object<string, Object>>}
         */
        _this.FEATURE_COLLECTION_PARSERS = {};
        _this.FEATURE_COLLECTION_PARSERS[_this.namespace] = {
            'featureMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(_this.readFeaturesInternal),
            'featureMembers': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeReplacer"])(_this.readFeaturesInternal)
        };
        return _this;
    }
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {Array<Feature> | undefined} Features.
     */
    GMLBase.prototype.readFeaturesInternal = function (node, objectStack) {
        var localName = node.localName;
        var features = null;
        if (localName == 'FeatureCollection') {
            features = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])([], this.FEATURE_COLLECTION_PARSERS, node, objectStack, this);
        }
        else if (localName == 'featureMembers' || localName == 'featureMember') {
            var context = objectStack[0];
            var featureType = context['featureType'];
            var featureNS = context['featureNS'];
            var prefix = 'p';
            var defaultPrefix = 'p0';
            if (!featureType && node.childNodes) {
                featureType = [], featureNS = {};
                for (var i = 0, ii = node.childNodes.length; i < ii; ++i) {
                    var child = node.childNodes[i];
                    if (child.nodeType === 1) {
                        var ft = child.nodeName.split(':').pop();
                        if (featureType.indexOf(ft) === -1) {
                            var key = '';
                            var count = 0;
                            var uri = child.namespaceURI;
                            for (var candidate in featureNS) {
                                if (featureNS[candidate] === uri) {
                                    key = candidate;
                                    break;
                                }
                                ++count;
                            }
                            if (!key) {
                                key = prefix + count;
                                featureNS[key] = uri;
                            }
                            featureType.push(key + ':' + ft);
                        }
                    }
                }
                if (localName != 'featureMember') {
                    // recheck featureType for each featureMember
                    context['featureType'] = featureType;
                    context['featureNS'] = featureNS;
                }
            }
            if (typeof featureNS === 'string') {
                var ns = featureNS;
                featureNS = {};
                featureNS[defaultPrefix] = ns;
            }
            /** @type {Object<string, Object<string, import("../xml.js").Parser>>} */
            var parsersNS = {};
            var featureTypes = Array.isArray(featureType) ? featureType : [featureType];
            for (var p in featureNS) {
                /** @type {Object<string, import("../xml.js").Parser>} */
                var parsers = {};
                for (var i = 0, ii = featureTypes.length; i < ii; ++i) {
                    var featurePrefix = featureTypes[i].indexOf(':') === -1 ?
                        defaultPrefix : featureTypes[i].split(':')[0];
                    if (featurePrefix === p) {
                        parsers[featureTypes[i].split(':').pop()] =
                            (localName == 'featureMembers') ?
                                Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(this.readFeatureElement, this) :
                                Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeReplacer"])(this.readFeatureElement, this);
                    }
                }
                parsersNS[featureNS[p]] = parsers;
            }
            if (localName == 'featureMember') {
                features = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])(undefined, parsersNS, node, objectStack);
            }
            else {
                features = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])([], parsersNS, node, objectStack);
            }
        }
        if (features === null) {
            features = [];
        }
        return features;
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {import("../geom/Geometry.js").default|import("../extent.js").Extent|undefined} Geometry.
     */
    GMLBase.prototype.readGeometryElement = function (node, objectStack) {
        var context = /** @type {Object} */ (objectStack[0]);
        context['srsName'] = node.firstElementChild.getAttribute('srsName');
        context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension');
        var geometry = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])(null, this.GEOMETRY_PARSERS, node, objectStack, this);
        if (geometry) {
            if (Array.isArray(geometry)) {
                return Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformExtentWithOptions"])(/** @type {import("../extent.js").Extent} */ (geometry), context);
            }
            else {
                return Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(/** @type {import("../geom/Geometry.js").default} */ (geometry), false, context);
            }
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @param {boolean} asFeature whether result should be wrapped as a feature.
     * @return {Feature|Object} Feature
     */
    GMLBase.prototype.readFeatureElementInternal = function (node, objectStack, asFeature) {
        var geometryName;
        var values = {};
        for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
            var value = void 0;
            var localName = n.localName;
            // first, check if it is simple attribute
            if (n.childNodes.length === 0
                || (n.childNodes.length === 1 && (n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) {
                value = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["getAllTextContent"])(n, false);
                if (ONLY_WHITESPACE_RE.test(value)) {
                    value = undefined;
                }
            }
            else {
                if (asFeature) {
                    //if feature, try it as a geometry
                    value = this.readGeometryElement(n, objectStack);
                }
                if (!value) { //if not a geometry or not a feature, treat it as a complex attribute
                    value = this.readFeatureElementInternal(n, objectStack, false);
                }
                else if (localName !== 'boundedBy') {
                    // boundedBy is an extent and must not be considered as a geometry
                    geometryName = localName;
                }
            }
            if (values[localName]) {
                if (!(values[localName] instanceof Array)) {
                    values[localName] = [values[localName]];
                }
                values[localName].push(value);
            }
            else {
                values[localName] = value;
            }
            var len = n.attributes.length;
            if (len > 0) {
                values[localName] = { _content_: values[localName] };
                for (var i = 0; i < len; i++) {
                    var attName = n.attributes[i].name;
                    values[localName][attName] = n.attributes[i].value;
                }
            }
        }
        if (!asFeature) {
            return values;
        }
        else {
            var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"](values);
            if (geometryName) {
                feature.setGeometryName(geometryName);
            }
            var fid = node.getAttribute('fid') ||
                Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["getAttributeNS"])(node, this.namespace, 'id');
            if (fid) {
                feature.setId(fid);
            }
            return feature;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {Feature} Feature.
     */
    GMLBase.prototype.readFeatureElement = function (node, objectStack) {
        return this.readFeatureElementInternal(node, objectStack, true);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {Point|undefined} Point.
     */
    GMLBase.prototype.readPoint = function (node, objectStack) {
        var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack);
        if (flatCoordinates) {
            return new _geom_Point_js__WEBPACK_IMPORTED_MODULE_10__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XYZ);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {MultiPoint|undefined} MultiPoint.
     */
    GMLBase.prototype.readMultiPoint = function (node, objectStack) {
        /** @type {Array<Array<number>>} */
        var coordinates = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])([], this.MULTIPOINT_PARSERS_, node, objectStack, this);
        if (coordinates) {
            return new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_8__["default"](coordinates);
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {MultiLineString|undefined} MultiLineString.
     */
    GMLBase.prototype.readMultiLineString = function (node, objectStack) {
        /** @type {Array<LineString>} */
        var lineStrings = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])([], this.MULTILINESTRING_PARSERS_, node, objectStack, this);
        if (lineStrings) {
            return new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_7__["default"](lineStrings);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {MultiPolygon|undefined} MultiPolygon.
     */
    GMLBase.prototype.readMultiPolygon = function (node, objectStack) {
        /** @type {Array<Polygon>} */
        var polygons = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])([], this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
        if (polygons) {
            return new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_9__["default"](polygons);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GMLBase.prototype.pointMemberParser_ = function (node, objectStack) {
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["parseNode"])(this.POINTMEMBER_PARSERS_, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GMLBase.prototype.lineStringMemberParser_ = function (node, objectStack) {
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["parseNode"])(this.LINESTRINGMEMBER_PARSERS_, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    GMLBase.prototype.polygonMemberParser_ = function (node, objectStack) {
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["parseNode"])(this.POLYGONMEMBER_PARSERS_, node, objectStack, this);
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {LineString|undefined} LineString.
     */
    GMLBase.prototype.readLineString = function (node, objectStack) {
        var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack);
        if (flatCoordinates) {
            var lineString = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_5__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XYZ);
            return lineString;
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<number>|undefined} LinearRing flat coordinates.
     */
    GMLBase.prototype.readFlatLinearRing_ = function (node, objectStack) {
        var ring = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS, node, objectStack, this);
        if (ring) {
            return ring;
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {LinearRing|undefined} LinearRing.
     */
    GMLBase.prototype.readLinearRing = function (node, objectStack) {
        var flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack);
        if (flatCoordinates) {
            return new _geom_LinearRing_js__WEBPACK_IMPORTED_MODULE_6__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XYZ);
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {Polygon|undefined} Polygon.
     */
    GMLBase.prototype.readPolygon = function (node, objectStack) {
        /** @type {Array<Array<number>>} */
        var flatLinearRings = Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])([null], this.FLAT_LINEAR_RINGS_PARSERS, node, objectStack, this);
        if (flatLinearRings && flatLinearRings[0]) {
            var flatCoordinates = flatLinearRings[0];
            var ends = [flatCoordinates.length];
            var i = void 0, ii = void 0;
            for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
                Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(flatCoordinates, flatLinearRings[i]);
                ends.push(flatCoordinates.length);
            }
            return new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_11__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XYZ, ends);
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<number>} Flat coordinates.
     */
    GMLBase.prototype.readFlatCoordinatesFromNode_ = function (node, objectStack) {
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["pushParseAndPop"])(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS, node, objectStack, this);
    };
    /**
     * @inheritDoc
     */
    //@ts-ignore
    GMLBase.prototype.readGeometryFromNode = function (node, opt_options) {
        var geometry = this.readGeometryElement(node, [this.getReadOptions(node, opt_options ? opt_options : {})]);
        return geometry ? geometry : null;
    };
    /**
     * @inheritDoc
     */
    GMLBase.prototype.readFeaturesFromNode = function (node, opt_options) {
        var options = {
            featureType: this.featureType,
            featureNS: this.featureNS
        };
        if (opt_options) {
            Object(_obj_js__WEBPACK_IMPORTED_MODULE_12__["assign"])(options, this.getReadOptions(node, opt_options));
        }
        var features = this.readFeaturesInternal(node, [options]);
        return features || [];
    };
    /**
     * @inheritDoc
     */
    GMLBase.prototype.readProjectionFromNode = function (node) {
        return Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["get"])(this.srsName ? this.srsName : node.firstElementChild.getAttribute('srsName'));
    };
    return GMLBase;
}(_XMLFeature_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
GMLBase.prototype.namespace = GMLNS;
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GMLBase.prototype.FLAT_LINEAR_RINGS_PARSERS = {
    'http://www.opengis.net/gml': {}
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GMLBase.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
    'http://www.opengis.net/gml': {}
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GMLBase.prototype.GEOMETRY_PARSERS = {
    'http://www.opengis.net/gml': {}
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GMLBase.prototype.MULTIPOINT_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'pointMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.pointMemberParser_),
        'pointMembers': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.pointMemberParser_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'lineStringMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.lineStringMemberParser_),
        'lineStringMembers': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.lineStringMemberParser_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'polygonMember': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.polygonMemberParser_),
        'polygonMembers': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.polygonMemberParser_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GMLBase.prototype.POINTMEMBER_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.readFlatCoordinatesFromNode_)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.readLineString)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @private
 */
GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
    'http://www.opengis.net/gml': {
        'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeArrayPusher"])(GMLBase.prototype.readPolygon)
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 * @protected
 */
GMLBase.prototype.RING_PARSERS = {
    'http://www.opengis.net/gml': {
        'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_14__["makeReplacer"])(GMLBase.prototype.readFlatLinearRing_)
    }
};
/* harmony default export */ __webpack_exports__["default"] = (GMLBase);
//# sourceMappingURL=GMLBase.js.map

/***/ }),

/***/ "./node_modules/ol/format/GPX.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/GPX.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _XMLFeature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./XMLFeature.js */ "./node_modules/ol/format/XMLFeature.js");
/* harmony import */ var _xsd_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./xsd.js */ "./node_modules/ol/format/xsd.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/GPX
 */












/**
 * @const
 * @type {Array<null|string>}
 */
var NAMESPACE_URIS = [
    null,
    'http://www.topografix.com/GPX/1/0',
    'http://www.topografix.com/GPX/1/1'
];
/**
 * @const
 * @type {string}
 */
var SCHEMA_LOCATION = 'http://www.topografix.com/GPX/1/1 ' +
    'http://www.topografix.com/GPX/1/1/gpx.xsd';
/**
 * @const
 * @type {Object<string, function(Node, Array<*>): (Feature|undefined)>}
 */
var FEATURE_READER = {
    'rte': readRte,
    'trk': readTrk,
    'wpt': readWpt
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var GPX_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'rte': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeArrayPusher"])(readRte),
    'trk': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeArrayPusher"])(readTrk),
    'wpt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeArrayPusher"])(readWpt)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var LINK_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'text': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"], 'linkText'),
    'type': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"], 'linkType')
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var GPX_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'rte': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeRte),
    'trk': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeTrk),
    'wpt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeWpt)
});
/**
 * @typedef {Object} Options
 * @property {function(Feature, Node)} [readExtensions] Callback function
 * to process `extensions` nodes. To prevent memory leaks, this callback function must
 * not store any references to the node. Note that the `extensions`
 * node is not allowed in GPX 1.0. Moreover, only `extensions`
 * nodes from `wpt`, `rte` and `trk` can be processed, as those are
 * directly mapped to a feature.
 */
/**
 * @typedef {Object} LayoutOptions
 * @property {boolean} [hasZ]
 * @property {boolean} [hasM]
 */
/**
 * @classdesc
 * Feature format for reading and writing data in the GPX format.
 *
 * Note that {@link module:ol/format/GPX~GPX#readFeature} only reads the first
 * feature of the source.
 *
 * When reading, routes (`<rte>`) are converted into LineString geometries, and
 * tracks (`<trk>`) into MultiLineString. Any properties on route and track
 * waypoints are ignored.
 *
 * When writing, LineString geometries are output as routes (`<rte>`), and
 * MultiLineString as tracks (`<trk>`).
 *
 * @api
 */
var GPX = /** @class */ (function (_super) {
    __extends(GPX, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function GPX(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @inheritDoc
         */
        _this.dataProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_10__["get"])('EPSG:4326');
        /**
         * @type {function(Feature, Node): void|undefined}
         * @private
         */
        _this.readExtensions_ = options.readExtensions;
        return _this;
    }
    /**
     * @param {Array<Feature>} features List of features.
     * @private
     */
    GPX.prototype.handleReadExtensions_ = function (features) {
        if (!features) {
            features = [];
        }
        for (var i = 0, ii = features.length; i < ii; ++i) {
            var feature = features[i];
            if (this.readExtensions_) {
                var extensionsNode = feature.get('extensionsNode_') || null;
                this.readExtensions_(feature, extensionsNode);
            }
            feature.set('extensionsNode_', undefined);
        }
    };
    /**
     * @inheritDoc
     */
    GPX.prototype.readFeatureFromNode = function (node, opt_options) {
        if (!Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, node.namespaceURI)) {
            return null;
        }
        var featureReader = FEATURE_READER[node.localName];
        if (!featureReader) {
            return null;
        }
        var feature = featureReader(node, [this.getReadOptions(node, opt_options)]);
        if (!feature) {
            return null;
        }
        this.handleReadExtensions_([feature]);
        return feature;
    };
    /**
     * @inheritDoc
     */
    GPX.prototype.readFeaturesFromNode = function (node, opt_options) {
        if (!Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, node.namespaceURI)) {
            return [];
        }
        if (node.localName == 'gpx') {
            /** @type {Array<Feature>} */
            var features = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushParseAndPop"])([], GPX_PARSERS, node, [this.getReadOptions(node, opt_options)]);
            if (features) {
                this.handleReadExtensions_(features);
                return features;
            }
            else {
                return [];
            }
        }
        return [];
    };
    /**
     * Encode an array of features in the GPX format as an XML node.
     * LineString geometries are output as routes (`<rte>`), and MultiLineString
     * as tracks (`<trk>`).
     *
     * @param {Array<Feature>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Options.
     * @return {Node} Node.
     * @override
     * @api
     */
    GPX.prototype.writeFeaturesNode = function (features, opt_options) {
        opt_options = this.adaptOptions(opt_options);
        //FIXME Serialize metadata
        var gpx = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["createElementNS"])('http://www.topografix.com/GPX/1/1', 'gpx');
        var xmlnsUri = 'http://www.w3.org/2000/xmlns/';
        gpx.setAttributeNS(xmlnsUri, 'xmlns:xsi', _xml_js__WEBPACK_IMPORTED_MODULE_11__["XML_SCHEMA_INSTANCE_URI"]);
        gpx.setAttributeNS(_xml_js__WEBPACK_IMPORTED_MODULE_11__["XML_SCHEMA_INSTANCE_URI"], 'xsi:schemaLocation', SCHEMA_LOCATION);
        gpx.setAttribute('version', '1.1');
        gpx.setAttribute('creator', 'OpenLayers');
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ ({ node: gpx }), GPX_SERIALIZERS, GPX_NODE_FACTORY, features, [opt_options]);
        return gpx;
    };
    return GPX;
}(_XMLFeature_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var RTE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'cmt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'desc': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'src': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'link': parseLink,
    'number': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'extensions': parseExtensions,
    'type': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'rtept': parseRtePt
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var RTEPT_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'ele': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'time': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDateTime"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var TRK_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'cmt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'desc': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'src': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'link': parseLink,
    'number': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'type': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'extensions': parseExtensions,
    'trkseg': parseTrkSeg
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var TRKSEG_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'trkpt': parseTrkPt
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var TRKPT_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'ele': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'time': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDateTime"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var WPT_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'ele': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'time': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDateTime"]),
    'magvar': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'geoidheight': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'cmt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'desc': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'src': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'link': parseLink,
    'sym': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'type': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'fix': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'sat': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'hdop': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'vdop': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'pdop': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'ageofdgpsdata': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'dgpsid': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'extensions': parseExtensions
});
/**
 * @const
 * @type {Array<string>}
 */
var LINK_SEQUENCE = ['text', 'type'];
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var LINK_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'text': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'type': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"])
});
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var RTE_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, [
    'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'rtept'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var RTE_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'cmt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'desc': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'src': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'link': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeLink),
    'number': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeNonNegativeIntegerTextNode"]),
    'type': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'rtept': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeArraySerializer"])(Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeWptType))
});
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var RTEPT_TYPE_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, [
    'ele', 'time'
]);
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var TRK_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, [
    'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'trkseg'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var TRK_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'cmt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'desc': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'src': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'link': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeLink),
    'number': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeNonNegativeIntegerTextNode"]),
    'type': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'trkseg': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeArraySerializer"])(Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeTrkSeg))
});
/**
 * @const
 * @type {function(*, Array<*>, string=): (Node|undefined)}
 */
var TRKSEG_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeSimpleNodeFactory"])('trkpt');
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var TRKSEG_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'trkpt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeWptType)
});
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var WPT_TYPE_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, [
    'ele', 'time', 'magvar', 'geoidheight', 'name', 'cmt', 'desc', 'src',
    'link', 'sym', 'type', 'fix', 'sat', 'hdop', 'vdop', 'pdop',
    'ageofdgpsdata', 'dgpsid'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var WPT_TYPE_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeStructureNS"])(NAMESPACE_URIS, {
    'ele': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeDecimalTextNode"]),
    'time': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeDateTimeTextNode"]),
    'magvar': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeDecimalTextNode"]),
    'geoidheight': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeDecimalTextNode"]),
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'cmt': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'desc': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'src': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'link': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(writeLink),
    'sym': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'type': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'fix': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeStringTextNode"]),
    'sat': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeNonNegativeIntegerTextNode"]),
    'hdop': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeDecimalTextNode"]),
    'vdop': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeDecimalTextNode"]),
    'pdop': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeDecimalTextNode"]),
    'ageofdgpsdata': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeDecimalTextNode"]),
    'dgpsid': Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["writeNonNegativeIntegerTextNode"])
});
/**
 * @const
 * @type {Object<string, string>}
 */
var GEOMETRY_TYPE_TO_NODENAME = {
    'Point': 'wpt',
    'LineString': 'rte',
    'MultiLineString': 'trk'
};
/**
 * @param {*} value Value.
 * @param {Array<*>} objectStack Object stack.
 * @param {string=} opt_nodeName Node name.
 * @return {Node|undefined} Node.
 */
function GPX_NODE_FACTORY(value, objectStack, opt_nodeName) {
    var geometry = /** @type {Feature} */ (value).getGeometry();
    if (geometry) {
        var nodeName = GEOMETRY_TYPE_TO_NODENAME[geometry.getType()];
        if (nodeName) {
            var parentNode = objectStack[objectStack.length - 1].node;
            return Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["createElementNS"])(parentNode.namespaceURI, nodeName);
        }
    }
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {LayoutOptions} layoutOptions Layout options.
 * @param {Element} node Node.
 * @param {!Object} values Values.
 * @return {Array<number>} Flat coordinates.
 */
function appendCoordinate(flatCoordinates, layoutOptions, node, values) {
    flatCoordinates.push(parseFloat(node.getAttribute('lon')), parseFloat(node.getAttribute('lat')));
    if ('ele' in values) {
        flatCoordinates.push(/** @type {number} */ (values['ele']));
        delete values['ele'];
        layoutOptions.hasZ = true;
    }
    else {
        flatCoordinates.push(0);
    }
    if ('time' in values) {
        flatCoordinates.push(/** @type {number} */ (values['time']));
        delete values['time'];
        layoutOptions.hasM = true;
    }
    else {
        flatCoordinates.push(0);
    }
    return flatCoordinates;
}
/**
 * Choose GeometryLayout based on flags in layoutOptions and adjust flatCoordinates
 * and ends arrays by shrinking them accordingly (removing unused zero entries).
 *
 * @param {LayoutOptions} layoutOptions Layout options.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {Array<number>=} ends Ends.
 * @return {GeometryLayout} Layout.
 */
function applyLayoutOptions(layoutOptions, flatCoordinates, ends) {
    var layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XY;
    var stride = 2;
    if (layoutOptions.hasZ && layoutOptions.hasM) {
        layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM;
        stride = 4;
    }
    else if (layoutOptions.hasZ) {
        layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ;
        stride = 3;
    }
    else if (layoutOptions.hasM) {
        layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYM;
        stride = 3;
    }
    if (stride !== 4) {
        for (var i = 0, ii = flatCoordinates.length / 4; i < ii; i++) {
            flatCoordinates[i * stride] = flatCoordinates[i * 4];
            flatCoordinates[i * stride + 1] = flatCoordinates[i * 4 + 1];
            if (layoutOptions.hasZ) {
                flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 2];
            }
            if (layoutOptions.hasM) {
                flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 3];
            }
        }
        flatCoordinates.length = flatCoordinates.length / 4 * stride;
        if (ends) {
            for (var i = 0, ii = ends.length; i < ii; i++) {
                ends[i] = ends[i] / 4 * stride;
            }
        }
    }
    return layout;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function parseLink(node, objectStack) {
    var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    var href = node.getAttribute('href');
    if (href !== null) {
        values['link'] = href;
    }
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["parseNode"])(LINK_PARSERS, node, objectStack);
}
/**
 * @param {Node} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function parseExtensions(node, objectStack) {
    var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    values['extensionsNode_'] = node;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function parseRtePt(node, objectStack) {
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushParseAndPop"])({}, RTEPT_PARSERS, node, objectStack);
    if (values) {
        var rteValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]);
        var flatCoordinates = /** @type {Array<number>} */ (rteValues['flatCoordinates']);
        var layoutOptions = /** @type {LayoutOptions} */ (rteValues['layoutOptions']);
        appendCoordinate(flatCoordinates, layoutOptions, node, values);
    }
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function parseTrkPt(node, objectStack) {
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushParseAndPop"])({}, TRKPT_PARSERS, node, objectStack);
    if (values) {
        var trkValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]);
        var flatCoordinates = /** @type {Array<number>} */ (trkValues['flatCoordinates']);
        var layoutOptions = /** @type {LayoutOptions} */ (trkValues['layoutOptions']);
        appendCoordinate(flatCoordinates, layoutOptions, node, values);
    }
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function parseTrkSeg(node, objectStack) {
    var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["parseNode"])(TRKSEG_PARSERS, node, objectStack);
    var flatCoordinates = /** @type {Array<number>} */ (values['flatCoordinates']);
    var ends = /** @type {Array<number>} */ (values['ends']);
    ends.push(flatCoordinates.length);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Feature|undefined} Track.
 */
function readRte(node, objectStack) {
    var options = /** @type {import("./Feature.js").ReadOptions} */ (objectStack[0]);
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushParseAndPop"])({
        'flatCoordinates': [],
        'layoutOptions': {}
    }, RTE_PARSERS, node, objectStack);
    if (!values) {
        return undefined;
    }
    var flatCoordinates = /** @type {Array<number>} */ (values['flatCoordinates']);
    delete values['flatCoordinates'];
    var layoutOptions = /** @type {LayoutOptions} */ (values['layoutOptions']);
    delete values['layoutOptions'];
    var layout = applyLayoutOptions(layoutOptions, flatCoordinates);
    var geometry = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_7__["default"](flatCoordinates, layout);
    Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, false, options);
    var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"](geometry);
    feature.setProperties(values, true);
    return feature;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Feature|undefined} Track.
 */
function readTrk(node, objectStack) {
    var options = /** @type {import("./Feature.js").ReadOptions} */ (objectStack[0]);
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushParseAndPop"])({
        'flatCoordinates': [],
        'ends': [],
        'layoutOptions': {}
    }, TRK_PARSERS, node, objectStack);
    if (!values) {
        return undefined;
    }
    var flatCoordinates = /** @type {Array<number>} */ (values['flatCoordinates']);
    delete values['flatCoordinates'];
    var ends = /** @type {Array<number>} */ (values['ends']);
    delete values['ends'];
    var layoutOptions = /** @type {LayoutOptions} */ (values['layoutOptions']);
    delete values['layoutOptions'];
    var layout = applyLayoutOptions(layoutOptions, flatCoordinates, ends);
    var geometry = new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_8__["default"](flatCoordinates, layout, ends);
    Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, false, options);
    var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"](geometry);
    feature.setProperties(values, true);
    return feature;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Feature|undefined} Waypoint.
 */
function readWpt(node, objectStack) {
    var options = /** @type {import("./Feature.js").ReadOptions} */ (objectStack[0]);
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushParseAndPop"])({}, WPT_PARSERS, node, objectStack);
    if (!values) {
        return undefined;
    }
    var layoutOptions = /** @type {LayoutOptions} */ ({});
    var coordinates = appendCoordinate([], layoutOptions, node, values);
    var layout = applyLayoutOptions(layoutOptions, coordinates);
    var geometry = new _geom_Point_js__WEBPACK_IMPORTED_MODULE_9__["default"](coordinates, layout);
    Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, false, options);
    var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"](geometry);
    feature.setProperties(values, true);
    return feature;
}
/**
 * @param {Element} node Node.
 * @param {string} value Value for the link's `href` attribute.
 * @param {Array<*>} objectStack Node stack.
 */
function writeLink(node, value, objectStack) {
    node.setAttribute('href', value);
    var context = objectStack[objectStack.length - 1];
    var properties = context['properties'];
    var link = [
        properties['linkText'],
        properties['linkType']
    ];
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ ({ node: node }), LINK_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_11__["OBJECT_PROPERTY_NODE_FACTORY"], link, objectStack, LINK_SEQUENCE);
}
/**
 * @param {Element} node Node.
 * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
 * @param {Array<*>} objectStack Object stack.
 */
function writeWptType(node, coordinate, objectStack) {
    var context = objectStack[objectStack.length - 1];
    var parentNode = context.node;
    var namespaceURI = parentNode.namespaceURI;
    var properties = context['properties'];
    //FIXME Projection handling
    node.setAttributeNS(null, 'lat', String(coordinate[1]));
    node.setAttributeNS(null, 'lon', String(coordinate[0]));
    var geometryLayout = context['geometryLayout'];
    switch (geometryLayout) {
        case _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM:
            if (coordinate[3] !== 0) {
                properties['time'] = coordinate[3];
            }
        // fall through
        case _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ:
            if (coordinate[2] !== 0) {
                properties['ele'] = coordinate[2];
            }
            break;
        case _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYM:
            if (coordinate[2] !== 0) {
                properties['time'] = coordinate[2];
            }
            break;
        default:
        // pass
    }
    var orderedKeys = (node.nodeName == 'rtept') ?
        RTEPT_TYPE_SEQUENCE[namespaceURI] :
        WPT_TYPE_SEQUENCE[namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ ({ node: node, 'properties': properties }), WPT_TYPE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_11__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @param {Node} node Node.
 * @param {Feature} feature Feature.
 * @param {Array<*>} objectStack Object stack.
 */
function writeRte(node, feature, objectStack) {
    var options = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[0]);
    var properties = feature.getProperties();
    var context = { node: node };
    context['properties'] = properties;
    var geometry = feature.getGeometry();
    if (geometry.getType() == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].LINE_STRING) {
        var lineString = /** @type {LineString} */ (Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, true, options));
        context['geometryLayout'] = lineString.getLayout();
        properties['rtept'] = lineString.getCoordinates();
    }
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = RTE_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushSerializeAndPop"])(context, RTE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_11__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @param {Node} node Node.
 * @param {Feature} feature Feature.
 * @param {Array<*>} objectStack Object stack.
 */
function writeTrk(node, feature, objectStack) {
    var options = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[0]);
    var properties = feature.getProperties();
    /** @type {import("../xml.js").NodeStackItem} */
    var context = { node: node };
    context['properties'] = properties;
    var geometry = feature.getGeometry();
    if (geometry.getType() == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].MULTI_LINE_STRING) {
        var multiLineString = /** @type {MultiLineString} */ (Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, true, options));
        properties['trkseg'] = multiLineString.getLineStrings();
    }
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = TRK_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushSerializeAndPop"])(context, TRK_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_11__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @param {Node} node Node.
 * @param {LineString} lineString LineString.
 * @param {Array<*>} objectStack Object stack.
 */
function writeTrkSeg(node, lineString, objectStack) {
    /** @type {import("../xml.js").NodeStackItem} */
    var context = { node: node };
    context['geometryLayout'] = lineString.getLayout();
    context['properties'] = {};
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_11__["pushSerializeAndPop"])(context, TRKSEG_SERIALIZERS, TRKSEG_NODE_FACTORY, lineString.getCoordinates(), objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Feature} feature Feature.
 * @param {Array<*>} objectStack Object stack.
 */
function writeWpt(node, feature, objectStack) {
    var options = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[0]);
    var context = objectStack[objectStack.length - 1];
    context['properties'] = feature.getProperties();
    var geometry = feature.getGeometry();
    if (geometry.getType() == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POINT) {
        var point = /** @type {Point} */ (Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, true, options));
        context['geometryLayout'] = point.getLayout();
        writeWptType(node, point.getCoordinates(), objectStack);
    }
}
/* harmony default export */ __webpack_exports__["default"] = (GPX);
//# sourceMappingURL=GPX.js.map

/***/ }),

/***/ "./node_modules/ol/format/GeoJSON.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/format/GeoJSON.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _JSONFeature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./JSONFeature.js */ "./node_modules/ol/format/JSONFeature.js");
/* harmony import */ var _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/GeometryCollection.js */ "./node_modules/ol/geom/GeometryCollection.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/**
 * @module ol/format/GeoJSON
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();














/**
 * @typedef {import("geojson").GeoJSON} GeoJSONObject
 * @typedef {import("geojson").Feature} GeoJSONFeature
 * @typedef {import("geojson").FeatureCollection} GeoJSONFeatureCollection
 * @typedef {import("geojson").Geometry} GeoJSONGeometry
 * @typedef {import("geojson").Point} GeoJSONPoint
 * @typedef {import("geojson").LineString} GeoJSONLineString
 * @typedef {import("geojson").Polygon} GeoJSONPolygon
 * @typedef {import("geojson").MultiPoint} GeoJSONMultiPoint
 * @typedef {import("geojson").MultiLineString} GeoJSONMultiLineString
 * @typedef {import("geojson").MultiPolygon} GeoJSONMultiPolygon
 * @typedef {import("geojson").GeometryCollection} GeoJSONGeometryCollection
 */
/**
 * @typedef {Object} Options
 * @property {import("../proj.js").ProjectionLike} [dataProjection='EPSG:4326'] Default data projection.
 * @property {import("../proj.js").ProjectionLike} [featureProjection] Projection for features read or
 * written by the format.  Options passed to read or write methods will take precedence.
 * @property {string} [geometryName] Geometry name to use when creating features.
 * @property {boolean} [extractGeometryName=false] Certain GeoJSON providers include
 * the geometry_name field in the feature GeoJSON. If set to `true` the GeoJSON reader
 * will look for that field to set the geometry name. If both this field is set to `true`
 * and a `geometryName` is provided, the `geometryName` will take precedence.
 */
/**
 * @classdesc
 * Feature format for reading and writing data in the GeoJSON format.
 *
  * @api
 */
var GeoJSON = /** @class */ (function (_super) {
    __extends(GeoJSON, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function GeoJSON(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this) || this;
        /**
         * @inheritDoc
         */
        _this.dataProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_12__["get"])(options.dataProjection ?
            options.dataProjection : 'EPSG:4326');
        if (options.featureProjection) {
            _this.defaultFeatureProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_12__["get"])(options.featureProjection);
        }
        /**
         * Name of the geometry attribute for features.
         * @type {string|undefined}
         * @private
         */
        _this.geometryName_ = options.geometryName;
        /**
         * Look for the geometry name in the feature GeoJSON
         * @type {boolean|undefined}
         * @private
         */
        _this.extractGeometryName_ = options.extractGeometryName;
        return _this;
    }
    /**
     * @inheritDoc
     */
    GeoJSON.prototype.readFeatureFromObject = function (object, opt_options) {
        /**
         * @type {GeoJSONFeature}
         */
        var geoJSONFeature = null;
        if (object['type'] === 'Feature') {
            geoJSONFeature = /** @type {GeoJSONFeature} */ (object);
        }
        else {
            geoJSONFeature = {
                'type': 'Feature',
                'geometry': /** @type {GeoJSONGeometry} */ (object),
                'properties': null
            };
        }
        var geometry = readGeometry(geoJSONFeature['geometry'], opt_options);
        var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"]();
        if (this.geometryName_) {
            feature.setGeometryName(this.geometryName_);
        }
        else if (this.extractGeometryName_ && 'geometry_name' in geoJSONFeature !== undefined) {
            feature.setGeometryName(geoJSONFeature['geometry_name']);
        }
        feature.setGeometry(geometry);
        if ('id' in geoJSONFeature) {
            feature.setId(geoJSONFeature['id']);
        }
        if (geoJSONFeature['properties']) {
            feature.setProperties(geoJSONFeature['properties'], true);
        }
        return feature;
    };
    /**
     * @inheritDoc
     */
    GeoJSON.prototype.readFeaturesFromObject = function (object, opt_options) {
        var geoJSONObject = /** @type {GeoJSONObject} */ (object);
        /** @type {Array<import("../Feature.js").default>} */
        var features = null;
        if (geoJSONObject['type'] === 'FeatureCollection') {
            var geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ (object);
            features = [];
            var geoJSONFeatures = geoJSONFeatureCollection['features'];
            for (var i = 0, ii = geoJSONFeatures.length; i < ii; ++i) {
                features.push(this.readFeatureFromObject(geoJSONFeatures[i], opt_options));
            }
        }
        else {
            features = [this.readFeatureFromObject(object, opt_options)];
        }
        return features;
    };
    /**
     * @inheritDoc
     */
    GeoJSON.prototype.readGeometryFromObject = function (object, opt_options) {
        return readGeometry(/** @type {GeoJSONGeometry} */ (object), opt_options);
    };
    /**
     * @inheritDoc
     */
    GeoJSON.prototype.readProjectionFromObject = function (object) {
        var crs = object['crs'];
        var projection;
        if (crs) {
            if (crs['type'] == 'name') {
                projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_12__["get"])(crs['properties']['name']);
            }
            else if (crs['type'] === 'EPSG') {
                projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_12__["get"])('EPSG:' + crs['properties']['code']);
            }
            else {
                Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(false, 36); // Unknown SRS type
            }
        }
        else {
            projection = this.dataProjection;
        }
        return (
        /** @type {import("../proj/Projection.js").default} */ (projection));
    };
    /**
     * Encode a feature as a GeoJSON Feature object.
     *
     * @param {import("../Feature.js").default} feature Feature.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {GeoJSONFeature} Object.
     * @override
     * @api
     */
    GeoJSON.prototype.writeFeatureObject = function (feature, opt_options) {
        opt_options = this.adaptOptions(opt_options);
        /** @type {GeoJSONFeature} */
        var object = {
            'type': 'Feature',
            geometry: null,
            properties: null
        };
        var id = feature.getId();
        if (id !== undefined) {
            object.id = id;
        }
        var geometry = feature.getGeometry();
        if (geometry) {
            object.geometry = writeGeometry(geometry, opt_options);
        }
        var properties = feature.getProperties();
        delete properties[feature.getGeometryName()];
        if (!Object(_obj_js__WEBPACK_IMPORTED_MODULE_11__["isEmpty"])(properties)) {
            object.properties = properties;
        }
        return object;
    };
    /**
     * Encode an array of features as a GeoJSON object.
     *
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {GeoJSONFeatureCollection} GeoJSON Object.
     * @override
     * @api
     */
    GeoJSON.prototype.writeFeaturesObject = function (features, opt_options) {
        opt_options = this.adaptOptions(opt_options);
        var objects = [];
        for (var i = 0, ii = features.length; i < ii; ++i) {
            objects.push(this.writeFeatureObject(features[i], opt_options));
        }
        return {
            type: 'FeatureCollection',
            features: objects
        };
    };
    /**
     * Encode a geometry as a GeoJSON object.
     *
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.
     * @override
     * @api
     */
    GeoJSON.prototype.writeGeometryObject = function (geometry, opt_options) {
        return writeGeometry(geometry, this.adaptOptions(opt_options));
    };
    return GeoJSON;
}(_JSONFeature_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.
 * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
 * @return {import("../geom/Geometry.js").default} Geometry.
 */
function readGeometry(object, opt_options) {
    if (!object) {
        return null;
    }
    /**
     * @type {import("../geom/Geometry.js").default}
     */
    var geometry;
    switch (object['type']) {
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].POINT: {
            geometry = readPointGeometry(/** @type {GeoJSONPoint} */ (object));
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].LINE_STRING: {
            geometry = readLineStringGeometry(/** @type {GeoJSONLineString} */ (object));
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].POLYGON: {
            geometry = readPolygonGeometry(/** @type {GeoJSONPolygon} */ (object));
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].MULTI_POINT: {
            geometry = readMultiPointGeometry(/** @type {GeoJSONMultiPoint} */ (object));
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].MULTI_LINE_STRING: {
            geometry = readMultiLineStringGeometry(/** @type {GeoJSONMultiLineString} */ (object));
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].MULTI_POLYGON: {
            geometry = readMultiPolygonGeometry(/** @type {GeoJSONMultiPolygon} */ (object));
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].GEOMETRY_COLLECTION: {
            geometry = readGeometryCollectionGeometry(/** @type {GeoJSONGeometryCollection} */ (object));
            break;
        }
        default: {
            throw new Error('Unsupported GeoJSON type: ' + object.type);
        }
    }
    return Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, false, opt_options);
}
/**
 * @param {GeoJSONGeometryCollection} object Object.
 * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
 * @return {GeometryCollection} Geometry collection.
 */
function readGeometryCollectionGeometry(object, opt_options) {
    var geometries = object['geometries'].map(
    /**
     * @param {GeoJSONGeometry} geometry Geometry.
     * @return {import("../geom/Geometry.js").default} geometry Geometry.
     */
    function (geometry) {
        return readGeometry(geometry, opt_options);
    });
    return new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_4__["default"](geometries);
}
/**
 * @param {GeoJSONPoint} object Object.
 * @return {Point} Point.
 */
function readPointGeometry(object) {
    return new _geom_Point_js__WEBPACK_IMPORTED_MODULE_9__["default"](object['coordinates']);
}
/**
 * @param {GeoJSONLineString} object Object.
 * @return {LineString} LineString.
 */
function readLineStringGeometry(object) {
    return new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_5__["default"](object['coordinates']);
}
/**
 * @param {GeoJSONMultiLineString} object Object.
 * @return {MultiLineString} MultiLineString.
 */
function readMultiLineStringGeometry(object) {
    return new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_6__["default"](object['coordinates']);
}
/**
 * @param {GeoJSONMultiPoint} object Object.
 * @return {MultiPoint} MultiPoint.
 */
function readMultiPointGeometry(object) {
    return new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_7__["default"](object['coordinates']);
}
/**
 * @param {GeoJSONMultiPolygon} object Object.
 * @return {MultiPolygon} MultiPolygon.
 */
function readMultiPolygonGeometry(object) {
    return new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_8__["default"](object['coordinates']);
}
/**
 * @param {GeoJSONPolygon} object Object.
 * @return {Polygon} Polygon.
 */
function readPolygonGeometry(object) {
    return new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_10__["default"](object['coordinates']);
}
/**
 * @param {import("../geom/Geometry.js").default} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {GeoJSONGeometry} GeoJSON geometry.
 */
function writeGeometry(geometry, opt_options) {
    geometry = Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, true, opt_options);
    var type = geometry.getType();
    /** @type {GeoJSONGeometry} */
    var geoJSON;
    switch (type) {
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].POINT: {
            geoJSON = writePointGeometry(/** @type {Point} */ (geometry), opt_options);
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].LINE_STRING: {
            geoJSON = writeLineStringGeometry(/** @type {LineString} */ (geometry), opt_options);
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].POLYGON: {
            geoJSON = writePolygonGeometry(/** @type {Polygon} */ (geometry), opt_options);
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].MULTI_POINT: {
            geoJSON = writeMultiPointGeometry(/** @type {MultiPoint} */ (geometry), opt_options);
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].MULTI_LINE_STRING: {
            geoJSON = writeMultiLineStringGeometry(/** @type {MultiLineString} */ (geometry), opt_options);
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].MULTI_POLYGON: {
            geoJSON = writeMultiPolygonGeometry(/** @type {MultiPolygon} */ (geometry), opt_options);
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].GEOMETRY_COLLECTION: {
            geoJSON = writeGeometryCollectionGeometry(/** @type {GeometryCollection} */ (geometry), opt_options);
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_13__["default"].CIRCLE: {
            geoJSON = {
                type: 'GeometryCollection',
                geometries: []
            };
            break;
        }
        default: {
            throw new Error('Unsupported geometry type: ' + type);
        }
    }
    return geoJSON;
}
/**
 * @param {GeometryCollection} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {GeoJSONGeometryCollection} GeoJSON geometry collection.
 */
function writeGeometryCollectionGeometry(geometry, opt_options) {
    var geometries = geometry.getGeometriesArray().map(function (geometry) {
        var options = Object(_obj_js__WEBPACK_IMPORTED_MODULE_11__["assign"])({}, opt_options);
        delete options.featureProjection;
        return writeGeometry(geometry, options);
    });
    return {
        type: 'GeometryCollection',
        geometries: geometries
    };
}
/**
 * @param {LineString} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {GeoJSONGeometry} GeoJSON geometry.
 */
function writeLineStringGeometry(geometry, opt_options) {
    return {
        type: 'LineString',
        coordinates: geometry.getCoordinates()
    };
}
/**
 * @param {MultiLineString} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {GeoJSONGeometry} GeoJSON geometry.
 */
function writeMultiLineStringGeometry(geometry, opt_options) {
    return {
        type: 'MultiLineString',
        coordinates: geometry.getCoordinates()
    };
}
/**
 * @param {MultiPoint} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {GeoJSONGeometry} GeoJSON geometry.
 */
function writeMultiPointGeometry(geometry, opt_options) {
    return {
        type: 'MultiPoint',
        coordinates: geometry.getCoordinates()
    };
}
/**
 * @param {MultiPolygon} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {GeoJSONGeometry} GeoJSON geometry.
 */
function writeMultiPolygonGeometry(geometry, opt_options) {
    var right;
    if (opt_options) {
        right = opt_options.rightHanded;
    }
    return {
        type: 'MultiPolygon',
        coordinates: geometry.getCoordinates(right)
    };
}
/**
 * @param {Point} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {GeoJSONGeometry} GeoJSON geometry.
 */
function writePointGeometry(geometry, opt_options) {
    return {
        type: 'Point',
        coordinates: geometry.getCoordinates()
    };
}
/**
 * @param {Polygon} geometry Geometry.
 * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
 * @return {GeoJSONGeometry} GeoJSON geometry.
 */
function writePolygonGeometry(geometry, opt_options) {
    var right;
    if (opt_options) {
        right = opt_options.rightHanded;
    }
    return {
        type: 'Polygon',
        coordinates: geometry.getCoordinates(right)
    };
}
/* harmony default export */ __webpack_exports__["default"] = (GeoJSON);
//# sourceMappingURL=GeoJSON.js.map

/***/ }),

/***/ "./node_modules/ol/format/IGC.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/IGC.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _TextFeature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TextFeature.js */ "./node_modules/ol/format/TextFeature.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/IGC
 */






/**
 * IGC altitude/z. One of 'barometric', 'gps', 'none'.
 * @enum {string}
 */
var IGCZ = {
    BAROMETRIC: 'barometric',
    GPS: 'gps',
    NONE: 'none'
};
/**
 * @const
 * @type {RegExp}
 */
var B_RECORD_RE = /^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/;
/**
 * @const
 * @type {RegExp}
 */
var H_RECORD_RE = /^H.([A-Z]{3}).*?:(.*)/;
/**
 * @const
 * @type {RegExp}
 */
var HFDTE_RECORD_RE = /^HFDTE(\d{2})(\d{2})(\d{2})/;
/**
 * A regular expression matching the newline characters `\r\n`, `\r` and `\n`.
 *
 * @const
 * @type {RegExp}
 */
var NEWLINE_RE = /\r\n|\r|\n/;
/**
 * @typedef {Object} Options
 * @property {IGCZ|string} [altitudeMode='none'] Altitude mode. Possible
 * values are `'barometric'`, `'gps'`, and `'none'`.
 */
/**
 * @classdesc
 * Feature format for `*.igc` flight recording files.
 *
 * As IGC sources contain a single feature,
 * {@link module:ol/format/IGC~IGC#readFeatures} will return the feature in an
 * array
 *
 * @api
 */
var IGC = /** @class */ (function (_super) {
    __extends(IGC, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function IGC(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @inheritDoc
         */
        _this.dataProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])('EPSG:4326');
        /**
         * @private
         * @type {IGCZ}
         */
        _this.altitudeMode_ = options.altitudeMode ? options.altitudeMode : IGCZ.NONE;
        return _this;
    }
    /**
     * @inheritDoc
     */
    IGC.prototype.readFeatureFromText = function (text, opt_options) {
        var altitudeMode = this.altitudeMode_;
        var lines = text.split(NEWLINE_RE);
        /** @type {Object<string, string>} */
        var properties = {};
        var flatCoordinates = [];
        var year = 2000;
        var month = 0;
        var day = 1;
        var lastDateTime = -1;
        var i, ii;
        for (i = 0, ii = lines.length; i < ii; ++i) {
            var line = lines[i];
            var m = void 0;
            if (line.charAt(0) == 'B') {
                m = B_RECORD_RE.exec(line);
                if (m) {
                    var hour = parseInt(m[1], 10);
                    var minute = parseInt(m[2], 10);
                    var second = parseInt(m[3], 10);
                    var y = parseInt(m[4], 10) + parseInt(m[5], 10) / 60000;
                    if (m[6] == 'S') {
                        y = -y;
                    }
                    var x = parseInt(m[7], 10) + parseInt(m[8], 10) / 60000;
                    if (m[9] == 'W') {
                        x = -x;
                    }
                    flatCoordinates.push(x, y);
                    if (altitudeMode != IGCZ.NONE) {
                        var z = void 0;
                        if (altitudeMode == IGCZ.GPS) {
                            z = parseInt(m[11], 10);
                        }
                        else if (altitudeMode == IGCZ.BAROMETRIC) {
                            z = parseInt(m[12], 10);
                        }
                        else {
                            z = 0;
                        }
                        flatCoordinates.push(z);
                    }
                    var dateTime = Date.UTC(year, month, day, hour, minute, second);
                    // Detect UTC midnight wrap around.
                    if (dateTime < lastDateTime) {
                        dateTime = Date.UTC(year, month, day + 1, hour, minute, second);
                    }
                    flatCoordinates.push(dateTime / 1000);
                    lastDateTime = dateTime;
                }
            }
            else if (line.charAt(0) == 'H') {
                m = HFDTE_RECORD_RE.exec(line);
                if (m) {
                    day = parseInt(m[1], 10);
                    month = parseInt(m[2], 10) - 1;
                    year = 2000 + parseInt(m[3], 10);
                }
                else {
                    m = H_RECORD_RE.exec(line);
                    if (m) {
                        properties[m[1]] = m[2].trim();
                    }
                }
            }
        }
        if (flatCoordinates.length === 0) {
            return null;
        }
        var layout = altitudeMode == IGCZ.NONE ? _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XYM : _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XYZM;
        var lineString = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_4__["default"](flatCoordinates, layout);
        var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"](Object(_Feature_js__WEBPACK_IMPORTED_MODULE_1__["transformGeometryWithOptions"])(lineString, false, opt_options));
        feature.setProperties(properties, true);
        return feature;
    };
    /**
     * @inheritDoc
     */
    IGC.prototype.readFeaturesFromText = function (text, opt_options) {
        var feature = this.readFeatureFromText(text, opt_options);
        if (feature) {
            return [feature];
        }
        else {
            return [];
        }
    };
    return IGC;
}(_TextFeature_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (IGC);
//# sourceMappingURL=IGC.js.map

/***/ }),

/***/ "./node_modules/ol/format/IIIFInfo.js":
/*!********************************************!*\
  !*** ./node_modules/ol/format/IIIFInfo.js ***!
  \********************************************/
/*! exports provided: default, Versions */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Versions", function() { return Versions; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/**
 * @module ol/format/IIIFInfo
 */

/**
 * @typedef {Object} PreferredOptions
 * @property {string} [format] Preferred image format. Will be used if the image information
 * indicates support for that format.
 * @property {string} [quality] IIIF image qualitiy.  Will be used if the image information
 * indicates support for that quality.
 */
/**
 * @typedef {Object} SupportedFeatures
 * @property {Array<string>} [supports] Supported IIIF image size and region
 * calculation features.
 * @property {Array<string>} [formats] Supported image formats.
 * @property {Array<string>} [qualities] Supported IIIF image qualities.
 */
/**
 * @typedef {Object} TileInfo
 * @property {Array<number>} scaleFactors Supported resolution scaling factors.
 * @property {number} width Tile width in pixels.
 * @property {number} [height] Tile height in pixels. Same as tile width if height is
 * not given.
 */
/**
 * @typedef {Object} IiifProfile
 * @property {Array<string>} [formats] Supported image formats for the image service.
 * @property {Array<string>} [qualities] Supported IIIF image qualities.
 * @property {Array<string>} [supports] Supported features.
 * @property {number} [maxArea] Maximum area (pixels) available for this image service.
 * @property {number} [maxHeight] Maximum height.
 * @property {number} [maxWidth] Maximum width.
 */
/**
 * @typedef {Object<string,string|number|Array<number|string|IiifProfile>|Object<string, number>|TileInfo>}
 *    ImageInformationResponse
 */
/**
 * Enum representing the major IIIF Image API versions
 * @enum {string}
 */
var Versions = {
    VERSION1: 'version1',
    VERSION2: 'version2',
    VERSION3: 'version3'
};
/**
 * Supported image formats, qualities and supported region / size calculation features
 * for different image API versions and compliance levels
 * @const
 * @type {Object<string, Object<string, SupportedFeatures>>}
 */
var IIIF_PROFILE_VALUES = {};
IIIF_PROFILE_VALUES[Versions.VERSION1] = {
    'level0': {
        supports: [],
        formats: [],
        qualities: ['native']
    },
    'level1': {
        supports: ['regionByPx', 'sizeByW', 'sizeByH', 'sizeByPct'],
        formats: ['jpg'],
        qualities: ['native']
    },
    'level2': {
        supports: ['regionByPx', 'regionByPct', 'sizeByW', 'sizeByH', 'sizeByPct',
            'sizeByConfinedWh', 'sizeByWh'],
        formats: ['jpg', 'png'],
        qualities: ['native', 'color', 'grey', 'bitonal']
    }
};
IIIF_PROFILE_VALUES[Versions.VERSION2] = {
    'level0': {
        supports: [],
        formats: ['jpg'],
        qualities: ['default']
    },
    'level1': {
        supports: ['regionByPx', 'sizeByW', 'sizeByH', 'sizeByPct'],
        formats: ['jpg'],
        qualities: ['default']
    },
    'level2': {
        supports: ['regionByPx', 'regionByPct', 'sizeByW', 'sizeByH', 'sizeByPct',
            'sizeByConfinedWh', 'sizeByDistortedWh', 'sizeByWh'],
        formats: ['jpg', 'png'],
        qualities: ['default', 'bitonal']
    }
};
IIIF_PROFILE_VALUES[Versions.VERSION3] = {
    'level0': {
        supports: [],
        formats: ['jpg'],
        qualities: ['default']
    },
    'level1': {
        supports: ['regionByPx', 'regionSquare', 'sizeByW', 'sizeByH', 'sizeByWh'],
        formats: ['jpg'],
        qualities: ['default']
    },
    'level2': {
        supports: ['regionByPx', 'regionSquare', 'regionByPct',
            'sizeByW', 'sizeByH', 'sizeByPct', 'sizeByConfinedWh', 'sizeByWh'],
        formats: ['jpg', 'png'],
        qualities: ['default']
    }
};
IIIF_PROFILE_VALUES['none'] = {
    'none': {
        supports: [],
        formats: [],
        qualities: []
    }
};
var COMPLIANCE_VERSION1 = new RegExp('^https?\:\/\/library\.stanford\.edu\/iiif\/image-api\/(1\.1\/)?compliance\.html#level[0-2]$');
var COMPLIANCE_VERSION2 = new RegExp('^https?\:\/\/iiif\.io\/api\/image\/2\/level[0-2](\.json)?$');
var COMPLIANCE_VERSION3 = new RegExp('(^https?\:\/\/iiif\.io\/api\/image\/3\/level[0-2](\.json)?$)|(^level[0-2]$)');
function generateVersion1Options(iiifInfo) {
    var levelProfile = iiifInfo.getComplianceLevelSupportedFeatures();
    // Version 1.0 and 1.1 do not require a profile.
    if (levelProfile === undefined) {
        levelProfile = IIIF_PROFILE_VALUES[Versions.VERSION1]['level0'];
    }
    return {
        url: iiifInfo.imageInfo['@id'] === undefined ? undefined : iiifInfo.imageInfo['@id'].replace(/\/?(info.json)?$/g, ''),
        supports: levelProfile.supports,
        formats: levelProfile.formats.concat([iiifInfo.imageInfo.formats === undefined ?
                [] : iiifInfo.imageInfo.formats]),
        qualities: levelProfile.qualities.concat([iiifInfo.imageInfo.qualities === undefined ?
                [] : iiifInfo.imageInfo.qualities]),
        resolutions: iiifInfo.imageInfo.scale_factors,
        tileSize: iiifInfo.imageInfo.tile_width !== undefined ? (iiifInfo.imageInfo.tile_height !== undefined ?
            [iiifInfo.imageInfo.tile_width, iiifInfo.imageInfo.tile_height] : [iiifInfo.imageInfo.tile_width, iiifInfo.imageInfo.tile_width]) :
            (iiifInfo.imageInfo.tile_height != undefined ? [iiifInfo.imageInfo.tile_height, iiifInfo.imageInfo.tile_height] : undefined)
    };
}
function generateVersion2Options(iiifInfo) {
    var levelProfile = iiifInfo.getComplianceLevelSupportedFeatures(), additionalProfile = Array.isArray(iiifInfo.imageInfo.profile) && iiifInfo.imageInfo.profile.length > 1, profileSupports = additionalProfile && iiifInfo.imageInfo.profile[1].supports ? iiifInfo.imageInfo.profile[1].supports : [], profileFormats = additionalProfile && iiifInfo.imageInfo.profile[1].formats ? iiifInfo.imageInfo.profile[1].formats : [], profileQualities = additionalProfile && iiifInfo.imageInfo.profile[1].qualities ? iiifInfo.imageInfo.profile[1].qualities : [];
    return {
        url: iiifInfo.imageInfo['@id'].replace(/\/?(info.json)?$/g, ''),
        sizes: iiifInfo.imageInfo.sizes === undefined ? undefined : iiifInfo.imageInfo.sizes.map(function (size) {
            return [size.width, size.height];
        }),
        tileSize: iiifInfo.imageInfo.tiles === undefined ? undefined : [
            iiifInfo.imageInfo.tiles.map(function (tile) {
                return tile.width;
            })[0],
            iiifInfo.imageInfo.tiles.map(function (tile) {
                return tile.height === undefined ? tile.width : tile.height;
            })[0]
        ],
        resolutions: iiifInfo.imageInfo.tiles === undefined ? undefined :
            iiifInfo.imageInfo.tiles.map(function (tile) {
                return tile.scaleFactors;
            })[0],
        supports: levelProfile.supports.concat(profileSupports),
        formats: levelProfile.formats.concat(profileFormats),
        qualities: levelProfile.qualities.concat(profileQualities)
    };
}
function generateVersion3Options(iiifInfo) {
    var levelProfile = iiifInfo.getComplianceLevelSupportedFeatures(), formats = iiifInfo.imageInfo.extraFormats === undefined ? levelProfile.formats : levelProfile.formats.concat(iiifInfo.imageInfo.extraFormats), preferredFormat = iiifInfo.imageInfo.preferredFormats !== undefined && Array.isArray(iiifInfo.imageInfo.preferredFormats) &&
        iiifInfo.imageInfo.preferredFormats.length > 0 ?
        iiifInfo.imageInfo.preferredFormats.filter(function (format) {
            return ['jpg', 'png', 'gif'].includes(format);
        }).reduce(function (acc, format) {
            return acc === undefined && formats.includes(format) ? format : acc;
        }, undefined) : undefined;
    return {
        url: iiifInfo.imageInfo['id'],
        sizes: iiifInfo.imageInfo.sizes === undefined ? undefined : iiifInfo.imageInfo.sizes.map(function (size) {
            return [size.width, size.height];
        }),
        tileSize: iiifInfo.imageInfo.tiles === undefined ? undefined : [
            iiifInfo.imageInfo.tiles.map(function (tile) {
                return tile.width;
            })[0],
            iiifInfo.imageInfo.tiles.map(function (tile) {
                return tile.height;
            })[0]
        ],
        resolutions: iiifInfo.imageInfo.tiles === undefined ? undefined :
            iiifInfo.imageInfo.tiles.map(function (tile) {
                return tile.scaleFactors;
            })[0],
        supports: iiifInfo.imageInfo.extraFeatures === undefined ? levelProfile.supports : levelProfile.supports.concat(iiifInfo.imageInfo.extraFeatures),
        formats: formats,
        qualities: iiifInfo.imageInfo.extraQualities === undefined ? levelProfile.qualities : levelProfile.qualities.concat(iiifInfo.imageInfo.extraQualities),
        preferredFormat: preferredFormat
    };
}
var versionFunctions = {};
versionFunctions[Versions.VERSION1] = generateVersion1Options;
versionFunctions[Versions.VERSION2] = generateVersion2Options;
versionFunctions[Versions.VERSION3] = generateVersion3Options;
/**
 * @classdesc
 * Format for transforming IIIF Image API image information responses into
 * IIIF tile source ready options
 *
 * @api
 */
var IIIFInfo = /** @class */ (function () {
    /**
     * @param {string|ImageInformationResponse} imageInfo
     * Deserialized image information JSON response object or JSON response as string
     */
    function IIIFInfo(imageInfo) {
        this.setImageInfo(imageInfo);
    }
    /**
     * @param {string|ImageInformationResponse} imageInfo
     * Deserialized image information JSON response object or JSON response as string
     * @api
     */
    IIIFInfo.prototype.setImageInfo = function (imageInfo) {
        if (typeof imageInfo == 'string') {
            this.imageInfo = JSON.parse(imageInfo);
        }
        else {
            this.imageInfo = imageInfo;
        }
    };
    /**
     * @returns {Versions} Major IIIF version.
     * @api
     */
    IIIFInfo.prototype.getImageApiVersion = function () {
        if (this.imageInfo === undefined) {
            return;
        }
        var context = this.imageInfo['@context'] || 'ol-no-context';
        if (typeof context == 'string') {
            context = [context];
        }
        for (var i = 0; i < context.length; i++) {
            switch (context[i]) {
                case 'http://library.stanford.edu/iiif/image-api/1.1/context.json':
                case 'http://iiif.io/api/image/1/context.json':
                    return Versions.VERSION1;
                case 'http://iiif.io/api/image/2/context.json':
                    return Versions.VERSION2;
                case 'http://iiif.io/api/image/3/context.json':
                    return Versions.VERSION3;
                case 'ol-no-context':
                    // Image API 1.0 has no '@context'
                    if (this.getComplianceLevelEntryFromProfile(Versions.VERSION1) && this.imageInfo.identifier) {
                        return Versions.VERSION1;
                    }
                    break;
                default:
            }
        }
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(false, 61);
    };
    /**
     * @param {Versions} version Optional IIIF image API version
     * @returns {string} Compliance level as it appears in the IIIF image information
     * response.
     */
    IIIFInfo.prototype.getComplianceLevelEntryFromProfile = function (version) {
        if (this.imageInfo === undefined || this.imageInfo.profile === undefined) {
            return;
        }
        if (version === undefined) {
            version = this.getImageApiVersion();
        }
        switch (version) {
            case Versions.VERSION1:
                if (COMPLIANCE_VERSION1.test(this.imageInfo.profile)) {
                    return this.imageInfo.profile;
                }
                break;
            case Versions.VERSION3:
                if (COMPLIANCE_VERSION3.test(this.imageInfo.profile)) {
                    return this.imageInfo.profile;
                }
                break;
            case Versions.VERSION2:
                if (typeof this.imageInfo.profile === 'string' && COMPLIANCE_VERSION2.test(this.imageInfo.profile)) {
                    return this.imageInfo.profile;
                }
                if (Array.isArray(this.imageInfo.profile) && this.imageInfo.profile.length > 0
                    && typeof this.imageInfo.profile[0] === 'string' && COMPLIANCE_VERSION2.test(this.imageInfo.profile[0])) {
                    return this.imageInfo.profile[0];
                }
                break;
            default:
        }
    };
    /**
     * @param {Versions} version Optional IIIF image API version
     * @returns {string} Compliance level, on of 'level0', 'level1' or 'level2' or undefined
     */
    IIIFInfo.prototype.getComplianceLevelFromProfile = function (version) {
        var complianceLevel = this.getComplianceLevelEntryFromProfile(version);
        if (complianceLevel === undefined) {
            return undefined;
        }
        var level = complianceLevel.match(/level[0-2](\.json)?$/g);
        return Array.isArray(level) ? level[0].replace('.json', '') : undefined;
    };
    /**
     * @returns {SupportedFeatures} Image formats, qualities and region / size calculation
     * methods that are supported by the IIIF service.
     */
    IIIFInfo.prototype.getComplianceLevelSupportedFeatures = function () {
        if (this.imageInfo === undefined) {
            return;
        }
        var version = this.getImageApiVersion();
        var level = this.getComplianceLevelFromProfile(version);
        if (level === undefined) {
            return IIIF_PROFILE_VALUES['none']['none'];
        }
        return IIIF_PROFILE_VALUES[version][level];
    };
    /**
     * @param {PreferredOptions=} opt_preferredOptions Optional options for preferred format and quality.
     * @returns {import("../source/IIIF.js").Options} IIIF tile source ready constructor options.
     * @api
     */
    IIIFInfo.prototype.getTileSourceOptions = function (opt_preferredOptions) {
        var options = opt_preferredOptions || {}, version = this.getImageApiVersion();
        if (version === undefined) {
            return;
        }
        var imageOptions = version === undefined ? undefined : versionFunctions[version](this);
        if (imageOptions === undefined) {
            return;
        }
        return {
            url: imageOptions.url,
            version: version,
            size: [this.imageInfo.width, this.imageInfo.height],
            sizes: imageOptions.sizes,
            format: options.format !== undefined && imageOptions.formats.includes(options.format) ? options.format :
                imageOptions.preferredFormat !== undefined ? imageOptions.preferredFormat : 'jpg',
            supports: imageOptions.supports,
            quality: options.quality && imageOptions.qualities.includes(options.quality) ?
                options.quality : imageOptions.qualities.includes('native') ? 'native' : 'default',
            resolutions: Array.isArray(imageOptions.resolutions) ? imageOptions.resolutions.sort(function (a, b) {
                return b - a;
            }) : undefined,
            tileSize: imageOptions.tileSize
        };
    };
    return IIIFInfo;
}());
/* harmony default export */ __webpack_exports__["default"] = (IIIFInfo);

//# sourceMappingURL=IIIFInfo.js.map

/***/ }),

/***/ "./node_modules/ol/format/JSONFeature.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/format/JSONFeature.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _FormatType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FormatType.js */ "./node_modules/ol/format/FormatType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/JSONFeature
 */



/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Base class for JSON feature formats.
 *
 * @abstract
 */
var JSONFeature = /** @class */ (function (_super) {
    __extends(JSONFeature, _super);
    function JSONFeature() {
        return _super.call(this) || this;
    }
    /**
     * @inheritDoc
     */
    JSONFeature.prototype.getType = function () {
        return _FormatType_js__WEBPACK_IMPORTED_MODULE_2__["default"].JSON;
    };
    /**
     * Read a feature.  Only works for a single feature. Use `readFeatures` to
     * read a feature collection.
     *
     * @param {ArrayBuffer|Document|Node|Object|string} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @return {import("../Feature.js").default} Feature.
     * @api
     */
    JSONFeature.prototype.readFeature = function (source, opt_options) {
        return this.readFeatureFromObject(getObject(source), this.getReadOptions(source, opt_options));
    };
    /**
     * Read all features.  Works with both a single feature and a feature
     * collection.
     *
     * @param {ArrayBuffer|Document|Node|Object|string} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @return {Array<import("../Feature.js").default>} Features.
     * @api
     */
    JSONFeature.prototype.readFeatures = function (source, opt_options) {
        return this.readFeaturesFromObject(getObject(source), this.getReadOptions(source, opt_options));
    };
    /**
     * @abstract
     * @param {Object} object Object.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @protected
     * @return {import("../Feature.js").default} Feature.
     */
    JSONFeature.prototype.readFeatureFromObject = function (object, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @abstract
     * @param {Object} object Object.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @protected
     * @return {Array<import("../Feature.js").default>} Features.
     */
    JSONFeature.prototype.readFeaturesFromObject = function (object, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Read a geometry.
     *
     * @param {ArrayBuffer|Document|Node|Object|string} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @return {import("../geom/Geometry.js").default} Geometry.
     * @api
     */
    JSONFeature.prototype.readGeometry = function (source, opt_options) {
        return this.readGeometryFromObject(getObject(source), this.getReadOptions(source, opt_options));
    };
    /**
     * @abstract
     * @param {Object} object Object.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @protected
     * @return {import("../geom/Geometry.js").default} Geometry.
     */
    JSONFeature.prototype.readGeometryFromObject = function (object, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Read the projection.
     *
     * @param {ArrayBuffer|Document|Node|Object|string} source Source.
     * @return {import("../proj/Projection.js").default} Projection.
     * @api
     */
    JSONFeature.prototype.readProjection = function (source) {
        return this.readProjectionFromObject(getObject(source));
    };
    /**
     * @abstract
     * @param {Object} object Object.
     * @protected
     * @return {import("../proj/Projection.js").default} Projection.
     */
    JSONFeature.prototype.readProjectionFromObject = function (object) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Encode a feature as string.
     *
     * @param {import("../Feature.js").default} feature Feature.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {string} Encoded feature.
     * @api
     */
    JSONFeature.prototype.writeFeature = function (feature, opt_options) {
        return JSON.stringify(this.writeFeatureObject(feature, opt_options));
    };
    /**
     * @abstract
     * @param {import("../Feature.js").default} feature Feature.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {Object} Object.
     */
    JSONFeature.prototype.writeFeatureObject = function (feature, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Encode an array of features as string.
     *
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {string} Encoded features.
     * @api
     */
    JSONFeature.prototype.writeFeatures = function (features, opt_options) {
        return JSON.stringify(this.writeFeaturesObject(features, opt_options));
    };
    /**
     * @abstract
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {Object} Object.
     */
    JSONFeature.prototype.writeFeaturesObject = function (features, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Encode a geometry as string.
     *
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {string} Encoded geometry.
     * @api
     */
    JSONFeature.prototype.writeGeometry = function (geometry, opt_options) {
        return JSON.stringify(this.writeGeometryObject(geometry, opt_options));
    };
    /**
     * @abstract
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {Object} Object.
     */
    JSONFeature.prototype.writeGeometryObject = function (geometry, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    return JSONFeature;
}(_Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * @param {Document|Node|Object|string} source Source.
 * @return {Object} Object.
 */
function getObject(source) {
    if (typeof source === 'string') {
        var object = JSON.parse(source);
        return object ? /** @type {Object} */ (object) : null;
    }
    else if (source !== null) {
        return source;
    }
    else {
        return null;
    }
}
/* harmony default export */ __webpack_exports__["default"] = (JSONFeature);
//# sourceMappingURL=JSONFeature.js.map

/***/ }),

/***/ "./node_modules/ol/format/KML.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/KML.js ***!
  \***************************************/
/*! exports provided: getDefaultFillStyle, getDefaultImageStyle, getDefaultStrokeStyle, getDefaultTextStyle, getDefaultStyle, getDefaultStyleArray, readFlatCoordinates, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultFillStyle", function() { return getDefaultFillStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultImageStyle", function() { return getDefaultImageStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultStrokeStyle", function() { return getDefaultStrokeStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultTextStyle", function() { return getDefaultTextStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultStyle", function() { return getDefaultStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultStyleArray", function() { return getDefaultStyleArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readFlatCoordinates", function() { return readFlatCoordinates; });
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../color.js */ "./node_modules/ol/color.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _XMLFeature_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./XMLFeature.js */ "./node_modules/ol/format/XMLFeature.js");
/* harmony import */ var _xsd_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./xsd.js */ "./node_modules/ol/format/xsd.js");
/* harmony import */ var _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/GeometryCollection.js */ "./node_modules/ol/geom/GeometryCollection.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _style_Fill_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../style/Fill.js */ "./node_modules/ol/style/Fill.js");
/* harmony import */ var _style_Icon_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../style/Icon.js */ "./node_modules/ol/style/Icon.js");
/* harmony import */ var _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../style/IconAnchorUnits.js */ "./node_modules/ol/style/IconAnchorUnits.js");
/* harmony import */ var _style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../style/IconOrigin.js */ "./node_modules/ol/style/IconOrigin.js");
/* harmony import */ var _style_Stroke_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../style/Stroke.js */ "./node_modules/ol/style/Stroke.js");
/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/ol/style/Style.js");
/* harmony import */ var _style_Text_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../style/Text.js */ "./node_modules/ol/style/Text.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/KML
 */


























/**
 * @typedef {Object} Vec2
 * @property {number} x
 * @property {IconAnchorUnits} xunits
 * @property {number} y
 * @property {IconAnchorUnits} yunits
 * @property {IconOrigin} origin
 */
/**
 * @typedef {Object} GxTrackObject
 * @property {Array<number>} flatCoordinates
 * @property {Array<number>} whens
 */
/**
 * @const
 * @type {Array<string>}
 */
var GX_NAMESPACE_URIS = [
    'http://www.google.com/kml/ext/2.2'
];
/**
 * @const
 * @type {Array<null|string>}
 */
var NAMESPACE_URIS = [
    null,
    'http://earth.google.com/kml/2.0',
    'http://earth.google.com/kml/2.1',
    'http://earth.google.com/kml/2.2',
    'http://www.opengis.net/kml/2.2'
];
/**
 * @const
 * @type {string}
 */
var SCHEMA_LOCATION = 'http://www.opengis.net/kml/2.2 ' +
    'https://developers.google.com/kml/schema/kml22gx.xsd';
/**
 * @type {Object<string, IconAnchorUnits>}
 */
var ICON_ANCHOR_UNITS_MAP = {
    'fraction': _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].FRACTION,
    'pixels': _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].PIXELS,
    'insetPixels': _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].PIXELS
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var PLACEMARK_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'ExtendedData': extendedDataParser,
    'Region': regionParser,
    'MultiGeometry': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readMultiGeometry, 'geometry'),
    'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readLineString, 'geometry'),
    'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readLinearRing, 'geometry'),
    'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readPoint, 'geometry'),
    'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readPolygon, 'geometry'),
    'Style': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readStyle),
    'StyleMap': placemarkStyleMapParser,
    'address': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'description': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'open': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readBoolean"]),
    'phoneNumber': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'styleUrl': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readURI),
    'visibility': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readBoolean"])
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(GX_NAMESPACE_URIS, {
    'MultiTrack': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readGxMultiTrack, 'geometry'),
    'Track': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readGxTrack, 'geometry')
}));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var NETWORK_LINK_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'ExtendedData': extendedDataParser,
    'Region': regionParser,
    'Link': linkParser,
    'address': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'description': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'open': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readBoolean"]),
    'phoneNumber': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'visibility': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readBoolean"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var LINK_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'href': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readURI)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var REGION_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'LatLonAltBox': latLonAltBoxParser,
    'Lod': lodParser
});
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var KML_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'Document', 'Placemark'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var KML_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'Document': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeDocument),
    'Placemark': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePlacemark)
});
/**
 * @type {import("../color.js").Color}
 */
var DEFAULT_COLOR;
/**
 * @type {Fill}
 */
var DEFAULT_FILL_STYLE = null;
/**
 * Get the default fill style (or null if not yet set).
 * @return {Fill} The default fill style.
 */
function getDefaultFillStyle() {
    return DEFAULT_FILL_STYLE;
}
/**
 * @type {import("../size.js").Size}
 */
var DEFAULT_IMAGE_STYLE_ANCHOR;
/**
 * @type {IconAnchorUnits}
 */
var DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;
/**
 * @type {IconAnchorUnits}
 */
var DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;
/**
 * @type {import("../size.js").Size}
 */
var DEFAULT_IMAGE_STYLE_SIZE;
/**
 * @type {string}
 */
var DEFAULT_IMAGE_STYLE_SRC;
/**
 * @type {number}
 */
var DEFAULT_IMAGE_SCALE_MULTIPLIER;
/**
 * @type {import("../style/Image.js").default}
 */
var DEFAULT_IMAGE_STYLE = null;
/**
 * Get the default image style (or null if not yet set).
 * @return {import("../style/Image.js").default} The default image style.
 */
function getDefaultImageStyle() {
    return DEFAULT_IMAGE_STYLE;
}
/**
 * @type {string}
 */
var DEFAULT_NO_IMAGE_STYLE;
/**
 * @type {Stroke}
 */
var DEFAULT_STROKE_STYLE = null;
/**
 * Get the default stroke style (or null if not yet set).
 * @return {Stroke} The default stroke style.
 */
function getDefaultStrokeStyle() {
    return DEFAULT_STROKE_STYLE;
}
/**
 * @type {Stroke}
 */
var DEFAULT_TEXT_STROKE_STYLE;
/**
 * @type {Text}
 */
var DEFAULT_TEXT_STYLE = null;
/**
 * Get the default text style (or null if not yet set).
 * @return {Text} The default text style.
 */
function getDefaultTextStyle() {
    return DEFAULT_TEXT_STYLE;
}
/**
 * @type {Style}
 */
var DEFAULT_STYLE = null;
/**
 * Get the default style (or null if not yet set).
 * @return {Style} The default style.
 */
function getDefaultStyle() {
    return DEFAULT_STYLE;
}
/**
 * @type {Array<Style>}
 */
var DEFAULT_STYLE_ARRAY = null;
/**
 * Get the default style array (or null if not yet set).
 * @return {Array<Style>} The default style.
 */
function getDefaultStyleArray() {
    return DEFAULT_STYLE_ARRAY;
}
function createStyleDefaults() {
    DEFAULT_COLOR = [255, 255, 255, 1];
    DEFAULT_FILL_STYLE = new _style_Fill_js__WEBPACK_IMPORTED_MODULE_18__["default"]({
        color: DEFAULT_COLOR
    });
    DEFAULT_IMAGE_STYLE_ANCHOR = [20, 2]; // FIXME maybe [8, 32] ?
    DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS = _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].PIXELS;
    DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS = _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].PIXELS;
    DEFAULT_IMAGE_STYLE_SIZE = [64, 64];
    DEFAULT_IMAGE_STYLE_SRC =
        'https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png';
    DEFAULT_IMAGE_SCALE_MULTIPLIER = 0.5;
    DEFAULT_IMAGE_STYLE = new _style_Icon_js__WEBPACK_IMPORTED_MODULE_19__["default"]({
        anchor: DEFAULT_IMAGE_STYLE_ANCHOR,
        anchorOrigin: _style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_21__["default"].BOTTOM_LEFT,
        anchorXUnits: DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS,
        anchorYUnits: DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS,
        crossOrigin: 'anonymous',
        rotation: 0,
        scale: DEFAULT_IMAGE_SCALE_MULTIPLIER,
        size: DEFAULT_IMAGE_STYLE_SIZE,
        src: DEFAULT_IMAGE_STYLE_SRC
    });
    DEFAULT_NO_IMAGE_STYLE = 'NO_IMAGE';
    DEFAULT_STROKE_STYLE = new _style_Stroke_js__WEBPACK_IMPORTED_MODULE_22__["default"]({
        color: DEFAULT_COLOR,
        width: 1
    });
    DEFAULT_TEXT_STROKE_STYLE = new _style_Stroke_js__WEBPACK_IMPORTED_MODULE_22__["default"]({
        color: [51, 51, 51, 1],
        width: 2
    });
    DEFAULT_TEXT_STYLE = new _style_Text_js__WEBPACK_IMPORTED_MODULE_24__["default"]({
        font: 'bold 16px Helvetica',
        fill: DEFAULT_FILL_STYLE,
        stroke: DEFAULT_TEXT_STROKE_STYLE,
        scale: 0.8
    });
    DEFAULT_STYLE = new _style_Style_js__WEBPACK_IMPORTED_MODULE_23__["default"]({
        fill: DEFAULT_FILL_STYLE,
        image: DEFAULT_IMAGE_STYLE,
        text: DEFAULT_TEXT_STYLE,
        stroke: DEFAULT_STROKE_STYLE,
        zIndex: 0
    });
    DEFAULT_STYLE_ARRAY = [DEFAULT_STYLE];
}
/**
 * @type {HTMLTextAreaElement}
 */
var TEXTAREA;
/**
 * @typedef {Object} Options
 * @property {boolean} [extractStyles=true] Extract styles from the KML.
 * @property {boolean} [showPointNames=true] Show names as labels for placemarks which contain points.
 * @property {Array<Style>} [defaultStyle] Default style. The
 * default default style is the same as Google Earth.
 * @property {boolean} [writeStyles=true] Write styles into KML.
 * @property {null|string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loaded images. Note that you must provide a
 * `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 */
/**
 * @classdesc
 * Feature format for reading and writing data in the KML format.
 *
 * {@link module:ol/format/KML~KML#readFeature} will read the first feature from
 * a KML source.
 *
 * MultiGeometries are converted into GeometryCollections if they are a mix of
 * geometry types, and into MultiPoint/MultiLineString/MultiPolygon if they are
 * all of the same type.
 *
 * Note that the KML format uses the URL() constructor. Older browsers such as IE
 * which do not support this will need a URL polyfill to be loaded before use.
 *
 * @api
 */
var KML = /** @class */ (function (_super) {
    __extends(KML, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function KML(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        if (!DEFAULT_STYLE_ARRAY) {
            createStyleDefaults();
        }
        /**
         * @inheritDoc
         */
        _this.dataProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_17__["get"])('EPSG:4326');
        /**
         * @private
         * @type {Array<Style>}
         */
        _this.defaultStyle_ = options.defaultStyle ?
            options.defaultStyle : DEFAULT_STYLE_ARRAY;
        /**
         * @private
         * @type {boolean}
         */
        _this.extractStyles_ = options.extractStyles !== undefined ?
            options.extractStyles : true;
        /**
         * @private
         * @type {boolean}
         */
        _this.writeStyles_ = options.writeStyles !== undefined ?
            options.writeStyles : true;
        /**
         * @private
         * @type {!Object<string, (Array<Style>|string)>}
         */
        _this.sharedStyles_ = {};
        /**
         * @private
         * @type {boolean}
         */
        _this.showPointNames_ = options.showPointNames !== undefined ?
            options.showPointNames : true;
        /**
         * @private
         * @type {null|string}
         */
        _this.crossOrigin_ = options.crossOrigin !== undefined ?
            options.crossOrigin : 'anonymous';
        return _this;
    }
    /**
     * @param {Node} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Array<Feature>|undefined} Features.
     */
    KML.prototype.readDocumentOrFolder_ = function (node, objectStack) {
        // FIXME use scope somehow
        var parsersNS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
            'Document': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayExtender"])(this.readDocumentOrFolder_, this),
            'Folder': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayExtender"])(this.readDocumentOrFolder_, this),
            'Placemark': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayPusher"])(this.readPlacemark_, this),
            'Style': this.readSharedStyle_.bind(this),
            'StyleMap': this.readSharedStyleMap_.bind(this)
        });
        /** @type {Array<Feature>} */
        // @ts-ignore
        var features = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])([], parsersNS, node, objectStack, this);
        if (features) {
            return features;
        }
        else {
            return undefined;
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     * @return {Feature|undefined} Feature.
     */
    KML.prototype.readPlacemark_ = function (node, objectStack) {
        var object = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({ 'geometry': null }, PLACEMARK_PARSERS, node, objectStack, this);
        if (!object) {
            return undefined;
        }
        var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
        var id = node.getAttribute('id');
        if (id !== null) {
            feature.setId(id);
        }
        var options = /** @type {import("./Feature.js").ReadOptions} */ (objectStack[0]);
        var geometry = object['geometry'];
        if (geometry) {
            Object(_Feature_js__WEBPACK_IMPORTED_MODULE_4__["transformGeometryWithOptions"])(geometry, false, options);
        }
        feature.setGeometry(geometry);
        delete object['geometry'];
        if (this.extractStyles_) {
            var style = object['Style'];
            var styleUrl = object['styleUrl'];
            var styleFunction = createFeatureStyleFunction(style, styleUrl, this.defaultStyle_, this.sharedStyles_, this.showPointNames_);
            feature.setStyle(styleFunction);
        }
        delete object['Style'];
        // we do not remove the styleUrl property from the object, so it
        // gets stored on feature when setProperties is called
        feature.setProperties(object, true);
        return feature;
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    KML.prototype.readSharedStyle_ = function (node, objectStack) {
        var id = node.getAttribute('id');
        if (id !== null) {
            var style = readStyle.call(this, node, objectStack);
            if (style) {
                var styleUri = void 0;
                var baseURI = node.baseURI;
                if (!baseURI || baseURI == 'about:blank') {
                    baseURI = window.location.href;
                }
                if (baseURI) {
                    var url = new URL('#' + id, baseURI);
                    styleUri = url.href;
                }
                else {
                    styleUri = '#' + id;
                }
                this.sharedStyles_[styleUri] = style;
            }
        }
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @private
     */
    KML.prototype.readSharedStyleMap_ = function (node, objectStack) {
        var id = node.getAttribute('id');
        if (id === null) {
            return;
        }
        var styleMapValue = readStyleMapValue.call(this, node, objectStack);
        if (!styleMapValue) {
            return;
        }
        var styleUri;
        var baseURI = node.baseURI;
        if (!baseURI || baseURI == 'about:blank') {
            baseURI = window.location.href;
        }
        if (baseURI) {
            var url = new URL('#' + id, baseURI);
            styleUri = url.href;
        }
        else {
            styleUri = '#' + id;
        }
        this.sharedStyles_[styleUri] = styleMapValue;
    };
    /**
     * @inheritDoc
     */
    KML.prototype.readFeatureFromNode = function (node, opt_options) {
        if (!Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, node.namespaceURI)) {
            return null;
        }
        var feature = this.readPlacemark_(node, [this.getReadOptions(node, opt_options)]);
        if (feature) {
            return feature;
        }
        else {
            return null;
        }
    };
    /**
     * @inheritDoc
     */
    KML.prototype.readFeaturesFromNode = function (node, opt_options) {
        if (!Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, node.namespaceURI)) {
            return [];
        }
        var features;
        var localName = node.localName;
        if (localName == 'Document' || localName == 'Folder') {
            features = this.readDocumentOrFolder_(node, [this.getReadOptions(node, opt_options)]);
            if (features) {
                return features;
            }
            else {
                return [];
            }
        }
        else if (localName == 'Placemark') {
            var feature = this.readPlacemark_(node, [this.getReadOptions(node, opt_options)]);
            if (feature) {
                return [feature];
            }
            else {
                return [];
            }
        }
        else if (localName == 'kml') {
            features = [];
            for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
                var fs = this.readFeaturesFromNode(n, opt_options);
                if (fs) {
                    Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(features, fs);
                }
            }
            return features;
        }
        else {
            return [];
        }
    };
    /**
     * Read the name of the KML.
     *
     * @param {Document|Element|string} source Source.
     * @return {string|undefined} Name.
     * @api
     */
    KML.prototype.readName = function (source) {
        if (!source) {
            return undefined;
        }
        else if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["parse"])(source);
            return this.readNameFromDocument(doc);
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["isDocument"])(source)) {
            return this.readNameFromDocument(/** @type {Document} */ (source));
        }
        else {
            return this.readNameFromNode(/** @type {Element} */ (source));
        }
    };
    /**
     * @param {Document} doc Document.
     * @return {string|undefined} Name.
     */
    KML.prototype.readNameFromDocument = function (doc) {
        for (var n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                var name_1 = this.readNameFromNode(/** @type {Element} */ (n));
                if (name_1) {
                    return name_1;
                }
            }
        }
        return undefined;
    };
    /**
     * @param {Element} node Node.
     * @return {string|undefined} Name.
     */
    KML.prototype.readNameFromNode = function (node) {
        for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
            if (Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, n.namespaceURI) &&
                n.localName == 'name') {
                return Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"])(n);
            }
        }
        for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
            var localName = n.localName;
            if (Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, n.namespaceURI) &&
                (localName == 'Document' ||
                    localName == 'Folder' ||
                    localName == 'Placemark' ||
                    localName == 'kml')) {
                var name_2 = this.readNameFromNode(n);
                if (name_2) {
                    return name_2;
                }
            }
        }
        return undefined;
    };
    /**
     * Read the network links of the KML.
     *
     * @param {Document|Element|string} source Source.
     * @return {Array<Object>} Network links.
     * @api
     */
    KML.prototype.readNetworkLinks = function (source) {
        var networkLinks = [];
        if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["parse"])(source);
            Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(networkLinks, this.readNetworkLinksFromDocument(doc));
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["isDocument"])(source)) {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(networkLinks, this.readNetworkLinksFromDocument(
            /** @type {Document} */ (source)));
        }
        else {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(networkLinks, this.readNetworkLinksFromNode(
            /** @type {Element} */ (source)));
        }
        return networkLinks;
    };
    /**
     * @param {Document} doc Document.
     * @return {Array<Object>} Network links.
     */
    KML.prototype.readNetworkLinksFromDocument = function (doc) {
        var networkLinks = [];
        for (var n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(networkLinks, this.readNetworkLinksFromNode(/** @type {Element} */ (n)));
            }
        }
        return networkLinks;
    };
    /**
     * @param {Element} node Node.
     * @return {Array<Object>} Network links.
     */
    KML.prototype.readNetworkLinksFromNode = function (node) {
        var networkLinks = [];
        for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
            if (Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, n.namespaceURI) &&
                n.localName == 'NetworkLink') {
                var obj = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, NETWORK_LINK_PARSERS, n, []);
                networkLinks.push(obj);
            }
        }
        for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
            var localName = n.localName;
            if (Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, n.namespaceURI) &&
                (localName == 'Document' ||
                    localName == 'Folder' ||
                    localName == 'kml')) {
                Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(networkLinks, this.readNetworkLinksFromNode(n));
            }
        }
        return networkLinks;
    };
    /**
     * Read the regions of the KML.
     *
     * @param {Document|Element|string} source Source.
     * @return {Array<Object>} Regions.
     * @api
     */
    KML.prototype.readRegion = function (source) {
        var regions = [];
        if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["parse"])(source);
            Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(regions, this.readRegionFromDocument(doc));
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["isDocument"])(source)) {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(regions, this.readRegionFromDocument(
            /** @type {Document} */ (source)));
        }
        else {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(regions, this.readRegionFromNode(
            /** @type {Element} */ (source)));
        }
        return regions;
    };
    /**
     * @param {Document} doc Document.
     * @return {Array<Object>} Region.
     */
    KML.prototype.readRegionFromDocument = function (doc) {
        var regions = [];
        for (var n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(regions, this.readRegionFromNode(/** @type {Element} */ (n)));
            }
        }
        return regions;
    };
    /**
     * @param {Element} node Node.
     * @return {Array<Object>} Region.
     * @api
     */
    KML.prototype.readRegionFromNode = function (node) {
        var regions = [];
        for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
            if (Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, n.namespaceURI) &&
                n.localName == 'Region') {
                var obj = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, REGION_PARSERS, n, []);
                regions.push(obj);
            }
        }
        for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
            var localName = n.localName;
            if (Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(NAMESPACE_URIS, n.namespaceURI) &&
                (localName == 'Document' ||
                    localName == 'Folder' ||
                    localName == 'kml')) {
                Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(regions, this.readRegionFromNode(n));
            }
        }
        return regions;
    };
    /**
     * Encode an array of features in the KML format as an XML node. GeometryCollections,
     * MultiPoints, MultiLineStrings, and MultiPolygons are output as MultiGeometries.
     *
     * @param {Array<Feature>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Options.
     * @return {Node} Node.
     * @override
     * @api
     */
    KML.prototype.writeFeaturesNode = function (features, opt_options) {
        opt_options = this.adaptOptions(opt_options);
        var kml = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["createElementNS"])(NAMESPACE_URIS[4], 'kml');
        var xmlnsUri = 'http://www.w3.org/2000/xmlns/';
        kml.setAttributeNS(xmlnsUri, 'xmlns:gx', GX_NAMESPACE_URIS[0]);
        kml.setAttributeNS(xmlnsUri, 'xmlns:xsi', _xml_js__WEBPACK_IMPORTED_MODULE_25__["XML_SCHEMA_INSTANCE_URI"]);
        kml.setAttributeNS(_xml_js__WEBPACK_IMPORTED_MODULE_25__["XML_SCHEMA_INSTANCE_URI"], 'xsi:schemaLocation', SCHEMA_LOCATION);
        var /** @type {import("../xml.js").NodeStackItem} */ context = { node: kml };
        /** @type {!Object<string, (Array<Feature>|Feature|undefined)>} */
        var properties = {};
        if (features.length > 1) {
            properties['Document'] = features;
        }
        else if (features.length == 1) {
            properties['Placemark'] = features[0];
        }
        var orderedKeys = KML_SEQUENCE[kml.namespaceURI];
        var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, orderedKeys);
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, KML_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, [opt_options], orderedKeys, this);
        return kml;
    };
    return KML;
}(_XMLFeature_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/**
 * @param {Style|undefined} foundStyle Style.
 * @param {string} name Name.
 * @return {Style} style Style.
 */
function createNameStyleFunction(foundStyle, name) {
    var textOffset = [0, 0];
    var textAlign = 'start';
    var imageStyle = foundStyle.getImage();
    if (imageStyle) {
        var imageSize = imageStyle.getImageSize();
        if (imageSize === null) {
            imageSize = DEFAULT_IMAGE_STYLE_SIZE;
        }
        if (imageSize.length == 2) {
            var imageScale = imageStyle.getScale();
            // Offset the label to be centered to the right of the icon,
            // if there is one.
            textOffset[0] = imageScale * imageSize[0] / 2;
            textOffset[1] = -imageScale * imageSize[1] / 2;
            textAlign = 'left';
        }
    }
    var textStyle = foundStyle.getText();
    if (textStyle) {
        // clone the text style, customizing it with name, alignments and offset.
        // Note that kml does not support many text options that OpenLayers does (rotation, textBaseline).
        textStyle = textStyle.clone();
        textStyle.setFont(textStyle.getFont() || DEFAULT_TEXT_STYLE.getFont());
        textStyle.setScale(textStyle.getScale() || DEFAULT_TEXT_STYLE.getScale());
        textStyle.setFill(textStyle.getFill() || DEFAULT_TEXT_STYLE.getFill());
        textStyle.setStroke(textStyle.getStroke() || DEFAULT_TEXT_STROKE_STYLE);
    }
    else {
        textStyle = DEFAULT_TEXT_STYLE.clone();
    }
    textStyle.setText(name);
    textStyle.setOffsetX(textOffset[0]);
    textStyle.setOffsetY(textOffset[1]);
    textStyle.setTextAlign(textAlign);
    var nameStyle = new _style_Style_js__WEBPACK_IMPORTED_MODULE_23__["default"]({
        image: imageStyle,
        text: textStyle
    });
    return nameStyle;
}
/**
 * @param {Array<Style>|undefined} style Style.
 * @param {string} styleUrl Style URL.
 * @param {Array<Style>} defaultStyle Default style.
 * @param {!Object<string, (Array<Style>|string)>} sharedStyles Shared styles.
 * @param {boolean|undefined} showPointNames true to show names for point placemarks.
 * @return {import("../style/Style.js").StyleFunction} Feature style function.
 */
function createFeatureStyleFunction(style, styleUrl, defaultStyle, sharedStyles, showPointNames) {
    return (
    /**
     * @param {Feature} feature feature.
     * @param {number} resolution Resolution.
     * @return {Array<Style>|Style} Style.
     */
    function (feature, resolution) {
        var drawName = showPointNames;
        var name = '';
        var multiGeometryPoints = [];
        if (drawName) {
            var geometry = feature.getGeometry();
            if (geometry) {
                var type = geometry.getType();
                if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOMETRY_COLLECTION) {
                    multiGeometryPoints = geometry.getGeometriesArrayRecursive().filter(function (geometry) {
                        var type = geometry.getType();
                        return type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POINT || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POINT;
                    });
                    drawName = multiGeometryPoints.length > 0;
                }
                else {
                    drawName = type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POINT || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POINT;
                }
            }
        }
        if (drawName) {
            name = /** @type {string} */ (feature.get('name'));
            drawName = drawName && !!name;
            // convert any html character codes
            if (drawName && name.search(/&[^&]+;/) > -1) {
                if (!TEXTAREA) {
                    TEXTAREA = document.createElement('textarea');
                }
                TEXTAREA.innerHTML = name;
                name = TEXTAREA.value;
            }
        }
        var featureStyle = defaultStyle;
        if (style) {
            featureStyle = style;
        }
        else if (styleUrl) {
            featureStyle = findStyle(styleUrl, defaultStyle, sharedStyles);
        }
        if (drawName) {
            var nameStyle = createNameStyleFunction(featureStyle[0], name);
            if (multiGeometryPoints.length > 0) {
                // in multigeometries restrict the name style to points and create a
                // style without image or text for geometries requiring fill or stroke
                // including any polygon specific style if there is one
                nameStyle.setGeometry(new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__["default"](multiGeometryPoints));
                var baseStyle = new _style_Style_js__WEBPACK_IMPORTED_MODULE_23__["default"]({
                    geometry: featureStyle[0].getGeometry(),
                    image: null,
                    fill: featureStyle[0].getFill(),
                    stroke: featureStyle[0].getStroke(),
                    text: null
                });
                return [nameStyle, baseStyle].concat(featureStyle.slice(1));
            }
            return nameStyle;
        }
        return featureStyle;
    });
}
/**
 * @param {Array<Style>|string|undefined} styleValue Style value.
 * @param {Array<Style>} defaultStyle Default style.
 * @param {!Object<string, (Array<Style>|string)>} sharedStyles
 * Shared styles.
 * @return {Array<Style>} Style.
 */
function findStyle(styleValue, defaultStyle, sharedStyles) {
    if (Array.isArray(styleValue)) {
        return styleValue;
    }
    else if (typeof styleValue === 'string') {
        // KML files in the wild occasionally forget the leading `#` on styleUrls
        // defined in the same document.  Add a leading `#` if it enables to find
        // a style.
        if (!(styleValue in sharedStyles) && ('#' + styleValue in sharedStyles)) {
            styleValue = '#' + styleValue;
        }
        return findStyle(sharedStyles[styleValue], defaultStyle, sharedStyles);
    }
    else {
        return defaultStyle;
    }
}
/**
 * @param {Node} node Node.
 * @return {import("../color.js").Color|undefined} Color.
 */
function readColor(node) {
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["getAllTextContent"])(node, false);
    // The KML specification states that colors should not include a leading `#`
    // but we tolerate them.
    var m = /^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(s);
    if (m) {
        var hexColor = m[1];
        return [
            parseInt(hexColor.substr(6, 2), 16),
            parseInt(hexColor.substr(4, 2), 16),
            parseInt(hexColor.substr(2, 2), 16),
            parseInt(hexColor.substr(0, 2), 16) / 255
        ];
    }
    else {
        return undefined;
    }
}
/**
 * @param {Node} node Node.
 * @return {Array<number>|undefined} Flat coordinates.
 */
function readFlatCoordinates(node) {
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["getAllTextContent"])(node, false);
    var flatCoordinates = [];
    // The KML specification states that coordinate tuples should not include
    // spaces, but we tolerate them.
    var re = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;
    var m;
    while ((m = re.exec(s))) {
        var x = parseFloat(m[1]);
        var y = parseFloat(m[2]);
        var z = m[3] ? parseFloat(m[3]) : 0;
        flatCoordinates.push(x, y, z);
        s = s.substr(m[0].length);
    }
    if (s !== '') {
        return undefined;
    }
    return flatCoordinates;
}
/**
 * @param {Node} node Node.
 * @return {string} URI.
 */
function readURI(node) {
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["getAllTextContent"])(node, false).trim();
    var baseURI = node.baseURI;
    if (!baseURI || baseURI == 'about:blank') {
        baseURI = window.location.href;
    }
    if (baseURI) {
        var url = new URL(s, baseURI);
        return url.href;
    }
    else {
        return s;
    }
}
/**
 * @param {Element} node Node.
 * @return {Vec2} Vec2.
 */
function readVec2(node) {
    var xunits = node.getAttribute('xunits');
    var yunits = node.getAttribute('yunits');
    var origin;
    if (xunits !== 'insetPixels') {
        if (yunits !== 'insetPixels') {
            origin = _style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_21__["default"].BOTTOM_LEFT;
        }
        else {
            origin = _style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_21__["default"].TOP_LEFT;
        }
    }
    else {
        if (yunits !== 'insetPixels') {
            origin = _style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_21__["default"].BOTTOM_RIGHT;
        }
        else {
            origin = _style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_21__["default"].TOP_RIGHT;
        }
    }
    return {
        x: parseFloat(node.getAttribute('x')),
        xunits: ICON_ANCHOR_UNITS_MAP[xunits],
        y: parseFloat(node.getAttribute('y')),
        yunits: ICON_ANCHOR_UNITS_MAP[yunits],
        origin: origin
    };
}
/**
 * @param {Node} node Node.
 * @return {number|undefined} Scale.
 */
function readScale(node) {
    return Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"])(node);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var STYLE_MAP_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'Pair': pairDataParser
});
/**
 * @this {KML}
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Array<Style>|string|undefined} StyleMap.
 */
function readStyleMapValue(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])(undefined, STYLE_MAP_PARSERS, node, objectStack, this);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var ICON_STYLE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'Icon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readIcon),
    'color': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readColor),
    'heading': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'hotSpot': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readVec2),
    'scale': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readScale)
});
/**
 * @this {KML}
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function iconStyleParser(node, objectStack) {
    // FIXME refreshMode
    // FIXME refreshInterval
    // FIXME viewRefreshTime
    // FIXME viewBoundScale
    // FIXME viewFormat
    // FIXME httpQuery
    var object = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, ICON_STYLE_PARSERS, node, objectStack);
    if (!object) {
        return;
    }
    var styleObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    var IconObject = 'Icon' in object ? object['Icon'] : {};
    var drawIcon = (!('Icon' in object) || Object.keys(IconObject).length > 0);
    var src;
    var href = /** @type {string|undefined} */ (IconObject['href']);
    if (href) {
        src = href;
    }
    else if (drawIcon) {
        src = DEFAULT_IMAGE_STYLE_SRC;
    }
    var anchor, anchorXUnits, anchorYUnits;
    var anchorOrigin = _style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_21__["default"].BOTTOM_LEFT;
    var hotSpot = /** @type {Vec2|undefined} */ (object['hotSpot']);
    if (hotSpot) {
        anchor = [hotSpot.x, hotSpot.y];
        anchorXUnits = hotSpot.xunits;
        anchorYUnits = hotSpot.yunits;
        anchorOrigin = hotSpot.origin;
    }
    else if (src === DEFAULT_IMAGE_STYLE_SRC) {
        anchor = DEFAULT_IMAGE_STYLE_ANCHOR;
        anchorXUnits = DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;
        anchorYUnits = DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;
    }
    else if (/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(src)) {
        anchor = [0.5, 0];
        anchorXUnits = _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].FRACTION;
        anchorYUnits = _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].FRACTION;
    }
    var offset;
    var x = /** @type {number|undefined} */ (IconObject['x']);
    var y = /** @type {number|undefined} */ (IconObject['y']);
    if (x !== undefined && y !== undefined) {
        offset = [x, y];
    }
    var size;
    var w = /** @type {number|undefined} */ (IconObject['w']);
    var h = /** @type {number|undefined} */ (IconObject['h']);
    if (w !== undefined && h !== undefined) {
        size = [w, h];
    }
    var rotation;
    var heading = /** @type {number} */ (object['heading']);
    if (heading !== undefined) {
        rotation = Object(_math_js__WEBPACK_IMPORTED_MODULE_16__["toRadians"])(heading);
    }
    var scale = /** @type {number|undefined} */ (object['scale']);
    var color = /** @type {Array<number>|undefined} */ (object['color']);
    if (drawIcon) {
        if (src == DEFAULT_IMAGE_STYLE_SRC) {
            size = DEFAULT_IMAGE_STYLE_SIZE;
            if (scale === undefined) {
                scale = DEFAULT_IMAGE_SCALE_MULTIPLIER;
            }
        }
        var imageStyle = new _style_Icon_js__WEBPACK_IMPORTED_MODULE_19__["default"]({
            anchor: anchor,
            anchorOrigin: anchorOrigin,
            anchorXUnits: anchorXUnits,
            anchorYUnits: anchorYUnits,
            crossOrigin: this.crossOrigin_,
            offset: offset,
            offsetOrigin: _style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_21__["default"].BOTTOM_LEFT,
            rotation: rotation,
            scale: scale,
            size: size,
            src: src,
            color: color
        });
        styleObject['imageStyle'] = imageStyle;
    }
    else {
        // handle the case when we explicitly want to draw no icon.
        styleObject['imageStyle'] = DEFAULT_NO_IMAGE_STYLE;
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var LABEL_STYLE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'color': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readColor),
    'scale': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readScale)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function labelStyleParser(node, objectStack) {
    // FIXME colorMode
    var object = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, LABEL_STYLE_PARSERS, node, objectStack);
    if (!object) {
        return;
    }
    var styleObject = objectStack[objectStack.length - 1];
    var textStyle = new _style_Text_js__WEBPACK_IMPORTED_MODULE_24__["default"]({
        fill: new _style_Fill_js__WEBPACK_IMPORTED_MODULE_18__["default"]({
            color: /** @type {import("../color.js").Color} */ ('color' in object ? object['color'] : DEFAULT_COLOR)
        }),
        scale: /** @type {number|undefined} */ (object['scale'])
    });
    styleObject['textStyle'] = textStyle;
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var LINE_STYLE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'color': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readColor),
    'width': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"])
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function lineStyleParser(node, objectStack) {
    // FIXME colorMode
    // FIXME gx:outerColor
    // FIXME gx:outerWidth
    // FIXME gx:physicalWidth
    // FIXME gx:labelVisibility
    var object = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, LINE_STYLE_PARSERS, node, objectStack);
    if (!object) {
        return;
    }
    var styleObject = objectStack[objectStack.length - 1];
    var strokeStyle = new _style_Stroke_js__WEBPACK_IMPORTED_MODULE_22__["default"]({
        color: /** @type {import("../color.js").Color} */ ('color' in object ? object['color'] : DEFAULT_COLOR),
        width: /** @type {number} */ ('width' in object ? object['width'] : 1)
    });
    styleObject['strokeStyle'] = strokeStyle;
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var POLY_STYLE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'color': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readColor),
    'fill': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readBoolean"]),
    'outline': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readBoolean"])
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function polyStyleParser(node, objectStack) {
    // FIXME colorMode
    var object = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, POLY_STYLE_PARSERS, node, objectStack);
    if (!object) {
        return;
    }
    var styleObject = objectStack[objectStack.length - 1];
    var fillStyle = new _style_Fill_js__WEBPACK_IMPORTED_MODULE_18__["default"]({
        color: /** @type {import("../color.js").Color} */ ('color' in object ? object['color'] : DEFAULT_COLOR)
    });
    styleObject['fillStyle'] = fillStyle;
    var fill = /** @type {boolean|undefined} */ (object['fill']);
    if (fill !== undefined) {
        styleObject['fill'] = fill;
    }
    var outline = /** @type {boolean|undefined} */ (object['outline']);
    if (outline !== undefined) {
        styleObject['outline'] = outline;
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var FLAT_LINEAR_RING_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'coordinates': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeReplacer"])(readFlatCoordinates)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Array<number>} LinearRing flat coordinates.
 */
function readFlatLinearRing(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])(null, FLAT_LINEAR_RING_PARSERS, node, objectStack);
}
/**
 * @param {Node} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function gxCoordParser(node, objectStack) {
    var gxTrackObject = /** @type {GxTrackObject} */ (objectStack[objectStack.length - 1]);
    var flatCoordinates = gxTrackObject.flatCoordinates;
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["getAllTextContent"])(node, false);
    var re = /^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i;
    var m = re.exec(s);
    if (m) {
        var x = parseFloat(m[1]);
        var y = parseFloat(m[2]);
        var z = parseFloat(m[3]);
        flatCoordinates.push(x, y, z, 0);
    }
    else {
        flatCoordinates.push(0, 0, 0, 0);
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var GX_MULTITRACK_GEOMETRY_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(GX_NAMESPACE_URIS, {
    'Track': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayPusher"])(readGxTrack)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {MultiLineString|undefined} MultiLineString.
 */
function readGxMultiTrack(node, objectStack) {
    var lineStrings = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])([], GX_MULTITRACK_GEOMETRY_PARSERS, node, objectStack);
    if (!lineStrings) {
        return undefined;
    }
    return new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_11__["default"](lineStrings);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var GX_TRACK_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'when': whenParser
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(GX_NAMESPACE_URIS, {
    'coord': gxCoordParser
}));
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {LineString|undefined} LineString.
 */
function readGxTrack(node, objectStack) {
    var gxTrackObject = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])(
    /** @type {GxTrackObject} */ ({
        flatCoordinates: [],
        whens: []
    }), GX_TRACK_PARSERS, node, objectStack);
    if (!gxTrackObject) {
        return undefined;
    }
    var flatCoordinates = gxTrackObject.flatCoordinates;
    var whens = gxTrackObject.whens;
    for (var i = 0, ii = Math.min(flatCoordinates.length, whens.length); i < ii; ++i) {
        flatCoordinates[4 * i + 3] = whens[i];
    }
    return new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_10__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XYZM);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var ICON_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'href': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readURI)
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(GX_NAMESPACE_URIS, {
    'x': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'y': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'w': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'h': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"])
}));
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object} Icon object.
 */
function readIcon(node, objectStack) {
    var iconObject = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, ICON_PARSERS, node, objectStack);
    if (iconObject) {
        return iconObject;
    }
    else {
        return null;
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var GEOMETRY_FLAT_COORDINATES_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'coordinates': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeReplacer"])(readFlatCoordinates)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Array<number>} Flat coordinates.
 */
function readFlatCoordinatesFromNode(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])(null, GEOMETRY_FLAT_COORDINATES_PARSERS, node, objectStack);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var EXTRUDE_AND_ALTITUDE_MODE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'extrude': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readBoolean"]),
    'tessellate': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readBoolean"]),
    'altitudeMode': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"])
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {LineString|undefined} LineString.
 */
function readLineString(node, objectStack) {
    var properties = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, EXTRUDE_AND_ALTITUDE_MODE_PARSERS, node, objectStack);
    var flatCoordinates = readFlatCoordinatesFromNode(node, objectStack);
    if (flatCoordinates) {
        var lineString = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_10__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XYZ);
        lineString.setProperties(properties, true);
        return lineString;
    }
    else {
        return undefined;
    }
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Polygon|undefined} Polygon.
 */
function readLinearRing(node, objectStack) {
    var properties = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, EXTRUDE_AND_ALTITUDE_MODE_PARSERS, node, objectStack);
    var flatCoordinates = readFlatCoordinatesFromNode(node, objectStack);
    if (flatCoordinates) {
        var polygon = new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_15__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XYZ, [flatCoordinates.length]);
        polygon.setProperties(properties, true);
        return polygon;
    }
    else {
        return undefined;
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var MULTI_GEOMETRY_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayPusher"])(readLineString),
    'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayPusher"])(readLinearRing),
    'MultiGeometry': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayPusher"])(readMultiGeometry),
    'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayPusher"])(readPoint),
    'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeArrayPusher"])(readPolygon)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {import("../geom/Geometry.js").default} Geometry.
 */
function readMultiGeometry(node, objectStack) {
    var geometries = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])([], MULTI_GEOMETRY_PARSERS, node, objectStack);
    if (!geometries) {
        return null;
    }
    if (geometries.length === 0) {
        return new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__["default"](geometries);
    }
    var multiGeometry;
    var homogeneous = true;
    var type = geometries[0].getType();
    var geometry;
    for (var i = 1, ii = geometries.length; i < ii; ++i) {
        geometry = geometries[i];
        if (geometry.getType() != type) {
            homogeneous = false;
            break;
        }
    }
    if (homogeneous) {
        var layout = void 0;
        var flatCoordinates = void 0;
        if (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POINT) {
            var point = geometries[0];
            layout = point.getLayout();
            flatCoordinates = point.getFlatCoordinates();
            for (var i = 1, ii = geometries.length; i < ii; ++i) {
                geometry = geometries[i];
                Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(flatCoordinates, geometry.getFlatCoordinates());
            }
            multiGeometry = new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_12__["default"](flatCoordinates, layout);
            setCommonGeometryProperties(multiGeometry, geometries);
        }
        else if (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].LINE_STRING) {
            multiGeometry = new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_11__["default"](geometries);
            setCommonGeometryProperties(multiGeometry, geometries);
        }
        else if (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POLYGON) {
            multiGeometry = new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_13__["default"](geometries);
            setCommonGeometryProperties(multiGeometry, geometries);
        }
        else if (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOMETRY_COLLECTION) {
            multiGeometry = new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__["default"](geometries);
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(false, 37); // Unknown geometry type found
        }
    }
    else {
        multiGeometry = new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__["default"](geometries);
    }
    return (
    /** @type {import("../geom/Geometry.js").default} */ (multiGeometry));
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Point|undefined} Point.
 */
function readPoint(node, objectStack) {
    var properties = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, EXTRUDE_AND_ALTITUDE_MODE_PARSERS, node, objectStack);
    var flatCoordinates = readFlatCoordinatesFromNode(node, objectStack);
    if (flatCoordinates) {
        var point = new _geom_Point_js__WEBPACK_IMPORTED_MODULE_14__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XYZ);
        point.setProperties(properties, true);
        return point;
    }
    else {
        return undefined;
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var FLAT_LINEAR_RINGS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'innerBoundaryIs': innerBoundaryIsParser,
    'outerBoundaryIs': outerBoundaryIsParser
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Polygon|undefined} Polygon.
 */
function readPolygon(node, objectStack) {
    var properties = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])(/** @type {Object<string,*>} */ ({}), EXTRUDE_AND_ALTITUDE_MODE_PARSERS, node, objectStack);
    var flatLinearRings = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])([null], FLAT_LINEAR_RINGS_PARSERS, node, objectStack);
    if (flatLinearRings && flatLinearRings[0]) {
        var flatCoordinates = flatLinearRings[0];
        var ends = [flatCoordinates.length];
        for (var i = 1, ii = flatLinearRings.length; i < ii; ++i) {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(flatCoordinates, flatLinearRings[i]);
            ends.push(flatCoordinates.length);
        }
        var polygon = new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_15__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XYZ, ends);
        polygon.setProperties(properties, true);
        return polygon;
    }
    else {
        return undefined;
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var STYLE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'IconStyle': iconStyleParser,
    'LabelStyle': labelStyleParser,
    'LineStyle': lineStyleParser,
    'PolyStyle': polyStyleParser
});
/**
 * @this {KML}
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Array<Style>} Style.
 */
function readStyle(node, objectStack) {
    var styleObject = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, STYLE_PARSERS, node, objectStack, this);
    if (!styleObject) {
        return null;
    }
    var fillStyle = /** @type {Fill} */ ('fillStyle' in styleObject ?
        styleObject['fillStyle'] : DEFAULT_FILL_STYLE);
    var fill = /** @type {boolean|undefined} */ (styleObject['fill']);
    if (fill !== undefined && !fill) {
        fillStyle = null;
    }
    var imageStyle;
    if ('imageStyle' in styleObject) {
        if (styleObject['imageStyle'] != DEFAULT_NO_IMAGE_STYLE) {
            imageStyle = styleObject['imageStyle'];
        }
    }
    else {
        imageStyle = DEFAULT_IMAGE_STYLE;
    }
    var textStyle = /** @type {Text} */ ('textStyle' in styleObject ?
        styleObject['textStyle'] : DEFAULT_TEXT_STYLE);
    var strokeStyle = /** @type {Stroke} */ ('strokeStyle' in styleObject ?
        styleObject['strokeStyle'] : DEFAULT_STROKE_STYLE);
    var outline = /** @type {boolean|undefined} */ (styleObject['outline']);
    if (outline !== undefined && !outline) {
        // if the polystyle specifies no outline two styles are needed,
        // one for non-polygon geometries where linestrings require a stroke
        // and one for polygons where there should be no stroke
        return [
            new _style_Style_js__WEBPACK_IMPORTED_MODULE_23__["default"]({
                geometry: function (feature) {
                    var geometry = feature.getGeometry();
                    var type = geometry.getType();
                    if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOMETRY_COLLECTION) {
                        return new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__["default"](geometry.getGeometriesArrayRecursive().filter(function (geometry) {
                            var type = geometry.getType();
                            return type !== _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POLYGON && type !== _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POLYGON;
                        }));
                    }
                    else if (type !== _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POLYGON && type !== _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POLYGON) {
                        return geometry;
                    }
                },
                fill: fillStyle,
                image: imageStyle,
                stroke: strokeStyle,
                text: textStyle,
                zIndex: undefined // FIXME
            }),
            new _style_Style_js__WEBPACK_IMPORTED_MODULE_23__["default"]({
                geometry: function (feature) {
                    var geometry = feature.getGeometry();
                    var type = geometry.getType();
                    if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOMETRY_COLLECTION) {
                        return new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_7__["default"](geometry.getGeometriesArrayRecursive().filter(function (geometry) {
                            var type = geometry.getType();
                            return type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POLYGON || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POLYGON;
                        }));
                    }
                    else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POLYGON || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POLYGON) {
                        return geometry;
                    }
                },
                fill: fillStyle,
                stroke: null,
                zIndex: undefined // FIXME
            })
        ];
    }
    return [new _style_Style_js__WEBPACK_IMPORTED_MODULE_23__["default"]({
            fill: fillStyle,
            image: imageStyle,
            stroke: strokeStyle,
            text: textStyle,
            zIndex: undefined // FIXME
        })];
}
/**
 * Reads an array of geometries and creates arrays for common geometry
 * properties. Then sets them to the multi geometry.
 * @param {MultiPoint|MultiLineString|MultiPolygon} multiGeometry A multi-geometry.
 * @param {Array<import("../geom/Geometry.js").default>} geometries List of geometries.
 */
function setCommonGeometryProperties(multiGeometry, geometries) {
    var ii = geometries.length;
    var extrudes = new Array(geometries.length);
    var tessellates = new Array(geometries.length);
    var altitudeModes = new Array(geometries.length);
    var hasExtrude, hasTessellate, hasAltitudeMode;
    hasExtrude = false;
    hasTessellate = false;
    hasAltitudeMode = false;
    for (var i = 0; i < ii; ++i) {
        var geometry = geometries[i];
        extrudes[i] = geometry.get('extrude');
        tessellates[i] = geometry.get('tessellate');
        altitudeModes[i] = geometry.get('altitudeMode');
        hasExtrude = hasExtrude || extrudes[i] !== undefined;
        hasTessellate = hasTessellate || tessellates[i] !== undefined;
        hasAltitudeMode = hasAltitudeMode || altitudeModes[i];
    }
    if (hasExtrude) {
        multiGeometry.set('extrude', extrudes);
    }
    if (hasTessellate) {
        multiGeometry.set('tessellate', tessellates);
    }
    if (hasAltitudeMode) {
        multiGeometry.set('altitudeMode', altitudeModes);
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var DATA_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'displayName': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'value': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"])
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function dataParser(node, objectStack) {
    var name = node.getAttribute('name');
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["parseNode"])(DATA_PARSERS, node, objectStack);
    var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    if (name && featureObject.displayName) {
        featureObject[name] = {
            value: featureObject.value,
            displayName: featureObject.displayName,
            toString: function () {
                return featureObject.value;
            }
        };
    }
    else if (name !== null) {
        featureObject[name] = featureObject.value;
    }
    else if (featureObject.displayName !== null) {
        featureObject[featureObject.displayName] = featureObject.value;
    }
    delete featureObject['value'];
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var EXTENDED_DATA_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'Data': dataParser,
    'SchemaData': schemaDataParser
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function extendedDataParser(node, objectStack) {
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["parseNode"])(EXTENDED_DATA_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function regionParser(node, objectStack) {
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["parseNode"])(REGION_PARSERS, node, objectStack);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var PAIR_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'Style': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readStyle),
    'key': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'styleUrl': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(readURI)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function pairDataParser(node, objectStack) {
    var pairObject = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, PAIR_PARSERS, node, objectStack, this);
    if (!pairObject) {
        return;
    }
    var key = /** @type {string|undefined} */ (pairObject['key']);
    if (key && key == 'normal') {
        var styleUrl = /** @type {string|undefined} */ (pairObject['styleUrl']);
        if (styleUrl) {
            objectStack[objectStack.length - 1] = styleUrl;
        }
        var style = /** @type {Style} */ (pairObject['Style']);
        if (style) {
            objectStack[objectStack.length - 1] = style;
        }
    }
}
/**
 * @this {KML}
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function placemarkStyleMapParser(node, objectStack) {
    var styleMapValue = readStyleMapValue.call(this, node, objectStack);
    if (!styleMapValue) {
        return;
    }
    var placemarkObject = objectStack[objectStack.length - 1];
    if (Array.isArray(styleMapValue)) {
        placemarkObject['Style'] = styleMapValue;
    }
    else if (typeof styleMapValue === 'string') {
        placemarkObject['styleUrl'] = styleMapValue;
    }
    else {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(false, 38); // `styleMapValue` has an unknown type
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var SCHEMA_DATA_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'SimpleData': simpleDataParser
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function schemaDataParser(node, objectStack) {
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["parseNode"])(SCHEMA_DATA_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function simpleDataParser(node, objectStack) {
    var name = node.getAttribute('name');
    if (name !== null) {
        var data = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"])(node);
        var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
        featureObject[name] = data;
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var LAT_LON_ALT_BOX_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'altitudeMode': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readString"]),
    'minAltitude': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'maxAltitude': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'north': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'south': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'east': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'west': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"])
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function latLonAltBoxParser(node, objectStack) {
    var object = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, LAT_LON_ALT_BOX_PARSERS, node, objectStack);
    if (!object) {
        return;
    }
    var regionObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    var extent = [
        parseFloat(object['west']),
        parseFloat(object['south']),
        parseFloat(object['east']),
        parseFloat(object['north'])
    ];
    regionObject['extent'] = extent;
    regionObject['altitudeMode'] = object['altitudeMode'];
    regionObject['minAltitude'] = parseFloat(object['minAltitude']);
    regionObject['maxAltitude'] = parseFloat(object['maxAltitude']);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var LOD_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'minLodPixels': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'maxLodPixels': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'minFadeExtent': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"]),
    'maxFadeExtent': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readDecimal"])
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function lodParser(node, objectStack) {
    var object = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])({}, LOD_PARSERS, node, objectStack);
    if (!object) {
        return;
    }
    var lodObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    lodObject['minLodPixels'] = parseFloat(object['minLodPixels']);
    lodObject['maxLodPixels'] = parseFloat(object['maxLodPixels']);
    lodObject['minFadeExtent'] = parseFloat(object['minFadeExtent']);
    lodObject['maxFadeExtent'] = parseFloat(object['maxFadeExtent']);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var INNER_BOUNDARY_IS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeReplacer"])(readFlatLinearRing)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function innerBoundaryIsParser(node, objectStack) {
    /** @type {Array<number>|undefined} */
    var flatLinearRing = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])(undefined, INNER_BOUNDARY_IS_PARSERS, node, objectStack);
    if (flatLinearRing) {
        var flatLinearRings = /** @type {Array<Array<number>>} */ (objectStack[objectStack.length - 1]);
        flatLinearRings.push(flatLinearRing);
    }
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var OUTER_BOUNDARY_IS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeReplacer"])(readFlatLinearRing)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function outerBoundaryIsParser(node, objectStack) {
    /** @type {Array<number>|undefined} */
    var flatLinearRing = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushParseAndPop"])(undefined, OUTER_BOUNDARY_IS_PARSERS, node, objectStack);
    if (flatLinearRing) {
        var flatLinearRings = /** @type {Array<Array<number>>} */ (objectStack[objectStack.length - 1]);
        flatLinearRings[0] = flatLinearRing;
    }
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function linkParser(node, objectStack) {
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["parseNode"])(LINK_PARSERS, node, objectStack);
}
/**
 * @param {Node} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function whenParser(node, objectStack) {
    var gxTrackObject = /** @type {GxTrackObject} */ (objectStack[objectStack.length - 1]);
    var whens = gxTrackObject.whens;
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["getAllTextContent"])(node, false);
    var when = Date.parse(s);
    whens.push(isNaN(when) ? 0 : when);
}
/**
 * @param {Node} node Node to append a TextNode with the color to.
 * @param {import("../color.js").Color|string} color Color.
 */
function writeColorTextNode(node, color) {
    var rgba = Object(_color_js__WEBPACK_IMPORTED_MODULE_3__["asArray"])(color);
    var opacity = (rgba.length == 4) ? rgba[3] : 1;
    /** @type {Array<string|number>} */
    var abgr = [opacity * 255, rgba[2], rgba[1], rgba[0]];
    for (var i = 0; i < 4; ++i) {
        var hex = Math.floor(/** @type {number} */ (abgr[i])).toString(16);
        abgr[i] = (hex.length == 1) ? '0' + hex : hex;
    }
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(node, abgr.join(''));
}
/**
 * @param {Node} node Node to append a TextNode with the coordinates to.
 * @param {Array<number>} coordinates Coordinates.
 * @param {Array<*>} objectStack Object stack.
 */
function writeCoordinatesTextNode(node, coordinates, objectStack) {
    var context = objectStack[objectStack.length - 1];
    var layout = context['layout'];
    var stride = context['stride'];
    var dimension;
    if (layout == _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XY ||
        layout == _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XYM) {
        dimension = 2;
    }
    else if (layout == _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XYZ ||
        layout == _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_8__["default"].XYZM) {
        dimension = 3;
    }
    else {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(false, 34); // Invalid geometry layout
    }
    var ii = coordinates.length;
    var text = '';
    if (ii > 0) {
        text += coordinates[0];
        for (var d = 1; d < dimension; ++d) {
            text += ',' + coordinates[d];
        }
        for (var i = stride; i < ii; i += stride) {
            text += ' ' + coordinates[i];
            for (var d = 1; d < dimension; ++d) {
                text += ',' + coordinates[i + d];
            }
        }
    }
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(node, text);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var EXTENDEDDATA_NODE_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'Data': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeDataNode),
    'value': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeDataNodeValue),
    'displayName': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeDataNodeName)
});
/**
 * @param {Element} node Node.
 * @param {{name: *, value: *}} pair Name value pair.
 * @param {Array<*>} objectStack Object stack.
 */
function writeDataNode(node, pair, objectStack) {
    node.setAttribute('name', pair.name);
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    var value = pair.value;
    if (typeof value == 'object') {
        if (value !== null && value.displayName) {
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, EXTENDEDDATA_NODE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], [value.displayName], objectStack, ['displayName']);
        }
        if (value !== null && value.value) {
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, EXTENDEDDATA_NODE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], [value.value], objectStack, ['value']);
        }
    }
    else {
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, EXTENDEDDATA_NODE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], [value], objectStack, ['value']);
    }
}
/**
 * @param {Node} node Node to append a TextNode with the name to.
 * @param {string} name DisplayName.
 */
function writeDataNodeName(node, name) {
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeCDATASection"])(node, name);
}
/**
 * @param {Node} node Node to append a CDATA Section with the value to.
 * @param {string} value Value.
 */
function writeDataNodeValue(node, value) {
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(node, value);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var DOCUMENT_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'Placemark': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePlacemark)
});
/**
 * @const
 * @param {*} value Value.
 * @param {Array<*>} objectStack Object stack.
 * @param {string=} opt_nodeName Node name.
 * @return {Node|undefined} Node.
 */
var DOCUMENT_NODE_FACTORY = function (value, objectStack, opt_nodeName) {
    var parentNode = objectStack[objectStack.length - 1].node;
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["createElementNS"])(parentNode.namespaceURI, 'Placemark');
};
/**
 * @param {Node} node Node.
 * @param {Array<Feature>} features Features.
 * @param {Array<*>} objectStack Object stack.
 * @this {KML}
 */
function writeDocument(node, features, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, DOCUMENT_SERIALIZERS, DOCUMENT_NODE_FACTORY, features, objectStack, undefined, this);
}
/**
 * A factory for creating Data nodes.
 * @const
 * @type {function(*, Array<*>): (Node|undefined)}
 */
var DATA_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSimpleNodeFactory"])('Data');
/**
 * @param {Node} node Node.
 * @param {{names: Array<string>, values: (Array<*>)}} namesAndValues Names and values.
 * @param {Array<*>} objectStack Object stack.
 */
function writeExtendedData(node, namesAndValues, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    var names = namesAndValues.names;
    var values = namesAndValues.values;
    var length = names.length;
    for (var i = 0; i < length; i++) {
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, EXTENDEDDATA_NODE_SERIALIZERS, DATA_NODE_FACTORY, [{ name: names[i], value: values[i] }], objectStack);
    }
}
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var ICON_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'href'
], Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(GX_NAMESPACE_URIS, [
    'x', 'y', 'w', 'h'
]));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var ICON_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'href': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(GX_NAMESPACE_URIS, {
    'x': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeDecimalTextNode"]),
    'y': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeDecimalTextNode"]),
    'w': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeDecimalTextNode"]),
    'h': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeDecimalTextNode"])
}));
/**
 * @const
 * @param {*} value Value.
 * @param {Array<*>} objectStack Object stack.
 * @param {string=} opt_nodeName Node name.
 * @return {Node|undefined} Node.
 */
var GX_NODE_FACTORY = function (value, objectStack, opt_nodeName) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["createElementNS"])(GX_NAMESPACE_URIS[0], 'gx:' + opt_nodeName);
};
/**
 * @param {Node} node Node.
 * @param {Object} icon Icon object.
 * @param {Array<*>} objectStack Object stack.
 */
function writeIcon(node, icon, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = ICON_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(icon, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, ICON_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
    orderedKeys =
        ICON_SEQUENCE[GX_NAMESPACE_URIS[0]];
    values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(icon, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, ICON_SERIALIZERS, GX_NODE_FACTORY, values, objectStack, orderedKeys);
}
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var ICON_STYLE_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'scale', 'heading', 'Icon', 'color', 'hotSpot'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var ICON_STYLE_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'Icon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeIcon),
    'color': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeColorTextNode),
    'heading': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeDecimalTextNode"]),
    'hotSpot': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeVec2),
    'scale': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeScaleTextNode)
});
/**
 * @param {Node} node Node.
 * @param {import("../style/Icon.js").default} style Icon style.
 * @param {Array<*>} objectStack Object stack.
 */
function writeIconStyle(node, style, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    var /** @type {Object<string, any>} */ properties = {};
    var src = style.getSrc();
    var size = style.getSize();
    var iconImageSize = style.getImageSize();
    var iconProperties = {
        'href': src
    };
    if (size) {
        iconProperties['w'] = size[0];
        iconProperties['h'] = size[1];
        var anchor = style.getAnchor(); // top-left
        var origin_1 = style.getOrigin(); // top-left
        if (origin_1 && iconImageSize && origin_1[0] !== 0 && origin_1[1] !== size[1]) {
            iconProperties['x'] = origin_1[0];
            iconProperties['y'] = iconImageSize[1] - (origin_1[1] + size[1]);
        }
        if (anchor && (anchor[0] !== size[0] / 2 || anchor[1] !== size[1] / 2)) {
            var /** @type {Vec2} */ hotSpot = {
                x: anchor[0],
                xunits: _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].PIXELS,
                y: size[1] - anchor[1],
                yunits: _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_20__["default"].PIXELS
            };
            properties['hotSpot'] = hotSpot;
        }
    }
    properties['Icon'] = iconProperties;
    var scale = style.getScale();
    if (scale !== 1) {
        properties['scale'] = scale;
    }
    var rotation = style.getRotation();
    if (rotation !== 0) {
        properties['heading'] = rotation; // 0-360
    }
    var color = style.getColor();
    if (color) {
        properties['color'] = color;
    }
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = ICON_STYLE_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, ICON_STYLE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var LABEL_STYLE_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'color', 'scale'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var LABEL_STYLE_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'color': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeColorTextNode),
    'scale': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeScaleTextNode)
});
/**
 * @param {Node} node Node.
 * @param {Text} style style.
 * @param {Array<*>} objectStack Object stack.
 */
function writeLabelStyle(node, style, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    var properties = {};
    var fill = style.getFill();
    if (fill) {
        properties['color'] = fill.getColor();
    }
    var scale = style.getScale();
    if (scale && scale !== 1) {
        properties['scale'] = scale;
    }
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = LABEL_STYLE_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, LABEL_STYLE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var LINE_STYLE_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'color', 'width'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var LINE_STYLE_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'color': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeColorTextNode),
    'width': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeDecimalTextNode"])
});
/**
 * @param {Node} node Node.
 * @param {Stroke} style style.
 * @param {Array<*>} objectStack Object stack.
 */
function writeLineStyle(node, style, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    var properties = {
        'color': style.getColor(),
        'width': Number(style.getWidth()) || 1
    };
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = LINE_STYLE_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, LINE_STYLE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @const
 * @type {Object<string, string>}
 */
var GEOMETRY_TYPE_TO_NODENAME = {
    'Point': 'Point',
    'LineString': 'LineString',
    'LinearRing': 'LinearRing',
    'Polygon': 'Polygon',
    'MultiPoint': 'MultiGeometry',
    'MultiLineString': 'MultiGeometry',
    'MultiPolygon': 'MultiGeometry',
    'GeometryCollection': 'MultiGeometry'
};
/**
 * @const
 * @param {*} value Value.
 * @param {Array<*>} objectStack Object stack.
 * @param {string=} opt_nodeName Node name.
 * @return {Node|undefined} Node.
 */
var GEOMETRY_NODE_FACTORY = function (value, objectStack, opt_nodeName) {
    if (value) {
        var parentNode = objectStack[objectStack.length - 1].node;
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["createElementNS"])(parentNode.namespaceURI, GEOMETRY_TYPE_TO_NODENAME[ /** @type {import("../geom/Geometry.js").default} */(value).getType()]);
    }
};
/**
 * A factory for creating Point nodes.
 * @const
 * @type {function(*, Array<*>, string=): (Node|undefined)}
 */
var POINT_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSimpleNodeFactory"])('Point');
/**
 * A factory for creating LineString nodes.
 * @const
 * @type {function(*, Array<*>, string=): (Node|undefined)}
 */
var LINE_STRING_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSimpleNodeFactory"])('LineString');
/**
 * A factory for creating LinearRing nodes.
 * @const
 * @type {function(*, Array<*>, string=): (Node|undefined)}
 */
var LINEAR_RING_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSimpleNodeFactory"])('LinearRing');
/**
 * A factory for creating Polygon nodes.
 * @const
 * @type {function(*, Array<*>, string=): (Node|undefined)}
 */
var POLYGON_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSimpleNodeFactory"])('Polygon');
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var MULTI_GEOMETRY_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePrimitiveGeometry),
    'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePrimitiveGeometry),
    'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePolygon),
    'GeometryCollection': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeMultiGeometry)
});
/**
 * @param {Node} node Node.
 * @param {import("../geom/Geometry.js").default} geometry Geometry.
 * @param {Array<*>} objectStack Object stack.
 */
function writeMultiGeometry(node, geometry, objectStack) {
    /** @type {import("../xml.js").NodeStackItem} */
    var context = { node: node };
    var type = geometry.getType();
    /** @type {Array<import("../geom/Geometry.js").default>} */
    var geometries = [];
    /** @type {function(*, Array<*>, string=): (Node|undefined)} */
    var factory;
    if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOMETRY_COLLECTION) {
        /** @type {GeometryCollection} */ (geometry).getGeometriesArrayRecursive().forEach(function (geometry) {
            var type = geometry.getType();
            if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POINT) {
                geometries = geometries.concat(/** @type {MultiPoint} */ (geometry).getPoints());
            }
            else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_LINE_STRING) {
                geometries = geometries.concat(/** @type {MultiLineString} */ (geometry).getLineStrings());
            }
            else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POLYGON) {
                geometries = geometries.concat(/** @type {MultiPolygon} */ (geometry).getPolygons());
            }
            else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POINT
                || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].LINE_STRING
                || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POLYGON) {
                geometries.push(geometry);
            }
            else {
                Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(false, 39); // Unknown geometry type
            }
        });
        factory = GEOMETRY_NODE_FACTORY;
    }
    else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POINT) {
        geometries = /** @type {MultiPoint} */ (geometry).getPoints();
        factory = POINT_NODE_FACTORY;
    }
    else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_LINE_STRING) {
        geometries =
            ( /** @type {MultiLineString} */(geometry)).getLineStrings();
        factory = LINE_STRING_NODE_FACTORY;
    }
    else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POLYGON) {
        geometries =
            ( /** @type {MultiPolygon} */(geometry)).getPolygons();
        factory = POLYGON_NODE_FACTORY;
    }
    else {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(false, 39); // Unknown geometry type
    }
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, MULTI_GEOMETRY_SERIALIZERS, factory, geometries, objectStack);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var BOUNDARY_IS_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePrimitiveGeometry)
});
/**
 * @param {Node} node Node.
 * @param {import("../geom/LinearRing.js").default} linearRing Linear ring.
 * @param {Array<*>} objectStack Object stack.
 */
function writeBoundaryIs(node, linearRing, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, BOUNDARY_IS_SERIALIZERS, LINEAR_RING_NODE_FACTORY, [linearRing], objectStack);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var PLACEMARK_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'ExtendedData': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeExtendedData),
    'MultiGeometry': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeMultiGeometry),
    'LineString': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePrimitiveGeometry),
    'LinearRing': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePrimitiveGeometry),
    'Point': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePrimitiveGeometry),
    'Polygon': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePolygon),
    'Style': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeStyle),
    'address': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"]),
    'description': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"]),
    'name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"]),
    'open': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeBooleanTextNode"]),
    'phoneNumber': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"]),
    'styleUrl': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"]),
    'visibility': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeBooleanTextNode"])
});
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var PLACEMARK_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'name', 'open', 'visibility', 'address', 'phoneNumber', 'description',
    'styleUrl', 'Style'
]);
/**
 * A factory for creating ExtendedData nodes.
 * @const
 * @type {function(*, Array<*>): (Node|undefined)}
 */
var EXTENDEDDATA_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSimpleNodeFactory"])('ExtendedData');
/**
 * FIXME currently we do serialize arbitrary/custom feature properties
 * (ExtendedData).
 * @param {Element} node Node.
 * @param {Feature} feature Feature.
 * @param {Array<*>} objectStack Object stack.
 * @this {KML}
 */
function writePlacemark(node, feature, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    // set id
    if (feature.getId()) {
        node.setAttribute('id', /** @type {string} */ (feature.getId()));
    }
    // serialize properties (properties unknown to KML are not serialized)
    var properties = feature.getProperties();
    // don't export these to ExtendedData
    var filter = { 'address': 1, 'description': 1, 'name': 1, 'open': 1,
        'phoneNumber': 1, 'styleUrl': 1, 'visibility': 1 };
    filter[feature.getGeometryName()] = 1;
    var keys = Object.keys(properties || {}).sort().filter(function (v) {
        return !filter[v];
    });
    var styleFunction = feature.getStyleFunction();
    if (styleFunction) {
        // FIXME the styles returned by the style function are supposed to be
        // resolution-independent here
        var styles = styleFunction(feature, 0);
        if (styles) {
            var styleArray = Array.isArray(styles) ? styles : [styles];
            var pointStyles = styleArray;
            if (feature.getGeometry()) {
                pointStyles = styleArray.filter(function (style) {
                    var geometry = style.getGeometryFunction()(feature);
                    if (geometry) {
                        var type = geometry.getType();
                        if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOMETRY_COLLECTION) {
                            return /** @type {GeometryCollection} */ (geometry).getGeometriesArrayRecursive().filter(function (geometry) {
                                var type = geometry.getType();
                                return type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POINT || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POINT;
                            }).length;
                        }
                        return type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POINT || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POINT;
                    }
                });
            }
            if (this.writeStyles_) {
                var lineStyles = styleArray;
                var polyStyles = styleArray;
                if (feature.getGeometry()) {
                    lineStyles = styleArray.filter(function (style) {
                        var geometry = style.getGeometryFunction()(feature);
                        if (geometry) {
                            var type = geometry.getType();
                            if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOMETRY_COLLECTION) {
                                return /** @type {GeometryCollection} */ (geometry).getGeometriesArrayRecursive().filter(function (geometry) {
                                    var type = geometry.getType();
                                    return type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].LINE_STRING || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_LINE_STRING;
                                }).length;
                            }
                            return type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].LINE_STRING || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_LINE_STRING;
                        }
                    });
                    polyStyles = styleArray.filter(function (style) {
                        var geometry = style.getGeometryFunction()(feature);
                        if (geometry) {
                            var type = geometry.getType();
                            if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOMETRY_COLLECTION) {
                                return /** @type {GeometryCollection} */ (geometry).getGeometriesArrayRecursive().filter(function (geometry) {
                                    var type = geometry.getType();
                                    return type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POLYGON || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POLYGON;
                                }).length;
                            }
                            return type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].POLYGON || type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MULTI_POLYGON;
                        }
                    });
                }
                properties['Style'] = { pointStyles: pointStyles, lineStyles: lineStyles, polyStyles: polyStyles };
            }
            if (pointStyles.length && properties['name'] === undefined) {
                var textStyle = pointStyles[0].getText();
                if (textStyle) {
                    properties['name'] = textStyle.getText();
                }
            }
        }
    }
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = PLACEMARK_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, PLACEMARK_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
    if (keys.length > 0) {
        var sequence = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, keys);
        var namesAndValues = { names: keys, values: sequence };
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, PLACEMARK_SERIALIZERS, EXTENDEDDATA_NODE_FACTORY, [namesAndValues], objectStack);
    }
    // serialize geometry
    var options = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[0]);
    var geometry = feature.getGeometry();
    if (geometry) {
        geometry = Object(_Feature_js__WEBPACK_IMPORTED_MODULE_4__["transformGeometryWithOptions"])(geometry, true, options);
    }
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, PLACEMARK_SERIALIZERS, GEOMETRY_NODE_FACTORY, [geometry], objectStack);
}
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var PRIMITIVE_GEOMETRY_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'extrude', 'tessellate', 'altitudeMode', 'coordinates'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var PRIMITIVE_GEOMETRY_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'extrude': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeBooleanTextNode"]),
    'tessellate': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeBooleanTextNode"]),
    'altitudeMode': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"]),
    'coordinates': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeCoordinatesTextNode)
});
/**
 * @param {Node} node Node.
 * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
 * @param {Array<*>} objectStack Object stack.
 */
function writePrimitiveGeometry(node, geometry, objectStack) {
    var flatCoordinates = geometry.getFlatCoordinates();
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    context['layout'] = geometry.getLayout();
    context['stride'] = geometry.getStride();
    // serialize properties (properties unknown to KML are not serialized)
    var properties = geometry.getProperties();
    properties.coordinates = flatCoordinates;
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = PRIMITIVE_GEOMETRY_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, PRIMITIVE_GEOMETRY_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var POLY_STYLE_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'color', 'fill', 'outline'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var POLYGON_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'outerBoundaryIs': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeBoundaryIs),
    'innerBoundaryIs': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeBoundaryIs)
});
/**
 * A factory for creating innerBoundaryIs nodes.
 * @const
 * @type {function(*, Array<*>, string=): (Node|undefined)}
 */
var INNER_BOUNDARY_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSimpleNodeFactory"])('innerBoundaryIs');
/**
 * A factory for creating outerBoundaryIs nodes.
 * @const
 * @type {function(*, Array<*>, string=): (Node|undefined)}
 */
var OUTER_BOUNDARY_NODE_FACTORY = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSimpleNodeFactory"])('outerBoundaryIs');
/**
 * @param {Node} node Node.
 * @param {Polygon} polygon Polygon.
 * @param {Array<*>} objectStack Object stack.
 */
function writePolygon(node, polygon, objectStack) {
    var linearRings = polygon.getLinearRings();
    var outerRing = linearRings.shift();
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    // inner rings
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, POLYGON_SERIALIZERS, INNER_BOUNDARY_NODE_FACTORY, linearRings, objectStack);
    // outer ring
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, POLYGON_SERIALIZERS, OUTER_BOUNDARY_NODE_FACTORY, [outerRing], objectStack);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var POLY_STYLE_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'color': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeColorTextNode),
    'fill': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeBooleanTextNode"]),
    'outline': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeBooleanTextNode"])
});
/**
 * @param {Node} node Node.
 * @param {Style} style Style.
 * @param {Array<*>} objectStack Object stack.
 */
function writePolyStyle(node, style, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    var fill = style.getFill();
    var stroke = style.getStroke();
    var properties = {
        'color': fill ? fill.getColor() : undefined,
        'fill': fill ? undefined : false,
        'outline': stroke ? undefined : false
    };
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = POLY_STYLE_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, POLY_STYLE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @param {Node} node Node to append a TextNode with the scale to.
 * @param {number|undefined} scale Scale.
 */
function writeScaleTextNode(node, scale) {
    // the Math is to remove any excess decimals created by float arithmetic
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeDecimalTextNode"])(node, Math.round(scale * 1e6) / 1e6);
}
/**
 * @const
 * @type {Object<string, Array<string>>}
 */
// @ts-ignore
var STYLE_SEQUENCE = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, [
    'IconStyle', 'LabelStyle', 'LineStyle', 'PolyStyle'
]);
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
// @ts-ignore
var STYLE_SERIALIZERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeStructureNS"])(NAMESPACE_URIS, {
    'IconStyle': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeIconStyle),
    'LabelStyle': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeLabelStyle),
    'LineStyle': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writeLineStyle),
    'PolyStyle': Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeChildAppender"])(writePolyStyle)
});
/**
 * @param {Node} node Node.
 * @param {Object<string, Array<Style>>} styles Styles.
 * @param {Array<*>} objectStack Object stack.
 */
function writeStyle(node, styles, objectStack) {
    var /** @type {import("../xml.js").NodeStackItem} */ context = { node: node };
    var properties = {};
    if (styles.pointStyles.length) {
        var textStyle = styles.pointStyles[0].getText();
        if (textStyle) {
            properties['LabelStyle'] = textStyle;
        }
        var imageStyle = styles.pointStyles[0].getImage();
        if (imageStyle && typeof /** @type {?} */ (imageStyle).getSrc === 'function') {
            properties['IconStyle'] = imageStyle;
        }
    }
    if (styles.lineStyles.length) {
        var strokeStyle = styles.lineStyles[0].getStroke();
        if (strokeStyle) {
            properties['LineStyle'] = strokeStyle;
        }
    }
    if (styles.polyStyles.length) {
        var strokeStyle = styles.polyStyles[0].getStroke();
        if (strokeStyle && !properties['LineStyle']) {
            properties['LineStyle'] = strokeStyle;
        }
        properties['PolyStyle'] = styles.polyStyles[0];
    }
    var parentNode = objectStack[objectStack.length - 1].node;
    var orderedKeys = STYLE_SEQUENCE[parentNode.namespaceURI];
    var values = Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["makeSequence"])(properties, orderedKeys);
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_25__["pushSerializeAndPop"])(context, STYLE_SERIALIZERS, _xml_js__WEBPACK_IMPORTED_MODULE_25__["OBJECT_PROPERTY_NODE_FACTORY"], values, objectStack, orderedKeys);
}
/**
 * @param {Element} node Node to append a TextNode with the Vec2 to.
 * @param {Vec2} vec2 Vec2.
 */
function writeVec2(node, vec2) {
    node.setAttribute('x', String(vec2.x));
    node.setAttribute('y', String(vec2.y));
    node.setAttribute('xunits', vec2.xunits);
    node.setAttribute('yunits', vec2.yunits);
}
/* harmony default export */ __webpack_exports__["default"] = (KML);
//# sourceMappingURL=KML.js.map

/***/ }),

/***/ "./node_modules/ol/format/MVT.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/MVT.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var pbf__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! pbf */ "./node_modules/pbf/index.js");
/* harmony import */ var pbf__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(pbf__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _FormatType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FormatType.js */ "./node_modules/ol/format/FormatType.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _geom_flat_orient_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geom/flat/orient.js */ "./node_modules/ol/geom/flat/orient.js");
/* harmony import */ var _proj_Projection_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../proj/Projection.js */ "./node_modules/ol/proj/Projection.js");
/* harmony import */ var _proj_Units_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../proj/Units.js */ "./node_modules/ol/proj/Units.js");
/* harmony import */ var _render_Feature_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../render/Feature.js */ "./node_modules/ol/render/Feature.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/**
 * @module ol/format/MVT
 */
//FIXME Implement projection handling
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();

















/**
 * @typedef {Object} Options
 * @property {import("../Feature.js").FeatureClass} [featureClass] Class for features returned by
 * {@link module:ol/format/MVT#readFeatures}. Set to {@link module:ol/Feature~Feature} to get full editing and geometry
 * support at the cost of decreased rendering performance. The default is
 * {@link module:ol/render/Feature~RenderFeature}, which is optimized for rendering and hit detection.
 * @property {string} [geometryName='geometry'] Geometry name to use when creating features.
 * @property {string} [layerName='layer'] Name of the feature attribute that holds the layer name.
 * @property {Array<string>} [layers] Layers to read features from. If not provided, features will be read from all
 * @property {string} [idProperty] Optional property that will be assigned as the feature id and removed from the properties.
 * layers.
 */
/**
 * @classdesc
 * Feature format for reading data in the Mapbox MVT format.
 *
 * @param {Options=} opt_options Options.
 * @api
 */
var MVT = /** @class */ (function (_super) {
    __extends(MVT, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function MVT(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @type {Projection}
         */
        _this.dataProjection = new _proj_Projection_js__WEBPACK_IMPORTED_MODULE_13__["default"]({
            code: '',
            units: _proj_Units_js__WEBPACK_IMPORTED_MODULE_14__["default"].TILE_PIXELS
        });
        /**
         * @private
         * @type {import("../Feature.js").FeatureClass}
         */
        _this.featureClass_ = options.featureClass ? options.featureClass : _render_Feature_js__WEBPACK_IMPORTED_MODULE_15__["default"];
        /**
         * @private
         * @type {string|undefined}
         */
        _this.geometryName_ = options.geometryName;
        /**
         * @private
         * @type {string}
         */
        _this.layerName_ = options.layerName ? options.layerName : 'layer';
        /**
         * @private
         * @type {Array<string>}
         */
        _this.layers_ = options.layers ? options.layers : null;
        /**
         * @private
         * @type {string}
         */
        _this.idProperty_ = options.idProperty;
        return _this;
    }
    /**
     * Read the raw geometry from the pbf offset stored in a raw feature's geometry
     * property.
     * @param {PBF} pbf PBF.
     * @param {Object} feature Raw feature.
     * @param {Array<number>} flatCoordinates Array to store flat coordinates in.
     * @param {Array<number>} ends Array to store ends in.
     * @private
     */
    MVT.prototype.readRawGeometry_ = function (pbf, feature, flatCoordinates, ends) {
        pbf.pos = feature.geometry;
        var end = pbf.readVarint() + pbf.pos;
        var cmd = 1;
        var length = 0;
        var x = 0;
        var y = 0;
        var coordsLen = 0;
        var currentEnd = 0;
        while (pbf.pos < end) {
            if (!length) {
                var cmdLen = pbf.readVarint();
                cmd = cmdLen & 0x7;
                length = cmdLen >> 3;
            }
            length--;
            if (cmd === 1 || cmd === 2) {
                x += pbf.readSVarint();
                y += pbf.readSVarint();
                if (cmd === 1) { // moveTo
                    if (coordsLen > currentEnd) {
                        ends.push(coordsLen);
                        currentEnd = coordsLen;
                    }
                }
                flatCoordinates.push(x, y);
                coordsLen += 2;
            }
            else if (cmd === 7) {
                if (coordsLen > currentEnd) {
                    // close polygon
                    flatCoordinates.push(flatCoordinates[currentEnd], flatCoordinates[currentEnd + 1]);
                    coordsLen += 2;
                }
            }
            else {
                Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(false, 59); // Invalid command found in the PBF
            }
        }
        if (coordsLen > currentEnd) {
            ends.push(coordsLen);
            currentEnd = coordsLen;
        }
    };
    /**
     * @private
     * @param {PBF} pbf PBF
     * @param {Object} rawFeature Raw Mapbox feature.
     * @param {import("./Feature.js").ReadOptions} options Read options.
     * @return {import("../Feature.js").FeatureLike} Feature.
     */
    MVT.prototype.createFeature_ = function (pbf, rawFeature, options) {
        var type = rawFeature.type;
        if (type === 0) {
            return null;
        }
        var feature;
        var values = rawFeature.properties;
        var id;
        if (!this.idProperty_) {
            id = rawFeature.id;
        }
        else {
            id = values[this.idProperty_];
            delete values[this.idProperty_];
        }
        values[this.layerName_] = rawFeature.layer.name;
        var flatCoordinates = [];
        var ends = [];
        this.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
        var geometryType = getGeometryType(type, ends.length);
        if (this.featureClass_ === _render_Feature_js__WEBPACK_IMPORTED_MODULE_15__["default"]) {
            feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
            feature.transform(options.dataProjection, options.featureProjection);
        }
        else {
            var geom = void 0;
            if (geometryType == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].POLYGON) {
                var endss = [];
                var offset = 0;
                var prevEndIndex = 0;
                for (var i = 0, ii = ends.length; i < ii; ++i) {
                    var end = ends[i];
                    if (!Object(_geom_flat_orient_js__WEBPACK_IMPORTED_MODULE_12__["linearRingIsClockwise"])(flatCoordinates, offset, end, 2)) {
                        endss.push(ends.slice(prevEndIndex, i));
                        prevEndIndex = i;
                    }
                    offset = end;
                }
                if (endss.length > 1) {
                    geom = new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_9__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XY, endss);
                }
                else {
                    geom = new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_11__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XY, ends);
                }
            }
            else {
                geom = geometryType === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].POINT ? new _geom_Point_js__WEBPACK_IMPORTED_MODULE_10__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XY) :
                    geometryType === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].LINE_STRING ? new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XY) :
                        geometryType === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].POLYGON ? new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_11__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XY, ends) :
                            geometryType === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].MULTI_POINT ? new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_8__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XY) :
                                geometryType === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].MULTI_LINE_STRING ? new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_7__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XY, ends) :
                                    null;
            }
            var ctor = /** @type {typeof import("../Feature.js").default} */ (this.featureClass_);
            feature = new ctor();
            if (this.geometryName_) {
                feature.setGeometryName(this.geometryName_);
            }
            var geometry = Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geom, false, options);
            feature.setGeometry(geometry);
            feature.setId(id);
            feature.setProperties(values, true);
        }
        return feature;
    };
    /**
     * @inheritDoc
     */
    MVT.prototype.getType = function () {
        return _FormatType_js__WEBPACK_IMPORTED_MODULE_3__["default"].ARRAY_BUFFER;
    };
    /**
     * Read all features.
     *
     * @param {ArrayBuffer} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @return {Array<import("../Feature.js").FeatureLike>} Features.
     * @api
     */
    MVT.prototype.readFeatures = function (source, opt_options) {
        var layers = this.layers_;
        var options = /** @type {import("./Feature.js").ReadOptions} */ (this.adaptOptions(opt_options));
        var dataProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_16__["get"])(options.dataProjection);
        dataProjection.setWorldExtent(options.extent);
        options.dataProjection = dataProjection;
        var pbf = new pbf__WEBPACK_IMPORTED_MODULE_1___default.a(/** @type {ArrayBuffer} */ (source));
        var pbfLayers = pbf.readFields(layersPBFReader, {});
        var features = [];
        for (var name_1 in pbfLayers) {
            if (layers && layers.indexOf(name_1) == -1) {
                continue;
            }
            var pbfLayer = pbfLayers[name_1];
            var extent = pbfLayer ? [0, 0, pbfLayer.extent, pbfLayer.extent] : null;
            dataProjection.setExtent(extent);
            for (var i = 0, ii = pbfLayer.length; i < ii; ++i) {
                var rawFeature = readRawFeature(pbf, pbfLayer, i);
                features.push(this.createFeature_(pbf, rawFeature, options));
            }
        }
        return features;
    };
    /**
     * @inheritDoc
     * @api
     */
    MVT.prototype.readProjection = function (source) {
        return this.dataProjection;
    };
    /**
     * Sets the layers that features will be read from.
     * @param {Array<string>} layers Layers.
     * @api
     */
    MVT.prototype.setLayers = function (layers) {
        this.layers_ = layers;
    };
    return MVT;
}(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * Reader callback for parsing layers.
 * @param {number} tag The tag.
 * @param {Object} layers The layers object.
 * @param {PBF} pbf The PBF.
 */
function layersPBFReader(tag, layers, pbf) {
    if (tag === 3) {
        var layer = {
            keys: [],
            values: [],
            features: []
        };
        var end = pbf.readVarint() + pbf.pos;
        pbf.readFields(layerPBFReader, layer, end);
        layer.length = layer.features.length;
        if (layer.length) {
            layers[layer.name] = layer;
        }
    }
}
/**
 * Reader callback for parsing layer.
 * @param {number} tag The tag.
 * @param {Object} layer The layer object.
 * @param {PBF} pbf The PBF.
 */
function layerPBFReader(tag, layer, pbf) {
    if (tag === 15) {
        layer.version = pbf.readVarint();
    }
    else if (tag === 1) {
        layer.name = pbf.readString();
    }
    else if (tag === 5) {
        layer.extent = pbf.readVarint();
    }
    else if (tag === 2) {
        layer.features.push(pbf.pos);
    }
    else if (tag === 3) {
        layer.keys.push(pbf.readString());
    }
    else if (tag === 4) {
        var value = null;
        var end = pbf.readVarint() + pbf.pos;
        while (pbf.pos < end) {
            tag = pbf.readVarint() >> 3;
            value = tag === 1 ? pbf.readString() :
                tag === 2 ? pbf.readFloat() :
                    tag === 3 ? pbf.readDouble() :
                        tag === 4 ? pbf.readVarint64() :
                            tag === 5 ? pbf.readVarint() :
                                tag === 6 ? pbf.readSVarint() :
                                    tag === 7 ? pbf.readBoolean() : null;
        }
        layer.values.push(value);
    }
}
/**
 * Reader callback for parsing feature.
 * @param {number} tag The tag.
 * @param {Object} feature The feature object.
 * @param {PBF} pbf The PBF.
 */
function featurePBFReader(tag, feature, pbf) {
    if (tag == 1) {
        feature.id = pbf.readVarint();
    }
    else if (tag == 2) {
        var end = pbf.readVarint() + pbf.pos;
        while (pbf.pos < end) {
            var key = feature.layer.keys[pbf.readVarint()];
            var value = feature.layer.values[pbf.readVarint()];
            feature.properties[key] = value;
        }
    }
    else if (tag == 3) {
        feature.type = pbf.readVarint();
    }
    else if (tag == 4) {
        feature.geometry = pbf.pos;
    }
}
/**
 * Read a raw feature from the pbf offset stored at index `i` in the raw layer.
 * @param {PBF} pbf PBF.
 * @param {Object} layer Raw layer.
 * @param {number} i Index of the feature in the raw layer's `features` array.
 * @return {Object} Raw feature.
 */
function readRawFeature(pbf, layer, i) {
    pbf.pos = layer.features[i];
    var end = pbf.readVarint() + pbf.pos;
    var feature = {
        layer: layer,
        type: 0,
        properties: {}
    };
    pbf.readFields(featurePBFReader, feature, end);
    return feature;
}
/**
 * @param {number} type The raw feature's geometry type
 * @param {number} numEnds Number of ends of the flat coordinates of the
 * geometry.
 * @return {GeometryType} The geometry type.
 */
function getGeometryType(type, numEnds) {
    /** @type {GeometryType} */
    var geometryType;
    if (type === 1) {
        geometryType = numEnds === 1 ?
            _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].POINT : _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].MULTI_POINT;
    }
    else if (type === 2) {
        geometryType = numEnds === 1 ?
            _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].LINE_STRING :
            _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].MULTI_LINE_STRING;
    }
    else if (type === 3) {
        geometryType = _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].POLYGON;
        // MultiPolygon not relevant for rendering - winding order determines
        // outer rings of polygons.
    }
    return geometryType;
}
/* harmony default export */ __webpack_exports__["default"] = (MVT);
//# sourceMappingURL=MVT.js.map

/***/ }),

/***/ "./node_modules/ol/format/OWS.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/OWS.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _XLink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./XLink.js */ "./node_modules/ol/format/XLink.js");
/* harmony import */ var _XML_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./XML.js */ "./node_modules/ol/format/XML.js");
/* harmony import */ var _xsd_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./xsd.js */ "./node_modules/ol/format/xsd.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/OWS
 */




/**
 * @const
 * @type {Array<null|string>}
 */
var NAMESPACE_URIS = [null, 'http://www.opengis.net/ows/1.1'];
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'ServiceIdentification': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readServiceIdentification),
    'ServiceProvider': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readServiceProvider),
    'OperationsMetadata': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readOperationsMetadata)
});
var OWS = /** @class */ (function (_super) {
    __extends(OWS, _super);
    function OWS() {
        return _super.call(this) || this;
    }
    /**
     * @inheritDoc
     */
    OWS.prototype.readFromDocument = function (doc) {
        for (var n = doc.firstChild; n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                return this.readFromNode(n);
            }
        }
        return null;
    };
    /**
     * @inheritDoc
     */
    OWS.prototype.readFromNode = function (node) {
        var owsObject = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, PARSERS, node, []);
        return owsObject ? owsObject : null;
    };
    return OWS;
}(_XML_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var ADDRESS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'DeliveryPoint': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'City': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'AdministrativeArea': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'PostalCode': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Country': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ElectronicMailAddress': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var ALLOWED_VALUES_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Value': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readValue)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var CONSTRAINT_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'AllowedValues': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readAllowedValues)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var CONTACT_INFO_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Phone': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readPhone),
    'Address': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readAddress)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var DCP_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'HTTP': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readHttp)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var HTTP_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Get': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readGet),
    'Post': undefined // TODO
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var OPERATION_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'DCP': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readDcp)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var OPERATIONS_METADATA_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Operation': readOperation
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var PHONE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Voice': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Facsimile': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var REQUEST_METHOD_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Constraint': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readConstraint)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var SERVICE_CONTACT_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'IndividualName': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'PositionName': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ContactInfo': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readContactInfo)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var SERVICE_IDENTIFICATION_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Abstract': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'AccessConstraints': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Fees': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Title': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ServiceTypeVersion': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ServiceType': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var SERVICE_PROVIDER_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'ProviderName': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ProviderSite': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_XLink_js__WEBPACK_IMPORTED_MODULE_0__["readHref"]),
    'ServiceContact': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readServiceContact)
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The address.
 */
function readAddress(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, ADDRESS_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The values.
 */
function readAllowedValues(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, ALLOWED_VALUES_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The constraint.
 */
function readConstraint(node, objectStack) {
    var name = node.getAttribute('name');
    if (!name) {
        return undefined;
    }
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({ 'name': name }, CONSTRAINT_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The contact info.
 */
function readContactInfo(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, CONTACT_INFO_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The DCP.
 */
function readDcp(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, DCP_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The GET object.
 */
function readGet(node, objectStack) {
    var href = Object(_XLink_js__WEBPACK_IMPORTED_MODULE_0__["readHref"])(node);
    if (!href) {
        return undefined;
    }
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({ 'href': href }, REQUEST_METHOD_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The HTTP object.
 */
function readHttp(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, HTTP_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The operation.
 */
function readOperation(node, objectStack) {
    var name = node.getAttribute('name');
    var value = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, OPERATION_PARSERS, node, objectStack);
    if (!value) {
        return undefined;
    }
    var object = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    object[name] = value;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The operations metadata.
 */
function readOperationsMetadata(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, OPERATIONS_METADATA_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The phone.
 */
function readPhone(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, PHONE_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The service identification.
 */
function readServiceIdentification(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, SERVICE_IDENTIFICATION_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The service contact.
 */
function readServiceContact(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, SERVICE_CONTACT_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} The service provider.
 */
function readServiceProvider(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, SERVICE_PROVIDER_PARSERS, node, objectStack);
}
/**
 * @param {Node} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {string|undefined} The value.
 */
function readValue(node, objectStack) {
    return Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])(node);
}
/* harmony default export */ __webpack_exports__["default"] = (OWS);
//# sourceMappingURL=OWS.js.map

/***/ }),

/***/ "./node_modules/ol/format/Polyline.js":
/*!********************************************!*\
  !*** ./node_modules/ol/format/Polyline.js ***!
  \********************************************/
/*! exports provided: encodeDeltas, decodeDeltas, encodeFloats, decodeFloats, encodeSignedIntegers, decodeSignedIntegers, encodeUnsignedIntegers, decodeUnsignedIntegers, encodeUnsignedInteger, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeDeltas", function() { return encodeDeltas; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decodeDeltas", function() { return decodeDeltas; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeFloats", function() { return encodeFloats; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decodeFloats", function() { return decodeFloats; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeSignedIntegers", function() { return encodeSignedIntegers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decodeSignedIntegers", function() { return decodeSignedIntegers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeUnsignedIntegers", function() { return encodeUnsignedIntegers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decodeUnsignedIntegers", function() { return decodeUnsignedIntegers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encodeUnsignedInteger", function() { return encodeUnsignedInteger; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _TextFeature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./TextFeature.js */ "./node_modules/ol/format/TextFeature.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _geom_flat_flip_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/flat/flip.js */ "./node_modules/ol/geom/flat/flip.js");
/* harmony import */ var _geom_flat_inflate_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/flat/inflate.js */ "./node_modules/ol/geom/flat/inflate.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/Polyline
 */










/**
 * @typedef {Object} Options
 * @property {number} [factor=1e5] The factor by which the coordinates values will be scaled.
 * @property {GeometryLayout} [geometryLayout='XY'] Layout of the
 * feature geometries created by the format reader.
 */
/**
 * @classdesc
 * Feature format for reading and writing data in the Encoded
 * Polyline Algorithm Format.
 *
 * When reading features, the coordinates are assumed to be in two dimensions
 * and in [latitude, longitude] order.
 *
 * As Polyline sources contain a single feature,
 * {@link module:ol/format/Polyline~Polyline#readFeatures} will return the
 * feature in an array.
 *
 * @api
 */
var Polyline = /** @class */ (function (_super) {
    __extends(Polyline, _super);
    /**
     * @param {Options=} opt_options Optional configuration object.
     */
    function Polyline(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @inheritDoc
         */
        _this.dataProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_9__["get"])('EPSG:4326');
        /**
         * @private
         * @type {number}
         */
        _this.factor_ = options.factor ? options.factor : 1e5;
        /**
         * @private
         * @type {GeometryLayout}
         */
        _this.geometryLayout_ = options.geometryLayout ?
            options.geometryLayout : _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_4__["default"].XY;
        return _this;
    }
    /**
     * @inheritDoc
     */
    Polyline.prototype.readFeatureFromText = function (text, opt_options) {
        var geometry = this.readGeometryFromText(text, opt_options);
        return new _Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"](geometry);
    };
    /**
     * @inheritDoc
     */
    Polyline.prototype.readFeaturesFromText = function (text, opt_options) {
        var feature = this.readFeatureFromText(text, opt_options);
        return [feature];
    };
    /**
     * @inheritDoc
     */
    Polyline.prototype.readGeometryFromText = function (text, opt_options) {
        var stride = Object(_geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_6__["getStrideForLayout"])(this.geometryLayout_);
        var flatCoordinates = decodeDeltas(text, stride, this.factor_);
        Object(_geom_flat_flip_js__WEBPACK_IMPORTED_MODULE_7__["flipXY"])(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
        var coordinates = Object(_geom_flat_inflate_js__WEBPACK_IMPORTED_MODULE_8__["inflateCoordinates"])(flatCoordinates, 0, flatCoordinates.length, stride);
        var lineString = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_5__["default"](coordinates, this.geometryLayout_);
        return Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(lineString, false, this.adaptOptions(opt_options));
    };
    /**
     * @inheritDoc
     */
    Polyline.prototype.writeFeatureText = function (feature, opt_options) {
        var geometry = feature.getGeometry();
        if (geometry) {
            return this.writeGeometryText(geometry, opt_options);
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(false, 40); // Expected `feature` to have a geometry
            return '';
        }
    };
    /**
     * @inheritDoc
     */
    Polyline.prototype.writeFeaturesText = function (features, opt_options) {
        return this.writeFeatureText(features[0], opt_options);
    };
    /**
     * @inheritDoc
     */
    Polyline.prototype.writeGeometryText = function (geometry, opt_options) {
        geometry = /** @type {LineString} */
            (Object(_Feature_js__WEBPACK_IMPORTED_MODULE_2__["transformGeometryWithOptions"])(geometry, true, this.adaptOptions(opt_options)));
        var flatCoordinates = geometry.getFlatCoordinates();
        var stride = geometry.getStride();
        Object(_geom_flat_flip_js__WEBPACK_IMPORTED_MODULE_7__["flipXY"])(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
        return encodeDeltas(flatCoordinates, stride, this.factor_);
    };
    return Polyline;
}(_TextFeature_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * Encode a list of n-dimensional points and return an encoded string
 *
 * Attention: This function will modify the passed array!
 *
 * @param {Array<number>} numbers A list of n-dimensional points.
 * @param {number} stride The number of dimension of the points in the list.
 * @param {number=} opt_factor The factor by which the numbers will be
 *     multiplied. The remaining decimal places will get rounded away.
 *     Default is `1e5`.
 * @return {string} The encoded string.
 * @api
 */
function encodeDeltas(numbers, stride, opt_factor) {
    var factor = opt_factor ? opt_factor : 1e5;
    var d;
    var lastNumbers = new Array(stride);
    for (d = 0; d < stride; ++d) {
        lastNumbers[d] = 0;
    }
    for (var i = 0, ii = numbers.length; i < ii;) {
        for (d = 0; d < stride; ++d, ++i) {
            var num = numbers[i];
            var delta = num - lastNumbers[d];
            lastNumbers[d] = num;
            numbers[i] = delta;
        }
    }
    return encodeFloats(numbers, factor);
}
/**
 * Decode a list of n-dimensional points from an encoded string
 *
 * @param {string} encoded An encoded string.
 * @param {number} stride The number of dimension of the points in the
 *     encoded string.
 * @param {number=} opt_factor The factor by which the resulting numbers will
 *     be divided. Default is `1e5`.
 * @return {Array<number>} A list of n-dimensional points.
 * @api
 */
function decodeDeltas(encoded, stride, opt_factor) {
    var factor = opt_factor ? opt_factor : 1e5;
    var d;
    /** @type {Array<number>} */
    var lastNumbers = new Array(stride);
    for (d = 0; d < stride; ++d) {
        lastNumbers[d] = 0;
    }
    var numbers = decodeFloats(encoded, factor);
    for (var i = 0, ii = numbers.length; i < ii;) {
        for (d = 0; d < stride; ++d, ++i) {
            lastNumbers[d] += numbers[i];
            numbers[i] = lastNumbers[d];
        }
    }
    return numbers;
}
/**
 * Encode a list of floating point numbers and return an encoded string
 *
 * Attention: This function will modify the passed array!
 *
 * @param {Array<number>} numbers A list of floating point numbers.
 * @param {number=} opt_factor The factor by which the numbers will be
 *     multiplied. The remaining decimal places will get rounded away.
 *     Default is `1e5`.
 * @return {string} The encoded string.
 * @api
 */
function encodeFloats(numbers, opt_factor) {
    var factor = opt_factor ? opt_factor : 1e5;
    for (var i = 0, ii = numbers.length; i < ii; ++i) {
        numbers[i] = Math.round(numbers[i] * factor);
    }
    return encodeSignedIntegers(numbers);
}
/**
 * Decode a list of floating point numbers from an encoded string
 *
 * @param {string} encoded An encoded string.
 * @param {number=} opt_factor The factor by which the result will be divided.
 *     Default is `1e5`.
 * @return {Array<number>} A list of floating point numbers.
 * @api
 */
function decodeFloats(encoded, opt_factor) {
    var factor = opt_factor ? opt_factor : 1e5;
    var numbers = decodeSignedIntegers(encoded);
    for (var i = 0, ii = numbers.length; i < ii; ++i) {
        numbers[i] /= factor;
    }
    return numbers;
}
/**
 * Encode a list of signed integers and return an encoded string
 *
 * Attention: This function will modify the passed array!
 *
 * @param {Array<number>} numbers A list of signed integers.
 * @return {string} The encoded string.
 */
function encodeSignedIntegers(numbers) {
    for (var i = 0, ii = numbers.length; i < ii; ++i) {
        var num = numbers[i];
        numbers[i] = (num < 0) ? ~(num << 1) : (num << 1);
    }
    return encodeUnsignedIntegers(numbers);
}
/**
 * Decode a list of signed integers from an encoded string
 *
 * @param {string} encoded An encoded string.
 * @return {Array<number>} A list of signed integers.
 */
function decodeSignedIntegers(encoded) {
    var numbers = decodeUnsignedIntegers(encoded);
    for (var i = 0, ii = numbers.length; i < ii; ++i) {
        var num = numbers[i];
        numbers[i] = (num & 1) ? ~(num >> 1) : (num >> 1);
    }
    return numbers;
}
/**
 * Encode a list of unsigned integers and return an encoded string
 *
 * @param {Array<number>} numbers A list of unsigned integers.
 * @return {string} The encoded string.
 */
function encodeUnsignedIntegers(numbers) {
    var encoded = '';
    for (var i = 0, ii = numbers.length; i < ii; ++i) {
        encoded += encodeUnsignedInteger(numbers[i]);
    }
    return encoded;
}
/**
 * Decode a list of unsigned integers from an encoded string
 *
 * @param {string} encoded An encoded string.
 * @return {Array<number>} A list of unsigned integers.
 */
function decodeUnsignedIntegers(encoded) {
    var numbers = [];
    var current = 0;
    var shift = 0;
    for (var i = 0, ii = encoded.length; i < ii; ++i) {
        var b = encoded.charCodeAt(i) - 63;
        current |= (b & 0x1f) << shift;
        if (b < 0x20) {
            numbers.push(current);
            current = 0;
            shift = 0;
        }
        else {
            shift += 5;
        }
    }
    return numbers;
}
/**
 * Encode one single unsigned integer and return an encoded string
 *
 * @param {number} num Unsigned integer that should be encoded.
 * @return {string} The encoded string.
 */
function encodeUnsignedInteger(num) {
    var value, encoded = '';
    while (num >= 0x20) {
        value = (0x20 | (num & 0x1f)) + 63;
        encoded += String.fromCharCode(value);
        num >>= 5;
    }
    value = num + 63;
    encoded += String.fromCharCode(value);
    return encoded;
}
/* harmony default export */ __webpack_exports__["default"] = (Polyline);
//# sourceMappingURL=Polyline.js.map

/***/ }),

/***/ "./node_modules/ol/format/TextFeature.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/format/TextFeature.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _format_Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../format/Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _format_FormatType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../format/FormatType.js */ "./node_modules/ol/format/FormatType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/TextFeature
 */



/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Base class for text feature formats.
 *
 * @abstract
 */
var TextFeature = /** @class */ (function (_super) {
    __extends(TextFeature, _super);
    function TextFeature() {
        return _super.call(this) || this;
    }
    /**
     * @inheritDoc
     */
    TextFeature.prototype.getType = function () {
        return _format_FormatType_js__WEBPACK_IMPORTED_MODULE_2__["default"].TEXT;
    };
    /**
     * Read the feature from the source.
     *
     * @param {Document|Node|Object|string} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @return {import("../Feature.js").default} Feature.
     * @api
     */
    TextFeature.prototype.readFeature = function (source, opt_options) {
        return this.readFeatureFromText(getText(source), this.adaptOptions(opt_options));
    };
    /**
     * @abstract
     * @param {string} text Text.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @protected
     * @return {import("../Feature.js").default} Feature.
     */
    TextFeature.prototype.readFeatureFromText = function (text, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Read the features from the source.
     *
     * @param {Document|Node|Object|string} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @return {Array<import("../Feature.js").default>} Features.
     * @api
     */
    TextFeature.prototype.readFeatures = function (source, opt_options) {
        return this.readFeaturesFromText(getText(source), this.adaptOptions(opt_options));
    };
    /**
     * @abstract
     * @param {string} text Text.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @protected
     * @return {Array<import("../Feature.js").default>} Features.
     */
    TextFeature.prototype.readFeaturesFromText = function (text, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Read the geometry from the source.
     *
     * @param {Document|Node|Object|string} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @return {import("../geom/Geometry.js").default} Geometry.
     * @api
     */
    TextFeature.prototype.readGeometry = function (source, opt_options) {
        return this.readGeometryFromText(getText(source), this.adaptOptions(opt_options));
    };
    /**
     * @abstract
     * @param {string} text Text.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @protected
     * @return {import("../geom/Geometry.js").default} Geometry.
     */
    TextFeature.prototype.readGeometryFromText = function (text, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Read the projection from the source.
     *
     * @param {Document|Node|Object|string} source Source.
     * @return {import("../proj/Projection.js").default} Projection.
     * @api
     */
    TextFeature.prototype.readProjection = function (source) {
        return this.readProjectionFromText(getText(source));
    };
    /**
     * @param {string} text Text.
     * @protected
     * @return {import("../proj/Projection.js").default} Projection.
     */
    TextFeature.prototype.readProjectionFromText = function (text) {
        return this.dataProjection;
    };
    /**
     * Encode a feature as a string.
     *
     * @param {import("../Feature.js").default} feature Feature.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {string} Encoded feature.
     * @api
     */
    TextFeature.prototype.writeFeature = function (feature, opt_options) {
        return this.writeFeatureText(feature, this.adaptOptions(opt_options));
    };
    /**
     * @abstract
     * @param {import("../Feature.js").default} feature Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @protected
     * @return {string} Text.
     */
    TextFeature.prototype.writeFeatureText = function (feature, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Encode an array of features as string.
     *
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {string} Encoded features.
     * @api
     */
    TextFeature.prototype.writeFeatures = function (features, opt_options) {
        return this.writeFeaturesText(features, this.adaptOptions(opt_options));
    };
    /**
     * @abstract
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @protected
     * @return {string} Text.
     */
    TextFeature.prototype.writeFeaturesText = function (features, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Write a single geometry.
     *
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {string} Geometry.
     * @api
     */
    TextFeature.prototype.writeGeometry = function (geometry, opt_options) {
        return this.writeGeometryText(geometry, this.adaptOptions(opt_options));
    };
    /**
     * @abstract
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @protected
     * @return {string} Text.
     */
    TextFeature.prototype.writeGeometryText = function (geometry, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    return TextFeature;
}(_format_Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * @param {Document|Node|Object|string} source Source.
 * @return {string} Text.
 */
function getText(source) {
    if (typeof source === 'string') {
        return source;
    }
    else {
        return '';
    }
}
/* harmony default export */ __webpack_exports__["default"] = (TextFeature);
//# sourceMappingURL=TextFeature.js.map

/***/ }),

/***/ "./node_modules/ol/format/TopoJSON.js":
/*!********************************************!*\
  !*** ./node_modules/ol/format/TopoJSON.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _JSONFeature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./JSONFeature.js */ "./node_modules/ol/format/JSONFeature.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/TopoJSON
 */










/**
 * @typedef {import("topojson-specification").Topology} TopoJSONTopology
 * @typedef {import("topojson-specification").GeometryCollection} TopoJSONGeometryCollection
 * @typedef {import("topojson-specification").GeometryObject} TopoJSONGeometry
 * @typedef {import("topojson-specification").Point} TopoJSONPoint
 * @typedef {import("topojson-specification").MultiPoint} TopoJSONMultiPoint
 * @typedef {import("topojson-specification").LineString} TopoJSONLineString
 * @typedef {import("topojson-specification").MultiLineString} TopoJSONMultiLineString
 * @typedef {import("topojson-specification").Polygon} TopoJSONPolygon
 * @typedef {import("topojson-specification").MultiPolygon} TopoJSONMultiPolygon
 */
/**
 * @typedef {Object} Options
 * @property {import("../proj.js").ProjectionLike} [dataProjection='EPSG:4326'] Default data projection.
 * @property {string} [layerName] Set the name of the TopoJSON topology
 * `objects`'s children as feature property with the specified name. This means
 * that when set to `'layer'`, a topology like
 * ```
 * {
 *   "type": "Topology",
 *   "objects": {
 *     "example": {
 *       "type": "GeometryCollection",
 *       "geometries": []
 *     }
 *   }
 * }
 * ```
 * will result in features that have a property `'layer'` set to `'example'`.
 * When not set, no property will be added to features.
 * @property {Array<string>} [layers] Names of the TopoJSON topology's
 * `objects`'s children to read features from.  If not provided, features will
 * be read from all children.
 */
/**
 * @classdesc
 * Feature format for reading data in the TopoJSON format.
 *
 * @api
 */
var TopoJSON = /** @class */ (function (_super) {
    __extends(TopoJSON, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function TopoJSON(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @private
         * @type {string|undefined}
         */
        _this.layerName_ = options.layerName;
        /**
         * @private
         * @type {?Array<string>}
         */
        _this.layers_ = options.layers ? options.layers : null;
        /**
         * @inheritDoc
         */
        _this.dataProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_9__["get"])(options.dataProjection ?
            options.dataProjection : 'EPSG:4326');
        return _this;
    }
    /**
     * @inheritDoc
     */
    TopoJSON.prototype.readFeaturesFromObject = function (object, opt_options) {
        if (object.type == 'Topology') {
            var topoJSONTopology = /** @type {TopoJSONTopology} */ (object);
            var transform = void 0, scale = null, translate = null;
            if (topoJSONTopology['transform']) {
                transform = topoJSONTopology['transform'];
                scale = transform['scale'];
                translate = transform['translate'];
            }
            var arcs = topoJSONTopology['arcs'];
            if (transform) {
                transformArcs(arcs, scale, translate);
            }
            /** @type {Array<Feature>} */
            var features = [];
            var topoJSONFeatures = topoJSONTopology['objects'];
            var property = this.layerName_;
            var feature = void 0;
            for (var objectName in topoJSONFeatures) {
                if (this.layers_ && this.layers_.indexOf(objectName) == -1) {
                    continue;
                }
                if (topoJSONFeatures[objectName].type === 'GeometryCollection') {
                    feature = /** @type {TopoJSONGeometryCollection} */ (topoJSONFeatures[objectName]);
                    features.push.apply(features, readFeaturesFromGeometryCollection(feature, arcs, scale, translate, property, objectName, opt_options));
                }
                else {
                    feature = /** @type {TopoJSONGeometry} */ (topoJSONFeatures[objectName]);
                    features.push(readFeatureFromGeometry(feature, arcs, scale, translate, property, objectName, opt_options));
                }
            }
            return features;
        }
        else {
            return [];
        }
    };
    /**
     * @inheritDoc
     */
    TopoJSON.prototype.readProjectionFromObject = function (object) {
        return this.dataProjection;
    };
    return TopoJSON;
}(_JSONFeature_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * @const
 * @type {Object<string, function(TopoJSONGeometry, Array, ...Array=): import("../geom/Geometry.js").default>}
 */
var GEOMETRY_READERS = {
    'Point': readPointGeometry,
    'LineString': readLineStringGeometry,
    'Polygon': readPolygonGeometry,
    'MultiPoint': readMultiPointGeometry,
    'MultiLineString': readMultiLineStringGeometry,
    'MultiPolygon': readMultiPolygonGeometry
};
/**
 * Concatenate arcs into a coordinate array.
 * @param {Array<number>} indices Indices of arcs to concatenate.  Negative
 *     values indicate arcs need to be reversed.
 * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs (already
 *     transformed).
 * @return {Array<import("../coordinate.js").Coordinate>} Coordinates array.
 */
function concatenateArcs(indices, arcs) {
    /** @type {Array<import("../coordinate.js").Coordinate>} */
    var coordinates = [];
    var index, arc;
    for (var i = 0, ii = indices.length; i < ii; ++i) {
        index = indices[i];
        if (i > 0) {
            // splicing together arcs, discard last point
            coordinates.pop();
        }
        if (index >= 0) {
            // forward arc
            arc = arcs[index];
        }
        else {
            // reverse arc
            arc = arcs[~index].slice().reverse();
        }
        coordinates.push.apply(coordinates, arc);
    }
    // provide fresh copies of coordinate arrays
    for (var j = 0, jj = coordinates.length; j < jj; ++j) {
        coordinates[j] = coordinates[j].slice();
    }
    return coordinates;
}
/**
 * Create a point from a TopoJSON geometry object.
 *
 * @param {TopoJSONPoint} object TopoJSON object.
 * @param {Array<number>} scale Scale for each dimension.
 * @param {Array<number>} translate Translation for each dimension.
 * @return {Point} Geometry.
 */
function readPointGeometry(object, scale, translate) {
    var coordinates = object['coordinates'];
    if (scale && translate) {
        transformVertex(coordinates, scale, translate);
    }
    return new _geom_Point_js__WEBPACK_IMPORTED_MODULE_7__["default"](coordinates);
}
/**
 * Create a multi-point from a TopoJSON geometry object.
 *
 * @param {TopoJSONMultiPoint} object TopoJSON object.
 * @param {Array<number>} scale Scale for each dimension.
 * @param {Array<number>} translate Translation for each dimension.
 * @return {MultiPoint} Geometry.
 */
function readMultiPointGeometry(object, scale, translate) {
    var coordinates = object['coordinates'];
    if (scale && translate) {
        for (var i = 0, ii = coordinates.length; i < ii; ++i) {
            transformVertex(coordinates[i], scale, translate);
        }
    }
    return new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_5__["default"](coordinates);
}
/**
 * Create a linestring from a TopoJSON geometry object.
 *
 * @param {TopoJSONLineString} object TopoJSON object.
 * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
 * @return {LineString} Geometry.
 */
function readLineStringGeometry(object, arcs) {
    var coordinates = concatenateArcs(object['arcs'], arcs);
    return new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__["default"](coordinates);
}
/**
 * Create a multi-linestring from a TopoJSON geometry object.
 *
 * @param {TopoJSONMultiLineString} object TopoJSON object.
 * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
 * @return {MultiLineString} Geometry.
 */
function readMultiLineStringGeometry(object, arcs) {
    var coordinates = [];
    for (var i = 0, ii = object['arcs'].length; i < ii; ++i) {
        coordinates[i] = concatenateArcs(object['arcs'][i], arcs);
    }
    return new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_4__["default"](coordinates);
}
/**
 * Create a polygon from a TopoJSON geometry object.
 *
 * @param {TopoJSONPolygon} object TopoJSON object.
 * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
 * @return {Polygon} Geometry.
 */
function readPolygonGeometry(object, arcs) {
    var coordinates = [];
    for (var i = 0, ii = object['arcs'].length; i < ii; ++i) {
        coordinates[i] = concatenateArcs(object['arcs'][i], arcs);
    }
    return new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__["default"](coordinates);
}
/**
 * Create a multi-polygon from a TopoJSON geometry object.
 *
 * @param {TopoJSONMultiPolygon} object TopoJSON object.
 * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
 * @return {MultiPolygon} Geometry.
 */
function readMultiPolygonGeometry(object, arcs) {
    var coordinates = [];
    for (var i = 0, ii = object['arcs'].length; i < ii; ++i) {
        // for each polygon
        var polyArray = object['arcs'][i];
        var ringCoords = [];
        for (var j = 0, jj = polyArray.length; j < jj; ++j) {
            // for each ring
            ringCoords[j] = concatenateArcs(polyArray[j], arcs);
        }
        coordinates[i] = ringCoords;
    }
    return new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_6__["default"](coordinates);
}
/**
 * Create features from a TopoJSON GeometryCollection object.
 *
 * @param {TopoJSONGeometryCollection} collection TopoJSON Geometry
 *     object.
 * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
 * @param {Array<number>} scale Scale for each dimension.
 * @param {Array<number>} translate Translation for each dimension.
 * @param {string|undefined} property Property to set the `GeometryCollection`'s parent
 *     object to.
 * @param {string} name Name of the `Topology`'s child object.
 * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
 * @return {Array<Feature>} Array of features.
 */
function readFeaturesFromGeometryCollection(collection, arcs, scale, translate, property, name, opt_options) {
    var geometries = collection['geometries'];
    var features = [];
    for (var i = 0, ii = geometries.length; i < ii; ++i) {
        features[i] = readFeatureFromGeometry(geometries[i], arcs, scale, translate, property, name, opt_options);
    }
    return features;
}
/**
 * Create a feature from a TopoJSON geometry object.
 *
 * @param {TopoJSONGeometry} object TopoJSON geometry object.
 * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
 * @param {Array<number>} scale Scale for each dimension.
 * @param {Array<number>} translate Translation for each dimension.
 * @param {string|undefined} property Property to set the `GeometryCollection`'s parent
 *     object to.
 * @param {string} name Name of the `Topology`'s child object.
 * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
 * @return {Feature} Feature.
 */
function readFeatureFromGeometry(object, arcs, scale, translate, property, name, opt_options) {
    var geometry;
    var type = object.type;
    var geometryReader = GEOMETRY_READERS[type];
    if ((type === 'Point') || (type === 'MultiPoint')) {
        geometry = geometryReader(object, scale, translate);
    }
    else {
        geometry = geometryReader(object, arcs);
    }
    var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
    feature.setGeometry(Object(_Feature_js__WEBPACK_IMPORTED_MODULE_1__["transformGeometryWithOptions"])(geometry, false, opt_options));
    if (object.id !== undefined) {
        feature.setId(object.id);
    }
    var properties = object.properties;
    if (property) {
        if (!properties) {
            properties = {};
        }
        properties[property] = name;
    }
    if (properties) {
        feature.setProperties(properties, true);
    }
    return feature;
}
/**
 * Apply a linear transform to array of arcs.  The provided array of arcs is
 * modified in place.
 *
 * @param {Array<Array<import("../coordinate.js").Coordinate>>} arcs Array of arcs.
 * @param {Array<number>} scale Scale for each dimension.
 * @param {Array<number>} translate Translation for each dimension.
 */
function transformArcs(arcs, scale, translate) {
    for (var i = 0, ii = arcs.length; i < ii; ++i) {
        transformArc(arcs[i], scale, translate);
    }
}
/**
 * Apply a linear transform to an arc.  The provided arc is modified in place.
 *
 * @param {Array<import("../coordinate.js").Coordinate>} arc Arc.
 * @param {Array<number>} scale Scale for each dimension.
 * @param {Array<number>} translate Translation for each dimension.
 */
function transformArc(arc, scale, translate) {
    var x = 0;
    var y = 0;
    for (var i = 0, ii = arc.length; i < ii; ++i) {
        var vertex = arc[i];
        x += vertex[0];
        y += vertex[1];
        vertex[0] = x;
        vertex[1] = y;
        transformVertex(vertex, scale, translate);
    }
}
/**
 * Apply a linear transform to a vertex.  The provided vertex is modified in
 * place.
 *
 * @param {import("../coordinate.js").Coordinate} vertex Vertex.
 * @param {Array<number>} scale Scale for each dimension.
 * @param {Array<number>} translate Translation for each dimension.
 */
function transformVertex(vertex, scale, translate) {
    vertex[0] = vertex[0] * scale[0] + translate[0];
    vertex[1] = vertex[1] * scale[1] + translate[1];
}
/* harmony default export */ __webpack_exports__["default"] = (TopoJSON);
//# sourceMappingURL=TopoJSON.js.map

/***/ }),

/***/ "./node_modules/ol/format/WFS.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/WFS.js ***!
  \***************************************/
/*! exports provided: writeFilter, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writeFilter", function() { return writeFilter; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _GML2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GML2.js */ "./node_modules/ol/format/GML2.js");
/* harmony import */ var _GML3_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GML3.js */ "./node_modules/ol/format/GML3.js");
/* harmony import */ var _GMLBase_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GMLBase.js */ "./node_modules/ol/format/GMLBase.js");
/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./filter.js */ "./node_modules/ol/format/filter.js");
/* harmony import */ var _XMLFeature_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./XMLFeature.js */ "./node_modules/ol/format/XMLFeature.js");
/* harmony import */ var _xsd_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./xsd.js */ "./node_modules/ol/format/xsd.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/WFS
 */










/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
var FEATURE_COLLECTION_PARSERS = {
    'http://www.opengis.net/gml': {
        'boundedBy': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeObjectPropertySetter"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readGeometryElement, 'bounds')
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
var TRANSACTION_SUMMARY_PARSERS = {
    'http://www.opengis.net/wfs': {
        'totalInserted': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readNonNegativeInteger"]),
        'totalUpdated': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readNonNegativeInteger"]),
        'totalDeleted': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readNonNegativeInteger"])
    }
};
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
var TRANSACTION_RESPONSE_PARSERS = {
    'http://www.opengis.net/wfs': {
        'TransactionSummary': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeObjectPropertySetter"])(readTransactionSummary, 'transactionSummary'),
        'InsertResults': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeObjectPropertySetter"])(readInsertResults, 'insertIds')
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
var QUERY_SERIALIZERS = {
    'http://www.opengis.net/wfs': {
        'PropertyName': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])
    }
};
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
var TRANSACTION_SERIALIZERS = {
    'http://www.opengis.net/wfs': {
        'Insert': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeFeature),
        'Update': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeUpdate),
        'Delete': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeDelete),
        'Property': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeProperty),
        'Native': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeNative)
    }
};
/**
 * @typedef {Object} Options
 * @property {Object<string, string>|string} [featureNS] The namespace URI used for features.
 * @property {Array<string>|string} [featureType] The feature type to parse. Only used for read operations.
 * @property {GMLBase} [gmlFormat] The GML format to use to parse the response. Default is `ol/format/GML3`.
 * @property {string} [schemaLocation] Optional schemaLocation to use for serialization, this will override the default.
 */
/**
 * @typedef {Object} WriteGetFeatureOptions
 * @property {string} featureNS The namespace URI used for features.
 * @property {string} featurePrefix The prefix for the feature namespace.
 * @property {Array<string>} featureTypes The feature type names.
 * @property {string} [srsName] SRS name. No srsName attribute will be set on
 * geometries when this is not provided.
 * @property {string} [handle] Handle.
 * @property {string} [outputFormat] Output format.
 * @property {number} [maxFeatures] Maximum number of features to fetch.
 * @property {string} [geometryName] Geometry name to use in a BBOX filter.
 * @property {Array<string>} [propertyNames] Optional list of property names to serialize.
 * @property {string} [viewParams] viewParams GeoServer vendor parameter.
 * @property {number} [startIndex] Start index to use for WFS paging. This is a
 * WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services.
 * @property {number} [count] Number of features to retrieve when paging. This is a
 * WFS 2.0 feature backported to WFS 1.1.0 by some Web Feature Services. Please note that some
 * Web Feature Services have repurposed `maxfeatures` instead.
 * @property {import("../extent.js").Extent} [bbox] Extent to use for the BBOX filter.
 * @property {import("./filter/Filter.js").default} [filter] Filter condition. See
 * {@link module:ol/format/Filter} for more information.
 * @property {string} [resultType] Indicates what response should be returned,
 * E.g. `hits` only includes the `numberOfFeatures` attribute in the response and no features.
 */
/**
 * @typedef {Object} WriteTransactionOptions
 * @property {string} featureNS The namespace URI used for features.
 * @property {string} featurePrefix The prefix for the feature namespace.
 * @property {string} featureType The feature type name.
 * @property {string} [srsName] SRS name. No srsName attribute will be set on
 * geometries when this is not provided.
 * @property {string} [handle] Handle.
 * @property {boolean} [hasZ] Must be set to true if the transaction is for
 * a 3D layer. This will allow the Z coordinate to be included in the transaction.
 * @property {Array<Object>} nativeElements Native elements. Currently not supported.
 * @property {import("./GMLBase.js").Options} [gmlOptions] GML options for the WFS transaction writer.
 * @property {string} [version='1.1.0'] WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`.
 */
/**
 * Number of features; bounds/extent.
 * @typedef {Object} FeatureCollectionMetadata
 * @property {number} numberOfFeatures
 * @property {import("../extent.js").Extent} bounds
 */
/**
 * Total deleted; total inserted; total updated; array of insert ids.
 * @typedef {Object} TransactionResponse
 * @property {number} totalDeleted
 * @property {number} totalInserted
 * @property {number} totalUpdated
 * @property {Array<string>} insertIds
 */
/**
 * @type {string}
 */
var FEATURE_PREFIX = 'feature';
/**
 * @type {string}
 */
var XMLNS = 'http://www.w3.org/2000/xmlns/';
/**
 * @type {string}
 */
var OGCNS = 'http://www.opengis.net/ogc';
/**
 * @type {string}
 */
var WFSNS = 'http://www.opengis.net/wfs';
/**
 * @type {string}
 */
var FESNS = 'http://www.opengis.net/fes';
/**
 * @type {Object<string, string>}
 */
var SCHEMA_LOCATIONS = {
    '1.1.0': 'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',
    '1.0.0': 'http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd'
};
/**
 * @const
 * @type {string}
 */
var DEFAULT_VERSION = '1.1.0';
/**
 * @classdesc
 * Feature format for reading and writing data in the WFS format.
 * By default, supports WFS version 1.1.0. You can pass a GML format
 * as option if you want to read a WFS that contains GML2 (WFS 1.0.0).
 * Also see {@link module:ol/format/GMLBase~GMLBase} which is used by this format.
 *
 * @api
 */
var WFS = /** @class */ (function (_super) {
    __extends(WFS, _super);
    /**
     * @param {Options=} opt_options Optional configuration object.
     */
    function WFS(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @private
         * @type {Array<string>|string|undefined}
         */
        _this.featureType_ = options.featureType;
        /**
         * @private
         * @type {Object<string, string>|string|undefined}
         */
        _this.featureNS_ = options.featureNS;
        /**
         * @private
         * @type {GMLBase}
         */
        _this.gmlFormat_ = options.gmlFormat ?
            options.gmlFormat : new _GML3_js__WEBPACK_IMPORTED_MODULE_2__["default"]();
        /**
         * @private
         * @type {string}
         */
        _this.schemaLocation_ = options.schemaLocation ?
            options.schemaLocation : SCHEMA_LOCATIONS[DEFAULT_VERSION];
        return _this;
    }
    /**
     * @return {Array<string>|string|undefined} featureType
     */
    WFS.prototype.getFeatureType = function () {
        return this.featureType_;
    };
    /**
     * @param {Array<string>|string|undefined} featureType Feature type(s) to parse.
     */
    WFS.prototype.setFeatureType = function (featureType) {
        this.featureType_ = featureType;
    };
    /**
     * @inheritDoc
     */
    WFS.prototype.readFeaturesFromNode = function (node, opt_options) {
        /** @type {import("../xml.js").NodeStackItem} */
        var context = {
            node: node
        };
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])(context, {
            'featureType': this.featureType_,
            'featureNS': this.featureNS_
        });
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])(context, this.getReadOptions(node, opt_options ? opt_options : {}));
        var objectStack = [context];
        this.gmlFormat_.FEATURE_COLLECTION_PARSERS[_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["GMLNS"]]['featureMember'] =
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeArrayPusher"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["default"].prototype.readFeaturesInternal);
        var features = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushParseAndPop"])([], this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node, objectStack, this.gmlFormat_);
        if (!features) {
            features = [];
        }
        return features;
    };
    /**
     * Read transaction response of the source.
     *
     * @param {Document|Element|Object|string} source Source.
     * @return {TransactionResponse|undefined} Transaction response.
     * @api
     */
    WFS.prototype.readTransactionResponse = function (source) {
        if (!source) {
            return undefined;
        }
        else if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["parse"])(source);
            return this.readTransactionResponseFromDocument(doc);
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["isDocument"])(source)) {
            return this.readTransactionResponseFromDocument(
            /** @type {Document} */ (source));
        }
        else {
            return this.readTransactionResponseFromNode(/** @type {Element} */ (source));
        }
    };
    /**
     * Read feature collection metadata of the source.
     *
     * @param {Document|Element|Object|string} source Source.
     * @return {FeatureCollectionMetadata|undefined}
     *     FeatureCollection metadata.
     * @api
     */
    WFS.prototype.readFeatureCollectionMetadata = function (source) {
        if (!source) {
            return undefined;
        }
        else if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["parse"])(source);
            return this.readFeatureCollectionMetadataFromDocument(doc);
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["isDocument"])(source)) {
            return this.readFeatureCollectionMetadataFromDocument(
            /** @type {Document} */ (source));
        }
        else {
            return this.readFeatureCollectionMetadataFromNode(
            /** @type {Element} */ (source));
        }
    };
    /**
     * @param {Document} doc Document.
     * @return {FeatureCollectionMetadata|undefined}
     *     FeatureCollection metadata.
     */
    WFS.prototype.readFeatureCollectionMetadataFromDocument = function (doc) {
        for (var n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                return this.readFeatureCollectionMetadataFromNode(/** @type {Element} */ (n));
            }
        }
        return undefined;
    };
    /**
     * @param {Element} node Node.
     * @return {FeatureCollectionMetadata|undefined}
     *     FeatureCollection metadata.
     */
    WFS.prototype.readFeatureCollectionMetadataFromNode = function (node) {
        var result = {};
        var value = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["readNonNegativeIntegerString"])(node.getAttribute('numberOfFeatures'));
        result['numberOfFeatures'] = value;
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushParseAndPop"])(
        /** @type {FeatureCollectionMetadata} */ (result), FEATURE_COLLECTION_PARSERS, node, [], this.gmlFormat_);
    };
    /**
     * @param {Document} doc Document.
     * @return {TransactionResponse|undefined} Transaction response.
     */
    WFS.prototype.readTransactionResponseFromDocument = function (doc) {
        for (var n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                return this.readTransactionResponseFromNode(/** @type {Element} */ (n));
            }
        }
        return undefined;
    };
    /**
     * @param {Element} node Node.
     * @return {TransactionResponse|undefined} Transaction response.
     */
    WFS.prototype.readTransactionResponseFromNode = function (node) {
        return Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushParseAndPop"])(
        /** @type {TransactionResponse} */ ({}), TRANSACTION_RESPONSE_PARSERS, node, []);
    };
    /**
     * Encode format as WFS `GetFeature` and return the Node.
     *
     * @param {WriteGetFeatureOptions} options Options.
     * @return {Node} Result.
     * @api
     */
    WFS.prototype.writeGetFeature = function (options) {
        var node = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(WFSNS, 'GetFeature');
        node.setAttribute('service', 'WFS');
        node.setAttribute('version', '1.1.0');
        var filter;
        if (options) {
            if (options.handle) {
                node.setAttribute('handle', options.handle);
            }
            if (options.outputFormat) {
                node.setAttribute('outputFormat', options.outputFormat);
            }
            if (options.maxFeatures !== undefined) {
                node.setAttribute('maxFeatures', String(options.maxFeatures));
            }
            if (options.resultType) {
                node.setAttribute('resultType', options.resultType);
            }
            if (options.startIndex !== undefined) {
                node.setAttribute('startIndex', String(options.startIndex));
            }
            if (options.count !== undefined) {
                node.setAttribute('count', String(options.count));
            }
            if (options.viewParams !== undefined) {
                node.setAttribute('viewParams', options.viewParams);
            }
            filter = options.filter;
            if (options.bbox) {
                Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(options.geometryName, 12); // `options.geometryName` must also be provided when `options.bbox` is set
                var bbox = Object(_filter_js__WEBPACK_IMPORTED_MODULE_4__["bbox"])(
                /** @type {string} */ (options.geometryName), options.bbox, options.srsName);
                if (filter) {
                    // if bbox and filter are both set, combine the two into a single filter
                    filter = Object(_filter_js__WEBPACK_IMPORTED_MODULE_4__["and"])(filter, bbox);
                }
                else {
                    filter = bbox;
                }
            }
        }
        node.setAttributeNS(_xml_js__WEBPACK_IMPORTED_MODULE_9__["XML_SCHEMA_INSTANCE_URI"], 'xsi:schemaLocation', this.schemaLocation_);
        /** @type {import("../xml.js").NodeStackItem} */
        var context = {
            node: node
        };
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])(context, {
            'srsName': options.srsName,
            'featureNS': options.featureNS ? options.featureNS : this.featureNS_,
            'featurePrefix': options.featurePrefix,
            'geometryName': options.geometryName,
            'filter': filter,
            'propertyNames': options.propertyNames ? options.propertyNames : []
        });
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(Array.isArray(options.featureTypes), 11); // `options.featureTypes` should be an Array
        writeGetFeature(node, /** @type {!Array<string>} */ (options.featureTypes), [context]);
        return node;
    };
    /**
     * Encode format as WFS `Transaction` and return the Node.
     *
     * @param {Array<import("../Feature.js").default>} inserts The features to insert.
     * @param {Array<import("../Feature.js").default>} updates The features to update.
     * @param {Array<import("../Feature.js").default>} deletes The features to delete.
     * @param {WriteTransactionOptions} options Write options.
     * @return {Node} Result.
     * @api
     */
    WFS.prototype.writeTransaction = function (inserts, updates, deletes, options) {
        var objectStack = [];
        var node = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(WFSNS, 'Transaction');
        var version = options.version ? options.version : DEFAULT_VERSION;
        var gmlVersion = version === '1.0.0' ? 2 : 3;
        node.setAttribute('service', 'WFS');
        node.setAttribute('version', version);
        var baseObj;
        /** @type {import("../xml.js").NodeStackItem} */
        var obj;
        if (options) {
            baseObj = options.gmlOptions ? options.gmlOptions : {};
            if (options.handle) {
                node.setAttribute('handle', options.handle);
            }
        }
        var schemaLocation = SCHEMA_LOCATIONS[version];
        node.setAttributeNS(_xml_js__WEBPACK_IMPORTED_MODULE_9__["XML_SCHEMA_INSTANCE_URI"], 'xsi:schemaLocation', schemaLocation);
        var featurePrefix = options.featurePrefix ? options.featurePrefix : FEATURE_PREFIX;
        if (inserts) {
            obj = Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])({ node: node }, { 'featureNS': options.featureNS,
                'featureType': options.featureType, 'featurePrefix': featurePrefix,
                'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName });
            Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])(obj, baseObj);
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])(obj, TRANSACTION_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])('Insert'), inserts, objectStack);
        }
        if (updates) {
            obj = Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])({ node: node }, { 'featureNS': options.featureNS,
                'featureType': options.featureType, 'featurePrefix': featurePrefix,
                'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName });
            Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])(obj, baseObj);
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])(obj, TRANSACTION_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])('Update'), updates, objectStack);
        }
        if (deletes) {
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])({ node: node, 'featureNS': options.featureNS,
                'featureType': options.featureType, 'featurePrefix': featurePrefix,
                'gmlVersion': gmlVersion, 'srsName': options.srsName }, TRANSACTION_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])('Delete'), deletes, objectStack);
        }
        if (options.nativeElements) {
            Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])({ node: node, 'featureNS': options.featureNS,
                'featureType': options.featureType, 'featurePrefix': featurePrefix,
                'gmlVersion': gmlVersion, 'srsName': options.srsName }, TRANSACTION_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])('Native'), options.nativeElements, objectStack);
        }
        return node;
    };
    /**
     * @inheritDoc
     */
    WFS.prototype.readProjectionFromDocument = function (doc) {
        for (var n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                return this.readProjectionFromNode(n);
            }
        }
        return null;
    };
    /**
     * @inheritDoc
     */
    WFS.prototype.readProjectionFromNode = function (node) {
        if (node.firstElementChild &&
            node.firstElementChild.firstElementChild) {
            node = node.firstElementChild.firstElementChild;
            for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
                if (!(n.childNodes.length === 0 ||
                    (n.childNodes.length === 1 &&
                        n.firstChild.nodeType === 3))) {
                    var objectStack = [{}];
                    this.gmlFormat_.readGeometryElement(n, objectStack);
                    return Object(_proj_js__WEBPACK_IMPORTED_MODULE_8__["get"])(objectStack.pop().srsName);
                }
            }
        }
        return null;
    };
    return WFS;
}(_XMLFeature_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Transaction Summary.
 */
function readTransactionSummary(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushParseAndPop"])({}, TRANSACTION_SUMMARY_PARSERS, node, objectStack);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
var OGC_FID_PARSERS = {
    'http://www.opengis.net/ogc': {
        'FeatureId': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeArrayPusher"])(function (node, objectStack) {
            return node.getAttribute('fid');
        })
    }
};
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 */
function fidParser(node, objectStack) {
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["parseNode"])(OGC_FID_PARSERS, node, objectStack);
}
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
var INSERT_RESULTS_PARSERS = {
    'http://www.opengis.net/wfs': {
        'Feature': fidParser
    }
};
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Array<string>|undefined} Insert results.
 */
function readInsertResults(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushParseAndPop"])([], INSERT_RESULTS_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {import("../Feature.js").default} feature Feature.
 * @param {Array<*>} objectStack Node stack.
 */
function writeFeature(node, feature, objectStack) {
    var context = objectStack[objectStack.length - 1];
    var featureType = context['featureType'];
    var featureNS = context['featureNS'];
    var gmlVersion = context['gmlVersion'];
    var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(featureNS, featureType);
    node.appendChild(child);
    if (gmlVersion === 2) {
        _GML2_js__WEBPACK_IMPORTED_MODULE_1__["default"].prototype.writeFeatureElement(child, feature, objectStack);
    }
    else {
        _GML3_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.writeFeatureElement(child, feature, objectStack);
    }
}
/**
 * @param {Node} node Node.
 * @param {number|string} fid Feature identifier.
 * @param {Array<*>} objectStack Node stack.
 */
function writeOgcFidFilter(node, fid, objectStack) {
    var filter = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(OGCNS, 'Filter');
    var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(OGCNS, 'FeatureId');
    filter.appendChild(child);
    child.setAttribute('fid', /** @type {string} */ (fid));
    node.appendChild(filter);
}
/**
 * @param {string|undefined} featurePrefix The prefix of the feature.
 * @param {string} featureType The type of the feature.
 * @returns {string} The value of the typeName property.
 */
function getTypeName(featurePrefix, featureType) {
    featurePrefix = featurePrefix ? featurePrefix : FEATURE_PREFIX;
    var prefix = featurePrefix + ':';
    // The featureType already contains the prefix.
    if (featureType.indexOf(prefix) === 0) {
        return featureType;
    }
    else {
        return prefix + featureType;
    }
}
/**
 * @param {Element} node Node.
 * @param {import("../Feature.js").default} feature Feature.
 * @param {Array<*>} objectStack Node stack.
 */
function writeDelete(node, feature, objectStack) {
    var context = objectStack[objectStack.length - 1];
    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(feature.getId() !== undefined, 26); // Features must have an id set
    var featureType = context['featureType'];
    var featurePrefix = context['featurePrefix'];
    var featureNS = context['featureNS'];
    var typeName = getTypeName(featurePrefix, featureType);
    node.setAttribute('typeName', typeName);
    node.setAttributeNS(XMLNS, 'xmlns:' + featurePrefix, featureNS);
    var fid = feature.getId();
    if (fid !== undefined) {
        writeOgcFidFilter(node, fid, objectStack);
    }
}
/**
 * @param {Element} node Node.
 * @param {import("../Feature.js").default} feature Feature.
 * @param {Array<*>} objectStack Node stack.
 */
function writeUpdate(node, feature, objectStack) {
    var context = objectStack[objectStack.length - 1];
    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(feature.getId() !== undefined, 27); // Features must have an id set
    var featureType = context['featureType'];
    var featurePrefix = context['featurePrefix'];
    var featureNS = context['featureNS'];
    var typeName = getTypeName(featurePrefix, featureType);
    var geometryName = feature.getGeometryName();
    node.setAttribute('typeName', typeName);
    node.setAttributeNS(XMLNS, 'xmlns:' + featurePrefix, featureNS);
    var fid = feature.getId();
    if (fid !== undefined) {
        var keys = feature.getKeys();
        var values = [];
        for (var i = 0, ii = keys.length; i < ii; i++) {
            var value = feature.get(keys[i]);
            if (value !== undefined) {
                var name_1 = keys[i];
                if (value && typeof /** @type {?} */ (value).getSimplifiedGeometry === 'function') {
                    name_1 = geometryName;
                }
                values.push({ name: name_1, value: value });
            }
        }
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])(/** @type {import("../xml.js").NodeStackItem} */ ({ 'gmlVersion': context['gmlVersion'], node: node,
            'hasZ': context['hasZ'], 'srsName': context['srsName'] }), TRANSACTION_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])('Property'), values, objectStack);
        writeOgcFidFilter(node, fid, objectStack);
    }
}
/**
 * @param {Node} node Node.
 * @param {Object} pair Property name and value.
 * @param {Array<*>} objectStack Node stack.
 */
function writeProperty(node, pair, objectStack) {
    var name = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(WFSNS, 'Name');
    var context = objectStack[objectStack.length - 1];
    var gmlVersion = context['gmlVersion'];
    node.appendChild(name);
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(name, pair.name);
    if (pair.value !== undefined && pair.value !== null) {
        var value = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(WFSNS, 'Value');
        node.appendChild(value);
        if (pair.value && typeof /** @type {?} */ (pair.value).getSimplifiedGeometry === 'function') {
            if (gmlVersion === 2) {
                _GML2_js__WEBPACK_IMPORTED_MODULE_1__["default"].prototype.writeGeometryElement(value, pair.value, objectStack);
            }
            else {
                _GML3_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.writeGeometryElement(value, pair.value, objectStack);
            }
        }
        else {
            Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(value, pair.value);
        }
    }
}
/**
 * @param {Element} node Node.
 * @param {{vendorId: string, safeToIgnore: boolean, value: string}} nativeElement The native element.
 * @param {Array<*>} objectStack Node stack.
 */
function writeNative(node, nativeElement, objectStack) {
    if (nativeElement.vendorId) {
        node.setAttribute('vendorId', nativeElement.vendorId);
    }
    if (nativeElement.safeToIgnore !== undefined) {
        node.setAttribute('safeToIgnore', String(nativeElement.safeToIgnore));
    }
    if (nativeElement.value !== undefined) {
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(node, nativeElement.value);
    }
}
/**
 * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
 */
var GETFEATURE_SERIALIZERS = {
    'http://www.opengis.net/wfs': {
        'Query': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeQuery)
    },
    'http://www.opengis.net/ogc': {
        'During': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeDuringFilter),
        'And': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeLogicalFilter),
        'Or': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeLogicalFilter),
        'Not': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeNotFilter),
        'BBOX': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeBboxFilter),
        'Contains': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeContainsFilter),
        'Intersects': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeIntersectsFilter),
        'Within': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeWithinFilter),
        'PropertyIsEqualTo': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeComparisonFilter),
        'PropertyIsNotEqualTo': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeComparisonFilter),
        'PropertyIsLessThan': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeComparisonFilter),
        'PropertyIsLessThanOrEqualTo': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeComparisonFilter),
        'PropertyIsGreaterThan': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeComparisonFilter),
        'PropertyIsGreaterThanOrEqualTo': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeComparisonFilter),
        'PropertyIsNull': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeIsNullFilter),
        'PropertyIsBetween': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeIsBetweenFilter),
        'PropertyIsLike': Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeChildAppender"])(writeIsLikeFilter)
    }
};
/**
 * @param {Element} node Node.
 * @param {string} featureType Feature type.
 * @param {Array<*>} objectStack Node stack.
 */
function writeQuery(node, featureType, objectStack) {
    var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    var featurePrefix = context['featurePrefix'];
    var featureNS = context['featureNS'];
    var propertyNames = context['propertyNames'];
    var srsName = context['srsName'];
    var typeName;
    // If feature prefix is not defined, we must not use the default prefix.
    if (featurePrefix) {
        typeName = getTypeName(featurePrefix, featureType);
    }
    else {
        typeName = featureType;
    }
    node.setAttribute('typeName', typeName);
    if (srsName) {
        node.setAttribute('srsName', srsName);
    }
    if (featureNS) {
        node.setAttributeNS(XMLNS, 'xmlns:' + featurePrefix, featureNS);
    }
    var item = /** @type {import("../xml.js").NodeStackItem} */ (Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])({}, context));
    item.node = node;
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])(item, QUERY_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])('PropertyName'), propertyNames, objectStack);
    var filter = context['filter'];
    if (filter) {
        var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(OGCNS, 'Filter');
        node.appendChild(child);
        writeFilterCondition(child, filter, objectStack);
    }
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/Filter.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeFilterCondition(node, filter, objectStack) {
    /** @type {import("../xml.js").NodeStackItem} */
    var item = { node: node };
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])(item, GETFEATURE_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])(filter.getTagName()), [filter], objectStack);
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/Bbox.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeBboxFilter(node, filter, objectStack) {
    var context = objectStack[objectStack.length - 1];
    context['srsName'] = filter.srsName;
    writeOgcPropertyName(node, filter.geometryName);
    _GML3_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.writeGeometryElement(node, filter.extent, objectStack);
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/Contains.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeContainsFilter(node, filter, objectStack) {
    var context = objectStack[objectStack.length - 1];
    context['srsName'] = filter.srsName;
    writeOgcPropertyName(node, filter.geometryName);
    _GML3_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.writeGeometryElement(node, filter.geometry, objectStack);
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/Intersects.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeIntersectsFilter(node, filter, objectStack) {
    var context = objectStack[objectStack.length - 1];
    context['srsName'] = filter.srsName;
    writeOgcPropertyName(node, filter.geometryName);
    _GML3_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.writeGeometryElement(node, filter.geometry, objectStack);
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/Within.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeWithinFilter(node, filter, objectStack) {
    var context = objectStack[objectStack.length - 1];
    context['srsName'] = filter.srsName;
    writeOgcPropertyName(node, filter.geometryName);
    _GML3_js__WEBPACK_IMPORTED_MODULE_2__["default"].prototype.writeGeometryElement(node, filter.geometry, objectStack);
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/During.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeDuringFilter(node, filter, objectStack) {
    var valueReference = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(FESNS, 'ValueReference');
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(valueReference, filter.propertyName);
    node.appendChild(valueReference);
    var timePeriod = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["GMLNS"], 'TimePeriod');
    node.appendChild(timePeriod);
    var begin = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["GMLNS"], 'begin');
    timePeriod.appendChild(begin);
    writeTimeInstant(begin, filter.begin);
    var end = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["GMLNS"], 'end');
    timePeriod.appendChild(end);
    writeTimeInstant(end, filter.end);
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/LogicalNary.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeLogicalFilter(node, filter, objectStack) {
    /** @type {import("../xml.js").NodeStackItem} */
    var item = { node: node };
    var conditions = filter.conditions;
    for (var i = 0, ii = conditions.length; i < ii; ++i) {
        var condition = conditions[i];
        Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])(item, GETFEATURE_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])(condition.getTagName()), [condition], objectStack);
    }
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/Not.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeNotFilter(node, filter, objectStack) {
    /** @type {import("../xml.js").NodeStackItem} */
    var item = { node: node };
    var condition = filter.condition;
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])(item, GETFEATURE_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])(condition.getTagName()), [condition], objectStack);
}
/**
 * @param {Element} node Node.
 * @param {import("./filter/ComparisonBinary.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeComparisonFilter(node, filter, objectStack) {
    if (filter.matchCase !== undefined) {
        node.setAttribute('matchCase', filter.matchCase.toString());
    }
    writeOgcPropertyName(node, filter.propertyName);
    writeOgcLiteral(node, '' + filter.expression);
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/IsNull.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeIsNullFilter(node, filter, objectStack) {
    writeOgcPropertyName(node, filter.propertyName);
}
/**
 * @param {Node} node Node.
 * @param {import("./filter/IsBetween.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeIsBetweenFilter(node, filter, objectStack) {
    writeOgcPropertyName(node, filter.propertyName);
    var lowerBoundary = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(OGCNS, 'LowerBoundary');
    node.appendChild(lowerBoundary);
    writeOgcLiteral(lowerBoundary, '' + filter.lowerBoundary);
    var upperBoundary = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(OGCNS, 'UpperBoundary');
    node.appendChild(upperBoundary);
    writeOgcLiteral(upperBoundary, '' + filter.upperBoundary);
}
/**
 * @param {Element} node Node.
 * @param {import("./filter/IsLike.js").default} filter Filter.
 * @param {Array<*>} objectStack Node stack.
 */
function writeIsLikeFilter(node, filter, objectStack) {
    node.setAttribute('wildCard', filter.wildCard);
    node.setAttribute('singleChar', filter.singleChar);
    node.setAttribute('escapeChar', filter.escapeChar);
    if (filter.matchCase !== undefined) {
        node.setAttribute('matchCase', filter.matchCase.toString());
    }
    writeOgcPropertyName(node, filter.propertyName);
    writeOgcLiteral(node, '' + filter.pattern);
}
/**
 * @param {string} tagName Tag name.
 * @param {Node} node Node.
 * @param {string} value Value.
 */
function writeOgcExpression(tagName, node, value) {
    var property = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(OGCNS, tagName);
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(property, value);
    node.appendChild(property);
}
/**
 * @param {Node} node Node.
 * @param {string} value PropertyName value.
 */
function writeOgcPropertyName(node, value) {
    writeOgcExpression('PropertyName', node, value);
}
/**
 * @param {Node} node Node.
 * @param {string} value PropertyName value.
 */
function writeOgcLiteral(node, value) {
    writeOgcExpression('Literal', node, value);
}
/**
 * @param {Node} node Node.
 * @param {string} time PropertyName value.
 */
function writeTimeInstant(node, time) {
    var timeInstant = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["GMLNS"], 'TimeInstant');
    node.appendChild(timeInstant);
    var timePosition = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(_GMLBase_js__WEBPACK_IMPORTED_MODULE_3__["GMLNS"], 'timePosition');
    timeInstant.appendChild(timePosition);
    Object(_xsd_js__WEBPACK_IMPORTED_MODULE_6__["writeStringTextNode"])(timePosition, time);
}
/**
 * Encode filter as WFS `Filter` and return the Node.
 *
 * @param {import("./filter/Filter.js").default} filter Filter.
 * @return {Node} Result.
 * @api
 */
function writeFilter(filter) {
    var child = Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["createElementNS"])(OGCNS, 'Filter');
    writeFilterCondition(child, filter, []);
    return child;
}
/**
 * @param {Node} node Node.
 * @param {Array<string>} featureTypes Feature types.
 * @param {Array<*>} objectStack Node stack.
 */
function writeGetFeature(node, featureTypes, objectStack) {
    var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
    var item = /** @type {import("../xml.js").NodeStackItem} */ (Object(_obj_js__WEBPACK_IMPORTED_MODULE_7__["assign"])({}, context));
    item.node = node;
    Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["pushSerializeAndPop"])(item, GETFEATURE_SERIALIZERS, Object(_xml_js__WEBPACK_IMPORTED_MODULE_9__["makeSimpleNodeFactory"])('Query'), featureTypes, objectStack);
}
/* harmony default export */ __webpack_exports__["default"] = (WFS);
//# sourceMappingURL=WFS.js.map

/***/ }),

/***/ "./node_modules/ol/format/WKT.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/WKT.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _TextFeature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TextFeature.js */ "./node_modules/ol/format/TextFeature.js");
/* harmony import */ var _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geom/GeometryCollection.js */ "./node_modules/ol/geom/GeometryCollection.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/WKT
 */












/**
 * Geometry constructors
 * @enum {function (new:import("../geom/Geometry.js").default, Array, GeometryLayout)}
 */
var GeometryConstructor = {
    'POINT': _geom_Point_js__WEBPACK_IMPORTED_MODULE_10__["default"],
    'LINESTRING': _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__["default"],
    'POLYGON': _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_11__["default"],
    'MULTIPOINT': _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_8__["default"],
    'MULTILINESTRING': _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_7__["default"],
    'MULTIPOLYGON': _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_9__["default"]
};
/**
 * @typedef {Object} Options
 * @property {boolean} [splitCollection=false] Whether to split GeometryCollections into
 * multiple features on reading.
 */
/**
 * @typedef {Object} Token
 * @property {number} type
 * @property {number|string} [value]
 * @property {number} position
 */
/**
 * @const
 * @type {string}
 */
var EMPTY = 'EMPTY';
/**
 * @const
 * @type {string}
 */
var Z = 'Z';
/**
 * @const
 * @type {string}
 */
var M = 'M';
/**
 * @const
 * @type {string}
 */
var ZM = 'ZM';
/**
 * @const
 * @enum {number}
 */
var TokenType = {
    TEXT: 1,
    LEFT_PAREN: 2,
    RIGHT_PAREN: 3,
    NUMBER: 4,
    COMMA: 5,
    EOF: 6
};
/**
 * @const
 * @type {Object<string, string>}
 */
var WKTGeometryType = {};
for (var type in _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"]) {
    WKTGeometryType[type] = _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"][type].toUpperCase();
}
/**
 * Class to tokenize a WKT string.
 */
var Lexer = /** @class */ (function () {
    /**
     * @param {string} wkt WKT string.
     */
    function Lexer(wkt) {
        /**
         * @type {string}
         */
        this.wkt = wkt;
        /**
         * @type {number}
         * @private
         */
        this.index_ = -1;
    }
    /**
     * @param {string} c Character.
     * @return {boolean} Whether the character is alphabetic.
     * @private
     */
    Lexer.prototype.isAlpha_ = function (c) {
        return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
    };
    /**
     * @param {string} c Character.
     * @param {boolean=} opt_decimal Whether the string number
     *     contains a dot, i.e. is a decimal number.
     * @return {boolean} Whether the character is numeric.
     * @private
     */
    Lexer.prototype.isNumeric_ = function (c, opt_decimal) {
        var decimal = opt_decimal !== undefined ? opt_decimal : false;
        return c >= '0' && c <= '9' || c == '.' && !decimal;
    };
    /**
     * @param {string} c Character.
     * @return {boolean} Whether the character is whitespace.
     * @private
     */
    Lexer.prototype.isWhiteSpace_ = function (c) {
        return c == ' ' || c == '\t' || c == '\r' || c == '\n';
    };
    /**
     * @return {string} Next string character.
     * @private
     */
    Lexer.prototype.nextChar_ = function () {
        return this.wkt.charAt(++this.index_);
    };
    /**
     * Fetch and return the next token.
     * @return {!Token} Next string token.
     */
    Lexer.prototype.nextToken = function () {
        var c = this.nextChar_();
        var position = this.index_;
        /** @type {number|string} */
        var value = c;
        var type;
        if (c == '(') {
            type = TokenType.LEFT_PAREN;
        }
        else if (c == ',') {
            type = TokenType.COMMA;
        }
        else if (c == ')') {
            type = TokenType.RIGHT_PAREN;
        }
        else if (this.isNumeric_(c) || c == '-') {
            type = TokenType.NUMBER;
            value = this.readNumber_();
        }
        else if (this.isAlpha_(c)) {
            type = TokenType.TEXT;
            value = this.readText_();
        }
        else if (this.isWhiteSpace_(c)) {
            return this.nextToken();
        }
        else if (c === '') {
            type = TokenType.EOF;
        }
        else {
            throw new Error('Unexpected character: ' + c);
        }
        return { position: position, value: value, type: type };
    };
    /**
     * @return {number} Numeric token value.
     * @private
     */
    Lexer.prototype.readNumber_ = function () {
        var c;
        var index = this.index_;
        var decimal = false;
        var scientificNotation = false;
        do {
            if (c == '.') {
                decimal = true;
            }
            else if (c == 'e' || c == 'E') {
                scientificNotation = true;
            }
            c = this.nextChar_();
        } while (this.isNumeric_(c, decimal) ||
            // if we haven't detected a scientific number before, 'e' or 'E'
            // hint that we should continue to read
            !scientificNotation && (c == 'e' || c == 'E') ||
            // once we know that we have a scientific number, both '-' and '+'
            // are allowed
            scientificNotation && (c == '-' || c == '+'));
        return parseFloat(this.wkt.substring(index, this.index_--));
    };
    /**
     * @return {string} String token value.
     * @private
     */
    Lexer.prototype.readText_ = function () {
        var c;
        var index = this.index_;
        do {
            c = this.nextChar_();
        } while (this.isAlpha_(c));
        return this.wkt.substring(index, this.index_--).toUpperCase();
    };
    return Lexer;
}());
/**
 * Class to parse the tokens from the WKT string.
 */
var Parser = /** @class */ (function () {
    /**
     * @param {Lexer} lexer The lexer.
     */
    function Parser(lexer) {
        /**
         * @type {Lexer}
         * @private
         */
        this.lexer_ = lexer;
        /**
         * @type {Token}
         * @private
         */
        this.token_;
        /**
         * @type {GeometryLayout}
         * @private
         */
        this.layout_ = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XY;
    }
    /**
     * Fetch the next token form the lexer and replace the active token.
     * @private
     */
    Parser.prototype.consume_ = function () {
        this.token_ = this.lexer_.nextToken();
    };
    /**
     * Tests if the given type matches the type of the current token.
     * @param {TokenType} type Token type.
     * @return {boolean} Whether the token matches the given type.
     */
    Parser.prototype.isTokenType = function (type) {
        var isMatch = this.token_.type == type;
        return isMatch;
    };
    /**
     * If the given type matches the current token, consume it.
     * @param {TokenType} type Token type.
     * @return {boolean} Whether the token matches the given type.
     */
    Parser.prototype.match = function (type) {
        var isMatch = this.isTokenType(type);
        if (isMatch) {
            this.consume_();
        }
        return isMatch;
    };
    /**
     * Try to parse the tokens provided by the lexer.
     * @return {import("../geom/Geometry.js").default} The geometry.
     */
    Parser.prototype.parse = function () {
        this.consume_();
        var geometry = this.parseGeometry_();
        return geometry;
    };
    /**
     * Try to parse the dimensional info.
     * @return {GeometryLayout} The layout.
     * @private
     */
    Parser.prototype.parseGeometryLayout_ = function () {
        var layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XY;
        var dimToken = this.token_;
        if (this.isTokenType(TokenType.TEXT)) {
            var dimInfo = dimToken.value;
            if (dimInfo === Z) {
                layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ;
            }
            else if (dimInfo === M) {
                layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYM;
            }
            else if (dimInfo === ZM) {
                layout = _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM;
            }
            if (layout !== _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XY) {
                this.consume_();
            }
        }
        return layout;
    };
    /**
     * @return {!Array<import("../geom/Geometry.js").default>} A collection of geometries.
     * @private
     */
    Parser.prototype.parseGeometryCollectionText_ = function () {
        if (this.match(TokenType.LEFT_PAREN)) {
            var geometries = [];
            do {
                geometries.push(this.parseGeometry_());
            } while (this.match(TokenType.COMMA));
            if (this.match(TokenType.RIGHT_PAREN)) {
                return geometries;
            }
        }
        else if (this.isEmptyGeometry_()) {
            return [];
        }
        throw new Error(this.formatErrorMessage_());
    };
    /**
     * @return {Array<number>} All values in a point.
     * @private
     */
    Parser.prototype.parsePointText_ = function () {
        if (this.match(TokenType.LEFT_PAREN)) {
            var coordinates = this.parsePoint_();
            if (this.match(TokenType.RIGHT_PAREN)) {
                return coordinates;
            }
        }
        else if (this.isEmptyGeometry_()) {
            return null;
        }
        throw new Error(this.formatErrorMessage_());
    };
    /**
     * @return {!Array<!Array<number>>} All points in a linestring.
     * @private
     */
    Parser.prototype.parseLineStringText_ = function () {
        if (this.match(TokenType.LEFT_PAREN)) {
            var coordinates = this.parsePointList_();
            if (this.match(TokenType.RIGHT_PAREN)) {
                return coordinates;
            }
        }
        else if (this.isEmptyGeometry_()) {
            return [];
        }
        throw new Error(this.formatErrorMessage_());
    };
    /**
     * @return {!Array<!Array<!Array<number>>>} All points in a polygon.
     * @private
     */
    Parser.prototype.parsePolygonText_ = function () {
        if (this.match(TokenType.LEFT_PAREN)) {
            var coordinates = this.parseLineStringTextList_();
            if (this.match(TokenType.RIGHT_PAREN)) {
                return coordinates;
            }
        }
        else if (this.isEmptyGeometry_()) {
            return [];
        }
        throw new Error(this.formatErrorMessage_());
    };
    /**
     * @return {!Array<!Array<number>>} All points in a multipoint.
     * @private
     */
    Parser.prototype.parseMultiPointText_ = function () {
        if (this.match(TokenType.LEFT_PAREN)) {
            var coordinates = void 0;
            if (this.token_.type == TokenType.LEFT_PAREN) {
                coordinates = this.parsePointTextList_();
            }
            else {
                coordinates = this.parsePointList_();
            }
            if (this.match(TokenType.RIGHT_PAREN)) {
                return coordinates;
            }
        }
        else if (this.isEmptyGeometry_()) {
            return [];
        }
        throw new Error(this.formatErrorMessage_());
    };
    /**
     * @return {!Array<!Array<!Array<number>>>} All linestring points
     *                                          in a multilinestring.
     * @private
     */
    Parser.prototype.parseMultiLineStringText_ = function () {
        if (this.match(TokenType.LEFT_PAREN)) {
            var coordinates = this.parseLineStringTextList_();
            if (this.match(TokenType.RIGHT_PAREN)) {
                return coordinates;
            }
        }
        else if (this.isEmptyGeometry_()) {
            return [];
        }
        throw new Error(this.formatErrorMessage_());
    };
    /**
     * @return {!Array<!Array<!Array<!Array<number>>>>} All polygon points in a multipolygon.
     * @private
     */
    Parser.prototype.parseMultiPolygonText_ = function () {
        if (this.match(TokenType.LEFT_PAREN)) {
            var coordinates = this.parsePolygonTextList_();
            if (this.match(TokenType.RIGHT_PAREN)) {
                return coordinates;
            }
        }
        else if (this.isEmptyGeometry_()) {
            return [];
        }
        throw new Error(this.formatErrorMessage_());
    };
    /**
     * @return {!Array<number>} A point.
     * @private
     */
    Parser.prototype.parsePoint_ = function () {
        var coordinates = [];
        var dimensions = this.layout_.length;
        for (var i = 0; i < dimensions; ++i) {
            var token = this.token_;
            if (this.match(TokenType.NUMBER)) {
                coordinates.push(/** @type {number} */ (token.value));
            }
            else {
                break;
            }
        }
        if (coordinates.length == dimensions) {
            return coordinates;
        }
        throw new Error(this.formatErrorMessage_());
    };
    /**
     * @return {!Array<!Array<number>>} An array of points.
     * @private
     */
    Parser.prototype.parsePointList_ = function () {
        var coordinates = [this.parsePoint_()];
        while (this.match(TokenType.COMMA)) {
            coordinates.push(this.parsePoint_());
        }
        return coordinates;
    };
    /**
     * @return {!Array<!Array<number>>} An array of points.
     * @private
     */
    Parser.prototype.parsePointTextList_ = function () {
        var coordinates = [this.parsePointText_()];
        while (this.match(TokenType.COMMA)) {
            coordinates.push(this.parsePointText_());
        }
        return coordinates;
    };
    /**
     * @return {!Array<!Array<!Array<number>>>} An array of points.
     * @private
     */
    Parser.prototype.parseLineStringTextList_ = function () {
        var coordinates = [this.parseLineStringText_()];
        while (this.match(TokenType.COMMA)) {
            coordinates.push(this.parseLineStringText_());
        }
        return coordinates;
    };
    /**
     * @return {!Array<!Array<!Array<!Array<number>>>>} An array of points.
     * @private
     */
    Parser.prototype.parsePolygonTextList_ = function () {
        var coordinates = [this.parsePolygonText_()];
        while (this.match(TokenType.COMMA)) {
            coordinates.push(this.parsePolygonText_());
        }
        return coordinates;
    };
    /**
     * @return {boolean} Whether the token implies an empty geometry.
     * @private
     */
    Parser.prototype.isEmptyGeometry_ = function () {
        var isEmpty = this.isTokenType(TokenType.TEXT) &&
            this.token_.value == EMPTY;
        if (isEmpty) {
            this.consume_();
        }
        return isEmpty;
    };
    /**
     * Create an error message for an unexpected token error.
     * @return {string} Error message.
     * @private
     */
    Parser.prototype.formatErrorMessage_ = function () {
        return 'Unexpected `' + this.token_.value + '` at position ' +
            this.token_.position + ' in `' + this.lexer_.wkt + '`';
    };
    /**
     * @return {!import("../geom/Geometry.js").default} The geometry.
     * @private
     */
    Parser.prototype.parseGeometry_ = function () {
        var token = this.token_;
        if (this.match(TokenType.TEXT)) {
            var geomType = token.value;
            this.layout_ = this.parseGeometryLayout_();
            if (geomType == 'GEOMETRYCOLLECTION') {
                var geometries = this.parseGeometryCollectionText_();
                return new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_3__["default"](geometries);
            }
            else {
                var ctor = GeometryConstructor[geomType];
                if (!ctor) {
                    throw new Error('Invalid geometry type: ' + geomType);
                }
                var coordinates = void 0;
                switch (geomType) {
                    case 'POINT': {
                        coordinates = this.parsePointText_();
                        break;
                    }
                    case 'LINESTRING': {
                        coordinates = this.parseLineStringText_();
                        break;
                    }
                    case 'POLYGON': {
                        coordinates = this.parsePolygonText_();
                        break;
                    }
                    case 'MULTIPOINT': {
                        coordinates = this.parseMultiPointText_();
                        break;
                    }
                    case 'MULTILINESTRING': {
                        coordinates = this.parseMultiLineStringText_();
                        break;
                    }
                    case 'MULTIPOLYGON': {
                        coordinates = this.parseMultiPolygonText_();
                        break;
                    }
                    default: {
                        throw new Error('Invalid geometry type: ' + geomType);
                    }
                }
                if (!coordinates) {
                    if (ctor === GeometryConstructor['POINT']) {
                        coordinates = [NaN, NaN];
                    }
                    else {
                        coordinates = [];
                    }
                }
                return new ctor(coordinates, this.layout_);
            }
        }
        throw new Error(this.formatErrorMessage_());
    };
    return Parser;
}());
/**
 * @classdesc
 * Geometry format for reading and writing data in the `WellKnownText` (WKT)
 * format.
 *
 * @api
 */
var WKT = /** @class */ (function (_super) {
    __extends(WKT, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function WKT(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * Split GeometryCollection into multiple features.
         * @type {boolean}
         * @private
         */
        _this.splitCollection_ = options.splitCollection !== undefined ?
            options.splitCollection : false;
        return _this;
    }
    /**
     * Parse a WKT string.
     * @param {string} wkt WKT string.
     * @return {import("../geom/Geometry.js").default|undefined}
     *     The geometry created.
     * @private
     */
    WKT.prototype.parse_ = function (wkt) {
        var lexer = new Lexer(wkt);
        var parser = new Parser(lexer);
        return parser.parse();
    };
    /**
     * @inheritDoc
     */
    WKT.prototype.readFeatureFromText = function (text, opt_options) {
        var geom = this.readGeometryFromText(text, opt_options);
        if (geom) {
            var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
            feature.setGeometry(geom);
            return feature;
        }
        return null;
    };
    /**
     * @inheritDoc
     */
    WKT.prototype.readFeaturesFromText = function (text, opt_options) {
        var geometries = [];
        var geometry = this.readGeometryFromText(text, opt_options);
        if (this.splitCollection_ &&
            geometry.getType() == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].GEOMETRY_COLLECTION) {
            geometries = ( /** @type {GeometryCollection} */(geometry))
                .getGeometriesArray();
        }
        else {
            geometries = [geometry];
        }
        var features = [];
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
            feature.setGeometry(geometries[i]);
            features.push(feature);
        }
        return features;
    };
    /**
     * @inheritDoc
     */
    WKT.prototype.readGeometryFromText = function (text, opt_options) {
        var geometry = this.parse_(text);
        if (geometry) {
            return Object(_Feature_js__WEBPACK_IMPORTED_MODULE_1__["transformGeometryWithOptions"])(geometry, false, opt_options);
        }
        else {
            return null;
        }
    };
    /**
     * @inheritDoc
     */
    WKT.prototype.writeFeatureText = function (feature, opt_options) {
        var geometry = feature.getGeometry();
        if (geometry) {
            return this.writeGeometryText(geometry, opt_options);
        }
        return '';
    };
    /**
     * @inheritDoc
     */
    WKT.prototype.writeFeaturesText = function (features, opt_options) {
        if (features.length == 1) {
            return this.writeFeatureText(features[0], opt_options);
        }
        var geometries = [];
        for (var i = 0, ii = features.length; i < ii; ++i) {
            geometries.push(features[i].getGeometry());
        }
        var collection = new _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_3__["default"](geometries);
        return this.writeGeometryText(collection, opt_options);
    };
    /**
     * @inheritDoc
     */
    WKT.prototype.writeGeometryText = function (geometry, opt_options) {
        return encode(Object(_Feature_js__WEBPACK_IMPORTED_MODULE_1__["transformGeometryWithOptions"])(geometry, true, opt_options));
    };
    return WKT;
}(_TextFeature_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * @param {Point} geom Point geometry.
 * @return {string} Coordinates part of Point as WKT.
 */
function encodePointGeometry(geom) {
    var coordinates = geom.getCoordinates();
    if (coordinates.length === 0) {
        return '';
    }
    return coordinates.join(' ');
}
/**
 * @param {MultiPoint} geom MultiPoint geometry.
 * @return {string} Coordinates part of MultiPoint as WKT.
 */
function encodeMultiPointGeometry(geom) {
    var array = [];
    var components = geom.getPoints();
    for (var i = 0, ii = components.length; i < ii; ++i) {
        array.push('(' + encodePointGeometry(components[i]) + ')');
    }
    return array.join(',');
}
/**
 * @param {GeometryCollection} geom GeometryCollection geometry.
 * @return {string} Coordinates part of GeometryCollection as WKT.
 */
function encodeGeometryCollectionGeometry(geom) {
    var array = [];
    var geoms = geom.getGeometries();
    for (var i = 0, ii = geoms.length; i < ii; ++i) {
        array.push(encode(geoms[i]));
    }
    return array.join(',');
}
/**
 * @param {LineString|import("../geom/LinearRing.js").default} geom LineString geometry.
 * @return {string} Coordinates part of LineString as WKT.
 */
function encodeLineStringGeometry(geom) {
    var coordinates = geom.getCoordinates();
    var array = [];
    for (var i = 0, ii = coordinates.length; i < ii; ++i) {
        array.push(coordinates[i].join(' '));
    }
    return array.join(',');
}
/**
 * @param {MultiLineString} geom MultiLineString geometry.
 * @return {string} Coordinates part of MultiLineString as WKT.
 */
function encodeMultiLineStringGeometry(geom) {
    var array = [];
    var components = geom.getLineStrings();
    for (var i = 0, ii = components.length; i < ii; ++i) {
        array.push('(' + encodeLineStringGeometry(components[i]) + ')');
    }
    return array.join(',');
}
/**
 * @param {Polygon} geom Polygon geometry.
 * @return {string} Coordinates part of Polygon as WKT.
 */
function encodePolygonGeometry(geom) {
    var array = [];
    var rings = geom.getLinearRings();
    for (var i = 0, ii = rings.length; i < ii; ++i) {
        array.push('(' + encodeLineStringGeometry(rings[i]) + ')');
    }
    return array.join(',');
}
/**
 * @param {MultiPolygon} geom MultiPolygon geometry.
 * @return {string} Coordinates part of MultiPolygon as WKT.
 */
function encodeMultiPolygonGeometry(geom) {
    var array = [];
    var components = geom.getPolygons();
    for (var i = 0, ii = components.length; i < ii; ++i) {
        array.push('(' + encodePolygonGeometry(components[i]) + ')');
    }
    return array.join(',');
}
/**
 * @param {import("../geom/SimpleGeometry.js").default} geom SimpleGeometry geometry.
 * @return {string} Potential dimensional information for WKT type.
 */
function encodeGeometryLayout(geom) {
    var layout = geom.getLayout();
    var dimInfo = '';
    if (layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZ || layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM) {
        dimInfo += Z;
    }
    if (layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYM || layout === _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_5__["default"].XYZM) {
        dimInfo += M;
    }
    return dimInfo;
}
/**
 * @const
 * @type {Object<string, function(import("../geom/Geometry.js").default): string>}
 */
var GeometryEncoder = {
    'Point': encodePointGeometry,
    'LineString': encodeLineStringGeometry,
    'Polygon': encodePolygonGeometry,
    'MultiPoint': encodeMultiPointGeometry,
    'MultiLineString': encodeMultiLineStringGeometry,
    'MultiPolygon': encodeMultiPolygonGeometry,
    'GeometryCollection': encodeGeometryCollectionGeometry
};
/**
 * Encode a geometry as WKT.
 * @param {!import("../geom/Geometry.js").default} geom The geometry to encode.
 * @return {string} WKT string for the geometry.
 */
function encode(geom) {
    var type = geom.getType();
    var geometryEncoder = GeometryEncoder[type];
    var enc = geometryEncoder(geom);
    type = type.toUpperCase();
    if (typeof /** @type {?} */ (geom).getFlatCoordinates === 'function') {
        var dimInfo = encodeGeometryLayout(/** @type {import("../geom/SimpleGeometry.js").default} */ (geom));
        if (dimInfo.length > 0) {
            type += ' ' + dimInfo;
        }
    }
    if (enc.length === 0) {
        return type + ' ' + EMPTY;
    }
    return type + '(' + enc + ')';
}
/* harmony default export */ __webpack_exports__["default"] = (WKT);
//# sourceMappingURL=WKT.js.map

/***/ }),

/***/ "./node_modules/ol/format/WMSCapabilities.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/format/WMSCapabilities.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _XLink_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./XLink.js */ "./node_modules/ol/format/XLink.js");
/* harmony import */ var _XML_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./XML.js */ "./node_modules/ol/format/XML.js");
/* harmony import */ var _xsd_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./xsd.js */ "./node_modules/ol/format/xsd.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/WMSCapabilities
 */




/**
 * @const
 * @type {Array<null|string>}
 */
var NAMESPACE_URIS = [
    null,
    'http://www.opengis.net/wms'
];
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Service': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readService),
    'Capability': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readCapability)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var CAPABILITY_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Request': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readRequest),
    'Exception': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readException),
    'Layer': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readCapabilityLayer)
});
/**
 * @classdesc
 * Format for reading WMS capabilities data
 *
 * @api
 */
var WMSCapabilities = /** @class */ (function (_super) {
    __extends(WMSCapabilities, _super);
    function WMSCapabilities() {
        var _this = _super.call(this) || this;
        /**
         * @type {string|undefined}
         */
        _this.version = undefined;
        return _this;
    }
    /**
     * @inheritDoc
     */
    WMSCapabilities.prototype.readFromDocument = function (doc) {
        for (var n = doc.firstChild; n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                return this.readFromNode(n);
            }
        }
        return null;
    };
    /**
     * @inheritDoc
     */
    WMSCapabilities.prototype.readFromNode = function (node) {
        this.version = node.getAttribute('version').trim();
        var wmsCapabilityObject = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({
            'version': this.version
        }, PARSERS, node, []);
        return wmsCapabilityObject ? wmsCapabilityObject : null;
    };
    return WMSCapabilities;
}(_XML_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var SERVICE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Title': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Abstract': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'KeywordList': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readKeywordList),
    'OnlineResource': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_XLink_js__WEBPACK_IMPORTED_MODULE_0__["readHref"]),
    'ContactInformation': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readContactInformation),
    'Fees': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'AccessConstraints': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'LayerLimit': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readNonNegativeInteger"]),
    'MaxWidth': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readNonNegativeInteger"]),
    'MaxHeight': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readNonNegativeInteger"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var CONTACT_INFORMATION_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'ContactPersonPrimary': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readContactPersonPrimary),
    'ContactPosition': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ContactAddress': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readContactAddress),
    'ContactVoiceTelephone': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ContactFacsimileTelephone': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ContactElectronicMailAddress': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var CONTACT_PERSON_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'ContactPerson': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'ContactOrganization': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var CONTACT_ADDRESS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'AddressType': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Address': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'City': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'StateOrProvince': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'PostCode': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Country': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var EXCEPTION_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Format': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeArrayPusher"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var LAYER_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Title': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Abstract': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'KeywordList': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readKeywordList),
    'CRS': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'EX_GeographicBoundingBox': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readEXGeographicBoundingBox),
    'BoundingBox': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readBoundingBox),
    'Dimension': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readDimension),
    'Attribution': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readAttribution),
    'AuthorityURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readAuthorityURL),
    'Identifier': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'MetadataURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readMetadataURL),
    'DataURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readFormatOnlineresource),
    'FeatureListURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readFormatOnlineresource),
    'Style': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readStyle),
    'MinScaleDenominator': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimal"]),
    'MaxScaleDenominator': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimal"]),
    'Layer': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readLayer)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var ATTRIBUTION_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Title': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'OnlineResource': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_XLink_js__WEBPACK_IMPORTED_MODULE_0__["readHref"]),
    'LogoURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readSizedFormatOnlineresource)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'westBoundLongitude': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimal"]),
    'eastBoundLongitude': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimal"]),
    'southBoundLatitude': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimal"]),
    'northBoundLatitude': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimal"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var REQUEST_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'GetCapabilities': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readOperationType),
    'GetMap': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readOperationType),
    'GetFeatureInfo': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readOperationType)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var OPERATIONTYPE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Format': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'DCPType': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readDCPType)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var DCPTYPE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'HTTP': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readHTTP)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var HTTP_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Get': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readFormatOnlineresource),
    'Post': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readFormatOnlineresource)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var STYLE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Name': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Title': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'Abstract': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'LegendURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertyPusher"])(readSizedFormatOnlineresource),
    'StyleSheetURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readFormatOnlineresource),
    'StyleURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(readFormatOnlineresource)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var FORMAT_ONLINERESOURCE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Format': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"]),
    'OnlineResource': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeObjectPropertySetter"])(_XLink_js__WEBPACK_IMPORTED_MODULE_0__["readHref"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var KEYWORDLIST_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeStructureNS"])(NAMESPACE_URIS, {
    'Keyword': Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["makeArrayPusher"])(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])
});
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Attribution object.
 */
function readAttribution(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, ATTRIBUTION_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object} Bounding box object.
 */
function readBoundingBox(node, objectStack) {
    var extent = [
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimalString"])(node.getAttribute('minx')),
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimalString"])(node.getAttribute('miny')),
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimalString"])(node.getAttribute('maxx')),
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimalString"])(node.getAttribute('maxy'))
    ];
    var resolutions = [
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimalString"])(node.getAttribute('resx')),
        Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimalString"])(node.getAttribute('resy'))
    ];
    return {
        'crs': node.getAttribute('CRS'),
        'extent': extent,
        'res': resolutions
    };
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {import("../extent.js").Extent|undefined} Bounding box object.
 */
function readEXGeographicBoundingBox(node, objectStack) {
    var geographicBoundingBox = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS, node, objectStack);
    if (!geographicBoundingBox) {
        return undefined;
    }
    var westBoundLongitude = /** @type {number|undefined} */ (geographicBoundingBox['westBoundLongitude']);
    var southBoundLatitude = /** @type {number|undefined} */ (geographicBoundingBox['southBoundLatitude']);
    var eastBoundLongitude = /** @type {number|undefined} */ (geographicBoundingBox['eastBoundLongitude']);
    var northBoundLatitude = /** @type {number|undefined} */ (geographicBoundingBox['northBoundLatitude']);
    if (westBoundLongitude === undefined || southBoundLatitude === undefined ||
        eastBoundLongitude === undefined || northBoundLatitude === undefined) {
        return undefined;
    }
    return [
        westBoundLongitude, southBoundLatitude,
        eastBoundLongitude, northBoundLatitude
    ];
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Capability object.
 */
function readCapability(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, CAPABILITY_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Service object.
 */
function readService(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, SERVICE_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Contact information object.
 */
function readContactInformation(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, CONTACT_INFORMATION_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Contact person object.
 */
function readContactPersonPrimary(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, CONTACT_PERSON_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Contact address object.
 */
function readContactAddress(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, CONTACT_ADDRESS_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Array<string>|undefined} Format array.
 */
function readException(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])([], EXCEPTION_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Layer object.
 */
function readCapabilityLayer(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, LAYER_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Layer object.
 */
function readLayer(node, objectStack) {
    var parentLayerObject = /**  @type {!Object<string,*>} */ (objectStack[objectStack.length - 1]);
    var layerObject = Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, LAYER_PARSERS, node, objectStack);
    if (!layerObject) {
        return undefined;
    }
    var queryable = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readBooleanString"])(node.getAttribute('queryable'));
    if (queryable === undefined) {
        queryable = parentLayerObject['queryable'];
    }
    layerObject['queryable'] = queryable !== undefined ? queryable : false;
    var cascaded = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readNonNegativeIntegerString"])(node.getAttribute('cascaded'));
    if (cascaded === undefined) {
        cascaded = parentLayerObject['cascaded'];
    }
    layerObject['cascaded'] = cascaded;
    var opaque = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readBooleanString"])(node.getAttribute('opaque'));
    if (opaque === undefined) {
        opaque = parentLayerObject['opaque'];
    }
    layerObject['opaque'] = opaque !== undefined ? opaque : false;
    var noSubsets = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readBooleanString"])(node.getAttribute('noSubsets'));
    if (noSubsets === undefined) {
        noSubsets = parentLayerObject['noSubsets'];
    }
    layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false;
    var fixedWidth = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimalString"])(node.getAttribute('fixedWidth'));
    if (!fixedWidth) {
        fixedWidth = parentLayerObject['fixedWidth'];
    }
    layerObject['fixedWidth'] = fixedWidth;
    var fixedHeight = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readDecimalString"])(node.getAttribute('fixedHeight'));
    if (!fixedHeight) {
        fixedHeight = parentLayerObject['fixedHeight'];
    }
    layerObject['fixedHeight'] = fixedHeight;
    // See 7.2.4.8
    var addKeys = ['Style', 'CRS', 'AuthorityURL'];
    addKeys.forEach(function (key) {
        if (key in parentLayerObject) {
            var childValue = layerObject[key] || [];
            layerObject[key] = childValue.concat(parentLayerObject[key]);
        }
    });
    var replaceKeys = ['EX_GeographicBoundingBox', 'BoundingBox', 'Dimension',
        'Attribution', 'MinScaleDenominator', 'MaxScaleDenominator'];
    replaceKeys.forEach(function (key) {
        if (!(key in layerObject)) {
            var parentValue = parentLayerObject[key];
            layerObject[key] = parentValue;
        }
    });
    return layerObject;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object} Dimension object.
 */
function readDimension(node, objectStack) {
    var dimensionObject = {
        'name': node.getAttribute('name'),
        'units': node.getAttribute('units'),
        'unitSymbol': node.getAttribute('unitSymbol'),
        'default': node.getAttribute('default'),
        'multipleValues': Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readBooleanString"])(node.getAttribute('multipleValues')),
        'nearestValue': Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readBooleanString"])(node.getAttribute('nearestValue')),
        'current': Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readBooleanString"])(node.getAttribute('current')),
        'values': Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readString"])(node)
    };
    return dimensionObject;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Online resource object.
 */
function readFormatOnlineresource(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, FORMAT_ONLINERESOURCE_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Request object.
 */
function readRequest(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, REQUEST_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} DCP type object.
 */
function readDCPType(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, DCPTYPE_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} HTTP object.
 */
function readHTTP(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, HTTP_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Operation type object.
 */
function readOperationType(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, OPERATIONTYPE_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Online resource object.
 */
function readSizedFormatOnlineresource(node, objectStack) {
    var formatOnlineresource = readFormatOnlineresource(node, objectStack);
    if (formatOnlineresource) {
        var size = [
            Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readNonNegativeIntegerString"])(node.getAttribute('width')),
            Object(_xsd_js__WEBPACK_IMPORTED_MODULE_2__["readNonNegativeIntegerString"])(node.getAttribute('height'))
        ];
        formatOnlineresource['size'] = size;
        return formatOnlineresource;
    }
    return undefined;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Authority URL object.
 */
function readAuthorityURL(node, objectStack) {
    var authorityObject = readFormatOnlineresource(node, objectStack);
    if (authorityObject) {
        authorityObject['name'] = node.getAttribute('name');
        return authorityObject;
    }
    return undefined;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Metadata URL object.
 */
function readMetadataURL(node, objectStack) {
    var metadataObject = readFormatOnlineresource(node, objectStack);
    if (metadataObject) {
        metadataObject['type'] = node.getAttribute('type');
        return metadataObject;
    }
    return undefined;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Style object.
 */
function readStyle(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])({}, STYLE_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Array<string>|undefined} Keyword list.
 */
function readKeywordList(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_3__["pushParseAndPop"])([], KEYWORDLIST_PARSERS, node, objectStack);
}
/* harmony default export */ __webpack_exports__["default"] = (WMSCapabilities);
//# sourceMappingURL=WMSCapabilities.js.map

/***/ }),

/***/ "./node_modules/ol/format/WMSGetFeatureInfo.js":
/*!*****************************************************!*\
  !*** ./node_modules/ol/format/WMSGetFeatureInfo.js ***!
  \*****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _GML2_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GML2.js */ "./node_modules/ol/format/GML2.js");
/* harmony import */ var _XMLFeature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./XMLFeature.js */ "./node_modules/ol/format/XMLFeature.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/WMSGetFeatureInfo
 */





/**
 * @typedef {Object} Options
 * @property {Array<string>} [layers] If set, only features of the given layers will be returned by the format when read.
 */
/**
 * @const
 * @type {string}
 */
var featureIdentifier = '_feature';
/**
 * @const
 * @type {string}
 */
var layerIdentifier = '_layer';
/**
 * @classdesc
 * Format for reading WMSGetFeatureInfo format. It uses
 * {@link module:ol/format/GML2~GML2} to read features.
 *
 * @api
 */
var WMSGetFeatureInfo = /** @class */ (function (_super) {
    __extends(WMSGetFeatureInfo, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function WMSGetFeatureInfo(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @private
         * @type {string}
         */
        _this.featureNS_ = 'http://mapserver.gis.umn.edu/mapserver';
        /**
         * @private
         * @type {GML2}
         */
        _this.gmlFormat_ = new _GML2_js__WEBPACK_IMPORTED_MODULE_1__["default"]();
        /**
         * @private
         * @type {Array<string>}
         */
        _this.layers_ = options.layers ? options.layers : null;
        return _this;
    }
    /**
     * @return {Array<string>} layers
     */
    WMSGetFeatureInfo.prototype.getLayers = function () {
        return this.layers_;
    };
    /**
     * @param {Array<string>} layers Layers to parse.
     */
    WMSGetFeatureInfo.prototype.setLayers = function (layers) {
        this.layers_ = layers;
    };
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     * @return {Array<import("../Feature.js").default>} Features.
     * @private
     */
    WMSGetFeatureInfo.prototype.readFeatures_ = function (node, objectStack) {
        node.setAttribute('namespaceURI', this.featureNS_);
        var localName = node.localName;
        /** @type {Array<import("../Feature.js").default>} */
        var features = [];
        if (node.childNodes.length === 0) {
            return features;
        }
        if (localName == 'msGMLOutput') {
            for (var i = 0, ii = node.childNodes.length; i < ii; i++) {
                var layer = node.childNodes[i];
                if (layer.nodeType !== Node.ELEMENT_NODE) {
                    continue;
                }
                var layerElement = /** @type {Element} */ (layer);
                var context = objectStack[0];
                var toRemove = layerIdentifier;
                var layerName = layerElement.localName.replace(toRemove, '');
                if (this.layers_ && !Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["includes"])(this.layers_, layerName)) {
                    continue;
                }
                var featureType = layerName +
                    featureIdentifier;
                context['featureType'] = featureType;
                context['featureNS'] = this.featureNS_;
                /** @type {Object<string, import("../xml.js").Parser>} */
                var parsers = {};
                parsers[featureType] = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["makeArrayPusher"])(this.gmlFormat_.readFeatureElement, this.gmlFormat_);
                var parsersNS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["makeStructureNS"])([context['featureNS'], null], parsers);
                layerElement.setAttribute('namespaceURI', this.featureNS_);
                var layerFeatures = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["pushParseAndPop"])(
                // @ts-ignore
                [], parsersNS, layerElement, objectStack, this.gmlFormat_);
                if (layerFeatures) {
                    Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(features, layerFeatures);
                }
            }
        }
        if (localName == 'FeatureCollection') {
            var gmlFeatures = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["pushParseAndPop"])([], this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node, [{}], this.gmlFormat_);
            if (gmlFeatures) {
                features = gmlFeatures;
            }
        }
        return features;
    };
    /**
     * @inheritDoc
     */
    WMSGetFeatureInfo.prototype.readFeaturesFromNode = function (node, opt_options) {
        var options = {};
        if (opt_options) {
            Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])(options, this.getReadOptions(node, opt_options));
        }
        return this.readFeatures_(node, [options]);
    };
    return WMSGetFeatureInfo;
}(_XMLFeature_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (WMSGetFeatureInfo);
//# sourceMappingURL=WMSGetFeatureInfo.js.map

/***/ }),

/***/ "./node_modules/ol/format/WMTSCapabilities.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/format/WMTSCapabilities.js ***!
  \****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _OWS_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OWS.js */ "./node_modules/ol/format/OWS.js");
/* harmony import */ var _XLink_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./XLink.js */ "./node_modules/ol/format/XLink.js");
/* harmony import */ var _XML_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./XML.js */ "./node_modules/ol/format/XML.js");
/* harmony import */ var _xsd_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./xsd.js */ "./node_modules/ol/format/xsd.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/WMTSCapabilities
 */






/**
 * @const
 * @type {Array<null|string>}
 */
var NAMESPACE_URIS = [
    null,
    'http://www.opengis.net/wmts/1.0'
];
/**
 * @const
 * @type {Array<null|string>}
 */
var OWS_NAMESPACE_URIS = [
    null,
    'http://www.opengis.net/ows/1.1'
];
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'Contents': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(readContents)
});
/**
 * @classdesc
 * Format for reading WMTS capabilities data.
 *
 * @api
 */
var WMTSCapabilities = /** @class */ (function (_super) {
    __extends(WMTSCapabilities, _super);
    function WMTSCapabilities() {
        var _this = _super.call(this) || this;
        /**
         * @type {OWS}
         * @private
         */
        _this.owsParser_ = new _OWS_js__WEBPACK_IMPORTED_MODULE_1__["default"]();
        return _this;
    }
    /**
     * @inheritDoc
     */
    WMTSCapabilities.prototype.readFromDocument = function (doc) {
        for (var n = doc.firstChild; n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                return this.readFromNode(n);
            }
        }
        return null;
    };
    /**
     * @inheritDoc
     */
    WMTSCapabilities.prototype.readFromNode = function (node) {
        var version = node.getAttribute('version');
        if (version) {
            version = version.trim();
        }
        var WMTSCapabilityObject = this.owsParser_.readFromNode(node);
        if (!WMTSCapabilityObject) {
            return null;
        }
        WMTSCapabilityObject['version'] = version;
        WMTSCapabilityObject = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])(WMTSCapabilityObject, PARSERS, node, []);
        return WMTSCapabilityObject ? WMTSCapabilityObject : null;
    };
    return WMTSCapabilities;
}(_XML_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var CONTENTS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'Layer': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(readLayer),
    'TileMatrixSet': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(readTileMatrixSet)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var LAYER_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'Style': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(readStyle),
    'Format': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'TileMatrixSetLink': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(readTileMatrixSetLink),
    'Dimension': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(readDimensions),
    'ResourceURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(readResourceUrl)
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(OWS_NAMESPACE_URIS, {
    'Title': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'Abstract': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'WGS84BoundingBox': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(readWgs84BoundingBox),
    'Identifier': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"])
}));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var STYLE_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'LegendURL': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(readLegendUrl)
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(OWS_NAMESPACE_URIS, {
    'Title': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'Identifier': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"])
}));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var TMS_LINKS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'TileMatrixSet': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'TileMatrixSetLimits': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(readTileMatrixLimitsList)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var TMS_LIMITS_LIST_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'TileMatrixLimits': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeArrayPusher"])(readTileMatrixLimits)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var TMS_LIMITS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'TileMatrix': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'MinTileRow': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'MaxTileRow': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'MinTileCol': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'MaxTileCol': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"])
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var DIMENSION_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'Default': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'Value': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"])
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(OWS_NAMESPACE_URIS, {
    'Identifier': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"])
}));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var WGS84_BBOX_READERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(OWS_NAMESPACE_URIS, {
    'LowerCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeArrayPusher"])(readCoordinates),
    'UpperCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeArrayPusher"])(readCoordinates)
});
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var TMS_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'WellKnownScaleSet': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'TileMatrix': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertyPusher"])(readTileMatrix)
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(OWS_NAMESPACE_URIS, {
    'SupportedCRS': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"]),
    'Identifier': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"])
}));
/**
 * @const
 * @type {Object<string, Object<string, import("../xml.js").Parser>>}
 */
// @ts-ignore
var TM_PARSERS = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(NAMESPACE_URIS, {
    'TopLeftCorner': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(readCoordinates),
    'ScaleDenominator': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readDecimal"]),
    'TileWidth': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'TileHeight': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'MatrixWidth': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"]),
    'MatrixHeight': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readNonNegativeInteger"])
}, Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeStructureNS"])(OWS_NAMESPACE_URIS, {
    'Identifier': Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["makeObjectPropertySetter"])(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"])
}));
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Attribution object.
 */
function readContents(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])({}, CONTENTS_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Layers object.
 */
function readLayer(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])({}, LAYER_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Tile Matrix Set object.
 */
function readTileMatrixSet(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])({}, TMS_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Style object.
 */
function readStyle(node, objectStack) {
    var style = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])({}, STYLE_PARSERS, node, objectStack);
    if (!style) {
        return undefined;
    }
    var isDefault = node.getAttribute('isDefault') === 'true';
    style['isDefault'] = isDefault;
    return style;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Tile Matrix Set Link object.
 */
function readTileMatrixSetLink(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])({}, TMS_LINKS_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Dimension object.
 */
function readDimensions(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])({}, DIMENSION_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Resource URL object.
 */
function readResourceUrl(node, objectStack) {
    var format = node.getAttribute('format');
    var template = node.getAttribute('template');
    var resourceType = node.getAttribute('resourceType');
    var resource = {};
    if (format) {
        resource['format'] = format;
    }
    if (template) {
        resource['template'] = template;
    }
    if (resourceType) {
        resource['resourceType'] = resourceType;
    }
    return resource;
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} WGS84 BBox object.
 */
function readWgs84BoundingBox(node, objectStack) {
    var coordinates = Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])([], WGS84_BBOX_READERS, node, objectStack);
    if (coordinates.length != 2) {
        return undefined;
    }
    return Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["boundingExtent"])(coordinates);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Legend object.
 */
function readLegendUrl(node, objectStack) {
    var legend = {};
    legend['format'] = node.getAttribute('format');
    legend['href'] = Object(_XLink_js__WEBPACK_IMPORTED_MODULE_2__["readHref"])(node);
    return legend;
}
/**
 * @param {Node} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} Coordinates object.
 */
function readCoordinates(node, objectStack) {
    var coordinates = Object(_xsd_js__WEBPACK_IMPORTED_MODULE_4__["readString"])(node).split(/\s+/);
    if (!coordinates || coordinates.length != 2) {
        return undefined;
    }
    var x = +coordinates[0];
    var y = +coordinates[1];
    if (isNaN(x) || isNaN(y)) {
        return undefined;
    }
    return [x, y];
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} TileMatrix object.
 */
function readTileMatrix(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])({}, TM_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} TileMatrixSetLimits Object.
 */
function readTileMatrixLimitsList(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])([], TMS_LIMITS_LIST_PARSERS, node, objectStack);
}
/**
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @return {Object|undefined} TileMatrixLimits Array.
 */
function readTileMatrixLimits(node, objectStack) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_5__["pushParseAndPop"])({}, TMS_LIMITS_PARSERS, node, objectStack);
}
/* harmony default export */ __webpack_exports__["default"] = (WMTSCapabilities);
//# sourceMappingURL=WMTSCapabilities.js.map

/***/ }),

/***/ "./node_modules/ol/format/XLink.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/format/XLink.js ***!
  \*****************************************/
/*! exports provided: readHref */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readHref", function() { return readHref; });
/**
 * @module ol/format/XLink
 */
/**
 * @const
 * @type {string}
 */
var NAMESPACE_URI = 'http://www.w3.org/1999/xlink';
/**
 * @param {Element} node Node.
 * @return {string|undefined} href.
 */
function readHref(node) {
    return node.getAttributeNS(NAMESPACE_URI, 'href');
}
//# sourceMappingURL=XLink.js.map

/***/ }),

/***/ "./node_modules/ol/format/XML.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/XML.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
/**
 * @module ol/format/XML
 */

/**
 * @classdesc
 * Generic format for reading non-feature XML data
 *
 * @abstract
 */
var XML = /** @class */ (function () {
    function XML() {
    }
    /**
     * Read the source document.
     *
     * @param {Document|Element|string} source The XML source.
     * @return {Object} An object representing the source.
     * @api
     */
    XML.prototype.read = function (source) {
        if (!source) {
            return null;
        }
        else if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["parse"])(source);
            return this.readFromDocument(doc);
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["isDocument"])(source)) {
            return this.readFromDocument(/** @type {Document} */ (source));
        }
        else {
            return this.readFromNode(/** @type {Element} */ (source));
        }
    };
    /**
     * @abstract
     * @param {Document} doc Document.
     * @return {Object} Object
     */
    XML.prototype.readFromDocument = function (doc) { };
    /**
     * @abstract
     * @param {Element} node Node.
     * @return {Object} Object
     */
    XML.prototype.readFromNode = function (node) { };
    return XML;
}());
/* harmony default export */ __webpack_exports__["default"] = (XML);
//# sourceMappingURL=XML.js.map

/***/ }),

/***/ "./node_modules/ol/format/XMLFeature.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/format/XMLFeature.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _format_Feature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../format/Feature.js */ "./node_modules/ol/format/Feature.js");
/* harmony import */ var _format_FormatType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../format/FormatType.js */ "./node_modules/ol/format/FormatType.js");
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/XMLFeature
 */





/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Base class for XML feature formats.
 *
 * @abstract
 */
var XMLFeature = /** @class */ (function (_super) {
    __extends(XMLFeature, _super);
    function XMLFeature() {
        var _this = _super.call(this) || this;
        /**
         * @type {XMLSerializer}
         * @private
         */
        _this.xmlSerializer_ = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["getXMLSerializer"])();
        return _this;
    }
    /**
     * @inheritDoc
     */
    XMLFeature.prototype.getType = function () {
        return _format_FormatType_js__WEBPACK_IMPORTED_MODULE_3__["default"].XML;
    };
    /**
     * Read a single feature.
     *
     * @param {Document|Node|Object|string} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
     * @return {import("../Feature.js").default} Feature.
     * @api
     */
    XMLFeature.prototype.readFeature = function (source, opt_options) {
        if (!source) {
            return null;
        }
        else if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["parse"])(source);
            return this.readFeatureFromDocument(doc, opt_options);
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["isDocument"])(source)) {
            return this.readFeatureFromDocument(/** @type {Document} */ (source), opt_options);
        }
        else {
            return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options);
        }
    };
    /**
     * @param {Document} doc Document.
     * @param {import("./Feature.js").ReadOptions=} opt_options Options.
     * @return {import("../Feature.js").default} Feature.
     */
    XMLFeature.prototype.readFeatureFromDocument = function (doc, opt_options) {
        var features = this.readFeaturesFromDocument(doc, opt_options);
        if (features.length > 0) {
            return features[0];
        }
        else {
            return null;
        }
    };
    /**
     * @param {Node} node Node.
     * @param {import("./Feature.js").ReadOptions=} opt_options Options.
     * @return {import("../Feature.js").default} Feature.
     */
    XMLFeature.prototype.readFeatureFromNode = function (node, opt_options) {
        return null; // not implemented
    };
    /**
     * Read all features from a feature collection.
     *
     * @param {Document|Node|Object|string} source Source.
     * @param {import("./Feature.js").ReadOptions=} opt_options Options.
     * @return {Array<import("../Feature.js").default>} Features.
     * @api
     */
    XMLFeature.prototype.readFeatures = function (source, opt_options) {
        if (!source) {
            return [];
        }
        else if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["parse"])(source);
            return this.readFeaturesFromDocument(doc, opt_options);
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["isDocument"])(source)) {
            return this.readFeaturesFromDocument(
            /** @type {Document} */ (source), opt_options);
        }
        else {
            return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options);
        }
    };
    /**
     * @param {Document} doc Document.
     * @param {import("./Feature.js").ReadOptions=} opt_options Options.
     * @protected
     * @return {Array<import("../Feature.js").default>} Features.
     */
    XMLFeature.prototype.readFeaturesFromDocument = function (doc, opt_options) {
        /** @type {Array<import("../Feature.js").default>} */
        var features = [];
        for (var n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) {
            if (n.nodeType == Node.ELEMENT_NODE) {
                Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(features, this.readFeaturesFromNode(n, opt_options));
            }
        }
        return features;
    };
    /**
     * @abstract
     * @param {Node} node Node.
     * @param {import("./Feature.js").ReadOptions=} opt_options Options.
     * @protected
     * @return {Array<import("../Feature.js").default>} Features.
     */
    XMLFeature.prototype.readFeaturesFromNode = function (node, opt_options) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @inheritDoc
     */
    XMLFeature.prototype.readGeometry = function (source, opt_options) {
        if (!source) {
            return null;
        }
        else if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["parse"])(source);
            return this.readGeometryFromDocument(doc, opt_options);
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["isDocument"])(source)) {
            return this.readGeometryFromDocument(
            /** @type {Document} */ (source), opt_options);
        }
        else {
            return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options);
        }
    };
    /**
     * @param {Document} doc Document.
     * @param {import("./Feature.js").ReadOptions=} opt_options Options.
     * @protected
     * @return {import("../geom/Geometry.js").default} Geometry.
     */
    XMLFeature.prototype.readGeometryFromDocument = function (doc, opt_options) {
        return null; // not implemented
    };
    /**
     * @param {Node} node Node.
     * @param {import("./Feature.js").ReadOptions=} opt_options Options.
     * @protected
     * @return {import("../geom/Geometry.js").default} Geometry.
     */
    XMLFeature.prototype.readGeometryFromNode = function (node, opt_options) {
        return null; // not implemented
    };
    /**
     * Read the projection from the source.
     *
     * @param {Document|Node|Object|string} source Source.
     * @return {import("../proj/Projection.js").default} Projection.
     * @api
     */
    XMLFeature.prototype.readProjection = function (source) {
        if (!source) {
            return null;
        }
        else if (typeof source === 'string') {
            var doc = Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["parse"])(source);
            return this.readProjectionFromDocument(doc);
        }
        else if (Object(_xml_js__WEBPACK_IMPORTED_MODULE_4__["isDocument"])(source)) {
            return this.readProjectionFromDocument(/** @type {Document} */ (source));
        }
        else {
            return this.readProjectionFromNode(/** @type {Node} */ (source));
        }
    };
    /**
     * @param {Document} doc Document.
     * @protected
     * @return {import("../proj/Projection.js").default} Projection.
     */
    XMLFeature.prototype.readProjectionFromDocument = function (doc) {
        return this.dataProjection;
    };
    /**
     * @param {Node} node Node.
     * @protected
     * @return {import("../proj/Projection.js").default} Projection.
     */
    XMLFeature.prototype.readProjectionFromNode = function (node) {
        return this.dataProjection;
    };
    /**
     * @inheritDoc
     */
    XMLFeature.prototype.writeFeature = function (feature, opt_options) {
        var node = this.writeFeatureNode(feature, opt_options);
        return this.xmlSerializer_.serializeToString(node);
    };
    /**
     * @param {import("../Feature.js").default} feature Feature.
     * @param {import("./Feature.js").WriteOptions=} opt_options Options.
     * @protected
     * @return {Node} Node.
     */
    XMLFeature.prototype.writeFeatureNode = function (feature, opt_options) {
        return null; // not implemented
    };
    /**
     * Encode an array of features as string.
     *
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
     * @return {string} Result.
     * @api
     */
    XMLFeature.prototype.writeFeatures = function (features, opt_options) {
        var node = this.writeFeaturesNode(features, opt_options);
        return this.xmlSerializer_.serializeToString(node);
    };
    /**
     * @param {Array<import("../Feature.js").default>} features Features.
     * @param {import("./Feature.js").WriteOptions=} opt_options Options.
     * @return {Node} Node.
     */
    XMLFeature.prototype.writeFeaturesNode = function (features, opt_options) {
        return null; // not implemented
    };
    /**
     * @inheritDoc
     */
    XMLFeature.prototype.writeGeometry = function (geometry, opt_options) {
        var node = this.writeGeometryNode(geometry, opt_options);
        return this.xmlSerializer_.serializeToString(node);
    };
    /**
     * @param {import("../geom/Geometry.js").default} geometry Geometry.
     * @param {import("./Feature.js").WriteOptions=} opt_options Options.
     * @return {Node} Node.
     */
    XMLFeature.prototype.writeGeometryNode = function (geometry, opt_options) {
        return null; // not implemented
    };
    return XMLFeature;
}(_format_Feature_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (XMLFeature);
//# sourceMappingURL=XMLFeature.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter.js":
/*!******************************************!*\
  !*** ./node_modules/ol/format/filter.js ***!
  \******************************************/
/*! exports provided: and, or, not, bbox, contains, intersects, within, equalTo, notEqualTo, lessThan, lessThanOrEqualTo, greaterThan, greaterThanOrEqualTo, isNull, between, like, during */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "and", function() { return and; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "or", function() { return or; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "not", function() { return not; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bbox", function() { return bbox; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return contains; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersects", function() { return intersects; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "within", function() { return within; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equalTo", function() { return equalTo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "notEqualTo", function() { return notEqualTo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lessThan", function() { return lessThan; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lessThanOrEqualTo", function() { return lessThanOrEqualTo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "greaterThan", function() { return greaterThan; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "greaterThanOrEqualTo", function() { return greaterThanOrEqualTo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return isNull; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "between", function() { return between; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "like", function() { return like; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "during", function() { return during; });
/* harmony import */ var _filter_And_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filter/And.js */ "./node_modules/ol/format/filter/And.js");
/* harmony import */ var _filter_Bbox_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter/Bbox.js */ "./node_modules/ol/format/filter/Bbox.js");
/* harmony import */ var _filter_Contains_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filter/Contains.js */ "./node_modules/ol/format/filter/Contains.js");
/* harmony import */ var _filter_During_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./filter/During.js */ "./node_modules/ol/format/filter/During.js");
/* harmony import */ var _filter_EqualTo_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./filter/EqualTo.js */ "./node_modules/ol/format/filter/EqualTo.js");
/* harmony import */ var _filter_GreaterThan_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./filter/GreaterThan.js */ "./node_modules/ol/format/filter/GreaterThan.js");
/* harmony import */ var _filter_GreaterThanOrEqualTo_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./filter/GreaterThanOrEqualTo.js */ "./node_modules/ol/format/filter/GreaterThanOrEqualTo.js");
/* harmony import */ var _filter_Intersects_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./filter/Intersects.js */ "./node_modules/ol/format/filter/Intersects.js");
/* harmony import */ var _filter_IsBetween_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./filter/IsBetween.js */ "./node_modules/ol/format/filter/IsBetween.js");
/* harmony import */ var _filter_IsLike_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./filter/IsLike.js */ "./node_modules/ol/format/filter/IsLike.js");
/* harmony import */ var _filter_IsNull_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./filter/IsNull.js */ "./node_modules/ol/format/filter/IsNull.js");
/* harmony import */ var _filter_LessThan_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./filter/LessThan.js */ "./node_modules/ol/format/filter/LessThan.js");
/* harmony import */ var _filter_LessThanOrEqualTo_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./filter/LessThanOrEqualTo.js */ "./node_modules/ol/format/filter/LessThanOrEqualTo.js");
/* harmony import */ var _filter_Not_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./filter/Not.js */ "./node_modules/ol/format/filter/Not.js");
/* harmony import */ var _filter_NotEqualTo_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./filter/NotEqualTo.js */ "./node_modules/ol/format/filter/NotEqualTo.js");
/* harmony import */ var _filter_Or_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./filter/Or.js */ "./node_modules/ol/format/filter/Or.js");
/* harmony import */ var _filter_Within_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./filter/Within.js */ "./node_modules/ol/format/filter/Within.js");
/**
 * @module ol/format/filter
 */

















/**
 * Create a logical `<And>` operator between two or more filter conditions.
 *
 * @param {...import("./filter/Filter.js").default} conditions Filter conditions.
 * @returns {!And} `<And>` operator.
 * @api
 */
function and(conditions) {
    var params = [null].concat(Array.prototype.slice.call(arguments));
    return new (Function.prototype.bind.apply(_filter_And_js__WEBPACK_IMPORTED_MODULE_0__["default"], params));
}
/**
 * Create a logical `<Or>` operator between two or more filter conditions.
 *
 * @param {...import("./filter/Filter.js").default} conditions Filter conditions.
 * @returns {!Or} `<Or>` operator.
 * @api
 */
function or(conditions) {
    var params = [null].concat(Array.prototype.slice.call(arguments));
    return new (Function.prototype.bind.apply(_filter_Or_js__WEBPACK_IMPORTED_MODULE_15__["default"], params));
}
/**
 * Represents a logical `<Not>` operator for a filter condition.
 *
 * @param {!import("./filter/Filter.js").default} condition Filter condition.
 * @returns {!Not} `<Not>` operator.
 * @api
 */
function not(condition) {
    return new _filter_Not_js__WEBPACK_IMPORTED_MODULE_13__["default"](condition);
}
/**
 * Create a `<BBOX>` operator to test whether a geometry-valued property
 * intersects a fixed bounding box
 *
 * @param {!string} geometryName Geometry name to use.
 * @param {!import("../extent.js").Extent} extent Extent.
 * @param {string=} opt_srsName SRS name. No srsName attribute will be
 *    set on geometries when this is not provided.
 * @returns {!Bbox} `<BBOX>` operator.
 * @api
 */
function bbox(geometryName, extent, opt_srsName) {
    return new _filter_Bbox_js__WEBPACK_IMPORTED_MODULE_1__["default"](geometryName, extent, opt_srsName);
}
/**
 * Create a `<Contains>` operator to test whether a geometry-valued property
 * contains a given geometry.
 *
 * @param {!string} geometryName Geometry name to use.
 * @param {!import("../geom/Geometry.js").default} geometry Geometry.
 * @param {string=} opt_srsName SRS name. No srsName attribute will be
 *    set on geometries when this is not provided.
 * @returns {!Contains} `<Contains>` operator.
 * @api
 */
function contains(geometryName, geometry, opt_srsName) {
    return new _filter_Contains_js__WEBPACK_IMPORTED_MODULE_2__["default"](geometryName, geometry, opt_srsName);
}
/**
 * Create a `<Intersects>` operator to test whether a geometry-valued property
 * intersects a given geometry.
 *
 * @param {!string} geometryName Geometry name to use.
 * @param {!import("../geom/Geometry.js").default} geometry Geometry.
 * @param {string=} opt_srsName SRS name. No srsName attribute will be
 *    set on geometries when this is not provided.
 * @returns {!Intersects} `<Intersects>` operator.
 * @api
 */
function intersects(geometryName, geometry, opt_srsName) {
    return new _filter_Intersects_js__WEBPACK_IMPORTED_MODULE_7__["default"](geometryName, geometry, opt_srsName);
}
/**
 * Create a `<Within>` operator to test whether a geometry-valued property
 * is within a given geometry.
 *
 * @param {!string} geometryName Geometry name to use.
 * @param {!import("../geom/Geometry.js").default} geometry Geometry.
 * @param {string=} opt_srsName SRS name. No srsName attribute will be
 *    set on geometries when this is not provided.
 * @returns {!Within} `<Within>` operator.
 * @api
 */
function within(geometryName, geometry, opt_srsName) {
    return new _filter_Within_js__WEBPACK_IMPORTED_MODULE_16__["default"](geometryName, geometry, opt_srsName);
}
/**
 * Creates a `<PropertyIsEqualTo>` comparison operator.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!(string|number)} expression The value to compare.
 * @param {boolean=} opt_matchCase Case-sensitive?
 * @returns {!EqualTo} `<PropertyIsEqualTo>` operator.
 * @api
 */
function equalTo(propertyName, expression, opt_matchCase) {
    return new _filter_EqualTo_js__WEBPACK_IMPORTED_MODULE_4__["default"](propertyName, expression, opt_matchCase);
}
/**
 * Creates a `<PropertyIsNotEqualTo>` comparison operator.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!(string|number)} expression The value to compare.
 * @param {boolean=} opt_matchCase Case-sensitive?
 * @returns {!NotEqualTo} `<PropertyIsNotEqualTo>` operator.
 * @api
 */
function notEqualTo(propertyName, expression, opt_matchCase) {
    return new _filter_NotEqualTo_js__WEBPACK_IMPORTED_MODULE_14__["default"](propertyName, expression, opt_matchCase);
}
/**
 * Creates a `<PropertyIsLessThan>` comparison operator.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!number} expression The value to compare.
 * @returns {!LessThan} `<PropertyIsLessThan>` operator.
 * @api
 */
function lessThan(propertyName, expression) {
    return new _filter_LessThan_js__WEBPACK_IMPORTED_MODULE_11__["default"](propertyName, expression);
}
/**
 * Creates a `<PropertyIsLessThanOrEqualTo>` comparison operator.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!number} expression The value to compare.
 * @returns {!LessThanOrEqualTo} `<PropertyIsLessThanOrEqualTo>` operator.
 * @api
 */
function lessThanOrEqualTo(propertyName, expression) {
    return new _filter_LessThanOrEqualTo_js__WEBPACK_IMPORTED_MODULE_12__["default"](propertyName, expression);
}
/**
 * Creates a `<PropertyIsGreaterThan>` comparison operator.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!number} expression The value to compare.
 * @returns {!GreaterThan} `<PropertyIsGreaterThan>` operator.
 * @api
 */
function greaterThan(propertyName, expression) {
    return new _filter_GreaterThan_js__WEBPACK_IMPORTED_MODULE_5__["default"](propertyName, expression);
}
/**
 * Creates a `<PropertyIsGreaterThanOrEqualTo>` comparison operator.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!number} expression The value to compare.
 * @returns {!GreaterThanOrEqualTo} `<PropertyIsGreaterThanOrEqualTo>` operator.
 * @api
 */
function greaterThanOrEqualTo(propertyName, expression) {
    return new _filter_GreaterThanOrEqualTo_js__WEBPACK_IMPORTED_MODULE_6__["default"](propertyName, expression);
}
/**
 * Creates a `<PropertyIsNull>` comparison operator to test whether a property value
 * is null.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @returns {!IsNull} `<PropertyIsNull>` operator.
 * @api
 */
function isNull(propertyName) {
    return new _filter_IsNull_js__WEBPACK_IMPORTED_MODULE_10__["default"](propertyName);
}
/**
 * Creates a `<PropertyIsBetween>` comparison operator to test whether an expression
 * value lies within a range given by a lower and upper bound (inclusive).
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!number} lowerBoundary The lower bound of the range.
 * @param {!number} upperBoundary The upper bound of the range.
 * @returns {!IsBetween} `<PropertyIsBetween>` operator.
 * @api
 */
function between(propertyName, lowerBoundary, upperBoundary) {
    return new _filter_IsBetween_js__WEBPACK_IMPORTED_MODULE_8__["default"](propertyName, lowerBoundary, upperBoundary);
}
/**
 * Represents a `<PropertyIsLike>` comparison operator that matches a string property
 * value against a text pattern.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!string} pattern Text pattern.
 * @param {string=} opt_wildCard Pattern character which matches any sequence of
 *    zero or more string characters. Default is '*'.
 * @param {string=} opt_singleChar pattern character which matches any single
 *    string character. Default is '.'.
 * @param {string=} opt_escapeChar Escape character which can be used to escape
 *    the pattern characters. Default is '!'.
 * @param {boolean=} opt_matchCase Case-sensitive?
 * @returns {!IsLike} `<PropertyIsLike>` operator.
 * @api
 */
function like(propertyName, pattern, opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
    return new _filter_IsLike_js__WEBPACK_IMPORTED_MODULE_9__["default"](propertyName, pattern, opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
}
/**
 * Create a `<During>` temporal operator.
 *
 * @param {!string} propertyName Name of the context property to compare.
 * @param {!string} begin The begin date in ISO-8601 format.
 * @param {!string} end The end date in ISO-8601 format.
 * @returns {!During} `<During>` operator.
 * @api
 */
function during(propertyName, begin, end) {
    return new _filter_During_js__WEBPACK_IMPORTED_MODULE_3__["default"](propertyName, begin, end);
}
//# sourceMappingURL=filter.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/And.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/format/filter/And.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _LogicalNary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LogicalNary.js */ "./node_modules/ol/format/filter/LogicalNary.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/And
 */

/**
 * @classdesc
 * Represents a logical `<And>` operator between two or more filter conditions.
 *
 * @abstract
 */
var And = /** @class */ (function (_super) {
    __extends(And, _super);
    /**
     * @param {...import("./Filter.js").default} conditions Conditions.
     */
    function And(conditions) {
        return _super.call(this, 'And', Array.prototype.slice.call(arguments)) || this;
    }
    return And;
}(_LogicalNary_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (And);
//# sourceMappingURL=And.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Bbox.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/format/filter/Bbox.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Filter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Filter.js */ "./node_modules/ol/format/filter/Filter.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/Bbox
 */

/**
 * @classdesc
 * Represents a `<BBOX>` operator to test whether a geometry-valued property
 * intersects a fixed bounding box
 *
 * @api
 */
var Bbox = /** @class */ (function (_super) {
    __extends(Bbox, _super);
    /**
     * @param {!string} geometryName Geometry name to use.
     * @param {!import("../../extent.js").Extent} extent Extent.
     * @param {string=} opt_srsName SRS name. No srsName attribute will be set
     * on geometries when this is not provided.
     */
    function Bbox(geometryName, extent, opt_srsName) {
        var _this = _super.call(this, 'BBOX') || this;
        /**
         * @type {!string}
         */
        _this.geometryName = geometryName;
        /**
         * @type {import("../../extent.js").Extent}
         */
        _this.extent = extent;
        if (extent.length !== 4) {
            throw new Error('Expected an extent with four values ([minX, minY, maxX, maxY])');
        }
        /**
         * @type {string|undefined}
         */
        _this.srsName = opt_srsName;
        return _this;
    }
    return Bbox;
}(_Filter_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Bbox);
//# sourceMappingURL=Bbox.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Comparison.js":
/*!*****************************************************!*\
  !*** ./node_modules/ol/format/filter/Comparison.js ***!
  \*****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Filter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Filter.js */ "./node_modules/ol/format/filter/Filter.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/Comparison
 */

/**
 * @classdesc
 * Abstract class; normally only used for creating subclasses and not instantiated in apps.
 * Base class for WFS GetFeature property comparison filters.
 *
 * @abstract
 */
var Comparison = /** @class */ (function (_super) {
    __extends(Comparison, _super);
    /**
     * @param {!string} tagName The XML tag name for this filter.
     * @param {!string} propertyName Name of the context property to compare.
     */
    function Comparison(tagName, propertyName) {
        var _this = _super.call(this, tagName) || this;
        /**
         * @type {!string}
         */
        _this.propertyName = propertyName;
        return _this;
    }
    return Comparison;
}(_Filter_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Comparison);
//# sourceMappingURL=Comparison.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/ComparisonBinary.js":
/*!***********************************************************!*\
  !*** ./node_modules/ol/format/filter/ComparisonBinary.js ***!
  \***********************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Comparison_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Comparison.js */ "./node_modules/ol/format/filter/Comparison.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/ComparisonBinary
 */

/**
 * @classdesc
 * Abstract class; normally only used for creating subclasses and not instantiated in apps.
 * Base class for WFS GetFeature property binary comparison filters.
 *
 * @abstract
 */
var ComparisonBinary = /** @class */ (function (_super) {
    __extends(ComparisonBinary, _super);
    /**
     * @param {!string} tagName The XML tag name for this filter.
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!(string|number)} expression The value to compare.
     * @param {boolean=} opt_matchCase Case-sensitive?
     */
    function ComparisonBinary(tagName, propertyName, expression, opt_matchCase) {
        var _this = _super.call(this, tagName, propertyName) || this;
        /**
         * @type {!(string|number)}
         */
        _this.expression = expression;
        /**
         * @type {boolean|undefined}
         */
        _this.matchCase = opt_matchCase;
        return _this;
    }
    return ComparisonBinary;
}(_Comparison_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ComparisonBinary);
//# sourceMappingURL=ComparisonBinary.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Contains.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/format/filter/Contains.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Spatial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Spatial.js */ "./node_modules/ol/format/filter/Spatial.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/Contains
 */

/**
 * @classdesc
 * Represents a `<Contains>` operator to test whether a geometry-valued property
 * contains a given geometry.
 * @api
 */
var Contains = /** @class */ (function (_super) {
    __extends(Contains, _super);
    /**
     * @param {!string} geometryName Geometry name to use.
     * @param {!import("../../geom/Geometry.js").default} geometry Geometry.
     * @param {string=} opt_srsName SRS name. No srsName attribute will be
     *    set on geometries when this is not provided.
     */
    function Contains(geometryName, geometry, opt_srsName) {
        return _super.call(this, 'Contains', geometryName, geometry, opt_srsName) || this;
    }
    return Contains;
}(_Spatial_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Contains);
//# sourceMappingURL=Contains.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/During.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/format/filter/During.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Comparison_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Comparison.js */ "./node_modules/ol/format/filter/Comparison.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/During
 */

/**
 * @classdesc
 * Represents a `<During>` comparison operator.
 * @api
 */
var During = /** @class */ (function (_super) {
    __extends(During, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!string} begin The begin date in ISO-8601 format.
     * @param {!string} end The end date in ISO-8601 format.
     */
    function During(propertyName, begin, end) {
        var _this = _super.call(this, 'During', propertyName) || this;
        /**
         * @type {!string}
         */
        _this.begin = begin;
        /**
         * @type {!string}
         */
        _this.end = end;
        return _this;
    }
    return During;
}(_Comparison_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (During);
//# sourceMappingURL=During.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/EqualTo.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/format/filter/EqualTo.js ***!
  \**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ComparisonBinary.js */ "./node_modules/ol/format/filter/ComparisonBinary.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/EqualTo
 */

/**
 * @classdesc
 * Represents a `<PropertyIsEqualTo>` comparison operator.
 * @api
 */
var EqualTo = /** @class */ (function (_super) {
    __extends(EqualTo, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!(string|number)} expression The value to compare.
     * @param {boolean=} opt_matchCase Case-sensitive?
     */
    function EqualTo(propertyName, expression, opt_matchCase) {
        return _super.call(this, 'PropertyIsEqualTo', propertyName, expression, opt_matchCase) || this;
    }
    return EqualTo;
}(_ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (EqualTo);
//# sourceMappingURL=EqualTo.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Filter.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/format/filter/Filter.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/format/filter/Filter
 */
/**
 * @classdesc
 * Abstract class; normally only used for creating subclasses and not instantiated in apps.
 * Base class for WFS GetFeature filters.
 *
 * @abstract
 */
var Filter = /** @class */ (function () {
    /**
     * @param {!string} tagName The XML tag name for this filter.
     */
    function Filter(tagName) {
        /**
         * @private
         * @type {!string}
         */
        this.tagName_ = tagName;
    }
    /**
     * The XML tag name for a filter.
     * @returns {!string} Name.
     */
    Filter.prototype.getTagName = function () {
        return this.tagName_;
    };
    return Filter;
}());
/* harmony default export */ __webpack_exports__["default"] = (Filter);
//# sourceMappingURL=Filter.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/GreaterThan.js":
/*!******************************************************!*\
  !*** ./node_modules/ol/format/filter/GreaterThan.js ***!
  \******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ComparisonBinary.js */ "./node_modules/ol/format/filter/ComparisonBinary.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/GreaterThan
 */

/**
 * @classdesc
 * Represents a `<PropertyIsGreaterThan>` comparison operator.
 * @api
 */
var GreaterThan = /** @class */ (function (_super) {
    __extends(GreaterThan, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!number} expression The value to compare.
     */
    function GreaterThan(propertyName, expression) {
        return _super.call(this, 'PropertyIsGreaterThan', propertyName, expression) || this;
    }
    return GreaterThan;
}(_ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (GreaterThan);
//# sourceMappingURL=GreaterThan.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/GreaterThanOrEqualTo.js":
/*!***************************************************************!*\
  !*** ./node_modules/ol/format/filter/GreaterThanOrEqualTo.js ***!
  \***************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ComparisonBinary.js */ "./node_modules/ol/format/filter/ComparisonBinary.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/GreaterThanOrEqualTo
 */

/**
 * @classdesc
 * Represents a `<PropertyIsGreaterThanOrEqualTo>` comparison operator.
 * @api
 */
var GreaterThanOrEqualTo = /** @class */ (function (_super) {
    __extends(GreaterThanOrEqualTo, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!number} expression The value to compare.
     */
    function GreaterThanOrEqualTo(propertyName, expression) {
        return _super.call(this, 'PropertyIsGreaterThanOrEqualTo', propertyName, expression) || this;
    }
    return GreaterThanOrEqualTo;
}(_ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (GreaterThanOrEqualTo);
//# sourceMappingURL=GreaterThanOrEqualTo.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Intersects.js":
/*!*****************************************************!*\
  !*** ./node_modules/ol/format/filter/Intersects.js ***!
  \*****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Spatial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Spatial.js */ "./node_modules/ol/format/filter/Spatial.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/Intersects
 */

/**
 * @classdesc
 * Represents a `<Intersects>` operator to test whether a geometry-valued property
 * intersects a given geometry.
 * @api
 */
var Intersects = /** @class */ (function (_super) {
    __extends(Intersects, _super);
    /**
     * @param {!string} geometryName Geometry name to use.
     * @param {!import("../../geom/Geometry.js").default} geometry Geometry.
     * @param {string=} opt_srsName SRS name. No srsName attribute will be
     *    set on geometries when this is not provided.
     */
    function Intersects(geometryName, geometry, opt_srsName) {
        return _super.call(this, 'Intersects', geometryName, geometry, opt_srsName) || this;
    }
    return Intersects;
}(_Spatial_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Intersects);
//# sourceMappingURL=Intersects.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/IsBetween.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/format/filter/IsBetween.js ***!
  \****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Comparison_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Comparison.js */ "./node_modules/ol/format/filter/Comparison.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/IsBetween
 */

/**
 * @classdesc
 * Represents a `<PropertyIsBetween>` comparison operator.
 * @api
 */
var IsBetween = /** @class */ (function (_super) {
    __extends(IsBetween, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!number} lowerBoundary The lower bound of the range.
     * @param {!number} upperBoundary The upper bound of the range.
     */
    function IsBetween(propertyName, lowerBoundary, upperBoundary) {
        var _this = _super.call(this, 'PropertyIsBetween', propertyName) || this;
        /**
         * @type {!number}
         */
        _this.lowerBoundary = lowerBoundary;
        /**
         * @type {!number}
         */
        _this.upperBoundary = upperBoundary;
        return _this;
    }
    return IsBetween;
}(_Comparison_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (IsBetween);
//# sourceMappingURL=IsBetween.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/IsLike.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/format/filter/IsLike.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Comparison_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Comparison.js */ "./node_modules/ol/format/filter/Comparison.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/IsLike
 */

/**
 * @classdesc
 * Represents a `<PropertyIsLike>` comparison operator.
 * @api
 */
var IsLike = /** @class */ (function (_super) {
    __extends(IsLike, _super);
    /**
     * [constructor description]
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!string} pattern Text pattern.
     * @param {string=} opt_wildCard Pattern character which matches any sequence of
     *    zero or more string characters. Default is '*'.
     * @param {string=} opt_singleChar pattern character which matches any single
     *    string character. Default is '.'.
     * @param {string=} opt_escapeChar Escape character which can be used to escape
     *    the pattern characters. Default is '!'.
     * @param {boolean=} opt_matchCase Case-sensitive?
     */
    function IsLike(propertyName, pattern, opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
        var _this = _super.call(this, 'PropertyIsLike', propertyName) || this;
        /**
         * @type {!string}
         */
        _this.pattern = pattern;
        /**
         * @type {!string}
         */
        _this.wildCard = (opt_wildCard !== undefined) ? opt_wildCard : '*';
        /**
         * @type {!string}
         */
        _this.singleChar = (opt_singleChar !== undefined) ? opt_singleChar : '.';
        /**
         * @type {!string}
         */
        _this.escapeChar = (opt_escapeChar !== undefined) ? opt_escapeChar : '!';
        /**
         * @type {boolean|undefined}
         */
        _this.matchCase = opt_matchCase;
        return _this;
    }
    return IsLike;
}(_Comparison_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (IsLike);
//# sourceMappingURL=IsLike.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/IsNull.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/format/filter/IsNull.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Comparison_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Comparison.js */ "./node_modules/ol/format/filter/Comparison.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/IsNull
 */

/**
 * @classdesc
 * Represents a `<PropertyIsNull>` comparison operator.
 * @api
 */
var IsNull = /** @class */ (function (_super) {
    __extends(IsNull, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     */
    function IsNull(propertyName) {
        return _super.call(this, 'PropertyIsNull', propertyName) || this;
    }
    return IsNull;
}(_Comparison_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (IsNull);
//# sourceMappingURL=IsNull.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/LessThan.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/format/filter/LessThan.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ComparisonBinary.js */ "./node_modules/ol/format/filter/ComparisonBinary.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/LessThan
 */

/**
 * @classdesc
 * Represents a `<PropertyIsLessThan>` comparison operator.
 * @api
 */
var LessThan = /** @class */ (function (_super) {
    __extends(LessThan, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!number} expression The value to compare.
     */
    function LessThan(propertyName, expression) {
        return _super.call(this, 'PropertyIsLessThan', propertyName, expression) || this;
    }
    return LessThan;
}(_ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (LessThan);
//# sourceMappingURL=LessThan.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/LessThanOrEqualTo.js":
/*!************************************************************!*\
  !*** ./node_modules/ol/format/filter/LessThanOrEqualTo.js ***!
  \************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ComparisonBinary.js */ "./node_modules/ol/format/filter/ComparisonBinary.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/LessThanOrEqualTo
 */

/**
 * @classdesc
 * Represents a `<PropertyIsLessThanOrEqualTo>` comparison operator.
 * @api
 */
var LessThanOrEqualTo = /** @class */ (function (_super) {
    __extends(LessThanOrEqualTo, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!number} expression The value to compare.
     */
    function LessThanOrEqualTo(propertyName, expression) {
        return _super.call(this, 'PropertyIsLessThanOrEqualTo', propertyName, expression) || this;
    }
    return LessThanOrEqualTo;
}(_ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (LessThanOrEqualTo);
//# sourceMappingURL=LessThanOrEqualTo.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/LogicalNary.js":
/*!******************************************************!*\
  !*** ./node_modules/ol/format/filter/LogicalNary.js ***!
  \******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _Filter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Filter.js */ "./node_modules/ol/format/filter/Filter.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/LogicalNary
 */


/**
 * @classdesc
 * Abstract class; normally only used for creating subclasses and not instantiated in apps.
 * Base class for WFS GetFeature n-ary logical filters.
 *
 * @abstract
 */
var LogicalNary = /** @class */ (function (_super) {
    __extends(LogicalNary, _super);
    /**
     * @param {!string} tagName The XML tag name for this filter.
     * @param {Array<import("./Filter.js").default>} conditions Conditions.
     */
    function LogicalNary(tagName, conditions) {
        var _this = _super.call(this, tagName) || this;
        /**
         * @type {Array<import("./Filter.js").default>}
         */
        _this.conditions = conditions;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(_this.conditions.length >= 2, 57); // At least 2 conditions are required.
        return _this;
    }
    return LogicalNary;
}(_Filter_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (LogicalNary);
//# sourceMappingURL=LogicalNary.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Not.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/format/filter/Not.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Filter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Filter.js */ "./node_modules/ol/format/filter/Filter.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/Not
 */

/**
 * @classdesc
 * Represents a logical `<Not>` operator for a filter condition.
 * @api
 */
var Not = /** @class */ (function (_super) {
    __extends(Not, _super);
    /**
     * @param {!import("./Filter.js").default} condition Filter condition.
     */
    function Not(condition) {
        var _this = _super.call(this, 'Not') || this;
        /**
         * @type {!import("./Filter.js").default}
         */
        _this.condition = condition;
        return _this;
    }
    return Not;
}(_Filter_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Not);
//# sourceMappingURL=Not.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/NotEqualTo.js":
/*!*****************************************************!*\
  !*** ./node_modules/ol/format/filter/NotEqualTo.js ***!
  \*****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ComparisonBinary.js */ "./node_modules/ol/format/filter/ComparisonBinary.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/NotEqualTo
 */

/**
 * @classdesc
 * Represents a `<PropertyIsNotEqualTo>` comparison operator.
 * @api
 */
var NotEqualTo = /** @class */ (function (_super) {
    __extends(NotEqualTo, _super);
    /**
     * @param {!string} propertyName Name of the context property to compare.
     * @param {!(string|number)} expression The value to compare.
     * @param {boolean=} opt_matchCase Case-sensitive?
     */
    function NotEqualTo(propertyName, expression, opt_matchCase) {
        return _super.call(this, 'PropertyIsNotEqualTo', propertyName, expression, opt_matchCase) || this;
    }
    return NotEqualTo;
}(_ComparisonBinary_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (NotEqualTo);
//# sourceMappingURL=NotEqualTo.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Or.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/format/filter/Or.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _LogicalNary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LogicalNary.js */ "./node_modules/ol/format/filter/LogicalNary.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/Or
 */

/**
 * @classdesc
 * Represents a logical `<Or>` operator between two ore more filter conditions.
 * @api
 */
var Or = /** @class */ (function (_super) {
    __extends(Or, _super);
    /**
     * @param {...import("./Filter.js").default} conditions Conditions.
     */
    function Or(conditions) {
        return _super.call(this, 'Or', Array.prototype.slice.call(arguments)) || this;
    }
    return Or;
}(_LogicalNary_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Or);
//# sourceMappingURL=Or.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Spatial.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/format/filter/Spatial.js ***!
  \**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Filter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Filter.js */ "./node_modules/ol/format/filter/Filter.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/Spatial
 */

/**
 * @classdesc
 * Abstract class; normally only used for creating subclasses and not instantiated in apps.
 * Represents a spatial operator to test whether a geometry-valued property
 * relates to a given geometry.
 *
 * @abstract
 */
var Spatial = /** @class */ (function (_super) {
    __extends(Spatial, _super);
    /**
     * @param {!string} tagName The XML tag name for this filter.
     * @param {!string} geometryName Geometry name to use.
     * @param {!import("../../geom/Geometry.js").default} geometry Geometry.
     * @param {string=} opt_srsName SRS name. No srsName attribute will be
     *    set on geometries when this is not provided.
     */
    function Spatial(tagName, geometryName, geometry, opt_srsName) {
        var _this = _super.call(this, tagName) || this;
        /**
         * @type {!string}
         */
        _this.geometryName = geometryName || 'the_geom';
        /**
         * @type {import("../../geom/Geometry.js").default}
         */
        _this.geometry = geometry;
        /**
         * @type {string|undefined}
         */
        _this.srsName = opt_srsName;
        return _this;
    }
    return Spatial;
}(_Filter_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Spatial);
//# sourceMappingURL=Spatial.js.map

/***/ }),

/***/ "./node_modules/ol/format/filter/Within.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/format/filter/Within.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Spatial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Spatial.js */ "./node_modules/ol/format/filter/Spatial.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/format/filter/Within
 */

/**
 * @classdesc
 * Represents a `<Within>` operator to test whether a geometry-valued property
 * is within a given geometry.
 * @api
 */
var Within = /** @class */ (function (_super) {
    __extends(Within, _super);
    /**
     * @param {!string} geometryName Geometry name to use.
     * @param {!import("../../geom/Geometry.js").default} geometry Geometry.
     * @param {string=} opt_srsName SRS name. No srsName attribute will be
     *    set on geometries when this is not provided.
     */
    function Within(geometryName, geometry, opt_srsName) {
        return _super.call(this, 'Within', geometryName, geometry, opt_srsName) || this;
    }
    return Within;
}(_Spatial_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Within);
//# sourceMappingURL=Within.js.map

/***/ }),

/***/ "./node_modules/ol/format/xsd.js":
/*!***************************************!*\
  !*** ./node_modules/ol/format/xsd.js ***!
  \***************************************/
/*! exports provided: readBoolean, readBooleanString, readDateTime, readDecimal, readDecimalString, readNonNegativeInteger, readNonNegativeIntegerString, readString, writeBooleanTextNode, writeCDATASection, writeDateTimeTextNode, writeDecimalTextNode, writeNonNegativeIntegerTextNode, writeStringTextNode */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readBoolean", function() { return readBoolean; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readBooleanString", function() { return readBooleanString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readDateTime", function() { return readDateTime; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readDecimal", function() { return readDecimal; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readDecimalString", function() { return readDecimalString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readNonNegativeInteger", function() { return readNonNegativeInteger; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readNonNegativeIntegerString", function() { return readNonNegativeIntegerString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readString", function() { return readString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writeBooleanTextNode", function() { return writeBooleanTextNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writeCDATASection", function() { return writeCDATASection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writeDateTimeTextNode", function() { return writeDateTimeTextNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writeDecimalTextNode", function() { return writeDecimalTextNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writeNonNegativeIntegerTextNode", function() { return writeNonNegativeIntegerTextNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writeStringTextNode", function() { return writeStringTextNode; });
/* harmony import */ var _xml_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../xml.js */ "./node_modules/ol/xml.js");
/* harmony import */ var _string_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../string.js */ "./node_modules/ol/string.js");
/**
 * @module ol/format/xsd
 */


/**
 * @param {Node} node Node.
 * @return {boolean|undefined} Boolean.
 */
function readBoolean(node) {
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getAllTextContent"])(node, false);
    return readBooleanString(s);
}
/**
 * @param {string} string String.
 * @return {boolean|undefined} Boolean.
 */
function readBooleanString(string) {
    var m = /^\s*(true|1)|(false|0)\s*$/.exec(string);
    if (m) {
        return m[1] !== undefined || false;
    }
    else {
        return undefined;
    }
}
/**
 * @param {Node} node Node.
 * @return {number|undefined} DateTime in seconds.
 */
function readDateTime(node) {
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getAllTextContent"])(node, false);
    var dateTime = Date.parse(s);
    return isNaN(dateTime) ? undefined : dateTime / 1000;
}
/**
 * @param {Node} node Node.
 * @return {number|undefined} Decimal.
 */
function readDecimal(node) {
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getAllTextContent"])(node, false);
    return readDecimalString(s);
}
/**
 * @param {string} string String.
 * @return {number|undefined} Decimal.
 */
function readDecimalString(string) {
    // FIXME check spec
    var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string);
    if (m) {
        return parseFloat(m[1]);
    }
    else {
        return undefined;
    }
}
/**
 * @param {Node} node Node.
 * @return {number|undefined} Non negative integer.
 */
function readNonNegativeInteger(node) {
    var s = Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getAllTextContent"])(node, false);
    return readNonNegativeIntegerString(s);
}
/**
 * @param {string} string String.
 * @return {number|undefined} Non negative integer.
 */
function readNonNegativeIntegerString(string) {
    var m = /^\s*(\d+)\s*$/.exec(string);
    if (m) {
        return parseInt(m[1], 10);
    }
    else {
        return undefined;
    }
}
/**
 * @param {Node} node Node.
 * @return {string|undefined} String.
 */
function readString(node) {
    return Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getAllTextContent"])(node, false).trim();
}
/**
 * @param {Node} node Node to append a TextNode with the boolean to.
 * @param {boolean} bool Boolean.
 */
function writeBooleanTextNode(node, bool) {
    writeStringTextNode(node, (bool) ? '1' : '0');
}
/**
 * @param {Node} node Node to append a CDATA Section with the string to.
 * @param {string} string String.
 */
function writeCDATASection(node, string) {
    node.appendChild(Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getDocument"])().createCDATASection(string));
}
/**
 * @param {Node} node Node to append a TextNode with the dateTime to.
 * @param {number} dateTime DateTime in seconds.
 */
function writeDateTimeTextNode(node, dateTime) {
    var date = new Date(dateTime * 1000);
    var string = date.getUTCFullYear() + '-' +
        Object(_string_js__WEBPACK_IMPORTED_MODULE_1__["padNumber"])(date.getUTCMonth() + 1, 2) + '-' +
        Object(_string_js__WEBPACK_IMPORTED_MODULE_1__["padNumber"])(date.getUTCDate(), 2) + 'T' +
        Object(_string_js__WEBPACK_IMPORTED_MODULE_1__["padNumber"])(date.getUTCHours(), 2) + ':' +
        Object(_string_js__WEBPACK_IMPORTED_MODULE_1__["padNumber"])(date.getUTCMinutes(), 2) + ':' +
        Object(_string_js__WEBPACK_IMPORTED_MODULE_1__["padNumber"])(date.getUTCSeconds(), 2) + 'Z';
    node.appendChild(Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getDocument"])().createTextNode(string));
}
/**
 * @param {Node} node Node to append a TextNode with the decimal to.
 * @param {number} decimal Decimal.
 */
function writeDecimalTextNode(node, decimal) {
    var string = decimal.toPrecision();
    node.appendChild(Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getDocument"])().createTextNode(string));
}
/**
 * @param {Node} node Node to append a TextNode with the decimal to.
 * @param {number} nonNegativeInteger Non negative integer.
 */
function writeNonNegativeIntegerTextNode(node, nonNegativeInteger) {
    var string = nonNegativeInteger.toString();
    node.appendChild(Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getDocument"])().createTextNode(string));
}
/**
 * @param {Node} node Node to append a TextNode with the string to.
 * @param {string} string String.
 */
function writeStringTextNode(node, string) {
    node.appendChild(Object(_xml_js__WEBPACK_IMPORTED_MODULE_0__["getDocument"])().createTextNode(string));
}
//# sourceMappingURL=xsd.js.map

/***/ }),

/***/ "./node_modules/ol/functions.js":
/*!**************************************!*\
  !*** ./node_modules/ol/functions.js ***!
  \**************************************/
/*! exports provided: TRUE, FALSE, VOID, memoizeOne */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRUE", function() { return TRUE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FALSE", function() { return FALSE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VOID", function() { return VOID; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "memoizeOne", function() { return memoizeOne; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./array.js */ "./node_modules/ol/array.js");
/**
 * @module ol/functions
 */

/**
 * Always returns true.
 * @returns {boolean} true.
 */
function TRUE() {
    return true;
}
/**
 * Always returns false.
 * @returns {boolean} false.
 */
function FALSE() {
    return false;
}
/**
 * A reusable function, used e.g. as a default for callbacks.
 *
 * @return {void} Nothing.
 */
function VOID() { }
/**
 * Wrap a function in another function that remembers the last return.  If the
 * returned function is called twice in a row with the same arguments and the same
 * this object, it will return the value from the first call in the second call.
 *
 * @param {function(...any): ReturnType} fn The function to memoize.
 * @return {function(...any): ReturnType} The memoized function.
 * @template ReturnType
 */
function memoizeOne(fn) {
    var called = false;
    /** @type {ReturnType} */
    var lastResult;
    /** @type {Array<any>} */
    var lastArgs;
    var lastThis;
    return function () {
        var nextArgs = Array.prototype.slice.call(arguments);
        if (!called || this !== lastThis || !Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["equals"])(nextArgs, lastArgs)) {
            called = true;
            lastThis = this;
            lastArgs = nextArgs;
            lastResult = fn.apply(this, arguments);
        }
        return lastResult;
    };
}
//# sourceMappingURL=functions.js.map

/***/ }),

/***/ "./node_modules/ol/geom.js":
/*!*********************************!*\
  !*** ./node_modules/ol/geom.js ***!
  \*********************************/
/*! exports provided: Circle, Geometry, GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, LinearRing */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _geom_Circle_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./geom/Circle.js */ "./node_modules/ol/geom/Circle.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Circle", function() { return _geom_Circle_js__WEBPACK_IMPORTED_MODULE_0__["default"]; });

/* harmony import */ var _geom_Geometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./geom/Geometry.js */ "./node_modules/ol/geom/Geometry.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Geometry", function() { return _geom_Geometry_js__WEBPACK_IMPORTED_MODULE_1__["default"]; });

/* harmony import */ var _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./geom/GeometryCollection.js */ "./node_modules/ol/geom/GeometryCollection.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GeometryCollection", function() { return _geom_GeometryCollection_js__WEBPACK_IMPORTED_MODULE_2__["default"]; });

/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LineString", function() { return _geom_LineString_js__WEBPACK_IMPORTED_MODULE_3__["default"]; });

/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultiLineString", function() { return _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_4__["default"]; });

/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultiPoint", function() { return _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_5__["default"]; });

/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultiPolygon", function() { return _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_6__["default"]; });

/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Point", function() { return _geom_Point_js__WEBPACK_IMPORTED_MODULE_7__["default"]; });

/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Polygon", function() { return _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__["default"]; });

/* harmony import */ var _geom_LinearRing_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./geom/LinearRing.js */ "./node_modules/ol/geom/LinearRing.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LinearRing", function() { return _geom_LinearRing_js__WEBPACK_IMPORTED_MODULE_9__["default"]; });

/**
 * @module ol/geom
 */










//# sourceMappingURL=geom.js.map

/***/ }),

/***/ "./node_modules/ol/geom/Circle.js":
/*!****************************************!*\
  !*** ./node_modules/ol/geom/Circle.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _flat_transform_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./flat/transform.js */ "./node_modules/ol/geom/flat/transform.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/Circle
 */





/**
 * @classdesc
 * Circle geometry.
 *
 * @api
 */
var Circle = /** @class */ (function (_super) {
    __extends(Circle, _super);
    /**
     * @param {!import("../coordinate.js").Coordinate} center Center.
     *     For internal use, flat coordinates in combination with `opt_layout` and no
     *     `opt_radius` are also accepted.
     * @param {number=} opt_radius Radius.
     * @param {import("./GeometryLayout.js").default=} opt_layout Layout.
     */
    function Circle(center, opt_radius, opt_layout) {
        var _this = _super.call(this) || this;
        if (opt_layout !== undefined && opt_radius === undefined) {
            _this.setFlatCoordinates(opt_layout, center);
        }
        else {
            var radius = opt_radius ? opt_radius : 0;
            _this.setCenterAndRadius(center, radius, opt_layout);
        }
        return _this;
    }
    /**
     * Make a complete copy of the geometry.
     * @return {!Circle} Clone.
     * @override
     * @api
     */
    Circle.prototype.clone = function () {
        return new Circle(this.flatCoordinates.slice(), undefined, this.layout);
    };
    /**
     * @inheritDoc
     */
    Circle.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        var flatCoordinates = this.flatCoordinates;
        var dx = x - flatCoordinates[0];
        var dy = y - flatCoordinates[1];
        var squaredDistance = dx * dx + dy * dy;
        if (squaredDistance < minSquaredDistance) {
            if (squaredDistance === 0) {
                for (var i = 0; i < this.stride; ++i) {
                    closestPoint[i] = flatCoordinates[i];
                }
            }
            else {
                var delta = this.getRadius() / Math.sqrt(squaredDistance);
                closestPoint[0] = flatCoordinates[0] + delta * dx;
                closestPoint[1] = flatCoordinates[1] + delta * dy;
                for (var i = 2; i < this.stride; ++i) {
                    closestPoint[i] = flatCoordinates[i];
                }
            }
            closestPoint.length = this.stride;
            return squaredDistance;
        }
        else {
            return minSquaredDistance;
        }
    };
    /**
     * @inheritDoc
     */
    Circle.prototype.containsXY = function (x, y) {
        var flatCoordinates = this.flatCoordinates;
        var dx = x - flatCoordinates[0];
        var dy = y - flatCoordinates[1];
        return dx * dx + dy * dy <= this.getRadiusSquared_();
    };
    /**
     * Return the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.
     * @return {import("../coordinate.js").Coordinate} Center.
     * @api
     */
    Circle.prototype.getCenter = function () {
        return this.flatCoordinates.slice(0, this.stride);
    };
    /**
     * @inheritDoc
     */
    Circle.prototype.computeExtent = function (extent) {
        var flatCoordinates = this.flatCoordinates;
        var radius = flatCoordinates[this.stride] - flatCoordinates[0];
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createOrUpdate"])(flatCoordinates[0] - radius, flatCoordinates[1] - radius, flatCoordinates[0] + radius, flatCoordinates[1] + radius, extent);
    };
    /**
     * Return the radius of the circle.
     * @return {number} Radius.
     * @api
     */
    Circle.prototype.getRadius = function () {
        return Math.sqrt(this.getRadiusSquared_());
    };
    /**
     * @private
     * @return {number} Radius squared.
     */
    Circle.prototype.getRadiusSquared_ = function () {
        var dx = this.flatCoordinates[this.stride] - this.flatCoordinates[0];
        var dy = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1];
        return dx * dx + dy * dy;
    };
    /**
     * @inheritDoc
     * @api
     */
    Circle.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].CIRCLE;
    };
    /**
     * @inheritDoc
     * @api
     */
    Circle.prototype.intersectsExtent = function (extent) {
        var circleExtent = this.getExtent();
        if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["intersects"])(extent, circleExtent)) {
            var center = this.getCenter();
            if (extent[0] <= center[0] && extent[2] >= center[0]) {
                return true;
            }
            if (extent[1] <= center[1] && extent[3] >= center[1]) {
                return true;
            }
            return Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["forEachCorner"])(extent, this.intersectsCoordinate.bind(this));
        }
        return false;
    };
    /**
     * Set the center of the circle as {@link module:ol/coordinate~Coordinate coordinate}.
     * @param {import("../coordinate.js").Coordinate} center Center.
     * @api
     */
    Circle.prototype.setCenter = function (center) {
        var stride = this.stride;
        var radius = this.flatCoordinates[stride] - this.flatCoordinates[0];
        var flatCoordinates = center.slice();
        flatCoordinates[stride] = flatCoordinates[0] + radius;
        for (var i = 1; i < stride; ++i) {
            flatCoordinates[stride + i] = center[i];
        }
        this.setFlatCoordinates(this.layout, flatCoordinates);
        this.changed();
    };
    /**
     * Set the center (as {@link module:ol/coordinate~Coordinate coordinate}) and the radius (as
     * number) of the circle.
     * @param {!import("../coordinate.js").Coordinate} center Center.
     * @param {number} radius Radius.
     * @param {import("./GeometryLayout.js").default=} opt_layout Layout.
     * @api
     */
    Circle.prototype.setCenterAndRadius = function (center, radius, opt_layout) {
        this.setLayout(opt_layout, center, 0);
        if (!this.flatCoordinates) {
            this.flatCoordinates = [];
        }
        /** @type {Array<number>} */
        var flatCoordinates = this.flatCoordinates;
        var offset = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_3__["deflateCoordinate"])(flatCoordinates, 0, center, this.stride);
        flatCoordinates[offset++] = flatCoordinates[0] + radius;
        for (var i = 1, ii = this.stride; i < ii; ++i) {
            flatCoordinates[offset++] = flatCoordinates[i];
        }
        flatCoordinates.length = offset;
        this.changed();
    };
    /**
     * @inheritDoc
     */
    Circle.prototype.getCoordinates = function () {
        return null;
    };
    /**
     * @inheritDoc
     */
    Circle.prototype.setCoordinates = function (coordinates, opt_layout) { };
    /**
     * Set the radius of the circle. The radius is in the units of the projection.
     * @param {number} radius Radius.
     * @api
     */
    Circle.prototype.setRadius = function (radius) {
        this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;
        this.changed();
    };
    /**
     * @inheritDoc
     * @api
     */
    Circle.prototype.rotate = function (angle, anchor) {
        var center = this.getCenter();
        var stride = this.getStride();
        this.setCenter(Object(_flat_transform_js__WEBPACK_IMPORTED_MODULE_4__["rotate"])(center, 0, center.length, stride, angle, anchor, center));
        this.changed();
    };
    /**
     * @inheritDoc
     * @api
     */
    Circle.prototype.translate = function (deltaX, deltaY) {
        var center = this.getCenter();
        var stride = this.getStride();
        this.setCenter(Object(_flat_transform_js__WEBPACK_IMPORTED_MODULE_4__["translate"])(center, 0, center.length, stride, deltaX, deltaY, center));
        this.changed();
    };
    return Circle;
}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * Transform each coordinate of the circle from one coordinate reference system
 * to another. The geometry is modified in place.
 * If you do not want the geometry modified in place, first clone() it and
 * then use this function on the clone.
 *
 * Internally a circle is currently represented by two points: the center of
 * the circle `[cx, cy]`, and the point to the right of the circle
 * `[cx + r, cy]`. This `transform` function just transforms these two points.
 * So the resulting geometry is also a circle, and that circle does not
 * correspond to the shape that would be obtained by transforming every point
 * of the original circle.
 *
 * @param {import("../proj.js").ProjectionLike} source The current projection.  Can be a
 *     string identifier or a {@link module:ol/proj/Projection~Projection} object.
 * @param {import("../proj.js").ProjectionLike} destination The desired projection.  Can be a
 *     string identifier or a {@link module:ol/proj/Projection~Projection} object.
 * @return {Circle} This geometry.  Note that original geometry is
 *     modified in place.
 * @function
 * @api
 */
Circle.prototype.transform;
/* harmony default export */ __webpack_exports__["default"] = (Circle);
//# sourceMappingURL=Circle.js.map

/***/ }),

/***/ "./node_modules/ol/geom/Geometry.js":
/*!******************************************!*\
  !*** ./node_modules/ol/geom/Geometry.js ***!
  \******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _flat_transform_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./flat/transform.js */ "./node_modules/ol/geom/flat/transform.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _proj_Units_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../proj/Units.js */ "./node_modules/ol/proj/Units.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/Geometry
 */








/**
 * @type {import("../transform.js").Transform}
 */
var tmpTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["create"])();
/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Base class for vector geometries.
 *
 * To get notified of changes to the geometry, register a listener for the
 * generic `change` event on your geometry instance.
 *
 * @abstract
 * @api
 */
var Geometry = /** @class */ (function (_super) {
    __extends(Geometry, _super);
    function Geometry() {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {import("../extent.js").Extent}
         */
        _this.extent_ = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["createEmpty"])();
        /**
         * @private
         * @type {number}
         */
        _this.extentRevision_ = -1;
        /**
         * @protected
         * @type {number}
         */
        _this.simplifiedGeometryMaxMinSquaredTolerance = 0;
        /**
         * @protected
         * @type {number}
         */
        _this.simplifiedGeometryRevision = 0;
        /**
         * Get a transformed and simplified version of the geometry.
         * @abstract
         * @param {number} revision The geometry revision.
         * @param {number} squaredTolerance Squared tolerance.
         * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
         * @return {Geometry} Simplified geometry.
         */
        _this.simplifyTransformedInternal = Object(_functions_js__WEBPACK_IMPORTED_MODULE_7__["memoizeOne"])(function (revision, squaredTolerance, opt_transform) {
            if (!opt_transform) {
                return this.getSimplifiedGeometry(squaredTolerance);
            }
            var clone = this.clone();
            clone.applyTransform(opt_transform);
            return clone.getSimplifiedGeometry(squaredTolerance);
        });
        return _this;
    }
    /**
     * Get a transformed and simplified version of the geometry.
     * @abstract
     * @param {number} squaredTolerance Squared tolerance.
     * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
     * @return {Geometry} Simplified geometry.
     */
    Geometry.prototype.simplifyTransformed = function (squaredTolerance, opt_transform) {
        return this.simplifyTransformedInternal(this.getRevision(), squaredTolerance, opt_transform);
    };
    /**
     * Make a complete copy of the geometry.
     * @abstract
     * @return {!Geometry} Clone.
     */
    Geometry.prototype.clone = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @abstract
     * @param {number} x X.
     * @param {number} y Y.
     * @param {import("../coordinate.js").Coordinate} closestPoint Closest point.
     * @param {number} minSquaredDistance Minimum squared distance.
     * @return {number} Minimum squared distance.
     */
    Geometry.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @param {number} x X.
     * @param {number} y Y.
     * @return {boolean} Contains (x, y).
     */
    Geometry.prototype.containsXY = function (x, y) {
        var coord = this.getClosestPoint([x, y]);
        return coord[0] === x && coord[1] === y;
    };
    /**
     * Return the closest point of the geometry to the passed point as
     * {@link module:ol/coordinate~Coordinate coordinate}.
     * @param {import("../coordinate.js").Coordinate} point Point.
     * @param {import("../coordinate.js").Coordinate=} opt_closestPoint Closest point.
     * @return {import("../coordinate.js").Coordinate} Closest point.
     * @api
     */
    Geometry.prototype.getClosestPoint = function (point, opt_closestPoint) {
        var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN];
        this.closestPointXY(point[0], point[1], closestPoint, Infinity);
        return closestPoint;
    };
    /**
     * Returns true if this geometry includes the specified coordinate. If the
     * coordinate is on the boundary of the geometry, returns false.
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @return {boolean} Contains coordinate.
     * @api
     */
    Geometry.prototype.intersectsCoordinate = function (coordinate) {
        return this.containsXY(coordinate[0], coordinate[1]);
    };
    /**
     * @abstract
     * @param {import("../extent.js").Extent} extent Extent.
     * @protected
     * @return {import("../extent.js").Extent} extent Extent.
     */
    Geometry.prototype.computeExtent = function (extent) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Get the extent of the geometry.
     * @param {import("../extent.js").Extent=} opt_extent Extent.
     * @return {import("../extent.js").Extent} extent Extent.
     * @api
     */
    Geometry.prototype.getExtent = function (opt_extent) {
        if (this.extentRevision_ != this.getRevision()) {
            this.extent_ = this.computeExtent(this.extent_);
            this.extentRevision_ = this.getRevision();
        }
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["returnOrUpdate"])(this.extent_, opt_extent);
    };
    /**
     * Rotate the geometry around a given coordinate. This modifies the geometry
     * coordinates in place.
     * @abstract
     * @param {number} angle Rotation angle in radians.
     * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
     * @api
     */
    Geometry.prototype.rotate = function (angle, anchor) {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Scale the geometry (with an optional origin).  This modifies the geometry
     * coordinates in place.
     * @abstract
     * @param {number} sx The scaling factor in the x-direction.
     * @param {number=} opt_sy The scaling factor in the y-direction (defaults to
     *     sx).
     * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center
     *     of the geometry extent).
     * @api
     */
    Geometry.prototype.scale = function (sx, opt_sy, opt_anchor) {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Create a simplified version of this geometry.  For linestrings, this uses
     * the [Douglas Peucker](https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm)
     * algorithm.  For polygons, a quantization-based
     * simplification is used to preserve topology.
     * @param {number} tolerance The tolerance distance for simplification.
     * @return {Geometry} A new, simplified version of the original geometry.
     * @api
     */
    Geometry.prototype.simplify = function (tolerance) {
        return this.getSimplifiedGeometry(tolerance * tolerance);
    };
    /**
     * Create a simplified version of this geometry using the Douglas Peucker
     * algorithm.
     * See https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.
     * @abstract
     * @param {number} squaredTolerance Squared tolerance.
     * @return {Geometry} Simplified geometry.
     */
    Geometry.prototype.getSimplifiedGeometry = function (squaredTolerance) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Get the type of this geometry.
     * @abstract
     * @return {import("./GeometryType.js").default} Geometry type.
     */
    Geometry.prototype.getType = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Apply a transform function to the coordinates of the geometry.
     * The geometry is modified in place.
     * If you do not want the geometry modified in place, first `clone()` it and
     * then use this function on the clone.
     * @abstract
     * @param {import("../proj.js").TransformFunction} transformFn Transform function.
     * Called with a flat array of geometry coordinates.
     */
    Geometry.prototype.applyTransform = function (transformFn) {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Test if the geometry and the passed extent intersect.
     * @abstract
     * @param {import("../extent.js").Extent} extent Extent.
     * @return {boolean} `true` if the geometry and the extent intersect.
     */
    Geometry.prototype.intersectsExtent = function (extent) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Translate the geometry.  This modifies the geometry coordinates in place.  If
     * instead you want a new geometry, first `clone()` this geometry.
     * @abstract
     * @param {number} deltaX Delta X.
     * @param {number} deltaY Delta Y.
     * @api
     */
    Geometry.prototype.translate = function (deltaX, deltaY) {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Transform each coordinate of the geometry from one coordinate reference
     * system to another. The geometry is modified in place.
     * For example, a line will be transformed to a line and a circle to a circle.
     * If you do not want the geometry modified in place, first `clone()` it and
     * then use this function on the clone.
     *
     * @param {import("../proj.js").ProjectionLike} source The current projection.  Can be a
     *     string identifier or a {@link module:ol/proj/Projection~Projection} object.
     * @param {import("../proj.js").ProjectionLike} destination The desired projection.  Can be a
     *     string identifier or a {@link module:ol/proj/Projection~Projection} object.
     * @return {Geometry} This geometry.  Note that original geometry is
     *     modified in place.
     * @api
     */
    Geometry.prototype.transform = function (source, destination) {
        /** @type {import("../proj/Projection.js").default} */
        var sourceProj = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["get"])(source);
        var transformFn = sourceProj.getUnits() == _proj_Units_js__WEBPACK_IMPORTED_MODULE_5__["default"].TILE_PIXELS ?
            function (inCoordinates, outCoordinates, stride) {
                var pixelExtent = sourceProj.getExtent();
                var projectedExtent = sourceProj.getWorldExtent();
                var scale = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getHeight"])(projectedExtent) / Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getHeight"])(pixelExtent);
                Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["compose"])(tmpTransform, projectedExtent[0], projectedExtent[3], scale, -scale, 0, 0, 0);
                Object(_flat_transform_js__WEBPACK_IMPORTED_MODULE_3__["transform2D"])(inCoordinates, 0, inCoordinates.length, stride, tmpTransform, outCoordinates);
                return Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["getTransform"])(sourceProj, destination)(inCoordinates, outCoordinates, stride);
            } :
            Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["getTransform"])(sourceProj, destination);
        this.applyTransform(transformFn);
        return this;
    };
    return Geometry;
}(_Object_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Geometry);
//# sourceMappingURL=Geometry.js.map

/***/ }),

/***/ "./node_modules/ol/geom/GeometryCollection.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/geom/GeometryCollection.js ***!
  \****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Geometry_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Geometry.js */ "./node_modules/ol/geom/Geometry.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/GeometryCollection
 */





/**
 * @classdesc
 * An array of {@link module:ol/geom/Geometry} objects.
 *
 * @api
 */
var GeometryCollection = /** @class */ (function (_super) {
    __extends(GeometryCollection, _super);
    /**
     * @param {Array<Geometry>=} opt_geometries Geometries.
     */
    function GeometryCollection(opt_geometries) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {Array<Geometry>}
         */
        _this.geometries_ = opt_geometries ? opt_geometries : null;
        /**
         * @type {Array<import("../events.js").EventsKey>}
         */
        _this.changeEventsKeys_ = [];
        _this.listenGeometriesChange_();
        return _this;
    }
    /**
     * @private
     */
    GeometryCollection.prototype.unlistenGeometriesChange_ = function () {
        this.changeEventsKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_0__["unlistenByKey"]);
        this.changeEventsKeys_.length = 0;
    };
    /**
     * @private
     */
    GeometryCollection.prototype.listenGeometriesChange_ = function () {
        if (!this.geometries_) {
            return;
        }
        for (var i = 0, ii = this.geometries_.length; i < ii; ++i) {
            this.changeEventsKeys_.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["listen"])(this.geometries_[i], _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].CHANGE, this.changed, this));
        }
    };
    /**
     * Make a complete copy of the geometry.
     * @return {!GeometryCollection} Clone.
     * @override
     * @api
     */
    GeometryCollection.prototype.clone = function () {
        var geometryCollection = new GeometryCollection(null);
        geometryCollection.setGeometries(this.geometries_);
        return geometryCollection;
    };
    /**
     * @inheritDoc
     */
    GeometryCollection.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        if (minSquaredDistance < Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["closestSquaredDistanceXY"])(this.getExtent(), x, y)) {
            return minSquaredDistance;
        }
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            minSquaredDistance = geometries[i].closestPointXY(x, y, closestPoint, minSquaredDistance);
        }
        return minSquaredDistance;
    };
    /**
     * @inheritDoc
     */
    GeometryCollection.prototype.containsXY = function (x, y) {
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            if (geometries[i].containsXY(x, y)) {
                return true;
            }
        }
        return false;
    };
    /**
     * @inheritDoc
     */
    GeometryCollection.prototype.computeExtent = function (extent) {
        Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["createOrUpdateEmpty"])(extent);
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["extend"])(extent, geometries[i].getExtent());
        }
        return extent;
    };
    /**
     * Return the geometries that make up this geometry collection.
     * @return {Array<Geometry>} Geometries.
     * @api
     */
    GeometryCollection.prototype.getGeometries = function () {
        return cloneGeometries(this.geometries_);
    };
    /**
     * @return {Array<Geometry>} Geometries.
     */
    GeometryCollection.prototype.getGeometriesArray = function () {
        return this.geometries_;
    };
    /**
     * @return {Array<Geometry>} Geometries.
     */
    GeometryCollection.prototype.getGeometriesArrayRecursive = function () {
        /** @type {Array<Geometry>} */
        var geometriesArray = [];
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            if (geometries[i].getType() === this.getType()) {
                geometriesArray = geometriesArray.concat(/** @type {GeometryCollection} */ (geometries[i]).getGeometriesArrayRecursive());
            }
            else {
                geometriesArray.push(geometries[i]);
            }
        }
        return geometriesArray;
    };
    /**
     * @inheritDoc
     */
    GeometryCollection.prototype.getSimplifiedGeometry = function (squaredTolerance) {
        if (this.simplifiedGeometryRevision !== this.getRevision()) {
            this.simplifiedGeometryMaxMinSquaredTolerance = 0;
            this.simplifiedGeometryRevision = this.getRevision();
        }
        if (squaredTolerance < 0 ||
            (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&
                squaredTolerance < this.simplifiedGeometryMaxMinSquaredTolerance)) {
            return this;
        }
        var simplifiedGeometries = [];
        var geometries = this.geometries_;
        var simplified = false;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            var geometry = geometries[i];
            var simplifiedGeometry = geometry.getSimplifiedGeometry(squaredTolerance);
            simplifiedGeometries.push(simplifiedGeometry);
            if (simplifiedGeometry !== geometry) {
                simplified = true;
            }
        }
        if (simplified) {
            var simplifiedGeometryCollection = new GeometryCollection(null);
            simplifiedGeometryCollection.setGeometriesArray(simplifiedGeometries);
            return simplifiedGeometryCollection;
        }
        else {
            this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;
            return this;
        }
    };
    /**
     * @inheritDoc
     * @api
     */
    GeometryCollection.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].GEOMETRY_COLLECTION;
    };
    /**
     * @inheritDoc
     * @api
     */
    GeometryCollection.prototype.intersectsExtent = function (extent) {
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            if (geometries[i].intersectsExtent(extent)) {
                return true;
            }
        }
        return false;
    };
    /**
     * @return {boolean} Is empty.
     */
    GeometryCollection.prototype.isEmpty = function () {
        return this.geometries_.length === 0;
    };
    /**
     * @inheritDoc
     * @api
     */
    GeometryCollection.prototype.rotate = function (angle, anchor) {
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            geometries[i].rotate(angle, anchor);
        }
        this.changed();
    };
    /**
     * @inheritDoc
     * @api
     */
    GeometryCollection.prototype.scale = function (sx, opt_sy, opt_anchor) {
        var anchor = opt_anchor;
        if (!anchor) {
            anchor = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getCenter"])(this.getExtent());
        }
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            geometries[i].scale(sx, opt_sy, anchor);
        }
        this.changed();
    };
    /**
     * Set the geometries that make up this geometry collection.
     * @param {Array<Geometry>} geometries Geometries.
     * @api
     */
    GeometryCollection.prototype.setGeometries = function (geometries) {
        this.setGeometriesArray(cloneGeometries(geometries));
    };
    /**
     * @param {Array<Geometry>} geometries Geometries.
     */
    GeometryCollection.prototype.setGeometriesArray = function (geometries) {
        this.unlistenGeometriesChange_();
        this.geometries_ = geometries;
        this.listenGeometriesChange_();
        this.changed();
    };
    /**
     * @inheritDoc
     * @api
     */
    GeometryCollection.prototype.applyTransform = function (transformFn) {
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            geometries[i].applyTransform(transformFn);
        }
        this.changed();
    };
    /**
     * @inheritDoc
     * @api
     */
    GeometryCollection.prototype.translate = function (deltaX, deltaY) {
        var geometries = this.geometries_;
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            geometries[i].translate(deltaX, deltaY);
        }
        this.changed();
    };
    /**
     * @inheritDoc
     */
    GeometryCollection.prototype.disposeInternal = function () {
        this.unlistenGeometriesChange_();
        _super.prototype.disposeInternal.call(this);
    };
    return GeometryCollection;
}(_Geometry_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * @param {Array<Geometry>} geometries Geometries.
 * @return {Array<Geometry>} Cloned geometries.
 */
function cloneGeometries(geometries) {
    var clonedGeometries = [];
    for (var i = 0, ii = geometries.length; i < ii; ++i) {
        clonedGeometries.push(geometries[i].clone());
    }
    return clonedGeometries;
}
/* harmony default export */ __webpack_exports__["default"] = (GeometryCollection);
//# sourceMappingURL=GeometryCollection.js.map

/***/ }),

/***/ "./node_modules/ol/geom/GeometryLayout.js":
/*!************************************************!*\
  !*** ./node_modules/ol/geom/GeometryLayout.js ***!
  \************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/geom/GeometryLayout
 */
/**
 * The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')
 * or measure ('M') coordinate is available. Supported values are `'XY'`,
 * `'XYZ'`, `'XYM'`, `'XYZM'`.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    XY: 'XY',
    XYZ: 'XYZ',
    XYM: 'XYM',
    XYZM: 'XYZM'
});
//# sourceMappingURL=GeometryLayout.js.map

/***/ }),

/***/ "./node_modules/ol/geom/GeometryType.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/geom/GeometryType.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/geom/GeometryType
 */
/**
 * The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,
 * `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,
 * `'GeometryCollection'`, `'Circle'`.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    POINT: 'Point',
    LINE_STRING: 'LineString',
    LINEAR_RING: 'LinearRing',
    POLYGON: 'Polygon',
    MULTI_POINT: 'MultiPoint',
    MULTI_LINE_STRING: 'MultiLineString',
    MULTI_POLYGON: 'MultiPolygon',
    GEOMETRY_COLLECTION: 'GeometryCollection',
    CIRCLE: 'Circle'
});
//# sourceMappingURL=GeometryType.js.map

/***/ }),

/***/ "./node_modules/ol/geom/LineString.js":
/*!********************************************!*\
  !*** ./node_modules/ol/geom/LineString.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _flat_closest_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./flat/closest.js */ "./node_modules/ol/geom/flat/closest.js");
/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _flat_inflate_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./flat/inflate.js */ "./node_modules/ol/geom/flat/inflate.js");
/* harmony import */ var _flat_interpolate_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./flat/interpolate.js */ "./node_modules/ol/geom/flat/interpolate.js");
/* harmony import */ var _flat_intersectsextent_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./flat/intersectsextent.js */ "./node_modules/ol/geom/flat/intersectsextent.js");
/* harmony import */ var _flat_length_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flat/length.js */ "./node_modules/ol/geom/flat/length.js");
/* harmony import */ var _flat_segments_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./flat/segments.js */ "./node_modules/ol/geom/flat/segments.js");
/* harmony import */ var _flat_simplify_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./flat/simplify.js */ "./node_modules/ol/geom/flat/simplify.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/LineString
 */













/**
 * @classdesc
 * Linestring geometry.
 *
 * @api
 */
var LineString = /** @class */ (function (_super) {
    __extends(LineString, _super);
    /**
     * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
     *     For internal use, flat coordinates in combination with `opt_layout` are also accepted.
     * @param {GeometryLayout=} opt_layout Layout.
     */
    function LineString(coordinates, opt_layout) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {import("../coordinate.js").Coordinate}
         */
        _this.flatMidpoint_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.flatMidpointRevision_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.maxDelta_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.maxDeltaRevision_ = -1;
        if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {
            _this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
        }
        else {
            _this.setCoordinates(/** @type {Array<import("../coordinate.js").Coordinate>} */ (coordinates), opt_layout);
        }
        return _this;
    }
    /**
     * Append the passed coordinate to the coordinates of the linestring.
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @api
     */
    LineString.prototype.appendCoordinate = function (coordinate) {
        if (!this.flatCoordinates) {
            this.flatCoordinates = coordinate.slice();
        }
        else {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(this.flatCoordinates, coordinate);
        }
        this.changed();
    };
    /**
     * Make a complete copy of the geometry.
     * @return {!LineString} Clone.
     * @override
     * @api
     */
    LineString.prototype.clone = function () {
        return new LineString(this.flatCoordinates.slice(), this.layout);
    };
    /**
     * @inheritDoc
     */
    LineString.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        if (minSquaredDistance < Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["closestSquaredDistanceXY"])(this.getExtent(), x, y)) {
            return minSquaredDistance;
        }
        if (this.maxDeltaRevision_ != this.getRevision()) {
            this.maxDelta_ = Math.sqrt(Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_5__["maxSquaredDelta"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0));
            this.maxDeltaRevision_ = this.getRevision();
        }
        return Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_5__["assignClosestPoint"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, false, x, y, closestPoint, minSquaredDistance);
    };
    /**
     * Iterate over each segment, calling the provided callback.
     * If the callback returns a truthy value the function returns that
     * value immediately. Otherwise the function returns `false`.
     *
     * @param {function(this: S, import("../coordinate.js").Coordinate, import("../coordinate.js").Coordinate): T} callback Function
     *     called for each segment. The function will receive two arguments, the start and end coordinates of the segment.
     * @return {T|boolean} Value.
     * @template T,S
     * @api
     */
    LineString.prototype.forEachSegment = function (callback) {
        return Object(_flat_segments_js__WEBPACK_IMPORTED_MODULE_11__["forEach"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, callback);
    };
    /**
     * Returns the coordinate at `m` using linear interpolation, or `null` if no
     * such coordinate exists.
     *
     * `opt_extrapolate` controls extrapolation beyond the range of Ms in the
     * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first
     * M will return the first coordinate and Ms greater than the last M will
     * return the last coordinate.
     *
     * @param {number} m M.
     * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`.
     * @return {import("../coordinate.js").Coordinate} Coordinate.
     * @api
     */
    LineString.prototype.getCoordinateAtM = function (m, opt_extrapolate) {
        if (this.layout != _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XYM &&
            this.layout != _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XYZM) {
            return null;
        }
        var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;
        return Object(_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_8__["lineStringCoordinateAtM"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, m, extrapolate);
    };
    /**
     * Return the coordinates of the linestring.
     * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
     * @override
     * @api
     */
    LineString.prototype.getCoordinates = function () {
        return Object(_flat_inflate_js__WEBPACK_IMPORTED_MODULE_7__["inflateCoordinates"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
    };
    /**
     * Return the coordinate at the provided fraction along the linestring.
     * The `fraction` is a number between 0 and 1, where 0 is the start of the
     * linestring and 1 is the end.
     * @param {number} fraction Fraction.
     * @param {import("../coordinate.js").Coordinate=} opt_dest Optional coordinate whose values will
     *     be modified. If not provided, a new coordinate will be returned.
     * @return {import("../coordinate.js").Coordinate} Coordinate of the interpolated point.
     * @api
     */
    LineString.prototype.getCoordinateAt = function (fraction, opt_dest) {
        return Object(_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_8__["interpolatePoint"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, fraction, opt_dest);
    };
    /**
     * Return the length of the linestring on projected plane.
     * @return {number} Length (on projected plane).
     * @api
     */
    LineString.prototype.getLength = function () {
        return Object(_flat_length_js__WEBPACK_IMPORTED_MODULE_10__["lineStringLength"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
    };
    /**
     * @return {Array<number>} Flat midpoint.
     */
    LineString.prototype.getFlatMidpoint = function () {
        if (this.flatMidpointRevision_ != this.getRevision()) {
            this.flatMidpoint_ = this.getCoordinateAt(0.5, this.flatMidpoint_);
            this.flatMidpointRevision_ = this.getRevision();
        }
        return this.flatMidpoint_;
    };
    /**
     * @inheritDoc
     */
    LineString.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
        var simplifiedFlatCoordinates = [];
        simplifiedFlatCoordinates.length = Object(_flat_simplify_js__WEBPACK_IMPORTED_MODULE_12__["douglasPeucker"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0);
        return new LineString(simplifiedFlatCoordinates, _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XY);
    };
    /**
     * @inheritDoc
     * @api
     */
    LineString.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].LINE_STRING;
    };
    /**
     * @inheritDoc
     * @api
     */
    LineString.prototype.intersectsExtent = function (extent) {
        return Object(_flat_intersectsextent_js__WEBPACK_IMPORTED_MODULE_9__["intersectsLineString"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent);
    };
    /**
     * Set the coordinates of the linestring.
     * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
     * @param {GeometryLayout=} opt_layout Layout.
     * @override
     * @api
     */
    LineString.prototype.setCoordinates = function (coordinates, opt_layout) {
        this.setLayout(opt_layout, coordinates, 1);
        if (!this.flatCoordinates) {
            this.flatCoordinates = [];
        }
        this.flatCoordinates.length = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_6__["deflateCoordinates"])(this.flatCoordinates, 0, coordinates, this.stride);
        this.changed();
    };
    return LineString;
}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (LineString);
//# sourceMappingURL=LineString.js.map

/***/ }),

/***/ "./node_modules/ol/geom/LinearRing.js":
/*!********************************************!*\
  !*** ./node_modules/ol/geom/LinearRing.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _flat_area_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./flat/area.js */ "./node_modules/ol/geom/flat/area.js");
/* harmony import */ var _flat_closest_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./flat/closest.js */ "./node_modules/ol/geom/flat/closest.js");
/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _flat_inflate_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./flat/inflate.js */ "./node_modules/ol/geom/flat/inflate.js");
/* harmony import */ var _flat_simplify_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./flat/simplify.js */ "./node_modules/ol/geom/flat/simplify.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/LinearRing
 */









/**
 * @classdesc
 * Linear ring geometry. Only used as part of polygon; cannot be rendered
 * on its own.
 *
 * @api
 */
var LinearRing = /** @class */ (function (_super) {
    __extends(LinearRing, _super);
    /**
     * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
     *     For internal use, flat coordinates in combination with `opt_layout` are also accepted.
     * @param {GeometryLayout=} opt_layout Layout.
     */
    function LinearRing(coordinates, opt_layout) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {number}
         */
        _this.maxDelta_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.maxDeltaRevision_ = -1;
        if (opt_layout !== undefined && !Array.isArray(coordinates[0])) {
            _this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
        }
        else {
            _this.setCoordinates(/** @type {Array<import("../coordinate.js").Coordinate>} */ (coordinates), opt_layout);
        }
        return _this;
    }
    /**
     * Make a complete copy of the geometry.
     * @return {!LinearRing} Clone.
     * @override
     * @api
     */
    LinearRing.prototype.clone = function () {
        return new LinearRing(this.flatCoordinates.slice(), this.layout);
    };
    /**
     * @inheritDoc
     */
    LinearRing.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        if (minSquaredDistance < Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["closestSquaredDistanceXY"])(this.getExtent(), x, y)) {
            return minSquaredDistance;
        }
        if (this.maxDeltaRevision_ != this.getRevision()) {
            this.maxDelta_ = Math.sqrt(Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_5__["maxSquaredDelta"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0));
            this.maxDeltaRevision_ = this.getRevision();
        }
        return Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_5__["assignClosestPoint"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
    };
    /**
     * Return the area of the linear ring on projected plane.
     * @return {number} Area (on projected plane).
     * @api
     */
    LinearRing.prototype.getArea = function () {
        return Object(_flat_area_js__WEBPACK_IMPORTED_MODULE_4__["linearRing"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
    };
    /**
     * Return the coordinates of the linear ring.
     * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
     * @override
     * @api
     */
    LinearRing.prototype.getCoordinates = function () {
        return Object(_flat_inflate_js__WEBPACK_IMPORTED_MODULE_7__["inflateCoordinates"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
    };
    /**
     * @inheritDoc
     */
    LinearRing.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
        var simplifiedFlatCoordinates = [];
        simplifiedFlatCoordinates.length = Object(_flat_simplify_js__WEBPACK_IMPORTED_MODULE_8__["douglasPeucker"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0);
        return new LinearRing(simplifiedFlatCoordinates, _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_1__["default"].XY);
    };
    /**
     * @inheritDoc
     * @api
     */
    LinearRing.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_2__["default"].LINEAR_RING;
    };
    /**
     * @inheritDoc
     */
    LinearRing.prototype.intersectsExtent = function (extent) {
        return false;
    };
    /**
     * Set the coordinates of the linear ring.
     * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
     * @param {GeometryLayout=} opt_layout Layout.
     * @override
     * @api
     */
    LinearRing.prototype.setCoordinates = function (coordinates, opt_layout) {
        this.setLayout(opt_layout, coordinates, 1);
        if (!this.flatCoordinates) {
            this.flatCoordinates = [];
        }
        this.flatCoordinates.length = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_6__["deflateCoordinates"])(this.flatCoordinates, 0, coordinates, this.stride);
        this.changed();
    };
    return LinearRing;
}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (LinearRing);
//# sourceMappingURL=LinearRing.js.map

/***/ }),

/***/ "./node_modules/ol/geom/MultiLineString.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/geom/MultiLineString.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _LineString_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _flat_closest_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flat/closest.js */ "./node_modules/ol/geom/flat/closest.js");
/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _flat_inflate_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./flat/inflate.js */ "./node_modules/ol/geom/flat/inflate.js");
/* harmony import */ var _flat_interpolate_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./flat/interpolate.js */ "./node_modules/ol/geom/flat/interpolate.js");
/* harmony import */ var _flat_intersectsextent_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flat/intersectsextent.js */ "./node_modules/ol/geom/flat/intersectsextent.js");
/* harmony import */ var _flat_simplify_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./flat/simplify.js */ "./node_modules/ol/geom/flat/simplify.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/MultiLineString
 */












/**
 * @classdesc
 * Multi-linestring geometry.
 *
 * @api
 */
var MultiLineString = /** @class */ (function (_super) {
    __extends(MultiLineString, _super);
    /**
     * @param {Array<Array<import("../coordinate.js").Coordinate>|LineString>|Array<number>} coordinates
     *     Coordinates or LineString geometries. (For internal use, flat coordinates in
     *     combination with `opt_layout` and `opt_ends` are also accepted.)
     * @param {GeometryLayout=} opt_layout Layout.
     * @param {Array<number>=} opt_ends Flat coordinate ends for internal use.
     */
    function MultiLineString(coordinates, opt_layout, opt_ends) {
        var _this = _super.call(this) || this;
        /**
         * @type {Array<number>}
         * @private
         */
        _this.ends_ = [];
        /**
         * @private
         * @type {number}
         */
        _this.maxDelta_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.maxDeltaRevision_ = -1;
        if (Array.isArray(coordinates[0])) {
            _this.setCoordinates(/** @type {Array<Array<import("../coordinate.js").Coordinate>>} */ (coordinates), opt_layout);
        }
        else if (opt_layout !== undefined && opt_ends) {
            _this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
            _this.ends_ = opt_ends;
        }
        else {
            var layout = _this.getLayout();
            var lineStrings = /** @type {Array<LineString>} */ (coordinates);
            var flatCoordinates = [];
            var ends = [];
            for (var i = 0, ii = lineStrings.length; i < ii; ++i) {
                var lineString = lineStrings[i];
                if (i === 0) {
                    layout = lineString.getLayout();
                }
                Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(flatCoordinates, lineString.getFlatCoordinates());
                ends.push(flatCoordinates.length);
            }
            _this.setFlatCoordinates(layout, flatCoordinates);
            _this.ends_ = ends;
        }
        return _this;
    }
    /**
     * Append the passed linestring to the multilinestring.
     * @param {LineString} lineString LineString.
     * @api
     */
    MultiLineString.prototype.appendLineString = function (lineString) {
        if (!this.flatCoordinates) {
            this.flatCoordinates = lineString.getFlatCoordinates().slice();
        }
        else {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(this.flatCoordinates, lineString.getFlatCoordinates().slice());
        }
        this.ends_.push(this.flatCoordinates.length);
        this.changed();
    };
    /**
     * Make a complete copy of the geometry.
     * @return {!MultiLineString} Clone.
     * @override
     * @api
     */
    MultiLineString.prototype.clone = function () {
        return new MultiLineString(this.flatCoordinates.slice(), this.layout, this.ends_.slice());
    };
    /**
     * @inheritDoc
     */
    MultiLineString.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        if (minSquaredDistance < Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["closestSquaredDistanceXY"])(this.getExtent(), x, y)) {
            return minSquaredDistance;
        }
        if (this.maxDeltaRevision_ != this.getRevision()) {
            this.maxDelta_ = Math.sqrt(Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_6__["arrayMaxSquaredDelta"])(this.flatCoordinates, 0, this.ends_, this.stride, 0));
            this.maxDeltaRevision_ = this.getRevision();
        }
        return Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_6__["assignClosestArrayPoint"])(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, false, x, y, closestPoint, minSquaredDistance);
    };
    /**
     * Returns the coordinate at `m` using linear interpolation, or `null` if no
     * such coordinate exists.
     *
     * `opt_extrapolate` controls extrapolation beyond the range of Ms in the
     * MultiLineString. If `opt_extrapolate` is `true` then Ms less than the first
     * M will return the first coordinate and Ms greater than the last M will
     * return the last coordinate.
     *
     * `opt_interpolate` controls interpolation between consecutive LineStrings
     * within the MultiLineString. If `opt_interpolate` is `true` the coordinates
     * will be linearly interpolated between the last coordinate of one LineString
     * and the first coordinate of the next LineString.  If `opt_interpolate` is
     * `false` then the function will return `null` for Ms falling between
     * LineStrings.
     *
     * @param {number} m M.
     * @param {boolean=} opt_extrapolate Extrapolate. Default is `false`.
     * @param {boolean=} opt_interpolate Interpolate. Default is `false`.
     * @return {import("../coordinate.js").Coordinate} Coordinate.
     * @api
     */
    MultiLineString.prototype.getCoordinateAtM = function (m, opt_extrapolate, opt_interpolate) {
        if ((this.layout != _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XYM &&
            this.layout != _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XYZM) ||
            this.flatCoordinates.length === 0) {
            return null;
        }
        var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;
        var interpolate = opt_interpolate !== undefined ? opt_interpolate : false;
        return Object(_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_9__["lineStringsCoordinateAtM"])(this.flatCoordinates, 0, this.ends_, this.stride, m, extrapolate, interpolate);
    };
    /**
     * Return the coordinates of the multilinestring.
     * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
     * @override
     * @api
     */
    MultiLineString.prototype.getCoordinates = function () {
        return Object(_flat_inflate_js__WEBPACK_IMPORTED_MODULE_8__["inflateCoordinatesArray"])(this.flatCoordinates, 0, this.ends_, this.stride);
    };
    /**
     * @return {Array<number>} Ends.
     */
    MultiLineString.prototype.getEnds = function () {
        return this.ends_;
    };
    /**
     * Return the linestring at the specified index.
     * @param {number} index Index.
     * @return {LineString} LineString.
     * @api
     */
    MultiLineString.prototype.getLineString = function (index) {
        if (index < 0 || this.ends_.length <= index) {
            return null;
        }
        return new _LineString_js__WEBPACK_IMPORTED_MODULE_4__["default"](this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout);
    };
    /**
     * Return the linestrings of this multilinestring.
     * @return {Array<LineString>} LineStrings.
     * @api
     */
    MultiLineString.prototype.getLineStrings = function () {
        var flatCoordinates = this.flatCoordinates;
        var ends = this.ends_;
        var layout = this.layout;
        /** @type {Array<LineString>} */
        var lineStrings = [];
        var offset = 0;
        for (var i = 0, ii = ends.length; i < ii; ++i) {
            var end = ends[i];
            var lineString = new _LineString_js__WEBPACK_IMPORTED_MODULE_4__["default"](flatCoordinates.slice(offset, end), layout);
            lineStrings.push(lineString);
            offset = end;
        }
        return lineStrings;
    };
    /**
     * @return {Array<number>} Flat midpoints.
     */
    MultiLineString.prototype.getFlatMidpoints = function () {
        var midpoints = [];
        var flatCoordinates = this.flatCoordinates;
        var offset = 0;
        var ends = this.ends_;
        var stride = this.stride;
        for (var i = 0, ii = ends.length; i < ii; ++i) {
            var end = ends[i];
            var midpoint = Object(_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_9__["interpolatePoint"])(flatCoordinates, offset, end, stride, 0.5);
            Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(midpoints, midpoint);
            offset = end;
        }
        return midpoints;
    };
    /**
     * @inheritDoc
     */
    MultiLineString.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
        var simplifiedFlatCoordinates = [];
        var simplifiedEnds = [];
        simplifiedFlatCoordinates.length = Object(_flat_simplify_js__WEBPACK_IMPORTED_MODULE_11__["douglasPeuckerArray"])(this.flatCoordinates, 0, this.ends_, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0, simplifiedEnds);
        return new MultiLineString(simplifiedFlatCoordinates, _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XY, simplifiedEnds);
    };
    /**
     * @inheritDoc
     * @api
     */
    MultiLineString.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].MULTI_LINE_STRING;
    };
    /**
     * @inheritDoc
     * @api
     */
    MultiLineString.prototype.intersectsExtent = function (extent) {
        return Object(_flat_intersectsextent_js__WEBPACK_IMPORTED_MODULE_10__["intersectsLineStringArray"])(this.flatCoordinates, 0, this.ends_, this.stride, extent);
    };
    /**
     * Set the coordinates of the multilinestring.
     * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
     * @param {GeometryLayout=} opt_layout Layout.
     * @override
     * @api
     */
    MultiLineString.prototype.setCoordinates = function (coordinates, opt_layout) {
        this.setLayout(opt_layout, coordinates, 2);
        if (!this.flatCoordinates) {
            this.flatCoordinates = [];
        }
        var ends = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_7__["deflateCoordinatesArray"])(this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
        this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
        this.changed();
    };
    return MultiLineString;
}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (MultiLineString);
//# sourceMappingURL=MultiLineString.js.map

/***/ }),

/***/ "./node_modules/ol/geom/MultiPoint.js":
/*!********************************************!*\
  !*** ./node_modules/ol/geom/MultiPoint.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _Point_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _flat_inflate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flat/inflate.js */ "./node_modules/ol/geom/flat/inflate.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/MultiPoint
 */








/**
 * @classdesc
 * Multi-point geometry.
 *
 * @api
 */
var MultiPoint = /** @class */ (function (_super) {
    __extends(MultiPoint, _super);
    /**
     * @param {Array<import("../coordinate.js").Coordinate>|Array<number>} coordinates Coordinates.
     *     For internal use, flat coordinates in combination with `opt_layout` are also accepted.
     * @param {import("./GeometryLayout.js").default=} opt_layout Layout.
     */
    function MultiPoint(coordinates, opt_layout) {
        var _this = _super.call(this) || this;
        if (opt_layout && !Array.isArray(coordinates[0])) {
            _this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
        }
        else {
            _this.setCoordinates(/** @type {Array<import("../coordinate.js").Coordinate>} */ (coordinates), opt_layout);
        }
        return _this;
    }
    /**
     * Append the passed point to this multipoint.
     * @param {Point} point Point.
     * @api
     */
    MultiPoint.prototype.appendPoint = function (point) {
        if (!this.flatCoordinates) {
            this.flatCoordinates = point.getFlatCoordinates().slice();
        }
        else {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(this.flatCoordinates, point.getFlatCoordinates());
        }
        this.changed();
    };
    /**
     * Make a complete copy of the geometry.
     * @return {!MultiPoint} Clone.
     * @override
     * @api
     */
    MultiPoint.prototype.clone = function () {
        var multiPoint = new MultiPoint(this.flatCoordinates.slice(), this.layout);
        return multiPoint;
    };
    /**
     * @inheritDoc
     */
    MultiPoint.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        if (minSquaredDistance < Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["closestSquaredDistanceXY"])(this.getExtent(), x, y)) {
            return minSquaredDistance;
        }
        var flatCoordinates = this.flatCoordinates;
        var stride = this.stride;
        for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
            var squaredDistance = Object(_math_js__WEBPACK_IMPORTED_MODULE_7__["squaredDistance"])(x, y, flatCoordinates[i], flatCoordinates[i + 1]);
            if (squaredDistance < minSquaredDistance) {
                minSquaredDistance = squaredDistance;
                for (var j = 0; j < stride; ++j) {
                    closestPoint[j] = flatCoordinates[i + j];
                }
                closestPoint.length = stride;
            }
        }
        return minSquaredDistance;
    };
    /**
     * Return the coordinates of the multipoint.
     * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
     * @override
     * @api
     */
    MultiPoint.prototype.getCoordinates = function () {
        return Object(_flat_inflate_js__WEBPACK_IMPORTED_MODULE_6__["inflateCoordinates"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
    };
    /**
     * Return the point at the specified index.
     * @param {number} index Index.
     * @return {Point} Point.
     * @api
     */
    MultiPoint.prototype.getPoint = function (index) {
        var n = !this.flatCoordinates ? 0 : this.flatCoordinates.length / this.stride;
        if (index < 0 || n <= index) {
            return null;
        }
        return new _Point_js__WEBPACK_IMPORTED_MODULE_3__["default"](this.flatCoordinates.slice(index * this.stride, (index + 1) * this.stride), this.layout);
    };
    /**
     * Return the points of this multipoint.
     * @return {Array<Point>} Points.
     * @api
     */
    MultiPoint.prototype.getPoints = function () {
        var flatCoordinates = this.flatCoordinates;
        var layout = this.layout;
        var stride = this.stride;
        /** @type {Array<Point>} */
        var points = [];
        for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
            var point = new _Point_js__WEBPACK_IMPORTED_MODULE_3__["default"](flatCoordinates.slice(i, i + stride), layout);
            points.push(point);
        }
        return points;
    };
    /**
     * @inheritDoc
     * @api
     */
    MultiPoint.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_2__["default"].MULTI_POINT;
    };
    /**
     * @inheritDoc
     * @api
     */
    MultiPoint.prototype.intersectsExtent = function (extent) {
        var flatCoordinates = this.flatCoordinates;
        var stride = this.stride;
        for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
            var x = flatCoordinates[i];
            var y = flatCoordinates[i + 1];
            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["containsXY"])(extent, x, y)) {
                return true;
            }
        }
        return false;
    };
    /**
     * Set the coordinates of the multipoint.
     * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
     * @param {import("./GeometryLayout.js").default=} opt_layout Layout.
     * @override
     * @api
     */
    MultiPoint.prototype.setCoordinates = function (coordinates, opt_layout) {
        this.setLayout(opt_layout, coordinates, 1);
        if (!this.flatCoordinates) {
            this.flatCoordinates = [];
        }
        this.flatCoordinates.length = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_5__["deflateCoordinates"])(this.flatCoordinates, 0, coordinates, this.stride);
        this.changed();
    };
    return MultiPoint;
}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (MultiPoint);
//# sourceMappingURL=MultiPoint.js.map

/***/ }),

/***/ "./node_modules/ol/geom/MultiPolygon.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/geom/MultiPolygon.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _MultiPoint_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _Polygon_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _flat_area_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./flat/area.js */ "./node_modules/ol/geom/flat/area.js");
/* harmony import */ var _flat_center_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./flat/center.js */ "./node_modules/ol/geom/flat/center.js");
/* harmony import */ var _flat_closest_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./flat/closest.js */ "./node_modules/ol/geom/flat/closest.js");
/* harmony import */ var _flat_contains_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flat/contains.js */ "./node_modules/ol/geom/flat/contains.js");
/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _flat_inflate_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./flat/inflate.js */ "./node_modules/ol/geom/flat/inflate.js");
/* harmony import */ var _flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./flat/interiorpoint.js */ "./node_modules/ol/geom/flat/interiorpoint.js");
/* harmony import */ var _flat_intersectsextent_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./flat/intersectsextent.js */ "./node_modules/ol/geom/flat/intersectsextent.js");
/* harmony import */ var _flat_orient_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./flat/orient.js */ "./node_modules/ol/geom/flat/orient.js");
/* harmony import */ var _flat_simplify_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./flat/simplify.js */ "./node_modules/ol/geom/flat/simplify.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/MultiPolygon
 */

















/**
 * @classdesc
 * Multi-polygon geometry.
 *
 * @api
 */
var MultiPolygon = /** @class */ (function (_super) {
    __extends(MultiPolygon, _super);
    /**
     * @param {Array<Array<Array<import("../coordinate.js").Coordinate>>|Polygon>|Array<number>} coordinates Coordinates.
     *     For internal use, flat coordinates in combination with `opt_layout` and `opt_endss` are also accepted.
     * @param {GeometryLayout=} opt_layout Layout.
     * @param {Array<Array<number>>=} opt_endss Array of ends for internal use with flat coordinates.
     */
    function MultiPolygon(coordinates, opt_layout, opt_endss) {
        var _this = _super.call(this) || this;
        /**
         * @type {Array<Array<number>>}
         * @private
         */
        _this.endss_ = [];
        /**
         * @private
         * @type {number}
         */
        _this.flatInteriorPointsRevision_ = -1;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.flatInteriorPoints_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.maxDelta_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.maxDeltaRevision_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.orientedRevision_ = -1;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.orientedFlatCoordinates_ = null;
        if (!opt_endss && !Array.isArray(coordinates[0])) {
            var layout = _this.getLayout();
            var polygons = /** @type {Array<Polygon>} */ (coordinates);
            var flatCoordinates = [];
            var endss = [];
            for (var i = 0, ii = polygons.length; i < ii; ++i) {
                var polygon = polygons[i];
                if (i === 0) {
                    layout = polygon.getLayout();
                }
                var offset = flatCoordinates.length;
                var ends = polygon.getEnds();
                for (var j = 0, jj = ends.length; j < jj; ++j) {
                    ends[j] += offset;
                }
                Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(flatCoordinates, polygon.getFlatCoordinates());
                endss.push(ends);
            }
            opt_layout = layout;
            coordinates = flatCoordinates;
            opt_endss = endss;
        }
        if (opt_layout !== undefined && opt_endss) {
            _this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
            _this.endss_ = opt_endss;
        }
        else {
            _this.setCoordinates(/** @type {Array<Array<Array<import("../coordinate.js").Coordinate>>>} */ (coordinates), opt_layout);
        }
        return _this;
    }
    /**
     * Append the passed polygon to this multipolygon.
     * @param {Polygon} polygon Polygon.
     * @api
     */
    MultiPolygon.prototype.appendPolygon = function (polygon) {
        /** @type {Array<number>} */
        var ends;
        if (!this.flatCoordinates) {
            this.flatCoordinates = polygon.getFlatCoordinates().slice();
            ends = polygon.getEnds().slice();
            this.endss_.push();
        }
        else {
            var offset = this.flatCoordinates.length;
            Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(this.flatCoordinates, polygon.getFlatCoordinates());
            ends = polygon.getEnds().slice();
            for (var i = 0, ii = ends.length; i < ii; ++i) {
                ends[i] += offset;
            }
        }
        this.endss_.push(ends);
        this.changed();
    };
    /**
     * Make a complete copy of the geometry.
     * @return {!MultiPolygon} Clone.
     * @override
     * @api
     */
    MultiPolygon.prototype.clone = function () {
        var len = this.endss_.length;
        var newEndss = new Array(len);
        for (var i = 0; i < len; ++i) {
            newEndss[i] = this.endss_[i].slice();
        }
        return new MultiPolygon(this.flatCoordinates.slice(), this.layout, newEndss);
    };
    /**
     * @inheritDoc
     */
    MultiPolygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        if (minSquaredDistance < Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["closestSquaredDistanceXY"])(this.getExtent(), x, y)) {
            return minSquaredDistance;
        }
        if (this.maxDeltaRevision_ != this.getRevision()) {
            this.maxDelta_ = Math.sqrt(Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_9__["multiArrayMaxSquaredDelta"])(this.flatCoordinates, 0, this.endss_, this.stride, 0));
            this.maxDeltaRevision_ = this.getRevision();
        }
        return Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_9__["assignClosestMultiArrayPoint"])(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
    };
    /**
     * @inheritDoc
     */
    MultiPolygon.prototype.containsXY = function (x, y) {
        return Object(_flat_contains_js__WEBPACK_IMPORTED_MODULE_10__["linearRingssContainsXY"])(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, x, y);
    };
    /**
     * Return the area of the multipolygon on projected plane.
     * @return {number} Area (on projected plane).
     * @api
     */
    MultiPolygon.prototype.getArea = function () {
        return Object(_flat_area_js__WEBPACK_IMPORTED_MODULE_7__["linearRingss"])(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride);
    };
    /**
     * Get the coordinate array for this geometry.  This array has the structure
     * of a GeoJSON coordinate array for multi-polygons.
     *
     * @param {boolean=} opt_right Orient coordinates according to the right-hand
     *     rule (counter-clockwise for exterior and clockwise for interior rings).
     *     If `false`, coordinates will be oriented according to the left-hand rule
     *     (clockwise for exterior and counter-clockwise for interior rings).
     *     By default, coordinate orientation will depend on how the geometry was
     *     constructed.
     * @return {Array<Array<Array<import("../coordinate.js").Coordinate>>>} Coordinates.
     * @override
     * @api
     */
    MultiPolygon.prototype.getCoordinates = function (opt_right) {
        var flatCoordinates;
        if (opt_right !== undefined) {
            flatCoordinates = this.getOrientedFlatCoordinates().slice();
            Object(_flat_orient_js__WEBPACK_IMPORTED_MODULE_15__["orientLinearRingsArray"])(flatCoordinates, 0, this.endss_, this.stride, opt_right);
        }
        else {
            flatCoordinates = this.flatCoordinates;
        }
        return Object(_flat_inflate_js__WEBPACK_IMPORTED_MODULE_12__["inflateMultiCoordinatesArray"])(flatCoordinates, 0, this.endss_, this.stride);
    };
    /**
     * @return {Array<Array<number>>} Endss.
     */
    MultiPolygon.prototype.getEndss = function () {
        return this.endss_;
    };
    /**
     * @return {Array<number>} Flat interior points.
     */
    MultiPolygon.prototype.getFlatInteriorPoints = function () {
        if (this.flatInteriorPointsRevision_ != this.getRevision()) {
            var flatCenters = Object(_flat_center_js__WEBPACK_IMPORTED_MODULE_8__["linearRingss"])(this.flatCoordinates, 0, this.endss_, this.stride);
            this.flatInteriorPoints_ = Object(_flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_13__["getInteriorPointsOfMultiArray"])(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, flatCenters);
            this.flatInteriorPointsRevision_ = this.getRevision();
        }
        return this.flatInteriorPoints_;
    };
    /**
     * Return the interior points as {@link module:ol/geom/MultiPoint multipoint}.
     * @return {MultiPoint} Interior points as XYM coordinates, where M is
     * the length of the horizontal intersection that the point belongs to.
     * @api
     */
    MultiPolygon.prototype.getInteriorPoints = function () {
        return new _MultiPoint_js__WEBPACK_IMPORTED_MODULE_4__["default"](this.getFlatInteriorPoints().slice(), _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XYM);
    };
    /**
     * @return {Array<number>} Oriented flat coordinates.
     */
    MultiPolygon.prototype.getOrientedFlatCoordinates = function () {
        if (this.orientedRevision_ != this.getRevision()) {
            var flatCoordinates = this.flatCoordinates;
            if (Object(_flat_orient_js__WEBPACK_IMPORTED_MODULE_15__["linearRingssAreOriented"])(flatCoordinates, 0, this.endss_, this.stride)) {
                this.orientedFlatCoordinates_ = flatCoordinates;
            }
            else {
                this.orientedFlatCoordinates_ = flatCoordinates.slice();
                this.orientedFlatCoordinates_.length =
                    Object(_flat_orient_js__WEBPACK_IMPORTED_MODULE_15__["orientLinearRingsArray"])(this.orientedFlatCoordinates_, 0, this.endss_, this.stride);
            }
            this.orientedRevision_ = this.getRevision();
        }
        return this.orientedFlatCoordinates_;
    };
    /**
     * @inheritDoc
     */
    MultiPolygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
        var simplifiedFlatCoordinates = [];
        var simplifiedEndss = [];
        simplifiedFlatCoordinates.length = Object(_flat_simplify_js__WEBPACK_IMPORTED_MODULE_16__["quantizeMultiArray"])(this.flatCoordinates, 0, this.endss_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEndss);
        return new MultiPolygon(simplifiedFlatCoordinates, _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XY, simplifiedEndss);
    };
    /**
     * Return the polygon at the specified index.
     * @param {number} index Index.
     * @return {Polygon} Polygon.
     * @api
     */
    MultiPolygon.prototype.getPolygon = function (index) {
        if (index < 0 || this.endss_.length <= index) {
            return null;
        }
        var offset;
        if (index === 0) {
            offset = 0;
        }
        else {
            var prevEnds = this.endss_[index - 1];
            offset = prevEnds[prevEnds.length - 1];
        }
        var ends = this.endss_[index].slice();
        var end = ends[ends.length - 1];
        if (offset !== 0) {
            for (var i = 0, ii = ends.length; i < ii; ++i) {
                ends[i] -= offset;
            }
        }
        return new _Polygon_js__WEBPACK_IMPORTED_MODULE_5__["default"](this.flatCoordinates.slice(offset, end), this.layout, ends);
    };
    /**
     * Return the polygons of this multipolygon.
     * @return {Array<Polygon>} Polygons.
     * @api
     */
    MultiPolygon.prototype.getPolygons = function () {
        var layout = this.layout;
        var flatCoordinates = this.flatCoordinates;
        var endss = this.endss_;
        var polygons = [];
        var offset = 0;
        for (var i = 0, ii = endss.length; i < ii; ++i) {
            var ends = endss[i].slice();
            var end = ends[ends.length - 1];
            if (offset !== 0) {
                for (var j = 0, jj = ends.length; j < jj; ++j) {
                    ends[j] -= offset;
                }
            }
            var polygon = new _Polygon_js__WEBPACK_IMPORTED_MODULE_5__["default"](flatCoordinates.slice(offset, end), layout, ends);
            polygons.push(polygon);
            offset = end;
        }
        return polygons;
    };
    /**
     * @inheritDoc
     * @api
     */
    MultiPolygon.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].MULTI_POLYGON;
    };
    /**
     * @inheritDoc
     * @api
     */
    MultiPolygon.prototype.intersectsExtent = function (extent) {
        return Object(_flat_intersectsextent_js__WEBPACK_IMPORTED_MODULE_14__["intersectsLinearRingMultiArray"])(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, extent);
    };
    /**
     * Set the coordinates of the multipolygon.
     * @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates.
     * @param {GeometryLayout=} opt_layout Layout.
     * @override
     * @api
     */
    MultiPolygon.prototype.setCoordinates = function (coordinates, opt_layout) {
        this.setLayout(opt_layout, coordinates, 3);
        if (!this.flatCoordinates) {
            this.flatCoordinates = [];
        }
        var endss = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_11__["deflateMultiCoordinatesArray"])(this.flatCoordinates, 0, coordinates, this.stride, this.endss_);
        if (endss.length === 0) {
            this.flatCoordinates.length = 0;
        }
        else {
            var lastEnds = endss[endss.length - 1];
            this.flatCoordinates.length = lastEnds.length === 0 ?
                0 : lastEnds[lastEnds.length - 1];
        }
        this.changed();
    };
    return MultiPolygon;
}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (MultiPolygon);
//# sourceMappingURL=MultiPolygon.js.map

/***/ }),

/***/ "./node_modules/ol/geom/Point.js":
/*!***************************************!*\
  !*** ./node_modules/ol/geom/Point.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/Point
 */





/**
 * @classdesc
 * Point geometry.
 *
 * @api
 */
var Point = /** @class */ (function (_super) {
    __extends(Point, _super);
    /**
     * @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
     * @param {import("./GeometryLayout.js").default=} opt_layout Layout.
     */
    function Point(coordinates, opt_layout) {
        var _this = _super.call(this) || this;
        _this.setCoordinates(coordinates, opt_layout);
        return _this;
    }
    /**
     * Make a complete copy of the geometry.
     * @return {!Point} Clone.
     * @override
     * @api
     */
    Point.prototype.clone = function () {
        var point = new Point(this.flatCoordinates.slice(), this.layout);
        return point;
    };
    /**
     * @inheritDoc
     */
    Point.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        var flatCoordinates = this.flatCoordinates;
        var squaredDistance = Object(_math_js__WEBPACK_IMPORTED_MODULE_4__["squaredDistance"])(x, y, flatCoordinates[0], flatCoordinates[1]);
        if (squaredDistance < minSquaredDistance) {
            var stride = this.stride;
            for (var i = 0; i < stride; ++i) {
                closestPoint[i] = flatCoordinates[i];
            }
            closestPoint.length = stride;
            return squaredDistance;
        }
        else {
            return minSquaredDistance;
        }
    };
    /**
     * Return the coordinate of the point.
     * @return {import("../coordinate.js").Coordinate} Coordinates.
     * @override
     * @api
     */
    Point.prototype.getCoordinates = function () {
        return !this.flatCoordinates ? [] : this.flatCoordinates.slice();
    };
    /**
     * @inheritDoc
     */
    Point.prototype.computeExtent = function (extent) {
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createOrUpdateFromCoordinate"])(this.flatCoordinates, extent);
    };
    /**
     * @inheritDoc
     * @api
     */
    Point.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINT;
    };
    /**
     * @inheritDoc
     * @api
     */
    Point.prototype.intersectsExtent = function (extent) {
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["containsXY"])(extent, this.flatCoordinates[0], this.flatCoordinates[1]);
    };
    /**
     * @inheritDoc
     * @api
     */
    Point.prototype.setCoordinates = function (coordinates, opt_layout) {
        this.setLayout(opt_layout, coordinates, 0);
        if (!this.flatCoordinates) {
            this.flatCoordinates = [];
        }
        this.flatCoordinates.length = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_3__["deflateCoordinate"])(this.flatCoordinates, 0, coordinates, this.stride);
        this.changed();
    };
    return Point;
}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Point);
//# sourceMappingURL=Point.js.map

/***/ }),

/***/ "./node_modules/ol/geom/Polygon.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/geom/Polygon.js ***!
  \*****************************************/
/*! exports provided: default, circular, fromExtent, fromCircle, makeRegular */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "circular", function() { return circular; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromExtent", function() { return fromExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromCircle", function() { return fromCircle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeRegular", function() { return makeRegular; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _GeometryType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _LinearRing_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./LinearRing.js */ "./node_modules/ol/geom/LinearRing.js");
/* harmony import */ var _Point_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _sphere_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../sphere.js */ "./node_modules/ol/sphere.js");
/* harmony import */ var _flat_area_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./flat/area.js */ "./node_modules/ol/geom/flat/area.js");
/* harmony import */ var _flat_closest_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./flat/closest.js */ "./node_modules/ol/geom/flat/closest.js");
/* harmony import */ var _flat_contains_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flat/contains.js */ "./node_modules/ol/geom/flat/contains.js");
/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./flat/deflate.js */ "./node_modules/ol/geom/flat/deflate.js");
/* harmony import */ var _flat_inflate_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./flat/inflate.js */ "./node_modules/ol/geom/flat/inflate.js");
/* harmony import */ var _flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./flat/interiorpoint.js */ "./node_modules/ol/geom/flat/interiorpoint.js");
/* harmony import */ var _flat_intersectsextent_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./flat/intersectsextent.js */ "./node_modules/ol/geom/flat/intersectsextent.js");
/* harmony import */ var _flat_orient_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./flat/orient.js */ "./node_modules/ol/geom/flat/orient.js");
/* harmony import */ var _flat_simplify_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./flat/simplify.js */ "./node_modules/ol/geom/flat/simplify.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/Polygon
 */


















/**
 * @classdesc
 * Polygon geometry.
 *
 * @api
 */
var Polygon = /** @class */ (function (_super) {
    __extends(Polygon, _super);
    /**
     * @param {!Array<Array<import("../coordinate.js").Coordinate>>|!Array<number>} coordinates
     *     Array of linear rings that define the polygon. The first linear ring of the
     *     array defines the outer-boundary or surface of the polygon. Each subsequent
     *     linear ring defines a hole in the surface of the polygon. A linear ring is
     *     an array of vertices' coordinates where the first coordinate and the last are
     *     equivalent. (For internal use, flat coordinates in combination with
     *     `opt_layout` and `opt_ends` are also accepted.)
     * @param {GeometryLayout=} opt_layout Layout.
     * @param {Array<number>=} opt_ends Ends (for internal use with flat coordinates).
     */
    function Polygon(coordinates, opt_layout, opt_ends) {
        var _this = _super.call(this) || this;
        /**
         * @type {Array<number>}
         * @private
         */
        _this.ends_ = [];
        /**
         * @private
         * @type {number}
         */
        _this.flatInteriorPointRevision_ = -1;
        /**
         * @private
         * @type {import("../coordinate.js").Coordinate}
         */
        _this.flatInteriorPoint_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.maxDelta_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.maxDeltaRevision_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.orientedRevision_ = -1;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.orientedFlatCoordinates_ = null;
        if (opt_layout !== undefined && opt_ends) {
            _this.setFlatCoordinates(opt_layout, /** @type {Array<number>} */ (coordinates));
            _this.ends_ = opt_ends;
        }
        else {
            _this.setCoordinates(/** @type {Array<Array<import("../coordinate.js").Coordinate>>} */ (coordinates), opt_layout);
        }
        return _this;
    }
    /**
     * Append the passed linear ring to this polygon.
     * @param {LinearRing} linearRing Linear ring.
     * @api
     */
    Polygon.prototype.appendLinearRing = function (linearRing) {
        if (!this.flatCoordinates) {
            this.flatCoordinates = linearRing.getFlatCoordinates().slice();
        }
        else {
            Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(this.flatCoordinates, linearRing.getFlatCoordinates());
        }
        this.ends_.push(this.flatCoordinates.length);
        this.changed();
    };
    /**
     * Make a complete copy of the geometry.
     * @return {!Polygon} Clone.
     * @override
     * @api
     */
    Polygon.prototype.clone = function () {
        return new Polygon(this.flatCoordinates.slice(), this.layout, this.ends_.slice());
    };
    /**
     * @inheritDoc
     */
    Polygon.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) {
        if (minSquaredDistance < Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["closestSquaredDistanceXY"])(this.getExtent(), x, y)) {
            return minSquaredDistance;
        }
        if (this.maxDeltaRevision_ != this.getRevision()) {
            this.maxDelta_ = Math.sqrt(Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_9__["arrayMaxSquaredDelta"])(this.flatCoordinates, 0, this.ends_, this.stride, 0));
            this.maxDeltaRevision_ = this.getRevision();
        }
        return Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_9__["assignClosestArrayPoint"])(this.flatCoordinates, 0, this.ends_, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance);
    };
    /**
     * @inheritDoc
     */
    Polygon.prototype.containsXY = function (x, y) {
        return Object(_flat_contains_js__WEBPACK_IMPORTED_MODULE_10__["linearRingsContainsXY"])(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y);
    };
    /**
     * Return the area of the polygon on projected plane.
     * @return {number} Area (on projected plane).
     * @api
     */
    Polygon.prototype.getArea = function () {
        return Object(_flat_area_js__WEBPACK_IMPORTED_MODULE_8__["linearRings"])(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride);
    };
    /**
     * Get the coordinate array for this geometry.  This array has the structure
     * of a GeoJSON coordinate array for polygons.
     *
     * @param {boolean=} opt_right Orient coordinates according to the right-hand
     *     rule (counter-clockwise for exterior and clockwise for interior rings).
     *     If `false`, coordinates will be oriented according to the left-hand rule
     *     (clockwise for exterior and counter-clockwise for interior rings).
     *     By default, coordinate orientation will depend on how the geometry was
     *     constructed.
     * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
     * @override
     * @api
     */
    Polygon.prototype.getCoordinates = function (opt_right) {
        var flatCoordinates;
        if (opt_right !== undefined) {
            flatCoordinates = this.getOrientedFlatCoordinates().slice();
            Object(_flat_orient_js__WEBPACK_IMPORTED_MODULE_15__["orientLinearRings"])(flatCoordinates, 0, this.ends_, this.stride, opt_right);
        }
        else {
            flatCoordinates = this.flatCoordinates;
        }
        return Object(_flat_inflate_js__WEBPACK_IMPORTED_MODULE_12__["inflateCoordinatesArray"])(flatCoordinates, 0, this.ends_, this.stride);
    };
    /**
     * @return {Array<number>} Ends.
     */
    Polygon.prototype.getEnds = function () {
        return this.ends_;
    };
    /**
     * @return {Array<number>} Interior point.
     */
    Polygon.prototype.getFlatInteriorPoint = function () {
        if (this.flatInteriorPointRevision_ != this.getRevision()) {
            var flatCenter = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getCenter"])(this.getExtent());
            this.flatInteriorPoint_ = Object(_flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_13__["getInteriorPointOfArray"])(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, flatCenter, 0);
            this.flatInteriorPointRevision_ = this.getRevision();
        }
        return this.flatInteriorPoint_;
    };
    /**
     * Return an interior point of the polygon.
     * @return {Point} Interior point as XYM coordinate, where M is the
     * length of the horizontal intersection that the point belongs to.
     * @api
     */
    Polygon.prototype.getInteriorPoint = function () {
        return new _Point_js__WEBPACK_IMPORTED_MODULE_5__["default"](this.getFlatInteriorPoint(), _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XYM);
    };
    /**
     * Return the number of rings of the polygon,  this includes the exterior
     * ring and any interior rings.
     *
     * @return {number} Number of rings.
     * @api
     */
    Polygon.prototype.getLinearRingCount = function () {
        return this.ends_.length;
    };
    /**
     * Return the Nth linear ring of the polygon geometry. Return `null` if the
     * given index is out of range.
     * The exterior linear ring is available at index `0` and the interior rings
     * at index `1` and beyond.
     *
     * @param {number} index Index.
     * @return {LinearRing} Linear ring.
     * @api
     */
    Polygon.prototype.getLinearRing = function (index) {
        if (index < 0 || this.ends_.length <= index) {
            return null;
        }
        return new _LinearRing_js__WEBPACK_IMPORTED_MODULE_4__["default"](this.flatCoordinates.slice(index === 0 ? 0 : this.ends_[index - 1], this.ends_[index]), this.layout);
    };
    /**
     * Return the linear rings of the polygon.
     * @return {Array<LinearRing>} Linear rings.
     * @api
     */
    Polygon.prototype.getLinearRings = function () {
        var layout = this.layout;
        var flatCoordinates = this.flatCoordinates;
        var ends = this.ends_;
        var linearRings = [];
        var offset = 0;
        for (var i = 0, ii = ends.length; i < ii; ++i) {
            var end = ends[i];
            var linearRing = new _LinearRing_js__WEBPACK_IMPORTED_MODULE_4__["default"](flatCoordinates.slice(offset, end), layout);
            linearRings.push(linearRing);
            offset = end;
        }
        return linearRings;
    };
    /**
     * @return {Array<number>} Oriented flat coordinates.
     */
    Polygon.prototype.getOrientedFlatCoordinates = function () {
        if (this.orientedRevision_ != this.getRevision()) {
            var flatCoordinates = this.flatCoordinates;
            if (Object(_flat_orient_js__WEBPACK_IMPORTED_MODULE_15__["linearRingsAreOriented"])(flatCoordinates, 0, this.ends_, this.stride)) {
                this.orientedFlatCoordinates_ = flatCoordinates;
            }
            else {
                this.orientedFlatCoordinates_ = flatCoordinates.slice();
                this.orientedFlatCoordinates_.length =
                    Object(_flat_orient_js__WEBPACK_IMPORTED_MODULE_15__["orientLinearRings"])(this.orientedFlatCoordinates_, 0, this.ends_, this.stride);
            }
            this.orientedRevision_ = this.getRevision();
        }
        return this.orientedFlatCoordinates_;
    };
    /**
     * @inheritDoc
     */
    Polygon.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
        var simplifiedFlatCoordinates = [];
        var simplifiedEnds = [];
        simplifiedFlatCoordinates.length = Object(_flat_simplify_js__WEBPACK_IMPORTED_MODULE_16__["quantizeArray"])(this.flatCoordinates, 0, this.ends_, this.stride, Math.sqrt(squaredTolerance), simplifiedFlatCoordinates, 0, simplifiedEnds);
        return new Polygon(simplifiedFlatCoordinates, _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XY, simplifiedEnds);
    };
    /**
     * @inheritDoc
     * @api
     */
    Polygon.prototype.getType = function () {
        return _GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POLYGON;
    };
    /**
     * @inheritDoc
     * @api
     */
    Polygon.prototype.intersectsExtent = function (extent) {
        return Object(_flat_intersectsextent_js__WEBPACK_IMPORTED_MODULE_14__["intersectsLinearRingArray"])(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, extent);
    };
    /**
     * Set the coordinates of the polygon.
     * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
     * @param {GeometryLayout=} opt_layout Layout.
     * @override
     * @api
     */
    Polygon.prototype.setCoordinates = function (coordinates, opt_layout) {
        this.setLayout(opt_layout, coordinates, 2);
        if (!this.flatCoordinates) {
            this.flatCoordinates = [];
        }
        var ends = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_11__["deflateCoordinatesArray"])(this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
        this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
        this.changed();
    };
    return Polygon;
}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Polygon);
/**
 * Create an approximation of a circle on the surface of a sphere.
 * @param {import("../coordinate.js").Coordinate} center Center (`[lon, lat]` in degrees).
 * @param {number} radius The great-circle distance from the center to
 *     the polygon vertices.
 * @param {number=} opt_n Optional number of vertices for the resulting
 *     polygon. Default is `32`.
 * @param {number=} opt_sphereRadius Optional radius for the sphere (defaults to
 *     the Earth's mean radius using the WGS84 ellipsoid).
 * @return {Polygon} The "circular" polygon.
 * @api
 */
function circular(center, radius, opt_n, opt_sphereRadius) {
    var n = opt_n ? opt_n : 32;
    /** @type {Array<number>} */
    var flatCoordinates = [];
    for (var i = 0; i < n; ++i) {
        Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(flatCoordinates, Object(_sphere_js__WEBPACK_IMPORTED_MODULE_7__["offset"])(center, radius, 2 * Math.PI * i / n, opt_sphereRadius));
    }
    flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
    return new Polygon(flatCoordinates, _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XY, [flatCoordinates.length]);
}
/**
 * Create a polygon from an extent. The layout used is `XY`.
 * @param {import("../extent.js").Extent} extent The extent.
 * @return {Polygon} The polygon.
 * @api
 */
function fromExtent(extent) {
    var minX = extent[0];
    var minY = extent[1];
    var maxX = extent[2];
    var maxY = extent[3];
    var flatCoordinates = [minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY];
    return new Polygon(flatCoordinates, _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_2__["default"].XY, [flatCoordinates.length]);
}
/**
 * Create a regular polygon from a circle.
 * @param {import("./Circle.js").default} circle Circle geometry.
 * @param {number=} opt_sides Number of sides of the polygon. Default is 32.
 * @param {number=} opt_angle Start angle for the first vertex of the polygon in
 *     radians. Default is 0.
 * @return {Polygon} Polygon geometry.
 * @api
 */
function fromCircle(circle, opt_sides, opt_angle) {
    var sides = opt_sides ? opt_sides : 32;
    var stride = circle.getStride();
    var layout = circle.getLayout();
    var center = circle.getCenter();
    var arrayLength = stride * (sides + 1);
    var flatCoordinates = new Array(arrayLength);
    for (var i = 0; i < arrayLength; i += stride) {
        flatCoordinates[i] = 0;
        flatCoordinates[i + 1] = 0;
        for (var j = 2; j < stride; j++) {
            flatCoordinates[i + j] = center[j];
        }
    }
    var ends = [flatCoordinates.length];
    var polygon = new Polygon(flatCoordinates, layout, ends);
    makeRegular(polygon, center, circle.getRadius(), opt_angle);
    return polygon;
}
/**
 * Modify the coordinates of a polygon to make it a regular polygon.
 * @param {Polygon} polygon Polygon geometry.
 * @param {import("../coordinate.js").Coordinate} center Center of the regular polygon.
 * @param {number} radius Radius of the regular polygon.
 * @param {number=} opt_angle Start angle for the first vertex of the polygon in
 *     radians. Default is 0.
 */
function makeRegular(polygon, center, radius, opt_angle) {
    var flatCoordinates = polygon.getFlatCoordinates();
    var stride = polygon.getStride();
    var sides = flatCoordinates.length / stride - 1;
    var startAngle = opt_angle ? opt_angle : 0;
    for (var i = 0; i <= sides; ++i) {
        var offset = i * stride;
        var angle = startAngle + (Object(_math_js__WEBPACK_IMPORTED_MODULE_17__["modulo"])(i, sides) * 2 * Math.PI / sides);
        flatCoordinates[offset] = center[0] + (radius * Math.cos(angle));
        flatCoordinates[offset + 1] = center[1] + (radius * Math.sin(angle));
    }
    polygon.changed();
}
//# sourceMappingURL=Polygon.js.map

/***/ }),

/***/ "./node_modules/ol/geom/SimpleGeometry.js":
/*!************************************************!*\
  !*** ./node_modules/ol/geom/SimpleGeometry.js ***!
  \************************************************/
/*! exports provided: getStrideForLayout, transformGeom2D, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStrideForLayout", function() { return getStrideForLayout; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformGeom2D", function() { return transformGeom2D; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Geometry_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Geometry.js */ "./node_modules/ol/geom/Geometry.js");
/* harmony import */ var _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _flat_transform_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./flat/transform.js */ "./node_modules/ol/geom/flat/transform.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/geom/SimpleGeometry
 */





/**
 * @classdesc
 * Abstract base class; only used for creating subclasses; do not instantiate
 * in apps, as cannot be rendered.
 *
 * @abstract
 * @api
 */
var SimpleGeometry = /** @class */ (function (_super) {
    __extends(SimpleGeometry, _super);
    function SimpleGeometry() {
        var _this = _super.call(this) || this;
        /**
         * @protected
         * @type {GeometryLayout}
         */
        _this.layout = _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XY;
        /**
         * @protected
         * @type {number}
         */
        _this.stride = 2;
        /**
         * @protected
         * @type {Array<number>}
         */
        _this.flatCoordinates = null;
        return _this;
    }
    /**
     * @inheritDoc
     */
    SimpleGeometry.prototype.computeExtent = function (extent) {
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createOrUpdateFromFlatCoordinates"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, extent);
    };
    /**
     * @abstract
     * @return {Array<*>} Coordinates.
     */
    SimpleGeometry.prototype.getCoordinates = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Return the first coordinate of the geometry.
     * @return {import("../coordinate.js").Coordinate} First coordinate.
     * @api
     */
    SimpleGeometry.prototype.getFirstCoordinate = function () {
        return this.flatCoordinates.slice(0, this.stride);
    };
    /**
     * @return {Array<number>} Flat coordinates.
     */
    SimpleGeometry.prototype.getFlatCoordinates = function () {
        return this.flatCoordinates;
    };
    /**
     * Return the last coordinate of the geometry.
     * @return {import("../coordinate.js").Coordinate} Last point.
     * @api
     */
    SimpleGeometry.prototype.getLastCoordinate = function () {
        return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride);
    };
    /**
     * Return the {@link module:ol/geom/GeometryLayout layout} of the geometry.
     * @return {GeometryLayout} Layout.
     * @api
     */
    SimpleGeometry.prototype.getLayout = function () {
        return this.layout;
    };
    /**
     * @inheritDoc
     */
    SimpleGeometry.prototype.getSimplifiedGeometry = function (squaredTolerance) {
        if (this.simplifiedGeometryRevision !== this.getRevision()) {
            this.simplifiedGeometryMaxMinSquaredTolerance = 0;
            this.simplifiedGeometryRevision = this.getRevision();
        }
        // If squaredTolerance is negative or if we know that simplification will not
        // have any effect then just return this.
        if (squaredTolerance < 0 ||
            (this.simplifiedGeometryMaxMinSquaredTolerance !== 0 &&
                squaredTolerance <= this.simplifiedGeometryMaxMinSquaredTolerance)) {
            return this;
        }
        var simplifiedGeometry = this.getSimplifiedGeometryInternal(squaredTolerance);
        var simplifiedFlatCoordinates = simplifiedGeometry.getFlatCoordinates();
        if (simplifiedFlatCoordinates.length < this.flatCoordinates.length) {
            return simplifiedGeometry;
        }
        else {
            // Simplification did not actually remove any coordinates.  We now know
            // that any calls to getSimplifiedGeometry with a squaredTolerance less
            // than or equal to the current squaredTolerance will also not have any
            // effect.  This allows us to short circuit simplification (saving CPU
            // cycles) and prevents the cache of simplified geometries from filling
            // up with useless identical copies of this geometry (saving memory).
            this.simplifiedGeometryMaxMinSquaredTolerance = squaredTolerance;
            return this;
        }
    };
    /**
     * @param {number} squaredTolerance Squared tolerance.
     * @return {SimpleGeometry} Simplified geometry.
     * @protected
     */
    SimpleGeometry.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) {
        return this;
    };
    /**
     * @return {number} Stride.
     */
    SimpleGeometry.prototype.getStride = function () {
        return this.stride;
    };
    /**
     * @param {GeometryLayout} layout Layout.
     * @param {Array<number>} flatCoordinates Flat coordinates.
     */
    SimpleGeometry.prototype.setFlatCoordinates = function (layout, flatCoordinates) {
        this.stride = getStrideForLayout(layout);
        this.layout = layout;
        this.flatCoordinates = flatCoordinates;
    };
    /**
     * @abstract
     * @param {!Array<*>} coordinates Coordinates.
     * @param {GeometryLayout=} opt_layout Layout.
     */
    SimpleGeometry.prototype.setCoordinates = function (coordinates, opt_layout) {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @param {GeometryLayout|undefined} layout Layout.
     * @param {Array<*>} coordinates Coordinates.
     * @param {number} nesting Nesting.
     * @protected
     */
    SimpleGeometry.prototype.setLayout = function (layout, coordinates, nesting) {
        /** @type {number} */
        var stride;
        if (layout) {
            stride = getStrideForLayout(layout);
        }
        else {
            for (var i = 0; i < nesting; ++i) {
                if (coordinates.length === 0) {
                    this.layout = _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XY;
                    this.stride = 2;
                    return;
                }
                else {
                    coordinates = /** @type {Array} */ (coordinates[0]);
                }
            }
            stride = coordinates.length;
            layout = getLayoutForStride(stride);
        }
        this.layout = layout;
        this.stride = stride;
    };
    /**
     * Apply a transform function to the coordinates of the geometry.
     * The geometry is modified in place.
     * If you do not want the geometry modified in place, first `clone()` it and
     * then use this function on the clone.
     * @param {import("../proj.js").TransformFunction} transformFn Transform function.
     * Called with a flat array of geometry coordinates.
     * @api
     */
    SimpleGeometry.prototype.applyTransform = function (transformFn) {
        if (this.flatCoordinates) {
            transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);
            this.changed();
        }
    };
    /**
     * Rotate the geometry around a given coordinate. This modifies the geometry
     * coordinates in place.
     * @param {number} angle Rotation angle in radians.
     * @param {import("../coordinate.js").Coordinate} anchor The rotation center.
     * @api
     */
    SimpleGeometry.prototype.rotate = function (angle, anchor) {
        var flatCoordinates = this.getFlatCoordinates();
        if (flatCoordinates) {
            var stride = this.getStride();
            Object(_flat_transform_js__WEBPACK_IMPORTED_MODULE_4__["rotate"])(flatCoordinates, 0, flatCoordinates.length, stride, angle, anchor, flatCoordinates);
            this.changed();
        }
    };
    /**
     * Scale the geometry (with an optional origin).  This modifies the geometry
     * coordinates in place.
      * @param {number} sx The scaling factor in the x-direction.
     * @param {number=} opt_sy The scaling factor in the y-direction (defaults to
     *     sx).
     * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center
     *     of the geometry extent).
     * @api
     */
    SimpleGeometry.prototype.scale = function (sx, opt_sy, opt_anchor) {
        var sy = opt_sy;
        if (sy === undefined) {
            sy = sx;
        }
        var anchor = opt_anchor;
        if (!anchor) {
            anchor = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getCenter"])(this.getExtent());
        }
        var flatCoordinates = this.getFlatCoordinates();
        if (flatCoordinates) {
            var stride = this.getStride();
            Object(_flat_transform_js__WEBPACK_IMPORTED_MODULE_4__["scale"])(flatCoordinates, 0, flatCoordinates.length, stride, sx, sy, anchor, flatCoordinates);
            this.changed();
        }
    };
    /**
     * Translate the geometry.  This modifies the geometry coordinates in place.  If
     * instead you want a new geometry, first `clone()` this geometry.
     * @param {number} deltaX Delta X.
     * @param {number} deltaY Delta Y.
     * @api
     */
    SimpleGeometry.prototype.translate = function (deltaX, deltaY) {
        var flatCoordinates = this.getFlatCoordinates();
        if (flatCoordinates) {
            var stride = this.getStride();
            Object(_flat_transform_js__WEBPACK_IMPORTED_MODULE_4__["translate"])(flatCoordinates, 0, flatCoordinates.length, stride, deltaX, deltaY, flatCoordinates);
            this.changed();
        }
    };
    return SimpleGeometry;
}(_Geometry_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * @param {number} stride Stride.
 * @return {GeometryLayout} layout Layout.
 */
function getLayoutForStride(stride) {
    var layout;
    if (stride == 2) {
        layout = _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XY;
    }
    else if (stride == 3) {
        layout = _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XYZ;
    }
    else if (stride == 4) {
        layout = _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XYZM;
    }
    return (
    /** @type {GeometryLayout} */ (layout));
}
/**
 * @param {GeometryLayout} layout Layout.
 * @return {number} Stride.
 */
function getStrideForLayout(layout) {
    var stride;
    if (layout == _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XY) {
        stride = 2;
    }
    else if (layout == _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XYZ || layout == _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XYM) {
        stride = 3;
    }
    else if (layout == _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_3__["default"].XYZM) {
        stride = 4;
    }
    return /** @type {number} */ (stride);
}
/**
 * @param {SimpleGeometry} simpleGeometry Simple geometry.
 * @param {import("../transform.js").Transform} transform Transform.
 * @param {Array<number>=} opt_dest Destination.
 * @return {Array<number>} Transformed flat coordinates.
 */
function transformGeom2D(simpleGeometry, transform, opt_dest) {
    var flatCoordinates = simpleGeometry.getFlatCoordinates();
    if (!flatCoordinates) {
        return null;
    }
    else {
        var stride = simpleGeometry.getStride();
        return Object(_flat_transform_js__WEBPACK_IMPORTED_MODULE_4__["transform2D"])(flatCoordinates, 0, flatCoordinates.length, stride, transform, opt_dest);
    }
}
/* harmony default export */ __webpack_exports__["default"] = (SimpleGeometry);
//# sourceMappingURL=SimpleGeometry.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/area.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/geom/flat/area.js ***!
  \*******************************************/
/*! exports provided: linearRing, linearRings, linearRingss */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRing", function() { return linearRing; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRings", function() { return linearRings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingss", function() { return linearRingss; });
/**
 * @module ol/geom/flat/area
 */
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @return {number} Area.
 */
function linearRing(flatCoordinates, offset, end, stride) {
    var twiceArea = 0;
    var x1 = flatCoordinates[end - stride];
    var y1 = flatCoordinates[end - stride + 1];
    for (; offset < end; offset += stride) {
        var x2 = flatCoordinates[offset];
        var y2 = flatCoordinates[offset + 1];
        twiceArea += y1 * x2 - x1 * y2;
        x1 = x2;
        y1 = y2;
    }
    return twiceArea / 2;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @return {number} Area.
 */
function linearRings(flatCoordinates, offset, ends, stride) {
    var area = 0;
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        var end = ends[i];
        area += linearRing(flatCoordinates, offset, end, stride);
        offset = end;
    }
    return area;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @return {number} Area.
 */
function linearRingss(flatCoordinates, offset, endss, stride) {
    var area = 0;
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        area += linearRings(flatCoordinates, offset, ends, stride);
        offset = ends[ends.length - 1];
    }
    return area;
}
//# sourceMappingURL=area.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/center.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/geom/flat/center.js ***!
  \*********************************************/
/*! exports provided: linearRingss */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingss", function() { return linearRingss; });
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/**
 * @module ol/geom/flat/center
 */

/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @return {Array<number>} Flat centers.
 */
function linearRingss(flatCoordinates, offset, endss, stride) {
    var flatCenters = [];
    var extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createEmpty"])();
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createOrUpdateFromFlatCoordinates"])(flatCoordinates, offset, ends[0], stride);
        flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2);
        offset = ends[ends.length - 1];
    }
    return flatCenters;
}
//# sourceMappingURL=center.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/closest.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/geom/flat/closest.js ***!
  \**********************************************/
/*! exports provided: maxSquaredDelta, arrayMaxSquaredDelta, multiArrayMaxSquaredDelta, assignClosestPoint, assignClosestArrayPoint, assignClosestMultiArrayPoint */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "maxSquaredDelta", function() { return maxSquaredDelta; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arrayMaxSquaredDelta", function() { return arrayMaxSquaredDelta; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiArrayMaxSquaredDelta", function() { return multiArrayMaxSquaredDelta; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assignClosestPoint", function() { return assignClosestPoint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assignClosestArrayPoint", function() { return assignClosestArrayPoint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assignClosestMultiArrayPoint", function() { return assignClosestMultiArrayPoint; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math.js */ "./node_modules/ol/math.js");
/**
 * @module ol/geom/flat/closest
 */

/**
 * Returns the point on the 2D line segment flatCoordinates[offset1] to
 * flatCoordinates[offset2] that is closest to the point (x, y).  Extra
 * dimensions are linearly interpolated.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset1 Offset 1.
 * @param {number} offset2 Offset 2.
 * @param {number} stride Stride.
 * @param {number} x X.
 * @param {number} y Y.
 * @param {Array<number>} closestPoint Closest point.
 */
function assignClosest(flatCoordinates, offset1, offset2, stride, x, y, closestPoint) {
    var x1 = flatCoordinates[offset1];
    var y1 = flatCoordinates[offset1 + 1];
    var dx = flatCoordinates[offset2] - x1;
    var dy = flatCoordinates[offset2 + 1] - y1;
    var offset;
    if (dx === 0 && dy === 0) {
        offset = offset1;
    }
    else {
        var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);
        if (t > 1) {
            offset = offset2;
        }
        else if (t > 0) {
            for (var i = 0; i < stride; ++i) {
                closestPoint[i] = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["lerp"])(flatCoordinates[offset1 + i], flatCoordinates[offset2 + i], t);
            }
            closestPoint.length = stride;
            return;
        }
        else {
            offset = offset1;
        }
    }
    for (var i = 0; i < stride; ++i) {
        closestPoint[i] = flatCoordinates[offset + i];
    }
    closestPoint.length = stride;
}
/**
 * Return the squared of the largest distance between any pair of consecutive
 * coordinates.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} max Max squared delta.
 * @return {number} Max squared delta.
 */
function maxSquaredDelta(flatCoordinates, offset, end, stride, max) {
    var x1 = flatCoordinates[offset];
    var y1 = flatCoordinates[offset + 1];
    for (offset += stride; offset < end; offset += stride) {
        var x2 = flatCoordinates[offset];
        var y2 = flatCoordinates[offset + 1];
        var squaredDelta = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["squaredDistance"])(x1, y1, x2, y2);
        if (squaredDelta > max) {
            max = squaredDelta;
        }
        x1 = x2;
        y1 = y2;
    }
    return max;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {number} max Max squared delta.
 * @return {number} Max squared delta.
 */
function arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max) {
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        var end = ends[i];
        max = maxSquaredDelta(flatCoordinates, offset, end, stride, max);
        offset = end;
    }
    return max;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @param {number} max Max squared delta.
 * @return {number} Max squared delta.
 */
function multiArrayMaxSquaredDelta(flatCoordinates, offset, endss, stride, max) {
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        max = arrayMaxSquaredDelta(flatCoordinates, offset, ends, stride, max);
        offset = ends[ends.length - 1];
    }
    return max;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} maxDelta Max delta.
 * @param {boolean} isRing Is ring.
 * @param {number} x X.
 * @param {number} y Y.
 * @param {Array<number>} closestPoint Closest point.
 * @param {number} minSquaredDistance Minimum squared distance.
 * @param {Array<number>=} opt_tmpPoint Temporary point object.
 * @return {number} Minimum squared distance.
 */
function assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {
    if (offset == end) {
        return minSquaredDistance;
    }
    var i, squaredDistance;
    if (maxDelta === 0) {
        // All points are identical, so just test the first point.
        squaredDistance = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["squaredDistance"])(x, y, flatCoordinates[offset], flatCoordinates[offset + 1]);
        if (squaredDistance < minSquaredDistance) {
            for (i = 0; i < stride; ++i) {
                closestPoint[i] = flatCoordinates[offset + i];
            }
            closestPoint.length = stride;
            return squaredDistance;
        }
        else {
            return minSquaredDistance;
        }
    }
    var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
    var index = offset + stride;
    while (index < end) {
        assignClosest(flatCoordinates, index - stride, index, stride, x, y, tmpPoint);
        squaredDistance = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["squaredDistance"])(x, y, tmpPoint[0], tmpPoint[1]);
        if (squaredDistance < minSquaredDistance) {
            minSquaredDistance = squaredDistance;
            for (i = 0; i < stride; ++i) {
                closestPoint[i] = tmpPoint[i];
            }
            closestPoint.length = stride;
            index += stride;
        }
        else {
            // Skip ahead multiple points, because we know that all the skipped
            // points cannot be any closer than the closest point we have found so
            // far.  We know this because we know how close the current point is, how
            // close the closest point we have found so far is, and the maximum
            // distance between consecutive points.  For example, if we're currently
            // at distance 10, the best we've found so far is 3, and that the maximum
            // distance between consecutive points is 2, then we'll need to skip at
            // least (10 - 3) / 2 == 3 (rounded down) points to have any chance of
            // finding a closer point.  We use Math.max(..., 1) to ensure that we
            // always advance at least one point, to avoid an infinite loop.
            index += stride * Math.max(((Math.sqrt(squaredDistance) -
                Math.sqrt(minSquaredDistance)) / maxDelta) | 0, 1);
        }
    }
    if (isRing) {
        // Check the closing segment.
        assignClosest(flatCoordinates, end - stride, offset, stride, x, y, tmpPoint);
        squaredDistance = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["squaredDistance"])(x, y, tmpPoint[0], tmpPoint[1]);
        if (squaredDistance < minSquaredDistance) {
            minSquaredDistance = squaredDistance;
            for (i = 0; i < stride; ++i) {
                closestPoint[i] = tmpPoint[i];
            }
            closestPoint.length = stride;
        }
    }
    return minSquaredDistance;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {number} maxDelta Max delta.
 * @param {boolean} isRing Is ring.
 * @param {number} x X.
 * @param {number} y Y.
 * @param {Array<number>} closestPoint Closest point.
 * @param {number} minSquaredDistance Minimum squared distance.
 * @param {Array<number>=} opt_tmpPoint Temporary point object.
 * @return {number} Minimum squared distance.
 */
function assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {
    var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        var end = ends[i];
        minSquaredDistance = assignClosestPoint(flatCoordinates, offset, end, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);
        offset = end;
    }
    return minSquaredDistance;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @param {number} maxDelta Max delta.
 * @param {boolean} isRing Is ring.
 * @param {number} x X.
 * @param {number} y Y.
 * @param {Array<number>} closestPoint Closest point.
 * @param {number} minSquaredDistance Minimum squared distance.
 * @param {Array<number>=} opt_tmpPoint Temporary point object.
 * @return {number} Minimum squared distance.
 */
function assignClosestMultiArrayPoint(flatCoordinates, offset, endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) {
    var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        minSquaredDistance = assignClosestArrayPoint(flatCoordinates, offset, ends, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, tmpPoint);
        offset = ends[ends.length - 1];
    }
    return minSquaredDistance;
}
//# sourceMappingURL=closest.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/contains.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/geom/flat/contains.js ***!
  \***********************************************/
/*! exports provided: linearRingContainsExtent, linearRingContainsXY, linearRingsContainsXY, linearRingssContainsXY */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingContainsExtent", function() { return linearRingContainsExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingContainsXY", function() { return linearRingContainsXY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingsContainsXY", function() { return linearRingsContainsXY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingssContainsXY", function() { return linearRingssContainsXY; });
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/**
 * @module ol/geom/flat/contains
 */

/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {import("../../extent.js").Extent} extent Extent.
 * @return {boolean} Contains extent.
 */
function linearRingContainsExtent(flatCoordinates, offset, end, stride, extent) {
    var outside = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["forEachCorner"])(extent, 
    /**
     * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
     * @return {boolean} Contains (x, y).
     */
    function (coordinate) {
        return !linearRingContainsXY(flatCoordinates, offset, end, stride, coordinate[0], coordinate[1]);
    });
    return !outside;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} x X.
 * @param {number} y Y.
 * @return {boolean} Contains (x, y).
 */
function linearRingContainsXY(flatCoordinates, offset, end, stride, x, y) {
    // http://geomalgorithms.com/a03-_inclusion.html
    // Copyright 2000 softSurfer, 2012 Dan Sunday
    // This code may be freely used and modified for any purpose
    // providing that this copyright notice is included with it.
    // SoftSurfer makes no warranty for this code, and cannot be held
    // liable for any real or imagined damage resulting from its use.
    // Users of this code must verify correctness for their application.
    var wn = 0;
    var x1 = flatCoordinates[end - stride];
    var y1 = flatCoordinates[end - stride + 1];
    for (; offset < end; offset += stride) {
        var x2 = flatCoordinates[offset];
        var y2 = flatCoordinates[offset + 1];
        if (y1 <= y) {
            if (y2 > y && ((x2 - x1) * (y - y1)) - ((x - x1) * (y2 - y1)) > 0) {
                wn++;
            }
        }
        else if (y2 <= y && ((x2 - x1) * (y - y1)) - ((x - x1) * (y2 - y1)) < 0) {
            wn--;
        }
        x1 = x2;
        y1 = y2;
    }
    return wn !== 0;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {number} x X.
 * @param {number} y Y.
 * @return {boolean} Contains (x, y).
 */
function linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y) {
    if (ends.length === 0) {
        return false;
    }
    if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) {
        return false;
    }
    for (var i = 1, ii = ends.length; i < ii; ++i) {
        if (linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)) {
            return false;
        }
    }
    return true;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @param {number} x X.
 * @param {number} y Y.
 * @return {boolean} Contains (x, y).
 */
function linearRingssContainsXY(flatCoordinates, offset, endss, stride, x, y) {
    if (endss.length === 0) {
        return false;
    }
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) {
            return true;
        }
        offset = ends[ends.length - 1];
    }
    return false;
}
//# sourceMappingURL=contains.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/deflate.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/geom/flat/deflate.js ***!
  \**********************************************/
/*! exports provided: deflateCoordinate, deflateCoordinates, deflateCoordinatesArray, deflateMultiCoordinatesArray */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deflateCoordinate", function() { return deflateCoordinate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deflateCoordinates", function() { return deflateCoordinates; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deflateCoordinatesArray", function() { return deflateCoordinatesArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deflateMultiCoordinatesArray", function() { return deflateMultiCoordinatesArray; });
/**
 * @module ol/geom/flat/deflate
 */
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
 * @param {number} stride Stride.
 * @return {number} offset Offset.
 */
function deflateCoordinate(flatCoordinates, offset, coordinate, stride) {
    for (var i = 0, ii = coordinate.length; i < ii; ++i) {
        flatCoordinates[offset++] = coordinate[i];
    }
    return offset;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<import("../../coordinate.js").Coordinate>} coordinates Coordinates.
 * @param {number} stride Stride.
 * @return {number} offset Offset.
 */
function deflateCoordinates(flatCoordinates, offset, coordinates, stride) {
    for (var i = 0, ii = coordinates.length; i < ii; ++i) {
        var coordinate = coordinates[i];
        for (var j = 0; j < stride; ++j) {
            flatCoordinates[offset++] = coordinate[j];
        }
    }
    return offset;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<import("../../coordinate.js").Coordinate>>} coordinatess Coordinatess.
 * @param {number} stride Stride.
 * @param {Array<number>=} opt_ends Ends.
 * @return {Array<number>} Ends.
 */
function deflateCoordinatesArray(flatCoordinates, offset, coordinatess, stride, opt_ends) {
    var ends = opt_ends ? opt_ends : [];
    var i = 0;
    for (var j = 0, jj = coordinatess.length; j < jj; ++j) {
        var end = deflateCoordinates(flatCoordinates, offset, coordinatess[j], stride);
        ends[i++] = end;
        offset = end;
    }
    ends.length = i;
    return ends;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<Array<import("../../coordinate.js").Coordinate>>>} coordinatesss Coordinatesss.
 * @param {number} stride Stride.
 * @param {Array<Array<number>>=} opt_endss Endss.
 * @return {Array<Array<number>>} Endss.
 */
function deflateMultiCoordinatesArray(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
    var endss = opt_endss ? opt_endss : [];
    var i = 0;
    for (var j = 0, jj = coordinatesss.length; j < jj; ++j) {
        var ends = deflateCoordinatesArray(flatCoordinates, offset, coordinatesss[j], stride, endss[i]);
        endss[i++] = ends;
        offset = ends[ends.length - 1];
    }
    endss.length = i;
    return endss;
}
//# sourceMappingURL=deflate.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/flip.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/geom/flat/flip.js ***!
  \*******************************************/
/*! exports provided: flipXY */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "flipXY", function() { return flipXY; });
/**
 * @module ol/geom/flat/flip
 */
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {Array<number>=} opt_dest Destination.
 * @param {number=} opt_destOffset Destination offset.
 * @return {Array<number>} Flat coordinates.
 */
function flipXY(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
    var dest, destOffset;
    if (opt_dest !== undefined) {
        dest = opt_dest;
        destOffset = opt_destOffset !== undefined ? opt_destOffset : 0;
    }
    else {
        dest = [];
        destOffset = 0;
    }
    var j = offset;
    while (j < end) {
        var x = flatCoordinates[j++];
        dest[destOffset++] = flatCoordinates[j++];
        dest[destOffset++] = x;
        for (var k = 2; k < stride; ++k) {
            dest[destOffset++] = flatCoordinates[j++];
        }
    }
    dest.length = destOffset;
    return dest;
}
//# sourceMappingURL=flip.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/geodesic.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/geom/flat/geodesic.js ***!
  \***********************************************/
/*! exports provided: greatCircleArc, meridian, parallel */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "greatCircleArc", function() { return greatCircleArc; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "meridian", function() { return meridian; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parallel", function() { return parallel; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../proj.js */ "./node_modules/ol/proj.js");
/**
 * @module ol/geom/flat/geodesic
 */


/**
 * @param {function(number): import("../../coordinate.js").Coordinate} interpolate Interpolate function.
 * @param {import("../../proj.js").TransformFunction} transform Transform from longitude/latitude to
 *     projected coordinates.
 * @param {number} squaredTolerance Squared tolerance.
 * @return {Array<number>} Flat coordinates.
 */
function line(interpolate, transform, squaredTolerance) {
    // FIXME reduce garbage generation
    // FIXME optimize stack operations
    /** @type {Array<number>} */
    var flatCoordinates = [];
    var geoA = interpolate(0);
    var geoB = interpolate(1);
    var a = transform(geoA);
    var b = transform(geoB);
    /** @type {Array<import("../../coordinate.js").Coordinate>} */
    var geoStack = [geoB, geoA];
    /** @type {Array<import("../../coordinate.js").Coordinate>} */
    var stack = [b, a];
    /** @type {Array<number>} */
    var fractionStack = [1, 0];
    /** @type {!Object<string, boolean>} */
    var fractions = {};
    var maxIterations = 1e5;
    var geoM, m, fracA, fracB, fracM, key;
    while (--maxIterations > 0 && fractionStack.length > 0) {
        // Pop the a coordinate off the stack
        fracA = fractionStack.pop();
        geoA = geoStack.pop();
        a = stack.pop();
        // Add the a coordinate if it has not been added yet
        key = fracA.toString();
        if (!(key in fractions)) {
            flatCoordinates.push(a[0], a[1]);
            fractions[key] = true;
        }
        // Pop the b coordinate off the stack
        fracB = fractionStack.pop();
        geoB = geoStack.pop();
        b = stack.pop();
        // Find the m point between the a and b coordinates
        fracM = (fracA + fracB) / 2;
        geoM = interpolate(fracM);
        m = transform(geoM);
        if (Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["squaredSegmentDistance"])(m[0], m[1], a[0], a[1], b[0], b[1]) < squaredTolerance) {
            // If the m point is sufficiently close to the straight line, then we
            // discard it.  Just use the b coordinate and move on to the next line
            // segment.
            flatCoordinates.push(b[0], b[1]);
            key = fracB.toString();
            fractions[key] = true;
        }
        else {
            // Otherwise, we need to subdivide the current line segment.  Split it
            // into two and push the two line segments onto the stack.
            fractionStack.push(fracB, fracM, fracM, fracA);
            stack.push(b, m, m, a);
            geoStack.push(geoB, geoM, geoM, geoA);
        }
    }
    return flatCoordinates;
}
/**
 * Generate a great-circle arcs between two lat/lon points.
 * @param {number} lon1 Longitude 1 in degrees.
 * @param {number} lat1 Latitude 1 in degrees.
 * @param {number} lon2 Longitude 2 in degrees.
 * @param {number} lat2 Latitude 2 in degrees.
 * @param {import("../../proj/Projection.js").default} projection Projection.
 * @param {number} squaredTolerance Squared tolerance.
 * @return {Array<number>} Flat coordinates.
 */
function greatCircleArc(lon1, lat1, lon2, lat2, projection, squaredTolerance) {
    var geoProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["get"])('EPSG:4326');
    var cosLat1 = Math.cos(Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(lat1));
    var sinLat1 = Math.sin(Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(lat1));
    var cosLat2 = Math.cos(Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(lat2));
    var sinLat2 = Math.sin(Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(lat2));
    var cosDeltaLon = Math.cos(Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(lon2 - lon1));
    var sinDeltaLon = Math.sin(Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(lon2 - lon1));
    var d = sinLat1 * sinLat2 + cosLat1 * cosLat2 * cosDeltaLon;
    return line(
    /**
     * @param {number} frac Fraction.
     * @return {import("../../coordinate.js").Coordinate} Coordinate.
     */
    function (frac) {
        if (1 <= d) {
            return [lon2, lat2];
        }
        var D = frac * Math.acos(d);
        var cosD = Math.cos(D);
        var sinD = Math.sin(D);
        var y = sinDeltaLon * cosLat2;
        var x = cosLat1 * sinLat2 - sinLat1 * cosLat2 * cosDeltaLon;
        var theta = Math.atan2(y, x);
        var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));
        var lon = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(lon1) +
            Math.atan2(Math.sin(theta) * sinD * cosLat1, cosD - sinLat1 * Math.sin(lat));
        return [Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toDegrees"])(lon), Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toDegrees"])(lat)];
    }, Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["getTransform"])(geoProjection, projection), squaredTolerance);
}
/**
 * Generate a meridian (line at constant longitude).
 * @param {number} lon Longitude.
 * @param {number} lat1 Latitude 1.
 * @param {number} lat2 Latitude 2.
 * @param {import("../../proj/Projection.js").default} projection Projection.
 * @param {number} squaredTolerance Squared tolerance.
 * @return {Array<number>} Flat coordinates.
 */
function meridian(lon, lat1, lat2, projection, squaredTolerance) {
    var epsg4326Projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["get"])('EPSG:4326');
    return line(
    /**
     * @param {number} frac Fraction.
     * @return {import("../../coordinate.js").Coordinate} Coordinate.
     */
    function (frac) {
        return [lon, lat1 + ((lat2 - lat1) * frac)];
    }, Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["getTransform"])(epsg4326Projection, projection), squaredTolerance);
}
/**
 * Generate a parallel (line at constant latitude).
 * @param {number} lat Latitude.
 * @param {number} lon1 Longitude 1.
 * @param {number} lon2 Longitude 2.
 * @param {import("../../proj/Projection.js").default} projection Projection.
 * @param {number} squaredTolerance Squared tolerance.
 * @return {Array<number>} Flat coordinates.
 */
function parallel(lat, lon1, lon2, projection, squaredTolerance) {
    var epsg4326Projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["get"])('EPSG:4326');
    return line(
    /**
     * @param {number} frac Fraction.
     * @return {import("../../coordinate.js").Coordinate} Coordinate.
     */
    function (frac) {
        return [lon1 + ((lon2 - lon1) * frac), lat];
    }, Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["getTransform"])(epsg4326Projection, projection), squaredTolerance);
}
//# sourceMappingURL=geodesic.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/inflate.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/geom/flat/inflate.js ***!
  \**********************************************/
/*! exports provided: inflateCoordinates, inflateCoordinatesArray, inflateMultiCoordinatesArray */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inflateCoordinates", function() { return inflateCoordinates; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inflateCoordinatesArray", function() { return inflateCoordinatesArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inflateMultiCoordinatesArray", function() { return inflateMultiCoordinatesArray; });
/**
 * @module ol/geom/flat/inflate
 */
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {Array<import("../../coordinate.js").Coordinate>=} opt_coordinates Coordinates.
 * @return {Array<import("../../coordinate.js").Coordinate>} Coordinates.
 */
function inflateCoordinates(flatCoordinates, offset, end, stride, opt_coordinates) {
    var coordinates = opt_coordinates !== undefined ? opt_coordinates : [];
    var i = 0;
    for (var j = offset; j < end; j += stride) {
        coordinates[i++] = flatCoordinates.slice(j, j + stride);
    }
    coordinates.length = i;
    return coordinates;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {Array<Array<import("../../coordinate.js").Coordinate>>=} opt_coordinatess Coordinatess.
 * @return {Array<Array<import("../../coordinate.js").Coordinate>>} Coordinatess.
 */
function inflateCoordinatesArray(flatCoordinates, offset, ends, stride, opt_coordinatess) {
    var coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : [];
    var i = 0;
    for (var j = 0, jj = ends.length; j < jj; ++j) {
        var end = ends[j];
        coordinatess[i++] = inflateCoordinates(flatCoordinates, offset, end, stride, coordinatess[i]);
        offset = end;
    }
    coordinatess.length = i;
    return coordinatess;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @param {Array<Array<Array<import("../../coordinate.js").Coordinate>>>=} opt_coordinatesss
 *     Coordinatesss.
 * @return {Array<Array<Array<import("../../coordinate.js").Coordinate>>>} Coordinatesss.
 */
function inflateMultiCoordinatesArray(flatCoordinates, offset, endss, stride, opt_coordinatesss) {
    var coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : [];
    var i = 0;
    for (var j = 0, jj = endss.length; j < jj; ++j) {
        var ends = endss[j];
        coordinatesss[i++] = inflateCoordinatesArray(flatCoordinates, offset, ends, stride, coordinatesss[i]);
        offset = ends[ends.length - 1];
    }
    coordinatesss.length = i;
    return coordinatesss;
}
//# sourceMappingURL=inflate.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/interiorpoint.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/geom/flat/interiorpoint.js ***!
  \****************************************************/
/*! exports provided: getInteriorPointOfArray, getInteriorPointsOfMultiArray */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInteriorPointOfArray", function() { return getInteriorPointOfArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInteriorPointsOfMultiArray", function() { return getInteriorPointsOfMultiArray; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./contains.js */ "./node_modules/ol/geom/flat/contains.js");
/**
 * @module ol/geom/flat/interiorpoint
 */


/**
 * Calculates a point that is likely to lie in the interior of the linear rings.
 * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {Array<number>} flatCenters Flat centers.
 * @param {number} flatCentersOffset Flat center offset.
 * @param {Array<number>=} opt_dest Destination.
 * @return {Array<number>} Destination point as XYM coordinate, where M is the
 * length of the horizontal intersection that the point belongs to.
 */
function getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, flatCentersOffset, opt_dest) {
    var i, ii, x, x1, x2, y1, y2;
    var y = flatCenters[flatCentersOffset + 1];
    /** @type {Array<number>} */
    var intersections = [];
    // Calculate intersections with the horizontal line
    for (var r = 0, rr = ends.length; r < rr; ++r) {
        var end = ends[r];
        x1 = flatCoordinates[end - stride];
        y1 = flatCoordinates[end - stride + 1];
        for (i = offset; i < end; i += stride) {
            x2 = flatCoordinates[i];
            y2 = flatCoordinates[i + 1];
            if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) {
                x = (y - y1) / (y2 - y1) * (x2 - x1) + x1;
                intersections.push(x);
            }
            x1 = x2;
            y1 = y2;
        }
    }
    // Find the longest segment of the horizontal line that has its center point
    // inside the linear ring.
    var pointX = NaN;
    var maxSegmentLength = -Infinity;
    intersections.sort(_array_js__WEBPACK_IMPORTED_MODULE_0__["numberSafeCompareFunction"]);
    x1 = intersections[0];
    for (i = 1, ii = intersections.length; i < ii; ++i) {
        x2 = intersections[i];
        var segmentLength = Math.abs(x2 - x1);
        if (segmentLength > maxSegmentLength) {
            x = (x1 + x2) / 2;
            if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_1__["linearRingsContainsXY"])(flatCoordinates, offset, ends, stride, x, y)) {
                pointX = x;
                maxSegmentLength = segmentLength;
            }
        }
        x1 = x2;
    }
    if (isNaN(pointX)) {
        // There is no horizontal line that has its center point inside the linear
        // ring.  Use the center of the the linear ring's extent.
        pointX = flatCenters[flatCentersOffset];
    }
    if (opt_dest) {
        opt_dest.push(pointX, y, maxSegmentLength);
        return opt_dest;
    }
    else {
        return [pointX, y, maxSegmentLength];
    }
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @param {Array<number>} flatCenters Flat centers.
 * @return {Array<number>} Interior points as XYM coordinates, where M is the
 * length of the horizontal intersection that the point belongs to.
 */
function getInteriorPointsOfMultiArray(flatCoordinates, offset, endss, stride, flatCenters) {
    var interiorPoints = [];
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        interiorPoints = getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, 2 * i, interiorPoints);
        offset = ends[ends.length - 1];
    }
    return interiorPoints;
}
//# sourceMappingURL=interiorpoint.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/interpolate.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/geom/flat/interpolate.js ***!
  \**************************************************/
/*! exports provided: interpolatePoint, lineStringCoordinateAtM, lineStringsCoordinateAtM */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interpolatePoint", function() { return interpolatePoint; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineStringCoordinateAtM", function() { return lineStringCoordinateAtM; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineStringsCoordinateAtM", function() { return lineStringsCoordinateAtM; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../math.js */ "./node_modules/ol/math.js");
/**
 * @module ol/geom/flat/interpolate
 */


/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} fraction Fraction.
 * @param {Array<number>=} opt_dest Destination.
 * @return {Array<number>} Destination.
 */
function interpolatePoint(flatCoordinates, offset, end, stride, fraction, opt_dest) {
    var pointX = NaN;
    var pointY = NaN;
    var n = (end - offset) / stride;
    if (n === 1) {
        pointX = flatCoordinates[offset];
        pointY = flatCoordinates[offset + 1];
    }
    else if (n == 2) {
        pointX = (1 - fraction) * flatCoordinates[offset] +
            fraction * flatCoordinates[offset + stride];
        pointY = (1 - fraction) * flatCoordinates[offset + 1] +
            fraction * flatCoordinates[offset + stride + 1];
    }
    else if (n !== 0) {
        var x1 = flatCoordinates[offset];
        var y1 = flatCoordinates[offset + 1];
        var length_1 = 0;
        var cumulativeLengths = [0];
        for (var i = offset + stride; i < end; i += stride) {
            var x2 = flatCoordinates[i];
            var y2 = flatCoordinates[i + 1];
            length_1 += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
            cumulativeLengths.push(length_1);
            x1 = x2;
            y1 = y2;
        }
        var target = fraction * length_1;
        var index = Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["binarySearch"])(cumulativeLengths, target);
        if (index < 0) {
            var t = (target - cumulativeLengths[-index - 2]) /
                (cumulativeLengths[-index - 1] - cumulativeLengths[-index - 2]);
            var o = offset + (-index - 2) * stride;
            pointX = Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["lerp"])(flatCoordinates[o], flatCoordinates[o + stride], t);
            pointY = Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["lerp"])(flatCoordinates[o + 1], flatCoordinates[o + stride + 1], t);
        }
        else {
            pointX = flatCoordinates[offset + index * stride];
            pointY = flatCoordinates[offset + index * stride + 1];
        }
    }
    if (opt_dest) {
        opt_dest[0] = pointX;
        opt_dest[1] = pointY;
        return opt_dest;
    }
    else {
        return [pointX, pointY];
    }
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} m M.
 * @param {boolean} extrapolate Extrapolate.
 * @return {import("../../coordinate.js").Coordinate} Coordinate.
 */
function lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, extrapolate) {
    if (end == offset) {
        return null;
    }
    var coordinate;
    if (m < flatCoordinates[offset + stride - 1]) {
        if (extrapolate) {
            coordinate = flatCoordinates.slice(offset, offset + stride);
            coordinate[stride - 1] = m;
            return coordinate;
        }
        else {
            return null;
        }
    }
    else if (flatCoordinates[end - 1] < m) {
        if (extrapolate) {
            coordinate = flatCoordinates.slice(end - stride, end);
            coordinate[stride - 1] = m;
            return coordinate;
        }
        else {
            return null;
        }
    }
    // FIXME use O(1) search
    if (m == flatCoordinates[offset + stride - 1]) {
        return flatCoordinates.slice(offset, offset + stride);
    }
    var lo = offset / stride;
    var hi = end / stride;
    while (lo < hi) {
        var mid = (lo + hi) >> 1;
        if (m < flatCoordinates[(mid + 1) * stride - 1]) {
            hi = mid;
        }
        else {
            lo = mid + 1;
        }
    }
    var m0 = flatCoordinates[lo * stride - 1];
    if (m == m0) {
        return flatCoordinates.slice((lo - 1) * stride, (lo - 1) * stride + stride);
    }
    var m1 = flatCoordinates[(lo + 1) * stride - 1];
    var t = (m - m0) / (m1 - m0);
    coordinate = [];
    for (var i = 0; i < stride - 1; ++i) {
        coordinate.push(Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["lerp"])(flatCoordinates[(lo - 1) * stride + i], flatCoordinates[lo * stride + i], t));
    }
    coordinate.push(m);
    return coordinate;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {number} m M.
 * @param {boolean} extrapolate Extrapolate.
 * @param {boolean} interpolate Interpolate.
 * @return {import("../../coordinate.js").Coordinate} Coordinate.
 */
function lineStringsCoordinateAtM(flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) {
    if (interpolate) {
        return lineStringCoordinateAtM(flatCoordinates, offset, ends[ends.length - 1], stride, m, extrapolate);
    }
    var coordinate;
    if (m < flatCoordinates[stride - 1]) {
        if (extrapolate) {
            coordinate = flatCoordinates.slice(0, stride);
            coordinate[stride - 1] = m;
            return coordinate;
        }
        else {
            return null;
        }
    }
    if (flatCoordinates[flatCoordinates.length - 1] < m) {
        if (extrapolate) {
            coordinate = flatCoordinates.slice(flatCoordinates.length - stride);
            coordinate[stride - 1] = m;
            return coordinate;
        }
        else {
            return null;
        }
    }
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        var end = ends[i];
        if (offset == end) {
            continue;
        }
        if (m < flatCoordinates[offset + stride - 1]) {
            return null;
        }
        else if (m <= flatCoordinates[end - 1]) {
            return lineStringCoordinateAtM(flatCoordinates, offset, end, stride, m, false);
        }
        offset = end;
    }
    return null;
}
//# sourceMappingURL=interpolate.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/intersectsextent.js":
/*!*******************************************************!*\
  !*** ./node_modules/ol/geom/flat/intersectsextent.js ***!
  \*******************************************************/
/*! exports provided: intersectsLineString, intersectsLineStringArray, intersectsLinearRing, intersectsLinearRingArray, intersectsLinearRingMultiArray */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersectsLineString", function() { return intersectsLineString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersectsLineStringArray", function() { return intersectsLineStringArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersectsLinearRing", function() { return intersectsLinearRing; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersectsLinearRingArray", function() { return intersectsLinearRingArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersectsLinearRingMultiArray", function() { return intersectsLinearRingMultiArray; });
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./contains.js */ "./node_modules/ol/geom/flat/contains.js");
/* harmony import */ var _segments_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./segments.js */ "./node_modules/ol/geom/flat/segments.js");
/**
 * @module ol/geom/flat/intersectsextent
 */



/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {import("../../extent.js").Extent} extent Extent.
 * @return {boolean} True if the geometry and the extent intersect.
 */
function intersectsLineString(flatCoordinates, offset, end, stride, extent) {
    var coordinatesExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["extendFlatCoordinates"])(Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createEmpty"])(), flatCoordinates, offset, end, stride);
    if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["intersects"])(extent, coordinatesExtent)) {
        return false;
    }
    if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["containsExtent"])(extent, coordinatesExtent)) {
        return true;
    }
    if (coordinatesExtent[0] >= extent[0] &&
        coordinatesExtent[2] <= extent[2]) {
        return true;
    }
    if (coordinatesExtent[1] >= extent[1] &&
        coordinatesExtent[3] <= extent[3]) {
        return true;
    }
    return Object(_segments_js__WEBPACK_IMPORTED_MODULE_2__["forEach"])(flatCoordinates, offset, end, stride, 
    /**
     * @param {import("../../coordinate.js").Coordinate} point1 Start point.
     * @param {import("../../coordinate.js").Coordinate} point2 End point.
     * @return {boolean} `true` if the segment and the extent intersect,
     *     `false` otherwise.
     */
    function (point1, point2) {
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["intersectsSegment"])(extent, point1, point2);
    });
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {import("../../extent.js").Extent} extent Extent.
 * @return {boolean} True if the geometry and the extent intersect.
 */
function intersectsLineStringArray(flatCoordinates, offset, ends, stride, extent) {
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        if (intersectsLineString(flatCoordinates, offset, ends[i], stride, extent)) {
            return true;
        }
        offset = ends[i];
    }
    return false;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {import("../../extent.js").Extent} extent Extent.
 * @return {boolean} True if the geometry and the extent intersect.
 */
function intersectsLinearRing(flatCoordinates, offset, end, stride, extent) {
    if (intersectsLineString(flatCoordinates, offset, end, stride, extent)) {
        return true;
    }
    if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_1__["linearRingContainsXY"])(flatCoordinates, offset, end, stride, extent[0], extent[1])) {
        return true;
    }
    if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_1__["linearRingContainsXY"])(flatCoordinates, offset, end, stride, extent[0], extent[3])) {
        return true;
    }
    if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_1__["linearRingContainsXY"])(flatCoordinates, offset, end, stride, extent[2], extent[1])) {
        return true;
    }
    if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_1__["linearRingContainsXY"])(flatCoordinates, offset, end, stride, extent[2], extent[3])) {
        return true;
    }
    return false;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {import("../../extent.js").Extent} extent Extent.
 * @return {boolean} True if the geometry and the extent intersect.
 */
function intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent) {
    if (!intersectsLinearRing(flatCoordinates, offset, ends[0], stride, extent)) {
        return false;
    }
    if (ends.length === 1) {
        return true;
    }
    for (var i = 1, ii = ends.length; i < ii; ++i) {
        if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_1__["linearRingContainsExtent"])(flatCoordinates, ends[i - 1], ends[i], stride, extent)) {
            if (!intersectsLineString(flatCoordinates, ends[i - 1], ends[i], stride, extent)) {
                return false;
            }
        }
    }
    return true;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @param {import("../../extent.js").Extent} extent Extent.
 * @return {boolean} True if the geometry and the extent intersect.
 */
function intersectsLinearRingMultiArray(flatCoordinates, offset, endss, stride, extent) {
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        if (intersectsLinearRingArray(flatCoordinates, offset, ends, stride, extent)) {
            return true;
        }
        offset = ends[ends.length - 1];
    }
    return false;
}
//# sourceMappingURL=intersectsextent.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/length.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/geom/flat/length.js ***!
  \*********************************************/
/*! exports provided: lineStringLength, linearRingLength */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lineStringLength", function() { return lineStringLength; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingLength", function() { return linearRingLength; });
/**
 * @module ol/geom/flat/length
 */
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @return {number} Length.
 */
function lineStringLength(flatCoordinates, offset, end, stride) {
    var x1 = flatCoordinates[offset];
    var y1 = flatCoordinates[offset + 1];
    var length = 0;
    for (var i = offset + stride; i < end; i += stride) {
        var x2 = flatCoordinates[i];
        var y2 = flatCoordinates[i + 1];
        length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
        x1 = x2;
        y1 = y2;
    }
    return length;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @return {number} Perimeter.
 */
function linearRingLength(flatCoordinates, offset, end, stride) {
    var perimeter = lineStringLength(flatCoordinates, offset, end, stride);
    var dx = flatCoordinates[end - stride] - flatCoordinates[offset];
    var dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1];
    perimeter += Math.sqrt(dx * dx + dy * dy);
    return perimeter;
}
//# sourceMappingURL=length.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/orient.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/geom/flat/orient.js ***!
  \*********************************************/
/*! exports provided: linearRingIsClockwise, linearRingsAreOriented, linearRingssAreOriented, orientLinearRings, orientLinearRingsArray */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingIsClockwise", function() { return linearRingIsClockwise; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingsAreOriented", function() { return linearRingsAreOriented; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linearRingssAreOriented", function() { return linearRingssAreOriented; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "orientLinearRings", function() { return orientLinearRings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "orientLinearRingsArray", function() { return orientLinearRingsArray; });
/* harmony import */ var _reverse_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./reverse.js */ "./node_modules/ol/geom/flat/reverse.js");
/**
 * @module ol/geom/flat/orient
 */

/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @return {boolean} Is clockwise.
 */
function linearRingIsClockwise(flatCoordinates, offset, end, stride) {
    // http://tinyurl.com/clockwise-method
    // https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrlinearring.cpp
    var edge = 0;
    var x1 = flatCoordinates[end - stride];
    var y1 = flatCoordinates[end - stride + 1];
    for (; offset < end; offset += stride) {
        var x2 = flatCoordinates[offset];
        var y2 = flatCoordinates[offset + 1];
        edge += (x2 - x1) * (y2 + y1);
        x1 = x2;
        y1 = y2;
    }
    return edge > 0;
}
/**
 * Determines if linear rings are oriented.  By default, left-hand orientation
 * is tested (first ring must be clockwise, remaining rings counter-clockwise).
 * To test for right-hand orientation, use the `opt_right` argument.
 *
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Array of end indexes.
 * @param {number} stride Stride.
 * @param {boolean=} opt_right Test for right-hand orientation
 *     (counter-clockwise exterior ring and clockwise interior rings).
 * @return {boolean} Rings are correctly oriented.
 */
function linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right) {
    var right = opt_right !== undefined ? opt_right : false;
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        var end = ends[i];
        var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride);
        if (i === 0) {
            if ((right && isClockwise) || (!right && !isClockwise)) {
                return false;
            }
        }
        else {
            if ((right && !isClockwise) || (!right && isClockwise)) {
                return false;
            }
        }
        offset = end;
    }
    return true;
}
/**
 * Determines if linear rings are oriented.  By default, left-hand orientation
 * is tested (first ring must be clockwise, remaining rings counter-clockwise).
 * To test for right-hand orientation, use the `opt_right` argument.
 *
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Array of array of end indexes.
 * @param {number} stride Stride.
 * @param {boolean=} opt_right Test for right-hand orientation
 *     (counter-clockwise exterior ring and clockwise interior rings).
 * @return {boolean} Rings are correctly oriented.
 */
function linearRingssAreOriented(flatCoordinates, offset, endss, stride, opt_right) {
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        if (!linearRingsAreOriented(flatCoordinates, offset, ends, stride, opt_right)) {
            return false;
        }
        if (ends.length) {
            offset = ends[ends.length - 1];
        }
    }
    return true;
}
/**
 * Orient coordinates in a flat array of linear rings.  By default, rings
 * are oriented following the left-hand rule (clockwise for exterior and
 * counter-clockwise for interior rings).  To orient according to the
 * right-hand rule, use the `opt_right` argument.
 *
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {boolean=} opt_right Follow the right-hand rule for orientation.
 * @return {number} End.
 */
function orientLinearRings(flatCoordinates, offset, ends, stride, opt_right) {
    var right = opt_right !== undefined ? opt_right : false;
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        var end = ends[i];
        var isClockwise = linearRingIsClockwise(flatCoordinates, offset, end, stride);
        var reverse = i === 0 ?
            (right && isClockwise) || (!right && !isClockwise) :
            (right && !isClockwise) || (!right && isClockwise);
        if (reverse) {
            Object(_reverse_js__WEBPACK_IMPORTED_MODULE_0__["coordinates"])(flatCoordinates, offset, end, stride);
        }
        offset = end;
    }
    return offset;
}
/**
 * Orient coordinates in a flat array of linear rings.  By default, rings
 * are oriented following the left-hand rule (clockwise for exterior and
 * counter-clockwise for interior rings).  To orient according to the
 * right-hand rule, use the `opt_right` argument.
 *
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Array of array of end indexes.
 * @param {number} stride Stride.
 * @param {boolean=} opt_right Follow the right-hand rule for orientation.
 * @return {number} End.
 */
function orientLinearRingsArray(flatCoordinates, offset, endss, stride, opt_right) {
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        offset = orientLinearRings(flatCoordinates, offset, endss[i], stride, opt_right);
    }
    return offset;
}
//# sourceMappingURL=orient.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/reverse.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/geom/flat/reverse.js ***!
  \**********************************************/
/*! exports provided: coordinates */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coordinates", function() { return coordinates; });
/**
 * @module ol/geom/flat/reverse
 */
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 */
function coordinates(flatCoordinates, offset, end, stride) {
    while (offset < end - stride) {
        for (var i = 0; i < stride; ++i) {
            var tmp = flatCoordinates[offset + i];
            flatCoordinates[offset + i] = flatCoordinates[end - stride + i];
            flatCoordinates[end - stride + i] = tmp;
        }
        offset += stride;
        end -= stride;
    }
}
//# sourceMappingURL=reverse.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/segments.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/geom/flat/segments.js ***!
  \***********************************************/
/*! exports provided: forEach */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return forEach; });
/**
 * @module ol/geom/flat/segments
 */
/**
 * This function calls `callback` for each segment of the flat coordinates
 * array. If the callback returns a truthy value the function returns that
 * value immediately. Otherwise the function returns `false`.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {function(import("../../coordinate.js").Coordinate, import("../../coordinate.js").Coordinate): T} callback Function
 *     called for each segment.
 * @return {T|boolean} Value.
 * @template T
 */
function forEach(flatCoordinates, offset, end, stride, callback) {
    var point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];
    var point2 = [];
    var ret;
    for (; (offset + stride) < end; offset += stride) {
        point2[0] = flatCoordinates[offset + stride];
        point2[1] = flatCoordinates[offset + stride + 1];
        ret = callback(point1, point2);
        if (ret) {
            return ret;
        }
        point1[0] = point2[0];
        point1[1] = point2[1];
    }
    return false;
}
//# sourceMappingURL=segments.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/simplify.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/geom/flat/simplify.js ***!
  \***********************************************/
/*! exports provided: simplifyLineString, douglasPeucker, douglasPeuckerArray, douglasPeuckerMultiArray, radialDistance, snap, quantize, quantizeArray, quantizeMultiArray */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simplifyLineString", function() { return simplifyLineString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "douglasPeucker", function() { return douglasPeucker; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "douglasPeuckerArray", function() { return douglasPeuckerArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "douglasPeuckerMultiArray", function() { return douglasPeuckerMultiArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "radialDistance", function() { return radialDistance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "snap", function() { return snap; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quantize", function() { return quantize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quantizeArray", function() { return quantizeArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quantizeMultiArray", function() { return quantizeMultiArray; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math.js */ "./node_modules/ol/math.js");
/**
 * @module ol/geom/flat/simplify
 */
// Based on simplify-js https://github.com/mourner/simplify-js
// Copyright (c) 2012, Vladimir Agafonkin
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//    1. Redistributions of source code must retain the above copyright notice,
//       this list of conditions and the following disclaimer.
//
//    2. Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in the
//       documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} squaredTolerance Squared tolerance.
 * @param {boolean} highQuality Highest quality.
 * @param {Array<number>=} opt_simplifiedFlatCoordinates Simplified flat
 *     coordinates.
 * @return {Array<number>} Simplified line string.
 */
function simplifyLineString(flatCoordinates, offset, end, stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
    var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?
        opt_simplifiedFlatCoordinates : [];
    if (!highQuality) {
        end = radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0);
        flatCoordinates = simplifiedFlatCoordinates;
        offset = 0;
        stride = 2;
    }
    simplifiedFlatCoordinates.length = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0);
    return simplifiedFlatCoordinates;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} squaredTolerance Squared tolerance.
 * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
 *     coordinates.
 * @param {number} simplifiedOffset Simplified offset.
 * @return {number} Simplified offset.
 */
function douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {
    var n = (end - offset) / stride;
    if (n < 3) {
        for (; offset < end; offset += stride) {
            simplifiedFlatCoordinates[simplifiedOffset++] =
                flatCoordinates[offset];
            simplifiedFlatCoordinates[simplifiedOffset++] =
                flatCoordinates[offset + 1];
        }
        return simplifiedOffset;
    }
    /** @type {Array<number>} */
    var markers = new Array(n);
    markers[0] = 1;
    markers[n - 1] = 1;
    /** @type {Array<number>} */
    var stack = [offset, end - stride];
    var index = 0;
    while (stack.length > 0) {
        var last = stack.pop();
        var first = stack.pop();
        var maxSquaredDistance = 0;
        var x1 = flatCoordinates[first];
        var y1 = flatCoordinates[first + 1];
        var x2 = flatCoordinates[last];
        var y2 = flatCoordinates[last + 1];
        for (var i = first + stride; i < last; i += stride) {
            var x = flatCoordinates[i];
            var y = flatCoordinates[i + 1];
            var squaredDistance_1 = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["squaredSegmentDistance"])(x, y, x1, y1, x2, y2);
            if (squaredDistance_1 > maxSquaredDistance) {
                index = i;
                maxSquaredDistance = squaredDistance_1;
            }
        }
        if (maxSquaredDistance > squaredTolerance) {
            markers[(index - offset) / stride] = 1;
            if (first + stride < index) {
                stack.push(first, index);
            }
            if (index + stride < last) {
                stack.push(index, last);
            }
        }
    }
    for (var i = 0; i < n; ++i) {
        if (markers[i]) {
            simplifiedFlatCoordinates[simplifiedOffset++] =
                flatCoordinates[offset + i * stride];
            simplifiedFlatCoordinates[simplifiedOffset++] =
                flatCoordinates[offset + i * stride + 1];
        }
    }
    return simplifiedOffset;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {number} squaredTolerance Squared tolerance.
 * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
 *     coordinates.
 * @param {number} simplifiedOffset Simplified offset.
 * @param {Array<number>} simplifiedEnds Simplified ends.
 * @return {number} Simplified offset.
 */
function douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        var end = ends[i];
        simplifiedOffset = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset);
        simplifiedEnds.push(simplifiedOffset);
        offset = end;
    }
    return simplifiedOffset;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @param {number} squaredTolerance Squared tolerance.
 * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
 *     coordinates.
 * @param {number} simplifiedOffset Simplified offset.
 * @param {Array<Array<number>>} simplifiedEndss Simplified endss.
 * @return {number} Simplified offset.
 */
function douglasPeuckerMultiArray(flatCoordinates, offset, endss, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        var simplifiedEnds = [];
        simplifiedOffset = douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);
        simplifiedEndss.push(simplifiedEnds);
        offset = ends[ends.length - 1];
    }
    return simplifiedOffset;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} squaredTolerance Squared tolerance.
 * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
 *     coordinates.
 * @param {number} simplifiedOffset Simplified offset.
 * @return {number} Simplified offset.
 */
function radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) {
    if (end <= offset + stride) {
        // zero or one point, no simplification possible, so copy and return
        for (; offset < end; offset += stride) {
            simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset];
            simplifiedFlatCoordinates[simplifiedOffset++] =
                flatCoordinates[offset + 1];
        }
        return simplifiedOffset;
    }
    var x1 = flatCoordinates[offset];
    var y1 = flatCoordinates[offset + 1];
    // copy first point
    simplifiedFlatCoordinates[simplifiedOffset++] = x1;
    simplifiedFlatCoordinates[simplifiedOffset++] = y1;
    var x2 = x1;
    var y2 = y1;
    for (offset += stride; offset < end; offset += stride) {
        x2 = flatCoordinates[offset];
        y2 = flatCoordinates[offset + 1];
        if (Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["squaredDistance"])(x1, y1, x2, y2) > squaredTolerance) {
            // copy point at offset
            simplifiedFlatCoordinates[simplifiedOffset++] = x2;
            simplifiedFlatCoordinates[simplifiedOffset++] = y2;
            x1 = x2;
            y1 = y2;
        }
    }
    if (x2 != x1 || y2 != y1) {
        // copy last point
        simplifiedFlatCoordinates[simplifiedOffset++] = x2;
        simplifiedFlatCoordinates[simplifiedOffset++] = y2;
    }
    return simplifiedOffset;
}
/**
 * @param {number} value Value.
 * @param {number} tolerance Tolerance.
 * @return {number} Rounded value.
 */
function snap(value, tolerance) {
    return tolerance * Math.round(value / tolerance);
}
/**
 * Simplifies a line string using an algorithm designed by Tim Schaub.
 * Coordinates are snapped to the nearest value in a virtual grid and
 * consecutive duplicate coordinates are discarded.  This effectively preserves
 * topology as the simplification of any subsection of a line string is
 * independent of the rest of the line string.  This means that, for examples,
 * the common edge between two polygons will be simplified to the same line
 * string independently in both polygons.  This implementation uses a single
 * pass over the coordinates and eliminates intermediate collinear points.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} tolerance Tolerance.
 * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
 *     coordinates.
 * @param {number} simplifiedOffset Simplified offset.
 * @return {number} Simplified offset.
 */
function quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset) {
    // do nothing if the line is empty
    if (offset == end) {
        return simplifiedOffset;
    }
    // snap the first coordinate (P1)
    var x1 = snap(flatCoordinates[offset], tolerance);
    var y1 = snap(flatCoordinates[offset + 1], tolerance);
    offset += stride;
    // add the first coordinate to the output
    simplifiedFlatCoordinates[simplifiedOffset++] = x1;
    simplifiedFlatCoordinates[simplifiedOffset++] = y1;
    // find the next coordinate that does not snap to the same value as the first
    // coordinate (P2)
    var x2, y2;
    do {
        x2 = snap(flatCoordinates[offset], tolerance);
        y2 = snap(flatCoordinates[offset + 1], tolerance);
        offset += stride;
        if (offset == end) {
            // all coordinates snap to the same value, the line collapses to a point
            // push the last snapped value anyway to ensure that the output contains
            // at least two points
            // FIXME should we really return at least two points anyway?
            simplifiedFlatCoordinates[simplifiedOffset++] = x2;
            simplifiedFlatCoordinates[simplifiedOffset++] = y2;
            return simplifiedOffset;
        }
    } while (x2 == x1 && y2 == y1);
    while (offset < end) {
        // snap the next coordinate (P3)
        var x3 = snap(flatCoordinates[offset], tolerance);
        var y3 = snap(flatCoordinates[offset + 1], tolerance);
        offset += stride;
        // skip P3 if it is equal to P2
        if (x3 == x2 && y3 == y2) {
            continue;
        }
        // calculate the delta between P1 and P2
        var dx1 = x2 - x1;
        var dy1 = y2 - y1;
        // calculate the delta between P3 and P1
        var dx2 = x3 - x1;
        var dy2 = y3 - y1;
        // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from
        // P1 in the same direction then P2 is on the straight line between P1 and
        // P3
        if ((dx1 * dy2 == dy1 * dx2) &&
            ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) &&
            ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))) {
            // discard P2 and set P2 = P3
            x2 = x3;
            y2 = y3;
            continue;
        }
        // either P1, P2, and P3 are not colinear, or they are colinear but P3 is
        // between P3 and P1 or on the opposite half of the line to P2.  add P2,
        // and continue with P1 = P2 and P2 = P3
        simplifiedFlatCoordinates[simplifiedOffset++] = x2;
        simplifiedFlatCoordinates[simplifiedOffset++] = y2;
        x1 = x2;
        y1 = y2;
        x2 = x3;
        y2 = y3;
    }
    // add the last point (P2)
    simplifiedFlatCoordinates[simplifiedOffset++] = x2;
    simplifiedFlatCoordinates[simplifiedOffset++] = y2;
    return simplifiedOffset;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<number>} ends Ends.
 * @param {number} stride Stride.
 * @param {number} tolerance Tolerance.
 * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
 *     coordinates.
 * @param {number} simplifiedOffset Simplified offset.
 * @param {Array<number>} simplifiedEnds Simplified ends.
 * @return {number} Simplified offset.
 */
function quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) {
    for (var i = 0, ii = ends.length; i < ii; ++i) {
        var end = ends[i];
        simplifiedOffset = quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset);
        simplifiedEnds.push(simplifiedOffset);
        offset = end;
    }
    return simplifiedOffset;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {Array<Array<number>>} endss Endss.
 * @param {number} stride Stride.
 * @param {number} tolerance Tolerance.
 * @param {Array<number>} simplifiedFlatCoordinates Simplified flat
 *     coordinates.
 * @param {number} simplifiedOffset Simplified offset.
 * @param {Array<Array<number>>} simplifiedEndss Simplified endss.
 * @return {number} Simplified offset.
 */
function quantizeMultiArray(flatCoordinates, offset, endss, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) {
    for (var i = 0, ii = endss.length; i < ii; ++i) {
        var ends = endss[i];
        var simplifiedEnds = [];
        simplifiedOffset = quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds);
        simplifiedEndss.push(simplifiedEnds);
        offset = ends[ends.length - 1];
    }
    return simplifiedOffset;
}
//# sourceMappingURL=simplify.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/straightchunk.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/geom/flat/straightchunk.js ***!
  \****************************************************/
/*! exports provided: matchingChunk */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matchingChunk", function() { return matchingChunk; });
/**
 * @module ol/geom/flat/straightchunk
 */
/**
 * @param {number} maxAngle Maximum acceptable angle delta between segments.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @return {Array<number>} Start and end of the first suitable chunk of the
 * given `flatCoordinates`.
 */
function matchingChunk(maxAngle, flatCoordinates, offset, end, stride) {
    var chunkStart = offset;
    var chunkEnd = offset;
    var chunkM = 0;
    var m = 0;
    var start = offset;
    var acos, i, m12, m23, x1, y1, x12, y12, x23, y23;
    for (i = offset; i < end; i += stride) {
        var x2 = flatCoordinates[i];
        var y2 = flatCoordinates[i + 1];
        if (x1 !== undefined) {
            x23 = x2 - x1;
            y23 = y2 - y1;
            m23 = Math.sqrt(x23 * x23 + y23 * y23);
            if (x12 !== undefined) {
                m += m12;
                acos = Math.acos((x12 * x23 + y12 * y23) / (m12 * m23));
                if (acos > maxAngle) {
                    if (m > chunkM) {
                        chunkM = m;
                        chunkStart = start;
                        chunkEnd = i;
                    }
                    m = 0;
                    start = i - stride;
                }
            }
            m12 = m23;
            x12 = x23;
            y12 = y23;
        }
        x1 = x2;
        y1 = y2;
    }
    m += m23;
    return m > chunkM ? [start, i] : [chunkStart, chunkEnd];
}
//# sourceMappingURL=straightchunk.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/textpath.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/geom/flat/textpath.js ***!
  \***********************************************/
/*! exports provided: drawTextOnPath */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawTextOnPath", function() { return drawTextOnPath; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../math.js */ "./node_modules/ol/math.js");
/**
 * @module ol/geom/flat/textpath
 */

/**
 * @param {Array<number>} flatCoordinates Path to put text on.
 * @param {number} offset Start offset of the `flatCoordinates`.
 * @param {number} end End offset of the `flatCoordinates`.
 * @param {number} stride Stride.
 * @param {string} text Text to place on the path.
 * @param {number} startM m along the path where the text starts.
 * @param {number} maxAngle Max angle between adjacent chars in radians.
 * @param {number} scale The product of the text scale and the device pixel ratio.
 * @param {function(string, string, Object<string, number>):number} measureAndCacheTextWidth Measure and cache text width.
 * @param {string} font The font.
 * @param {Object<string, number>} cache A cache of measured widths.
 * @return {Array<Array<*>>} The result array (or null if `maxAngle` was
 * exceeded). Entries of the array are x, y, anchorX, angle, chunk.
 */
function drawTextOnPath(flatCoordinates, offset, end, stride, text, startM, maxAngle, scale, measureAndCacheTextWidth, font, cache) {
    var result = [];
    // Keep text upright
    var reverse = flatCoordinates[offset] > flatCoordinates[end - stride];
    var numChars = text.length;
    var x1 = flatCoordinates[offset];
    var y1 = flatCoordinates[offset + 1];
    offset += stride;
    var x2 = flatCoordinates[offset];
    var y2 = flatCoordinates[offset + 1];
    var segmentM = 0;
    var segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
    var angleChanged = false;
    var index, previousAngle;
    for (var i = 0; i < numChars; ++i) {
        index = reverse ? numChars - i - 1 : i;
        var char = text[index];
        var charLength = scale * measureAndCacheTextWidth(font, char, cache);
        var charM = startM + charLength / 2;
        while (offset < end - stride && segmentM + segmentLength < charM) {
            x1 = x2;
            y1 = y2;
            offset += stride;
            x2 = flatCoordinates[offset];
            y2 = flatCoordinates[offset + 1];
            segmentM += segmentLength;
            segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
        }
        var segmentPos = charM - segmentM;
        var angle = Math.atan2(y2 - y1, x2 - x1);
        if (reverse) {
            angle += angle > 0 ? -Math.PI : Math.PI;
        }
        if (previousAngle !== undefined) {
            var delta = angle - previousAngle;
            angleChanged = angleChanged || delta !== 0;
            delta += (delta > Math.PI) ? -2 * Math.PI : (delta < -Math.PI) ? 2 * Math.PI : 0;
            if (Math.abs(delta) > maxAngle) {
                return null;
            }
        }
        previousAngle = angle;
        var interpolate = segmentPos / segmentLength;
        var x = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["lerp"])(x1, x2, interpolate);
        var y = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["lerp"])(y1, y2, interpolate);
        result[index] = [x, y, charLength / 2, angle, char];
        startM += charLength;
    }
    return angleChanged ? result : [[result[0][0], result[0][1], result[0][2], result[0][3], text]];
}
//# sourceMappingURL=textpath.js.map

/***/ }),

/***/ "./node_modules/ol/geom/flat/transform.js":
/*!************************************************!*\
  !*** ./node_modules/ol/geom/flat/transform.js ***!
  \************************************************/
/*! exports provided: transform2D, rotate, scale, translate */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transform2D", function() { return transform2D; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotate", function() { return rotate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "translate", function() { return translate; });
/**
 * @module ol/geom/flat/transform
 */
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {import("../../transform.js").Transform} transform Transform.
 * @param {Array<number>=} opt_dest Destination.
 * @return {Array<number>} Transformed coordinates.
 */
function transform2D(flatCoordinates, offset, end, stride, transform, opt_dest) {
    var dest = opt_dest ? opt_dest : [];
    var i = 0;
    for (var j = offset; j < end; j += stride) {
        var x = flatCoordinates[j];
        var y = flatCoordinates[j + 1];
        dest[i++] = transform[0] * x + transform[2] * y + transform[4];
        dest[i++] = transform[1] * x + transform[3] * y + transform[5];
    }
    if (opt_dest && dest.length != i) {
        dest.length = i;
    }
    return dest;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} angle Angle.
 * @param {Array<number>} anchor Rotation anchor point.
 * @param {Array<number>=} opt_dest Destination.
 * @return {Array<number>} Transformed coordinates.
 */
function rotate(flatCoordinates, offset, end, stride, angle, anchor, opt_dest) {
    var dest = opt_dest ? opt_dest : [];
    var cos = Math.cos(angle);
    var sin = Math.sin(angle);
    var anchorX = anchor[0];
    var anchorY = anchor[1];
    var i = 0;
    for (var j = offset; j < end; j += stride) {
        var deltaX = flatCoordinates[j] - anchorX;
        var deltaY = flatCoordinates[j + 1] - anchorY;
        dest[i++] = anchorX + deltaX * cos - deltaY * sin;
        dest[i++] = anchorY + deltaX * sin + deltaY * cos;
        for (var k = j + 2; k < j + stride; ++k) {
            dest[i++] = flatCoordinates[k];
        }
    }
    if (opt_dest && dest.length != i) {
        dest.length = i;
    }
    return dest;
}
/**
 * Scale the coordinates.
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} sx Scale factor in the x-direction.
 * @param {number} sy Scale factor in the y-direction.
 * @param {Array<number>} anchor Scale anchor point.
 * @param {Array<number>=} opt_dest Destination.
 * @return {Array<number>} Transformed coordinates.
 */
function scale(flatCoordinates, offset, end, stride, sx, sy, anchor, opt_dest) {
    var dest = opt_dest ? opt_dest : [];
    var anchorX = anchor[0];
    var anchorY = anchor[1];
    var i = 0;
    for (var j = offset; j < end; j += stride) {
        var deltaX = flatCoordinates[j] - anchorX;
        var deltaY = flatCoordinates[j + 1] - anchorY;
        dest[i++] = anchorX + sx * deltaX;
        dest[i++] = anchorY + sy * deltaY;
        for (var k = j + 2; k < j + stride; ++k) {
            dest[i++] = flatCoordinates[k];
        }
    }
    if (opt_dest && dest.length != i) {
        dest.length = i;
    }
    return dest;
}
/**
 * @param {Array<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {number} deltaX Delta X.
 * @param {number} deltaY Delta Y.
 * @param {Array<number>=} opt_dest Destination.
 * @return {Array<number>} Transformed coordinates.
 */
function translate(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
    var dest = opt_dest ? opt_dest : [];
    var i = 0;
    for (var j = offset; j < end; j += stride) {
        dest[i++] = flatCoordinates[j] + deltaX;
        dest[i++] = flatCoordinates[j + 1] + deltaY;
        for (var k = j + 2; k < j + stride; ++k) {
            dest[i++] = flatCoordinates[k];
        }
    }
    if (opt_dest && dest.length != i) {
        dest.length = i;
    }
    return dest;
}
//# sourceMappingURL=transform.js.map

/***/ }),

/***/ "./node_modules/ol/has.js":
/*!********************************!*\
  !*** ./node_modules/ol/has.js ***!
  \********************************/
/*! exports provided: FIREFOX, SAFARI, WEBKIT, MAC, DEVICE_PIXEL_RATIO, WORKER_OFFSCREEN_CANVAS, IMAGE_DECODE, PASSIVE_EVENT_LISTENERS */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIREFOX", function() { return FIREFOX; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SAFARI", function() { return SAFARI; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WEBKIT", function() { return WEBKIT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAC", function() { return MAC; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEVICE_PIXEL_RATIO", function() { return DEVICE_PIXEL_RATIO; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WORKER_OFFSCREEN_CANVAS", function() { return WORKER_OFFSCREEN_CANVAS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IMAGE_DECODE", function() { return IMAGE_DECODE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PASSIVE_EVENT_LISTENERS", function() { return PASSIVE_EVENT_LISTENERS; });
/**
 * @module ol/has
 */
var ua = typeof navigator !== 'undefined' ?
    navigator.userAgent.toLowerCase() : '';
/**
 * User agent string says we are dealing with Firefox as browser.
 * @type {boolean}
 */
var FIREFOX = ua.indexOf('firefox') !== -1;
/**
 * User agent string says we are dealing with Safari as browser.
 * @type {boolean}
 */
var SAFARI = ua.indexOf('safari') !== -1 && ua.indexOf('chrom') == -1;
/**
 * User agent string says we are dealing with a WebKit engine.
 * @type {boolean}
 */
var WEBKIT = ua.indexOf('webkit') !== -1 && ua.indexOf('edge') == -1;
/**
 * User agent string says we are dealing with a Mac as platform.
 * @type {boolean}
 */
var MAC = ua.indexOf('macintosh') !== -1;
/**
 * The ratio between physical pixels and device-independent pixels
 * (dips) on the device (`window.devicePixelRatio`).
 * @const
 * @type {number}
 * @api
 */
var DEVICE_PIXEL_RATIO = typeof devicePixelRatio !== 'undefined' ? devicePixelRatio : 1;
/**
 * The execution context is a worker with OffscreenCanvas available.
 * @const
 * @type {boolean}
 */
var WORKER_OFFSCREEN_CANVAS = typeof WorkerGlobalScope !== 'undefined' && typeof OffscreenCanvas !== 'undefined' &&
    self instanceof WorkerGlobalScope; //eslint-disable-line
/**
 * Image.prototype.decode() is supported.
 * @type {boolean}
 */
var IMAGE_DECODE = typeof Image !== 'undefined' && Image.prototype.decode;
/**
 * @type {boolean}
 */
var PASSIVE_EVENT_LISTENERS = (function () {
    var passive = false;
    try {
        var options = Object.defineProperty({}, 'passive', {
            get: function () {
                passive = true;
            }
        });
        window.addEventListener('_', null, options);
        window.removeEventListener('_', null, options);
    }
    catch (error) {
        // passive not supported
    }
    return passive;
})();
//# sourceMappingURL=has.js.map

/***/ }),

/***/ "./node_modules/ol/interaction.js":
/*!****************************************!*\
  !*** ./node_modules/ol/interaction.js ***!
  \****************************************/
/*! exports provided: DoubleClickZoom, DragAndDrop, DragBox, DragPan, DragRotate, DragRotateAndZoom, DragZoom, Draw, Extent, Interaction, KeyboardPan, KeyboardZoom, Modify, MouseWheelZoom, PinchRotate, PinchZoom, Pointer, Select, Snap, Translate, defaults */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return defaults; });
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var _Kinetic_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Kinetic.js */ "./node_modules/ol/Kinetic.js");
/* harmony import */ var _interaction_DoubleClickZoom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interaction/DoubleClickZoom.js */ "./node_modules/ol/interaction/DoubleClickZoom.js");
/* harmony import */ var _interaction_DragPan_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./interaction/DragPan.js */ "./node_modules/ol/interaction/DragPan.js");
/* harmony import */ var _interaction_DragRotate_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interaction/DragRotate.js */ "./node_modules/ol/interaction/DragRotate.js");
/* harmony import */ var _interaction_DragZoom_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./interaction/DragZoom.js */ "./node_modules/ol/interaction/DragZoom.js");
/* harmony import */ var _interaction_KeyboardPan_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./interaction/KeyboardPan.js */ "./node_modules/ol/interaction/KeyboardPan.js");
/* harmony import */ var _interaction_KeyboardZoom_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./interaction/KeyboardZoom.js */ "./node_modules/ol/interaction/KeyboardZoom.js");
/* harmony import */ var _interaction_MouseWheelZoom_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./interaction/MouseWheelZoom.js */ "./node_modules/ol/interaction/MouseWheelZoom.js");
/* harmony import */ var _interaction_PinchRotate_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./interaction/PinchRotate.js */ "./node_modules/ol/interaction/PinchRotate.js");
/* harmony import */ var _interaction_PinchZoom_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./interaction/PinchZoom.js */ "./node_modules/ol/interaction/PinchZoom.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DoubleClickZoom", function() { return _interaction_DoubleClickZoom_js__WEBPACK_IMPORTED_MODULE_2__["default"]; });

/* harmony import */ var _interaction_DragAndDrop_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./interaction/DragAndDrop.js */ "./node_modules/ol/interaction/DragAndDrop.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragAndDrop", function() { return _interaction_DragAndDrop_js__WEBPACK_IMPORTED_MODULE_12__["default"]; });

/* harmony import */ var _interaction_DragBox_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./interaction/DragBox.js */ "./node_modules/ol/interaction/DragBox.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragBox", function() { return _interaction_DragBox_js__WEBPACK_IMPORTED_MODULE_13__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragPan", function() { return _interaction_DragPan_js__WEBPACK_IMPORTED_MODULE_3__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragRotate", function() { return _interaction_DragRotate_js__WEBPACK_IMPORTED_MODULE_4__["default"]; });

/* harmony import */ var _interaction_DragRotateAndZoom_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./interaction/DragRotateAndZoom.js */ "./node_modules/ol/interaction/DragRotateAndZoom.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragRotateAndZoom", function() { return _interaction_DragRotateAndZoom_js__WEBPACK_IMPORTED_MODULE_14__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragZoom", function() { return _interaction_DragZoom_js__WEBPACK_IMPORTED_MODULE_5__["default"]; });

/* harmony import */ var _interaction_Draw_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./interaction/Draw.js */ "./node_modules/ol/interaction/Draw.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Draw", function() { return _interaction_Draw_js__WEBPACK_IMPORTED_MODULE_15__["default"]; });

/* harmony import */ var _interaction_Extent_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./interaction/Extent.js */ "./node_modules/ol/interaction/Extent.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Extent", function() { return _interaction_Extent_js__WEBPACK_IMPORTED_MODULE_16__["default"]; });

/* harmony import */ var _interaction_Interaction_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./interaction/Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Interaction", function() { return _interaction_Interaction_js__WEBPACK_IMPORTED_MODULE_17__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KeyboardPan", function() { return _interaction_KeyboardPan_js__WEBPACK_IMPORTED_MODULE_6__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KeyboardZoom", function() { return _interaction_KeyboardZoom_js__WEBPACK_IMPORTED_MODULE_7__["default"]; });

/* harmony import */ var _interaction_Modify_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./interaction/Modify.js */ "./node_modules/ol/interaction/Modify.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Modify", function() { return _interaction_Modify_js__WEBPACK_IMPORTED_MODULE_18__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MouseWheelZoom", function() { return _interaction_MouseWheelZoom_js__WEBPACK_IMPORTED_MODULE_8__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PinchRotate", function() { return _interaction_PinchRotate_js__WEBPACK_IMPORTED_MODULE_9__["default"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PinchZoom", function() { return _interaction_PinchZoom_js__WEBPACK_IMPORTED_MODULE_10__["default"]; });

/* harmony import */ var _interaction_Pointer_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./interaction/Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Pointer", function() { return _interaction_Pointer_js__WEBPACK_IMPORTED_MODULE_19__["default"]; });

/* harmony import */ var _interaction_Select_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./interaction/Select.js */ "./node_modules/ol/interaction/Select.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Select", function() { return _interaction_Select_js__WEBPACK_IMPORTED_MODULE_20__["default"]; });

/* harmony import */ var _interaction_Snap_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./interaction/Snap.js */ "./node_modules/ol/interaction/Snap.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Snap", function() { return _interaction_Snap_js__WEBPACK_IMPORTED_MODULE_21__["default"]; });

/* harmony import */ var _interaction_Translate_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./interaction/Translate.js */ "./node_modules/ol/interaction/Translate.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Translate", function() { return _interaction_Translate_js__WEBPACK_IMPORTED_MODULE_22__["default"]; });

/**
 * @module ol/interaction
 */
































/**
 * @typedef {Object} DefaultsOptions
 * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is
 * desired.
 * @property {boolean} [onFocusOnly=false] Interact only when the map has the
 * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is
 * useful when page scroll is desired for maps that do not have the browser's
 * focus.
 * @property {boolean} [doubleClickZoom=true] Whether double click zoom is
 * desired.
 * @property {boolean} [keyboard=true] Whether keyboard interaction is desired.
 * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired.
 * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired.
 * @property {boolean} [dragPan=true] Whether drag pan is desired.
 * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired.
 * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired.
 * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom.
 * @property {number} [zoomDuration] Duration of the zoom animation in
 * milliseconds.
 */
/**
 * Set of interactions included in maps by default. Specific interactions can be
 * excluded by setting the appropriate option to false in the constructor
 * options, but the order of the interactions is fixed.  If you want to specify
 * a different order for interactions, you will need to create your own
 * {@link module:ol/interaction/Interaction} instances and insert
 * them into a {@link module:ol/Collection} in the order you want
 * before creating your {@link module:ol/Map~Map} instance. Changing the order can
 * be of interest if the event propagation needs to be stopped at a point.
 * The default set of interactions, in sequence, is:
 * * {@link module:ol/interaction/DragRotate~DragRotate}
 * * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom}
 * * {@link module:ol/interaction/DragPan~DragPan}
 * * {@link module:ol/interaction/PinchRotate~PinchRotate}
 * * {@link module:ol/interaction/PinchZoom~PinchZoom}
 * * {@link module:ol/interaction/KeyboardPan~KeyboardPan}
 * * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}
 * * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}
 * * {@link module:ol/interaction/DragZoom~DragZoom}
 *
 * @param {DefaultsOptions=} opt_options Defaults options.
 * @return {import("./Collection.js").default<import("./interaction/Interaction.js").default>}
 * A collection of interactions to be used with the {@link module:ol/Map~Map}
 * constructor's `interactions` option.
 * @api
 */
function defaults(opt_options) {
    var options = opt_options ? opt_options : {};
    var interactions = new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"]();
    var kinetic = new _Kinetic_js__WEBPACK_IMPORTED_MODULE_1__["default"](-0.005, 0.05, 100);
    var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
        options.altShiftDragRotate : true;
    if (altShiftDragRotate) {
        interactions.push(new _interaction_DragRotate_js__WEBPACK_IMPORTED_MODULE_4__["default"]());
    }
    var doubleClickZoom = options.doubleClickZoom !== undefined ?
        options.doubleClickZoom : true;
    if (doubleClickZoom) {
        interactions.push(new _interaction_DoubleClickZoom_js__WEBPACK_IMPORTED_MODULE_2__["default"]({
            delta: options.zoomDelta,
            duration: options.zoomDuration
        }));
    }
    var dragPan = options.dragPan !== undefined ? options.dragPan : true;
    if (dragPan) {
        interactions.push(new _interaction_DragPan_js__WEBPACK_IMPORTED_MODULE_3__["default"]({
            condition: options.onFocusOnly ? _events_condition_js__WEBPACK_IMPORTED_MODULE_11__["focus"] : undefined,
            kinetic: kinetic
        }));
    }
    var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate :
        true;
    if (pinchRotate) {
        interactions.push(new _interaction_PinchRotate_js__WEBPACK_IMPORTED_MODULE_9__["default"]());
    }
    var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;
    if (pinchZoom) {
        interactions.push(new _interaction_PinchZoom_js__WEBPACK_IMPORTED_MODULE_10__["default"]({
            duration: options.zoomDuration
        }));
    }
    var keyboard = options.keyboard !== undefined ? options.keyboard : true;
    if (keyboard) {
        interactions.push(new _interaction_KeyboardPan_js__WEBPACK_IMPORTED_MODULE_6__["default"]());
        interactions.push(new _interaction_KeyboardZoom_js__WEBPACK_IMPORTED_MODULE_7__["default"]({
            delta: options.zoomDelta,
            duration: options.zoomDuration
        }));
    }
    var mouseWheelZoom = options.mouseWheelZoom !== undefined ?
        options.mouseWheelZoom : true;
    if (mouseWheelZoom) {
        interactions.push(new _interaction_MouseWheelZoom_js__WEBPACK_IMPORTED_MODULE_8__["default"]({
            condition: options.onFocusOnly ? _events_condition_js__WEBPACK_IMPORTED_MODULE_11__["focus"] : undefined,
            duration: options.zoomDuration
        }));
    }
    var shiftDragZoom = options.shiftDragZoom !== undefined ?
        options.shiftDragZoom : true;
    if (shiftDragZoom) {
        interactions.push(new _interaction_DragZoom_js__WEBPACK_IMPORTED_MODULE_5__["default"]({
            duration: options.zoomDuration
        }));
    }
    return interactions;
}
//# sourceMappingURL=interaction.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/DoubleClickZoom.js":
/*!********************************************************!*\
  !*** ./node_modules/ol/interaction/DoubleClickZoom.js ***!
  \********************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
/* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/DoubleClickZoom
 */


/**
 * @typedef {Object} Options
 * @property {number} [duration=250] Animation duration in milliseconds.
 * @property {number} [delta=1] The zoom delta applied on each double click.
 */
/**
 * @classdesc
 * Allows the user to zoom by double-clicking on the map.
 * @api
 */
var DoubleClickZoom = /** @class */ (function (_super) {
    __extends(DoubleClickZoom, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function DoubleClickZoom(opt_options) {
        var _this = _super.call(this, {
            handleEvent: handleEvent
        }) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @private
         * @type {number}
         */
        _this.delta_ = options.delta ? options.delta : 1;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 250;
        return _this;
    }
    return DoubleClickZoom;
}(_Interaction_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a
 * doubleclick) and eventually zooms the map.
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} `false` to stop event propagation.
 * @this {DoubleClickZoom}
 */
function handleEvent(mapBrowserEvent) {
    var stopEvent = false;
    if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].DBLCLICK) {
        var browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
        var map = mapBrowserEvent.map;
        var anchor = mapBrowserEvent.coordinate;
        var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
        var view = map.getView();
        Object(_Interaction_js__WEBPACK_IMPORTED_MODULE_1__["zoomByDelta"])(view, delta, anchor, this.duration_);
        mapBrowserEvent.preventDefault();
        stopEvent = true;
    }
    return !stopEvent;
}
/* harmony default export */ __webpack_exports__["default"] = (DoubleClickZoom);
//# sourceMappingURL=DoubleClickZoom.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/DragAndDrop.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/interaction/DragAndDrop.js ***!
  \****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/**
 * @module ol/interaction/DragAndDrop
 */
// FIXME should handle all geo-referenced data, not just vector data
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();






/**
 * @typedef {Object} Options
 * @property {Array<typeof import("../format/Feature.js").default>} [formatConstructors] Format constructors.
 * @property {import("../source/Vector.js").default} [source] Optional vector source where features will be added.  If a source is provided
 * all existing features will be removed and new features will be added when
 * they are dropped on the target.  If you want to add features to a vector
 * source without removing the existing features (append only), instead of
 * providing the source option listen for the "addfeatures" event.
 * @property {import("../proj.js").ProjectionLike} [projection] Target projection. By default, the map's view's projection is used.
 * @property {HTMLElement} [target] The element that is used as the drop target, default is the viewport element.
 */
/**
 * @enum {string}
 */
var DragAndDropEventType = {
    /**
     * Triggered when features are added
     * @event DragAndDropEvent#addfeatures
     * @api
     */
    ADD_FEATURES: 'addfeatures'
};
/**
 * @classdesc
 * Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances
 * of this type.
 */
var DragAndDropEvent = /** @class */ (function (_super) {
    __extends(DragAndDropEvent, _super);
    /**
     * @param {DragAndDropEventType} type Type.
     * @param {File} file File.
     * @param {Array<import("../Feature.js").default>=} opt_features Features.
     * @param {import("../proj/Projection.js").default=} opt_projection Projection.
     */
    function DragAndDropEvent(type, file, opt_features, opt_projection) {
        var _this = _super.call(this, type) || this;
        /**
         * The features parsed from dropped data.
         * @type {Array<import("../Feature.js").FeatureLike>|undefined}
         * @api
         */
        _this.features = opt_features;
        /**
         * The dropped file.
         * @type {File}
         * @api
         */
        _this.file = file;
        /**
         * The feature projection.
         * @type {import("../proj/Projection.js").default|undefined}
         * @api
         */
        _this.projection = opt_projection;
        return _this;
    }
    return DragAndDropEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * @classdesc
 * Handles input of vector data by drag and drop.
 * @api
 *
 * @fires DragAndDropEvent
 */
var DragAndDrop = /** @class */ (function (_super) {
    __extends(DragAndDrop, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function DragAndDrop(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            handleEvent: _functions_js__WEBPACK_IMPORTED_MODULE_0__["TRUE"]
        }) || this;
        /**
         * @private
         * @type {Array<typeof import("../format/Feature.js").default>}
         */
        _this.formatConstructors_ = options.formatConstructors ?
            options.formatConstructors : [];
        /**
         * @private
         * @type {import("../proj/Projection.js").default}
         */
        _this.projection_ = options.projection ?
            Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])(options.projection) : null;
        /**
         * @private
         * @type {?Array<import("../events.js").EventsKey>}
         */
        _this.dropListenKeys_ = null;
        /**
         * @private
         * @type {import("../source/Vector.js").default}
         */
        _this.source_ = options.source || null;
        /**
         * @private
         * @type {HTMLElement}
         */
        _this.target = options.target ? options.target : null;
        return _this;
    }
    /**
     * @param {File} file File.
     * @param {Event} event Load event.
     * @private
     */
    DragAndDrop.prototype.handleResult_ = function (file, event) {
        var result = event.target.result;
        var map = this.getMap();
        var projection = this.projection_;
        if (!projection) {
            var view = map.getView();
            projection = view.getProjection();
        }
        var formatConstructors = this.formatConstructors_;
        var features = [];
        for (var i = 0, ii = formatConstructors.length; i < ii; ++i) {
            var format = new formatConstructors[i]();
            features = this.tryReadFeatures_(format, result, {
                featureProjection: projection
            });
            if (features && features.length > 0) {
                break;
            }
        }
        if (this.source_) {
            this.source_.clear();
            this.source_.addFeatures(features);
        }
        this.dispatchEvent(new DragAndDropEvent(DragAndDropEventType.ADD_FEATURES, file, features, projection));
    };
    /**
     * @private
     */
    DragAndDrop.prototype.registerListeners_ = function () {
        var map = this.getMap();
        if (map) {
            var dropArea = this.target ? this.target : map.getViewport();
            this.dropListenKeys_ = [
                Object(_events_js__WEBPACK_IMPORTED_MODULE_1__["listen"])(dropArea, _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].DROP, handleDrop, this),
                Object(_events_js__WEBPACK_IMPORTED_MODULE_1__["listen"])(dropArea, _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].DRAGENTER, handleStop, this),
                Object(_events_js__WEBPACK_IMPORTED_MODULE_1__["listen"])(dropArea, _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].DRAGOVER, handleStop, this),
                Object(_events_js__WEBPACK_IMPORTED_MODULE_1__["listen"])(dropArea, _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].DROP, handleStop, this)
            ];
        }
    };
    /**
     * @inheritDoc
     */
    DragAndDrop.prototype.setActive = function (active) {
        if (!this.getActive() && active) {
            this.registerListeners_();
        }
        if (this.getActive() && !active) {
            this.unregisterListeners_();
        }
        _super.prototype.setActive.call(this, active);
    };
    /**
     * @inheritDoc
     */
    DragAndDrop.prototype.setMap = function (map) {
        this.unregisterListeners_();
        _super.prototype.setMap.call(this, map);
        if (this.getActive()) {
            this.registerListeners_();
        }
    };
    /**
     * @param {import("../format/Feature.js").default} format Format.
     * @param {string} text Text.
     * @param {import("../format/Feature.js").ReadOptions} options Read options.
     * @private
     * @return {Array<import("../Feature.js").FeatureLike>} Features.
     */
    DragAndDrop.prototype.tryReadFeatures_ = function (format, text, options) {
        try {
            return format.readFeatures(text, options);
        }
        catch (e) {
            return null;
        }
    };
    /**
     * @private
     */
    DragAndDrop.prototype.unregisterListeners_ = function () {
        if (this.dropListenKeys_) {
            this.dropListenKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_1__["unlistenByKey"]);
            this.dropListenKeys_ = null;
        }
    };
    return DragAndDrop;
}(_Interaction_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/**
 * @param {DragEvent} event Event.
 * @this {DragAndDrop}
 */
function handleDrop(event) {
    var files = event.dataTransfer.files;
    for (var i = 0, ii = files.length; i < ii; ++i) {
        var file = files.item(i);
        var reader = new FileReader();
        reader.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOAD, this.handleResult_.bind(this, file));
        reader.readAsText(file);
    }
}
/**
 * @param {DragEvent} event Event.
 */
function handleStop(event) {
    event.stopPropagation();
    event.preventDefault();
    event.dataTransfer.dropEffect = 'copy';
}
/* harmony default export */ __webpack_exports__["default"] = (DragAndDrop);
//# sourceMappingURL=DragAndDrop.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/DragBox.js":
/*!************************************************!*\
  !*** ./node_modules/ol/interaction/DragBox.js ***!
  \************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
/* harmony import */ var _render_Box_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../render/Box.js */ "./node_modules/ol/render/Box.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/DragBox
 */
// FIXME draw drag box





/**
 * A function that takes a {@link module:ol/MapBrowserEvent} and two
 * {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,
 * true should be returned.
 * @typedef {function(this: ?, import("../MapBrowserEvent.js").default, import("../pixel.js").Pixel, import("../pixel.js").Pixel):boolean} EndCondition
 */
/**
 * @typedef {Object} Options
 * @property {string} [className='ol-dragbox'] CSS class name for styling the box.
 * @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
 * to indicate whether that event should be handled.
 * Default is {@link ol/events/condition~mouseActionButton}.
 * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default
 * `boxEndCondition` function.
 * @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
 * {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.
 * Default is `true` if the area of the box is bigger than the `minArea` option.
 * @property {function(this:DragBox, import("../MapBrowserEvent.js").default)} [onBoxEnd] Code to execute just
 * before `boxend` is fired.
 */
/**
 * @enum {string}
 */
var DragBoxEventType = {
    /**
     * Triggered upon drag box start.
     * @event DragBoxEvent#boxstart
     * @api
     */
    BOXSTART: 'boxstart',
    /**
     * Triggered on drag when box is active.
     * @event DragBoxEvent#boxdrag
     * @api
     */
    BOXDRAG: 'boxdrag',
    /**
     * Triggered upon drag box end.
     * @event DragBoxEvent#boxend
     * @api
     */
    BOXEND: 'boxend'
};
/**
 * @classdesc
 * Events emitted by {@link module:ol/interaction/DragBox~DragBox} instances are instances of
 * this type.
 */
var DragBoxEvent = /** @class */ (function (_super) {
    __extends(DragBoxEvent, _super);
    /**
     * @param {string} type The event type.
     * @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
     * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Originating event.
     */
    function DragBoxEvent(type, coordinate, mapBrowserEvent) {
        var _this = _super.call(this, type) || this;
        /**
         * The coordinate of the drag event.
         * @const
         * @type {import("../coordinate.js").Coordinate}
         * @api
         */
        _this.coordinate = coordinate;
        /**
         * @const
         * @type {import("../MapBrowserEvent.js").default}
         * @api
         */
        _this.mapBrowserEvent = mapBrowserEvent;
        return _this;
    }
    return DragBoxEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * @classdesc
 * Allows the user to draw a vector box by clicking and dragging on the map,
 * normally combined with an {@link module:ol/events/condition} that limits
 * it to when the shift or other key is held down. This is used, for example,
 * for zooming to a specific area of the map
 * (see {@link module:ol/interaction/DragZoom~DragZoom} and
 * {@link module:ol/interaction/DragRotateAndZoom}).
 *
 * @fires DragBoxEvent
 * @api
 */
var DragBox = /** @class */ (function (_super) {
    __extends(DragBox, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function DragBox(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @type {import("../render/Box.js").default}
         * @private
         */
        _this.box_ = new _render_Box_js__WEBPACK_IMPORTED_MODULE_4__["default"](options.className || 'ol-dragbox');
        /**
         * @type {number}
         * @private
         */
        _this.minArea_ = options.minArea !== undefined ? options.minArea : 64;
        /**
         * Function to execute just before `onboxend` is fired
         * @type {function(this:DragBox, import("../MapBrowserEvent.js").default): void}
         * @private
         */
        _this.onBoxEnd_ = options.onBoxEnd ? options.onBoxEnd : _functions_js__WEBPACK_IMPORTED_MODULE_2__["VOID"];
        /**
         * @type {import("../pixel.js").Pixel}
         * @private
         */
        _this.startPixel_ = null;
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_1__["mouseActionButton"];
        /**
         * @private
         * @type {EndCondition}
         */
        _this.boxEndCondition_ = options.boxEndCondition ?
            options.boxEndCondition : _this.defaultBoxEndCondition;
        return _this;
    }
    /**
     * The default condition for determining whether the boxend event
     * should fire.
     * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent The originating MapBrowserEvent
     *     leading to the box end.
     * @param {import("../pixel.js").Pixel} startPixel The starting pixel of the box.
     * @param {import("../pixel.js").Pixel} endPixel The end pixel of the box.
     * @return {boolean} Whether or not the boxend condition should be fired.
     */
    DragBox.prototype.defaultBoxEndCondition = function (mapBrowserEvent, startPixel, endPixel) {
        var width = endPixel[0] - startPixel[0];
        var height = endPixel[1] - startPixel[1];
        return width * width + height * height >= this.minArea_;
    };
    /**
     * Returns geometry of last drawn box.
     * @return {import("../geom/Polygon.js").default} Geometry.
     * @api
     */
    DragBox.prototype.getGeometry = function () {
        return this.box_.getGeometry();
    };
    /**
     * @inheritDoc
     */
    DragBox.prototype.handleDragEvent = function (mapBrowserEvent) {
        this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
        this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXDRAG, mapBrowserEvent.coordinate, mapBrowserEvent));
    };
    /**
     * @inheritDoc
     */
    DragBox.prototype.handleUpEvent = function (mapBrowserEvent) {
        this.box_.setMap(null);
        if (this.boxEndCondition_(mapBrowserEvent, this.startPixel_, mapBrowserEvent.pixel)) {
            this.onBoxEnd_(mapBrowserEvent);
            this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXEND, mapBrowserEvent.coordinate, mapBrowserEvent));
        }
        return false;
    };
    /**
     * @inheritDoc
     */
    DragBox.prototype.handleDownEvent = function (mapBrowserEvent) {
        if (this.condition_(mapBrowserEvent)) {
            this.startPixel_ = mapBrowserEvent.pixel;
            this.box_.setMap(mapBrowserEvent.map);
            this.box_.setPixels(this.startPixel_, this.startPixel_);
            this.dispatchEvent(new DragBoxEvent(DragBoxEventType.BOXSTART, mapBrowserEvent.coordinate, mapBrowserEvent));
            return true;
        }
        else {
            return false;
        }
    };
    return DragBox;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (DragBox);
//# sourceMappingURL=DragBox.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/DragPan.js":
/*!************************************************!*\
  !*** ./node_modules/ol/interaction/DragPan.js ***!
  \************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _easing_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../easing.js */ "./node_modules/ol/easing.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/DragPan
 */





/**
 * @typedef {Object} Options
 * @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
 * to indicate whether that event should be handled.
 * Default is {@link module:ol/events/condition~noModifierKeys} and {@link module:ol/events/condition~primaryAction}.
 * In addition, if there is a `tabindex` attribute on the map element,
 * {@link module:ol/events/condition~focus} will also be applied.
 * @property {import("../Kinetic.js").default} [kinetic] Kinetic inertia to apply to the pan.
 */
/**
 * @classdesc
 * Allows the user to pan the map by dragging the map.
 * @api
 */
var DragPan = /** @class */ (function (_super) {
    __extends(DragPan, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function DragPan(opt_options) {
        var _this = _super.call(this, {
            stopDown: _functions_js__WEBPACK_IMPORTED_MODULE_3__["FALSE"]
        }) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @private
         * @type {import("../Kinetic.js").default|undefined}
         */
        _this.kinetic_ = options.kinetic;
        /**
         * @type {import("../pixel.js").Pixel}
         */
        _this.lastCentroid = null;
        /**
         * @type {number}
         */
        _this.lastPointersCount_;
        /**
         * @type {boolean}
         */
        _this.panning_ = false;
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : defaultCondition;
        /**
         * @private
         * @type {boolean}
         */
        _this.noKinetic_ = false;
        return _this;
    }
    /**
     * @private
     * @param {import("../MapBrowserEvent").default} mapBrowserEvent Event.
     * @return {boolean} Condition passes.
     */
    DragPan.prototype.conditionInternal_ = function (mapBrowserEvent) {
        var pass = true;
        if (mapBrowserEvent.map.getTargetElement().hasAttribute('tabindex')) {
            pass = Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_2__["focus"])(mapBrowserEvent);
        }
        return pass && this.condition_(mapBrowserEvent);
    };
    /**
     * @inheritDoc
     */
    DragPan.prototype.handleDragEvent = function (mapBrowserEvent) {
        if (!this.panning_) {
            this.panning_ = true;
            this.getMap().getView().beginInteraction();
        }
        var targetPointers = this.targetPointers;
        var centroid = Object(_Pointer_js__WEBPACK_IMPORTED_MODULE_4__["centroid"])(targetPointers);
        if (targetPointers.length == this.lastPointersCount_) {
            if (this.kinetic_) {
                this.kinetic_.update(centroid[0], centroid[1]);
            }
            if (this.lastCentroid) {
                var delta = [
                    this.lastCentroid[0] - centroid[0],
                    centroid[1] - this.lastCentroid[1]
                ];
                var map = mapBrowserEvent.map;
                var view = map.getView();
                Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_0__["scale"])(delta, view.getResolution());
                Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_0__["rotate"])(delta, view.getRotation());
                view.adjustCenterInternal(delta);
            }
        }
        else if (this.kinetic_) {
            // reset so we don't overestimate the kinetic energy after
            // after one finger down, tiny drag, second finger down
            this.kinetic_.begin();
        }
        this.lastCentroid = centroid;
        this.lastPointersCount_ = targetPointers.length;
        mapBrowserEvent.originalEvent.preventDefault();
    };
    /**
     * @inheritDoc
     */
    DragPan.prototype.handleUpEvent = function (mapBrowserEvent) {
        var map = mapBrowserEvent.map;
        var view = map.getView();
        if (this.targetPointers.length === 0) {
            if (!this.noKinetic_ && this.kinetic_ && this.kinetic_.end()) {
                var distance = this.kinetic_.getDistance();
                var angle = this.kinetic_.getAngle();
                var center = view.getCenterInternal();
                var centerpx = map.getPixelFromCoordinateInternal(center);
                var dest = map.getCoordinateFromPixelInternal([
                    centerpx[0] - distance * Math.cos(angle),
                    centerpx[1] - distance * Math.sin(angle)
                ]);
                view.animateInternal({
                    center: view.getConstrainedCenter(dest),
                    duration: 500,
                    easing: _easing_js__WEBPACK_IMPORTED_MODULE_1__["easeOut"]
                });
            }
            if (this.panning_) {
                this.panning_ = false;
                view.endInteraction();
            }
            return false;
        }
        else {
            if (this.kinetic_) {
                // reset so we don't overestimate the kinetic energy after
                // after one finger up, tiny drag, second finger up
                this.kinetic_.begin();
            }
            this.lastCentroid = null;
            return true;
        }
    };
    /**
     * @inheritDoc
     */
    DragPan.prototype.handleDownEvent = function (mapBrowserEvent) {
        if (this.targetPointers.length > 0 && this.conditionInternal_(mapBrowserEvent)) {
            var map = mapBrowserEvent.map;
            var view = map.getView();
            this.lastCentroid = null;
            // stop any current animation
            if (view.getAnimating()) {
                view.cancelAnimations();
            }
            if (this.kinetic_) {
                this.kinetic_.begin();
            }
            // No kinetic as soon as more than one pointer on the screen is
            // detected. This is to prevent nasty pans after pinch.
            this.noKinetic_ = this.targetPointers.length > 1;
            return true;
        }
        else {
            return false;
        }
    };
    return DragPan;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/**
 * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Browser event.
 * @return {boolean} Combined condition result.
 */
function defaultCondition(mapBrowserEvent) {
    return Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_2__["noModifierKeys"])(mapBrowserEvent) && Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_2__["primaryAction"])(mapBrowserEvent);
}
/* harmony default export */ __webpack_exports__["default"] = (DragPan);
//# sourceMappingURL=DragPan.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/DragRotate.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/interaction/DragRotate.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _rotationconstraint_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../rotationconstraint.js */ "./node_modules/ol/rotationconstraint.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/DragRotate
 */




/**
 * @typedef {Object} Options
 * @property {import("../events/condition.js").Condition} [condition] A function that takes an
 * {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
 * to indicate whether that event should be handled.
 * Default is {@link module:ol/events/condition~altShiftKeysOnly}.
 * @property {number} [duration=250] Animation duration in milliseconds.
 */
/**
 * @classdesc
 * Allows the user to rotate the map by clicking and dragging on the map,
 * normally combined with an {@link module:ol/events/condition} that limits
 * it to when the alt and shift keys are held down.
 *
 * This interaction is only supported for mouse devices.
 * @api
 */
var DragRotate = /** @class */ (function (_super) {
    __extends(DragRotate, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function DragRotate(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            stopDown: _functions_js__WEBPACK_IMPORTED_MODULE_2__["FALSE"]
        }) || this;
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_1__["altShiftKeysOnly"];
        /**
         * @private
         * @type {number|undefined}
         */
        _this.lastAngle_ = undefined;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 250;
        return _this;
    }
    /**
     * @inheritDoc
     */
    DragRotate.prototype.handleDragEvent = function (mapBrowserEvent) {
        if (!Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_1__["mouseOnly"])(mapBrowserEvent)) {
            return;
        }
        var map = mapBrowserEvent.map;
        var view = map.getView();
        if (view.getConstraints().rotation === _rotationconstraint_js__WEBPACK_IMPORTED_MODULE_0__["disable"]) {
            return;
        }
        var size = map.getSize();
        var offset = mapBrowserEvent.pixel;
        var theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
        if (this.lastAngle_ !== undefined) {
            var delta = theta - this.lastAngle_;
            view.adjustRotationInternal(-delta);
        }
        this.lastAngle_ = theta;
    };
    /**
     * @inheritDoc
     */
    DragRotate.prototype.handleUpEvent = function (mapBrowserEvent) {
        if (!Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_1__["mouseOnly"])(mapBrowserEvent)) {
            return true;
        }
        var map = mapBrowserEvent.map;
        var view = map.getView();
        view.endInteraction(this.duration_);
        return false;
    };
    /**
     * @inheritDoc
     */
    DragRotate.prototype.handleDownEvent = function (mapBrowserEvent) {
        if (!Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_1__["mouseOnly"])(mapBrowserEvent)) {
            return false;
        }
        if (Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_1__["mouseActionButton"])(mapBrowserEvent) && this.condition_(mapBrowserEvent)) {
            var map = mapBrowserEvent.map;
            map.getView().beginInteraction();
            this.lastAngle_ = undefined;
            return true;
        }
        else {
            return false;
        }
    };
    return DragRotate;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (DragRotate);
//# sourceMappingURL=DragRotate.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/DragRotateAndZoom.js":
/*!**********************************************************!*\
  !*** ./node_modules/ol/interaction/DragRotateAndZoom.js ***!
  \**********************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/DragRotateAndZoom
 */


/**
 * @typedef {Object} Options
 * @property {import("../events/condition.js").Condition} [condition] A function that
 * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled.
 * Default is {@link module:ol/events/condition~shiftKeyOnly}.
 * @property {number} [duration=400] Animation duration in milliseconds.
 */
/**
 * @classdesc
 * Allows the user to zoom and rotate the map by clicking and dragging
 * on the map.  By default, this interaction is limited to when the shift
 * key is held down.
 *
 * This interaction is only supported for mouse devices.
 *
 * And this interaction is not included in the default interactions.
 * @api
 */
var DragRotateAndZoom = /** @class */ (function (_super) {
    __extends(DragRotateAndZoom, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function DragRotateAndZoom(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, /** @type {import("./Pointer.js").Options} */ (options)) || this;
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_0__["shiftKeyOnly"];
        /**
         * @private
         * @type {number|undefined}
         */
        _this.lastAngle_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.lastMagnitude_ = undefined;
        /**
         * @private
         * @type {number}
         */
        _this.lastScaleDelta_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 400;
        return _this;
    }
    /**
     * @inheritDoc
     */
    DragRotateAndZoom.prototype.handleDragEvent = function (mapBrowserEvent) {
        if (!Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_0__["mouseOnly"])(mapBrowserEvent)) {
            return;
        }
        var map = mapBrowserEvent.map;
        var size = map.getSize();
        var offset = mapBrowserEvent.pixel;
        var deltaX = offset[0] - size[0] / 2;
        var deltaY = size[1] / 2 - offset[1];
        var theta = Math.atan2(deltaY, deltaX);
        var magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
        var view = map.getView();
        if (this.lastAngle_ !== undefined) {
            var angleDelta = this.lastAngle_ - theta;
            view.adjustRotationInternal(angleDelta);
        }
        this.lastAngle_ = theta;
        if (this.lastMagnitude_ !== undefined) {
            view.adjustResolutionInternal(this.lastMagnitude_ / magnitude);
        }
        if (this.lastMagnitude_ !== undefined) {
            this.lastScaleDelta_ = this.lastMagnitude_ / magnitude;
        }
        this.lastMagnitude_ = magnitude;
    };
    /**
     * @inheritDoc
     */
    DragRotateAndZoom.prototype.handleUpEvent = function (mapBrowserEvent) {
        if (!Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_0__["mouseOnly"])(mapBrowserEvent)) {
            return true;
        }
        var map = mapBrowserEvent.map;
        var view = map.getView();
        var direction = this.lastScaleDelta_ > 1 ? 1 : -1;
        view.endInteraction(this.duration_, direction);
        this.lastScaleDelta_ = 0;
        return false;
    };
    /**
     * @inheritDoc
     */
    DragRotateAndZoom.prototype.handleDownEvent = function (mapBrowserEvent) {
        if (!Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_0__["mouseOnly"])(mapBrowserEvent)) {
            return false;
        }
        if (this.condition_(mapBrowserEvent)) {
            mapBrowserEvent.map.getView().beginInteraction();
            this.lastAngle_ = undefined;
            this.lastMagnitude_ = undefined;
            return true;
        }
        else {
            return false;
        }
    };
    return DragRotateAndZoom;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (DragRotateAndZoom);
//# sourceMappingURL=DragRotateAndZoom.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/DragZoom.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/interaction/DragZoom.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _easing_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../easing.js */ "./node_modules/ol/easing.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _DragBox_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DragBox.js */ "./node_modules/ol/interaction/DragBox.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/DragZoom
 */




/**
 * @typedef {Object} Options
 * @property {string} [className='ol-dragzoom'] CSS class name for styling the
 * box.
 * @property {import("../events/condition.js").Condition} [condition] A function that
 * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled.
 * Default is {@link module:ol/events/condition~shiftKeyOnly}.
 * @property {number} [duration=200] Animation duration in milliseconds.
 * @property {boolean} [out=false] Use interaction for zooming out.
 * @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the parent default
 * `boxEndCondition` function.
 */
/**
 * @classdesc
 * Allows the user to zoom the map by clicking and dragging on the map,
 * normally combined with an {@link module:ol/events/condition} that limits
 * it to when a key, shift by default, is held down.
 *
 * To change the style of the box, use CSS and the `.ol-dragzoom` selector, or
 * your custom one configured with `className`.
 * @api
 */
var DragZoom = /** @class */ (function (_super) {
    __extends(DragZoom, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function DragZoom(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var condition = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_1__["shiftKeyOnly"];
        _this = _super.call(this, {
            condition: condition,
            className: options.className || 'ol-dragzoom',
            minArea: options.minArea,
            onBoxEnd: onBoxEnd
        }) || this;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 200;
        /**
         * @private
         * @type {boolean}
         */
        _this.out_ = options.out !== undefined ? options.out : false;
        return _this;
    }
    return DragZoom;
}(_DragBox_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * @this {DragZoom}
 */
function onBoxEnd() {
    var map = this.getMap();
    var view = /** @type {!import("../View.js").default} */ (map.getView());
    var size = /** @type {!import("../size.js").Size} */ (map.getSize());
    var extent = this.getGeometry().getExtent();
    if (this.out_) {
        var mapExtent = view.calculateExtentInternal(size);
        var boxPixelExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["createOrUpdateFromCoordinates"])([
            map.getPixelFromCoordinateInternal(Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getBottomLeft"])(extent)),
            map.getPixelFromCoordinateInternal(Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getTopRight"])(extent))
        ]);
        var factor = view.getResolutionForExtentInternal(boxPixelExtent, size);
        Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["scaleFromCenter"])(mapExtent, 1 / factor);
        extent = mapExtent;
    }
    var resolution = view.getConstrainedResolution(view.getResolutionForExtentInternal(extent, size));
    var center = view.getConstrainedCenter(Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getCenter"])(extent), resolution);
    view.animateInternal({
        resolution: resolution,
        center: center,
        duration: this.duration_,
        easing: _easing_js__WEBPACK_IMPORTED_MODULE_0__["easeOut"]
    });
}
/* harmony default export */ __webpack_exports__["default"] = (DragZoom);
//# sourceMappingURL=DragZoom.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Draw.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/interaction/Draw.js ***!
  \*********************************************/
/*! exports provided: createRegularPolygon, createBox, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRegularPolygon", function() { return createRegularPolygon; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBox", function() { return createBox; });
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
/* harmony import */ var _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../MapBrowserPointerEvent.js */ "./node_modules/ol/MapBrowserPointerEvent.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _geom_Circle_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../geom/Circle.js */ "./node_modules/ol/geom/Circle.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geom/MultiLineString.js */ "./node_modules/ol/geom/MultiLineString.js");
/* harmony import */ var _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../geom/MultiPoint.js */ "./node_modules/ol/geom/MultiPoint.js");
/* harmony import */ var _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../geom/MultiPolygon.js */ "./node_modules/ol/geom/MultiPolygon.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
/* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./Property.js */ "./node_modules/ol/interaction/Property.js");
/* harmony import */ var _layer_Vector_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../layer/Vector.js */ "./node_modules/ol/layer/Vector.js");
/* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../source/Vector.js */ "./node_modules/ol/source/Vector.js");
/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/ol/style/Style.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/Draw
 */
























/**
 * @typedef {Object} Options
 * @property {GeometryType} type Geometry type of
 * the geometries being drawn with this instance.
 * @property {number} [clickTolerance=6] The maximum distance in pixels between
 * "down" and "up" for a "up" event to be considered a "click" event and
 * actually add a point/vertex to the geometry being drawn.  The default of `6`
 * was chosen for the draw interaction to behave correctly on mouse as well as
 * on touch devices.
 * @property {import("../Collection.js").default<Feature>} [features]
 * Destination collection for the drawn features.
 * @property {VectorSource} [source] Destination source for
 * the drawn features.
 * @property {number} [dragVertexDelay=500] Delay in milliseconds after pointerdown
 * before the current vertex can be dragged to its exact position.
 * @property {number} [snapTolerance=12] Pixel distance for snapping to the
 * drawing finish.
 * @property {boolean} [stopClick=false] Stop click, singleclick, and
 * doubleclick events from firing during drawing.
 * @property {number} [maxPoints] The number of points that can be drawn before
 * a polygon ring or line string is finished. By default there is no
 * restriction.
 * @property {number} [minPoints] The number of points that must be drawn
 * before a polygon ring or line string can be finished. Default is `3` for
 * polygon rings and `2` for line strings.
 * @property {import("../events/condition.js").Condition} [finishCondition] A function
 * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether the drawing can be finished.
 * @property {import("../style/Style.js").StyleLike} [style]
 * Style for sketch features.
 * @property {GeometryFunction} [geometryFunction]
 * Function that is called when a geometry's coordinates are updated.
 * @property {string} [geometryName] Geometry name to use for features created
 * by the draw interaction.
 * @property {import("../events/condition.js").Condition} [condition] A function that
 * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled.
 * By default {@link module:ol/events/condition~noModifierKeys}, i.e. a click,
 * adds a vertex or deactivates freehand drawing.
 * @property {boolean} [freehand=false] Operate in freehand mode for lines,
 * polygons, and circles.  This makes the interaction always operate in freehand
 * mode and takes precedence over any `freehandCondition` option.
 * @property {import("../events/condition.js").Condition} [freehandCondition]
 * Condition that activates freehand drawing for lines and polygons. This
 * function takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and
 * returns a boolean to indicate whether that event should be handled. The
 * default is {@link module:ol/events/condition~shiftKeyOnly}, meaning that the
 * Shift key activates freehand drawing.
 * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch
 * overlay.
 */
/**
 * Coordinate type when drawing points.
 * @typedef {import("../coordinate.js").Coordinate} PointCoordType
 */
/**
 * Coordinate type when drawing lines.
 * @typedef {Array<import("../coordinate.js").Coordinate>} LineCoordType
 */
/**
 * Coordinate type when drawing polygons.
 * @typedef {Array<Array<import("../coordinate.js").Coordinate>>} PolyCoordType
 */
/**
 * Types used for drawing coordinates.
 * @typedef {PointCoordType|LineCoordType|PolyCoordType} SketchCoordType
 */
/**
 * Function that takes an array of coordinates and an optional existing geometry
 * and a projection as arguments, and returns a geometry. The optional existing
 * geometry is the geometry that is returned when the function is called without
 * a second argument.
 * @typedef {function(!SketchCoordType, import("../geom/SimpleGeometry.js").default=,
 *     import("../proj/Projection.js").default=):
 *     import("../geom/SimpleGeometry.js").default} GeometryFunction
 */
/**
 * Draw mode.  This collapses multi-part geometry types with their single-part
 * cousins.
 * @enum {string}
 */
var Mode = {
    POINT: 'Point',
    LINE_STRING: 'LineString',
    POLYGON: 'Polygon',
    CIRCLE: 'Circle'
};
/**
 * @enum {string}
 */
var DrawEventType = {
    /**
     * Triggered upon feature draw start
     * @event DrawEvent#drawstart
     * @api
     */
    DRAWSTART: 'drawstart',
    /**
     * Triggered upon feature draw end
     * @event DrawEvent#drawend
     * @api
     */
    DRAWEND: 'drawend',
    /**
     * Triggered upon feature draw abortion
     * @event DrawEvent#drawabort
     * @api
     */
    DRAWABORT: 'drawabort'
};
/**
 * @classdesc
 * Events emitted by {@link module:ol/interaction/Draw~Draw} instances are
 * instances of this type.
 */
var DrawEvent = /** @class */ (function (_super) {
    __extends(DrawEvent, _super);
    /**
     * @param {DrawEventType} type Type.
     * @param {Feature} feature The feature drawn.
     */
    function DrawEvent(type, feature) {
        var _this = _super.call(this, type) || this;
        /**
         * The feature being drawn.
         * @type {Feature}
         * @api
         */
        _this.feature = feature;
        return _this;
    }
    return DrawEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/**
 * @classdesc
 * Interaction for drawing feature geometries.
 *
 * @fires DrawEvent
 * @api
 */
var Draw = /** @class */ (function (_super) {
    __extends(Draw, _super);
    /**
     * @param {Options} options Options.
     */
    function Draw(options) {
        var _this = this;
        var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
        if (!pointerOptions.stopDown) {
            pointerOptions.stopDown = _functions_js__WEBPACK_IMPORTED_MODULE_9__["FALSE"];
        }
        _this = _super.call(this, pointerOptions) || this;
        /**
         * @type {boolean}
         * @private
         */
        _this.shouldHandle_ = false;
        /**
         * @type {import("../pixel.js").Pixel}
         * @private
         */
        _this.downPx_ = null;
        /**
         * @type {?}
         * @private
         */
        _this.downTimeout_;
        /**
         * @type {number|undefined}
         * @private
         */
        _this.lastDragTime_;
        /**
         * @type {boolean}
         * @private
         */
        _this.freehand_ = false;
        /**
         * Target source for drawn features.
         * @type {VectorSource}
         * @private
         */
        _this.source_ = options.source ? options.source : null;
        /**
         * Target collection for drawn features.
         * @type {import("../Collection.js").default<Feature>}
         * @private
         */
        _this.features_ = options.features ? options.features : null;
        /**
         * Pixel distance for snapping.
         * @type {number}
         * @private
         */
        _this.snapTolerance_ = options.snapTolerance ? options.snapTolerance : 12;
        /**
         * Geometry type.
         * @type {GeometryType}
         * @private
         */
        _this.type_ = /** @type {GeometryType} */ (options.type);
        /**
         * Drawing mode (derived from geometry type.
         * @type {Mode}
         * @private
         */
        _this.mode_ = getMode(_this.type_);
        /**
         * Stop click, singleclick, and doubleclick events from firing during drawing.
         * Default is `false`.
         * @type {boolean}
         * @private
         */
        _this.stopClick_ = !!options.stopClick;
        /**
         * The number of points that must be drawn before a polygon ring or line
         * string can be finished.  The default is 3 for polygon rings and 2 for
         * line strings.
         * @type {number}
         * @private
         */
        _this.minPoints_ = options.minPoints ?
            options.minPoints :
            (_this.mode_ === Mode.POLYGON ? 3 : 2);
        /**
         * The number of points that can be drawn before a polygon ring or line string
         * is finished. The default is no restriction.
         * @type {number}
         * @private
         */
        _this.maxPoints_ = options.maxPoints ? options.maxPoints : Infinity;
        /**
         * A function to decide if a potential finish coordinate is permissible
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.finishCondition_ = options.finishCondition ? options.finishCondition : _functions_js__WEBPACK_IMPORTED_MODULE_9__["TRUE"];
        var geometryFunction = options.geometryFunction;
        if (!geometryFunction) {
            if (_this.type_ === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].CIRCLE) {
                /**
                 * @param {!LineCoordType} coordinates The coordinates.
                 * @param {import("../geom/SimpleGeometry.js").default=} opt_geometry Optional geometry.
                 * @param {import("../proj/Projection.js").default} projection The view projection.
                 * @return {import("../geom/SimpleGeometry.js").default} A geometry.
                 */
                geometryFunction = function (coordinates, opt_geometry, projection) {
                    var circle = opt_geometry ? /** @type {Circle} */ (opt_geometry) :
                        new _geom_Circle_js__WEBPACK_IMPORTED_MODULE_10__["default"]([NaN, NaN]);
                    var center = Object(_proj_js__WEBPACK_IMPORTED_MODULE_23__["fromUserCoordinate"])(coordinates[0], projection);
                    var squaredLength = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_5__["squaredDistance"])(center, Object(_proj_js__WEBPACK_IMPORTED_MODULE_23__["fromUserCoordinate"])(coordinates[1], projection));
                    circle.setCenterAndRadius(center, Math.sqrt(squaredLength));
                    var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_23__["getUserProjection"])();
                    if (userProjection) {
                        circle.transform(projection, userProjection);
                    }
                    return circle;
                };
            }
            else {
                var Constructor_1;
                var mode_1 = _this.mode_;
                if (mode_1 === Mode.POINT) {
                    Constructor_1 = _geom_Point_js__WEBPACK_IMPORTED_MODULE_16__["default"];
                }
                else if (mode_1 === Mode.LINE_STRING) {
                    Constructor_1 = _geom_LineString_js__WEBPACK_IMPORTED_MODULE_12__["default"];
                }
                else if (mode_1 === Mode.POLYGON) {
                    Constructor_1 = _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_17__["default"];
                }
                /**
                 * @param {!LineCoordType} coordinates The coordinates.
                 * @param {import("../geom/SimpleGeometry.js").default=} opt_geometry Optional geometry.
                 * @param {import("../proj/Projection.js").default} projection The view projection.
                 * @return {import("../geom/SimpleGeometry.js").default} A geometry.
                 */
                geometryFunction = function (coordinates, opt_geometry, projection) {
                    var geometry = opt_geometry;
                    if (geometry) {
                        if (mode_1 === Mode.POLYGON) {
                            if (coordinates[0].length) {
                                // Add a closing coordinate to match the first
                                geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]);
                            }
                            else {
                                geometry.setCoordinates([]);
                            }
                        }
                        else {
                            geometry.setCoordinates(coordinates);
                        }
                    }
                    else {
                        geometry = new Constructor_1(coordinates);
                    }
                    return geometry;
                };
            }
        }
        /**
         * @type {GeometryFunction}
         * @private
         */
        _this.geometryFunction_ = geometryFunction;
        /**
         * @type {number}
         * @private
         */
        _this.dragVertexDelay_ = options.dragVertexDelay !== undefined ? options.dragVertexDelay : 500;
        /**
         * Finish coordinate for the feature (first point for polygons, last point for
         * linestrings).
         * @type {import("../coordinate.js").Coordinate}
         * @private
         */
        _this.finishCoordinate_ = null;
        /**
         * Sketch feature.
         * @type {Feature}
         * @private
         */
        _this.sketchFeature_ = null;
        /**
         * Sketch point.
         * @type {Feature<Point>}
         * @private
         */
        _this.sketchPoint_ = null;
        /**
         * Sketch coordinates. Used when drawing a line or polygon.
         * @type {SketchCoordType}
         * @private
         */
        _this.sketchCoords_ = null;
        /**
         * Sketch line. Used when drawing polygon.
         * @type {Feature<LineString>}
         * @private
         */
        _this.sketchLine_ = null;
        /**
         * Sketch line coordinates. Used when drawing a polygon or circle.
         * @type {LineCoordType}
         * @private
         */
        _this.sketchLineCoords_ = null;
        /**
         * Squared tolerance for handling up events.  If the squared distance
         * between a down and up event is greater than this tolerance, up events
         * will not be handled.
         * @type {number}
         * @private
         */
        _this.squaredClickTolerance_ = options.clickTolerance ?
            options.clickTolerance * options.clickTolerance : 36;
        /**
         * Draw overlay where our sketch features are drawn.
         * @type {VectorLayer}
         * @private
         */
        _this.overlay_ = new _layer_Vector_js__WEBPACK_IMPORTED_MODULE_20__["default"]({
            source: new _source_Vector_js__WEBPACK_IMPORTED_MODULE_21__["default"]({
                useSpatialIndex: false,
                wrapX: options.wrapX ? options.wrapX : false
            }),
            style: options.style ? options.style : getDefaultStyleFunction(),
            updateWhileInteracting: true
        });
        /**
         * Name of the geometry attribute for newly created features.
         * @type {string|undefined}
         * @private
         */
        _this.geometryName_ = options.geometryName;
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_7__["noModifierKeys"];
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.freehandCondition_;
        if (options.freehand) {
            _this.freehandCondition_ = _events_condition_js__WEBPACK_IMPORTED_MODULE_7__["always"];
        }
        else {
            _this.freehandCondition_ = options.freehandCondition ? options.freehandCondition : _events_condition_js__WEBPACK_IMPORTED_MODULE_7__["shiftKeyOnly"];
        }
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_4__["getChangeEventType"])(_Property_js__WEBPACK_IMPORTED_MODULE_19__["default"].ACTIVE), _this.updateState_);
        return _this;
    }
    /**
     * @inheritDoc
     */
    Draw.prototype.setMap = function (map) {
        _super.prototype.setMap.call(this, map);
        this.updateState_();
    };
    /**
     * Get the overlay layer that this interaction renders sketch features to.
     * @return {VectorLayer} Overlay layer.
     * @api
     */
    Draw.prototype.getOverlay = function () {
        return this.overlay_;
    };
    /**
     * Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually draw or finish the drawing.
     * @override
     * @api
     */
    Draw.prototype.handleEvent = function (event) {
        if (event.originalEvent.type === _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].CONTEXTMENU) {
            // Avoid context menu for long taps when drawing on mobile
            event.preventDefault();
        }
        this.freehand_ = this.mode_ !== Mode.POINT && this.freehandCondition_(event);
        var move = event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERMOVE;
        var pass = true;
        if (!this.freehand_ && this.lastDragTime_ && event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERDRAG) {
            var now = Date.now();
            if (now - this.lastDragTime_ >= this.dragVertexDelay_) {
                this.downPx_ = event.pixel;
                this.shouldHandle_ = !this.freehand_;
                move = true;
            }
            else {
                this.lastDragTime_ = undefined;
            }
            if (this.shouldHandle_ && this.downTimeout_ !== undefined) {
                clearTimeout(this.downTimeout_);
                this.downTimeout_ = undefined;
            }
        }
        if (this.freehand_ &&
            event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERDRAG &&
            this.sketchFeature_ !== null) {
            this.addToDrawing_(event.coordinate);
            pass = false;
        }
        else if (this.freehand_ &&
            event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERDOWN) {
            pass = false;
        }
        else if (move) {
            pass = event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERMOVE;
            if (pass && this.freehand_) {
                pass = this.handlePointerMove_(event);
            }
            else if ( /** @type {MapBrowserPointerEvent} */(event).pointerEvent.pointerType == 'mouse' ||
                (event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERDRAG && this.downTimeout_ === undefined)) {
                this.handlePointerMove_(event);
            }
        }
        else if (event.type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].DBLCLICK) {
            pass = false;
        }
        return _super.prototype.handleEvent.call(this, event) && pass;
    };
    /**
     * @inheritDoc
     */
    Draw.prototype.handleDownEvent = function (event) {
        this.shouldHandle_ = !this.freehand_;
        if (this.freehand_) {
            this.downPx_ = event.pixel;
            if (!this.finishCoordinate_) {
                this.startDrawing_(event);
            }
            return true;
        }
        else if (this.condition_(event)) {
            this.lastDragTime_ = Date.now();
            this.downTimeout_ = setTimeout(function () {
                this.handlePointerMove_(new _MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_3__["default"](_MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINTERMOVE, event.map, event.pointerEvent, false, event.frameState));
            }.bind(this), this.dragVertexDelay_);
            this.downPx_ = event.pixel;
            return true;
        }
        else {
            this.lastDragTime_ = undefined;
            return false;
        }
    };
    /**
     * @inheritDoc
     */
    Draw.prototype.handleUpEvent = function (event) {
        var pass = true;
        if (this.downTimeout_) {
            clearTimeout(this.downTimeout_);
            this.downTimeout_ = undefined;
        }
        this.handlePointerMove_(event);
        var circleMode = this.mode_ === Mode.CIRCLE;
        if (this.shouldHandle_) {
            if (!this.finishCoordinate_) {
                this.startDrawing_(event);
                if (this.mode_ === Mode.POINT) {
                    this.finishDrawing();
                }
            }
            else if (this.freehand_ || circleMode) {
                this.finishDrawing();
            }
            else if (this.atFinish_(event)) {
                if (this.finishCondition_(event)) {
                    this.finishDrawing();
                }
            }
            else {
                this.addToDrawing_(event.coordinate);
            }
            pass = false;
        }
        else if (this.freehand_) {
            this.abortDrawing();
        }
        if (!pass && this.stopClick_) {
            event.stopPropagation();
        }
        return pass;
    };
    /**
     * Handle move events.
     * @param {import("../MapBrowserEvent.js").default} event A move event.
     * @return {boolean} Pass the event to other interactions.
     * @private
     */
    Draw.prototype.handlePointerMove_ = function (event) {
        if (this.downPx_ &&
            ((!this.freehand_ && this.shouldHandle_) ||
                (this.freehand_ && !this.shouldHandle_))) {
            var downPx = this.downPx_;
            var clickPx = event.pixel;
            var dx = downPx[0] - clickPx[0];
            var dy = downPx[1] - clickPx[1];
            var squaredDistance = dx * dx + dy * dy;
            this.shouldHandle_ = this.freehand_ ?
                squaredDistance > this.squaredClickTolerance_ :
                squaredDistance <= this.squaredClickTolerance_;
            if (!this.shouldHandle_) {
                return true;
            }
        }
        if (this.finishCoordinate_) {
            this.modifyDrawing_(event);
        }
        else {
            this.createOrUpdateSketchPoint_(event);
        }
        return true;
    };
    /**
     * Determine if an event is within the snapping tolerance of the start coord.
     * @param {import("../MapBrowserEvent.js").default} event Event.
     * @return {boolean} The event is within the snapping tolerance of the start.
     * @private
     */
    Draw.prototype.atFinish_ = function (event) {
        var at = false;
        if (this.sketchFeature_) {
            var potentiallyDone = false;
            var potentiallyFinishCoordinates = [this.finishCoordinate_];
            if (this.mode_ === Mode.LINE_STRING) {
                potentiallyDone = this.sketchCoords_.length > this.minPoints_;
            }
            else if (this.mode_ === Mode.POLYGON) {
                var sketchCoords = /** @type {PolyCoordType} */ (this.sketchCoords_);
                potentiallyDone = sketchCoords[0].length > this.minPoints_;
                potentiallyFinishCoordinates = [sketchCoords[0][0], sketchCoords[0][sketchCoords[0].length - 2]];
            }
            if (potentiallyDone) {
                var map = event.map;
                for (var i = 0, ii = potentiallyFinishCoordinates.length; i < ii; i++) {
                    var finishCoordinate = potentiallyFinishCoordinates[i];
                    var finishPixel = map.getPixelFromCoordinate(finishCoordinate);
                    var pixel = event.pixel;
                    var dx = pixel[0] - finishPixel[0];
                    var dy = pixel[1] - finishPixel[1];
                    var snapTolerance = this.freehand_ ? 1 : this.snapTolerance_;
                    at = Math.sqrt(dx * dx + dy * dy) <= snapTolerance;
                    if (at) {
                        this.finishCoordinate_ = finishCoordinate;
                        break;
                    }
                }
            }
        }
        return at;
    };
    /**
     * @param {import("../MapBrowserEvent.js").default} event Event.
     * @private
     */
    Draw.prototype.createOrUpdateSketchPoint_ = function (event) {
        var coordinates = event.coordinate.slice();
        if (!this.sketchPoint_) {
            this.sketchPoint_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_16__["default"](coordinates));
            this.updateSketchFeatures_();
        }
        else {
            var sketchPointGeom = this.sketchPoint_.getGeometry();
            sketchPointGeom.setCoordinates(coordinates);
        }
    };
    /**
     * Start the drawing.
     * @param {import("../MapBrowserEvent.js").default} event Event.
     * @private
     */
    Draw.prototype.startDrawing_ = function (event) {
        var start = event.coordinate;
        var projection = event.map.getView().getProjection();
        this.finishCoordinate_ = start;
        if (this.mode_ === Mode.POINT) {
            this.sketchCoords_ = start.slice();
        }
        else if (this.mode_ === Mode.POLYGON) {
            this.sketchCoords_ = [[start.slice(), start.slice()]];
            this.sketchLineCoords_ = this.sketchCoords_[0];
        }
        else {
            this.sketchCoords_ = [start.slice(), start.slice()];
        }
        if (this.sketchLineCoords_) {
            this.sketchLine_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"](new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_12__["default"](this.sketchLineCoords_));
        }
        var geometry = this.geometryFunction_(this.sketchCoords_, undefined, projection);
        this.sketchFeature_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"]();
        if (this.geometryName_) {
            this.sketchFeature_.setGeometryName(this.geometryName_);
        }
        this.sketchFeature_.setGeometry(geometry);
        this.updateSketchFeatures_();
        this.dispatchEvent(new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_));
    };
    /**
     * Modify the drawing.
     * @param {import("../MapBrowserEvent.js").default} event Event.
     * @private
     */
    Draw.prototype.modifyDrawing_ = function (event) {
        var coordinate = event.coordinate;
        var geometry = this.sketchFeature_.getGeometry();
        var projection = event.map.getView().getProjection();
        var coordinates, last;
        if (this.mode_ === Mode.POINT) {
            last = this.sketchCoords_;
        }
        else if (this.mode_ === Mode.POLYGON) {
            coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
            last = coordinates[coordinates.length - 1];
            if (this.atFinish_(event)) {
                // snap to finish
                coordinate = this.finishCoordinate_.slice();
            }
        }
        else {
            coordinates = this.sketchCoords_;
            last = coordinates[coordinates.length - 1];
        }
        last[0] = coordinate[0];
        last[1] = coordinate[1];
        this.geometryFunction_(/** @type {!LineCoordType} */ (this.sketchCoords_), geometry, projection);
        if (this.sketchPoint_) {
            var sketchPointGeom = this.sketchPoint_.getGeometry();
            sketchPointGeom.setCoordinates(coordinate);
        }
        /** @type {LineString} */
        var sketchLineGeom;
        if (geometry.getType() == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].POLYGON &&
            this.mode_ !== Mode.POLYGON) {
            if (!this.sketchLine_) {
                this.sketchLine_ = new _Feature_js__WEBPACK_IMPORTED_MODULE_1__["default"]();
            }
            var ring = geometry.getLinearRing(0);
            sketchLineGeom = this.sketchLine_.getGeometry();
            if (!sketchLineGeom) {
                sketchLineGeom = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_12__["default"](ring.getFlatCoordinates(), ring.getLayout());
                this.sketchLine_.setGeometry(sketchLineGeom);
            }
            else {
                sketchLineGeom.setFlatCoordinates(ring.getLayout(), ring.getFlatCoordinates());
                sketchLineGeom.changed();
            }
        }
        else if (this.sketchLineCoords_) {
            sketchLineGeom = this.sketchLine_.getGeometry();
            sketchLineGeom.setCoordinates(this.sketchLineCoords_);
        }
        this.updateSketchFeatures_();
    };
    /**
     * Add a new coordinate to the drawing.
     * @param {!PointCoordType} coordinate Coordinate
     * @private
     */
    Draw.prototype.addToDrawing_ = function (coordinate) {
        var geometry = this.sketchFeature_.getGeometry();
        var projection = this.getMap().getView().getProjection();
        var done;
        var coordinates;
        if (this.mode_ === Mode.LINE_STRING) {
            this.finishCoordinate_ = coordinate.slice();
            coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);
            if (coordinates.length >= this.maxPoints_) {
                if (this.freehand_) {
                    coordinates.pop();
                }
                else {
                    done = true;
                }
            }
            coordinates.push(coordinate.slice());
            this.geometryFunction_(coordinates, geometry, projection);
        }
        else if (this.mode_ === Mode.POLYGON) {
            coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
            if (coordinates.length >= this.maxPoints_) {
                if (this.freehand_) {
                    coordinates.pop();
                }
                else {
                    done = true;
                }
            }
            coordinates.push(coordinate.slice());
            if (done) {
                this.finishCoordinate_ = coordinates[0];
            }
            this.geometryFunction_(this.sketchCoords_, geometry, projection);
        }
        this.updateSketchFeatures_();
        if (done) {
            this.finishDrawing();
        }
    };
    /**
     * Remove last point of the feature currently being drawn.
     * @api
     */
    Draw.prototype.removeLastPoint = function () {
        if (!this.sketchFeature_) {
            return;
        }
        var geometry = this.sketchFeature_.getGeometry();
        var projection = this.getMap().getView().getProjection();
        var coordinates;
        /** @type {LineString} */
        var sketchLineGeom;
        if (this.mode_ === Mode.LINE_STRING) {
            coordinates = /** @type {LineCoordType} */ (this.sketchCoords_);
            coordinates.splice(-2, 1);
            this.geometryFunction_(coordinates, geometry, projection);
            if (coordinates.length >= 2) {
                this.finishCoordinate_ = coordinates[coordinates.length - 2].slice();
            }
        }
        else if (this.mode_ === Mode.POLYGON) {
            coordinates = /** @type {PolyCoordType} */ (this.sketchCoords_)[0];
            coordinates.splice(-2, 1);
            sketchLineGeom = this.sketchLine_.getGeometry();
            sketchLineGeom.setCoordinates(coordinates);
            this.geometryFunction_(this.sketchCoords_, geometry, projection);
        }
        if (coordinates.length === 0) {
            this.abortDrawing();
        }
        this.updateSketchFeatures_();
    };
    /**
     * Stop drawing and add the sketch feature to the target layer.
     * The {@link module:ol/interaction/Draw~DrawEventType.DRAWEND} event is
     * dispatched before inserting the feature.
     * @api
     */
    Draw.prototype.finishDrawing = function () {
        var sketchFeature = this.abortDrawing_();
        if (!sketchFeature) {
            return;
        }
        var coordinates = this.sketchCoords_;
        var geometry = sketchFeature.getGeometry();
        var projection = this.getMap().getView().getProjection();
        if (this.mode_ === Mode.LINE_STRING) {
            // remove the redundant last point
            coordinates.pop();
            this.geometryFunction_(coordinates, geometry, projection);
        }
        else if (this.mode_ === Mode.POLYGON) {
            // remove the redundant last point in ring
            /** @type {PolyCoordType} */ (coordinates)[0].pop();
            this.geometryFunction_(coordinates, geometry, projection);
            coordinates = geometry.getCoordinates();
        }
        // cast multi-part geometries
        if (this.type_ === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_POINT) {
            sketchFeature.setGeometry(new _geom_MultiPoint_js__WEBPACK_IMPORTED_MODULE_14__["default"]([/** @type {PointCoordType} */ (coordinates)]));
        }
        else if (this.type_ === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_LINE_STRING) {
            sketchFeature.setGeometry(new _geom_MultiLineString_js__WEBPACK_IMPORTED_MODULE_13__["default"]([/** @type {LineCoordType} */ (coordinates)]));
        }
        else if (this.type_ === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_POLYGON) {
            sketchFeature.setGeometry(new _geom_MultiPolygon_js__WEBPACK_IMPORTED_MODULE_15__["default"]([/** @type {PolyCoordType} */ (coordinates)]));
        }
        // First dispatch event to allow full set up of feature
        this.dispatchEvent(new DrawEvent(DrawEventType.DRAWEND, sketchFeature));
        // Then insert feature
        if (this.features_) {
            this.features_.push(sketchFeature);
        }
        if (this.source_) {
            this.source_.addFeature(sketchFeature);
        }
    };
    /**
     * Stop drawing without adding the sketch feature to the target layer.
     * @return {Feature} The sketch feature (or null if none).
     * @private
     */
    Draw.prototype.abortDrawing_ = function () {
        this.finishCoordinate_ = null;
        var sketchFeature = this.sketchFeature_;
        this.sketchFeature_ = null;
        this.sketchPoint_ = null;
        this.sketchLine_ = null;
        this.overlay_.getSource().clear(true);
        return sketchFeature;
    };
    /**
     * Stop drawing without adding the sketch feature to the target layer.
     * @api
     */
    Draw.prototype.abortDrawing = function () {
        var sketchFeature = this.abortDrawing_();
        if (sketchFeature) {
            this.dispatchEvent(new DrawEvent(DrawEventType.DRAWABORT, sketchFeature));
        }
    };
    /**
     * Append coordinates to the end of the geometry that is currently being drawn.
     * This can be used when drawing LineStrings or Polygons. Coordinates will
     * either be appended to the current LineString or the outer ring of the current
     * Polygon.
     * @param {!LineCoordType} coordinates Linear coordinates to be appended into
     * the coordinate array.
     * @api
     */
    Draw.prototype.appendCoordinates = function (coordinates) {
        var mode = this.mode_;
        var sketchCoords = [];
        if (mode === Mode.LINE_STRING) {
            sketchCoords = /** @type {LineCoordType} */ this.sketchCoords_;
        }
        else if (mode === Mode.POLYGON) {
            sketchCoords = this.sketchCoords_ && this.sketchCoords_.length ? /** @type {PolyCoordType} */ (this.sketchCoords_)[0] : [];
        }
        // Remove last coordinate from sketch drawing (this coordinate follows cursor position)
        var ending = sketchCoords.pop();
        // Append coordinate list
        for (var i = 0; i < coordinates.length; i++) {
            this.addToDrawing_(coordinates[i]);
        }
        // Duplicate last coordinate for sketch drawing
        this.addToDrawing_(ending);
    };
    /**
     * Initiate draw mode by starting from an existing geometry which will
     * receive new additional points. This only works on features with
     * `LineString` geometries, where the interaction will extend lines by adding
     * points to the end of the coordinates array.
     * This will change the original feature, instead of drawing a copy.
     *
     * The function will dispatch a `drawstart` event.
     *
     * @param {!Feature<LineString>} feature Feature to be extended.
     * @api
     */
    Draw.prototype.extend = function (feature) {
        var geometry = feature.getGeometry();
        var lineString = geometry;
        this.sketchFeature_ = feature;
        this.sketchCoords_ = lineString.getCoordinates();
        var last = this.sketchCoords_[this.sketchCoords_.length - 1];
        this.finishCoordinate_ = last.slice();
        this.sketchCoords_.push(last.slice());
        this.updateSketchFeatures_();
        this.dispatchEvent(new DrawEvent(DrawEventType.DRAWSTART, this.sketchFeature_));
    };
    /**
     * Redraw the sketch features.
     * @private
     */
    Draw.prototype.updateSketchFeatures_ = function () {
        var sketchFeatures = [];
        if (this.sketchFeature_) {
            sketchFeatures.push(this.sketchFeature_);
        }
        if (this.sketchLine_) {
            sketchFeatures.push(this.sketchLine_);
        }
        if (this.sketchPoint_) {
            sketchFeatures.push(this.sketchPoint_);
        }
        var overlaySource = this.overlay_.getSource();
        overlaySource.clear(true);
        overlaySource.addFeatures(sketchFeatures);
    };
    /**
     * @private
     */
    Draw.prototype.updateState_ = function () {
        var map = this.getMap();
        var active = this.getActive();
        if (!map || !active) {
            this.abortDrawing();
        }
        this.overlay_.setMap(active ? map : null);
    };
    return Draw;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_18__["default"]));
/**
 * @return {import("../style/Style.js").StyleFunction} Styles.
 */
function getDefaultStyleFunction() {
    var styles = Object(_style_Style_js__WEBPACK_IMPORTED_MODULE_22__["createEditingStyle"])();
    return function (feature, resolution) {
        return styles[feature.getGeometry().getType()];
    };
}
/**
 * Create a `geometryFunction` for `type: 'Circle'` that will create a regular
 * polygon with a user specified number of sides and start angle instead of an
 * `import("../geom/Circle.js").Circle` geometry.
 * @param {number=} opt_sides Number of sides of the regular polygon. Default is
 *     32.
 * @param {number=} opt_angle Angle of the first point in radians. 0 means East.
 *     Default is the angle defined by the heading from the center of the
 *     regular polygon to the current pointer position.
 * @return {GeometryFunction} Function that draws a
 *     polygon.
 * @api
 */
function createRegularPolygon(opt_sides, opt_angle) {
    return function (coordinates, opt_geometry, projection) {
        var center = Object(_proj_js__WEBPACK_IMPORTED_MODULE_23__["fromUserCoordinate"])(/** @type {LineCoordType} */ (coordinates)[0], projection);
        var end = Object(_proj_js__WEBPACK_IMPORTED_MODULE_23__["fromUserCoordinate"])(/** @type {LineCoordType} */ (coordinates)[1], projection);
        var radius = Math.sqrt(Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_5__["squaredDistance"])(center, end));
        var geometry = opt_geometry ? /** @type {Polygon} */ (opt_geometry) :
            Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_17__["fromCircle"])(new _geom_Circle_js__WEBPACK_IMPORTED_MODULE_10__["default"](center), opt_sides);
        var angle = opt_angle;
        if (!opt_angle) {
            var x = end[0] - center[0];
            var y = end[1] - center[1];
            angle = Math.atan(y / x) - (x < 0 ? Math.PI : 0);
        }
        Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_17__["makeRegular"])(geometry, center, radius, angle);
        var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_23__["getUserProjection"])();
        if (userProjection) {
            geometry.transform(projection, userProjection);
        }
        return geometry;
    };
}
/**
 * Create a `geometryFunction` that will create a box-shaped polygon (aligned
 * with the coordinate system axes).  Use this with the draw interaction and
 * `type: 'Circle'` to return a box instead of a circle geometry.
 * @return {GeometryFunction} Function that draws a box-shaped polygon.
 * @api
 */
function createBox() {
    return (function (coordinates, opt_geometry, projection) {
        var extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_8__["boundingExtent"])(/** @type {LineCoordType} */ (coordinates).map(function (coordinate) {
            return Object(_proj_js__WEBPACK_IMPORTED_MODULE_23__["fromUserCoordinate"])(coordinate, projection);
        }));
        var boxCoordinates = [[
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_8__["getBottomLeft"])(extent),
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_8__["getBottomRight"])(extent),
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_8__["getTopRight"])(extent),
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_8__["getTopLeft"])(extent),
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_8__["getBottomLeft"])(extent)
            ]];
        var geometry = opt_geometry;
        if (geometry) {
            geometry.setCoordinates(boxCoordinates);
        }
        else {
            geometry = new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_17__["default"](boxCoordinates);
        }
        var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_23__["getUserProjection"])();
        if (userProjection) {
            geometry.transform(projection, userProjection);
        }
        return geometry;
    });
}
/**
 * Get the drawing mode.  The mode for mult-part geometries is the same as for
 * their single-part cousins.
 * @param {GeometryType} type Geometry type.
 * @return {Mode} Drawing mode.
 */
function getMode(type) {
    var mode;
    if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].POINT ||
        type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_POINT) {
        mode = Mode.POINT;
    }
    else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].LINE_STRING ||
        type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_LINE_STRING) {
        mode = Mode.LINE_STRING;
    }
    else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].POLYGON ||
        type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_POLYGON) {
        mode = Mode.POLYGON;
    }
    else if (type === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].CIRCLE) {
        mode = Mode.CIRCLE;
    }
    return (
    /** @type {!Mode} */ (mode));
}
/* harmony default export */ __webpack_exports__["default"] = (Draw);
//# sourceMappingURL=Draw.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Extent.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/interaction/Extent.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
/* harmony import */ var _layer_Vector_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../layer/Vector.js */ "./node_modules/ol/layer/Vector.js");
/* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../source/Vector.js */ "./node_modules/ol/source/Vector.js");
/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/ol/style/Style.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/Extent
 */













/**
 * @typedef {Object} Options
 * @property {import("../extent.js").Extent} [extent] Initial extent. Defaults to no
 * initial extent.
 * @property {import("../style/Style.js").StyleLike} [boxStyle]
 * Style for the drawn extent box. Defaults to
 * {@link module:ol/style/Style~createEditing()['Polygon']}
 * @property {number} [pixelTolerance=10] Pixel tolerance for considering the
 * pointer close enough to a segment or vertex for editing.
 * @property {import("../style/Style.js").StyleLike} [pointerStyle]
 * Style for the cursor used to draw the extent. Defaults to
 * {@link module:ol/style/Style~createEditing()['Point']}
 * @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps
 * in the X direction? Only affects visuals, not functionality.
 */
/**
 * @enum {string}
 */
var ExtentEventType = {
    /**
     * Triggered after the extent is changed
     * @event ExtentEvent#extentchanged
     * @api
     */
    EXTENTCHANGED: 'extentchanged'
};
/**
 * @classdesc
 * Events emitted by {@link module:ol/interaction/Extent~Extent} instances are
 * instances of this type.
 */
var ExtentEvent = /** @class */ (function (_super) {
    __extends(ExtentEvent, _super);
    /**
     * @param {import("../extent.js").Extent} extent the new extent
     */
    function ExtentEvent(extent) {
        var _this = _super.call(this, ExtentEventType.EXTENTCHANGED) || this;
        /**
         * The current extent.
         * @type {import("../extent.js").Extent}
         * @api
         */
        _this.extent = extent;
        return _this;
    }
    return ExtentEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * @classdesc
 * Allows the user to draw a vector box by clicking and dragging on the map.
 * Once drawn, the vector box can be modified by dragging its vertices or edges.
 * This interaction is only supported for mouse devices.
 *
 * @fires ExtentEvent
 * @api
 */
var Extent = /** @class */ (function (_super) {
    __extends(Extent, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function Extent(opt_options) {
        var _this = this;
        var options = opt_options || {};
        _this = _super.call(this, /** @type {import("./Pointer.js").Options} */ (options)) || this;
        /**
         * Extent of the drawn box
         * @type {import("../extent.js").Extent}
         * @private
         */
        _this.extent_ = null;
        /**
         * Handler for pointer move events
         * @type {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null}
         * @private
         */
        _this.pointerHandler_ = null;
        /**
         * Pixel threshold to snap to extent
         * @type {number}
         * @private
         */
        _this.pixelTolerance_ = options.pixelTolerance !== undefined ?
            options.pixelTolerance : 10;
        /**
         * Is the pointer snapped to an extent vertex
         * @type {boolean}
         * @private
         */
        _this.snappedToVertex_ = false;
        /**
         * Feature for displaying the visible extent
         * @type {Feature}
         * @private
         */
        _this.extentFeature_ = null;
        /**
         * Feature for displaying the visible pointer
         * @type {Feature<Point>}
         * @private
         */
        _this.vertexFeature_ = null;
        if (!opt_options) {
            opt_options = {};
        }
        /**
         * Layer for the extentFeature
         * @type {VectorLayer}
         * @private
         */
        _this.extentOverlay_ = new _layer_Vector_js__WEBPACK_IMPORTED_MODULE_9__["default"]({
            source: new _source_Vector_js__WEBPACK_IMPORTED_MODULE_10__["default"]({
                useSpatialIndex: false,
                wrapX: !!opt_options.wrapX
            }),
            style: opt_options.boxStyle ? opt_options.boxStyle : getDefaultExtentStyleFunction(),
            updateWhileAnimating: true,
            updateWhileInteracting: true
        });
        /**
         * Layer for the vertexFeature
         * @type {VectorLayer}
         * @private
         */
        _this.vertexOverlay_ = new _layer_Vector_js__WEBPACK_IMPORTED_MODULE_9__["default"]({
            source: new _source_Vector_js__WEBPACK_IMPORTED_MODULE_10__["default"]({
                useSpatialIndex: false,
                wrapX: !!opt_options.wrapX
            }),
            style: opt_options.pointerStyle ? opt_options.pointerStyle : getDefaultPointerStyleFunction(),
            updateWhileAnimating: true,
            updateWhileInteracting: true
        });
        if (opt_options.extent) {
            _this.setExtent(opt_options.extent);
        }
        return _this;
    }
    /**
     * @param {import("../pixel.js").Pixel} pixel cursor location
     * @param {import("../PluggableMap.js").default} map map
     * @returns {import("../coordinate.js").Coordinate|null} snapped vertex on extent
     * @private
     */
    Extent.prototype.snapToVertex_ = function (pixel, map) {
        var pixelCoordinate = map.getCoordinateFromPixelInternal(pixel);
        var sortByDistance = function (a, b) {
            return Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistanceToSegment"])(pixelCoordinate, a) -
                Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistanceToSegment"])(pixelCoordinate, b);
        };
        var extent = this.getExtentInternal();
        if (extent) {
            //convert extents to line segments and find the segment closest to pixelCoordinate
            var segments = getSegments(extent);
            segments.sort(sortByDistance);
            var closestSegment = segments[0];
            var vertex = (Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["closestOnSegment"])(pixelCoordinate, closestSegment));
            var vertexPixel = map.getPixelFromCoordinateInternal(vertex);
            //if the distance is within tolerance, snap to the segment
            if (Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["distance"])(pixel, vertexPixel) <= this.pixelTolerance_) {
                //test if we should further snap to a vertex
                var pixel1 = map.getPixelFromCoordinateInternal(closestSegment[0]);
                var pixel2 = map.getPixelFromCoordinateInternal(closestSegment[1]);
                var squaredDist1 = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistance"])(vertexPixel, pixel1);
                var squaredDist2 = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistance"])(vertexPixel, pixel2);
                var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
                this.snappedToVertex_ = dist <= this.pixelTolerance_;
                if (this.snappedToVertex_) {
                    vertex = squaredDist1 > squaredDist2 ?
                        closestSegment[1] : closestSegment[0];
                }
                return vertex;
            }
        }
        return null;
    };
    /**
     * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent pointer move event
     * @private
     */
    Extent.prototype.handlePointerMove_ = function (mapBrowserEvent) {
        var pixel = mapBrowserEvent.pixel;
        var map = mapBrowserEvent.map;
        var vertex = this.snapToVertex_(pixel, map);
        if (!vertex) {
            vertex = map.getCoordinateFromPixelInternal(pixel);
        }
        this.createOrUpdatePointerFeature_(vertex);
    };
    /**
     * @param {import("../extent.js").Extent} extent extent
     * @returns {Feature} extent as featrue
     * @private
     */
    Extent.prototype.createOrUpdateExtentFeature_ = function (extent) {
        var extentFeature = this.extentFeature_;
        if (!extentFeature) {
            if (!extent) {
                extentFeature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"]({});
            }
            else {
                extentFeature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"](Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_7__["fromExtent"])(extent));
            }
            this.extentFeature_ = extentFeature;
            this.extentOverlay_.getSource().addFeature(extentFeature);
        }
        else {
            if (!extent) {
                extentFeature.setGeometry(undefined);
            }
            else {
                extentFeature.setGeometry(Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_7__["fromExtent"])(extent));
            }
        }
        return extentFeature;
    };
    /**
     * @param {import("../coordinate.js").Coordinate} vertex location of feature
     * @returns {Feature} vertex as feature
     * @private
     */
    Extent.prototype.createOrUpdatePointerFeature_ = function (vertex) {
        var vertexFeature = this.vertexFeature_;
        if (!vertexFeature) {
            vertexFeature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_6__["default"](vertex));
            this.vertexFeature_ = vertexFeature;
            this.vertexOverlay_.getSource().addFeature(vertexFeature);
        }
        else {
            var geometry = vertexFeature.getGeometry();
            geometry.setCoordinates(vertex);
        }
        return vertexFeature;
    };
    /**
     * @inheritDoc
     */
    Extent.prototype.handleEvent = function (mapBrowserEvent) {
        if (!( /** @type {import("../MapBrowserPointerEvent.js").default} */(mapBrowserEvent).pointerEvent)) {
            return true;
        }
        //display pointer (if not dragging)
        if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINTERMOVE && !this.handlingDownUpSequence) {
            this.handlePointerMove_(mapBrowserEvent);
        }
        //call pointer to determine up/down/drag
        _super.prototype.handleEvent.call(this, mapBrowserEvent);
        //return false to stop propagation
        return false;
    };
    /**
     * @inheritDoc
     */
    Extent.prototype.handleDownEvent = function (mapBrowserEvent) {
        var pixel = mapBrowserEvent.pixel;
        var map = mapBrowserEvent.map;
        var extent = this.getExtentInternal();
        var vertex = this.snapToVertex_(pixel, map);
        //find the extent corner opposite the passed corner
        var getOpposingPoint = function (point) {
            var x_ = null;
            var y_ = null;
            if (point[0] == extent[0]) {
                x_ = extent[2];
            }
            else if (point[0] == extent[2]) {
                x_ = extent[0];
            }
            if (point[1] == extent[1]) {
                y_ = extent[3];
            }
            else if (point[1] == extent[3]) {
                y_ = extent[1];
            }
            if (x_ !== null && y_ !== null) {
                return [x_, y_];
            }
            return null;
        };
        if (vertex && extent) {
            var x = (vertex[0] == extent[0] || vertex[0] == extent[2]) ? vertex[0] : null;
            var y = (vertex[1] == extent[1] || vertex[1] == extent[3]) ? vertex[1] : null;
            //snap to point
            if (x !== null && y !== null) {
                this.pointerHandler_ = getPointHandler(getOpposingPoint(vertex));
                //snap to edge
            }
            else if (x !== null) {
                this.pointerHandler_ = getEdgeHandler(getOpposingPoint([x, extent[1]]), getOpposingPoint([x, extent[3]]));
            }
            else if (y !== null) {
                this.pointerHandler_ = getEdgeHandler(getOpposingPoint([extent[0], y]), getOpposingPoint([extent[2], y]));
            }
            //no snap - new bbox
        }
        else {
            vertex = map.getCoordinateFromPixelInternal(pixel);
            this.setExtent([vertex[0], vertex[1], vertex[0], vertex[1]]);
            this.pointerHandler_ = getPointHandler(vertex);
        }
        return true; //event handled; start downup sequence
    };
    /**
     * @inheritDoc
     */
    Extent.prototype.handleDragEvent = function (mapBrowserEvent) {
        if (this.pointerHandler_) {
            var pixelCoordinate = mapBrowserEvent.coordinate;
            this.setExtent(this.pointerHandler_(pixelCoordinate));
            this.createOrUpdatePointerFeature_(pixelCoordinate);
        }
        return true;
    };
    /**
     * @inheritDoc
     */
    Extent.prototype.handleUpEvent = function (mapBrowserEvent) {
        this.pointerHandler_ = null;
        //If bbox is zero area, set to null;
        var extent = this.getExtentInternal();
        if (!extent || Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getArea"])(extent) === 0) {
            this.setExtent(null);
        }
        return false; //Stop handling downup sequence
    };
    /**
     * @inheritDoc
     */
    Extent.prototype.setMap = function (map) {
        this.extentOverlay_.setMap(map);
        this.vertexOverlay_.setMap(map);
        _super.prototype.setMap.call(this, map);
    };
    /**
     * Returns the current drawn extent in the view projection (or user projection if set)
     *
     * @return {import("../extent.js").Extent} Drawn extent in the view projection.
     * @api
     */
    Extent.prototype.getExtent = function () {
        return Object(_proj_js__WEBPACK_IMPORTED_MODULE_12__["toUserExtent"])(this.getExtentInternal(), this.getMap().getView().getProjection());
    };
    /**
     * Returns the current drawn extent in the view projection
     *
     * @return {import("../extent.js").Extent} Drawn extent in the view projection.
     * @api
     */
    Extent.prototype.getExtentInternal = function () {
        return this.extent_;
    };
    /**
     * Manually sets the drawn extent, using the view projection.
     *
     * @param {import("../extent.js").Extent} extent Extent
     * @api
     */
    Extent.prototype.setExtent = function (extent) {
        //Null extent means no bbox
        this.extent_ = extent ? extent : null;
        this.createOrUpdateExtentFeature_(extent);
        this.dispatchEvent(new ExtentEvent(this.extent_));
    };
    return Extent;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_8__["default"]));
/**
 * Returns the default style for the drawn bbox
 *
 * @return {import("../style/Style.js").StyleFunction} Default Extent style
 */
function getDefaultExtentStyleFunction() {
    var style = Object(_style_Style_js__WEBPACK_IMPORTED_MODULE_11__["createEditingStyle"])();
    return function (feature, resolution) {
        return style[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].POLYGON];
    };
}
/**
 * Returns the default style for the pointer
 *
 * @return {import("../style/Style.js").StyleFunction} Default pointer style
 */
function getDefaultPointerStyleFunction() {
    var style = Object(_style_Style_js__WEBPACK_IMPORTED_MODULE_11__["createEditingStyle"])();
    return function (feature, resolution) {
        return style[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_5__["default"].POINT];
    };
}
/**
 * @param {import("../coordinate.js").Coordinate} fixedPoint corner that will be unchanged in the new extent
 * @returns {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent} event handler
 */
function getPointHandler(fixedPoint) {
    return function (point) {
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["boundingExtent"])([fixedPoint, point]);
    };
}
/**
 * @param {import("../coordinate.js").Coordinate} fixedP1 first corner that will be unchanged in the new extent
 * @param {import("../coordinate.js").Coordinate} fixedP2 second corner that will be unchanged in the new extent
 * @returns {function (import("../coordinate.js").Coordinate): import("../extent.js").Extent|null} event handler
 */
function getEdgeHandler(fixedP1, fixedP2) {
    if (fixedP1[0] == fixedP2[0]) {
        return function (point) {
            return Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["boundingExtent"])([fixedP1, [point[0], fixedP2[1]]]);
        };
    }
    else if (fixedP1[1] == fixedP2[1]) {
        return function (point) {
            return Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["boundingExtent"])([fixedP1, [fixedP2[0], point[1]]]);
        };
    }
    else {
        return null;
    }
}
/**
 * @param {import("../extent.js").Extent} extent extent
 * @returns {Array<Array<import("../coordinate.js").Coordinate>>} extent line segments
 */
function getSegments(extent) {
    return [
        [[extent[0], extent[1]], [extent[0], extent[3]]],
        [[extent[0], extent[3]], [extent[2], extent[3]]],
        [[extent[2], extent[3]], [extent[2], extent[1]]],
        [[extent[2], extent[1]], [extent[0], extent[1]]]
    ];
}
/* harmony default export */ __webpack_exports__["default"] = (Extent);
//# sourceMappingURL=Extent.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Interaction.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/interaction/Interaction.js ***!
  \****************************************************/
/*! exports provided: pan, zoomByDelta, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pan", function() { return pan; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zoomByDelta", function() { return zoomByDelta; });
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _easing_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../easing.js */ "./node_modules/ol/easing.js");
/* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Property.js */ "./node_modules/ol/interaction/Property.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/Interaction
 */



/**
 * Object literal with config options for interactions.
 * @typedef {Object} InteractionOptions
 * @property {function(import("../MapBrowserEvent.js").default):boolean} handleEvent
 * Method called by the map to notify the interaction that a browser event was
 * dispatched to the map. If the function returns a falsy value, propagation of
 * the event to other interactions in the map's interactions chain will be
 * prevented (this includes functions with no explicit return). The interactions
 * are traversed in reverse order of the interactions collection of the map.
 */
/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * User actions that change the state of the map. Some are similar to controls,
 * but are not associated with a DOM element.
 * For example, {@link module:ol/interaction/KeyboardZoom~KeyboardZoom} is
 * functionally the same as {@link module:ol/control/Zoom~Zoom}, but triggered
 * by a keyboard event not a button element event.
 * Although interactions do not have a DOM element, some of them do render
 * vectors and so are visible on the screen.
 * @api
 */
var Interaction = /** @class */ (function (_super) {
    __extends(Interaction, _super);
    /**
     * @param {InteractionOptions} options Options.
     */
    function Interaction(options) {
        var _this = _super.call(this) || this;
        if (options.handleEvent) {
            _this.handleEvent = options.handleEvent;
        }
        /**
         * @private
         * @type {import("../PluggableMap.js").default}
         */
        _this.map_ = null;
        _this.setActive(true);
        return _this;
    }
    /**
     * Return whether the interaction is currently active.
     * @return {boolean} `true` if the interaction is active, `false` otherwise.
     * @observable
     * @api
     */
    Interaction.prototype.getActive = function () {
        return /** @type {boolean} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].ACTIVE));
    };
    /**
     * Get the map associated with this interaction.
     * @return {import("../PluggableMap.js").default} Map.
     * @api
     */
    Interaction.prototype.getMap = function () {
        return this.map_;
    };
    /**
     * Handles the {@link module:ol/MapBrowserEvent map browser event}.
     * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
     * @return {boolean} `false` to stop event propagation.
     * @api
     */
    Interaction.prototype.handleEvent = function (mapBrowserEvent) {
        return true;
    };
    /**
     * Activate or deactivate the interaction.
     * @param {boolean} active Active.
     * @observable
     * @api
     */
    Interaction.prototype.setActive = function (active) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].ACTIVE, active);
    };
    /**
     * Remove the interaction from its current map and attach it to the new map.
     * Subclasses may set up event handlers to get notified about changes to
     * the map here.
     * @param {import("../PluggableMap.js").default} map Map.
     */
    Interaction.prototype.setMap = function (map) {
        this.map_ = map;
    };
    return Interaction;
}(_Object_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * @param {import("../View.js").default} view View.
 * @param {import("../coordinate.js").Coordinate} delta Delta.
 * @param {number=} opt_duration Duration.
 */
function pan(view, delta, opt_duration) {
    var currentCenter = view.getCenterInternal();
    if (currentCenter) {
        var center = [currentCenter[0] + delta[0], currentCenter[1] + delta[1]];
        view.animateInternal({
            duration: opt_duration !== undefined ? opt_duration : 250,
            easing: _easing_js__WEBPACK_IMPORTED_MODULE_1__["linear"],
            center: view.getConstrainedCenter(center)
        });
    }
}
/**
 * @param {import("../View.js").default} view View.
 * @param {number} delta Delta from previous zoom level.
 * @param {import("../coordinate.js").Coordinate=} opt_anchor Anchor coordinate in the user projection.
 * @param {number=} opt_duration Duration.
 */
function zoomByDelta(view, delta, opt_anchor, opt_duration) {
    var currentZoom = view.getZoom();
    if (currentZoom === undefined) {
        return;
    }
    var newZoom = view.getConstrainedZoom(currentZoom + delta);
    var newResolution = view.getResolutionForZoom(newZoom);
    if (view.getAnimating()) {
        view.cancelAnimations();
    }
    view.animate({
        resolution: newResolution,
        anchor: opt_anchor,
        duration: opt_duration !== undefined ? opt_duration : 250,
        easing: _easing_js__WEBPACK_IMPORTED_MODULE_1__["easeOut"]
    });
}
/* harmony default export */ __webpack_exports__["default"] = (Interaction);
//# sourceMappingURL=Interaction.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/KeyboardPan.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/interaction/KeyboardPan.js ***!
  \****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _events_KeyCode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../events/KeyCode.js */ "./node_modules/ol/events/KeyCode.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/KeyboardPan
 */





/**
 * @typedef {Object} Options
 * @property {import("../events/condition.js").Condition} [condition] A function that
 * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled. Default is
 * {@link module:ol/events/condition~noModifierKeys} and
 * {@link module:ol/events/condition~targetNotEditable}.
 * @property {number} [duration=100] Animation duration in milliseconds.
 * @property {number} [pixelDelta=128] The amount of pixels to pan on each key
 * press.
 */
/**
 * @classdesc
 * Allows the user to pan the map using keyboard arrows.
 * Note that, although this interaction is by default included in maps,
 * the keys can only be used when browser focus is on the element to which
 * the keyboard events are attached. By default, this is the map div,
 * though you can change this with the `keyboardEventTarget` in
 * {@link module:ol/Map~Map}. `document` never loses focus but, for any other
 * element, focus will have to be on, and returned to, this element if the keys
 * are to function.
 * See also {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}.
 * @api
 */
var KeyboardPan = /** @class */ (function (_super) {
    __extends(KeyboardPan, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function KeyboardPan(opt_options) {
        var _this = _super.call(this, {
            handleEvent: handleEvent
        }) || this;
        var options = opt_options || {};
        /**
         * @private
         * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
         * @return {boolean} Combined condition result.
         */
        _this.defaultCondition_ = function (mapBrowserEvent) {
            return Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_3__["noModifierKeys"])(mapBrowserEvent) &&
                Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_3__["targetNotEditable"])(mapBrowserEvent);
        };
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition !== undefined ?
            options.condition : _this.defaultCondition_;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 100;
        /**
         * @private
         * @type {number}
         */
        _this.pixelDelta_ = options.pixelDelta !== undefined ?
            options.pixelDelta : 128;
        return _this;
    }
    return KeyboardPan;
}(_Interaction_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/**
 * Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a
 * `KeyEvent`, and decides the direction to pan to (if an arrow key was
 * pressed).
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} `false` to stop event propagation.
 * @this {KeyboardPan}
 */
function handleEvent(mapBrowserEvent) {
    var stopEvent = false;
    if (mapBrowserEvent.type == _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].KEYDOWN) {
        var keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent);
        var keyCode = keyEvent.keyCode;
        if (this.condition_(mapBrowserEvent) &&
            (keyCode == _events_KeyCode_js__WEBPACK_IMPORTED_MODULE_2__["default"].DOWN ||
                keyCode == _events_KeyCode_js__WEBPACK_IMPORTED_MODULE_2__["default"].LEFT ||
                keyCode == _events_KeyCode_js__WEBPACK_IMPORTED_MODULE_2__["default"].RIGHT ||
                keyCode == _events_KeyCode_js__WEBPACK_IMPORTED_MODULE_2__["default"].UP)) {
            var map = mapBrowserEvent.map;
            var view = map.getView();
            var mapUnitsDelta = view.getResolution() * this.pixelDelta_;
            var deltaX = 0, deltaY = 0;
            if (keyCode == _events_KeyCode_js__WEBPACK_IMPORTED_MODULE_2__["default"].DOWN) {
                deltaY = -mapUnitsDelta;
            }
            else if (keyCode == _events_KeyCode_js__WEBPACK_IMPORTED_MODULE_2__["default"].LEFT) {
                deltaX = -mapUnitsDelta;
            }
            else if (keyCode == _events_KeyCode_js__WEBPACK_IMPORTED_MODULE_2__["default"].RIGHT) {
                deltaX = mapUnitsDelta;
            }
            else {
                deltaY = mapUnitsDelta;
            }
            var delta = [deltaX, deltaY];
            Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_0__["rotate"])(delta, view.getRotation());
            Object(_Interaction_js__WEBPACK_IMPORTED_MODULE_4__["pan"])(view, delta, this.duration_);
            mapBrowserEvent.preventDefault();
            stopEvent = true;
        }
    }
    return !stopEvent;
}
/* harmony default export */ __webpack_exports__["default"] = (KeyboardPan);
//# sourceMappingURL=KeyboardPan.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/KeyboardZoom.js":
/*!*****************************************************!*\
  !*** ./node_modules/ol/interaction/KeyboardZoom.js ***!
  \*****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/KeyboardZoom
 */



/**
 * @typedef {Object} Options
 * @property {number} [duration=100] Animation duration in milliseconds.
 * @property {import("../events/condition.js").Condition} [condition] A function that
 * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled. Default is
 * {@link module:ol/events/condition~targetNotEditable}.
 * @property {number} [delta=1] The zoom level delta on each key press.
 */
/**
 * @classdesc
 * Allows the user to zoom the map using keyboard + and -.
 * Note that, although this interaction is by default included in maps,
 * the keys can only be used when browser focus is on the element to which
 * the keyboard events are attached. By default, this is the map div,
 * though you can change this with the `keyboardEventTarget` in
 * {@link module:ol/Map~Map}. `document` never loses focus but, for any other
 * element, focus will have to be on, and returned to, this element if the keys
 * are to function.
 * See also {@link module:ol/interaction/KeyboardPan~KeyboardPan}.
 * @api
 */
var KeyboardZoom = /** @class */ (function (_super) {
    __extends(KeyboardZoom, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function KeyboardZoom(opt_options) {
        var _this = _super.call(this, {
            handleEvent: handleEvent
        }) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_1__["targetNotEditable"];
        /**
         * @private
         * @type {number}
         */
        _this.delta_ = options.delta ? options.delta : 1;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 100;
        return _this;
    }
    return KeyboardZoom;
}(_Interaction_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * Handles the {@link module:ol/MapBrowserEvent map browser event} if it was a
 * `KeyEvent`, and decides whether to zoom in or out (depending on whether the
 * key pressed was '+' or '-').
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} `false` to stop event propagation.
 * @this {KeyboardZoom}
 */
function handleEvent(mapBrowserEvent) {
    var stopEvent = false;
    if (mapBrowserEvent.type == _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].KEYDOWN ||
        mapBrowserEvent.type == _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].KEYPRESS) {
        var keyEvent = /** @type {KeyboardEvent} */ (mapBrowserEvent.originalEvent);
        var charCode = keyEvent.charCode;
        if (this.condition_(mapBrowserEvent) &&
            (charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) {
            var map = mapBrowserEvent.map;
            var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
            var view = map.getView();
            Object(_Interaction_js__WEBPACK_IMPORTED_MODULE_2__["zoomByDelta"])(view, delta, undefined, this.duration_);
            mapBrowserEvent.preventDefault();
            stopEvent = true;
        }
    }
    return !stopEvent;
}
/* harmony default export */ __webpack_exports__["default"] = (KeyboardZoom);
//# sourceMappingURL=KeyboardZoom.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Modify.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/interaction/Modify.js ***!
  \***********************************************/
/*! exports provided: ModifyEvent, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ModifyEvent", function() { return ModifyEvent; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../CollectionEventType.js */ "./node_modules/ol/CollectionEventType.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
/* harmony import */ var _layer_Vector_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../layer/Vector.js */ "./node_modules/ol/layer/Vector.js");
/* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../source/Vector.js */ "./node_modules/ol/source/Vector.js");
/* harmony import */ var _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../source/VectorEventType.js */ "./node_modules/ol/source/VectorEventType.js");
/* harmony import */ var _structs_RBush_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../structs/RBush.js */ "./node_modules/ol/structs/RBush.js");
/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/ol/style/Style.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/Modify
 */





















/**
 * The segment index assigned to a circle's center when
 * breaking up a circle into ModifySegmentDataType segments.
 * @type {number}
 */
var CIRCLE_CENTER_INDEX = 0;
/**
 * The segment index assigned to a circle's circumference when
 * breaking up a circle into ModifySegmentDataType segments.
 * @type {number}
 */
var CIRCLE_CIRCUMFERENCE_INDEX = 1;
var tempExtent = [0, 0, 0, 0];
var tempSegment = [];
/**
 * @enum {string}
 */
var ModifyEventType = {
    /**
     * Triggered upon feature modification start
     * @event ModifyEvent#modifystart
     * @api
     */
    MODIFYSTART: 'modifystart',
    /**
     * Triggered upon feature modification end
     * @event ModifyEvent#modifyend
     * @api
     */
    MODIFYEND: 'modifyend'
};
/**
 * @typedef {Object} SegmentData
 * @property {Array<number>} [depth]
 * @property {Feature} feature
 * @property {import("../geom/SimpleGeometry.js").default} geometry
 * @property {number} [index]
 * @property {Array<import("../extent.js").Extent>} segment
 * @property {Array<SegmentData>} [featureSegments]
 */
/**
 * @typedef {Object} Options
 * @property {import("../events/condition.js").Condition} [condition] A function that
 * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event will be considered to add or move a
 * vertex to the sketch. Default is
 * {@link module:ol/events/condition~primaryAction}.
 * @property {import("../events/condition.js").Condition} [deleteCondition] A function
 * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled. By default,
 * {@link module:ol/events/condition~singleClick} with
 * {@link module:ol/events/condition~altKeyOnly} results in a vertex deletion.
 * @property {import("../events/condition.js").Condition} [insertVertexCondition] A
 * function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and
 * returns a boolean to indicate whether a new vertex should be added to the sketch
 * features. Default is {@link module:ol/events/condition~always}.
 * @property {number} [pixelTolerance=10] Pixel tolerance for considering the
 * pointer close enough to a segment or vertex for editing.
 * @property {import("../style/Style.js").StyleLike} [style]
 * Style used for the features being modified. By default the default edit
 * style is used (see {@link module:ol/style}).
 * @property {VectorSource} [source] The vector source with
 * features to modify.  If a vector source is not provided, a feature collection
 * must be provided with the features option.
 * @property {Collection<Feature>} [features]
 * The features the interaction works on.  If a feature collection is not
 * provided, a vector source must be provided with the source option.
 * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch
 * overlay.
 */
/**
 * @classdesc
 * Events emitted by {@link module:ol/interaction/Modify~Modify} instances are
 * instances of this type.
 */
var ModifyEvent = /** @class */ (function (_super) {
    __extends(ModifyEvent, _super);
    /**
     * @param {ModifyEventType} type Type.
     * @param {Collection<Feature>} features
     * The features modified.
     * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserPointerEvent
     * Associated {@link module:ol/MapBrowserPointerEvent}.
     */
    function ModifyEvent(type, features, mapBrowserPointerEvent) {
        var _this = _super.call(this, type) || this;
        /**
         * The features being modified.
         * @type {Collection<Feature>}
         * @api
         */
        _this.features = features;
        /**
         * Associated {@link module:ol/MapBrowserEvent}.
         * @type {import("../MapBrowserEvent.js").default}
         * @api
         */
        _this.mapBrowserEvent = mapBrowserPointerEvent;
        return _this;
    }
    return ModifyEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_7__["default"]));

/**
 * @classdesc
 * Interaction for modifying feature geometries.  To modify features that have
 * been added to an existing source, construct the modify interaction with the
 * `source` option.  If you want to modify features in a collection (for example,
 * the collection used by a select interaction), construct the interaction with
 * the `features` option.  The interaction must be constructed with either a
 * `source` or `features` option.
 *
 * By default, the interaction will allow deletion of vertices when the `alt`
 * key is pressed.  To configure the interaction with a different condition
 * for deletion, use the `deleteCondition` option.
 * @fires ModifyEvent
 * @api
 */
var Modify = /** @class */ (function (_super) {
    __extends(Modify, _super);
    /**
     * @param {Options} options Options.
     */
    function Modify(options) {
        var _this = _super.call(this, /** @type {import("./Pointer.js").Options} */ (options)) || this;
        /** @private */
        _this.boundHandleFeatureChange_ = _this.handleFeatureChange_.bind(_this);
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_9__["primaryAction"];
        /**
         * @private
         * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Browser event.
         * @return {boolean} Combined condition result.
         */
        _this.defaultDeleteCondition_ = function (mapBrowserEvent) {
            return Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_9__["altKeyOnly"])(mapBrowserEvent) && Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_9__["singleClick"])(mapBrowserEvent);
        };
        /**
         * @type {import("../events/condition.js").Condition}
         * @private
         */
        _this.deleteCondition_ = options.deleteCondition ?
            options.deleteCondition : _this.defaultDeleteCondition_;
        /**
         * @type {import("../events/condition.js").Condition}
         * @private
         */
        _this.insertVertexCondition_ = options.insertVertexCondition ?
            options.insertVertexCondition : _events_condition_js__WEBPACK_IMPORTED_MODULE_9__["always"];
        /**
         * Editing vertex.
         * @type {Feature}
         * @private
         */
        _this.vertexFeature_ = null;
        /**
         * Segments intersecting {@link this.vertexFeature_} by segment uid.
         * @type {Object<string, boolean>}
         * @private
         */
        _this.vertexSegments_ = null;
        /**
         * @type {import("../pixel.js").Pixel}
         * @private
         */
        _this.lastPixel_ = [0, 0];
        /**
         * Tracks if the next `singleclick` event should be ignored to prevent
         * accidental deletion right after vertex creation.
         * @type {boolean}
         * @private
         */
        _this.ignoreNextSingleClick_ = false;
        /**
         * @type {boolean}
         * @private
         */
        _this.modified_ = false;
        /**
         * Segment RTree for each layer
         * @type {RBush<SegmentData>}
         * @private
         */
        _this.rBush_ = new _structs_RBush_js__WEBPACK_IMPORTED_MODULE_18__["default"]();
        /**
         * @type {number}
         * @private
         */
        _this.pixelTolerance_ = options.pixelTolerance !== undefined ?
            options.pixelTolerance : 10;
        /**
         * @type {boolean}
         * @private
         */
        _this.snappedToVertex_ = false;
        /**
         * Indicate whether the interaction is currently changing a feature's
         * coordinates.
         * @type {boolean}
         * @private
         */
        _this.changingFeature_ = false;
        /**
         * @type {Array}
         * @private
         */
        _this.dragSegments_ = [];
        /**
         * Draw overlay where sketch features are drawn.
         * @type {VectorLayer}
         * @private
         */
        _this.overlay_ = new _layer_Vector_js__WEBPACK_IMPORTED_MODULE_15__["default"]({
            source: new _source_Vector_js__WEBPACK_IMPORTED_MODULE_16__["default"]({
                useSpatialIndex: false,
                wrapX: !!options.wrapX
            }),
            style: options.style ? options.style : getDefaultStyleFunction(),
            updateWhileAnimating: true,
            updateWhileInteracting: true
        });
        /**
         * @const
         * @private
         * @type {!Object<string, function(Feature, import("../geom/Geometry.js").default): void>}
         */
        _this.SEGMENT_WRITERS_ = {
            'Point': _this.writePointGeometry_.bind(_this),
            'LineString': _this.writeLineStringGeometry_.bind(_this),
            'LinearRing': _this.writeLineStringGeometry_.bind(_this),
            'Polygon': _this.writePolygonGeometry_.bind(_this),
            'MultiPoint': _this.writeMultiPointGeometry_.bind(_this),
            'MultiLineString': _this.writeMultiLineStringGeometry_.bind(_this),
            'MultiPolygon': _this.writeMultiPolygonGeometry_.bind(_this),
            'Circle': _this.writeCircleGeometry_.bind(_this),
            'GeometryCollection': _this.writeGeometryCollectionGeometry_.bind(_this)
        };
        /**
         * @type {VectorSource}
         * @private
         */
        _this.source_ = null;
        var features;
        if (options.source) {
            _this.source_ = options.source;
            features = new _Collection_js__WEBPACK_IMPORTED_MODULE_1__["default"](_this.source_.getFeatures());
            _this.source_.addEventListener(_source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].ADDFEATURE, _this.handleSourceAdd_.bind(_this));
            _this.source_.addEventListener(_source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_17__["default"].REMOVEFEATURE, _this.handleSourceRemove_.bind(_this));
        }
        else {
            features = options.features;
        }
        if (!features) {
            throw new Error('The modify interaction requires features or a source');
        }
        /**
         * @type {Collection<Feature>}
         * @private
         */
        _this.features_ = features;
        _this.features_.forEach(_this.addFeature_.bind(_this));
        _this.features_.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].ADD, _this.handleFeatureAdd_.bind(_this));
        _this.features_.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].REMOVE, _this.handleFeatureRemove_.bind(_this));
        /**
         * @type {import("../MapBrowserPointerEvent.js").default}
         * @private
         */
        _this.lastPointerEvent_ = null;
        return _this;
    }
    /**
     * @param {Feature} feature Feature.
     * @private
     */
    Modify.prototype.addFeature_ = function (feature) {
        var geometry = feature.getGeometry();
        if (geometry) {
            var writer = this.SEGMENT_WRITERS_[geometry.getType()];
            if (writer) {
                writer(feature, geometry);
            }
        }
        var map = this.getMap();
        if (map && map.isRendered() && this.getActive()) {
            this.handlePointerAtPixel_(this.lastPixel_, map);
        }
        feature.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].CHANGE, this.boundHandleFeatureChange_);
    };
    /**
     * @param {import("../MapBrowserPointerEvent.js").default} evt Map browser event
     * @private
     */
    Modify.prototype.willModifyFeatures_ = function (evt) {
        if (!this.modified_) {
            this.modified_ = true;
            this.dispatchEvent(new ModifyEvent(ModifyEventType.MODIFYSTART, this.features_, evt));
        }
    };
    /**
     * @param {Feature} feature Feature.
     * @private
     */
    Modify.prototype.removeFeature_ = function (feature) {
        this.removeFeatureSegmentData_(feature);
        // Remove the vertex feature if the collection of canditate features is empty.
        if (this.vertexFeature_ && this.features_.getLength() === 0) {
            this.overlay_.getSource().removeFeature(this.vertexFeature_);
            this.vertexFeature_ = null;
        }
        feature.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].CHANGE, this.boundHandleFeatureChange_);
    };
    /**
     * @param {Feature} feature Feature.
     * @private
     */
    Modify.prototype.removeFeatureSegmentData_ = function (feature) {
        var rBush = this.rBush_;
        /** @type {Array<SegmentData>} */
        var nodesToRemove = [];
        rBush.forEach(
        /**
         * @param {SegmentData} node RTree node.
         */
        function (node) {
            if (feature === node.feature) {
                nodesToRemove.push(node);
            }
        });
        for (var i = nodesToRemove.length - 1; i >= 0; --i) {
            var nodeToRemove = nodesToRemove[i];
            for (var j = this.dragSegments_.length - 1; j >= 0; --j) {
                if (this.dragSegments_[j][0] === nodeToRemove) {
                    this.dragSegments_.splice(j, 1);
                }
            }
            rBush.remove(nodeToRemove);
        }
    };
    /**
     * @inheritDoc
     */
    Modify.prototype.setActive = function (active) {
        if (this.vertexFeature_ && !active) {
            this.overlay_.getSource().removeFeature(this.vertexFeature_);
            this.vertexFeature_ = null;
        }
        _super.prototype.setActive.call(this, active);
    };
    /**
     * @inheritDoc
     */
    Modify.prototype.setMap = function (map) {
        this.overlay_.setMap(map);
        _super.prototype.setMap.call(this, map);
    };
    /**
     * Get the overlay layer that this interaction renders sketch features to.
     * @return {VectorLayer} Overlay layer.
     * @api
     */
    Modify.prototype.getOverlay = function () {
        return this.overlay_;
    };
    /**
     * @param {import("../source/Vector.js").VectorSourceEvent} event Event.
     * @private
     */
    Modify.prototype.handleSourceAdd_ = function (event) {
        if (event.feature) {
            this.features_.push(event.feature);
        }
    };
    /**
     * @param {import("../source/Vector.js").VectorSourceEvent} event Event.
     * @private
     */
    Modify.prototype.handleSourceRemove_ = function (event) {
        if (event.feature) {
            this.features_.remove(event.feature);
        }
    };
    /**
     * @param {import("../Collection.js").CollectionEvent} evt Event.
     * @private
     */
    Modify.prototype.handleFeatureAdd_ = function (evt) {
        this.addFeature_(/** @type {Feature} */ (evt.element));
    };
    /**
     * @param {import("../events/Event.js").default} evt Event.
     * @private
     */
    Modify.prototype.handleFeatureChange_ = function (evt) {
        if (!this.changingFeature_) {
            var feature = /** @type {Feature} */ (evt.target);
            this.removeFeature_(feature);
            this.addFeature_(feature);
        }
    };
    /**
     * @param {import("../Collection.js").CollectionEvent} evt Event.
     * @private
     */
    Modify.prototype.handleFeatureRemove_ = function (evt) {
        var feature = /** @type {Feature} */ (evt.element);
        this.removeFeature_(feature);
    };
    /**
     * @param {Feature} feature Feature
     * @param {Point} geometry Geometry.
     * @private
     */
    Modify.prototype.writePointGeometry_ = function (feature, geometry) {
        var coordinates = geometry.getCoordinates();
        /** @type {SegmentData} */
        var segmentData = {
            feature: feature,
            geometry: geometry,
            segment: [coordinates, coordinates]
        };
        this.rBush_.insert(geometry.getExtent(), segmentData);
    };
    /**
     * @param {Feature} feature Feature
     * @param {import("../geom/MultiPoint.js").default} geometry Geometry.
     * @private
     */
    Modify.prototype.writeMultiPointGeometry_ = function (feature, geometry) {
        var points = geometry.getCoordinates();
        for (var i = 0, ii = points.length; i < ii; ++i) {
            var coordinates = points[i];
            /** @type {SegmentData} */
            var segmentData = {
                feature: feature,
                geometry: geometry,
                depth: [i],
                index: i,
                segment: [coordinates, coordinates]
            };
            this.rBush_.insert(geometry.getExtent(), segmentData);
        }
    };
    /**
     * @param {Feature} feature Feature
     * @param {import("../geom/LineString.js").default} geometry Geometry.
     * @private
     */
    Modify.prototype.writeLineStringGeometry_ = function (feature, geometry) {
        var coordinates = geometry.getCoordinates();
        for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
            var segment = coordinates.slice(i, i + 2);
            /** @type {SegmentData} */
            var segmentData = {
                feature: feature,
                geometry: geometry,
                index: i,
                segment: segment
            };
            this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])(segment), segmentData);
        }
    };
    /**
     * @param {Feature} feature Feature
     * @param {import("../geom/MultiLineString.js").default} geometry Geometry.
     * @private
     */
    Modify.prototype.writeMultiLineStringGeometry_ = function (feature, geometry) {
        var lines = geometry.getCoordinates();
        for (var j = 0, jj = lines.length; j < jj; ++j) {
            var coordinates = lines[j];
            for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
                var segment = coordinates.slice(i, i + 2);
                /** @type {SegmentData} */
                var segmentData = {
                    feature: feature,
                    geometry: geometry,
                    depth: [j],
                    index: i,
                    segment: segment
                };
                this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])(segment), segmentData);
            }
        }
    };
    /**
     * @param {Feature} feature Feature
     * @param {import("../geom/Polygon.js").default} geometry Geometry.
     * @private
     */
    Modify.prototype.writePolygonGeometry_ = function (feature, geometry) {
        var rings = geometry.getCoordinates();
        for (var j = 0, jj = rings.length; j < jj; ++j) {
            var coordinates = rings[j];
            for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
                var segment = coordinates.slice(i, i + 2);
                /** @type {SegmentData} */
                var segmentData = {
                    feature: feature,
                    geometry: geometry,
                    depth: [j],
                    index: i,
                    segment: segment
                };
                this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])(segment), segmentData);
            }
        }
    };
    /**
     * @param {Feature} feature Feature
     * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
     * @private
     */
    Modify.prototype.writeMultiPolygonGeometry_ = function (feature, geometry) {
        var polygons = geometry.getCoordinates();
        for (var k = 0, kk = polygons.length; k < kk; ++k) {
            var rings = polygons[k];
            for (var j = 0, jj = rings.length; j < jj; ++j) {
                var coordinates = rings[j];
                for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
                    var segment = coordinates.slice(i, i + 2);
                    /** @type {SegmentData} */
                    var segmentData = {
                        feature: feature,
                        geometry: geometry,
                        depth: [j, k],
                        index: i,
                        segment: segment
                    };
                    this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])(segment), segmentData);
                }
            }
        }
    };
    /**
     * We convert a circle into two segments.  The segment at index
     * {@link CIRCLE_CENTER_INDEX} is the
     * circle's center (a point).  The segment at index
     * {@link CIRCLE_CIRCUMFERENCE_INDEX} is
     * the circumference, and is not a line segment.
     *
     * @param {Feature} feature Feature.
     * @param {import("../geom/Circle.js").default} geometry Geometry.
     * @private
     */
    Modify.prototype.writeCircleGeometry_ = function (feature, geometry) {
        var coordinates = geometry.getCenter();
        /** @type {SegmentData} */
        var centerSegmentData = {
            feature: feature,
            geometry: geometry,
            index: CIRCLE_CENTER_INDEX,
            segment: [coordinates, coordinates]
        };
        /** @type {SegmentData} */
        var circumferenceSegmentData = {
            feature: feature,
            geometry: geometry,
            index: CIRCLE_CIRCUMFERENCE_INDEX,
            segment: [coordinates, coordinates]
        };
        var featureSegments = [centerSegmentData, circumferenceSegmentData];
        centerSegmentData.featureSegments = featureSegments;
        circumferenceSegmentData.featureSegments = featureSegments;
        this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["createOrUpdateFromCoordinate"])(coordinates), centerSegmentData);
        var circleGeometry = /** @type {import("../geom/Geometry.js").default} */ (geometry);
        var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["getUserProjection"])();
        if (userProjection && this.getMap()) {
            var projection = this.getMap().getView().getProjection();
            circleGeometry = circleGeometry.clone().transform(userProjection, projection);
            circleGeometry = Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_13__["fromCircle"])(/** @type {import("../geom/Circle.js").default} */ (circleGeometry)).transform(projection, userProjection);
        }
        this.rBush_.insert(circleGeometry.getExtent(), circumferenceSegmentData);
    };
    /**
     * @param {Feature} feature Feature
     * @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
     * @private
     */
    Modify.prototype.writeGeometryCollectionGeometry_ = function (feature, geometry) {
        var geometries = geometry.getGeometriesArray();
        for (var i = 0; i < geometries.length; ++i) {
            var geometry_1 = geometries[i];
            var writer = this.SEGMENT_WRITERS_[geometry_1.getType()];
            writer(feature, geometry_1);
        }
    };
    /**
     * @param {import("../coordinate.js").Coordinate} coordinates Coordinates.
     * @return {Feature} Vertex feature.
     * @private
     */
    Modify.prototype.createOrUpdateVertexFeature_ = function (coordinates) {
        var vertexFeature = this.vertexFeature_;
        if (!vertexFeature) {
            vertexFeature = new _Feature_js__WEBPACK_IMPORTED_MODULE_3__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_12__["default"](coordinates));
            this.vertexFeature_ = vertexFeature;
            this.overlay_.getSource().addFeature(vertexFeature);
        }
        else {
            var geometry = vertexFeature.getGeometry();
            geometry.setCoordinates(coordinates);
        }
        return vertexFeature;
    };
    /**
     * Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the geometry.
     * @override
     */
    Modify.prototype.handleEvent = function (mapBrowserEvent) {
        if (!( /** @type {import("../MapBrowserPointerEvent.js").default} */(mapBrowserEvent).pointerEvent)) {
            return true;
        }
        this.lastPointerEvent_ = mapBrowserEvent;
        var handled;
        if (!mapBrowserEvent.map.getView().getInteracting() &&
            mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POINTERMOVE &&
            !this.handlingDownUpSequence) {
            this.handlePointerMove_(mapBrowserEvent);
        }
        if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {
            if (mapBrowserEvent.type != _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].SINGLECLICK || !this.ignoreNextSingleClick_) {
                handled = this.removePoint();
            }
            else {
                handled = true;
            }
        }
        if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].SINGLECLICK) {
            this.ignoreNextSingleClick_ = false;
        }
        return _super.prototype.handleEvent.call(this, mapBrowserEvent) && !handled;
    };
    /**
     * @inheritDoc
     */
    Modify.prototype.handleDragEvent = function (evt) {
        this.ignoreNextSingleClick_ = false;
        this.willModifyFeatures_(evt);
        var vertex = evt.coordinate;
        for (var i = 0, ii = this.dragSegments_.length; i < ii; ++i) {
            var dragSegment = this.dragSegments_[i];
            var segmentData = dragSegment[0];
            var depth = segmentData.depth;
            var geometry = segmentData.geometry;
            var coordinates = void 0;
            var segment = segmentData.segment;
            var index = dragSegment[1];
            while (vertex.length < geometry.getStride()) {
                vertex.push(segment[index][vertex.length]);
            }
            switch (geometry.getType()) {
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].POINT:
                    coordinates = vertex;
                    segment[0] = vertex;
                    segment[1] = vertex;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_POINT:
                    coordinates = geometry.getCoordinates();
                    coordinates[segmentData.index] = vertex;
                    segment[0] = vertex;
                    segment[1] = vertex;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].LINE_STRING:
                    coordinates = geometry.getCoordinates();
                    coordinates[segmentData.index + index] = vertex;
                    segment[index] = vertex;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_LINE_STRING:
                    coordinates = geometry.getCoordinates();
                    coordinates[depth[0]][segmentData.index + index] = vertex;
                    segment[index] = vertex;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].POLYGON:
                    coordinates = geometry.getCoordinates();
                    coordinates[depth[0]][segmentData.index + index] = vertex;
                    segment[index] = vertex;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_POLYGON:
                    coordinates = geometry.getCoordinates();
                    coordinates[depth[1]][depth[0]][segmentData.index + index] = vertex;
                    segment[index] = vertex;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].CIRCLE:
                    segment[0] = vertex;
                    segment[1] = vertex;
                    if (segmentData.index === CIRCLE_CENTER_INDEX) {
                        this.changingFeature_ = true;
                        geometry.setCenter(vertex);
                        this.changingFeature_ = false;
                    }
                    else { // We're dragging the circle's circumference:
                        this.changingFeature_ = true;
                        var projection = evt.map.getView().getProjection();
                        var radius = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["distance"])(Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(geometry.getCenter(), projection), Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(vertex, projection));
                        var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["getUserProjection"])();
                        if (userProjection) {
                            var circleGeometry = geometry.clone().transform(userProjection, projection);
                            circleGeometry.setRadius(radius);
                            radius = circleGeometry.transform(projection, userProjection).getRadius();
                        }
                        geometry.setRadius(radius);
                        this.changingFeature_ = false;
                    }
                    break;
                default:
                // pass
            }
            if (coordinates) {
                this.setGeometryCoordinates_(geometry, coordinates);
            }
        }
        this.createOrUpdateVertexFeature_(vertex);
    };
    /**
     * @inheritDoc
     */
    Modify.prototype.handleDownEvent = function (evt) {
        if (!this.condition_(evt)) {
            return false;
        }
        var pixelCoordinate = evt.coordinate;
        this.handlePointerAtPixel_(evt.pixel, evt.map, pixelCoordinate);
        this.dragSegments_.length = 0;
        this.modified_ = false;
        var vertexFeature = this.vertexFeature_;
        if (vertexFeature) {
            var projection = evt.map.getView().getProjection();
            var insertVertices = [];
            var vertex = vertexFeature.getGeometry().getCoordinates();
            var vertexExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])([vertex]);
            var segmentDataMatches = this.rBush_.getInExtent(vertexExtent);
            var componentSegments = {};
            segmentDataMatches.sort(compareIndexes);
            for (var i = 0, ii = segmentDataMatches.length; i < ii; ++i) {
                var segmentDataMatch = segmentDataMatches[i];
                var segment = segmentDataMatch.segment;
                var uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(segmentDataMatch.feature);
                var depth = segmentDataMatch.depth;
                if (depth) {
                    uid += '-' + depth.join('-'); // separate feature components
                }
                if (!componentSegments[uid]) {
                    componentSegments[uid] = new Array(2);
                }
                if (segmentDataMatch.geometry.getType() === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].CIRCLE && segmentDataMatch.index === CIRCLE_CIRCUMFERENCE_INDEX) {
                    var closestVertex = closestOnSegmentData(pixelCoordinate, segmentDataMatch, projection);
                    if (Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(closestVertex, vertex) && !componentSegments[uid][0]) {
                        this.dragSegments_.push([segmentDataMatch, 0]);
                        componentSegments[uid][0] = segmentDataMatch;
                    }
                    continue;
                }
                if (Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(segment[0], vertex) && !componentSegments[uid][0]) {
                    this.dragSegments_.push([segmentDataMatch, 0]);
                    componentSegments[uid][0] = segmentDataMatch;
                    continue;
                }
                if (Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(segment[1], vertex) && !componentSegments[uid][1]) {
                    // prevent dragging closed linestrings by the connecting node
                    if ((segmentDataMatch.geometry.getType() ===
                        _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].LINE_STRING ||
                        segmentDataMatch.geometry.getType() ===
                            _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_LINE_STRING) &&
                        componentSegments[uid][0] &&
                        componentSegments[uid][0].index === 0) {
                        continue;
                    }
                    this.dragSegments_.push([segmentDataMatch, 1]);
                    componentSegments[uid][1] = segmentDataMatch;
                    continue;
                }
                if (Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(segment) in this.vertexSegments_ &&
                    (!componentSegments[uid][0] && !componentSegments[uid][1]) &&
                    this.insertVertexCondition_(evt)) {
                    insertVertices.push([segmentDataMatch, vertex]);
                }
            }
            if (insertVertices.length) {
                this.willModifyFeatures_(evt);
            }
            for (var j = insertVertices.length - 1; j >= 0; --j) {
                this.insertVertex_.apply(this, insertVertices[j]);
            }
        }
        return !!this.vertexFeature_;
    };
    /**
     * @inheritDoc
     */
    Modify.prototype.handleUpEvent = function (evt) {
        for (var i = this.dragSegments_.length - 1; i >= 0; --i) {
            var segmentData = this.dragSegments_[i][0];
            var geometry = segmentData.geometry;
            if (geometry.getType() === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].CIRCLE) {
                // Update a circle object in the R* bush:
                var coordinates = geometry.getCenter();
                var centerSegmentData = segmentData.featureSegments[0];
                var circumferenceSegmentData = segmentData.featureSegments[1];
                centerSegmentData.segment[0] = coordinates;
                centerSegmentData.segment[1] = coordinates;
                circumferenceSegmentData.segment[0] = coordinates;
                circumferenceSegmentData.segment[1] = coordinates;
                this.rBush_.update(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["createOrUpdateFromCoordinate"])(coordinates), centerSegmentData);
                var circleGeometry = geometry;
                var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["getUserProjection"])();
                if (userProjection) {
                    var projection = evt.map.getView().getProjection();
                    circleGeometry = circleGeometry.clone().transform(userProjection, projection);
                    circleGeometry = Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_13__["fromCircle"])(circleGeometry).transform(projection, userProjection);
                }
                this.rBush_.update(circleGeometry.getExtent(), circumferenceSegmentData);
            }
            else {
                this.rBush_.update(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])(segmentData.segment), segmentData);
            }
        }
        if (this.modified_) {
            this.dispatchEvent(new ModifyEvent(ModifyEventType.MODIFYEND, this.features_, evt));
            this.modified_ = false;
        }
        return false;
    };
    /**
     * @param {import("../MapBrowserEvent.js").default} evt Event.
     * @private
     */
    Modify.prototype.handlePointerMove_ = function (evt) {
        this.lastPixel_ = evt.pixel;
        this.handlePointerAtPixel_(evt.pixel, evt.map, evt.coordinate);
    };
    /**
     * @param {import("../pixel.js").Pixel} pixel Pixel
     * @param {import("../PluggableMap.js").default} map Map.
     * @param {import("../coordinate.js").Coordinate=} opt_coordinate The pixel Coordinate.
     * @private
     */
    Modify.prototype.handlePointerAtPixel_ = function (pixel, map, opt_coordinate) {
        var pixelCoordinate = opt_coordinate || map.getCoordinateFromPixel(pixel);
        var projection = map.getView().getProjection();
        var sortByDistance = function (a, b) {
            return projectedDistanceToSegmentDataSquared(pixelCoordinate, a, projection) -
                projectedDistanceToSegmentDataSquared(pixelCoordinate, b, projection);
        };
        var viewExtent = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserExtent"])(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["createOrUpdateFromCoordinate"])(pixelCoordinate, tempExtent), projection);
        var buffer = map.getView().getResolution() * this.pixelTolerance_;
        var box = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["toUserExtent"])(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["buffer"])(viewExtent, buffer, tempExtent), projection);
        var rBush = this.rBush_;
        var nodes = rBush.getInExtent(box);
        if (nodes.length > 0) {
            nodes.sort(sortByDistance);
            var node = nodes[0];
            var closestSegment = node.segment;
            var vertex = closestOnSegmentData(pixelCoordinate, node, projection);
            var vertexPixel = map.getPixelFromCoordinate(vertex);
            var dist = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["distance"])(pixel, vertexPixel);
            if (dist <= this.pixelTolerance_) {
                /** @type {Object<string, boolean>} */
                var vertexSegments = {};
                if (node.geometry.getType() === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].CIRCLE && node.index === CIRCLE_CIRCUMFERENCE_INDEX) {
                    this.snappedToVertex_ = true;
                    this.createOrUpdateVertexFeature_(vertex);
                }
                else {
                    var pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
                    var pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
                    var squaredDist1 = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["squaredDistance"])(vertexPixel, pixel1);
                    var squaredDist2 = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["squaredDistance"])(vertexPixel, pixel2);
                    dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
                    this.snappedToVertex_ = dist <= this.pixelTolerance_;
                    if (this.snappedToVertex_) {
                        vertex = squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];
                    }
                    this.createOrUpdateVertexFeature_(vertex);
                    for (var i = 1, ii = nodes.length; i < ii; ++i) {
                        var segment = nodes[i].segment;
                        if ((Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(closestSegment[0], segment[0]) &&
                            Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(closestSegment[1], segment[1]) ||
                            (Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(closestSegment[0], segment[1]) &&
                                Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(closestSegment[1], segment[0])))) {
                            vertexSegments[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(segment)] = true;
                        }
                        else {
                            break;
                        }
                    }
                }
                vertexSegments[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(closestSegment)] = true;
                this.vertexSegments_ = vertexSegments;
                return;
            }
        }
        if (this.vertexFeature_) {
            this.overlay_.getSource().removeFeature(this.vertexFeature_);
            this.vertexFeature_ = null;
        }
    };
    /**
     * @param {SegmentData} segmentData Segment data.
     * @param {import("../coordinate.js").Coordinate} vertex Vertex.
     * @private
     */
    Modify.prototype.insertVertex_ = function (segmentData, vertex) {
        var segment = segmentData.segment;
        var feature = segmentData.feature;
        var geometry = segmentData.geometry;
        var depth = segmentData.depth;
        var index = segmentData.index;
        var coordinates;
        while (vertex.length < geometry.getStride()) {
            vertex.push(0);
        }
        switch (geometry.getType()) {
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_LINE_STRING:
                coordinates = geometry.getCoordinates();
                coordinates[depth[0]].splice(index + 1, 0, vertex);
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].POLYGON:
                coordinates = geometry.getCoordinates();
                coordinates[depth[0]].splice(index + 1, 0, vertex);
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_POLYGON:
                coordinates = geometry.getCoordinates();
                coordinates[depth[1]][depth[0]].splice(index + 1, 0, vertex);
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].LINE_STRING:
                coordinates = geometry.getCoordinates();
                coordinates.splice(index + 1, 0, vertex);
                break;
            default:
                return;
        }
        this.setGeometryCoordinates_(geometry, coordinates);
        var rTree = this.rBush_;
        rTree.remove(segmentData);
        this.updateSegmentIndices_(geometry, index, depth, 1);
        /** @type {SegmentData} */
        var newSegmentData = {
            segment: [segment[0], vertex],
            feature: feature,
            geometry: geometry,
            depth: depth,
            index: index
        };
        rTree.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])(newSegmentData.segment), newSegmentData);
        this.dragSegments_.push([newSegmentData, 1]);
        /** @type {SegmentData} */
        var newSegmentData2 = {
            segment: [vertex, segment[1]],
            feature: feature,
            geometry: geometry,
            depth: depth,
            index: index + 1
        };
        rTree.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])(newSegmentData2.segment), newSegmentData2);
        this.dragSegments_.push([newSegmentData2, 0]);
        this.ignoreNextSingleClick_ = true;
    };
    /**
     * Removes the vertex currently being pointed.
     * @return {boolean} True when a vertex was removed.
     * @api
     */
    Modify.prototype.removePoint = function () {
        if (this.lastPointerEvent_ && this.lastPointerEvent_.type != _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POINTERDRAG) {
            var evt = this.lastPointerEvent_;
            this.willModifyFeatures_(evt);
            var removed = this.removeVertex_();
            this.dispatchEvent(new ModifyEvent(ModifyEventType.MODIFYEND, this.features_, evt));
            this.modified_ = false;
            return removed;
        }
        return false;
    };
    /**
     * Removes a vertex from all matching features.
     * @return {boolean} True when a vertex was removed.
     * @private
     */
    Modify.prototype.removeVertex_ = function () {
        var dragSegments = this.dragSegments_;
        var segmentsByFeature = {};
        var deleted = false;
        var component, coordinates, dragSegment, geometry, i, index, left;
        var newIndex, right, segmentData, uid;
        for (i = dragSegments.length - 1; i >= 0; --i) {
            dragSegment = dragSegments[i];
            segmentData = dragSegment[0];
            uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(segmentData.feature);
            if (segmentData.depth) {
                // separate feature components
                uid += '-' + segmentData.depth.join('-');
            }
            if (!(uid in segmentsByFeature)) {
                segmentsByFeature[uid] = {};
            }
            if (dragSegment[1] === 0) {
                segmentsByFeature[uid].right = segmentData;
                segmentsByFeature[uid].index = segmentData.index;
            }
            else if (dragSegment[1] == 1) {
                segmentsByFeature[uid].left = segmentData;
                segmentsByFeature[uid].index = segmentData.index + 1;
            }
        }
        for (uid in segmentsByFeature) {
            right = segmentsByFeature[uid].right;
            left = segmentsByFeature[uid].left;
            index = segmentsByFeature[uid].index;
            newIndex = index - 1;
            if (left !== undefined) {
                segmentData = left;
            }
            else {
                segmentData = right;
            }
            if (newIndex < 0) {
                newIndex = 0;
            }
            geometry = segmentData.geometry;
            coordinates = geometry.getCoordinates();
            component = coordinates;
            deleted = false;
            switch (geometry.getType()) {
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_LINE_STRING:
                    if (coordinates[segmentData.depth[0]].length > 2) {
                        coordinates[segmentData.depth[0]].splice(index, 1);
                        deleted = true;
                    }
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].LINE_STRING:
                    if (coordinates.length > 2) {
                        coordinates.splice(index, 1);
                        deleted = true;
                    }
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].MULTI_POLYGON:
                    component = component[segmentData.depth[1]];
                /* falls through */
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].POLYGON:
                    component = component[segmentData.depth[0]];
                    if (component.length > 4) {
                        if (index == component.length - 1) {
                            index = 0;
                        }
                        component.splice(index, 1);
                        deleted = true;
                        if (index === 0) {
                            // close the ring again
                            component.pop();
                            component.push(component[0]);
                            newIndex = component.length - 1;
                        }
                    }
                    break;
                default:
                // pass
            }
            if (deleted) {
                this.setGeometryCoordinates_(geometry, coordinates);
                var segments = [];
                if (left !== undefined) {
                    this.rBush_.remove(left);
                    segments.push(left.segment[0]);
                }
                if (right !== undefined) {
                    this.rBush_.remove(right);
                    segments.push(right.segment[1]);
                }
                if (left !== undefined && right !== undefined) {
                    /** @type {SegmentData} */
                    var newSegmentData = {
                        depth: segmentData.depth,
                        feature: segmentData.feature,
                        geometry: segmentData.geometry,
                        index: newIndex,
                        segment: segments
                    };
                    this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_10__["boundingExtent"])(newSegmentData.segment), newSegmentData);
                }
                this.updateSegmentIndices_(geometry, index, segmentData.depth, -1);
                if (this.vertexFeature_) {
                    this.overlay_.getSource().removeFeature(this.vertexFeature_);
                    this.vertexFeature_ = null;
                }
                dragSegments.length = 0;
            }
        }
        return deleted;
    };
    /**
     * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
     * @param {Array} coordinates Coordinates.
     * @private
     */
    Modify.prototype.setGeometryCoordinates_ = function (geometry, coordinates) {
        this.changingFeature_ = true;
        geometry.setCoordinates(coordinates);
        this.changingFeature_ = false;
    };
    /**
     * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
     * @param {number} index Index.
     * @param {Array<number>|undefined} depth Depth.
     * @param {number} delta Delta (1 or -1).
     * @private
     */
    Modify.prototype.updateSegmentIndices_ = function (geometry, index, depth, delta) {
        this.rBush_.forEachInExtent(geometry.getExtent(), function (segmentDataMatch) {
            if (segmentDataMatch.geometry === geometry &&
                (depth === undefined || segmentDataMatch.depth === undefined ||
                    Object(_array_js__WEBPACK_IMPORTED_MODULE_5__["equals"])(segmentDataMatch.depth, depth)) &&
                segmentDataMatch.index > index) {
                segmentDataMatch.index += delta;
            }
        });
    };
    return Modify;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_14__["default"]));
/**
 * @param {SegmentData} a The first segment data.
 * @param {SegmentData} b The second segment data.
 * @return {number} The difference in indexes.
 */
function compareIndexes(a, b) {
    return a.index - b.index;
}
/**
 * Returns the distance from a point to a line segment.
 *
 * @param {import("../coordinate.js").Coordinate} pointCoordinates The coordinates of the point from
 *        which to calculate the distance.
 * @param {SegmentData} segmentData The object describing the line
 *        segment we are calculating the distance to.
 * @param {import("../proj/Projection.js").default} projection The view projection.
 * @return {number} The square of the distance between a point and a line segment.
 */
function projectedDistanceToSegmentDataSquared(pointCoordinates, segmentData, projection) {
    var geometry = segmentData.geometry;
    if (geometry.getType() === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].CIRCLE) {
        var circleGeometry = /** @type {import("../geom/Circle.js").default} */ (geometry);
        if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) {
            var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["getUserProjection"])();
            if (userProjection) {
                circleGeometry = /** @type {import("../geom/Circle.js").default} */ (circleGeometry.clone().transform(userProjection, projection));
            }
            var distanceToCenterSquared = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["squaredDistance"])(circleGeometry.getCenter(), Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(pointCoordinates, projection));
            var distanceToCircumference = Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius();
            return distanceToCircumference * distanceToCircumference;
        }
    }
    var coordinate = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(pointCoordinates, projection);
    tempSegment[0] = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(segmentData.segment[0], projection);
    tempSegment[1] = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(segmentData.segment[1], projection);
    return Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["squaredDistanceToSegment"])(coordinate, tempSegment);
}
/**
 * Returns the point closest to a given line segment.
 *
 * @param {import("../coordinate.js").Coordinate} pointCoordinates The point to which a closest point
 *        should be found.
 * @param {SegmentData} segmentData The object describing the line
 *        segment which should contain the closest point.
 * @param {import("../proj/Projection.js").default} projection The view projection.
 * @return {import("../coordinate.js").Coordinate} The point closest to the specified line segment.
 */
function closestOnSegmentData(pointCoordinates, segmentData, projection) {
    var geometry = segmentData.geometry;
    if (geometry.getType() === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].CIRCLE && segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) {
        var circleGeometry = /** @type {import("../geom/Circle.js").default} */ (geometry);
        var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["getUserProjection"])();
        if (userProjection) {
            circleGeometry = /** @type {import("../geom/Circle.js").default} */ (circleGeometry.clone().transform(userProjection, projection));
        }
        return Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["toUserCoordinate"])(circleGeometry.getClosestPoint(Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(pointCoordinates, projection)), projection);
    }
    var coordinate = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(pointCoordinates, projection);
    tempSegment[0] = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(segmentData.segment[0], projection);
    tempSegment[1] = Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["fromUserCoordinate"])(segmentData.segment[1], projection);
    return Object(_proj_js__WEBPACK_IMPORTED_MODULE_20__["toUserCoordinate"])(Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_6__["closestOnSegment"])(coordinate, tempSegment), projection);
}
/**
 * @return {import("../style/Style.js").StyleFunction} Styles.
 */
function getDefaultStyleFunction() {
    var style = Object(_style_Style_js__WEBPACK_IMPORTED_MODULE_19__["createEditingStyle"])();
    return function (feature, resolution) {
        return style[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_11__["default"].POINT];
    };
}
/* harmony default export */ __webpack_exports__["default"] = (Modify);
//# sourceMappingURL=Modify.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/MouseWheelZoom.js":
/*!*******************************************************!*\
  !*** ./node_modules/ol/interaction/MouseWheelZoom.js ***!
  \*******************************************************/
/*! exports provided: Mode, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Mode", function() { return Mode; });
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../has.js */ "./node_modules/ol/has.js");
/* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/MouseWheelZoom
 */





/**
 * @enum {string}
 */
var Mode = {
    TRACKPAD: 'trackpad',
    WHEEL: 'wheel'
};
/**
 * @typedef {Object} Options
 * @property {import("../events/condition.js").Condition} [condition] A function that
 * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled. Default is
 * {@link module:ol/events/condition~always}.
 * In addition, if there is a `tabindex` attribute on the map element,
 * {@link module:ol/events/condition~focus} will also be applied.
 * @property {number} [maxDelta=1] Maximum mouse wheel delta.
 * @property {number} [duration=250] Animation duration in milliseconds.
 * @property {number} [timeout=80] Mouse wheel timeout duration in milliseconds.
 * @property {boolean} [useAnchor=true] Enable zooming using the mouse's
 * location as the anchor. When set to `false`, zooming in and out will zoom to
 * the center of the screen instead of zooming on the mouse's location.
 */
/**
 * @classdesc
 * Allows the user to zoom the map by scrolling the mouse wheel.
 * @api
 */
var MouseWheelZoom = /** @class */ (function (_super) {
    __extends(MouseWheelZoom, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function MouseWheelZoom(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, /** @type {import("./Interaction.js").InteractionOptions} */ (options)) || this;
        /**
         * @private
         * @type {number}
         */
        _this.totalDelta_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.lastDelta_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.maxDelta_ = options.maxDelta !== undefined ? options.maxDelta : 1;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 250;
        /**
         * @private
         * @type {number}
         */
        _this.timeout_ = options.timeout !== undefined ? options.timeout : 80;
        /**
         * @private
         * @type {boolean}
         */
        _this.useAnchor_ = options.useAnchor !== undefined ? options.useAnchor : true;
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_0__["always"];
        /**
         * @private
         * @type {?import("../coordinate.js").Coordinate}
         */
        _this.lastAnchor_ = null;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.startTime_ = undefined;
        /**
         * @private
         * @type {?}
         */
        _this.timeoutId_;
        /**
         * @private
         * @type {Mode|undefined}
         */
        _this.mode_ = undefined;
        /**
         * Trackpad events separated by this delay will be considered separate
         * interactions.
         * @type {number}
         */
        _this.trackpadEventGap_ = 400;
        /**
         * @type {?}
         */
        _this.trackpadTimeoutId_;
        /**
         * The number of delta values per zoom level
         * @private
         * @type {number}
         */
        _this.deltaPerZoom_ = 300;
        return _this;
    }
    /**
     * @private
     * @param {import("../MapBrowserEvent").default} mapBrowserEvent Event.
     * @return {boolean} Condition passes.
     */
    MouseWheelZoom.prototype.conditionInternal_ = function (mapBrowserEvent) {
        var pass = true;
        if (mapBrowserEvent.map.getTargetElement().hasAttribute('tabindex')) {
            pass = Object(_events_condition_js__WEBPACK_IMPORTED_MODULE_0__["focus"])(mapBrowserEvent);
        }
        return pass && this.condition_(mapBrowserEvent);
    };
    /**
     * @private
     */
    MouseWheelZoom.prototype.endInteraction_ = function () {
        this.trackpadTimeoutId_ = undefined;
        var view = this.getMap().getView();
        view.endInteraction(undefined, this.lastDelta_ ? (this.lastDelta_ > 0 ? 1 : -1) : 0, this.lastAnchor_);
    };
    /**
     * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually
     * zooms the map.
     * @override
     */
    MouseWheelZoom.prototype.handleEvent = function (mapBrowserEvent) {
        if (!this.conditionInternal_(mapBrowserEvent)) {
            return true;
        }
        var type = mapBrowserEvent.type;
        if (type !== _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].WHEEL) {
            return true;
        }
        mapBrowserEvent.preventDefault();
        var map = mapBrowserEvent.map;
        var wheelEvent = /** @type {WheelEvent} */ (mapBrowserEvent.originalEvent);
        if (this.useAnchor_) {
            this.lastAnchor_ = mapBrowserEvent.coordinate;
        }
        // Delta normalisation inspired by
        // https://github.com/mapbox/mapbox-gl-js/blob/001c7b9/js/ui/handler/scroll_zoom.js
        var delta;
        if (mapBrowserEvent.type == _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].WHEEL) {
            delta = wheelEvent.deltaY;
            if (_has_js__WEBPACK_IMPORTED_MODULE_2__["FIREFOX"] &&
                wheelEvent.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
                delta /= _has_js__WEBPACK_IMPORTED_MODULE_2__["DEVICE_PIXEL_RATIO"];
            }
            if (wheelEvent.deltaMode === WheelEvent.DOM_DELTA_LINE) {
                delta *= 40;
            }
        }
        if (delta === 0) {
            return false;
        }
        else {
            this.lastDelta_ = delta;
        }
        var now = Date.now();
        if (this.startTime_ === undefined) {
            this.startTime_ = now;
        }
        if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {
            this.mode_ = Math.abs(delta) < 4 ?
                Mode.TRACKPAD :
                Mode.WHEEL;
        }
        var view = map.getView();
        if (this.mode_ === Mode.TRACKPAD && !view.getConstrainResolution()) {
            if (this.trackpadTimeoutId_) {
                clearTimeout(this.trackpadTimeoutId_);
            }
            else {
                if (view.getAnimating()) {
                    view.cancelAnimations();
                }
                view.beginInteraction();
            }
            this.trackpadTimeoutId_ = setTimeout(this.endInteraction_.bind(this), this.timeout_);
            view.adjustZoom(-delta / this.deltaPerZoom_, this.lastAnchor_);
            this.startTime_ = now;
            return false;
        }
        this.totalDelta_ += delta;
        var timeLeft = Math.max(this.timeout_ - (now - this.startTime_), 0);
        clearTimeout(this.timeoutId_);
        this.timeoutId_ = setTimeout(this.handleWheelZoom_.bind(this, map), timeLeft);
        return false;
    };
    /**
     * @private
     * @param {import("../PluggableMap.js").default} map Map.
     */
    MouseWheelZoom.prototype.handleWheelZoom_ = function (map) {
        var view = map.getView();
        if (view.getAnimating()) {
            view.cancelAnimations();
        }
        var delta = -Object(_math_js__WEBPACK_IMPORTED_MODULE_4__["clamp"])(this.totalDelta_, -this.maxDelta_ * this.deltaPerZoom_, this.maxDelta_ * this.deltaPerZoom_) / this.deltaPerZoom_;
        if (view.getConstrainResolution()) {
            // view has a zoom constraint, zoom by 1
            delta = delta ? delta > 0 ? 1 : -1 : 0;
        }
        Object(_Interaction_js__WEBPACK_IMPORTED_MODULE_3__["zoomByDelta"])(view, delta, this.lastAnchor_, this.duration_);
        this.mode_ = undefined;
        this.totalDelta_ = 0;
        this.lastAnchor_ = null;
        this.startTime_ = undefined;
        this.timeoutId_ = undefined;
    };
    /**
     * Enable or disable using the mouse's location as an anchor when zooming
     * @param {boolean} useAnchor true to zoom to the mouse's location, false
     * to zoom to the center of the map
     * @api
     */
    MouseWheelZoom.prototype.setMouseAnchor = function (useAnchor) {
        this.useAnchor_ = useAnchor;
        if (!useAnchor) {
            this.lastAnchor_ = null;
        }
    };
    return MouseWheelZoom;
}(_Interaction_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (MouseWheelZoom);
//# sourceMappingURL=MouseWheelZoom.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/PinchRotate.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/interaction/PinchRotate.js ***!
  \****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
/* harmony import */ var _rotationconstraint_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../rotationconstraint.js */ "./node_modules/ol/rotationconstraint.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/PinchRotate
 */



/**
 * @typedef {Object} Options
 * @property {number} [duration=250] The duration of the animation in
 * milliseconds.
 * @property {number} [threshold=0.3] Minimal angle in radians to start a rotation.
 */
/**
 * @classdesc
 * Allows the user to rotate the map by twisting with two fingers
 * on a touch screen.
 * @api
 */
var PinchRotate = /** @class */ (function (_super) {
    __extends(PinchRotate, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function PinchRotate(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
        if (!pointerOptions.stopDown) {
            pointerOptions.stopDown = _functions_js__WEBPACK_IMPORTED_MODULE_0__["FALSE"];
        }
        _this = _super.call(this, pointerOptions) || this;
        /**
         * @private
         * @type {import("../coordinate.js").Coordinate}
         */
        _this.anchor_ = null;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.lastAngle_ = undefined;
        /**
         * @private
         * @type {boolean}
         */
        _this.rotating_ = false;
        /**
         * @private
         * @type {number}
         */
        _this.rotationDelta_ = 0.0;
        /**
         * @private
         * @type {number}
         */
        _this.threshold_ = options.threshold !== undefined ? options.threshold : 0.3;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 250;
        return _this;
    }
    /**
     * @inheritDoc
     */
    PinchRotate.prototype.handleDragEvent = function (mapBrowserEvent) {
        var rotationDelta = 0.0;
        var touch0 = this.targetPointers[0];
        var touch1 = this.targetPointers[1];
        // angle between touches
        var angle = Math.atan2(touch1.clientY - touch0.clientY, touch1.clientX - touch0.clientX);
        if (this.lastAngle_ !== undefined) {
            var delta = angle - this.lastAngle_;
            this.rotationDelta_ += delta;
            if (!this.rotating_ &&
                Math.abs(this.rotationDelta_) > this.threshold_) {
                this.rotating_ = true;
            }
            rotationDelta = delta;
        }
        this.lastAngle_ = angle;
        var map = mapBrowserEvent.map;
        var view = map.getView();
        if (view.getConstraints().rotation === _rotationconstraint_js__WEBPACK_IMPORTED_MODULE_2__["disable"]) {
            return;
        }
        // rotate anchor point.
        // FIXME: should be the intersection point between the lines:
        //     touch0,touch1 and previousTouch0,previousTouch1
        var viewportPosition = map.getViewport().getBoundingClientRect();
        var centroid = Object(_Pointer_js__WEBPACK_IMPORTED_MODULE_1__["centroid"])(this.targetPointers);
        centroid[0] -= viewportPosition.left;
        centroid[1] -= viewportPosition.top;
        this.anchor_ = map.getCoordinateFromPixelInternal(centroid);
        // rotate
        if (this.rotating_) {
            map.render();
            view.adjustRotationInternal(rotationDelta, this.anchor_);
        }
    };
    /**
     * @inheritDoc
     */
    PinchRotate.prototype.handleUpEvent = function (mapBrowserEvent) {
        if (this.targetPointers.length < 2) {
            var map = mapBrowserEvent.map;
            var view = map.getView();
            view.endInteraction(this.duration_);
            return false;
        }
        else {
            return true;
        }
    };
    /**
     * @inheritDoc
     */
    PinchRotate.prototype.handleDownEvent = function (mapBrowserEvent) {
        if (this.targetPointers.length >= 2) {
            var map = mapBrowserEvent.map;
            this.anchor_ = null;
            this.lastAngle_ = undefined;
            this.rotating_ = false;
            this.rotationDelta_ = 0.0;
            if (!this.handlingDownUpSequence) {
                map.getView().beginInteraction();
            }
            return true;
        }
        else {
            return false;
        }
    };
    return PinchRotate;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (PinchRotate);
//# sourceMappingURL=PinchRotate.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/PinchZoom.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/interaction/PinchZoom.js ***!
  \**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/PinchZoom
 */


/**
 * @typedef {Object} Options
 * @property {number} [duration=400] Animation duration in milliseconds.
 */
/**
 * @classdesc
 * Allows the user to zoom the map by pinching with two fingers
 * on a touch screen.
 * @api
 */
var PinchZoom = /** @class */ (function (_super) {
    __extends(PinchZoom, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function PinchZoom(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
        if (!pointerOptions.stopDown) {
            pointerOptions.stopDown = _functions_js__WEBPACK_IMPORTED_MODULE_0__["FALSE"];
        }
        _this = _super.call(this, pointerOptions) || this;
        /**
         * @private
         * @type {import("../coordinate.js").Coordinate}
         */
        _this.anchor_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.duration_ = options.duration !== undefined ? options.duration : 400;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.lastDistance_ = undefined;
        /**
         * @private
         * @type {number}
         */
        _this.lastScaleDelta_ = 1;
        return _this;
    }
    /**
     * @inheritDoc
     */
    PinchZoom.prototype.handleDragEvent = function (mapBrowserEvent) {
        var scaleDelta = 1.0;
        var touch0 = this.targetPointers[0];
        var touch1 = this.targetPointers[1];
        var dx = touch0.clientX - touch1.clientX;
        var dy = touch0.clientY - touch1.clientY;
        // distance between touches
        var distance = Math.sqrt(dx * dx + dy * dy);
        if (this.lastDistance_ !== undefined) {
            scaleDelta = this.lastDistance_ / distance;
        }
        this.lastDistance_ = distance;
        var map = mapBrowserEvent.map;
        var view = map.getView();
        if (scaleDelta != 1.0) {
            this.lastScaleDelta_ = scaleDelta;
        }
        // scale anchor point.
        var viewportPosition = map.getViewport().getBoundingClientRect();
        var centroid = Object(_Pointer_js__WEBPACK_IMPORTED_MODULE_1__["centroid"])(this.targetPointers);
        centroid[0] -= viewportPosition.left;
        centroid[1] -= viewportPosition.top;
        this.anchor_ = map.getCoordinateFromPixelInternal(centroid);
        // scale, bypass the resolution constraint
        map.render();
        view.adjustResolutionInternal(scaleDelta, this.anchor_);
    };
    /**
     * @inheritDoc
     */
    PinchZoom.prototype.handleUpEvent = function (mapBrowserEvent) {
        if (this.targetPointers.length < 2) {
            var map = mapBrowserEvent.map;
            var view = map.getView();
            var direction = this.lastScaleDelta_ > 1 ? 1 : -1;
            view.endInteraction(this.duration_, direction);
            return false;
        }
        else {
            return true;
        }
    };
    /**
     * @inheritDoc
     */
    PinchZoom.prototype.handleDownEvent = function (mapBrowserEvent) {
        if (this.targetPointers.length >= 2) {
            var map = mapBrowserEvent.map;
            this.anchor_ = null;
            this.lastDistance_ = undefined;
            this.lastScaleDelta_ = 1;
            if (!this.handlingDownUpSequence) {
                map.getView().beginInteraction();
            }
            return true;
        }
        else {
            return false;
        }
    };
    return PinchZoom;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (PinchZoom);
//# sourceMappingURL=PinchZoom.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Pointer.js":
/*!************************************************!*\
  !*** ./node_modules/ol/interaction/Pointer.js ***!
  \************************************************/
/*! exports provided: centroid, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "centroid", function() { return centroid; });
/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../MapBrowserEventType.js */ "./node_modules/ol/MapBrowserEventType.js");
/* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/Pointer
 */



/**
 * @typedef {Object} Options
 * @property {function(import("../MapBrowserPointerEvent.js").default):boolean} [handleDownEvent]
 * Function handling "down" events. If the function returns `true` then a drag
 * sequence is started.
 * @property {function(import("../MapBrowserPointerEvent.js").default)} [handleDragEvent]
 * Function handling "drag" events. This function is called on "move" events
 * during a drag sequence.
 * @property {function(import("../MapBrowserEvent.js").default):boolean} [handleEvent]
 * Method called by the map to notify the interaction that a browser event was
 * dispatched to the map. The function may return `false` to prevent the
 * propagation of the event to other interactions in the map's interactions
 * chain.
 * @property {function(import("../MapBrowserPointerEvent.js").default)} [handleMoveEvent]
 * Function handling "move" events. This function is called on "move" events.
 * This functions is also called during a drag sequence, so during a drag
 * sequence both the `handleDragEvent` function and this function are called.
 * If `handleDownEvent` is defined and it returns true this function will not
 * be called during a drag sequence.
 * @property {function(import("../MapBrowserPointerEvent.js").default):boolean} [handleUpEvent]
 *  Function handling "up" events. If the function returns `false` then the
 * current drag sequence is stopped.
 * @property {function(boolean):boolean} [stopDown]
 * Should the down event be propagated to other interactions, or should be
 * stopped?
 */
/**
 * @classdesc
 * Base class that calls user-defined functions on `down`, `move` and `up`
 * events. This class also manages "drag sequences".
 *
 * When the `handleDownEvent` user function returns `true` a drag sequence is
 * started. During a drag sequence the `handleDragEvent` user function is
 * called on `move` events. The drag sequence ends when the `handleUpEvent`
 * user function is called and returns `false`.
 * @api
 */
var PointerInteraction = /** @class */ (function (_super) {
    __extends(PointerInteraction, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function PointerInteraction(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, /** @type {import("./Interaction.js").InteractionOptions} */ (options)) || this;
        if (options.handleDownEvent) {
            _this.handleDownEvent = options.handleDownEvent;
        }
        if (options.handleDragEvent) {
            _this.handleDragEvent = options.handleDragEvent;
        }
        if (options.handleMoveEvent) {
            _this.handleMoveEvent = options.handleMoveEvent;
        }
        if (options.handleUpEvent) {
            _this.handleUpEvent = options.handleUpEvent;
        }
        if (options.stopDown) {
            _this.stopDown = options.stopDown;
        }
        /**
         * @type {boolean}
         * @protected
         */
        _this.handlingDownUpSequence = false;
        /**
         * @type {!Object<string, PointerEvent>}
         * @private
         */
        _this.trackedPointers_ = {};
        /**
         * @type {Array<PointerEvent>}
         * @protected
         */
        _this.targetPointers = [];
        return _this;
    }
    /**
     * Returns the current number of pointers involved in the interaction,
     * e.g. `2` when two fingers are used.
     * @return {number} The number of pointers.
     * @api
     */
    PointerInteraction.prototype.getPointerCount = function () {
        return this.targetPointers.length;
    };
    /**
     * Handle pointer down events.
     * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
     * @return {boolean} If the event was consumed.
     * @protected
     */
    PointerInteraction.prototype.handleDownEvent = function (mapBrowserEvent) {
        return false;
    };
    /**
     * Handle pointer drag events.
     * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
     * @protected
     */
    PointerInteraction.prototype.handleDragEvent = function (mapBrowserEvent) { };
    /**
     * Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into
     * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
     * detected.
     * @override
     * @api
     */
    PointerInteraction.prototype.handleEvent = function (mapBrowserEvent) {
        if (!( /** @type {import("../MapBrowserPointerEvent.js").default} */(mapBrowserEvent).pointerEvent)) {
            return true;
        }
        var stopEvent = false;
        this.updateTrackedPointers_(mapBrowserEvent);
        if (this.handlingDownUpSequence) {
            if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERDRAG) {
                this.handleDragEvent(mapBrowserEvent);
            }
            else if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERUP) {
                var handledUp = this.handleUpEvent(mapBrowserEvent);
                this.handlingDownUpSequence = handledUp && this.targetPointers.length > 0;
            }
        }
        else {
            if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERDOWN) {
                var handled = this.handleDownEvent(mapBrowserEvent);
                this.handlingDownUpSequence = handled;
                stopEvent = this.stopDown(handled);
            }
            else if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERMOVE) {
                this.handleMoveEvent(mapBrowserEvent);
            }
        }
        return !stopEvent;
    };
    /**
     * Handle pointer move events.
     * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
     * @protected
     */
    PointerInteraction.prototype.handleMoveEvent = function (mapBrowserEvent) { };
    /**
     * Handle pointer up events.
     * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
     * @return {boolean} If the event was consumed.
     * @protected
     */
    PointerInteraction.prototype.handleUpEvent = function (mapBrowserEvent) {
        return false;
    };
    /**
     * This function is used to determine if "down" events should be propagated
     * to other interactions or should be stopped.
     * @param {boolean} handled Was the event handled by the interaction?
     * @return {boolean} Should the `down` event be stopped?
     */
    PointerInteraction.prototype.stopDown = function (handled) {
        return handled;
    };
    /**
     * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
     * @private
     */
    PointerInteraction.prototype.updateTrackedPointers_ = function (mapBrowserEvent) {
        if (isPointerDraggingEvent(mapBrowserEvent)) {
            var event_1 = mapBrowserEvent.pointerEvent;
            var id = event_1.pointerId.toString();
            if (mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERUP) {
                delete this.trackedPointers_[id];
            }
            else if (mapBrowserEvent.type ==
                _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERDOWN) {
                this.trackedPointers_[id] = event_1;
            }
            else if (id in this.trackedPointers_) {
                // update only when there was a pointerdown event for this pointer
                this.trackedPointers_[id] = event_1;
            }
            this.targetPointers = Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["getValues"])(this.trackedPointers_);
        }
    };
    return PointerInteraction;
}(_Interaction_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * @param {Array<PointerEvent>} pointerEvents List of events.
 * @return {import("../pixel.js").Pixel} Centroid pixel.
 */
function centroid(pointerEvents) {
    var length = pointerEvents.length;
    var clientX = 0;
    var clientY = 0;
    for (var i = 0; i < length; i++) {
        clientX += pointerEvents[i].clientX;
        clientY += pointerEvents[i].clientY;
    }
    return [clientX / length, clientY / length];
}
/**
 * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
 * @return {boolean} Whether the event is a pointerdown, pointerdrag
 *     or pointerup event.
 */
function isPointerDraggingEvent(mapBrowserEvent) {
    var type = mapBrowserEvent.type;
    return type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERDOWN ||
        type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERDRAG ||
        type === _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__["default"].POINTERUP;
}
/* harmony default export */ __webpack_exports__["default"] = (PointerInteraction);
//# sourceMappingURL=Pointer.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Property.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/interaction/Property.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/interaction/Property
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    ACTIVE: 'active'
});
//# sourceMappingURL=Property.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Select.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/interaction/Select.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../CollectionEventType.js */ "./node_modules/ol/CollectionEventType.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_condition_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _Interaction_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Interaction.js */ "./node_modules/ol/interaction/Interaction.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/ol/style/Style.js");
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Collection.js */ "./node_modules/ol/Collection.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/Select
 */











/**
 * @enum {string}
 */
var SelectEventType = {
    /**
     * Triggered when feature(s) has been (de)selected.
     * @event SelectEvent#select
     * @api
     */
    SELECT: 'select'
};
/**
 * A function that takes an {@link module:ol/Feature} or
 * {@link module:ol/render/Feature} and an
 * {@link module:ol/layer/Layer} and returns `true` if the feature may be
 * selected or `false` otherwise.
 * @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default):boolean} FilterFunction
 */
/**
 * @typedef {Object} Options
 * @property {import("../events/condition.js").Condition} [addCondition] A function
 * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled.
 * By default, this is {@link module:ol/events/condition~never}. Use this if you
 * want to use different events for add and remove instead of `toggle`.
 * @property {import("../events/condition.js").Condition} [condition] A function that
 * takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled. This is the event
 * for the selected features as a whole. By default, this is
 * {@link module:ol/events/condition~singleClick}. Clicking on a feature selects that
 * feature and removes any that were in the selection. Clicking outside any
 * feature removes all from the selection.
 * See `toggle`, `add`, `remove` options for adding/removing extra features to/
 * from the selection.
 * @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers]
 * A list of layers from which features should be selected. Alternatively, a
 * filter function can be provided. The function will be called for each layer
 * in the map and should return `true` for layers that you want to be
 * selectable. If the option is absent, all visible layers will be considered
 * selectable.
 * @property {import("../style/Style.js").StyleLike} [style]
 * Style for the selected features. By default the default edit style is used
 * (see {@link module:ol/style}).
 * If set to a falsey value, the selected feature's style will not change.
 * @property {import("../events/condition.js").Condition} [removeCondition] A function
 * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled.
 * By default, this is {@link module:ol/events/condition~never}. Use this if you
 * want to use different events for add and remove instead of `toggle`.
 * @property {import("../events/condition.js").Condition} [toggleCondition] A function
 * that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
 * boolean to indicate whether that event should be handled. This is in addition
 * to the `condition` event. By default,
 * {@link module:ol/events/condition~shiftKeyOnly}, i.e. pressing `shift` as
 * well as the `condition` event, adds that feature to the current selection if
 * it is not currently selected, and removes it if it is. See `add` and `remove`
 * if you want to use different events instead of a toggle.
 * @property {boolean} [multi=false] A boolean that determines if the default
 * behaviour should select only single features or all (overlapping) features at
 * the clicked map position. The default of `false` means single select.
 * @property {import("../Collection.js").default<import("../Feature.js").default>} [features]
 * Collection where the interaction will place selected features. Optional. If
 * not set the interaction will create a collection. In any case the collection
 * used by the interaction is returned by
 * {@link module:ol/interaction/Select~Select#getFeatures}.
 * @property {FilterFunction} [filter] A function
 * that takes an {@link module:ol/Feature} and an
 * {@link module:ol/layer/Layer} and returns `true` if the feature may be
 * selected or `false` otherwise.
 * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside
 * the radius around the given position will be checked for features.
 */
/**
 * @classdesc
 * Events emitted by {@link module:ol/interaction/Select~Select} instances are instances of
 * this type.
 */
var SelectEvent = /** @class */ (function (_super) {
    __extends(SelectEvent, _super);
    /**
     * @param {SelectEventType} type The event type.
     * @param {Array<import("../Feature.js").default>} selected Selected features.
     * @param {Array<import("../Feature.js").default>} deselected Deselected features.
     * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Associated
     *     {@link module:ol/MapBrowserEvent}.
     */
    function SelectEvent(type, selected, deselected, mapBrowserEvent) {
        var _this = _super.call(this, type) || this;
        /**
         * Selected features array.
         * @type {Array<import("../Feature.js").default>}
         * @api
         */
        _this.selected = selected;
        /**
         * Deselected features array.
         * @type {Array<import("../Feature.js").default>}
         * @api
         */
        _this.deselected = deselected;
        /**
         * Associated {@link module:ol/MapBrowserEvent}.
         * @type {import("../MapBrowserEvent.js").default}
         * @api
         */
        _this.mapBrowserEvent = mapBrowserEvent;
        return _this;
    }
    return SelectEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * Original feature styles to reset to when features are no longer selected.
 * @type {Object.<number, import("../style/Style.js").default|Array.<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction>}
 */
var originalFeatureStyles = {};
/**
 * @classdesc
 * Interaction for selecting vector features. By default, selected features are
 * styled differently, so this interaction can be used for visual highlighting,
 * as well as selecting features for other actions, such as modification or
 * output. There are three ways of controlling which features are selected:
 * using the browser event as defined by the `condition` and optionally the
 * `toggle`, `add`/`remove`, and `multi` options; a `layers` filter; and a
 * further feature filter using the `filter` option.
 *
 * Selected features are added to an internal unmanaged layer.
 *
 * @fires SelectEvent
 * @api
 */
var Select = /** @class */ (function (_super) {
    __extends(Select, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function Select(opt_options) {
        var _this = _super.call(this, {
            handleEvent: handleEvent
        }) || this;
        var options = opt_options ? opt_options : {};
        /**
         * @private
         */
        _this.boundAddFeature_ = _this.addFeature_.bind(_this);
        /**
         * @private
         */
        _this.boundRemoveFeature_ = _this.removeFeature_.bind(_this);
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.condition_ = options.condition ? options.condition : _events_condition_js__WEBPACK_IMPORTED_MODULE_4__["singleClick"];
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.addCondition_ = options.addCondition ? options.addCondition : _events_condition_js__WEBPACK_IMPORTED_MODULE_4__["never"];
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.removeCondition_ = options.removeCondition ? options.removeCondition : _events_condition_js__WEBPACK_IMPORTED_MODULE_4__["never"];
        /**
         * @private
         * @type {import("../events/condition.js").Condition}
         */
        _this.toggleCondition_ = options.toggleCondition ? options.toggleCondition : _events_condition_js__WEBPACK_IMPORTED_MODULE_4__["shiftKeyOnly"];
        /**
         * @private
         * @type {boolean}
         */
        _this.multi_ = options.multi ? options.multi : false;
        /**
         * @private
         * @type {FilterFunction}
         */
        _this.filter_ = options.filter ? options.filter : _functions_js__WEBPACK_IMPORTED_MODULE_5__["TRUE"];
        /**
         * @private
         * @type {number}
         */
        _this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
        /**
         * @private
         * @type {import("../style/Style.js").default|Array.<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction|null}
         */
        _this.style_ = options.style !== undefined ? options.style : getDefaultStyleFunction();
        /**
         * @private
         * @type {import("../Collection.js").default}
         */
        _this.features_ = options.features || new _Collection_js__WEBPACK_IMPORTED_MODULE_10__["default"]();
        /** @type {function(import("../layer/Layer.js").default): boolean} */
        var layerFilter;
        if (options.layers) {
            if (typeof options.layers === 'function') {
                layerFilter = options.layers;
            }
            else {
                var layers_1 = options.layers;
                layerFilter = function (layer) {
                    return Object(_array_js__WEBPACK_IMPORTED_MODULE_2__["includes"])(layers_1, layer);
                };
            }
        }
        else {
            layerFilter = _functions_js__WEBPACK_IMPORTED_MODULE_5__["TRUE"];
        }
        /**
         * @private
         * @type {function(import("../layer/Layer.js").default): boolean}
         */
        _this.layerFilter_ = layerFilter;
        /**
         * An association between selected feature (key)
         * and layer (value)
         * @private
         * @type {Object<string, import("../layer/Layer.js").default>}
         */
        _this.featureLayerAssociation_ = {};
        return _this;
    }
    /**
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     * @param {import("../layer/Layer.js").default} layer Layer.
     * @private
     */
    Select.prototype.addFeatureLayerAssociation_ = function (feature, layer) {
        this.featureLayerAssociation_[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature)] = layer;
    };
    /**
     * Get the selected features.
     * @return {import("../Collection.js").default<import("../Feature.js").default>} Features collection.
     * @api
     */
    Select.prototype.getFeatures = function () {
        return this.features_;
    };
    /**
     * Returns the Hit-detection tolerance.
     * @returns {number} Hit tolerance in pixels.
     * @api
     */
    Select.prototype.getHitTolerance = function () {
        return this.hitTolerance_;
    };
    /**
     * Returns the associated {@link module:ol/layer/Vector~Vector vectorlayer} of
     * the (last) selected feature. Note that this will not work with any
     * programmatic method like pushing features to
     * {@link module:ol/interaction/Select~Select#getFeatures collection}.
     * @param {import("../Feature.js").FeatureLike} feature Feature
     * @return {import('../layer/Vector.js').default} Layer.
     * @api
     */
    Select.prototype.getLayer = function (feature) {
        return (
        /** @type {import('../layer/Vector.js').default} */ (this.featureLayerAssociation_[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature)]));
    };
    /**
     * Hit-detection tolerance. Pixels inside the radius around the given position
     * will be checked for features.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @api
     */
    Select.prototype.setHitTolerance = function (hitTolerance) {
        this.hitTolerance_ = hitTolerance;
    };
    /**
     * Remove the interaction from its current map, if any,  and attach it to a new
     * map, if any. Pass `null` to just remove the interaction from the current map.
     * @param {import("../PluggableMap.js").default} map Map.
     * @override
     * @api
     */
    Select.prototype.setMap = function (map) {
        var currentMap = this.getMap();
        if (currentMap && this.style_) {
            this.features_.forEach(this.restorePreviousStyle_.bind(this));
        }
        _super.prototype.setMap.call(this, map);
        if (map) {
            this.features_.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ADD, this.boundAddFeature_);
            this.features_.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].REMOVE, this.boundRemoveFeature_);
            if (this.style_) {
                this.features_.forEach(this.applySelectedStyle_.bind(this));
            }
        }
        else {
            this.features_.removeEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ADD, this.boundAddFeature_);
            this.features_.removeEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].REMOVE, this.boundRemoveFeature_);
        }
    };
    /**
     * @param {import("../Collection.js").CollectionEvent} evt Event.
     * @private
     */
    Select.prototype.addFeature_ = function (evt) {
        var feature = evt.element;
        if (this.style_) {
            this.applySelectedStyle_(feature);
        }
    };
    /**
     * @param {import("../Collection.js").CollectionEvent} evt Event.
     * @private
     */
    Select.prototype.removeFeature_ = function (evt) {
        var feature = evt.element;
        if (this.style_) {
            this.restorePreviousStyle_(feature);
        }
    };
    /**
     * @return {import("../style/Style.js").default|Array.<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction|null} Select style.
     */
    Select.prototype.getStyle = function () {
        return this.style_;
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @private
     */
    Select.prototype.applySelectedStyle_ = function (feature) {
        var key = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
        if (!(key in originalFeatureStyles)) {
            originalFeatureStyles[key] = feature.getStyle();
        }
        feature.setStyle(this.style_);
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @private
     */
    Select.prototype.restorePreviousStyle_ = function (feature) {
        var key = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
        var selectInteractions = /** @type {Array<Select>} */ (this.getMap().getInteractions().getArray().filter(function (interaction) {
            return interaction instanceof Select && interaction.getStyle() && interaction.getFeatures().getArray().indexOf(feature) !== -1;
        }));
        if (selectInteractions.length > 0) {
            feature.setStyle(selectInteractions[selectInteractions.length - 1].getStyle());
        }
        else {
            feature.setStyle(originalFeatureStyles[key]);
            delete originalFeatureStyles[key];
        }
    };
    /**
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     * @private
     */
    Select.prototype.removeFeatureLayerAssociation_ = function (feature) {
        delete this.featureLayerAssociation_[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature)];
    };
    return Select;
}(_Interaction_js__WEBPACK_IMPORTED_MODULE_7__["default"]));
/**
 * Handles the {@link module:ol/MapBrowserEvent map browser event} and may change the
 * selected state of features.
 * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
 * @return {boolean} `false` to stop event propagation.
 * @this {Select}
 */
function handleEvent(mapBrowserEvent) {
    if (!this.condition_(mapBrowserEvent)) {
        return true;
    }
    var add = this.addCondition_(mapBrowserEvent);
    var remove = this.removeCondition_(mapBrowserEvent);
    var toggle = this.toggleCondition_(mapBrowserEvent);
    var set = !add && !remove && !toggle;
    var map = mapBrowserEvent.map;
    var features = this.getFeatures();
    var deselected = [];
    var selected = [];
    if (set) {
        // Replace the currently selected feature(s) with the feature(s) at the
        // pixel, or clear the selected feature(s) if there is no feature at
        // the pixel.
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_8__["clear"])(this.featureLayerAssociation_);
        map.forEachFeatureAtPixel(mapBrowserEvent.pixel, (
        /**
         * @param {import("../Feature.js").FeatureLike} feature Feature.
         * @param {import("../layer/Layer.js").default} layer Layer.
         * @return {boolean|undefined} Continue to iterate over the features.
         */
        function (feature, layer) {
            if (this.filter_(feature, layer)) {
                selected.push(feature);
                this.addFeatureLayerAssociation_(feature, layer);
                return !this.multi_;
            }
        }).bind(this), {
            layerFilter: this.layerFilter_,
            hitTolerance: this.hitTolerance_
        });
        for (var i = features.getLength() - 1; i >= 0; --i) {
            var feature = features.item(i);
            var index = selected.indexOf(feature);
            if (index > -1) {
                // feature is already selected
                selected.splice(index, 1);
            }
            else {
                features.remove(feature);
                deselected.push(feature);
            }
        }
        if (selected.length !== 0) {
            features.extend(selected);
        }
    }
    else {
        // Modify the currently selected feature(s).
        map.forEachFeatureAtPixel(mapBrowserEvent.pixel, (
        /**
         * @param {import("../Feature.js").FeatureLike} feature Feature.
         * @param {import("../layer/Layer.js").default} layer Layer.
         * @return {boolean|undefined} Continue to iterate over the features.
         */
        function (feature, layer) {
            if (this.filter_(feature, layer)) {
                if ((add || toggle) && !Object(_array_js__WEBPACK_IMPORTED_MODULE_2__["includes"])(features.getArray(), feature)) {
                    selected.push(feature);
                    this.addFeatureLayerAssociation_(feature, layer);
                }
                else if ((remove || toggle) && Object(_array_js__WEBPACK_IMPORTED_MODULE_2__["includes"])(features.getArray(), feature)) {
                    deselected.push(feature);
                    this.removeFeatureLayerAssociation_(feature);
                }
                return !this.multi_;
            }
        }).bind(this), {
            layerFilter: this.layerFilter_,
            hitTolerance: this.hitTolerance_
        });
        for (var j = deselected.length - 1; j >= 0; --j) {
            features.remove(deselected[j]);
        }
        features.extend(selected);
    }
    if (selected.length > 0 || deselected.length > 0) {
        this.dispatchEvent(new SelectEvent(SelectEventType.SELECT, selected, deselected, mapBrowserEvent));
    }
    return true;
}
/**
 * @return {import("../style/Style.js").StyleFunction} Styles.
 */
function getDefaultStyleFunction() {
    var styles = Object(_style_Style_js__WEBPACK_IMPORTED_MODULE_9__["createEditingStyle"])();
    Object(_array_js__WEBPACK_IMPORTED_MODULE_2__["extend"])(styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].POLYGON], styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].LINE_STRING]);
    Object(_array_js__WEBPACK_IMPORTED_MODULE_2__["extend"])(styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].GEOMETRY_COLLECTION], styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_6__["default"].LINE_STRING]);
    return function (feature) {
        if (!feature.getGeometry()) {
            return null;
        }
        return styles[feature.getGeometry().getType()];
    };
}
/* harmony default export */ __webpack_exports__["default"] = (Select);
//# sourceMappingURL=Select.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Snap.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/interaction/Snap.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../CollectionEventType.js */ "./node_modules/ol/CollectionEventType.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../source/VectorEventType.js */ "./node_modules/ol/source/VectorEventType.js");
/* harmony import */ var _structs_RBush_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../structs/RBush.js */ "./node_modules/ol/structs/RBush.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/Snap
 */














/**
 * @typedef {Object} Result
 * @property {boolean} snapped
 * @property {import("../coordinate.js").Coordinate|null} vertex
 * @property {import("../pixel.js").Pixel|null} vertexPixel
 */
/**
 * @typedef {Object} SegmentData
 * @property {import("../Feature.js").default} feature
 * @property {Array<import("../coordinate.js").Coordinate>} segment
 */
/**
 * @typedef {Object} Options
 * @property {import("../Collection.js").default<import("../Feature.js").default>} [features] Snap to these features. Either this option or source should be provided.
 * @property {boolean} [edge=true] Snap to edges.
 * @property {boolean} [vertex=true] Snap to vertices.
 * @property {number} [pixelTolerance=10] Pixel tolerance for considering the pointer close enough to a segment or
 * vertex for snapping.
 * @property {import("../source/Vector.js").default} [source] Snap to features from this source. Either this option or features should be provided
 */
/**
 * @param  {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event.
 * @return {import("../Feature.js").default} Feature.
 */
function getFeatureFromEvent(evt) {
    if ( /** @type {import("../source/Vector.js").VectorSourceEvent} */(evt).feature) {
        return /** @type {import("../source/Vector.js").VectorSourceEvent} */ (evt).feature;
    }
    else if ( /** @type {import("../Collection.js").CollectionEvent} */(evt).element) {
        return /** @type {import("../Feature.js").default} */ ( /** @type {import("../Collection.js").CollectionEvent} */(evt).element);
    }
}
var tempSegment = [];
/**
 * @classdesc
 * Handles snapping of vector features while modifying or drawing them.  The
 * features can come from a {@link module:ol/source/Vector} or {@link module:ol/Collection~Collection}
 * Any interaction object that allows the user to interact
 * with the features using the mouse can benefit from the snapping, as long
 * as it is added before.
 *
 * The snap interaction modifies map browser event `coordinate` and `pixel`
 * properties to force the snap to occur to any interaction that them.
 *
 * Example:
 *
 *     import Snap from 'ol/interaction/Snap';
 *
 *     const snap = new Snap({
 *       source: source
 *     });
 *
 *     map.addInteraction(snap);
 *
 * @api
 */
var Snap = /** @class */ (function (_super) {
    __extends(Snap, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function Snap(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var pointerOptions = /** @type {import("./Pointer.js").Options} */ (options);
        if (!pointerOptions.handleDownEvent) {
            pointerOptions.handleDownEvent = _functions_js__WEBPACK_IMPORTED_MODULE_6__["TRUE"];
        }
        if (!pointerOptions.stopDown) {
            pointerOptions.stopDown = _functions_js__WEBPACK_IMPORTED_MODULE_6__["FALSE"];
        }
        _this = _super.call(this, pointerOptions) || this;
        /**
         * @type {import("../source/Vector.js").default}
         * @private
         */
        _this.source_ = options.source ? options.source : null;
        /**
         * @private
         * @type {boolean}
         */
        _this.vertex_ = options.vertex !== undefined ? options.vertex : true;
        /**
         * @private
         * @type {boolean}
         */
        _this.edge_ = options.edge !== undefined ? options.edge : true;
        /**
         * @type {import("../Collection.js").default<import("../Feature.js").default>}
         * @private
         */
        _this.features_ = options.features ? options.features : null;
        /**
         * @type {Array<import("../events.js").EventsKey>}
         * @private
         */
        _this.featuresListenerKeys_ = [];
        /**
         * @type {Object<string, import("../events.js").EventsKey>}
         * @private
         */
        _this.featureChangeListenerKeys_ = {};
        /**
         * Extents are preserved so indexed segment can be quickly removed
         * when its feature geometry changes
         * @type {Object<string, import("../extent.js").Extent>}
         * @private
         */
        _this.indexedFeaturesExtents_ = {};
        /**
         * If a feature geometry changes while a pointer drag|move event occurs, the
         * feature doesn't get updated right away.  It will be at the next 'pointerup'
         * event fired.
         * @type {!Object<string, import("../Feature.js").default>}
         * @private
         */
        _this.pendingFeatures_ = {};
        /**
         * @type {number}
         * @private
         */
        _this.pixelTolerance_ = options.pixelTolerance !== undefined ?
            options.pixelTolerance : 10;
        /**
        * Segment RTree for each layer
        * @type {import("../structs/RBush.js").default<SegmentData>}
        * @private
        */
        _this.rBush_ = new _structs_RBush_js__WEBPACK_IMPORTED_MODULE_12__["default"]();
        /**
        * @const
        * @private
        * @type {Object<string, function(import("../Feature.js").default, import("../geom/Geometry.js").default): void>}
        */
        _this.SEGMENT_WRITERS_ = {
            'Point': _this.writePointGeometry_.bind(_this),
            'LineString': _this.writeLineStringGeometry_.bind(_this),
            'LinearRing': _this.writeLineStringGeometry_.bind(_this),
            'Polygon': _this.writePolygonGeometry_.bind(_this),
            'MultiPoint': _this.writeMultiPointGeometry_.bind(_this),
            'MultiLineString': _this.writeMultiLineStringGeometry_.bind(_this),
            'MultiPolygon': _this.writeMultiPolygonGeometry_.bind(_this),
            'GeometryCollection': _this.writeGeometryCollectionGeometry_.bind(_this),
            'Circle': _this.writeCircleGeometry_.bind(_this)
        };
        return _this;
    }
    /**
     * Add a feature to the collection of features that we may snap to.
     * @param {import("../Feature.js").default} feature Feature.
     * @param {boolean=} opt_listen Whether to listen to the feature change or not
     *     Defaults to `true`.
     * @api
     */
    Snap.prototype.addFeature = function (feature, opt_listen) {
        var register = opt_listen !== undefined ? opt_listen : true;
        var feature_uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
        var geometry = feature.getGeometry();
        if (geometry) {
            var segmentWriter = this.SEGMENT_WRITERS_[geometry.getType()];
            if (segmentWriter) {
                this.indexedFeaturesExtents_[feature_uid] = geometry.getExtent(Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["createEmpty"])());
                segmentWriter(feature, geometry);
            }
        }
        if (register) {
            this.featureChangeListenerKeys_[feature_uid] = Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(feature, _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CHANGE, this.handleFeatureChange_, this);
        }
    };
    /**
     * @param {import("../Feature.js").default} feature Feature.
     * @private
     */
    Snap.prototype.forEachFeatureAdd_ = function (feature) {
        this.addFeature(feature);
    };
    /**
     * @param {import("../Feature.js").default} feature Feature.
     * @private
     */
    Snap.prototype.forEachFeatureRemove_ = function (feature) {
        this.removeFeature(feature);
    };
    /**
     * @return {import("../Collection.js").default<import("../Feature.js").default>|Array<import("../Feature.js").default>} Features.
     * @private
     */
    Snap.prototype.getFeatures_ = function () {
        var features;
        if (this.features_) {
            features = this.features_;
        }
        else if (this.source_) {
            features = this.source_.getFeatures();
        }
        return features;
    };
    /**
     * @inheritDoc
     */
    Snap.prototype.handleEvent = function (evt) {
        var result = this.snapTo(evt.pixel, evt.coordinate, evt.map);
        if (result.snapped) {
            evt.coordinate = result.vertex.slice(0, 2);
            evt.pixel = result.vertexPixel;
        }
        return _super.prototype.handleEvent.call(this, evt);
    };
    /**
     * @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event.
     * @private
     */
    Snap.prototype.handleFeatureAdd_ = function (evt) {
        var feature = getFeatureFromEvent(evt);
        this.addFeature(feature);
    };
    /**
     * @param {import("../source/Vector.js").VectorSourceEvent|import("../Collection.js").CollectionEvent} evt Event.
     * @private
     */
    Snap.prototype.handleFeatureRemove_ = function (evt) {
        var feature = getFeatureFromEvent(evt);
        this.removeFeature(feature);
    };
    /**
     * @param {import("../events/Event.js").default} evt Event.
     * @private
     */
    Snap.prototype.handleFeatureChange_ = function (evt) {
        var feature = /** @type {import("../Feature.js").default} */ (evt.target);
        if (this.handlingDownUpSequence) {
            var uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
            if (!(uid in this.pendingFeatures_)) {
                this.pendingFeatures_[uid] = feature;
            }
        }
        else {
            this.updateFeature_(feature);
        }
    };
    /**
     * @inheritDoc
     */
    Snap.prototype.handleUpEvent = function (evt) {
        var featuresToUpdate = Object(_obj_js__WEBPACK_IMPORTED_MODULE_10__["getValues"])(this.pendingFeatures_);
        if (featuresToUpdate.length) {
            featuresToUpdate.forEach(this.updateFeature_.bind(this));
            this.pendingFeatures_ = {};
        }
        return false;
    };
    /**
     * Remove a feature from the collection of features that we may snap to.
     * @param {import("../Feature.js").default} feature Feature
     * @param {boolean=} opt_unlisten Whether to unlisten to the feature change
     *     or not. Defaults to `true`.
     * @api
     */
    Snap.prototype.removeFeature = function (feature, opt_unlisten) {
        var unregister = opt_unlisten !== undefined ? opt_unlisten : true;
        var feature_uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
        var extent = this.indexedFeaturesExtents_[feature_uid];
        if (extent) {
            var rBush = this.rBush_;
            var nodesToRemove_1 = [];
            rBush.forEachInExtent(extent, function (node) {
                if (feature === node.feature) {
                    nodesToRemove_1.push(node);
                }
            });
            for (var i = nodesToRemove_1.length - 1; i >= 0; --i) {
                rBush.remove(nodesToRemove_1[i]);
            }
        }
        if (unregister) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["unlistenByKey"])(this.featureChangeListenerKeys_[feature_uid]);
            delete this.featureChangeListenerKeys_[feature_uid];
        }
    };
    /**
     * @inheritDoc
     */
    Snap.prototype.setMap = function (map) {
        var currentMap = this.getMap();
        var keys = this.featuresListenerKeys_;
        var features = /** @type {Array<import("../Feature.js").default>} */ (this.getFeatures_());
        if (currentMap) {
            keys.forEach(_events_js__WEBPACK_IMPORTED_MODULE_3__["unlistenByKey"]);
            keys.length = 0;
            features.forEach(this.forEachFeatureRemove_.bind(this));
        }
        _super.prototype.setMap.call(this, map);
        if (map) {
            if (this.features_) {
                keys.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(this.features_, _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].ADD, this.handleFeatureAdd_, this), Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(this.features_, _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].REMOVE, this.handleFeatureRemove_, this));
            }
            else if (this.source_) {
                keys.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(this.source_, _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_11__["default"].ADDFEATURE, this.handleFeatureAdd_, this), Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(this.source_, _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_11__["default"].REMOVEFEATURE, this.handleFeatureRemove_, this));
            }
            features.forEach(this.forEachFeatureAdd_.bind(this));
        }
    };
    /**
     * @param {import("../pixel.js").Pixel} pixel Pixel
     * @param {import("../coordinate.js").Coordinate} pixelCoordinate Coordinate
     * @param {import("../PluggableMap.js").default} map Map.
     * @return {Result} Snap result
     */
    Snap.prototype.snapTo = function (pixel, pixelCoordinate, map) {
        var lowerLeft = map.getCoordinateFromPixel([pixel[0] - this.pixelTolerance_, pixel[1] + this.pixelTolerance_]);
        var upperRight = map.getCoordinateFromPixel([pixel[0] + this.pixelTolerance_, pixel[1] - this.pixelTolerance_]);
        var box = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["boundingExtent"])([lowerLeft, upperRight]);
        var segments = this.rBush_.getInExtent(box);
        // If snapping on vertices only, don't consider circles
        if (this.vertex_ && !this.edge_) {
            segments = segments.filter(function (segment) {
                return segment.feature.getGeometry().getType() !==
                    _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_7__["default"].CIRCLE;
            });
        }
        var snapped = false;
        var vertex = null;
        var vertexPixel = null;
        if (segments.length === 0) {
            return {
                snapped: snapped,
                vertex: vertex,
                vertexPixel: vertexPixel
            };
        }
        var projection = map.getView().getProjection();
        var projectedCoordinate = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["fromUserCoordinate"])(pixelCoordinate, projection);
        var closestSegmentData;
        var minSquaredDistance = Infinity;
        for (var i = 0; i < segments.length; ++i) {
            var segmentData = segments[i];
            tempSegment[0] = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["fromUserCoordinate"])(segmentData.segment[0], projection);
            tempSegment[1] = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["fromUserCoordinate"])(segmentData.segment[1], projection);
            var delta = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistanceToSegment"])(projectedCoordinate, tempSegment);
            if (delta < minSquaredDistance) {
                closestSegmentData = segmentData;
                minSquaredDistance = delta;
            }
        }
        var closestSegment = closestSegmentData.segment;
        if (this.vertex_ && !this.edge_) {
            var pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
            var pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
            var squaredDist1 = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistance"])(pixel, pixel1);
            var squaredDist2 = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistance"])(pixel, pixel2);
            var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
            if (dist <= this.pixelTolerance_) {
                snapped = true;
                vertex = squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];
                vertexPixel = map.getPixelFromCoordinate(vertex);
            }
        }
        else if (this.edge_) {
            var isCircle = closestSegmentData.feature.getGeometry().getType() === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_7__["default"].CIRCLE;
            if (isCircle) {
                var circleGeometry = closestSegmentData.feature.getGeometry();
                var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["getUserProjection"])();
                if (userProjection) {
                    circleGeometry = circleGeometry.clone().transform(userProjection, projection);
                }
                vertex = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["toUserCoordinate"])(Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["closestOnCircle"])(projectedCoordinate, 
                /** @type {import("../geom/Circle.js").default} */ (circleGeometry)), projection);
            }
            else {
                tempSegment[0] = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["fromUserCoordinate"])(closestSegment[0], projection);
                tempSegment[1] = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["fromUserCoordinate"])(closestSegment[1], projection);
                vertex = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["toUserCoordinate"])(Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["closestOnSegment"])(projectedCoordinate, tempSegment), projection);
            }
            vertexPixel = map.getPixelFromCoordinate(vertex);
            if (Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["distance"])(pixel, vertexPixel) <= this.pixelTolerance_) {
                snapped = true;
                if (this.vertex_ && !isCircle) {
                    var pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
                    var pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
                    var squaredDist1 = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistance"])(vertexPixel, pixel1);
                    var squaredDist2 = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_2__["squaredDistance"])(vertexPixel, pixel2);
                    var dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
                    if (dist <= this.pixelTolerance_) {
                        vertex = squaredDist1 > squaredDist2 ? closestSegment[1] : closestSegment[0];
                        vertexPixel = map.getPixelFromCoordinate(vertex);
                    }
                }
            }
        }
        if (snapped) {
            vertexPixel = [Math.round(vertexPixel[0]), Math.round(vertexPixel[1])];
        }
        return {
            snapped: snapped,
            vertex: vertex,
            vertexPixel: vertexPixel
        };
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @private
     */
    Snap.prototype.updateFeature_ = function (feature) {
        this.removeFeature(feature, false);
        this.addFeature(feature, false);
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @param {import("../geom/Circle.js").default} geometry Geometry.
     * @private
     */
    Snap.prototype.writeCircleGeometry_ = function (feature, geometry) {
        var projection = this.getMap().getView().getProjection();
        var circleGeometry = geometry;
        var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_13__["getUserProjection"])();
        if (userProjection) {
            circleGeometry = /** @type {import("../geom/Circle.js").default} */ (circleGeometry.clone().transform(userProjection, projection));
        }
        var polygon = Object(_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_8__["fromCircle"])(circleGeometry);
        if (userProjection) {
            polygon.transform(projection, userProjection);
        }
        var coordinates = polygon.getCoordinates()[0];
        for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
            var segment = coordinates.slice(i, i + 2);
            var segmentData = {
                feature: feature,
                segment: segment
            };
            this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["boundingExtent"])(segment), segmentData);
        }
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
     * @private
     */
    Snap.prototype.writeGeometryCollectionGeometry_ = function (feature, geometry) {
        var geometries = geometry.getGeometriesArray();
        for (var i = 0; i < geometries.length; ++i) {
            var segmentWriter = this.SEGMENT_WRITERS_[geometries[i].getType()];
            if (segmentWriter) {
                segmentWriter(feature, geometries[i]);
            }
        }
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @param {import("../geom/LineString.js").default} geometry Geometry.
     * @private
     */
    Snap.prototype.writeLineStringGeometry_ = function (feature, geometry) {
        var coordinates = geometry.getCoordinates();
        for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
            var segment = coordinates.slice(i, i + 2);
            var segmentData = {
                feature: feature,
                segment: segment
            };
            this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["boundingExtent"])(segment), segmentData);
        }
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @param {import("../geom/MultiLineString.js").default} geometry Geometry.
     * @private
     */
    Snap.prototype.writeMultiLineStringGeometry_ = function (feature, geometry) {
        var lines = geometry.getCoordinates();
        for (var j = 0, jj = lines.length; j < jj; ++j) {
            var coordinates = lines[j];
            for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
                var segment = coordinates.slice(i, i + 2);
                var segmentData = {
                    feature: feature,
                    segment: segment
                };
                this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["boundingExtent"])(segment), segmentData);
            }
        }
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @param {import("../geom/MultiPoint.js").default} geometry Geometry.
     * @private
     */
    Snap.prototype.writeMultiPointGeometry_ = function (feature, geometry) {
        var points = geometry.getCoordinates();
        for (var i = 0, ii = points.length; i < ii; ++i) {
            var coordinates = points[i];
            var segmentData = {
                feature: feature,
                segment: [coordinates, coordinates]
            };
            this.rBush_.insert(geometry.getExtent(), segmentData);
        }
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
     * @private
     */
    Snap.prototype.writeMultiPolygonGeometry_ = function (feature, geometry) {
        var polygons = geometry.getCoordinates();
        for (var k = 0, kk = polygons.length; k < kk; ++k) {
            var rings = polygons[k];
            for (var j = 0, jj = rings.length; j < jj; ++j) {
                var coordinates = rings[j];
                for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
                    var segment = coordinates.slice(i, i + 2);
                    var segmentData = {
                        feature: feature,
                        segment: segment
                    };
                    this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["boundingExtent"])(segment), segmentData);
                }
            }
        }
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @param {import("../geom/Point.js").default} geometry Geometry.
     * @private
     */
    Snap.prototype.writePointGeometry_ = function (feature, geometry) {
        var coordinates = geometry.getCoordinates();
        var segmentData = {
            feature: feature,
            segment: [coordinates, coordinates]
        };
        this.rBush_.insert(geometry.getExtent(), segmentData);
    };
    /**
     * @param {import("../Feature.js").default} feature Feature
     * @param {import("../geom/Polygon.js").default} geometry Geometry.
     * @private
     */
    Snap.prototype.writePolygonGeometry_ = function (feature, geometry) {
        var rings = geometry.getCoordinates();
        for (var j = 0, jj = rings.length; j < jj; ++j) {
            var coordinates = rings[j];
            for (var i = 0, ii = coordinates.length - 1; i < ii; ++i) {
                var segment = coordinates.slice(i, i + 2);
                var segmentData = {
                    feature: feature,
                    segment: segment
                };
                this.rBush_.insert(Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["boundingExtent"])(segment), segmentData);
            }
        }
    };
    return Snap;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_9__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Snap);
//# sourceMappingURL=Snap.js.map

/***/ }),

/***/ "./node_modules/ol/interaction/Translate.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/interaction/Translate.js ***!
  \**************************************************/
/*! exports provided: TranslateEvent, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslateEvent", function() { return TranslateEvent; });
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _Pointer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Pointer.js */ "./node_modules/ol/interaction/Pointer.js");
/* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Property.js */ "./node_modules/ol/interaction/Property.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/interaction/Translate
 */







/**
 * @enum {string}
 */
var TranslateEventType = {
    /**
     * Triggered upon feature translation start.
     * @event TranslateEvent#translatestart
     * @api
     */
    TRANSLATESTART: 'translatestart',
    /**
     * Triggered upon feature translation.
     * @event TranslateEvent#translating
     * @api
     */
    TRANSLATING: 'translating',
    /**
     * Triggered upon feature translation end.
     * @event TranslateEvent#translateend
     * @api
     */
    TRANSLATEEND: 'translateend'
};
/**
 * A function that takes an {@link module:ol/Feature} or
 * {@link module:ol/render/Feature} and an
 * {@link module:ol/layer/Layer} and returns `true` if the feature may be
 * translated or `false` otherwise.
 * @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default):boolean} FilterFunction
 */
/**
 * @typedef {Object} Options
 * @property {Collection<import("../Feature.js").default>} [features] Only features contained in this collection will be able to be translated. If
 * not specified, all features on the map will be able to be translated.
 * @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers] A list of layers from which features should be
 * translated. Alternatively, a filter function can be provided. The
 * function will be called for each layer in the map and should return
 * `true` for layers that you want to be translatable. If the option is
 * absent, all visible layers will be considered translatable.
 * @property {FilterFunction} [filter] A function
 * that takes an {@link module:ol/Feature} and an
 * {@link module:ol/layer/Layer} and returns `true` if the feature may be
 * translated or `false` otherwise.
 * @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position
 * will be checked for features.
 */
/**
 * @classdesc
 * Events emitted by {@link module:ol/interaction/Translate~Translate} instances
 * are instances of this type.
 */
var TranslateEvent = /** @class */ (function (_super) {
    __extends(TranslateEvent, _super);
    /**
     * @param {TranslateEventType} type Type.
     * @param {Collection<import("../Feature.js").default>} features The features translated.
     * @param {import("../coordinate.js").Coordinate} coordinate The event coordinate.
     * @param {import("../coordinate.js").Coordinate} startCoordinate The original coordinates before.translation started
     * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
     */
    function TranslateEvent(type, features, coordinate, startCoordinate, mapBrowserEvent) {
        var _this = _super.call(this, type) || this;
        /**
         * The features being translated.
         * @type {Collection<import("../Feature.js").default>}
         * @api
         */
        _this.features = features;
        /**
         * The coordinate of the drag event.
         * @const
         * @type {import("../coordinate.js").Coordinate}
         * @api
         */
        _this.coordinate = coordinate;
        /**
         * The coordinate of the start position before translation started.
         * @const
         * @type {import("../coordinate.js").Coordinate}
         * @api
         */
        _this.startCoordinate = startCoordinate;
        /**
         * Associated {@link module:ol/MapBrowserEvent}.
         * @type {import("../MapBrowserEvent.js").default}
         * @api
         */
        _this.mapBrowserEvent = mapBrowserEvent;
        return _this;
    }
    return TranslateEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_2__["default"]));

/**
 * @classdesc
 * Interaction for translating (moving) features.
 *
 * @fires TranslateEvent
 * @api
 */
var Translate = /** @class */ (function (_super) {
    __extends(Translate, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function Translate(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, /** @type {import("./Pointer.js").Options} */ (options)) || this;
        /**
         * The last position we translated to.
         * @type {import("../coordinate.js").Coordinate}
         * @private
         */
        _this.lastCoordinate_ = null;
        /**
         * The start position before translation started.
         * @type {import("../coordinate.js").Coordinate}
         * @private
         */
        _this.startCoordinate_ = null;
        /**
         * @type {Collection<import("../Feature.js").default>}
         * @private
         */
        _this.features_ = options.features !== undefined ? options.features : null;
        /** @type {function(import("../layer/Layer.js").default): boolean} */
        var layerFilter;
        if (options.layers) {
            if (typeof options.layers === 'function') {
                layerFilter = options.layers;
            }
            else {
                var layers_1 = options.layers;
                layerFilter = function (layer) {
                    return Object(_array_js__WEBPACK_IMPORTED_MODULE_4__["includes"])(layers_1, layer);
                };
            }
        }
        else {
            layerFilter = _functions_js__WEBPACK_IMPORTED_MODULE_3__["TRUE"];
        }
        /**
         * @private
         * @type {function(import("../layer/Layer.js").default): boolean}
         */
        _this.layerFilter_ = layerFilter;
        /**
         * @private
         * @type {FilterFunction}
         */
        _this.filter_ = options.filter ? options.filter : _functions_js__WEBPACK_IMPORTED_MODULE_3__["TRUE"];
        /**
         * @private
         * @type {number}
         */
        _this.hitTolerance_ = options.hitTolerance ? options.hitTolerance : 0;
        /**
         * @type {import("../Feature.js").default}
         * @private
         */
        _this.lastFeature_ = null;
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_1__["getChangeEventType"])(_Property_js__WEBPACK_IMPORTED_MODULE_6__["default"].ACTIVE), _this.handleActiveChanged_);
        return _this;
    }
    /**
     * @inheritDoc
     */
    Translate.prototype.handleDownEvent = function (event) {
        this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
        if (!this.lastCoordinate_ && this.lastFeature_) {
            this.startCoordinate_ = event.coordinate;
            this.lastCoordinate_ = event.coordinate;
            this.handleMoveEvent(event);
            var features = this.features_ || new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"]([this.lastFeature_]);
            this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATESTART, features, event.coordinate, this.startCoordinate_, event));
            return true;
        }
        return false;
    };
    /**
     * @inheritDoc
     */
    Translate.prototype.handleUpEvent = function (event) {
        if (this.lastCoordinate_) {
            this.lastCoordinate_ = null;
            this.handleMoveEvent(event);
            var features = this.features_ || new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"]([this.lastFeature_]);
            this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATEEND, features, event.coordinate, this.startCoordinate_, event));
            // cleanup
            this.startCoordinate_ = null;
            return true;
        }
        return false;
    };
    /**
     * @inheritDoc
     */
    Translate.prototype.handleDragEvent = function (event) {
        if (this.lastCoordinate_) {
            var newCoordinate = event.coordinate;
            var deltaX_1 = newCoordinate[0] - this.lastCoordinate_[0];
            var deltaY_1 = newCoordinate[1] - this.lastCoordinate_[1];
            var features = this.features_ || new _Collection_js__WEBPACK_IMPORTED_MODULE_0__["default"]([this.lastFeature_]);
            features.forEach(function (feature) {
                var geom = feature.getGeometry();
                geom.translate(deltaX_1, deltaY_1);
                feature.setGeometry(geom);
            });
            this.lastCoordinate_ = newCoordinate;
            this.dispatchEvent(new TranslateEvent(TranslateEventType.TRANSLATING, features, newCoordinate, this.startCoordinate_, event));
        }
    };
    /**
     * @inheritDoc
     */
    Translate.prototype.handleMoveEvent = function (event) {
        var elem = event.map.getViewport();
        // Change the cursor to grab/grabbing if hovering any of the features managed
        // by the interaction
        if (this.featuresAtPixel_(event.pixel, event.map)) {
            elem.classList.remove(this.lastCoordinate_ ? 'ol-grab' : 'ol-grabbing');
            elem.classList.add(this.lastCoordinate_ ? 'ol-grabbing' : 'ol-grab');
        }
        else {
            elem.classList.remove('ol-grab', 'ol-grabbing');
        }
    };
    /**
     * Tests to see if the given coordinates intersects any of our selected
     * features.
     * @param {import("../pixel.js").Pixel} pixel Pixel coordinate to test for intersection.
     * @param {import("../PluggableMap.js").default} map Map to test the intersection on.
     * @return {import("../Feature.js").default} Returns the feature found at the specified pixel
     * coordinates.
     * @private
     */
    Translate.prototype.featuresAtPixel_ = function (pixel, map) {
        return map.forEachFeatureAtPixel(pixel, function (feature, layer) {
            if (this.filter_(feature, layer)) {
                if (!this.features_ || Object(_array_js__WEBPACK_IMPORTED_MODULE_4__["includes"])(this.features_.getArray(), feature)) {
                    return feature;
                }
            }
        }.bind(this), {
            layerFilter: this.layerFilter_,
            hitTolerance: this.hitTolerance_
        });
    };
    /**
     * Returns the Hit-detection tolerance.
     * @returns {number} Hit tolerance in pixels.
     * @api
     */
    Translate.prototype.getHitTolerance = function () {
        return this.hitTolerance_;
    };
    /**
     * Hit-detection tolerance. Pixels inside the radius around the given position
     * will be checked for features.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @api
     */
    Translate.prototype.setHitTolerance = function (hitTolerance) {
        this.hitTolerance_ = hitTolerance;
    };
    /**
     * @inheritDoc
     */
    Translate.prototype.setMap = function (map) {
        var oldMap = this.getMap();
        _super.prototype.setMap.call(this, map);
        this.updateState_(oldMap);
    };
    /**
     * @private
     */
    Translate.prototype.handleActiveChanged_ = function () {
        this.updateState_(null);
    };
    /**
     * @param {import("../PluggableMap.js").default} oldMap Old map.
     * @private
     */
    Translate.prototype.updateState_ = function (oldMap) {
        var map = this.getMap();
        var active = this.getActive();
        if (!map || !active) {
            map = map || oldMap;
            if (map) {
                var elem = map.getViewport();
                elem.classList.remove('ol-grab', 'ol-grabbing');
            }
        }
    };
    return Translate;
}(_Pointer_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Translate);
//# sourceMappingURL=Translate.js.map

/***/ }),

/***/ "./node_modules/ol/layer.js":
/*!**********************************!*\
  !*** ./node_modules/ol/layer.js ***!
  \**********************************/
/*! exports provided: Group, Heatmap, Image, Layer, Tile, Vector, VectorImage, VectorTile */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _layer_Group_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./layer/Group.js */ "./node_modules/ol/layer/Group.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Group", function() { return _layer_Group_js__WEBPACK_IMPORTED_MODULE_0__["default"]; });

/* harmony import */ var _layer_Heatmap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./layer/Heatmap.js */ "./node_modules/ol/layer/Heatmap.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Heatmap", function() { return _layer_Heatmap_js__WEBPACK_IMPORTED_MODULE_1__["default"]; });

/* harmony import */ var _layer_Image_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./layer/Image.js */ "./node_modules/ol/layer/Image.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Image", function() { return _layer_Image_js__WEBPACK_IMPORTED_MODULE_2__["default"]; });

/* harmony import */ var _layer_Layer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./layer/Layer.js */ "./node_modules/ol/layer/Layer.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Layer", function() { return _layer_Layer_js__WEBPACK_IMPORTED_MODULE_3__["default"]; });

/* harmony import */ var _layer_Tile_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./layer/Tile.js */ "./node_modules/ol/layer/Tile.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Tile", function() { return _layer_Tile_js__WEBPACK_IMPORTED_MODULE_4__["default"]; });

/* harmony import */ var _layer_Vector_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./layer/Vector.js */ "./node_modules/ol/layer/Vector.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Vector", function() { return _layer_Vector_js__WEBPACK_IMPORTED_MODULE_5__["default"]; });

/* harmony import */ var _layer_VectorImage_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./layer/VectorImage.js */ "./node_modules/ol/layer/VectorImage.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VectorImage", function() { return _layer_VectorImage_js__WEBPACK_IMPORTED_MODULE_6__["default"]; });

/* harmony import */ var _layer_VectorTile_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./layer/VectorTile.js */ "./node_modules/ol/layer/VectorTile.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VectorTile", function() { return _layer_VectorTile_js__WEBPACK_IMPORTED_MODULE_7__["default"]; });

/**
 * @module ol/layer
 */








//# sourceMappingURL=layer.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Base.js":
/*!***************************************!*\
  !*** ./node_modules/ol/layer/Base.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Property.js */ "./node_modules/ol/layer/Property.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/Base
 */






/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 */
/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Note that with {@link module:ol/layer/Base} and all its subclasses, any property set in
 * the options is set as a {@link module:ol/Object} property on the layer object, so
 * is observable, and has get/set accessors.
 *
 * @api
 */
var BaseLayer = /** @class */ (function (_super) {
    __extends(BaseLayer, _super);
    /**
     * @param {Options} options Layer options.
     */
    function BaseLayer(options) {
        var _this = _super.call(this) || this;
        /**
         * @type {Object<string, *>}
         */
        var properties = Object(_obj_js__WEBPACK_IMPORTED_MODULE_4__["assign"])({}, options);
        properties[_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].OPACITY] =
            options.opacity !== undefined ? options.opacity : 1;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_5__["assert"])(typeof properties[_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].OPACITY] === 'number', 64); // Layer opacity must be a number
        properties[_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].VISIBLE] =
            options.visible !== undefined ? options.visible : true;
        properties[_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].Z_INDEX] = options.zIndex;
        properties[_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MAX_RESOLUTION] =
            options.maxResolution !== undefined ? options.maxResolution : Infinity;
        properties[_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MIN_RESOLUTION] =
            options.minResolution !== undefined ? options.minResolution : 0;
        properties[_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MIN_ZOOM] =
            options.minZoom !== undefined ? options.minZoom : -Infinity;
        properties[_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MAX_ZOOM] =
            options.maxZoom !== undefined ? options.maxZoom : Infinity;
        /**
         * @type {string}
         * @private
         */
        _this.className_ = properties.className !== undefined ? options.className : 'ol-layer';
        delete properties.className;
        _this.setProperties(properties);
        /**
         * @type {import("./Layer.js").State}
         * @private
         */
        _this.state_ = null;
        return _this;
    }
    /**
     * @return {string} CSS class name.
     */
    BaseLayer.prototype.getClassName = function () {
        return this.className_;
    };
    /**
     * This method is not meant to be called by layers or layer renderers because the state
     * is incorrect if the layer is included in a layer group.
     *
     * @param {boolean=} opt_managed Layer is managed.
     * @return {import("./Layer.js").State} Layer state.
     */
    BaseLayer.prototype.getLayerState = function (opt_managed) {
        /** @type {import("./Layer.js").State} */
        var state = this.state_ || /** @type {?} */ ({
            layer: this,
            managed: opt_managed === undefined ? true : opt_managed
        });
        var zIndex = this.getZIndex();
        state.opacity = Object(_math_js__WEBPACK_IMPORTED_MODULE_3__["clamp"])(Math.round(this.getOpacity() * 100) / 100, 0, 1);
        state.sourceState = this.getSourceState();
        state.visible = this.getVisible();
        state.extent = this.getExtent();
        state.zIndex = zIndex !== undefined ? zIndex : (state.managed === false ? Infinity : 0);
        state.maxResolution = this.getMaxResolution();
        state.minResolution = Math.max(this.getMinResolution(), 0);
        state.minZoom = this.getMinZoom();
        state.maxZoom = this.getMaxZoom();
        this.state_ = state;
        return state;
    };
    /**
     * @abstract
     * @param {Array<import("./Layer.js").default>=} opt_array Array of layers (to be
     *     modified in place).
     * @return {Array<import("./Layer.js").default>} Array of layers.
     */
    BaseLayer.prototype.getLayersArray = function (opt_array) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @abstract
     * @param {Array<import("./Layer.js").State>=} opt_states Optional list of layer
     *     states (to be modified in place).
     * @return {Array<import("./Layer.js").State>} List of layer states.
     */
    BaseLayer.prototype.getLayerStatesArray = function (opt_states) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Return the {@link module:ol/extent~Extent extent} of the layer or `undefined` if it
     * will be visible regardless of extent.
     * @return {import("../extent.js").Extent|undefined} The layer extent.
     * @observable
     * @api
     */
    BaseLayer.prototype.getExtent = function () {
        return (
        /** @type {import("../extent.js").Extent|undefined} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].EXTENT)));
    };
    /**
     * Return the maximum resolution of the layer.
     * @return {number} The maximum resolution of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.getMaxResolution = function () {
        return /** @type {number} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MAX_RESOLUTION));
    };
    /**
     * Return the minimum resolution of the layer.
     * @return {number} The minimum resolution of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.getMinResolution = function () {
        return /** @type {number} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MIN_RESOLUTION));
    };
    /**
     * Return the minimum zoom level of the layer.
     * @return {number} The minimum zoom level of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.getMinZoom = function () {
        return /** @type {number} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MIN_ZOOM));
    };
    /**
     * Return the maximum zoom level of the layer.
     * @return {number} The maximum zoom level of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.getMaxZoom = function () {
        return /** @type {number} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MAX_ZOOM));
    };
    /**
     * Return the opacity of the layer (between 0 and 1).
     * @return {number} The opacity of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.getOpacity = function () {
        return /** @type {number} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].OPACITY));
    };
    /**
     * @abstract
     * @return {import("../source/State.js").default} Source state.
     */
    BaseLayer.prototype.getSourceState = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Return the visibility of the layer (`true` or `false`).
     * @return {boolean} The visibility of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.getVisible = function () {
        return /** @type {boolean} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].VISIBLE));
    };
    /**
     * Return the Z-index of the layer, which is used to order layers before
     * rendering. The default Z-index is 0.
     * @return {number} The Z-index of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.getZIndex = function () {
        return /** @type {number} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].Z_INDEX));
    };
    /**
     * Set the extent at which the layer is visible.  If `undefined`, the layer
     * will be visible at all extents.
     * @param {import("../extent.js").Extent|undefined} extent The extent of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.setExtent = function (extent) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].EXTENT, extent);
    };
    /**
     * Set the maximum resolution at which the layer is visible.
     * @param {number} maxResolution The maximum resolution of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.setMaxResolution = function (maxResolution) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MAX_RESOLUTION, maxResolution);
    };
    /**
     * Set the minimum resolution at which the layer is visible.
     * @param {number} minResolution The minimum resolution of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.setMinResolution = function (minResolution) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MIN_RESOLUTION, minResolution);
    };
    /**
     * Set the maximum zoom (exclusive) at which the layer is visible.
     * Note that the zoom levels for layer visibility are based on the
     * view zoom level, which may be different from a tile source zoom level.
     * @param {number} maxZoom The maximum zoom of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.setMaxZoom = function (maxZoom) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MAX_ZOOM, maxZoom);
    };
    /**
     * Set the minimum zoom (inclusive) at which the layer is visible.
     * Note that the zoom levels for layer visibility are based on the
     * view zoom level, which may be different from a tile source zoom level.
     * @param {number} minZoom The minimum zoom of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.setMinZoom = function (minZoom) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].MIN_ZOOM, minZoom);
    };
    /**
     * Set the opacity of the layer, allowed values range from 0 to 1.
     * @param {number} opacity The opacity of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.setOpacity = function (opacity) {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_5__["assert"])(typeof opacity === 'number', 64); // Layer opacity must be a number
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].OPACITY, opacity);
    };
    /**
     * Set the visibility of the layer (`true` or `false`).
     * @param {boolean} visible The visibility of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.setVisible = function (visible) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].VISIBLE, visible);
    };
    /**
     * Set Z-index of the layer, which is used to order layers before rendering.
     * The default Z-index is 0.
     * @param {number} zindex The z-index of the layer.
     * @observable
     * @api
     */
    BaseLayer.prototype.setZIndex = function (zindex) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__["default"].Z_INDEX, zindex);
    };
    /**
     * @inheritDoc
     */
    BaseLayer.prototype.disposeInternal = function () {
        if (this.state_) {
            this.state_.layer = null;
            this.state_ = null;
        }
        _super.prototype.disposeInternal.call(this);
    };
    return BaseLayer;
}(_Object_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (BaseLayer);
//# sourceMappingURL=Base.js.map

/***/ }),

/***/ "./node_modules/ol/layer/BaseImage.js":
/*!********************************************!*\
  !*** ./node_modules/ol/layer/BaseImage.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Layer.js */ "./node_modules/ol/layer/Layer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/BaseImage
 */

/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage
 * this layer in its layers collection, and the layer will be rendered on top. This is useful for
 * temporary layers. The standard way to add a layer to a map and have it managed by the map is to
 * use {@link module:ol/Map#addLayer}.
 * @property {import("../source/Image.js").default} [source] Source for this layer.
 */
/**
 * @classdesc
 * Server-rendered images that are available for arbitrary extents and
 * resolutions.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @extends {Layer<import("../source/Image.js").default>}
 * @api
 */
var BaseImageLayer = /** @class */ (function (_super) {
    __extends(BaseImageLayer, _super);
    /**
     * @param {Options=} opt_options Layer options.
     */
    function BaseImageLayer(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, options) || this;
        return _this;
    }
    return BaseImageLayer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (BaseImageLayer);
//# sourceMappingURL=BaseImage.js.map

/***/ }),

/***/ "./node_modules/ol/layer/BaseTile.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/layer/BaseTile.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Layer.js */ "./node_modules/ol/layer/Layer.js");
/* harmony import */ var _TileProperty_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TileProperty.js */ "./node_modules/ol/layer/TileProperty.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/BaseTile
 */



/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`
 * means no preloading.
 * @property {import("../source/Tile.js").default} [source] Source for this layer.
 * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage
 * this layer in its layers collection, and the layer will be rendered on top. This is useful for
 * temporary layers. The standard way to add a layer to a map and have it managed by the map is to
 * use {@link module:ol/Map#addLayer}.
 * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error.
 */
/**
 * @classdesc
 * For layer sources that provide pre-rendered, tiled images in grids that are
 * organized by zoom levels for specific resolutions.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @extends {Layer<import("../source/Tile.js").default>}
 * @api
 */
var BaseTileLayer = /** @class */ (function (_super) {
    __extends(BaseTileLayer, _super);
    /**
     * @param {Options=} opt_options Tile layer options.
     */
    function BaseTileLayer(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var baseOptions = Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["assign"])({}, options);
        delete baseOptions.preload;
        delete baseOptions.useInterimTilesOnError;
        _this = _super.call(this, baseOptions) || this;
        _this.setPreload(options.preload !== undefined ? options.preload : 0);
        _this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
            options.useInterimTilesOnError : true);
        return _this;
    }
    /**
    * Return the level as number to which we will preload tiles up to.
    * @return {number} The level to preload tiles up to.
    * @observable
    * @api
    */
    BaseTileLayer.prototype.getPreload = function () {
        return /** @type {number} */ (this.get(_TileProperty_js__WEBPACK_IMPORTED_MODULE_1__["default"].PRELOAD));
    };
    /**
    * Set the level as number to which we will preload tiles up to.
    * @param {number} preload The level to preload tiles up to.
    * @observable
    * @api
    */
    BaseTileLayer.prototype.setPreload = function (preload) {
        this.set(_TileProperty_js__WEBPACK_IMPORTED_MODULE_1__["default"].PRELOAD, preload);
    };
    /**
    * Whether we use interim tiles on error.
    * @return {boolean} Use interim tiles on error.
    * @observable
    * @api
    */
    BaseTileLayer.prototype.getUseInterimTilesOnError = function () {
        return /** @type {boolean} */ (this.get(_TileProperty_js__WEBPACK_IMPORTED_MODULE_1__["default"].USE_INTERIM_TILES_ON_ERROR));
    };
    /**
    * Set whether we use interim tiles on error.
    * @param {boolean} useInterimTilesOnError Use interim tiles on error.
    * @observable
    * @api
    */
    BaseTileLayer.prototype.setUseInterimTilesOnError = function (useInterimTilesOnError) {
        this.set(_TileProperty_js__WEBPACK_IMPORTED_MODULE_1__["default"].USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
    };
    return BaseTileLayer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (BaseTileLayer);
//# sourceMappingURL=BaseTile.js.map

/***/ }),

/***/ "./node_modules/ol/layer/BaseVector.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/layer/BaseVector.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Layer.js */ "./node_modules/ol/layer/Layer.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/ol/style/Style.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/BaseVector
 */



/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {import("../render.js").OrderFunction} [renderOrder] Render order. Function to be used when sorting
 * features before rendering. By default features are drawn in the order that they are created. Use
 * `null` to avoid the sort, but get an undefined draw order.
 * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the
 * renderer when getting features from the vector source for the rendering or hit-detection.
 * Recommended value: the size of the largest symbol, line width or label.
 * @property {import("../source/Vector.js").default} [source] Source.
 * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage
 * this layer in its layers collection, and the layer will be rendered on top. This is useful for
 * temporary layers. The standard way to add a layer to a map and have it managed by the map is to
 * use {@link module:ol/Map#addLayer}.
 * @property {boolean} [declutter=false] Declutter images and text. Decluttering is applied to all
 * image and text styles of all Vector and VectorTile layers that have set this to `true`. The priority
 * is defined by the z-index of the layer, the `zIndex` of the style and the render order of features.
 * Higher z-index means higher priority. Within the same z-index, a feature rendered before another has
 * higher priority.
 * @property {import("../style/Style.js").StyleLike} [style] Layer style. See
 * {@link module:ol/style} for default style which will be used if this is not defined.
 * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will
 * be recreated during animations. This means that no vectors will be shown clipped, but the
 * setting will have a performance impact for large amounts of vector data. When set to `false`,
 * batches will be recreated when no animation is active.
 * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will
 * be recreated during interactions. See also `updateWhileAnimating`.
 */
/**
 * @enum {string}
 * @private
 */
var Property = {
    RENDER_ORDER: 'renderOrder'
};
/**
 * @classdesc
 * Vector data that is rendered client-side.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @template {import("../source/Vector.js").default|import("../source/VectorTile.js").default} VectorSourceType
 * @extends {Layer<VectorSourceType>}
 * @api
 */
var BaseVectorLayer = /** @class */ (function (_super) {
    __extends(BaseVectorLayer, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function BaseVectorLayer(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var baseOptions = Object(_obj_js__WEBPACK_IMPORTED_MODULE_1__["assign"])({}, options);
        delete baseOptions.style;
        delete baseOptions.renderBuffer;
        delete baseOptions.updateWhileAnimating;
        delete baseOptions.updateWhileInteracting;
        _this = _super.call(this, baseOptions) || this;
        /**
         * @private
         * @type {boolean}
         */
        _this.declutter_ = options.declutter !== undefined ? options.declutter : false;
        /**
         * @type {number}
         * @private
         */
        _this.renderBuffer_ = options.renderBuffer !== undefined ?
            options.renderBuffer : 100;
        /**
         * User provided style.
         * @type {import("../style/Style.js").StyleLike}
         * @private
         */
        _this.style_ = null;
        /**
         * Style function for use within the library.
         * @type {import("../style/Style.js").StyleFunction|undefined}
         * @private
         */
        _this.styleFunction_ = undefined;
        _this.setStyle(options.style);
        /**
         * @type {boolean}
         * @private
         */
        _this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ?
            options.updateWhileAnimating : false;
        /**
         * @type {boolean}
         * @private
         */
        _this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ?
            options.updateWhileInteracting : false;
        return _this;
    }
    /**
     * @return {boolean} Declutter.
     */
    BaseVectorLayer.prototype.getDeclutter = function () {
        return this.declutter_;
    };
    /**
     * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise
     * that resolves with an array of features. The array will either contain the topmost feature
     * when a hit was detected, or it will be empty.
     *
     * The hit detection algorithm used for this method is optimized for performance, but is less
     * accurate than the one used in {@link import("../PluggableMap.js").default#getFeaturesAtPixel}: Text
     * is not considered, and icons are only represented by their bounding box instead of the exact
     * image.
     *
     * @param {import("../pixel.js").Pixel} pixel Pixel.
     * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with an array of features.
     * @api
     */
    BaseVectorLayer.prototype.getFeatures = function (pixel) {
        return _super.prototype.getFeatures.call(this, pixel);
    };
    /**
     * @return {number|undefined} Render buffer.
     */
    BaseVectorLayer.prototype.getRenderBuffer = function () {
        return this.renderBuffer_;
    };
    /**
     * @return {function(import("../Feature.js").default, import("../Feature.js").default): number|null|undefined} Render
     *     order.
     */
    BaseVectorLayer.prototype.getRenderOrder = function () {
        return (
        /** @type {import("../render.js").OrderFunction|null|undefined} */ (this.get(Property.RENDER_ORDER)));
    };
    /**
     * Get the style for features.  This returns whatever was passed to the `style`
     * option at construction or to the `setStyle` method.
     * @return {import("../style/Style.js").StyleLike}
     *     Layer style.
     * @api
     */
    BaseVectorLayer.prototype.getStyle = function () {
        return this.style_;
    };
    /**
     * Get the style function.
     * @return {import("../style/Style.js").StyleFunction|undefined} Layer style function.
     * @api
     */
    BaseVectorLayer.prototype.getStyleFunction = function () {
        return this.styleFunction_;
    };
    /**
     * @return {boolean} Whether the rendered layer should be updated while
     *     animating.
     */
    BaseVectorLayer.prototype.getUpdateWhileAnimating = function () {
        return this.updateWhileAnimating_;
    };
    /**
     * @return {boolean} Whether the rendered layer should be updated while
     *     interacting.
     */
    BaseVectorLayer.prototype.getUpdateWhileInteracting = function () {
        return this.updateWhileInteracting_;
    };
    /**
     * @param {import("../render.js").OrderFunction|null|undefined} renderOrder
     *     Render order.
     */
    BaseVectorLayer.prototype.setRenderOrder = function (renderOrder) {
        this.set(Property.RENDER_ORDER, renderOrder);
    };
    /**
     * Set the style for features.  This can be a single style object, an array
     * of styles, or a function that takes a feature and resolution and returns
     * an array of styles. If it is `undefined` the default style is used. If
     * it is `null` the layer has no style (a `null` style), so only features
     * that have their own styles will be rendered in the layer. See
     * {@link module:ol/style} for information on the default style.
     * @param {import("../style/Style.js").default|Array<import("../style/Style.js").default>|import("../style/Style.js").StyleFunction|null|undefined} style Layer style.
     * @api
     */
    BaseVectorLayer.prototype.setStyle = function (style) {
        this.style_ = style !== undefined ? style : _style_Style_js__WEBPACK_IMPORTED_MODULE_2__["createDefaultStyle"];
        this.styleFunction_ = style === null ?
            undefined : Object(_style_Style_js__WEBPACK_IMPORTED_MODULE_2__["toFunction"])(this.style_);
        this.changed();
    };
    return BaseVectorLayer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (BaseVectorLayer);
//# sourceMappingURL=BaseVector.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Graticule.js":
/*!********************************************!*\
  !*** ./node_modules/ol/layer/Graticule.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Vector_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Vector.js */ "./node_modules/ol/layer/Vector.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _style_Text_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../style/Text.js */ "./node_modules/ol/style/Text.js");
/* harmony import */ var _style_Fill_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../style/Fill.js */ "./node_modules/ol/style/Fill.js");
/* harmony import */ var _style_Stroke_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../style/Stroke.js */ "./node_modules/ol/style/Stroke.js");
/* harmony import */ var _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../geom/LineString.js */ "./node_modules/ol/geom/LineString.js");
/* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../source/Vector.js */ "./node_modules/ol/source/Vector.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../style/Style.js */ "./node_modules/ol/style/Style.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _geom_flat_geodesic_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../geom/flat/geodesic.js */ "./node_modules/ol/geom/flat/geodesic.js");
/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../geom/GeometryLayout.js */ "./node_modules/ol/geom/GeometryLayout.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var _render_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../render.js */ "./node_modules/ol/render.js");
/* harmony import */ var _render_EventType_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../render/EventType.js */ "./node_modules/ol/render/EventType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/Graticule
 */



















/**
 * @type {Stroke}
 * @private
 * @const
 */
var DEFAULT_STROKE_STYLE = new _style_Stroke_js__WEBPACK_IMPORTED_MODULE_5__["default"]({
    color: 'rgba(0,0,0,0.2)'
});
/**
 * @type {Array<number>}
 * @private
 */
var INTERVALS = [
    90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.01, 0.005, 0.002, 0.001
];
/**
 * @typedef {Object} GraticuleLabelDataType
 * @property {Point} geom
 * @property {string} text
 */
/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {number} [maxLines=100] The maximum number of meridians and
 * parallels from the center of the map. The default value of 100 means that at
 * most 200 meridians and 200 parallels will be displayed. The default value is
 * appropriate for conformal projections like Spherical Mercator. If you
 * increase the value, more lines will be drawn and the drawing performance will
 * decrease.
 * @property {Stroke} [strokeStyle='rgba(0,0,0,0.2)'] The
 * stroke style to use for drawing the graticule. If not provided, a not fully
 * opaque black will be used.
 * @property {number} [targetSize=100] The target size of the graticule cells,
 * in pixels.
 * @property {boolean} [showLabels=false] Render a label with the respective
 * latitude/longitude for each graticule line.
 * @property {function(number):string} [lonLabelFormatter] Label formatter for
 * longitudes. This function is called with the longitude as argument, and
 * should return a formatted string representing the longitude. By default,
 * labels are formatted as degrees, minutes, seconds and hemisphere.
 * @property {function(number):string} [latLabelFormatter] Label formatter for
 * latitudes. This function is called with the latitude as argument, and
 * should return a formatted string representing the latitude. By default,
 * labels are formatted as degrees, minutes, seconds and hemisphere.
 * @property {number} [lonLabelPosition=0] Longitude label position in fractions
 * (0..1) of view extent. 0 means at the bottom of the viewport, 1 means at the
 * top.
 * @property {number} [latLabelPosition=1] Latitude label position in fractions
 * (0..1) of view extent. 0 means at the left of the viewport, 1 means at the
 * right.
 * @property {Text} [lonLabelStyle] Longitude label text
 * style. If not provided, the following style will be used:
 * ```js
 * new Text({
 *   font: '12px Calibri,sans-serif',
 *   textBaseline: 'bottom',
 *   fill: new Fill({
 *     color: 'rgba(0,0,0,1)'
 *   }),
 *   stroke: new Stroke({
 *     color: 'rgba(255,255,255,1)',
 *     width: 3
 *   })
 * });
 * ```
 * Note that the default's `textBaseline` configuration will not work well for
 * `lonLabelPosition` configurations that position labels close to the top of
 * the viewport.
 * @property {Text} [latLabelStyle] Latitude label text style.
 * If not provided, the following style will be used:
 * ```js
 * new Text({
 *   font: '12px Calibri,sans-serif',
 *   textAlign: 'end',
 *   fill: new Fill({
 *     color: 'rgba(0,0,0,1)'
 *   }),
 *   stroke: Stroke({
 *     color: 'rgba(255,255,255,1)',
 *     width: 3
 *   })
 * });
 * ```
 * Note that the default's `textAlign` configuration will not work well for
 * `latLabelPosition` configurations that position labels close to the left of
 * the viewport.
 * @property {Array<number>} [intervals=[90, 45, 30, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.01, 0.005, 0.002, 0.001]]
 * Intervals (in degrees) for the graticule. Example to limit graticules to 30 and 10 degrees intervals:
 * ```js
 * [30, 10]
 * ```
 * @property {boolean} [wrapX=true] Whether to repeat the graticule horizontally.
 */
/**
 * @classdesc
 * Layer that renders a grid for a coordinate system (currently only EPSG:4326 is supported).
 * Note that the view projection must define both extent and worldExtent.
 *
 * @fires import("../render/Event.js").RenderEvent
 * @api
 */
var Graticule = /** @class */ (function (_super) {
    __extends(Graticule, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function Graticule(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var baseOptions = Object(_obj_js__WEBPACK_IMPORTED_MODULE_1__["assign"])({
            updateWhileAnimating: true,
            updateWhileInteracting: true,
            renderBuffer: 0
        }, options);
        delete baseOptions.maxLines;
        delete baseOptions.strokeStyle;
        delete baseOptions.targetSize;
        delete baseOptions.showLabels;
        delete baseOptions.lonLabelFormatter;
        delete baseOptions.latLabelFormatter;
        delete baseOptions.lonLabelPosition;
        delete baseOptions.latLabelPosition;
        delete baseOptions.lonLabelStyle;
        delete baseOptions.latLabelStyle;
        delete baseOptions.intervals;
        _this = _super.call(this, baseOptions) || this;
        /**
         * @type {import("../proj/Projection.js").default}
         */
        _this.projection_ = null;
        /**
         * @type {number}
         * @private
         */
        _this.maxLat_ = Infinity;
        /**
         * @type {number}
         * @private
         */
        _this.maxLon_ = Infinity;
        /**
         * @type {number}
         * @private
         */
        _this.minLat_ = -Infinity;
        /**
         * @type {number}
         * @private
         */
        _this.minLon_ = -Infinity;
        /**
         * @type {number}
         * @private
         */
        _this.maxX_ = Infinity;
        /**
         * @type {number}
         * @private
         */
        _this.maxY_ = Infinity;
        /**
         * @type {number}
         * @private
         */
        _this.minX_ = -Infinity;
        /**
         * @type {number}
         * @private
         */
        _this.minY_ = -Infinity;
        /**
         * @type {number}
         * @private
         */
        _this.targetSize_ = options.targetSize !== undefined ? options.targetSize : 100;
        /**
         * @type {number}
         * @private
         */
        _this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;
        /**
         * @type {Array<LineString>}
         * @private
         */
        _this.meridians_ = [];
        /**
         * @type {Array<LineString>}
         * @private
         */
        _this.parallels_ = [];
        /**
         * @type {Stroke}
         * @private
         */
        _this.strokeStyle_ = options.strokeStyle !== undefined ? options.strokeStyle : DEFAULT_STROKE_STYLE;
        /**
         * @type {import("../proj.js").TransformFunction|undefined}
         * @private
         */
        _this.fromLonLatTransform_ = undefined;
        /**
         * @type {import("../proj.js").TransformFunction|undefined}
         * @private
         */
        _this.toLonLatTransform_ = undefined;
        /**
         * @type {import("../coordinate.js").Coordinate}
         * @private
         */
        _this.projectionCenterLonLat_ = null;
        /**
         * @type {import("../coordinate.js").Coordinate}
         * @private
         */
        _this.bottomLeft_ = null;
        /**
         * @type {import("../coordinate.js").Coordinate}
         * @private
         */
        _this.bottomRight_ = null;
        /**
         * @type {import("../coordinate.js").Coordinate}
         * @private
         */
        _this.topLeft_ = null;
        /**
         * @type {import("../coordinate.js").Coordinate}
         * @private
         */
        _this.topRight_ = null;
        /**
         * @type {Array<GraticuleLabelDataType>}
         * @private
         */
        _this.meridiansLabels_ = null;
        /**
         * @type {Array<GraticuleLabelDataType>}
         * @private
         */
        _this.parallelsLabels_ = null;
        if (options.showLabels) {
            /**
             * @type {null|function(number):string}
             * @private
             */
            _this.lonLabelFormatter_ = options.lonLabelFormatter == undefined ?
                _coordinate_js__WEBPACK_IMPORTED_MODULE_2__["degreesToStringHDMS"].bind(_this, 'EW') : options.lonLabelFormatter;
            /**
             * @type {function(number):string}
             * @private
             */
            _this.latLabelFormatter_ = options.latLabelFormatter == undefined ?
                _coordinate_js__WEBPACK_IMPORTED_MODULE_2__["degreesToStringHDMS"].bind(_this, 'NS') : options.latLabelFormatter;
            /**
             * Longitude label position in fractions (0..1) of view extent. 0 means
             * bottom, 1 means top.
             * @type {number}
             * @private
             */
            _this.lonLabelPosition_ = options.lonLabelPosition == undefined ? 0 :
                options.lonLabelPosition;
            /**
             * Latitude Label position in fractions (0..1) of view extent. 0 means left, 1
             * means right.
             * @type {number}
             * @private
             */
            _this.latLabelPosition_ = options.latLabelPosition == undefined ? 1 :
                options.latLabelPosition;
            /**
             * @type {Style}
             * @private
             */
            _this.lonLabelStyleBase_ = new _style_Style_js__WEBPACK_IMPORTED_MODULE_11__["default"]({
                text: options.lonLabelStyle !== undefined ? options.lonLabelStyle.clone() :
                    new _style_Text_js__WEBPACK_IMPORTED_MODULE_3__["default"]({
                        font: '12px Calibri,sans-serif',
                        textBaseline: 'bottom',
                        fill: new _style_Fill_js__WEBPACK_IMPORTED_MODULE_4__["default"]({
                            color: 'rgba(0,0,0,1)'
                        }),
                        stroke: new _style_Stroke_js__WEBPACK_IMPORTED_MODULE_5__["default"]({
                            color: 'rgba(255,255,255,1)',
                            width: 3
                        })
                    })
            });
            /**
             * @private
             * @param {import("../Feature").default} feature Feature
             * @return {Style} style
             */
            _this.lonLabelStyle_ = function (feature) {
                var label = feature.get('graticule_label');
                this.lonLabelStyleBase_.getText().setText(label);
                return this.lonLabelStyleBase_;
            }.bind(_this);
            /**
             * @type {Style}
             * @private
             */
            _this.latLabelStyleBase_ = new _style_Style_js__WEBPACK_IMPORTED_MODULE_11__["default"]({
                text: options.latLabelStyle !== undefined ? options.latLabelStyle.clone() :
                    new _style_Text_js__WEBPACK_IMPORTED_MODULE_3__["default"]({
                        font: '12px Calibri,sans-serif',
                        textAlign: 'right',
                        fill: new _style_Fill_js__WEBPACK_IMPORTED_MODULE_4__["default"]({
                            color: 'rgba(0,0,0,1)'
                        }),
                        stroke: new _style_Stroke_js__WEBPACK_IMPORTED_MODULE_5__["default"]({
                            color: 'rgba(255,255,255,1)',
                            width: 3
                        })
                    })
            });
            /**
             * @private
             * @param {import("../Feature").default} feature Feature
             * @return {Style} style
             */
            _this.latLabelStyle_ = function (feature) {
                var label = feature.get('graticule_label');
                this.latLabelStyleBase_.getText().setText(label);
                return this.latLabelStyleBase_;
            }.bind(_this);
            _this.meridiansLabels_ = [];
            _this.parallelsLabels_ = [];
            _this.addEventListener(_render_EventType_js__WEBPACK_IMPORTED_MODULE_18__["default"].POSTRENDER, _this.drawLabels_.bind(_this));
        }
        /**
         * @type {Array<number>}
         * @private
         */
        _this.intervals_ = options.intervals !== undefined ? options.intervals : INTERVALS;
        // use a source with a custom loader for lines & text
        _this.setSource(new _source_Vector_js__WEBPACK_IMPORTED_MODULE_7__["default"]({
            loader: _this.loaderFunction.bind(_this),
            strategy: _this.strategyFunction.bind(_this),
            features: new _Collection_js__WEBPACK_IMPORTED_MODULE_16__["default"](),
            overlaps: false,
            useSpatialIndex: false,
            wrapX: options.wrapX
        }));
        /**
         * feature pool to use when updating graticule
         * @type {Array<Feature>}
         * @private
         */
        _this.featurePool_ = [];
        /**
         * @type {Style}
         * @private
         */
        _this.lineStyle_ = new _style_Style_js__WEBPACK_IMPORTED_MODULE_11__["default"]({
            stroke: _this.strokeStyle_
        });
        /**
         * @type {?import("../extent.js").Extent}
         * @private
         */
        _this.loadedExtent_ = null;
        /**
         * @type {?import("../extent.js").Extent}
         */
        _this.renderedExtent_ = null;
        _this.setRenderOrder(null);
        return _this;
    }
    /**
     * Strategy function for loading features based on the view's extent and
     * resolution.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} resolution Resolution.
     * @return {Array<import("../extent.js").Extent>} Extents.
     */
    Graticule.prototype.strategyFunction = function (extent, resolution) {
        // extents may be passed in different worlds, to avoid endless loop we use only one
        var realWorldExtent = extent.slice();
        if (this.projection_ && this.getSource().getWrapX()) {
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["wrapX"])(realWorldExtent, this.projection_);
        }
        if (this.loadedExtent_) {
            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["approximatelyEquals"])(this.loadedExtent_, realWorldExtent, resolution)) {
                // make sure result is exactly equal to previous extent
                realWorldExtent = this.loadedExtent_.slice();
            }
            else {
                // we should not keep track of loaded extents
                this.getSource().removeLoadedExtent(this.loadedExtent_);
            }
        }
        return [realWorldExtent];
    };
    /**
     * Update geometries in the source based on current view
     * @param {import("../extent").Extent} extent Extent
     * @param {number} resolution Resolution
     * @param {import("../proj/Projection.js").default} projection Projection
     */
    Graticule.prototype.loaderFunction = function (extent, resolution, projection) {
        this.loadedExtent_ = extent;
        var source = this.getSource();
        // only consider the intersection between our own extent & the requested one
        var layerExtent = this.getExtent() || [-Infinity, -Infinity, Infinity, Infinity];
        var renderExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getIntersection"])(layerExtent, extent);
        if (this.renderedExtent_ && Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["equals"])(this.renderedExtent_, renderExtent)) {
            return;
        }
        this.renderedExtent_ = renderExtent;
        // bail out if nothing to render
        if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["isEmpty"])(renderExtent)) {
            return;
        }
        // update projection info
        var center = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getCenter"])(renderExtent);
        var squaredTolerance = resolution * resolution / 4;
        var updateProjectionInfo = !this.projection_ ||
            !Object(_proj_js__WEBPACK_IMPORTED_MODULE_8__["equivalent"])(this.projection_, projection);
        if (updateProjectionInfo) {
            this.updateProjectionInfo_(projection);
        }
        this.createGraticule_(renderExtent, center, resolution, squaredTolerance);
        // first make sure we have enough features in the pool
        var featureCount = this.meridians_.length + this.parallels_.length;
        if (this.meridiansLabels_) {
            featureCount += this.meridians_.length;
        }
        if (this.parallelsLabels_) {
            featureCount += this.parallels_.length;
        }
        var feature;
        while (featureCount > this.featurePool_.length) {
            feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_12__["default"]();
            this.featurePool_.push(feature);
        }
        var featuresColl = source.getFeaturesCollection();
        featuresColl.clear();
        var poolIndex = 0;
        // add features for the lines & labels
        var i, l;
        for (i = 0, l = this.meridians_.length; i < l; ++i) {
            feature = this.featurePool_[poolIndex++];
            feature.setGeometry(this.meridians_[i]);
            feature.setStyle(this.lineStyle_);
            featuresColl.push(feature);
        }
        for (i = 0, l = this.parallels_.length; i < l; ++i) {
            feature = this.featurePool_[poolIndex++];
            feature.setGeometry(this.parallels_[i]);
            feature.setStyle(this.lineStyle_);
            featuresColl.push(feature);
        }
    };
    /**
     * @param {number} lon Longitude.
     * @param {number} minLat Minimal latitude.
     * @param {number} maxLat Maximal latitude.
     * @param {number} squaredTolerance Squared tolerance.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} index Index.
     * @return {number} Index.
     * @private
     */
    Graticule.prototype.addMeridian_ = function (lon, minLat, maxLat, squaredTolerance, extent, index) {
        var lineString = this.getMeridian_(lon, minLat, maxLat, squaredTolerance, index);
        if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["intersects"])(lineString.getExtent(), extent)) {
            if (this.meridiansLabels_) {
                var text = this.lonLabelFormatter_(lon);
                if (index in this.meridiansLabels_) {
                    this.meridiansLabels_[index].text = text;
                }
                else {
                    this.meridiansLabels_[index] = {
                        geom: new _geom_Point_js__WEBPACK_IMPORTED_MODULE_15__["default"]([]),
                        text: text
                    };
                }
            }
            this.meridians_[index++] = lineString;
        }
        return index;
    };
    /**
     * @param {number} lat Latitude.
     * @param {number} minLon Minimal longitude.
     * @param {number} maxLon Maximal longitude.
     * @param {number} squaredTolerance Squared tolerance.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} index Index.
     * @return {number} Index.
     * @private
     */
    Graticule.prototype.addParallel_ = function (lat, minLon, maxLon, squaredTolerance, extent, index) {
        var lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance, index);
        if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["intersects"])(lineString.getExtent(), extent)) {
            if (this.parallelsLabels_) {
                var text = this.latLabelFormatter_(lat);
                if (index in this.parallelsLabels_) {
                    this.parallelsLabels_[index].text = text;
                }
                else {
                    this.parallelsLabels_[index] = {
                        geom: new _geom_Point_js__WEBPACK_IMPORTED_MODULE_15__["default"]([]),
                        text: text
                    };
                }
            }
            this.parallels_[index++] = lineString;
        }
        return index;
    };
    /**
     * @param {import("../render/Event.js").default} event Render event.
     * @private
     */
    Graticule.prototype.drawLabels_ = function (event) {
        var rotation = event.frameState.viewState.rotation;
        var extent = event.frameState.extent;
        var rotationCenter = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getCenter"])(extent);
        var rotationExtent = extent;
        if (rotation) {
            var width = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getWidth"])(extent);
            var height = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getHeight"])(extent);
            var cr = Math.abs(Math.cos(rotation));
            var sr = Math.abs(Math.sin(rotation));
            var unrotatedWidth = (sr * height - cr * width) / (sr * sr - cr * cr);
            var unrotatedHeight = (sr * width - cr * height) / (sr * sr - cr * cr);
            rotationExtent = [
                rotationCenter[0] - unrotatedWidth / 2, rotationCenter[1] - unrotatedHeight / 2,
                rotationCenter[0] + unrotatedWidth / 2, rotationCenter[1] + unrotatedHeight / 2
            ];
        }
        var startWorld = 0;
        var endWorld = 0;
        var labelsAtStart = this.latLabelPosition_ < 0.5;
        var projectionExtent = this.projection_.getExtent();
        var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getWidth"])(projectionExtent);
        if (this.getSource().getWrapX() && this.projection_.canWrapX() && !Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["containsExtent"])(projectionExtent, extent)) {
            startWorld = Math.floor((extent[0] - projectionExtent[0]) / worldWidth);
            endWorld = Math.ceil((extent[2] - projectionExtent[2]) / worldWidth);
            var inverted = Math.abs(rotation) > Math.PI / 2;
            labelsAtStart = labelsAtStart !== inverted;
        }
        var vectorContext = Object(_render_js__WEBPACK_IMPORTED_MODULE_17__["getVectorContext"])(event);
        for (var world = startWorld; world <= endWorld; ++world) {
            var poolIndex = this.meridians_.length + this.parallels_.length;
            var feature = void 0, index = void 0, l = void 0, textPoint = void 0;
            if (this.meridiansLabels_) {
                for (index = 0, l = this.meridiansLabels_.length; index < l; ++index) {
                    var lineString = this.meridians_[index];
                    if (!rotation && world === 0) {
                        textPoint = this.getMeridianPoint_(lineString, extent, index);
                    }
                    else {
                        var clone = lineString.clone();
                        clone.translate(world * worldWidth, 0);
                        clone.rotate(-rotation, rotationCenter);
                        textPoint = this.getMeridianPoint_(clone, rotationExtent, index);
                        textPoint.rotate(rotation, rotationCenter);
                    }
                    feature = this.featurePool_[poolIndex++];
                    feature.setGeometry(textPoint);
                    feature.set('graticule_label', this.meridiansLabels_[index].text);
                    vectorContext.drawFeature(feature, this.lonLabelStyle_(feature));
                }
            }
            if (this.parallelsLabels_) {
                if (world === startWorld && labelsAtStart || world === endWorld && !labelsAtStart) {
                    for (index = 0, l = this.parallels_.length; index < l; ++index) {
                        var lineString = this.parallels_[index];
                        if (!rotation && world === 0) {
                            textPoint = this.getParallelPoint_(lineString, extent, index);
                        }
                        else {
                            var clone = lineString.clone();
                            clone.translate(world * worldWidth, 0);
                            clone.rotate(-rotation, rotationCenter);
                            textPoint = this.getParallelPoint_(clone, rotationExtent, index);
                            textPoint.rotate(rotation, rotationCenter);
                        }
                        feature = this.featurePool_[poolIndex++];
                        feature.setGeometry(textPoint);
                        feature.set('graticule_label', this.parallelsLabels_[index].text);
                        vectorContext.drawFeature(feature, this.latLabelStyle_(feature));
                    }
                }
            }
        }
    };
    /**
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {import("../coordinate.js").Coordinate} center Center.
     * @param {number} resolution Resolution.
     * @param {number} squaredTolerance Squared tolerance.
     * @private
     */
    Graticule.prototype.createGraticule_ = function (extent, center, resolution, squaredTolerance) {
        var interval = this.getInterval_(resolution);
        if (interval == -1) {
            this.meridians_.length = 0;
            this.parallels_.length = 0;
            if (this.meridiansLabels_) {
                this.meridiansLabels_.length = 0;
            }
            if (this.parallelsLabels_) {
                this.parallelsLabels_.length = 0;
            }
            return;
        }
        var wrapX = false;
        var projectionExtent = this.projection_.getExtent();
        var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getWidth"])(projectionExtent);
        if (this.getSource().getWrapX() && this.projection_.canWrapX() && !Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["containsExtent"])(projectionExtent, extent)) {
            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getWidth"])(extent) >= worldWidth) {
                extent[0] = projectionExtent[0];
                extent[2] = projectionExtent[2];
            }
            else {
                wrapX = true;
            }
        }
        // Constrain the center to fit into the extent available to the graticule
        var validCenterP = [
            Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(center[0], this.minX_, this.maxX_),
            Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(center[1], this.minY_, this.maxY_)
        ];
        // Transform the center to lon lat
        // Some projections may have a void area at the poles
        // so replace any NaN latitudes with the min or max value closest to a pole
        var centerLonLat = this.toLonLatTransform_(validCenterP);
        if (isNaN(centerLonLat[1])) {
            centerLonLat[1] = Math.abs(this.maxLat_) >= Math.abs(this.minLat_) ?
                this.maxLat_ : this.minLat_;
        }
        var centerLon = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(centerLonLat[0], this.minLon_, this.maxLon_);
        var centerLat = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(centerLonLat[1], this.minLat_, this.maxLat_);
        var maxLines = this.maxLines_;
        var cnt, idx, lat, lon;
        // Limit the extent to fit into the extent available to the graticule
        var validExtentP = extent;
        if (!wrapX) {
            validExtentP = [
                Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(extent[0], this.minX_, this.maxX_),
                Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(extent[1], this.minY_, this.maxY_),
                Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(extent[2], this.minX_, this.maxX_),
                Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(extent[3], this.minY_, this.maxY_)
            ];
        }
        // Transform the extent to get the lon lat ranges for the edges of the extent
        var validExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["applyTransform"])(validExtentP, this.toLonLatTransform_, undefined, 8);
        var maxLat = validExtent[3];
        var maxLon = validExtent[2];
        var minLat = validExtent[1];
        var minLon = validExtent[0];
        if (!wrapX) {
            // Check if extremities of the world extent lie inside the extent
            // (for example the pole in a polar projection)
            // and extend the extent as appropriate
            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["containsCoordinate"])(validExtentP, this.bottomLeft_)) {
                minLon = this.minLon_;
                minLat = this.minLat_;
            }
            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["containsCoordinate"])(validExtentP, this.bottomRight_)) {
                maxLon = this.maxLon_;
                minLat = this.minLat_;
            }
            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["containsCoordinate"])(validExtentP, this.topLeft_)) {
                minLon = this.minLon_;
                maxLat = this.maxLat_;
            }
            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["containsCoordinate"])(validExtentP, this.topRight_)) {
                maxLon = this.maxLon_;
                maxLat = this.maxLat_;
            }
            // The transformed center may also extend the lon lat ranges used for rendering
            maxLat = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(maxLat, centerLat, this.maxLat_);
            maxLon = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(maxLon, centerLon, this.maxLon_);
            minLat = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(minLat, this.minLat_, centerLat);
            minLon = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(minLon, this.minLon_, centerLon);
        }
        // Create meridians
        centerLon = Math.floor(centerLon / interval) * interval;
        lon = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(centerLon, this.minLon_, this.maxLon_);
        idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, 0);
        cnt = 0;
        if (wrapX) {
            while ((lon -= interval) >= minLon && cnt++ < maxLines) {
                idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx);
            }
        }
        else {
            while (lon != this.minLon_ && cnt++ < maxLines) {
                lon = Math.max(lon - interval, this.minLon_);
                idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx);
            }
        }
        lon = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(centerLon, this.minLon_, this.maxLon_);
        cnt = 0;
        if (wrapX) {
            while ((lon += interval) <= maxLon && cnt++ < maxLines) {
                idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx);
            }
        }
        else {
            while (lon != this.maxLon_ && cnt++ < maxLines) {
                lon = Math.min(lon + interval, this.maxLon_);
                idx = this.addMeridian_(lon, minLat, maxLat, squaredTolerance, extent, idx);
            }
        }
        this.meridians_.length = idx;
        if (this.meridiansLabels_) {
            this.meridiansLabels_.length = idx;
        }
        // Create parallels
        centerLat = Math.floor(centerLat / interval) * interval;
        lat = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(centerLat, this.minLat_, this.maxLat_);
        idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, 0);
        cnt = 0;
        while (lat != this.minLat_ && cnt++ < maxLines) {
            lat = Math.max(lat - interval, this.minLat_);
            idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, idx);
        }
        lat = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(centerLat, this.minLat_, this.maxLat_);
        cnt = 0;
        while (lat != this.maxLat_ && cnt++ < maxLines) {
            lat = Math.min(lat + interval, this.maxLat_);
            idx = this.addParallel_(lat, minLon, maxLon, squaredTolerance, extent, idx);
        }
        this.parallels_.length = idx;
        if (this.parallelsLabels_) {
            this.parallelsLabels_.length = idx;
        }
    };
    /**
     * @param {number} resolution Resolution.
     * @return {number} The interval in degrees.
     * @private
     */
    Graticule.prototype.getInterval_ = function (resolution) {
        var centerLon = this.projectionCenterLonLat_[0];
        var centerLat = this.projectionCenterLonLat_[1];
        var interval = -1;
        var target = Math.pow(this.targetSize_ * resolution, 2);
        /** @type {Array<number>} **/
        var p1 = [];
        /** @type {Array<number>} **/
        var p2 = [];
        for (var i = 0, ii = this.intervals_.length; i < ii; ++i) {
            var delta = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(this.intervals_[i] / 2, 0, 90);
            // Don't attempt to transform latitudes beyond the poles!
            var clampedLat = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(centerLat, -90 + delta, 90 - delta);
            p1[0] = centerLon - delta;
            p1[1] = clampedLat - delta;
            p2[0] = centerLon + delta;
            p2[1] = clampedLat + delta;
            this.fromLonLatTransform_(p1, p1);
            this.fromLonLatTransform_(p2, p2);
            var dist = Math.pow(p2[0] - p1[0], 2) + Math.pow(p2[1] - p1[1], 2);
            if (dist <= target) {
                break;
            }
            interval = this.intervals_[i];
        }
        return interval;
    };
    /**
     * @param {number} lon Longitude.
     * @param {number} minLat Minimal latitude.
     * @param {number} maxLat Maximal latitude.
     * @param {number} squaredTolerance Squared tolerance.
     * @return {LineString} The meridian line string.
     * @param {number} index Index.
     * @private
     */
    Graticule.prototype.getMeridian_ = function (lon, minLat, maxLat, squaredTolerance, index) {
        var flatCoordinates = Object(_geom_flat_geodesic_js__WEBPACK_IMPORTED_MODULE_13__["meridian"])(lon, minLat, maxLat, this.projection_, squaredTolerance);
        var lineString = this.meridians_[index];
        if (!lineString) {
            lineString = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_14__["default"].XY);
            this.meridians_[index] = lineString;
        }
        else {
            lineString.setFlatCoordinates(_geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_14__["default"].XY, flatCoordinates);
            lineString.changed();
        }
        return lineString;
    };
    /**
     * @param {LineString} lineString Meridian
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} index Index.
     * @return {Point} Meridian point.
     * @private
     */
    Graticule.prototype.getMeridianPoint_ = function (lineString, extent, index) {
        var flatCoordinates = lineString.getFlatCoordinates();
        var bottom = 1;
        var top = flatCoordinates.length - 1;
        if (flatCoordinates[bottom] > flatCoordinates[top]) {
            bottom = top;
            top = 1;
        }
        var clampedBottom = Math.max(extent[1], flatCoordinates[bottom]);
        var clampedTop = Math.min(extent[3], flatCoordinates[top]);
        var lat = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(extent[1] + Math.abs(extent[1] - extent[3]) * this.lonLabelPosition_, clampedBottom, clampedTop);
        var coordinate0 = flatCoordinates[bottom - 1] +
            (flatCoordinates[top - 1] - flatCoordinates[bottom - 1]) * (lat - flatCoordinates[bottom]) /
                (flatCoordinates[top] - flatCoordinates[bottom]);
        var coordinate = [coordinate0, lat];
        var point = this.meridiansLabels_[index].geom;
        point.setCoordinates(coordinate);
        return point;
    };
    /**
     * Get the list of meridians.  Meridians are lines of equal longitude.
     * @return {Array<LineString>} The meridians.
     * @api
     */
    Graticule.prototype.getMeridians = function () {
        return this.meridians_;
    };
    /**
     * @param {number} lat Latitude.
     * @param {number} minLon Minimal longitude.
     * @param {number} maxLon Maximal longitude.
     * @param {number} squaredTolerance Squared tolerance.
     * @return {LineString} The parallel line string.
     * @param {number} index Index.
     * @private
     */
    Graticule.prototype.getParallel_ = function (lat, minLon, maxLon, squaredTolerance, index) {
        var flatCoordinates = Object(_geom_flat_geodesic_js__WEBPACK_IMPORTED_MODULE_13__["parallel"])(lat, minLon, maxLon, this.projection_, squaredTolerance);
        var lineString = this.parallels_[index];
        if (!lineString) {
            lineString = new _geom_LineString_js__WEBPACK_IMPORTED_MODULE_6__["default"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_14__["default"].XY);
        }
        else {
            lineString.setFlatCoordinates(_geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_14__["default"].XY, flatCoordinates);
            lineString.changed();
        }
        return lineString;
    };
    /**
     * @param {LineString} lineString Parallels.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} index Index.
     * @return {Point} Parallel point.
     * @private
     */
    Graticule.prototype.getParallelPoint_ = function (lineString, extent, index) {
        var flatCoordinates = lineString.getFlatCoordinates();
        var left = 0;
        var right = flatCoordinates.length - 2;
        if (flatCoordinates[left] > flatCoordinates[right]) {
            left = right;
            right = 0;
        }
        var clampedLeft = Math.max(extent[0], flatCoordinates[left]);
        var clampedRight = Math.min(extent[2], flatCoordinates[right]);
        var lon = Object(_math_js__WEBPACK_IMPORTED_MODULE_10__["clamp"])(extent[0] + Math.abs(extent[0] - extent[2]) * this.latLabelPosition_, clampedLeft, clampedRight);
        var coordinate1 = flatCoordinates[left + 1] +
            (flatCoordinates[right + 1] - flatCoordinates[left + 1]) * (lon - flatCoordinates[left]) /
                (flatCoordinates[right] - flatCoordinates[left]);
        var coordinate = [lon, coordinate1];
        var point = this.parallelsLabels_[index].geom;
        point.setCoordinates(coordinate);
        return point;
    };
    /**
     * Get the list of parallels.  Parallels are lines of equal latitude.
     * @return {Array<LineString>} The parallels.
     * @api
     */
    Graticule.prototype.getParallels = function () {
        return this.parallels_;
    };
    /**
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @private
     */
    Graticule.prototype.updateProjectionInfo_ = function (projection) {
        var epsg4326Projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_8__["get"])('EPSG:4326');
        var worldExtent = projection.getWorldExtent();
        this.maxLat_ = worldExtent[3];
        this.maxLon_ = worldExtent[2];
        this.minLat_ = worldExtent[1];
        this.minLon_ = worldExtent[0];
        // If the world extent crosses the dateline define a custom transform to
        // return longitudes which wrap the dateline
        var toLonLatTransform = Object(_proj_js__WEBPACK_IMPORTED_MODULE_8__["getTransform"])(projection, epsg4326Projection);
        if (this.minLon_ < this.maxLon_) {
            this.toLonLatTransform_ = toLonLatTransform;
        }
        else {
            var split_1 = this.minLon_ + this.maxLon_ / 2;
            this.maxLon_ += 360;
            this.toLonLatTransform_ = function (coordinates, opt_output, opt_dimension) {
                var dimension = opt_dimension || 2;
                var lonLatCoordinates = toLonLatTransform(coordinates, opt_output, dimension);
                for (var i = 0, l = lonLatCoordinates.length; i < l; i += dimension) {
                    if (lonLatCoordinates[i] < split_1) {
                        lonLatCoordinates[i] += 360;
                    }
                }
                return lonLatCoordinates;
            };
        }
        // Transform the extent to get the limits of the view projection extent
        // which should be available to the graticule
        this.fromLonLatTransform_ = Object(_proj_js__WEBPACK_IMPORTED_MODULE_8__["getTransform"])(epsg4326Projection, projection);
        var worldExtentP = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["applyTransform"])([this.minLon_, this.minLat_, this.maxLon_, this.maxLat_], this.fromLonLatTransform_, undefined, 8);
        this.minX_ = worldExtentP[0];
        this.maxX_ = worldExtentP[2];
        this.minY_ = worldExtentP[1];
        this.maxY_ = worldExtentP[3];
        // Determine the view projection coordinates of the extremities of the world extent
        // as these may lie inside a view extent (for example the pole in a polar projection)
        this.bottomLeft_ = this.fromLonLatTransform_([this.minLon_, this.minLat_]);
        this.bottomRight_ = this.fromLonLatTransform_([this.maxLon_, this.minLat_]);
        this.topLeft_ = this.fromLonLatTransform_([this.minLon_, this.maxLat_]);
        this.topRight_ = this.fromLonLatTransform_([this.maxLon_, this.maxLat_]);
        // Transform the projection center to lon lat
        // Some projections may have a void area at the poles
        // so replace any NaN latitudes with the min or max value closest to a pole
        this.projectionCenterLonLat_ = this.toLonLatTransform_(Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getCenter"])(projection.getExtent()));
        if (isNaN(this.projectionCenterLonLat_[1])) {
            this.projectionCenterLonLat_[1] = Math.abs(this.maxLat_) >= Math.abs(this.minLat_) ?
                this.maxLat_ : this.minLat_;
        }
        this.projection_ = projection;
    };
    return Graticule;
}(_Vector_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Graticule);
//# sourceMappingURL=Graticule.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Group.js":
/*!****************************************!*\
  !*** ./node_modules/ol/layer/Group.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../CollectionEventType.js */ "./node_modules/ol/CollectionEventType.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ObjectEventType.js */ "./node_modules/ol/ObjectEventType.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Base_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Base.js */ "./node_modules/ol/layer/Base.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _source_State_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../source/State.js */ "./node_modules/ol/source/State.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/Group
 */












/**
 * @typedef {Object} Options
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {Array<import("./Base.js").default>|import("../Collection.js").default<import("./Base.js").default>} [layers] Child layers.
 */
/**
 * @enum {string}
 * @private
 */
var Property = {
    LAYERS: 'layers'
};
/**
 * @classdesc
 * A {@link module:ol/Collection~Collection} of layers that are handled together.
 *
 * A generic `change` event is triggered when the group/Collection changes.
 *
 * @api
 */
var LayerGroup = /** @class */ (function (_super) {
    __extends(LayerGroup, _super);
    /**
     * @param {Options=} opt_options Layer options.
     */
    function LayerGroup(opt_options) {
        var _this = this;
        var options = opt_options || {};
        var baseOptions = /** @type {Options} */ (Object(_obj_js__WEBPACK_IMPORTED_MODULE_10__["assign"])({}, options));
        delete baseOptions.layers;
        var layers = options.layers;
        _this = _super.call(this, baseOptions) || this;
        /**
         * @private
         * @type {Array<import("../events.js").EventsKey>}
         */
        _this.layersListenerKeys_ = [];
        /**
         * @private
         * @type {Object<string, Array<import("../events.js").EventsKey>>}
         */
        _this.listenerKeys_ = {};
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_3__["getChangeEventType"])(Property.LAYERS), _this.handleLayersChanged_);
        if (layers) {
            if (Array.isArray(layers)) {
                layers = new _Collection_js__WEBPACK_IMPORTED_MODULE_1__["default"](layers.slice(), { unique: true });
            }
            else {
                Object(_asserts_js__WEBPACK_IMPORTED_MODULE_5__["assert"])(typeof /** @type {?} */ (layers).getArray === 'function', 43); // Expected `layers` to be an array or a `Collection`
            }
        }
        else {
            layers = new _Collection_js__WEBPACK_IMPORTED_MODULE_1__["default"](undefined, { unique: true });
        }
        _this.setLayers(layers);
        return _this;
    }
    /**
     * @private
     */
    LayerGroup.prototype.handleLayerChange_ = function () {
        this.changed();
    };
    /**
     * @private
     */
    LayerGroup.prototype.handleLayersChanged_ = function () {
        this.layersListenerKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_6__["unlistenByKey"]);
        this.layersListenerKeys_.length = 0;
        var layers = this.getLayers();
        this.layersListenerKeys_.push(Object(_events_js__WEBPACK_IMPORTED_MODULE_6__["listen"])(layers, _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].ADD, this.handleLayersAdd_, this), Object(_events_js__WEBPACK_IMPORTED_MODULE_6__["listen"])(layers, _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].REMOVE, this.handleLayersRemove_, this));
        for (var id in this.listenerKeys_) {
            this.listenerKeys_[id].forEach(_events_js__WEBPACK_IMPORTED_MODULE_6__["unlistenByKey"]);
        }
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_10__["clear"])(this.listenerKeys_);
        var layersArray = layers.getArray();
        for (var i = 0, ii = layersArray.length; i < ii; i++) {
            var layer = layersArray[i];
            this.listenerKeys_[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer)] = [
                Object(_events_js__WEBPACK_IMPORTED_MODULE_6__["listen"])(layer, _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].PROPERTYCHANGE, this.handleLayerChange_, this),
                Object(_events_js__WEBPACK_IMPORTED_MODULE_6__["listen"])(layer, _events_EventType_js__WEBPACK_IMPORTED_MODULE_7__["default"].CHANGE, this.handleLayerChange_, this)
            ];
        }
        this.changed();
    };
    /**
     * @param {import("../Collection.js").CollectionEvent} collectionEvent CollectionEvent.
     * @private
     */
    LayerGroup.prototype.handleLayersAdd_ = function (collectionEvent) {
        var layer = /** @type {import("./Base.js").default} */ (collectionEvent.element);
        this.listenerKeys_[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer)] = [
            Object(_events_js__WEBPACK_IMPORTED_MODULE_6__["listen"])(layer, _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].PROPERTYCHANGE, this.handleLayerChange_, this),
            Object(_events_js__WEBPACK_IMPORTED_MODULE_6__["listen"])(layer, _events_EventType_js__WEBPACK_IMPORTED_MODULE_7__["default"].CHANGE, this.handleLayerChange_, this)
        ];
        this.changed();
    };
    /**
     * @param {import("../Collection.js").CollectionEvent} collectionEvent CollectionEvent.
     * @private
     */
    LayerGroup.prototype.handleLayersRemove_ = function (collectionEvent) {
        var layer = /** @type {import("./Base.js").default} */ (collectionEvent.element);
        var key = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer);
        this.listenerKeys_[key].forEach(_events_js__WEBPACK_IMPORTED_MODULE_6__["unlistenByKey"]);
        delete this.listenerKeys_[key];
        this.changed();
    };
    /**
     * Returns the {@link module:ol/Collection collection} of {@link module:ol/layer/Layer~Layer layers}
     * in this group.
     * @return {!import("../Collection.js").default<import("./Base.js").default>} Collection of
     *   {@link module:ol/layer/Base layers} that are part of this group.
     * @observable
     * @api
     */
    LayerGroup.prototype.getLayers = function () {
        return (
        /** @type {!import("../Collection.js").default<import("./Base.js").default>} */ (this.get(Property.LAYERS)));
    };
    /**
     * Set the {@link module:ol/Collection collection} of {@link module:ol/layer/Layer~Layer layers}
     * in this group.
     * @param {!import("../Collection.js").default<import("./Base.js").default>} layers Collection of
     *   {@link module:ol/layer/Base layers} that are part of this group.
     * @observable
     * @api
     */
    LayerGroup.prototype.setLayers = function (layers) {
        this.set(Property.LAYERS, layers);
    };
    /**
     * @inheritDoc
     */
    LayerGroup.prototype.getLayersArray = function (opt_array) {
        var array = opt_array !== undefined ? opt_array : [];
        this.getLayers().forEach(function (layer) {
            layer.getLayersArray(array);
        });
        return array;
    };
    /**
     * @inheritDoc
     */
    LayerGroup.prototype.getLayerStatesArray = function (opt_states) {
        var states = opt_states !== undefined ? opt_states : [];
        var pos = states.length;
        this.getLayers().forEach(function (layer) {
            layer.getLayerStatesArray(states);
        });
        var ownLayerState = this.getLayerState();
        for (var i = pos, ii = states.length; i < ii; i++) {
            var layerState = states[i];
            layerState.opacity *= ownLayerState.opacity;
            layerState.visible = layerState.visible && ownLayerState.visible;
            layerState.maxResolution = Math.min(layerState.maxResolution, ownLayerState.maxResolution);
            layerState.minResolution = Math.max(layerState.minResolution, ownLayerState.minResolution);
            layerState.minZoom = Math.max(layerState.minZoom, ownLayerState.minZoom);
            layerState.maxZoom = Math.min(layerState.maxZoom, ownLayerState.maxZoom);
            if (ownLayerState.extent !== undefined) {
                if (layerState.extent !== undefined) {
                    layerState.extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_8__["getIntersection"])(layerState.extent, ownLayerState.extent);
                }
                else {
                    layerState.extent = ownLayerState.extent;
                }
            }
        }
        return states;
    };
    /**
     * @inheritDoc
     */
    LayerGroup.prototype.getSourceState = function () {
        return _source_State_js__WEBPACK_IMPORTED_MODULE_11__["default"].READY;
    };
    return LayerGroup;
}(_Base_js__WEBPACK_IMPORTED_MODULE_9__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (LayerGroup);
//# sourceMappingURL=Group.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Heatmap.js":
/*!******************************************!*\
  !*** ./node_modules/ol/layer/Heatmap.js ***!
  \******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _Vector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Vector.js */ "./node_modules/ol/layer/Vector.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _renderer_webgl_PointsLayer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../renderer/webgl/PointsLayer.js */ "./node_modules/ol/renderer/webgl/PointsLayer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/Heatmap
 */






/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {Array<string>} [gradient=['#00f', '#0ff', '#0f0', '#ff0', '#f00']] The color gradient
 * of the heatmap, specified as an array of CSS color strings.
 * @property {number} [radius=8] Radius size in pixels.
 * @property {number} [blur=15] Blur size in pixels.
 * @property {string|function(import("../Feature.js").default):number} [weight='weight'] The feature
 * attribute to use for the weight or a function that returns a weight from a feature. Weight values
 * should range from 0 to 1 (and values outside will be clamped to that range).
 * @property {import("../source/Vector.js").default} [source] Source.
 */
/**
 * @enum {string}
 * @private
 */
var Property = {
    BLUR: 'blur',
    GRADIENT: 'gradient',
    RADIUS: 'radius'
};
/**
 * @const
 * @type {Array<string>}
 */
var DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00'];
/**
 * @classdesc
 * Layer for rendering vector data as a heatmap.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @fires import("../render/Event.js").RenderEvent
 * @api
 */
var Heatmap = /** @class */ (function (_super) {
    __extends(Heatmap, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function Heatmap(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var baseOptions = Object(_obj_js__WEBPACK_IMPORTED_MODULE_4__["assign"])({}, options);
        delete baseOptions.gradient;
        delete baseOptions.radius;
        delete baseOptions.blur;
        delete baseOptions.weight;
        _this = _super.call(this, baseOptions) || this;
        /**
         * @private
         * @type {HTMLCanvasElement}
         */
        _this.gradient_ = null;
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_0__["getChangeEventType"])(Property.GRADIENT), _this.handleGradientChanged_);
        _this.setGradient(options.gradient ? options.gradient : DEFAULT_GRADIENT);
        _this.setBlur(options.blur !== undefined ? options.blur : 15);
        _this.setRadius(options.radius !== undefined ? options.radius : 8);
        var weight = options.weight ? options.weight : 'weight';
        if (typeof weight === 'string') {
            _this.weightFunction_ = function (feature) {
                return feature.get(weight);
            };
        }
        else {
            _this.weightFunction_ = weight;
        }
        // For performance reasons, don't sort the features before rendering.
        // The render order is not relevant for a heatmap representation.
        _this.setRenderOrder(null);
        return _this;
    }
    /**
     * Return the blur size in pixels.
     * @return {number} Blur size in pixels.
     * @api
     * @observable
     */
    Heatmap.prototype.getBlur = function () {
        return /** @type {number} */ (this.get(Property.BLUR));
    };
    /**
     * Return the gradient colors as array of strings.
     * @return {Array<string>} Colors.
     * @api
     * @observable
     */
    Heatmap.prototype.getGradient = function () {
        return /** @type {Array<string>} */ (this.get(Property.GRADIENT));
    };
    /**
     * Return the size of the radius in pixels.
     * @return {number} Radius size in pixel.
     * @api
     * @observable
     */
    Heatmap.prototype.getRadius = function () {
        return /** @type {number} */ (this.get(Property.RADIUS));
    };
    /**
     * @private
     */
    Heatmap.prototype.handleGradientChanged_ = function () {
        this.gradient_ = createGradient(this.getGradient());
    };
    /**
     * Set the blur size in pixels.
     * @param {number} blur Blur size in pixels.
     * @api
     * @observable
     */
    Heatmap.prototype.setBlur = function (blur) {
        this.set(Property.BLUR, blur);
    };
    /**
     * Set the gradient colors as array of strings.
     * @param {Array<string>} colors Gradient.
     * @api
     * @observable
     */
    Heatmap.prototype.setGradient = function (colors) {
        this.set(Property.GRADIENT, colors);
    };
    /**
     * Set the size of the radius in pixels.
     * @param {number} radius Radius size in pixel.
     * @api
     * @observable
     */
    Heatmap.prototype.setRadius = function (radius) {
        this.set(Property.RADIUS, radius);
    };
    /**
     * @inheritDoc
     */
    Heatmap.prototype.createRenderer = function () {
        return new _renderer_webgl_PointsLayer_js__WEBPACK_IMPORTED_MODULE_5__["default"](this, {
            attributes: [
                {
                    name: 'weight',
                    callback: function (feature) {
                        var weight = this.weightFunction_(feature);
                        return weight !== undefined ? Object(_math_js__WEBPACK_IMPORTED_MODULE_3__["clamp"])(weight, 0, 1) : 1;
                    }.bind(this)
                }
            ],
            vertexShader: "\n        precision mediump float;\n        uniform mat4 u_projectionMatrix;\n        uniform mat4 u_offsetScaleMatrix;\n        uniform float u_size;\n        attribute vec2 a_position;\n        attribute float a_index;\n        attribute float a_weight;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n\n        void main(void) {\n          mat4 offsetMatrix = u_offsetScaleMatrix;\n          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;\n          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;\n          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n          v_texCoord = vec2(u, v);\n          v_weight = a_weight;\n        }",
            fragmentShader: "\n        precision mediump float;\n        uniform float u_blurSlope;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n\n        void main(void) {\n          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);\n          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;\n          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;\n          float alpha = smoothstep(0.0, 1.0, value) * v_weight;\n          gl_FragColor = vec4(alpha, alpha, alpha, alpha);\n        }",
            hitVertexShader: "\n        precision mediump float;\n        uniform mat4 u_projectionMatrix;\n        uniform mat4 u_offsetScaleMatrix;\n        uniform float u_size;\n        attribute vec2 a_position;\n        attribute float a_index;\n        attribute float a_weight;\n        attribute vec4 a_hitColor;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n        varying vec4 v_hitColor;\n\n        void main(void) {\n          mat4 offsetMatrix = u_offsetScaleMatrix;\n          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;\n          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;\n          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n          v_texCoord = vec2(u, v);\n          v_hitColor = a_hitColor;\n          v_weight = a_weight;\n        }",
            hitFragmentShader: "\n        precision mediump float;\n        uniform float u_blurSlope;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n        varying vec4 v_hitColor;\n\n        void main(void) {\n          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);\n          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;\n          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;\n          float alpha = smoothstep(0.0, 1.0, value) * v_weight;\n          if (alpha < 0.05) {\n            discard;\n          }\n\n          gl_FragColor = v_hitColor;\n        }",
            uniforms: {
                u_size: function () {
                    return (this.get(Property.RADIUS) + this.get(Property.BLUR)) * 2;
                }.bind(this),
                u_blurSlope: function () {
                    return this.get(Property.RADIUS) / Math.max(1, this.get(Property.BLUR));
                }.bind(this)
            },
            postProcesses: [
                {
                    fragmentShader: "\n            precision mediump float;\n\n            uniform sampler2D u_image;\n            uniform sampler2D u_gradientTexture;\n\n            varying vec2 v_texCoord;\n\n            void main() {\n              vec4 color = texture2D(u_image, v_texCoord);\n              gl_FragColor.a = color.a;\n              gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n              gl_FragColor.rgb *= gl_FragColor.a;\n            }",
                    uniforms: {
                        u_gradientTexture: function () {
                            return this.gradient_;
                        }.bind(this)
                    }
                }
            ]
        });
    };
    return Heatmap;
}(_Vector_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/**
 * @param {Array<string>} colors A list of colored.
 * @return {HTMLCanvasElement} canvas with gradient texture.
 */
function createGradient(colors) {
    var width = 1;
    var height = 256;
    var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_1__["createCanvasContext2D"])(width, height);
    var gradient = context.createLinearGradient(0, 0, width, height);
    var step = 1 / (colors.length - 1);
    for (var i = 0, ii = colors.length; i < ii; ++i) {
        gradient.addColorStop(i * step, colors[i]);
    }
    context.fillStyle = gradient;
    context.fillRect(0, 0, width, height);
    return context.canvas;
}
/* harmony default export */ __webpack_exports__["default"] = (Heatmap);
//# sourceMappingURL=Heatmap.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Image.js":
/*!****************************************!*\
  !*** ./node_modules/ol/layer/Image.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _BaseImage_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseImage.js */ "./node_modules/ol/layer/BaseImage.js");
/* harmony import */ var _renderer_canvas_ImageLayer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderer/canvas/ImageLayer.js */ "./node_modules/ol/renderer/canvas/ImageLayer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/Image
 */


/**
 * @classdesc
 * Server-rendered images that are available for arbitrary extents and
 * resolutions.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @api
 */
var ImageLayer = /** @class */ (function (_super) {
    __extends(ImageLayer, _super);
    /**
     * @param {import("./BaseImage.js").Options=} opt_options Layer options.
     */
    function ImageLayer(opt_options) {
        return _super.call(this, opt_options) || this;
    }
    /**
     * Create a renderer for this layer.
     * @return {import("../renderer/Layer.js").default} A layer renderer.
     * @protected
     */
    ImageLayer.prototype.createRenderer = function () {
        return new _renderer_canvas_ImageLayer_js__WEBPACK_IMPORTED_MODULE_1__["default"](this);
    };
    return ImageLayer;
}(_BaseImage_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ImageLayer);
//# sourceMappingURL=Image.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Layer.js":
/*!****************************************!*\
  !*** ./node_modules/ol/layer/Layer.js ***!
  \****************************************/
/*! exports provided: inView, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inView", function() { return inView; });
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _Base_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Base.js */ "./node_modules/ol/layer/Base.js");
/* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Property.js */ "./node_modules/ol/layer/Property.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _render_EventType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../render/EventType.js */ "./node_modules/ol/render/EventType.js");
/* harmony import */ var _source_State_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../source/State.js */ "./node_modules/ol/source/State.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/Layer
 */









/**
 * @typedef {function(import("../PluggableMap.js").FrameState):HTMLElement} RenderFunction
 */
/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {import("../source/Source.js").default} [source] Source for this layer.  If not provided to the constructor,
 * the source can be set by calling {@link module:ol/layer/Layer#setSource layer.setSource(source)} after
 * construction.
 * @property {import("../PluggableMap.js").default} [map] Map.
 * @property {RenderFunction} [render] Render function. Takes the frame state as input and is expected to return an
 * HTML element. Will overwrite the default rendering for the layer.
 */
/**
 * @typedef {Object} State
 * @property {import("./Base.js").default} layer
 * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.
 * @property {SourceState} sourceState
 * @property {boolean} visible
 * @property {boolean} managed
 * @property {import("../extent.js").Extent} [extent]
 * @property {number} zIndex
 * @property {number} maxResolution
 * @property {number} minResolution
 * @property {number} minZoom
 * @property {number} maxZoom
 */
/**
 * @classdesc
 * Base class from which all layer types are derived. This should only be instantiated
 * in the case where a custom layer is be added to the map with a custom `render` function.
 * Such a function can be specified in the `options` object, and is expected to return an HTML element.
 *
 * A visual representation of raster or vector map data.
 * Layers group together those properties that pertain to how the data is to be
 * displayed, irrespective of the source of that data.
 *
 * Layers are usually added to a map with {@link module:ol/Map#addLayer}. Components
 * like {@link module:ol/interaction/Select~Select} use unmanaged layers
 * internally. These unmanaged layers are associated with the map using
 * {@link module:ol/layer/Layer~Layer#setMap} instead.
 *
 * A generic `change` event is fired when the state of the source changes.
 *
 * Please note that for performance reasons several layers might get rendered to
 * the same HTML element, which will cause {@link module:ol/Map~Map#forEachLayerAtPixel} to
 * give false positives. To avoid this, apply different `className` properties to the
 * layers at creation time.
 *
 * @fires import("../render/Event.js").RenderEvent#prerender
 * @fires import("../render/Event.js").RenderEvent#postrender
 *
 * @template {import("../source/Source.js").default} SourceType
 * @api
 */
var Layer = /** @class */ (function (_super) {
    __extends(Layer, _super);
    /**
     * @param {Options} options Layer options.
     */
    function Layer(options) {
        var _this = this;
        var baseOptions = Object(_obj_js__WEBPACK_IMPORTED_MODULE_5__["assign"])({}, options);
        delete baseOptions.source;
        _this = _super.call(this, baseOptions) || this;
        /**
         * @private
         * @type {?import("../events.js").EventsKey}
         */
        _this.mapPrecomposeKey_ = null;
        /**
         * @private
         * @type {?import("../events.js").EventsKey}
         */
        _this.mapRenderKey_ = null;
        /**
         * @private
         * @type {?import("../events.js").EventsKey}
         */
        _this.sourceChangeKey_ = null;
        /**
         * @private
         * @type {import("../renderer/Layer.js").default}
         */
        _this.renderer_ = null;
        // Overwrite default render method with a custom one
        if (options.render) {
            _this.render = options.render;
        }
        if (options.map) {
            _this.setMap(options.map);
        }
        _this.addEventListener(Object(_Object_js__WEBPACK_IMPORTED_MODULE_2__["getChangeEventType"])(_Property_js__WEBPACK_IMPORTED_MODULE_4__["default"].SOURCE), _this.handleSourcePropertyChange_);
        var source = options.source ? /** @type {SourceType} */ (options.source) : null;
        _this.setSource(source);
        return _this;
    }
    /**
     * @inheritDoc
     */
    Layer.prototype.getLayersArray = function (opt_array) {
        var array = opt_array ? opt_array : [];
        array.push(this);
        return array;
    };
    /**
     * @inheritDoc
     */
    Layer.prototype.getLayerStatesArray = function (opt_states) {
        var states = opt_states ? opt_states : [];
        states.push(this.getLayerState());
        return states;
    };
    /**
     * Get the layer source.
     * @return {SourceType} The layer source (or `null` if not yet set).
     * @observable
     * @api
     */
    Layer.prototype.getSource = function () {
        return /** @type {SourceType} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_4__["default"].SOURCE)) || null;
    };
    /**
      * @inheritDoc
      */
    Layer.prototype.getSourceState = function () {
        var source = this.getSource();
        return !source ? _source_State_js__WEBPACK_IMPORTED_MODULE_7__["default"].UNDEFINED : source.getState();
    };
    /**
     * @private
     */
    Layer.prototype.handleSourceChange_ = function () {
        this.changed();
    };
    /**
     * @private
     */
    Layer.prototype.handleSourcePropertyChange_ = function () {
        if (this.sourceChangeKey_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["unlistenByKey"])(this.sourceChangeKey_);
            this.sourceChangeKey_ = null;
        }
        var source = this.getSource();
        if (source) {
            this.sourceChangeKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["listen"])(source, _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].CHANGE, this.handleSourceChange_, this);
        }
        this.changed();
    };
    /**
     * @param {import("../pixel").Pixel} pixel Pixel.
     * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with
     * an array of features.
     */
    Layer.prototype.getFeatures = function (pixel) {
        return this.renderer_.getFeatures(pixel);
    };
    /**
     * In charge to manage the rendering of the layer. One layer type is
     * bounded with one layer renderer.
     * @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
     * @param {HTMLElement} target Target which the renderer may (but need not) use
     * for rendering its content.
     * @return {HTMLElement} The rendered element.
     */
    Layer.prototype.render = function (frameState, target) {
        var layerRenderer = this.getRenderer();
        if (layerRenderer.prepareFrame(frameState)) {
            return layerRenderer.renderFrame(frameState, target);
        }
    };
    /**
     * Sets the layer to be rendered on top of other layers on a map. The map will
     * not manage this layer in its layers collection, and the callback in
     * {@link module:ol/Map#forEachLayerAtPixel} will receive `null` as layer. This
     * is useful for temporary layers. To remove an unmanaged layer from the map,
     * use `#setMap(null)`.
     *
     * To add the layer to a map and have it managed by the map, use
     * {@link module:ol/Map#addLayer} instead.
     * @param {import("../PluggableMap.js").default} map Map.
     * @api
     */
    Layer.prototype.setMap = function (map) {
        if (this.mapPrecomposeKey_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["unlistenByKey"])(this.mapPrecomposeKey_);
            this.mapPrecomposeKey_ = null;
        }
        if (!map) {
            this.changed();
        }
        if (this.mapRenderKey_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["unlistenByKey"])(this.mapRenderKey_);
            this.mapRenderKey_ = null;
        }
        if (map) {
            this.mapPrecomposeKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["listen"])(map, _render_EventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].PRECOMPOSE, function (evt) {
                var renderEvent = /** @type {import("../render/Event.js").default} */ (evt);
                var layerStatesArray = renderEvent.frameState.layerStatesArray;
                var layerState = this.getLayerState(false);
                // A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both.
                Object(_asserts_js__WEBPACK_IMPORTED_MODULE_8__["assert"])(!layerStatesArray.some(function (arrayLayerState) {
                    return arrayLayerState.layer === layerState.layer;
                }), 67);
                layerStatesArray.push(layerState);
            }, this);
            this.mapRenderKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_0__["listen"])(this, _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].CHANGE, map.render, map);
            this.changed();
        }
    };
    /**
     * Set the layer source.
     * @param {SourceType} source The layer source.
     * @observable
     * @api
     */
    Layer.prototype.setSource = function (source) {
        this.set(_Property_js__WEBPACK_IMPORTED_MODULE_4__["default"].SOURCE, source);
    };
    /**
     * Get the renderer for this layer.
     * @return {import("../renderer/Layer.js").default} The layer renderer.
     */
    Layer.prototype.getRenderer = function () {
        if (!this.renderer_) {
            this.renderer_ = this.createRenderer();
        }
        return this.renderer_;
    };
    /**
     * @return {boolean} The layer has a renderer.
     */
    Layer.prototype.hasRenderer = function () {
        return !!this.renderer_;
    };
    /**
     * Create a renderer for this layer.
     * @return {import("../renderer/Layer.js").default} A layer renderer.
     * @protected
     */
    Layer.prototype.createRenderer = function () {
        return null;
    };
    /**
     * @inheritDoc
     */
    Layer.prototype.disposeInternal = function () {
        this.setSource(null);
        _super.prototype.disposeInternal.call(this);
    };
    return Layer;
}(_Base_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/**
 * Return `true` if the layer is visible and if the provided view state
 * has resolution and zoom levels that are in range of the layer's min/max.
 * @param {State} layerState Layer state.
 * @param {import("../View.js").State} viewState View state.
 * @return {boolean} The layer is visible at the given view state.
 */
function inView(layerState, viewState) {
    if (!layerState.visible) {
        return false;
    }
    var resolution = viewState.resolution;
    if (resolution < layerState.minResolution || resolution >= layerState.maxResolution) {
        return false;
    }
    var zoom = viewState.zoom;
    return zoom > layerState.minZoom && zoom <= layerState.maxZoom;
}
/* harmony default export */ __webpack_exports__["default"] = (Layer);
//# sourceMappingURL=Layer.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Property.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/layer/Property.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/layer/Property
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    OPACITY: 'opacity',
    VISIBLE: 'visible',
    EXTENT: 'extent',
    Z_INDEX: 'zIndex',
    MAX_RESOLUTION: 'maxResolution',
    MIN_RESOLUTION: 'minResolution',
    MAX_ZOOM: 'maxZoom',
    MIN_ZOOM: 'minZoom',
    SOURCE: 'source'
});
//# sourceMappingURL=Property.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Tile.js":
/*!***************************************!*\
  !*** ./node_modules/ol/layer/Tile.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _BaseTile_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseTile.js */ "./node_modules/ol/layer/BaseTile.js");
/* harmony import */ var _renderer_canvas_TileLayer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderer/canvas/TileLayer.js */ "./node_modules/ol/renderer/canvas/TileLayer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/Tile
 */


/**
 * @classdesc
 * For layer sources that provide pre-rendered, tiled images in grids that are
 * organized by zoom levels for specific resolutions.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @api
 */
var TileLayer = /** @class */ (function (_super) {
    __extends(TileLayer, _super);
    /**
     * @param {import("./BaseTile.js").Options=} opt_options Tile layer options.
     */
    function TileLayer(opt_options) {
        return _super.call(this, opt_options) || this;
    }
    /**
     * Create a renderer for this layer.
     * @return {import("../renderer/Layer.js").default} A layer renderer.
     * @protected
     */
    TileLayer.prototype.createRenderer = function () {
        return new _renderer_canvas_TileLayer_js__WEBPACK_IMPORTED_MODULE_1__["default"](this);
    };
    return TileLayer;
}(_BaseTile_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (TileLayer);
//# sourceMappingURL=Tile.js.map

/***/ }),

/***/ "./node_modules/ol/layer/TileProperty.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/layer/TileProperty.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/layer/TileProperty
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    PRELOAD: 'preload',
    USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError'
});
//# sourceMappingURL=TileProperty.js.map

/***/ }),

/***/ "./node_modules/ol/layer/Vector.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/layer/Vector.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _BaseVector_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseVector.js */ "./node_modules/ol/layer/BaseVector.js");
/* harmony import */ var _renderer_canvas_VectorLayer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../renderer/canvas/VectorLayer.js */ "./node_modules/ol/renderer/canvas/VectorLayer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/Vector
 */


/**
 * @classdesc
 * Vector data that is rendered client-side.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @extends {BaseVectorLayer<import("../source/Vector.js").default>}
 * @api
 */
var VectorLayer = /** @class */ (function (_super) {
    __extends(VectorLayer, _super);
    /**
     * @param {import("./BaseVector.js").Options=} opt_options Options.
     */
    function VectorLayer(opt_options) {
        return _super.call(this, opt_options) || this;
    }
    /**
     * Create a renderer for this layer.
     * @return {import("../renderer/Layer.js").default} A layer renderer.
     * @protected
     */
    VectorLayer.prototype.createRenderer = function () {
        return new _renderer_canvas_VectorLayer_js__WEBPACK_IMPORTED_MODULE_1__["default"](this);
    };
    return VectorLayer;
}(_BaseVector_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (VectorLayer);
//# sourceMappingURL=Vector.js.map

/***/ }),

/***/ "./node_modules/ol/layer/VectorImage.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/layer/VectorImage.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _BaseVector_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BaseVector.js */ "./node_modules/ol/layer/BaseVector.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _renderer_canvas_VectorImageLayer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../renderer/canvas/VectorImageLayer.js */ "./node_modules/ol/renderer/canvas/VectorImageLayer.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/VectorImage
 */



/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {import("../render.js").OrderFunction} [renderOrder] Render order. Function to be used when sorting
 * features before rendering. By default features are drawn in the order that they are created. Use
 * `null` to avoid the sort, but get an undefined draw order.
 * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the
 * renderer when getting features from the vector source for the rendering or hit-detection.
 * Recommended value: the size of the largest symbol, line width or label.
 * @property {import("../source/Vector.js").default} [source] Source.
 * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage
 * this layer in its layers collection, and the layer will be rendered on top. This is useful for
 * temporary layers. The standard way to add a layer to a map and have it managed by the map is to
 * use {@link module:ol/Map#addLayer}.
 * @property {boolean} [declutter=false] Declutter images and text on this layer. The priority is defined
 * by the `zIndex` of the style and the render order of features. Higher z-index means higher priority.
 * Within the same z-index, a feature rendered before another has higher priority.
 * @property {import("../style/Style.js").StyleLike} [style] Layer style. See
 * {@link module:ol/style} for default style which will be used if this is not defined.
 * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will
 * be recreated during animations. This means that no vectors will be shown clipped, but the
 * setting will have a performance impact for large amounts of vector data. When set to `false`,
 * batches will be recreated when no animation is active.
 * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will
 * be recreated during interactions. See also `updateWhileAnimating`.
 * @property {number} [imageRatio=1] Ratio by which the rendered extent should be larger than the
 * viewport extent. A larger ratio avoids cut images during panning, but will cause a decrease in performance.
 */
/**
 * @classdesc
 * Vector data that is rendered client-side.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @api
 */
var VectorImageLayer = /** @class */ (function (_super) {
    __extends(VectorImageLayer, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function VectorImageLayer(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var baseOptions = Object(_obj_js__WEBPACK_IMPORTED_MODULE_1__["assign"])({}, options);
        delete baseOptions.imageRatio;
        _this = _super.call(this, baseOptions) || this;
        /**
         * @type {number}
         * @private
         */
        _this.imageRatio_ = options.imageRatio !== undefined ? options.imageRatio : 1;
        return _this;
    }
    /**
     * @return {number} Ratio between rendered extent size and viewport extent size.
     */
    VectorImageLayer.prototype.getImageRatio = function () {
        return this.imageRatio_;
    };
    /**
     * Create a renderer for this layer.
     * @return {import("../renderer/Layer.js").default} A layer renderer.
     * @protected
     */
    VectorImageLayer.prototype.createRenderer = function () {
        return new _renderer_canvas_VectorImageLayer_js__WEBPACK_IMPORTED_MODULE_2__["default"](this);
    };
    return VectorImageLayer;
}(_BaseVector_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (VectorImageLayer);
//# sourceMappingURL=VectorImage.js.map

/***/ }),

/***/ "./node_modules/ol/layer/VectorTile.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/layer/VectorTile.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _TileProperty_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TileProperty.js */ "./node_modules/ol/layer/TileProperty.js");
/* harmony import */ var _BaseVector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BaseVector.js */ "./node_modules/ol/layer/BaseVector.js");
/* harmony import */ var _VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./VectorTileRenderType.js */ "./node_modules/ol/layer/VectorTileRenderType.js");
/* harmony import */ var _renderer_canvas_VectorTileLayer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../renderer/canvas/VectorTileLayer.js */ "./node_modules/ol/renderer/canvas/VectorTileLayer.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/layer/VectorTile
 */






/**
 * @typedef {Object} Options
 * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
 * @property {number} [opacity=1] Opacity (0, 1).
 * @property {boolean} [visible=true] Visibility.
 * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering.  The layer will not be
 * rendered outside of this extent.
 * @property {number} [zIndex] The z-index for layer rendering.  At rendering time, the layers
 * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed
 * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`
 * method was used.
 * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be
 * visible.
 * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will
 * be visible.
 * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be
 * visible.
 * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will
 * be visible.
 * @property {import("../render.js").OrderFunction} [renderOrder] Render order. Function to be used when sorting
 * features before rendering. By default features are drawn in the order that they are created. Use
 * `null` to avoid the sort, but get an undefined draw order.
 * @property {number} [renderBuffer=100] The buffer in pixels around the tile extent used by the
 * renderer when getting features from the vector tile for the rendering or hit-detection.
 * Recommended value: Vector tiles are usually generated with a buffer, so this value should match
 * the largest possible buffer of the used tiles. It should be at least the size of the largest
 * point symbol or line width.
 * @property {import("./VectorTileRenderType.js").default|string} [renderMode='hybrid'] Render mode for vector tiles:
 *  * `'image'`: Vector tiles are rendered as images. Great performance, but point symbols and texts
 *    are always rotated with the view and pixels are scaled during zoom animations. When `declutter`
 *    is set to `true`, the decluttering is done per tile resulting in labels and point symbols getting
 *    cut off at tile boundaries.
 *  * `'hybrid'`: Polygon and line elements are rendered as images, so pixels are scaled during zoom
 *    animations. Point symbols and texts are accurately rendered as vectors and can stay upright on
 *    rotated views.
 *  * `'vector'`: Everything is rendered as vectors. Use this mode for improved performance on vector
 *    tile layers with only a few rendered features (e.g. for highlighting a subset of features of
 *    another layer with the same source).
 * @property {import("../source/VectorTile.js").default} [source] Source.
 * @property {import("../PluggableMap.js").default} [map] Sets the layer as overlay on a map. The map will not manage
 * this layer in its layers collection, and the layer will be rendered on top. This is useful for
 * temporary layers. The standard way to add a layer to a map and have it managed by the map is to
 * use {@link module:ol/Map#addLayer}.
 * @property {boolean} [declutter=false] Declutter images and text. Decluttering is applied to all
 * image and text styles of all Vector and VectorTile layers that have set this to `true`. The priority
 * is defined by the z-index of the layer, the `zIndex` of the style and the render order of features.
 * Higher z-index means higher priority. Within the same z-index, a feature rendered before another has
 * higher priority.
 * @property {import("../style/Style.js").StyleLike} [style] Layer style. See
 * {@link module:ol/style} for default style which will be used if this is not defined.
 * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will be
 * recreated during animations. This means that no vectors will be shown clipped, but the setting
 * will have a performance impact for large amounts of vector data. When set to `false`, batches
 * will be recreated when no animation is active.
 * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will be
 * recreated during interactions. See also `updateWhileAnimating`.
 * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`
 * means no preloading.
 * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error.
 */
/**
 * @classdesc
 * Layer for vector tile data that is rendered client-side.
 * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
 * property on the layer object; for example, setting `title: 'My Title'` in the
 * options means that `title` is observable, and has get/set accessors.
 *
 * @param {Options=} opt_options Options.
 * @extends {BaseVectorLayer<import("../source/VectorTile.js").default>}
 * @api
 */
var VectorTileLayer = /** @class */ (function (_super) {
    __extends(VectorTileLayer, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function VectorTileLayer(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        var baseOptions = /** @type {Object} */ (Object(_obj_js__WEBPACK_IMPORTED_MODULE_5__["assign"])({}, options));
        delete baseOptions.preload;
        delete baseOptions.useInterimTilesOnError;
        _this = _super.call(this, /** @type {import("./BaseVector.js").Options} */ (baseOptions)) || this;
        var renderMode = options.renderMode || _VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].HYBRID;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(renderMode == undefined ||
            renderMode == _VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].IMAGE ||
            renderMode == _VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].HYBRID ||
            renderMode == _VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].VECTOR, 28); // `renderMode` must be `'image'`, `'hybrid'` or `'vector'`.
        /**
         * @private
         * @type {VectorTileRenderType}
         */
        _this.renderMode_ = renderMode;
        _this.setPreload(options.preload ? options.preload : 0);
        _this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
            options.useInterimTilesOnError : true);
        return _this;
    }
    /**
     * Create a renderer for this layer.
     * @return {import("../renderer/Layer.js").default} A layer renderer.
     * @protected
     */
    VectorTileLayer.prototype.createRenderer = function () {
        return new _renderer_canvas_VectorTileLayer_js__WEBPACK_IMPORTED_MODULE_4__["default"](this);
    };
    /**
     * Get the topmost feature that intersects the given pixel on the viewport. Returns a promise
     * that resolves with an array of features. The array will either contain the topmost feature
     * when a hit was detected, or it will be empty.
     *
     * The hit detection algorithm used for this method is optimized for performance, but is less
     * accurate than the one used in {@link import("../PluggableMap.js").default#getFeaturesAtPixel}: Text
     * is not considered, and icons are only represented by their bounding box instead of the exact
     * image.
     *
     * @param {import("../pixel.js").Pixel} pixel Pixel.
     * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with an array of features.
     * @api
     */
    VectorTileLayer.prototype.getFeatures = function (pixel) {
        return _super.prototype.getFeatures.call(this, pixel);
    };
    /**
     * @return {VectorTileRenderType} The render mode.
     */
    VectorTileLayer.prototype.getRenderMode = function () {
        return this.renderMode_;
    };
    /**
     * Return the level as number to which we will preload tiles up to.
     * @return {number} The level to preload tiles up to.
     * @observable
     * @api
     */
    VectorTileLayer.prototype.getPreload = function () {
        return /** @type {number} */ (this.get(_TileProperty_js__WEBPACK_IMPORTED_MODULE_1__["default"].PRELOAD));
    };
    /**
     * Whether we use interim tiles on error.
     * @return {boolean} Use interim tiles on error.
     * @observable
     * @api
     */
    VectorTileLayer.prototype.getUseInterimTilesOnError = function () {
        return /** @type {boolean} */ (this.get(_TileProperty_js__WEBPACK_IMPORTED_MODULE_1__["default"].USE_INTERIM_TILES_ON_ERROR));
    };
    /**
     * Set the level as number to which we will preload tiles up to.
     * @param {number} preload The level to preload tiles up to.
     * @observable
     * @api
     */
    VectorTileLayer.prototype.setPreload = function (preload) {
        this.set(_TileProperty_js__WEBPACK_IMPORTED_MODULE_1__["default"].PRELOAD, preload);
    };
    /**
     * Set whether we use interim tiles on error.
     * @param {boolean} useInterimTilesOnError Use interim tiles on error.
     * @observable
     * @api
     */
    VectorTileLayer.prototype.setUseInterimTilesOnError = function (useInterimTilesOnError) {
        this.set(_TileProperty_js__WEBPACK_IMPORTED_MODULE_1__["default"].USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
    };
    return VectorTileLayer;
}(_BaseVector_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (VectorTileLayer);
//# sourceMappingURL=VectorTile.js.map

/***/ }),

/***/ "./node_modules/ol/layer/VectorTileRenderType.js":
/*!*******************************************************!*\
  !*** ./node_modules/ol/layer/VectorTileRenderType.js ***!
  \*******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/layer/VectorTileRenderType
 */
/**
 * @enum {string}
 * Render mode for vector tiles:
 *  * `'image'`: Vector tiles are rendered as images. Great performance, but
 *    point symbols and texts are always rotated with the view and pixels are
 *    scaled during zoom animations.
 *  * `'hybrid'`: Polygon and line elements are rendered as images, so pixels
 *    are scaled during zoom animations. Point symbols and texts are accurately
 *    rendered as vectors and can stay upright on rotated views.
 *  * `'vector'`: Everything is rendered as vectors. Use this mode for improved
 *    performance on vector tile layers with only a few rendered features (e.g.
 *    for highlighting a subset of features of another layer with the same
 *    source).
 * @api
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    IMAGE: 'image',
    HYBRID: 'hybrid',
    VECTOR: 'vector'
});
//# sourceMappingURL=VectorTileRenderType.js.map

/***/ }),

/***/ "./node_modules/ol/loadingstrategy.js":
/*!********************************************!*\
  !*** ./node_modules/ol/loadingstrategy.js ***!
  \********************************************/
/*! exports provided: all, bbox, tile */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return all; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bbox", function() { return bbox; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tile", function() { return tile; });
/**
 * @module ol/loadingstrategy
 */
/**
 * Strategy function for loading all features with a single request.
 * @param {import("./extent.js").Extent} extent Extent.
 * @param {number} resolution Resolution.
 * @return {Array<import("./extent.js").Extent>} Extents.
 * @api
 */
function all(extent, resolution) {
    return [[-Infinity, -Infinity, Infinity, Infinity]];
}
/**
 * Strategy function for loading features based on the view's extent and
 * resolution.
 * @param {import("./extent.js").Extent} extent Extent.
 * @param {number} resolution Resolution.
 * @return {Array<import("./extent.js").Extent>} Extents.
 * @api
 */
function bbox(extent, resolution) {
    return [extent];
}
/**
 * Creates a strategy function for loading features based on a tile grid.
 * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
 * @return {function(import("./extent.js").Extent, number): Array<import("./extent.js").Extent>} Loading strategy.
 * @api
 */
function tile(tileGrid) {
    return (
    /**
     * @param {import("./extent.js").Extent} extent Extent.
     * @param {number} resolution Resolution.
     * @return {Array<import("./extent.js").Extent>} Extents.
     */
    function (extent, resolution) {
        var z = tileGrid.getZForResolution(resolution);
        var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);
        /** @type {Array<import("./extent.js").Extent>} */
        var extents = [];
        /** @type {import("./tilecoord.js").TileCoord} */
        var tileCoord = [z, 0, 0];
        for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX; ++tileCoord[1]) {
            for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY; ++tileCoord[2]) {
                extents.push(tileGrid.getTileCoordExtent(tileCoord));
            }
        }
        return extents;
    });
}
//# sourceMappingURL=loadingstrategy.js.map

/***/ }),

/***/ "./node_modules/ol/math.js":
/*!*********************************!*\
  !*** ./node_modules/ol/math.js ***!
  \*********************************/
/*! exports provided: clamp, cosh, squaredSegmentDistance, squaredDistance, solveLinearSystem, toDegrees, toRadians, modulo, lerp */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clamp", function() { return clamp; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cosh", function() { return cosh; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredSegmentDistance", function() { return squaredSegmentDistance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "squaredDistance", function() { return squaredDistance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "solveLinearSystem", function() { return solveLinearSystem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toDegrees", function() { return toDegrees; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRadians", function() { return toRadians; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "modulo", function() { return modulo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lerp", function() { return lerp; });
/**
 * @module ol/math
 */
/**
 * Takes a number and clamps it to within the provided bounds.
 * @param {number} value The input number.
 * @param {number} min The minimum value to return.
 * @param {number} max The maximum value to return.
 * @return {number} The input number if it is within bounds, or the nearest
 *     number within the bounds.
 */
function clamp(value, min, max) {
    return Math.min(Math.max(value, min), max);
}
/**
 * Return the hyperbolic cosine of a given number. The method will use the
 * native `Math.cosh` function if it is available, otherwise the hyperbolic
 * cosine will be calculated via the reference implementation of the Mozilla
 * developer network.
 *
 * @param {number} x X.
 * @return {number} Hyperbolic cosine of x.
 */
var cosh = (function () {
    // Wrapped in a iife, to save the overhead of checking for the native
    // implementation on every invocation.
    var cosh;
    if ('cosh' in Math) {
        // The environment supports the native Math.cosh function, use it…
        cosh = Math.cosh;
    }
    else {
        // … else, use the reference implementation of MDN:
        cosh = function (x) {
            var y = /** @type {Math} */ (Math).exp(x);
            return (y + 1 / y) / 2;
        };
    }
    return cosh;
}());
/**
 * Returns the square of the closest distance between the point (x, y) and the
 * line segment (x1, y1) to (x2, y2).
 * @param {number} x X.
 * @param {number} y Y.
 * @param {number} x1 X1.
 * @param {number} y1 Y1.
 * @param {number} x2 X2.
 * @param {number} y2 Y2.
 * @return {number} Squared distance.
 */
function squaredSegmentDistance(x, y, x1, y1, x2, y2) {
    var dx = x2 - x1;
    var dy = y2 - y1;
    if (dx !== 0 || dy !== 0) {
        var t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);
        if (t > 1) {
            x1 = x2;
            y1 = y2;
        }
        else if (t > 0) {
            x1 += dx * t;
            y1 += dy * t;
        }
    }
    return squaredDistance(x, y, x1, y1);
}
/**
 * Returns the square of the distance between the points (x1, y1) and (x2, y2).
 * @param {number} x1 X1.
 * @param {number} y1 Y1.
 * @param {number} x2 X2.
 * @param {number} y2 Y2.
 * @return {number} Squared distance.
 */
function squaredDistance(x1, y1, x2, y2) {
    var dx = x2 - x1;
    var dy = y2 - y1;
    return dx * dx + dy * dy;
}
/**
 * Solves system of linear equations using Gaussian elimination method.
 *
 * @param {Array<Array<number>>} mat Augmented matrix (n x n + 1 column)
 *                                     in row-major order.
 * @return {Array<number>} The resulting vector.
 */
function solveLinearSystem(mat) {
    var n = mat.length;
    for (var i = 0; i < n; i++) {
        // Find max in the i-th column (ignoring i - 1 first rows)
        var maxRow = i;
        var maxEl = Math.abs(mat[i][i]);
        for (var r = i + 1; r < n; r++) {
            var absValue = Math.abs(mat[r][i]);
            if (absValue > maxEl) {
                maxEl = absValue;
                maxRow = r;
            }
        }
        if (maxEl === 0) {
            return null; // matrix is singular
        }
        // Swap max row with i-th (current) row
        var tmp = mat[maxRow];
        mat[maxRow] = mat[i];
        mat[i] = tmp;
        // Subtract the i-th row to make all the remaining rows 0 in the i-th column
        for (var j = i + 1; j < n; j++) {
            var coef = -mat[j][i] / mat[i][i];
            for (var k = i; k < n + 1; k++) {
                if (i == k) {
                    mat[j][k] = 0;
                }
                else {
                    mat[j][k] += coef * mat[i][k];
                }
            }
        }
    }
    // Solve Ax=b for upper triangular matrix A (mat)
    var x = new Array(n);
    for (var l = n - 1; l >= 0; l--) {
        x[l] = mat[l][n] / mat[l][l];
        for (var m = l - 1; m >= 0; m--) {
            mat[m][n] -= mat[m][l] * x[l];
        }
    }
    return x;
}
/**
 * Converts radians to to degrees.
 *
 * @param {number} angleInRadians Angle in radians.
 * @return {number} Angle in degrees.
 */
function toDegrees(angleInRadians) {
    return angleInRadians * 180 / Math.PI;
}
/**
 * Converts degrees to radians.
 *
 * @param {number} angleInDegrees Angle in degrees.
 * @return {number} Angle in radians.
 */
function toRadians(angleInDegrees) {
    return angleInDegrees * Math.PI / 180;
}
/**
 * Returns the modulo of a / b, depending on the sign of b.
 *
 * @param {number} a Dividend.
 * @param {number} b Divisor.
 * @return {number} Modulo.
 */
function modulo(a, b) {
    var r = a % b;
    return r * b < 0 ? r + b : r;
}
/**
 * Calculates the linearly interpolated value of x between a and b.
 *
 * @param {number} a Number
 * @param {number} b Number
 * @param {number} x Value to be interpolated.
 * @return {number} Interpolated value.
 */
function lerp(a, b, x) {
    return a + x * (b - a);
}
//# sourceMappingURL=math.js.map

/***/ }),

/***/ "./node_modules/ol/net.js":
/*!********************************!*\
  !*** ./node_modules/ol/net.js ***!
  \********************************/
/*! exports provided: jsonp */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsonp", function() { return jsonp; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util.js */ "./node_modules/ol/util.js");
/**
 * @module ol/net
 */

/**
 * Simple JSONP helper. Supports error callbacks and a custom callback param.
 * The error callback will be called when no JSONP is executed after 10 seconds.
 *
 * @param {string} url Request url. A 'callback' query parameter will be
 *     appended.
 * @param {Function} callback Callback on success.
 * @param {function()=} opt_errback Callback on error.
 * @param {string=} opt_callbackParam Custom query parameter for the JSONP
 *     callback. Default is 'callback'.
 */
function jsonp(url, callback, opt_errback, opt_callbackParam) {
    var script = document.createElement('script');
    var key = 'olc_' + Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(callback);
    function cleanup() {
        delete window[key];
        script.parentNode.removeChild(script);
    }
    script.async = true;
    script.src = url + (url.indexOf('?') == -1 ? '?' : '&') +
        (opt_callbackParam || 'callback') + '=' + key;
    var timer = setTimeout(function () {
        cleanup();
        if (opt_errback) {
            opt_errback();
        }
    }, 10000);
    window[key] = function (data) {
        clearTimeout(timer);
        cleanup();
        callback(data);
    };
    document.getElementsByTagName('head')[0].appendChild(script);
}
//# sourceMappingURL=net.js.map

/***/ }),

/***/ "./node_modules/ol/obj.js":
/*!********************************!*\
  !*** ./node_modules/ol/obj.js ***!
  \********************************/
/*! exports provided: assign, clear, getValues, isEmpty */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return assign; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getValues", function() { return getValues; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return isEmpty; });
/**
 * @module ol/obj
 */
/**
 * Polyfill for Object.assign().  Assigns enumerable and own properties from
 * one or more source objects to a target object.
 * See https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign.
 *
 * @param {!Object} target The target object.
 * @param {...Object} var_sources The source object(s).
 * @return {!Object} The modified target object.
 */
var assign = (typeof Object.assign === 'function') ? Object.assign : function (target, var_sources) {
    if (target === undefined || target === null) {
        throw new TypeError('Cannot convert undefined or null to object');
    }
    var output = Object(target);
    for (var i = 1, ii = arguments.length; i < ii; ++i) {
        var source = arguments[i];
        if (source !== undefined && source !== null) {
            for (var key in source) {
                if (source.hasOwnProperty(key)) {
                    output[key] = source[key];
                }
            }
        }
    }
    return output;
};
/**
 * Removes all properties from an object.
 * @param {Object} object The object to clear.
 */
function clear(object) {
    for (var property in object) {
        delete object[property];
    }
}
/**
 * Polyfill for Object.values().  Get an array of property values from an object.
 * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values
 *
 * @param {!Object<K,V>} object The object from which to get the values.
 * @return {!Array<V>} The property values.
 * @template K,V
 */
var getValues = (typeof Object.values === 'function') ? Object.values : function (object) {
    var values = [];
    for (var property in object) {
        values.push(object[property]);
    }
    return values;
};
/**
 * Determine if an object has any properties.
 * @param {Object} object The object to check.
 * @return {boolean} The object is empty.
 */
function isEmpty(object) {
    var property;
    for (property in object) {
        return false;
    }
    return !property;
}
//# sourceMappingURL=obj.js.map

/***/ }),

/***/ "./node_modules/ol/pointer/EventType.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/pointer/EventType.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/pointer/EventType
 */
/**
 * Constants for event names.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    POINTERMOVE: 'pointermove',
    POINTERDOWN: 'pointerdown',
    POINTERUP: 'pointerup',
    POINTEROVER: 'pointerover',
    POINTEROUT: 'pointerout',
    POINTERENTER: 'pointerenter',
    POINTERLEAVE: 'pointerleave',
    POINTERCANCEL: 'pointercancel'
});
//# sourceMappingURL=EventType.js.map

/***/ }),

/***/ "./node_modules/ol/proj.js":
/*!*********************************!*\
  !*** ./node_modules/ol/proj.js ***!
  \*********************************/
/*! exports provided: METERS_PER_UNIT, Projection, cloneTransform, identityTransform, addProjection, addProjections, get, getPointResolution, addEquivalentProjections, addEquivalentTransforms, clearAllProjections, createProjection, createTransformFromCoordinateTransform, addCoordinateTransforms, fromLonLat, toLonLat, equivalent, getTransformFromProjections, getTransform, transform, transformExtent, transformWithProjections, setUserProjection, clearUserProjection, getUserProjection, useGeographic, toUserCoordinate, fromUserCoordinate, toUserExtent, fromUserExtent, addCommon */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneTransform", function() { return cloneTransform; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identityTransform", function() { return identityTransform; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addProjection", function() { return addProjection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addProjections", function() { return addProjections; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPointResolution", function() { return getPointResolution; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEquivalentProjections", function() { return addEquivalentProjections; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEquivalentTransforms", function() { return addEquivalentTransforms; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clearAllProjections", function() { return clearAllProjections; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createProjection", function() { return createProjection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTransformFromCoordinateTransform", function() { return createTransformFromCoordinateTransform; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addCoordinateTransforms", function() { return addCoordinateTransforms; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromLonLat", function() { return fromLonLat; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toLonLat", function() { return toLonLat; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equivalent", function() { return equivalent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTransformFromProjections", function() { return getTransformFromProjections; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTransform", function() { return getTransform; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transform", function() { return transform; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformExtent", function() { return transformExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transformWithProjections", function() { return transformWithProjections; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setUserProjection", function() { return setUserProjection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clearUserProjection", function() { return clearUserProjection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUserProjection", function() { return getUserProjection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useGeographic", function() { return useGeographic; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toUserCoordinate", function() { return toUserCoordinate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromUserCoordinate", function() { return fromUserCoordinate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toUserExtent", function() { return toUserExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromUserExtent", function() { return fromUserExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addCommon", function() { return addCommon; });
/* harmony import */ var _sphere_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sphere.js */ "./node_modules/ol/sphere.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _proj_epsg3857_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proj/epsg3857.js */ "./node_modules/ol/proj/epsg3857.js");
/* harmony import */ var _proj_epsg4326_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./proj/epsg4326.js */ "./node_modules/ol/proj/epsg4326.js");
/* harmony import */ var _proj_Projection_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./proj/Projection.js */ "./node_modules/ol/proj/Projection.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Projection", function() { return _proj_Projection_js__WEBPACK_IMPORTED_MODULE_5__["default"]; });

/* harmony import */ var _proj_Units_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./proj/Units.js */ "./node_modules/ol/proj/Units.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "METERS_PER_UNIT", function() { return _proj_Units_js__WEBPACK_IMPORTED_MODULE_6__["METERS_PER_UNIT"]; });

/* harmony import */ var _proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./proj/transforms.js */ "./node_modules/ol/proj/transforms.js");
/* harmony import */ var _proj_projections_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./proj/projections.js */ "./node_modules/ol/proj/projections.js");
/**
 * @module ol/proj
 */
/**
 * The ol/proj module stores:
 * * a list of {@link module:ol/proj/Projection}
 * objects, one for each projection supported by the application
 * * a list of transform functions needed to convert coordinates in one projection
 * into another.
 *
 * The static functions are the methods used to maintain these.
 * Each transform function can handle not only simple coordinate pairs, but also
 * large arrays of coordinates such as vector geometries.
 *
 * When loaded, the library adds projection objects for EPSG:4326 (WGS84
 * geographic coordinates) and EPSG:3857 (Web or Spherical Mercator, as used
 * for example by Bing Maps or OpenStreetMap), together with the relevant
 * transform functions.
 *
 * Additional transforms may be added by using the http://proj4js.org/
 * library (version 2.2 or later). You can use the full build supplied by
 * Proj4js, or create a custom build to support those projections you need; see
 * the Proj4js website for how to do this. You also need the Proj4js definitions
 * for the required projections. These definitions can be obtained from
 * https://epsg.io/, and are a JS function, so can be loaded in a script
 * tag (as in the examples) or pasted into your application.
 *
 * After all required projection definitions are added to proj4's registry (by
 * using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4`
 * package. Existing transforms are not changed by this function. See
 * examples/wms-image-custom-proj for an example of this.
 *
 * Additional projection definitions can be registered with `proj4.defs()` any
 * time. Just make sure to call `register(proj4)` again; for example, with user-supplied data where you don't
 * know in advance what projections are needed, you can initially load minimal
 * support and then load whichever are requested.
 *
 * Note that Proj4js does not support projection extents. If you want to add
 * one for creating default tile grids, you can add it after the Projection
 * object has been created with `setExtent`, for example,
 * `get('EPSG:1234').setExtent(extent)`.
 *
 * In addition to Proj4js support, any transform functions can be added with
 * {@link module:ol/proj~addCoordinateTransforms}. To use this, you must first create
 * a {@link module:ol/proj/Projection} object for the new projection and add it with
 * {@link module:ol/proj~addProjection}. You can then add the forward and inverse
 * functions with {@link module:ol/proj~addCoordinateTransforms}. See
 * examples/wms-custom-proj for an example of this.
 *
 * Note that if no transforms are needed and you only need to define the
 * projection, just add a {@link module:ol/proj/Projection} with
 * {@link module:ol/proj~addProjection}. See examples/wms-no-proj for an example of
 * this.
 */









/**
 * A projection as {@link module:ol/proj/Projection}, SRS identifier
 * string or undefined.
 * @typedef {Projection|string|undefined} ProjectionLike
 * @api
 */
/**
 * A transform function accepts an array of input coordinate values, an optional
 * output array, and an optional dimension (default should be 2).  The function
 * transforms the input coordinate values, populates the output array, and
 * returns the output array.
 *
 * @typedef {function(Array<number>, Array<number>=, number=): Array<number>} TransformFunction
 * @api
 */


/**
 * @param {Array<number>} input Input coordinate array.
 * @param {Array<number>=} opt_output Output array of coordinate values.
 * @param {number=} opt_dimension Dimension.
 * @return {Array<number>} Output coordinate array (new array, same coordinate
 *     values).
 */
function cloneTransform(input, opt_output, opt_dimension) {
    var output;
    if (opt_output !== undefined) {
        for (var i = 0, ii = input.length; i < ii; ++i) {
            opt_output[i] = input[i];
        }
        output = opt_output;
    }
    else {
        output = input.slice();
    }
    return output;
}
/**
 * @param {Array<number>} input Input coordinate array.
 * @param {Array<number>=} opt_output Output array of coordinate values.
 * @param {number=} opt_dimension Dimension.
 * @return {Array<number>} Input coordinate array (same array as input).
 */
function identityTransform(input, opt_output, opt_dimension) {
    if (opt_output !== undefined && input !== opt_output) {
        for (var i = 0, ii = input.length; i < ii; ++i) {
            opt_output[i] = input[i];
        }
        input = opt_output;
    }
    return input;
}
/**
 * Add a Projection object to the list of supported projections that can be
 * looked up by their code.
 *
 * @param {Projection} projection Projection instance.
 * @api
 */
function addProjection(projection) {
    Object(_proj_projections_js__WEBPACK_IMPORTED_MODULE_8__["add"])(projection.getCode(), projection);
    Object(_proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__["add"])(projection, projection, cloneTransform);
}
/**
 * @param {Array<Projection>} projections Projections.
 */
function addProjections(projections) {
    projections.forEach(addProjection);
}
/**
 * Fetches a Projection object for the code specified.
 *
 * @param {ProjectionLike} projectionLike Either a code string which is
 *     a combination of authority and identifier such as "EPSG:4326", or an
 *     existing projection object, or undefined.
 * @return {Projection} Projection object, or null if not in list.
 * @api
 */
function get(projectionLike) {
    return typeof projectionLike === 'string' ?
        Object(_proj_projections_js__WEBPACK_IMPORTED_MODULE_8__["get"])(/** @type {string} */ (projectionLike)) :
        ( /** @type {Projection} */(projectionLike) || null);
}
/**
 * Get the resolution of the point in degrees or distance units.
 * For projections with degrees as the unit this will simply return the
 * provided resolution. For other projections the point resolution is
 * by default estimated by transforming the 'point' pixel to EPSG:4326,
 * measuring its width and height on the normal sphere,
 * and taking the average of the width and height.
 * A custom function can be provided for a specific projection, either
 * by setting the `getPointResolution` option in the
 * {@link module:ol/proj/Projection~Projection} constructor or by using
 * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing
 * projection object.
 * @param {ProjectionLike} projection The projection.
 * @param {number} resolution Nominal resolution in projection units.
 * @param {import("./coordinate.js").Coordinate} point Point to find adjusted resolution at.
 * @param {Units=} opt_units Units to get the point resolution in.
 * Default is the projection's units.
 * @return {number} Point resolution.
 * @api
 */
function getPointResolution(projection, resolution, point, opt_units) {
    projection = get(projection);
    var pointResolution;
    var getter = projection.getPointResolutionFunc();
    if (getter) {
        pointResolution = getter(resolution, point);
        if (opt_units && opt_units !== projection.getUnits()) {
            var metersPerUnit = projection.getMetersPerUnit();
            if (metersPerUnit) {
                pointResolution = pointResolution * metersPerUnit / _proj_Units_js__WEBPACK_IMPORTED_MODULE_6__["METERS_PER_UNIT"][opt_units];
            }
        }
    }
    else {
        var units = projection.getUnits();
        if (units == _proj_Units_js__WEBPACK_IMPORTED_MODULE_6__["default"].DEGREES && !opt_units || opt_units == _proj_Units_js__WEBPACK_IMPORTED_MODULE_6__["default"].DEGREES) {
            pointResolution = resolution;
        }
        else {
            // Estimate point resolution by transforming the center pixel to EPSG:4326,
            // measuring its width and height on the normal sphere, and taking the
            // average of the width and height.
            var toEPSG4326_1 = getTransformFromProjections(projection, get('EPSG:4326'));
            var vertices = [
                point[0] - resolution / 2, point[1],
                point[0] + resolution / 2, point[1],
                point[0], point[1] - resolution / 2,
                point[0], point[1] + resolution / 2
            ];
            vertices = toEPSG4326_1(vertices, vertices, 2);
            var width = Object(_sphere_js__WEBPACK_IMPORTED_MODULE_0__["getDistance"])(vertices.slice(0, 2), vertices.slice(2, 4));
            var height = Object(_sphere_js__WEBPACK_IMPORTED_MODULE_0__["getDistance"])(vertices.slice(4, 6), vertices.slice(6, 8));
            pointResolution = (width + height) / 2;
            var metersPerUnit = opt_units ?
                _proj_Units_js__WEBPACK_IMPORTED_MODULE_6__["METERS_PER_UNIT"][opt_units] :
                projection.getMetersPerUnit();
            if (metersPerUnit !== undefined) {
                pointResolution /= metersPerUnit;
            }
        }
    }
    return pointResolution;
}
/**
 * Registers transformation functions that don't alter coordinates. Those allow
 * to transform between projections with equal meaning.
 *
 * @param {Array<Projection>} projections Projections.
 * @api
 */
function addEquivalentProjections(projections) {
    addProjections(projections);
    projections.forEach(function (source) {
        projections.forEach(function (destination) {
            if (source !== destination) {
                Object(_proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__["add"])(source, destination, cloneTransform);
            }
        });
    });
}
/**
 * Registers transformation functions to convert coordinates in any projection
 * in projection1 to any projection in projection2.
 *
 * @param {Array<Projection>} projections1 Projections with equal
 *     meaning.
 * @param {Array<Projection>} projections2 Projections with equal
 *     meaning.
 * @param {TransformFunction} forwardTransform Transformation from any
 *   projection in projection1 to any projection in projection2.
 * @param {TransformFunction} inverseTransform Transform from any projection
 *   in projection2 to any projection in projection1..
 */
function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) {
    projections1.forEach(function (projection1) {
        projections2.forEach(function (projection2) {
            Object(_proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__["add"])(projection1, projection2, forwardTransform);
            Object(_proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__["add"])(projection2, projection1, inverseTransform);
        });
    });
}
/**
 * Clear all cached projections and transforms.
 */
function clearAllProjections() {
    Object(_proj_projections_js__WEBPACK_IMPORTED_MODULE_8__["clear"])();
    Object(_proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__["clear"])();
}
/**
 * @param {Projection|string|undefined} projection Projection.
 * @param {string} defaultCode Default code.
 * @return {Projection} Projection.
 */
function createProjection(projection, defaultCode) {
    if (!projection) {
        return get(defaultCode);
    }
    else if (typeof projection === 'string') {
        return get(projection);
    }
    else {
        return (
        /** @type {Projection} */ (projection));
    }
}
/**
 * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform
 * function.
 * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} coordTransform Coordinate
 *     transform.
 * @return {TransformFunction} Transform function.
 */
function createTransformFromCoordinateTransform(coordTransform) {
    return (
    /**
     * @param {Array<number>} input Input.
     * @param {Array<number>=} opt_output Output.
     * @param {number=} opt_dimension Dimension.
     * @return {Array<number>} Output.
     */
    function (input, opt_output, opt_dimension) {
        var length = input.length;
        var dimension = opt_dimension !== undefined ? opt_dimension : 2;
        var output = opt_output !== undefined ? opt_output : new Array(length);
        for (var i = 0; i < length; i += dimension) {
            var point = coordTransform([input[i], input[i + 1]]);
            output[i] = point[0];
            output[i + 1] = point[1];
            for (var j = dimension - 1; j >= 2; --j) {
                output[i + j] = input[i + j];
            }
        }
        return output;
    });
}
/**
 * Registers coordinate transform functions to convert coordinates between the
 * source projection and the destination projection.
 * The forward and inverse functions convert coordinate pairs; this function
 * converts these into the functions used internally which also handle
 * extents and coordinate arrays.
 *
 * @param {ProjectionLike} source Source projection.
 * @param {ProjectionLike} destination Destination projection.
 * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} forward The forward transform
 *     function (that is, from the source projection to the destination
 *     projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns
 *     the transformed {@link module:ol/coordinate~Coordinate}.
 * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} inverse The inverse transform
 *     function (that is, from the destination projection to the source
 *     projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns
 *     the transformed {@link module:ol/coordinate~Coordinate}.
 * @api
 */
function addCoordinateTransforms(source, destination, forward, inverse) {
    var sourceProj = get(source);
    var destProj = get(destination);
    Object(_proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__["add"])(sourceProj, destProj, createTransformFromCoordinateTransform(forward));
    Object(_proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__["add"])(destProj, sourceProj, createTransformFromCoordinateTransform(inverse));
}
/**
 * Transforms a coordinate from longitude/latitude to a different projection.
 * @param {import("./coordinate.js").Coordinate} coordinate Coordinate as longitude and latitude, i.e.
 *     an array with longitude as 1st and latitude as 2nd element.
 * @param {ProjectionLike=} opt_projection Target projection. The
 *     default is Web Mercator, i.e. 'EPSG:3857'.
 * @return {import("./coordinate.js").Coordinate} Coordinate projected to the target projection.
 * @api
 */
function fromLonLat(coordinate, opt_projection) {
    return transform(coordinate, 'EPSG:4326', opt_projection !== undefined ? opt_projection : 'EPSG:3857');
}
/**
 * Transforms a coordinate to longitude/latitude.
 * @param {import("./coordinate.js").Coordinate} coordinate Projected coordinate.
 * @param {ProjectionLike=} opt_projection Projection of the coordinate.
 *     The default is Web Mercator, i.e. 'EPSG:3857'.
 * @return {import("./coordinate.js").Coordinate} Coordinate as longitude and latitude, i.e. an array
 *     with longitude as 1st and latitude as 2nd element.
 * @api
 */
function toLonLat(coordinate, opt_projection) {
    var lonLat = transform(coordinate, opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326');
    var lon = lonLat[0];
    if (lon < -180 || lon > 180) {
        lonLat[0] = Object(_math_js__WEBPACK_IMPORTED_MODULE_2__["modulo"])(lon + 180, 360) - 180;
    }
    return lonLat;
}
/**
 * Checks if two projections are the same, that is every coordinate in one
 * projection does represent the same geographic point as the same coordinate in
 * the other projection.
 *
 * @param {Projection} projection1 Projection 1.
 * @param {Projection} projection2 Projection 2.
 * @return {boolean} Equivalent.
 * @api
 */
function equivalent(projection1, projection2) {
    if (projection1 === projection2) {
        return true;
    }
    var equalUnits = projection1.getUnits() === projection2.getUnits();
    if (projection1.getCode() === projection2.getCode()) {
        return equalUnits;
    }
    else {
        var transformFunc = getTransformFromProjections(projection1, projection2);
        return transformFunc === cloneTransform && equalUnits;
    }
}
/**
 * Searches in the list of transform functions for the function for converting
 * coordinates from the source projection to the destination projection.
 *
 * @param {Projection} sourceProjection Source Projection object.
 * @param {Projection} destinationProjection Destination Projection
 *     object.
 * @return {TransformFunction} Transform function.
 */
function getTransformFromProjections(sourceProjection, destinationProjection) {
    var sourceCode = sourceProjection.getCode();
    var destinationCode = destinationProjection.getCode();
    var transformFunc = Object(_proj_transforms_js__WEBPACK_IMPORTED_MODULE_7__["get"])(sourceCode, destinationCode);
    if (!transformFunc) {
        transformFunc = identityTransform;
    }
    return transformFunc;
}
/**
 * Given the projection-like objects, searches for a transformation
 * function to convert a coordinates array from the source projection to the
 * destination projection.
 *
 * @param {ProjectionLike} source Source.
 * @param {ProjectionLike} destination Destination.
 * @return {TransformFunction} Transform function.
 * @api
 */
function getTransform(source, destination) {
    var sourceProjection = get(source);
    var destinationProjection = get(destination);
    return getTransformFromProjections(sourceProjection, destinationProjection);
}
/**
 * Transforms a coordinate from source projection to destination projection.
 * This returns a new coordinate (and does not modify the original).
 *
 * See {@link module:ol/proj~transformExtent} for extent transformation.
 * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its
 * subclasses for geometry transforms.
 *
 * @param {import("./coordinate.js").Coordinate} coordinate Coordinate.
 * @param {ProjectionLike} source Source projection-like.
 * @param {ProjectionLike} destination Destination projection-like.
 * @return {import("./coordinate.js").Coordinate} Coordinate.
 * @api
 */
function transform(coordinate, source, destination) {
    var transformFunc = getTransform(source, destination);
    return transformFunc(coordinate, undefined, coordinate.length);
}
/**
 * Transforms an extent from source projection to destination projection.  This
 * returns a new extent (and does not modify the original).
 *
 * @param {import("./extent.js").Extent} extent The extent to transform.
 * @param {ProjectionLike} source Source projection-like.
 * @param {ProjectionLike} destination Destination projection-like.
 * @param {number=} opt_stops Number of stops per side used for the transform.
 * By default only the corners are used.
 * @return {import("./extent.js").Extent} The transformed extent.
 * @api
 */
function transformExtent(extent, source, destination, opt_stops) {
    var transformFunc = getTransform(source, destination);
    return Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["applyTransform"])(extent, transformFunc, undefined, opt_stops);
}
/**
 * Transforms the given point to the destination projection.
 *
 * @param {import("./coordinate.js").Coordinate} point Point.
 * @param {Projection} sourceProjection Source projection.
 * @param {Projection} destinationProjection Destination projection.
 * @return {import("./coordinate.js").Coordinate} Point.
 */
function transformWithProjections(point, sourceProjection, destinationProjection) {
    var transformFunc = getTransformFromProjections(sourceProjection, destinationProjection);
    return transformFunc(point);
}
/**
 * @type {?Projection}
 */
var userProjection = null;
/**
 * Set the projection for coordinates supplied from and returned by API methods.
 * Note that this method is not yet a part of the stable API.  Support for user
 * projections is not yet complete and should be considered experimental.
 * @param {ProjectionLike} projection The user projection.
 */
function setUserProjection(projection) {
    userProjection = get(projection);
}
/**
 * Clear the user projection if set.  Note that this method is not yet a part of
 * the stable API.  Support for user projections is not yet complete and should
 * be considered experimental.
 */
function clearUserProjection() {
    userProjection = null;
}
/**
 * Get the projection for coordinates supplied from and returned by API methods.
 * Note that this method is not yet a part of the stable API.  Support for user
 * projections is not yet complete and should be considered experimental.
 * @returns {?Projection} The user projection (or null if not set).
 */
function getUserProjection() {
    return userProjection;
}
/**
 * Use geographic coordinates (WGS-84 datum) in API methods.  Note that this
 * method is not yet a part of the stable API.  Support for user projections is
 * not yet complete and should be considered experimental.
 */
function useGeographic() {
    setUserProjection('EPSG:4326');
}
/**
 * Return a coordinate transformed into the user projection.  If no user projection
 * is set, the original coordinate is returned.
 * @param {Array<number>} coordinate Input coordinate.
 * @param {ProjectionLike} sourceProjection The input coordinate projection.
 * @returns {Array<number>} The input coordinate in the user projection.
 */
function toUserCoordinate(coordinate, sourceProjection) {
    if (!userProjection) {
        return coordinate;
    }
    return transform(coordinate, sourceProjection, userProjection);
}
/**
 * Return a coordinate transformed from the user projection.  If no user projection
 * is set, the original coordinate is returned.
 * @param {Array<number>} coordinate Input coordinate.
 * @param {ProjectionLike} destProjection The destination projection.
 * @returns {Array<number>} The input coordinate transformed.
 */
function fromUserCoordinate(coordinate, destProjection) {
    if (!userProjection) {
        return coordinate;
    }
    return transform(coordinate, userProjection, destProjection);
}
/**
 * Return an extent transformed into the user projection.  If no user projection
 * is set, the original extent is returned.
 * @param {import("./extent.js").Extent} extent Input extent.
 * @param {ProjectionLike} sourceProjection The input extent projection.
 * @returns {import("./extent.js").Extent} The input extent in the user projection.
 */
function toUserExtent(extent, sourceProjection) {
    if (!userProjection) {
        return extent;
    }
    return transformExtent(extent, sourceProjection, userProjection);
}
/**
 * Return an extent transformed from the user projection.  If no user projection
 * is set, the original extent is returned.
 * @param {import("./extent.js").Extent} extent Input extent.
 * @param {ProjectionLike} destProjection The destination projection.
 * @returns {import("./extent.js").Extent} The input extent transformed.
 */
function fromUserExtent(extent, destProjection) {
    if (!userProjection) {
        return extent;
    }
    return transformExtent(extent, userProjection, destProjection);
}
/**
 * Add transforms to and from EPSG:4326 and EPSG:3857.  This function is called
 * by when this module is executed and should only need to be called again after
 * `clearAllProjections()` is called (e.g. in tests).
 */
function addCommon() {
    // Add transformations that don't alter coordinates to convert within set of
    // projections with equal meaning.
    addEquivalentProjections(_proj_epsg3857_js__WEBPACK_IMPORTED_MODULE_3__["PROJECTIONS"]);
    addEquivalentProjections(_proj_epsg4326_js__WEBPACK_IMPORTED_MODULE_4__["PROJECTIONS"]);
    // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like
    // coordinates and back.
    addEquivalentTransforms(_proj_epsg4326_js__WEBPACK_IMPORTED_MODULE_4__["PROJECTIONS"], _proj_epsg3857_js__WEBPACK_IMPORTED_MODULE_3__["PROJECTIONS"], _proj_epsg3857_js__WEBPACK_IMPORTED_MODULE_3__["fromEPSG4326"], _proj_epsg3857_js__WEBPACK_IMPORTED_MODULE_3__["toEPSG4326"]);
}
addCommon();
//# sourceMappingURL=proj.js.map

/***/ }),

/***/ "./node_modules/ol/proj/Projection.js":
/*!********************************************!*\
  !*** ./node_modules/ol/proj/Projection.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Units_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Units.js */ "./node_modules/ol/proj/Units.js");
/**
 * @module ol/proj/Projection
 */

/**
 * @typedef {Object} Options
 * @property {string} code The SRS identifier code, e.g. `EPSG:4326`.
 * @property {import("./Units.js").default|string} [units] Units. Required unless a
 * proj4 projection is defined for `code`.
 * @property {import("../extent.js").Extent} [extent] The validity extent for the SRS.
 * @property {string} [axisOrientation='enu'] The axis orientation as specified in Proj4.
 * @property {boolean} [global=false] Whether the projection is valid for the whole globe.
 * @property {number} [metersPerUnit] The meters per unit for the SRS.
 * If not provided, the `units` are used to get the meters per unit from the {@link module:ol/proj/Units~METERS_PER_UNIT}
 * lookup table.
 * @property {import("../extent.js").Extent} [worldExtent] The world extent for the SRS.
 * @property {function(number, import("../coordinate.js").Coordinate):number} [getPointResolution]
 * Function to determine resolution at a point. The function is called with a
 * `{number}` view resolution and an `{import("../coordinate.js").Coordinate}` as arguments, and returns
 * the `{number}` resolution in projection units at the passed coordinate. If this is `undefined`,
 * the default {@link module:ol/proj#getPointResolution} function will be used.
 */
/**
 * @classdesc
 * Projection definition class. One of these is created for each projection
 * supported in the application and stored in the {@link module:ol/proj} namespace.
 * You can use these in applications, but this is not required, as API params
 * and options use {@link module:ol/proj~ProjectionLike} which means the simple string
 * code will suffice.
 *
 * You can use {@link module:ol/proj~get} to retrieve the object for a particular
 * projection.
 *
 * The library includes definitions for `EPSG:4326` and `EPSG:3857`, together
 * with the following aliases:
 * * `EPSG:4326`: CRS:84, urn:ogc:def:crs:EPSG:6.6:4326,
 *     urn:ogc:def:crs:OGC:1.3:CRS84, urn:ogc:def:crs:OGC:2:84,
 *     http://www.opengis.net/gml/srs/epsg.xml#4326,
 *     urn:x-ogc:def:crs:EPSG:4326
 * * `EPSG:3857`: EPSG:102100, EPSG:102113, EPSG:900913,
 *     urn:ogc:def:crs:EPSG:6.18:3:3857,
 *     http://www.opengis.net/gml/srs/epsg.xml#3857
 *
 * If you use [proj4js](https://github.com/proj4js/proj4js), aliases can
 * be added using `proj4.defs()`. After all required projection definitions are
 * added, call the {@link module:ol/proj/proj4~register} function.
 *
 * @api
 */
var Projection = /** @class */ (function () {
    /**
     * @param {Options} options Projection options.
     */
    function Projection(options) {
        /**
         * @private
         * @type {string}
         */
        this.code_ = options.code;
        /**
         * Units of projected coordinates. When set to `TILE_PIXELS`, a
         * `this.extent_` and `this.worldExtent_` must be configured properly for each
         * tile.
         * @private
         * @type {import("./Units.js").default}
         */
        this.units_ = /** @type {import("./Units.js").default} */ (options.units);
        /**
         * Validity extent of the projection in projected coordinates. For projections
         * with `TILE_PIXELS` units, this is the extent of the tile in
         * tile pixel space.
         * @private
         * @type {import("../extent.js").Extent}
         */
        this.extent_ = options.extent !== undefined ? options.extent : null;
        /**
         * Extent of the world in EPSG:4326. For projections with
         * `TILE_PIXELS` units, this is the extent of the tile in
         * projected coordinate space.
         * @private
         * @type {import("../extent.js").Extent}
         */
        this.worldExtent_ = options.worldExtent !== undefined ?
            options.worldExtent : null;
        /**
         * @private
         * @type {string}
         */
        this.axisOrientation_ = options.axisOrientation !== undefined ?
            options.axisOrientation : 'enu';
        /**
         * @private
         * @type {boolean}
         */
        this.global_ = options.global !== undefined ? options.global : false;
        /**
         * @private
         * @type {boolean}
         */
        this.canWrapX_ = !!(this.global_ && this.extent_);
        /**
         * @private
         * @type {function(number, import("../coordinate.js").Coordinate):number|undefined}
         */
        this.getPointResolutionFunc_ = options.getPointResolution;
        /**
         * @private
         * @type {import("../tilegrid/TileGrid.js").default}
         */
        this.defaultTileGrid_ = null;
        /**
         * @private
         * @type {number|undefined}
         */
        this.metersPerUnit_ = options.metersPerUnit;
    }
    /**
     * @return {boolean} The projection is suitable for wrapping the x-axis
     */
    Projection.prototype.canWrapX = function () {
        return this.canWrapX_;
    };
    /**
     * Get the code for this projection, e.g. 'EPSG:4326'.
     * @return {string} Code.
     * @api
     */
    Projection.prototype.getCode = function () {
        return this.code_;
    };
    /**
     * Get the validity extent for this projection.
     * @return {import("../extent.js").Extent} Extent.
     * @api
     */
    Projection.prototype.getExtent = function () {
        return this.extent_;
    };
    /**
     * Get the units of this projection.
     * @return {import("./Units.js").default} Units.
     * @api
     */
    Projection.prototype.getUnits = function () {
        return this.units_;
    };
    /**
     * Get the amount of meters per unit of this projection.  If the projection is
     * not configured with `metersPerUnit` or a units identifier, the return is
     * `undefined`.
     * @return {number|undefined} Meters.
     * @api
     */
    Projection.prototype.getMetersPerUnit = function () {
        return this.metersPerUnit_ || _Units_js__WEBPACK_IMPORTED_MODULE_0__["METERS_PER_UNIT"][this.units_];
    };
    /**
     * Get the world extent for this projection.
     * @return {import("../extent.js").Extent} Extent.
     * @api
     */
    Projection.prototype.getWorldExtent = function () {
        return this.worldExtent_;
    };
    /**
     * Get the axis orientation of this projection.
     * Example values are:
     * enu - the default easting, northing, elevation.
     * neu - northing, easting, up - useful for "lat/long" geographic coordinates,
     *     or south orientated transverse mercator.
     * wnu - westing, northing, up - some planetary coordinate systems have
     *     "west positive" coordinate systems
     * @return {string} Axis orientation.
     * @api
     */
    Projection.prototype.getAxisOrientation = function () {
        return this.axisOrientation_;
    };
    /**
     * Is this projection a global projection which spans the whole world?
     * @return {boolean} Whether the projection is global.
     * @api
     */
    Projection.prototype.isGlobal = function () {
        return this.global_;
    };
    /**
     * Set if the projection is a global projection which spans the whole world
     * @param {boolean} global Whether the projection is global.
     * @api
     */
    Projection.prototype.setGlobal = function (global) {
        this.global_ = global;
        this.canWrapX_ = !!(global && this.extent_);
    };
    /**
     * @return {import("../tilegrid/TileGrid.js").default} The default tile grid.
     */
    Projection.prototype.getDefaultTileGrid = function () {
        return this.defaultTileGrid_;
    };
    /**
     * @param {import("../tilegrid/TileGrid.js").default} tileGrid The default tile grid.
     */
    Projection.prototype.setDefaultTileGrid = function (tileGrid) {
        this.defaultTileGrid_ = tileGrid;
    };
    /**
     * Set the validity extent for this projection.
     * @param {import("../extent.js").Extent} extent Extent.
     * @api
     */
    Projection.prototype.setExtent = function (extent) {
        this.extent_ = extent;
        this.canWrapX_ = !!(this.global_ && extent);
    };
    /**
     * Set the world extent for this projection.
     * @param {import("../extent.js").Extent} worldExtent World extent
     *     [minlon, minlat, maxlon, maxlat].
     * @api
     */
    Projection.prototype.setWorldExtent = function (worldExtent) {
        this.worldExtent_ = worldExtent;
    };
    /**
     * Set the getPointResolution function (see {@link module:ol/proj~getPointResolution}
     * for this projection.
     * @param {function(number, import("../coordinate.js").Coordinate):number} func Function
     * @api
     */
    Projection.prototype.setGetPointResolution = function (func) {
        this.getPointResolutionFunc_ = func;
    };
    /**
     * Get the custom point resolution function for this projection (if set).
     * @return {function(number, import("../coordinate.js").Coordinate):number|undefined} The custom point
     * resolution function (if set).
     */
    Projection.prototype.getPointResolutionFunc = function () {
        return this.getPointResolutionFunc_;
    };
    return Projection;
}());
/* harmony default export */ __webpack_exports__["default"] = (Projection);
//# sourceMappingURL=Projection.js.map

/***/ }),

/***/ "./node_modules/ol/proj/Units.js":
/*!***************************************!*\
  !*** ./node_modules/ol/proj/Units.js ***!
  \***************************************/
/*! exports provided: METERS_PER_UNIT, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "METERS_PER_UNIT", function() { return METERS_PER_UNIT; });
/**
 * @module ol/proj/Units
 */
/**
 * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or
 * `'us-ft'`.
 * @enum {string}
 */
var Units = {
    DEGREES: 'degrees',
    FEET: 'ft',
    METERS: 'm',
    PIXELS: 'pixels',
    TILE_PIXELS: 'tile-pixels',
    USFEET: 'us-ft'
};
/**
 * Meters per unit lookup table.
 * @const
 * @type {Object<Units, number>}
 * @api
 */
var METERS_PER_UNIT = {};
// use the radius of the Normal sphere
METERS_PER_UNIT[Units.DEGREES] = 2 * Math.PI * 6370997 / 360;
METERS_PER_UNIT[Units.FEET] = 0.3048;
METERS_PER_UNIT[Units.METERS] = 1;
METERS_PER_UNIT[Units.USFEET] = 1200 / 3937;
/* harmony default export */ __webpack_exports__["default"] = (Units);
//# sourceMappingURL=Units.js.map

/***/ }),

/***/ "./node_modules/ol/proj/epsg3857.js":
/*!******************************************!*\
  !*** ./node_modules/ol/proj/epsg3857.js ***!
  \******************************************/
/*! exports provided: RADIUS, HALF_SIZE, EXTENT, WORLD_EXTENT, PROJECTIONS, fromEPSG4326, toEPSG4326 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RADIUS", function() { return RADIUS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HALF_SIZE", function() { return HALF_SIZE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXTENT", function() { return EXTENT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WORLD_EXTENT", function() { return WORLD_EXTENT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PROJECTIONS", function() { return PROJECTIONS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromEPSG4326", function() { return fromEPSG4326; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toEPSG4326", function() { return toEPSG4326; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _Projection_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Projection.js */ "./node_modules/ol/proj/Projection.js");
/* harmony import */ var _Units_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Units.js */ "./node_modules/ol/proj/Units.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/proj/epsg3857
 */



/**
 * Radius of WGS84 sphere
 *
 * @const
 * @type {number}
 */
var RADIUS = 6378137;
/**
 * @const
 * @type {number}
 */
var HALF_SIZE = Math.PI * RADIUS;
/**
 * @const
 * @type {import("../extent.js").Extent}
 */
var EXTENT = [
    -HALF_SIZE, -HALF_SIZE,
    HALF_SIZE, HALF_SIZE
];
/**
 * @const
 * @type {import("../extent.js").Extent}
 */
var WORLD_EXTENT = [-180, -85, 180, 85];
/**
 * @classdesc
 * Projection object for web/spherical Mercator (EPSG:3857).
 */
var EPSG3857Projection = /** @class */ (function (_super) {
    __extends(EPSG3857Projection, _super);
    /**
     * @param {string} code Code.
     */
    function EPSG3857Projection(code) {
        return _super.call(this, {
            code: code,
            units: _Units_js__WEBPACK_IMPORTED_MODULE_2__["default"].METERS,
            extent: EXTENT,
            global: true,
            worldExtent: WORLD_EXTENT,
            getPointResolution: function (resolution, point) {
                return resolution / Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["cosh"])(point[1] / RADIUS);
            }
        }) || this;
    }
    return EPSG3857Projection;
}(_Projection_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * Projections equal to EPSG:3857.
 *
 * @const
 * @type {Array<import("./Projection.js").default>}
 */
var PROJECTIONS = [
    new EPSG3857Projection('EPSG:3857'),
    new EPSG3857Projection('EPSG:102100'),
    new EPSG3857Projection('EPSG:102113'),
    new EPSG3857Projection('EPSG:900913'),
    new EPSG3857Projection('urn:ogc:def:crs:EPSG:6.18:3:3857'),
    new EPSG3857Projection('urn:ogc:def:crs:EPSG::3857'),
    new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857')
];
/**
 * Transformation from EPSG:4326 to EPSG:3857.
 *
 * @param {Array<number>} input Input array of coordinate values.
 * @param {Array<number>=} opt_output Output array of coordinate values.
 * @param {number=} opt_dimension Dimension (default is `2`).
 * @return {Array<number>} Output array of coordinate values.
 */
function fromEPSG4326(input, opt_output, opt_dimension) {
    var length = input.length;
    var dimension = opt_dimension > 1 ? opt_dimension : 2;
    var output = opt_output;
    if (output === undefined) {
        if (dimension > 2) {
            // preserve values beyond second dimension
            output = input.slice();
        }
        else {
            output = new Array(length);
        }
    }
    var halfSize = HALF_SIZE;
    for (var i = 0; i < length; i += dimension) {
        output[i] = halfSize * input[i] / 180;
        var y = RADIUS *
            Math.log(Math.tan(Math.PI * (+input[i + 1] + 90) / 360));
        if (y > halfSize) {
            y = halfSize;
        }
        else if (y < -halfSize) {
            y = -halfSize;
        }
        output[i + 1] = y;
    }
    return output;
}
/**
 * Transformation from EPSG:3857 to EPSG:4326.
 *
 * @param {Array<number>} input Input array of coordinate values.
 * @param {Array<number>=} opt_output Output array of coordinate values.
 * @param {number=} opt_dimension Dimension (default is `2`).
 * @return {Array<number>} Output array of coordinate values.
 */
function toEPSG4326(input, opt_output, opt_dimension) {
    var length = input.length;
    var dimension = opt_dimension > 1 ? opt_dimension : 2;
    var output = opt_output;
    if (output === undefined) {
        if (dimension > 2) {
            // preserve values beyond second dimension
            output = input.slice();
        }
        else {
            output = new Array(length);
        }
    }
    for (var i = 0; i < length; i += dimension) {
        output[i] = 180 * input[i] / HALF_SIZE;
        output[i + 1] = 360 * Math.atan(Math.exp(input[i + 1] / RADIUS)) / Math.PI - 90;
    }
    return output;
}
//# sourceMappingURL=epsg3857.js.map

/***/ }),

/***/ "./node_modules/ol/proj/epsg4326.js":
/*!******************************************!*\
  !*** ./node_modules/ol/proj/epsg4326.js ***!
  \******************************************/
/*! exports provided: RADIUS, EXTENT, METERS_PER_UNIT, PROJECTIONS */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RADIUS", function() { return RADIUS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXTENT", function() { return EXTENT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "METERS_PER_UNIT", function() { return METERS_PER_UNIT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PROJECTIONS", function() { return PROJECTIONS; });
/* harmony import */ var _Projection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Projection.js */ "./node_modules/ol/proj/Projection.js");
/* harmony import */ var _Units_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Units.js */ "./node_modules/ol/proj/Units.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/proj/epsg4326
 */


/**
 * Semi-major radius of the WGS84 ellipsoid.
 *
 * @const
 * @type {number}
 */
var RADIUS = 6378137;
/**
 * Extent of the EPSG:4326 projection which is the whole world.
 *
 * @const
 * @type {import("../extent.js").Extent}
 */
var EXTENT = [-180, -90, 180, 90];
/**
 * @const
 * @type {number}
 */
var METERS_PER_UNIT = Math.PI * RADIUS / 180;
/**
 * @classdesc
 * Projection object for WGS84 geographic coordinates (EPSG:4326).
 *
 * Note that OpenLayers does not strictly comply with the EPSG definition.
 * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x).
 * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates.
 */
var EPSG4326Projection = /** @class */ (function (_super) {
    __extends(EPSG4326Projection, _super);
    /**
     * @param {string} code Code.
     * @param {string=} opt_axisOrientation Axis orientation.
     */
    function EPSG4326Projection(code, opt_axisOrientation) {
        return _super.call(this, {
            code: code,
            units: _Units_js__WEBPACK_IMPORTED_MODULE_1__["default"].DEGREES,
            extent: EXTENT,
            axisOrientation: opt_axisOrientation,
            global: true,
            metersPerUnit: METERS_PER_UNIT,
            worldExtent: EXTENT
        }) || this;
    }
    return EPSG4326Projection;
}(_Projection_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * Projections equal to EPSG:4326.
 *
 * @const
 * @type {Array<import("./Projection.js").default>}
 */
var PROJECTIONS = [
    new EPSG4326Projection('CRS:84'),
    new EPSG4326Projection('EPSG:4326', 'neu'),
    new EPSG4326Projection('urn:ogc:def:crs:EPSG::4326', 'neu'),
    new EPSG4326Projection('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'),
    new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'),
    new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'),
    new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),
    new EPSG4326Projection('urn:x-ogc:def:crs:EPSG:4326', 'neu')
];
//# sourceMappingURL=epsg4326.js.map

/***/ }),

/***/ "./node_modules/ol/proj/proj4.js":
/*!***************************************!*\
  !*** ./node_modules/ol/proj/proj4.js ***!
  \***************************************/
/*! exports provided: register */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "register", function() { return register; });
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _transforms_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transforms.js */ "./node_modules/ol/proj/transforms.js");
/* harmony import */ var _Projection_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Projection.js */ "./node_modules/ol/proj/Projection.js");
/**
 * @module ol/proj/proj4
 */



/**
 * Make projections defined in proj4 (with `proj4.defs()`) available in
 * OpenLayers.
 *
 * This function should be called whenever changes are made to the proj4
 * registry, e.g. after calling `proj4.defs()`. Existing transforms will not be
 * modified by this function.
 *
 * @param {?} proj4 Proj4.
 * @api
 */
function register(proj4) {
    var projCodes = Object.keys(proj4.defs);
    var len = projCodes.length;
    var i, j;
    for (i = 0; i < len; ++i) {
        var code = projCodes[i];
        if (!Object(_proj_js__WEBPACK_IMPORTED_MODULE_0__["get"])(code)) {
            var def = proj4.defs(code);
            Object(_proj_js__WEBPACK_IMPORTED_MODULE_0__["addProjection"])(new _Projection_js__WEBPACK_IMPORTED_MODULE_2__["default"]({
                code: code,
                axisOrientation: def.axis,
                metersPerUnit: def.to_meter,
                units: def.units
            }));
        }
    }
    for (i = 0; i < len; ++i) {
        var code1 = projCodes[i];
        var proj1 = Object(_proj_js__WEBPACK_IMPORTED_MODULE_0__["get"])(code1);
        for (j = 0; j < len; ++j) {
            var code2 = projCodes[j];
            var proj2 = Object(_proj_js__WEBPACK_IMPORTED_MODULE_0__["get"])(code2);
            if (!Object(_transforms_js__WEBPACK_IMPORTED_MODULE_1__["get"])(code1, code2)) {
                if (proj4.defs[code1] === proj4.defs[code2]) {
                    Object(_proj_js__WEBPACK_IMPORTED_MODULE_0__["addEquivalentProjections"])([proj1, proj2]);
                }
                else {
                    var transform = proj4(code1, code2);
                    Object(_proj_js__WEBPACK_IMPORTED_MODULE_0__["addCoordinateTransforms"])(proj1, proj2, transform.forward, transform.inverse);
                }
            }
        }
    }
}
//# sourceMappingURL=proj4.js.map

/***/ }),

/***/ "./node_modules/ol/proj/projections.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/proj/projections.js ***!
  \*********************************************/
/*! exports provided: clear, get, add */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; });
/**
 * @module ol/proj/projections
 */
/**
 * @type {Object<string, import("./Projection.js").default>}
 */
var cache = {};
/**
 * Clear the projections cache.
 */
function clear() {
    cache = {};
}
/**
 * Get a cached projection by code.
 * @param {string} code The code for the projection.
 * @return {import("./Projection.js").default} The projection (if cached).
 */
function get(code) {
    return cache[code] || null;
}
/**
 * Add a projection to the cache.
 * @param {string} code The projection code.
 * @param {import("./Projection.js").default} projection The projection to cache.
 */
function add(code, projection) {
    cache[code] = projection;
}
//# sourceMappingURL=projections.js.map

/***/ }),

/***/ "./node_modules/ol/proj/transforms.js":
/*!********************************************!*\
  !*** ./node_modules/ol/proj/transforms.js ***!
  \********************************************/
/*! exports provided: clear, add, remove, get */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return clear; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "remove", function() { return remove; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; });
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/**
 * @module ol/proj/transforms
 */

/**
 * @private
 * @type {!Object<string, Object<string, import("../proj.js").TransformFunction>>}
 */
var transforms = {};
/**
 * Clear the transform cache.
 */
function clear() {
    transforms = {};
}
/**
 * Registers a conversion function to convert coordinates from the source
 * projection to the destination projection.
 *
 * @param {import("./Projection.js").default} source Source.
 * @param {import("./Projection.js").default} destination Destination.
 * @param {import("../proj.js").TransformFunction} transformFn Transform.
 */
function add(source, destination, transformFn) {
    var sourceCode = source.getCode();
    var destinationCode = destination.getCode();
    if (!(sourceCode in transforms)) {
        transforms[sourceCode] = {};
    }
    transforms[sourceCode][destinationCode] = transformFn;
}
/**
 * Unregisters the conversion function to convert coordinates from the source
 * projection to the destination projection.  This method is used to clean up
 * cached transforms during testing.
 *
 * @param {import("./Projection.js").default} source Source projection.
 * @param {import("./Projection.js").default} destination Destination projection.
 * @return {import("../proj.js").TransformFunction} transformFn The unregistered transform.
 */
function remove(source, destination) {
    var sourceCode = source.getCode();
    var destinationCode = destination.getCode();
    var transform = transforms[sourceCode][destinationCode];
    delete transforms[sourceCode][destinationCode];
    if (Object(_obj_js__WEBPACK_IMPORTED_MODULE_0__["isEmpty"])(transforms[sourceCode])) {
        delete transforms[sourceCode];
    }
    return transform;
}
/**
 * Get a transform given a source code and a destination code.
 * @param {string} sourceCode The code for the source projection.
 * @param {string} destinationCode The code for the destination projection.
 * @return {import("../proj.js").TransformFunction|undefined} The transform function (if found).
 */
function get(sourceCode, destinationCode) {
    var transform;
    if (sourceCode in transforms && destinationCode in transforms[sourceCode]) {
        transform = transforms[sourceCode][destinationCode];
    }
    return transform;
}
//# sourceMappingURL=transforms.js.map

/***/ }),

/***/ "./node_modules/ol/render.js":
/*!***********************************!*\
  !*** ./node_modules/ol/render.js ***!
  \***********************************/
/*! exports provided: toContext, getVectorContext, getRenderPixel, renderDeclutterItems */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toContext", function() { return toContext; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVectorContext", function() { return getVectorContext; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRenderPixel", function() { return getRenderPixel; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderDeclutterItems", function() { return renderDeclutterItems; });
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./has.js */ "./node_modules/ol/has.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _render_canvas_Immediate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./render/canvas/Immediate.js */ "./node_modules/ol/render/canvas/Immediate.js");
/* harmony import */ var _renderer_vector_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./renderer/vector.js */ "./node_modules/ol/renderer/vector.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./proj.js */ "./node_modules/ol/proj.js");
/**
 * @module ol/render
 */





/**
 * @typedef {Object} State
 * @property {CanvasRenderingContext2D} context Canvas context that the layer is being rendered to.
 * @property {import("./Feature.js").FeatureLike} feature
 * @property {import("./geom/SimpleGeometry.js").default} geometry
 * @property {number} pixelRatio Pixel ratio used by the layer renderer.
 * @property {number} resolution Resolution that the render batch was created and optimized for.
 * This is not the view's resolution that is being rendered.
 * @property {number} rotation Rotation of the rendered layer in radians.
 */
/**
 * A function to be used when sorting features before rendering.
 * It takes two instances of {@link module:ol/Feature} or
 * {@link module:ol/render/Feature} and returns a `{number}`.
 *
 * @typedef {function(import("./Feature.js").FeatureLike, import("./Feature.js").FeatureLike):number} OrderFunction
 */
/**
 * @typedef {Object} ToContextOptions
 * @property {import("./size.js").Size} [size] Desired size of the canvas in css
 * pixels. When provided, both canvas and css size will be set according to the
 * `pixelRatio`. If not provided, the current canvas and css sizes will not be
 * altered.
 * @property {number} [pixelRatio=window.devicePixelRatio] Pixel ratio (canvas
 * pixel to css pixel ratio) for the canvas.
 */
/**
 * Binds a Canvas Immediate API to a canvas context, to allow drawing geometries
 * to the context's canvas.
 *
 * The units for geometry coordinates are css pixels relative to the top left
 * corner of the canvas element.
 * ```js
 * import {toContext} from 'ol/render';
 * import Fill from 'ol/style/Fill';
 * import Polygon from 'ol/geom/Polygon';
 *
 * var canvas = document.createElement('canvas');
 * var render = toContext(canvas.getContext('2d'),
 *     { size: [100, 100] });
 * render.setFillStrokeStyle(new Fill({ color: blue }));
 * render.drawPolygon(
 *     new Polygon([[[0, 0], [100, 100], [100, 0], [0, 0]]]));
 * ```
 *
 * @param {CanvasRenderingContext2D} context Canvas context.
 * @param {ToContextOptions=} opt_options Options.
 * @return {CanvasImmediateRenderer} Canvas Immediate.
 * @api
 */
function toContext(context, opt_options) {
    var canvas = context.canvas;
    var options = opt_options ? opt_options : {};
    var pixelRatio = options.pixelRatio || _has_js__WEBPACK_IMPORTED_MODULE_0__["DEVICE_PIXEL_RATIO"];
    var size = options.size;
    if (size) {
        canvas.width = size[0] * pixelRatio;
        canvas.height = size[1] * pixelRatio;
        canvas.style.width = size[0] + 'px';
        canvas.style.height = size[1] + 'px';
    }
    var extent = [0, 0, canvas.width, canvas.height];
    var transform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_1__["scale"])(Object(_transform_js__WEBPACK_IMPORTED_MODULE_1__["create"])(), pixelRatio, pixelRatio);
    return new _render_canvas_Immediate_js__WEBPACK_IMPORTED_MODULE_2__["default"](context, pixelRatio, extent, transform, 0);
}
/**
 * Gets a vector context for drawing to the event's canvas.
 * @param {import("./render/Event.js").default} event Render event.
 * @returns {CanvasImmediateRenderer} Vector context.
 * @api
 */
function getVectorContext(event) {
    var frameState = event.frameState;
    var transform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_1__["multiply"])(event.inversePixelTransform.slice(), frameState.coordinateToPixelTransform);
    var squaredTolerance = Object(_renderer_vector_js__WEBPACK_IMPORTED_MODULE_3__["getSquaredTolerance"])(frameState.viewState.resolution, frameState.pixelRatio);
    var userTransform;
    var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["getUserProjection"])();
    if (userProjection) {
        userTransform = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["getTransformFromProjections"])(userProjection, frameState.viewState.projection);
    }
    return new _render_canvas_Immediate_js__WEBPACK_IMPORTED_MODULE_2__["default"](event.context, frameState.pixelRatio, frameState.extent, transform, frameState.viewState.rotation, squaredTolerance, userTransform);
}
/**
 * Gets the pixel of the event's canvas context from the map viewport's CSS pixel.
 * @param {import("./render/Event.js").default} event Render event.
 * @param {import("./pixel.js").Pixel} pixel CSS pixel relative to the top-left
 * corner of the map viewport.
 * @returns {import("./pixel.js").Pixel} Pixel on the event's canvas context.
 * @api
 */
function getRenderPixel(event, pixel) {
    var result = pixel.slice(0);
    Object(_transform_js__WEBPACK_IMPORTED_MODULE_1__["apply"])(event.inversePixelTransform.slice(), result);
    return result;
}
/**
 * @param {import("./PluggableMap.js").FrameState} frameState Frame state.
 * @param {?} declutterTree Declutter tree.
 * @returns {?} Declutter tree.
 */
function renderDeclutterItems(frameState, declutterTree) {
    if (declutterTree) {
        declutterTree.clear();
    }
    var items = frameState.declutterItems;
    for (var z = items.length - 1; z >= 0; --z) {
        var item = items[z];
        var zIndexItems = item.items;
        for (var i = 0, ii = zIndexItems.length; i < ii; i += 3) {
            declutterTree = zIndexItems[i].renderDeclutter(zIndexItems[i + 1], zIndexItems[i + 2], item.opacity, declutterTree);
        }
    }
    items.length = 0;
    return declutterTree;
}
//# sourceMappingURL=render.js.map

/***/ }),

/***/ "./node_modules/ol/render/Box.js":
/*!***************************************!*\
  !*** ./node_modules/ol/render/Box.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Disposable_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Disposable.js */ "./node_modules/ol/Disposable.js");
/* harmony import */ var _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/**
 * @module ol/render/Box
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();


var RenderBox = /** @class */ (function (_super) {
    __extends(RenderBox, _super);
    /**
     * @param {string} className CSS class name.
     */
    function RenderBox(className) {
        var _this = _super.call(this) || this;
        /**
         * @type {import("../geom/Polygon.js").default}
         * @private
         */
        _this.geometry_ = null;
        /**
         * @type {HTMLDivElement}
         * @private
         */
        _this.element_ = document.createElement('div');
        _this.element_.style.position = 'absolute';
        _this.element_.className = 'ol-box ' + className;
        /**
         * @private
         * @type {import("../PluggableMap.js").default}
         */
        _this.map_ = null;
        /**
         * @private
         * @type {import("../pixel.js").Pixel}
         */
        _this.startPixel_ = null;
        /**
         * @private
         * @type {import("../pixel.js").Pixel}
         */
        _this.endPixel_ = null;
        return _this;
    }
    /**
     * @inheritDoc
     */
    RenderBox.prototype.disposeInternal = function () {
        this.setMap(null);
    };
    /**
     * @private
     */
    RenderBox.prototype.render_ = function () {
        var startPixel = this.startPixel_;
        var endPixel = this.endPixel_;
        var px = 'px';
        var style = this.element_.style;
        style.left = Math.min(startPixel[0], endPixel[0]) + px;
        style.top = Math.min(startPixel[1], endPixel[1]) + px;
        style.width = Math.abs(endPixel[0] - startPixel[0]) + px;
        style.height = Math.abs(endPixel[1] - startPixel[1]) + px;
    };
    /**
     * @param {import("../PluggableMap.js").default} map Map.
     */
    RenderBox.prototype.setMap = function (map) {
        if (this.map_) {
            this.map_.getOverlayContainer().removeChild(this.element_);
            var style = this.element_.style;
            style.left = 'inherit';
            style.top = 'inherit';
            style.width = 'inherit';
            style.height = 'inherit';
        }
        this.map_ = map;
        if (this.map_) {
            this.map_.getOverlayContainer().appendChild(this.element_);
        }
    };
    /**
     * @param {import("../pixel.js").Pixel} startPixel Start pixel.
     * @param {import("../pixel.js").Pixel} endPixel End pixel.
     */
    RenderBox.prototype.setPixels = function (startPixel, endPixel) {
        this.startPixel_ = startPixel;
        this.endPixel_ = endPixel;
        this.createOrUpdateGeometry();
        this.render_();
    };
    /**
     * Creates or updates the cached geometry.
     */
    RenderBox.prototype.createOrUpdateGeometry = function () {
        var startPixel = this.startPixel_;
        var endPixel = this.endPixel_;
        var pixels = [
            startPixel,
            [startPixel[0], endPixel[1]],
            endPixel,
            [endPixel[0], startPixel[1]]
        ];
        var coordinates = pixels.map(this.map_.getCoordinateFromPixelInternal, this.map_);
        // close the polygon
        coordinates[4] = coordinates[0].slice();
        if (!this.geometry_) {
            this.geometry_ = new _geom_Polygon_js__WEBPACK_IMPORTED_MODULE_1__["default"]([coordinates]);
        }
        else {
            this.geometry_.setCoordinates([coordinates]);
        }
    };
    /**
     * @return {import("../geom/Polygon.js").default} Geometry.
     */
    RenderBox.prototype.getGeometry = function () {
        return this.geometry_;
    };
    return RenderBox;
}(_Disposable_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (RenderBox);
//# sourceMappingURL=Box.js.map

/***/ }),

/***/ "./node_modules/ol/render/Event.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/render/Event.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/**
 * @module ol/render/Event
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();

var RenderEvent = /** @class */ (function (_super) {
    __extends(RenderEvent, _super);
    /**
     * @param {import("./EventType.js").default} type Type.
     * @param {import("../transform.js").Transform=} opt_inversePixelTransform Transform for
     *     CSS pixels to rendered pixels.
     * @param {import("../PluggableMap.js").FrameState=} opt_frameState Frame state.
     * @param {?CanvasRenderingContext2D=} opt_context Context.
     */
    function RenderEvent(type, opt_inversePixelTransform, opt_frameState, opt_context) {
        var _this = _super.call(this, type) || this;
        /**
         * Transform from CSS pixels (relative to the top-left corner of the map viewport)
         * to rendered pixels on this event's `context`.
         * @type {import("../transform.js").Transform|undefined}
         * @api
         */
        _this.inversePixelTransform = opt_inversePixelTransform;
        /**
         * An object representing the current render frame state.
         * @type {import("../PluggableMap.js").FrameState|undefined}
         * @api
         */
        _this.frameState = opt_frameState;
        /**
         * Canvas context. Not available when the event is dispatched by the map. Only available
         * when a Canvas renderer is used, null otherwise.
         * @type {CanvasRenderingContext2D|null|undefined}
         * @api
         */
        _this.context = opt_context;
        return _this;
    }
    return RenderEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (RenderEvent);
//# sourceMappingURL=Event.js.map

/***/ }),

/***/ "./node_modules/ol/render/EventType.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/render/EventType.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/render/EventType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Triggered before a layer is rendered.
     * @event module:ol/render/Event~RenderEvent#prerender
     * @api
     */
    PRERENDER: 'prerender',
    /**
     * Triggered after a layer is rendered.
     * @event module:ol/render/Event~RenderEvent#postrender
     * @api
     */
    POSTRENDER: 'postrender',
    /**
     * Triggered before layers are rendered.
     * The event object will not have a `context` set.
     * @event module:ol/render/Event~RenderEvent#precompose
     * @api
     */
    PRECOMPOSE: 'precompose',
    /**
     * Triggered after all layers are rendered.
     * The event object will not have a `context` set.
     * @event module:ol/render/Event~RenderEvent#postcompose
     * @api
     */
    POSTCOMPOSE: 'postcompose',
    /**
     * Triggered when rendering is complete, i.e. all sources and tiles have
     * finished loading for the current viewport, and all tiles are faded in.
     * The event object will not have a `context` set.
     * @event module:ol/render/Event~RenderEvent#rendercomplete
     * @api
     */
    RENDERCOMPLETE: 'rendercomplete'
});
//# sourceMappingURL=EventType.js.map

/***/ }),

/***/ "./node_modules/ol/render/Feature.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/render/Feature.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_flat_center_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geom/flat/center.js */ "./node_modules/ol/geom/flat/center.js");
/* harmony import */ var _geom_flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../geom/flat/interiorpoint.js */ "./node_modules/ol/geom/flat/interiorpoint.js");
/* harmony import */ var _geom_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../geom/flat/interpolate.js */ "./node_modules/ol/geom/flat/interpolate.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/flat/transform.js */ "./node_modules/ol/geom/flat/transform.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../transform.js */ "./node_modules/ol/transform.js");
/**
 * @module ol/render/Feature
 */









/**
 * @type {import("../transform.js").Transform}
 */
var tmpTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["create"])();
/**
 * Lightweight, read-only, {@link module:ol/Feature~Feature} and {@link module:ol/geom/Geometry~Geometry} like
 * structure, optimized for vector tile rendering and styling. Geometry access
 * through the API is limited to getting the type and extent of the geometry.
 */
var RenderFeature = /** @class */ (function () {
    /**
     * @param {GeometryType} type Geometry type.
     * @param {Array<number>} flatCoordinates Flat coordinates. These always need
     *     to be right-handed for polygons.
     * @param {Array<number>|Array<Array<number>>} ends Ends or Endss.
     * @param {Object<string, *>} properties Properties.
     * @param {number|string|undefined} id Feature id.
     */
    function RenderFeature(type, flatCoordinates, ends, properties, id) {
        /**
         * @private
         * @type {import("../extent.js").Extent|undefined}
         */
        this.extent_;
        /**
         * @private
         * @type {number|string|undefined}
         */
        this.id_ = id;
        /**
         * @private
         * @type {GeometryType}
         */
        this.type_ = type;
        /**
         * @private
         * @type {Array<number>}
         */
        this.flatCoordinates_ = flatCoordinates;
        /**
         * @private
         * @type {Array<number>}
         */
        this.flatInteriorPoints_ = null;
        /**
         * @private
         * @type {Array<number>}
         */
        this.flatMidpoints_ = null;
        /**
         * @private
         * @type {Array<number>|Array<Array<number>>}
         */
        this.ends_ = ends;
        /**
         * @private
         * @type {Object<string, *>}
         */
        this.properties_ = properties;
    }
    /**
     * Get a feature property by its key.
     * @param {string} key Key
     * @return {*} Value for the requested key.
     * @api
     */
    RenderFeature.prototype.get = function (key) {
        return this.properties_[key];
    };
    /**
     * Get the extent of this feature's geometry.
     * @return {import("../extent.js").Extent} Extent.
     * @api
     */
    RenderFeature.prototype.getExtent = function () {
        if (!this.extent_) {
            this.extent_ = this.type_ === _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_2__["default"].POINT ?
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createOrUpdateFromCoordinate"])(this.flatCoordinates_) :
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createOrUpdateFromFlatCoordinates"])(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2);
        }
        return this.extent_;
    };
    /**
     * @return {Array<number>} Flat interior points.
     */
    RenderFeature.prototype.getFlatInteriorPoint = function () {
        if (!this.flatInteriorPoints_) {
            var flatCenter = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getCenter"])(this.getExtent());
            this.flatInteriorPoints_ = Object(_geom_flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_4__["getInteriorPointOfArray"])(this.flatCoordinates_, 0, /** @type {Array<number>} */ (this.ends_), 2, flatCenter, 0);
        }
        return this.flatInteriorPoints_;
    };
    /**
     * @return {Array<number>} Flat interior points.
     */
    RenderFeature.prototype.getFlatInteriorPoints = function () {
        if (!this.flatInteriorPoints_) {
            var flatCenters = Object(_geom_flat_center_js__WEBPACK_IMPORTED_MODULE_3__["linearRingss"])(this.flatCoordinates_, 0, /** @type {Array<Array<number>>} */ (this.ends_), 2);
            this.flatInteriorPoints_ = Object(_geom_flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_4__["getInteriorPointsOfMultiArray"])(this.flatCoordinates_, 0, /** @type {Array<Array<number>>} */ (this.ends_), 2, flatCenters);
        }
        return this.flatInteriorPoints_;
    };
    /**
     * @return {Array<number>} Flat midpoint.
     */
    RenderFeature.prototype.getFlatMidpoint = function () {
        if (!this.flatMidpoints_) {
            this.flatMidpoints_ = Object(_geom_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_5__["interpolatePoint"])(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, 0.5);
        }
        return this.flatMidpoints_;
    };
    /**
     * @return {Array<number>} Flat midpoints.
     */
    RenderFeature.prototype.getFlatMidpoints = function () {
        if (!this.flatMidpoints_) {
            this.flatMidpoints_ = [];
            var flatCoordinates = this.flatCoordinates_;
            var offset = 0;
            var ends = /** @type {Array<number>} */ (this.ends_);
            for (var i = 0, ii = ends.length; i < ii; ++i) {
                var end = ends[i];
                var midpoint = Object(_geom_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_5__["interpolatePoint"])(flatCoordinates, offset, end, 2, 0.5);
                Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(this.flatMidpoints_, midpoint);
                offset = end;
            }
        }
        return this.flatMidpoints_;
    };
    /**
     * Get the feature identifier.  This is a stable identifier for the feature and
     * is set when reading data from a remote source.
     * @return {number|string|undefined} Id.
     * @api
     */
    RenderFeature.prototype.getId = function () {
        return this.id_;
    };
    /**
     * @return {Array<number>} Flat coordinates.
     */
    RenderFeature.prototype.getOrientedFlatCoordinates = function () {
        return this.flatCoordinates_;
    };
    /**
     * For API compatibility with {@link module:ol/Feature~Feature}, this method is useful when
     * determining the geometry type in style function (see {@link #getType}).
     * @return {RenderFeature} Feature.
     * @api
     */
    RenderFeature.prototype.getGeometry = function () {
        return this;
    };
    /**
     * @param {number} squaredTolerance Squared tolerance.
     * @return {RenderFeature} Simplified geometry.
     */
    RenderFeature.prototype.getSimplifiedGeometry = function (squaredTolerance) {
        return this;
    };
    /**
     * Get a transformed and simplified version of the geometry.
     * @abstract
     * @param {number} squaredTolerance Squared tolerance.
     * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
     * @return {RenderFeature} Simplified geometry.
     */
    RenderFeature.prototype.simplifyTransformed = function (squaredTolerance, opt_transform) {
        return this;
    };
    /**
     * Get the feature properties.
     * @return {Object<string, *>} Feature properties.
     * @api
     */
    RenderFeature.prototype.getProperties = function () {
        return this.properties_;
    };
    /**
     * @return {number} Stride.
     */
    RenderFeature.prototype.getStride = function () {
        return 2;
    };
    /**
     * @return {undefined}
     */
    RenderFeature.prototype.getStyleFunction = function () {
        return undefined;
    };
    /**
     * Get the type of this feature's geometry.
     * @return {GeometryType} Geometry type.
     * @api
     */
    RenderFeature.prototype.getType = function () {
        return this.type_;
    };
    /**
     * Transform geometry coordinates from tile pixel space to projected.
     * The SRS of the source and destination are expected to be the same.
     *
     * @param {import("../proj.js").ProjectionLike} source The current projection
     * @param {import("../proj.js").ProjectionLike} destination The desired projection.
     */
    RenderFeature.prototype.transform = function (source, destination) {
        source = Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["get"])(source);
        var pixelExtent = source.getExtent();
        var projectedExtent = source.getWorldExtent();
        var scale = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getHeight"])(projectedExtent) / Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getHeight"])(pixelExtent);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["compose"])(tmpTransform, projectedExtent[0], projectedExtent[3], scale, -scale, 0, 0, 0);
        Object(_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_7__["transform2D"])(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, tmpTransform, this.flatCoordinates_);
    };
    return RenderFeature;
}());
/**
 * @return {Array<number>|Array<Array<number>>} Ends or endss.
 */
RenderFeature.prototype.getEnds = function () {
    return this.ends_;
};
RenderFeature.prototype.getEndss = RenderFeature.prototype.getEnds;
/**
 * @return {Array<number>} Flat coordinates.
 */
RenderFeature.prototype.getFlatCoordinates =
    RenderFeature.prototype.getOrientedFlatCoordinates;
/* harmony default export */ __webpack_exports__["default"] = (RenderFeature);
//# sourceMappingURL=Feature.js.map

/***/ }),

/***/ "./node_modules/ol/render/VectorContext.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/render/VectorContext.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/render/VectorContext
 */
/**
 * @classdesc
 * Context for drawing geometries.  A vector context is available on render
 * events and does not need to be constructed directly.
 * @api
 */
var VectorContext = /** @class */ (function () {
    function VectorContext() {
    }
    /**
     * Render a geometry with a custom renderer.
     *
     * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     * @param {Function} renderer Renderer.
     */
    VectorContext.prototype.drawCustom = function (geometry, feature, renderer) { };
    /**
     * Render a geometry.
     *
     * @param {import("../geom/Geometry.js").default} geometry The geometry to render.
     */
    VectorContext.prototype.drawGeometry = function (geometry) { };
    /**
     * Set the rendering style.
     *
     * @param {import("../style/Style.js").default} style The rendering style.
     */
    VectorContext.prototype.setStyle = function (style) { };
    /**
     * @param {import("../geom/Circle.js").default} circleGeometry Circle geometry.
     * @param {import("../Feature.js").default} feature Feature.
     */
    VectorContext.prototype.drawCircle = function (circleGeometry, feature) { };
    /**
     * @param {import("../Feature.js").default} feature Feature.
     * @param {import("../style/Style.js").default} style Style.
     */
    VectorContext.prototype.drawFeature = function (feature, style) { };
    /**
     * @param {import("../geom/GeometryCollection.js").default} geometryCollectionGeometry Geometry collection.
     * @param {import("../Feature.js").default} feature Feature.
     */
    VectorContext.prototype.drawGeometryCollection = function (geometryCollectionGeometry, feature) { };
    /**
     * @param {import("../geom/LineString.js").default|import("./Feature.js").default} lineStringGeometry Line string geometry.
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     */
    VectorContext.prototype.drawLineString = function (lineStringGeometry, feature) { };
    /**
     * @param {import("../geom/MultiLineString.js").default|import("./Feature.js").default} multiLineStringGeometry MultiLineString geometry.
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     */
    VectorContext.prototype.drawMultiLineString = function (multiLineStringGeometry, feature) { };
    /**
     * @param {import("../geom/MultiPoint.js").default|import("./Feature.js").default} multiPointGeometry MultiPoint geometry.
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     */
    VectorContext.prototype.drawMultiPoint = function (multiPointGeometry, feature) { };
    /**
     * @param {import("../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     */
    VectorContext.prototype.drawMultiPolygon = function (multiPolygonGeometry, feature) { };
    /**
     * @param {import("../geom/Point.js").default|import("./Feature.js").default} pointGeometry Point geometry.
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     */
    VectorContext.prototype.drawPoint = function (pointGeometry, feature) { };
    /**
     * @param {import("../geom/Polygon.js").default|import("./Feature.js").default} polygonGeometry Polygon geometry.
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     */
    VectorContext.prototype.drawPolygon = function (polygonGeometry, feature) { };
    /**
     * @param {import("../geom/Geometry.js").default|import("./Feature.js").default} geometry Geometry.
     * @param {import("../Feature.js").FeatureLike} feature Feature.
     */
    VectorContext.prototype.drawText = function (geometry, feature) { };
    /**
     * @param {import("../style/Fill.js").default} fillStyle Fill style.
     * @param {import("../style/Stroke.js").default} strokeStyle Stroke style.
     */
    VectorContext.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) { };
    /**
     * @param {import("../style/Image.js").default} imageStyle Image style.
     * @param {import("./canvas.js").DeclutterGroup=} opt_declutterGroup Declutter.
     */
    VectorContext.prototype.setImageStyle = function (imageStyle, opt_declutterGroup) { };
    /**
     * @param {import("../style/Text.js").default} textStyle Text style.
     * @param {import("./canvas.js").DeclutterGroups=} opt_declutterGroups Declutter.
     */
    VectorContext.prototype.setTextStyle = function (textStyle, opt_declutterGroups) { };
    return VectorContext;
}());
/* harmony default export */ __webpack_exports__["default"] = (VectorContext);
//# sourceMappingURL=VectorContext.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas.js":
/*!******************************************!*\
  !*** ./node_modules/ol/render/canvas.js ***!
  \******************************************/
/*! exports provided: defaultFont, defaultFillStyle, defaultLineCap, defaultLineDash, defaultLineDashOffset, defaultLineJoin, defaultMiterLimit, defaultStrokeStyle, defaultTextAlign, defaultTextBaseline, defaultPadding, defaultLineWidth, checkedFonts, labelCache, textHeights, registerFont, measureTextHeight, measureTextWidth, measureAndCacheTextWidth, measureTextWidths, rotateAtOffset, drawImageOrLabel, createTransformString */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultFont", function() { return defaultFont; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultFillStyle", function() { return defaultFillStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultLineCap", function() { return defaultLineCap; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultLineDash", function() { return defaultLineDash; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultLineDashOffset", function() { return defaultLineDashOffset; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultLineJoin", function() { return defaultLineJoin; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultMiterLimit", function() { return defaultMiterLimit; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultStrokeStyle", function() { return defaultStrokeStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultTextAlign", function() { return defaultTextAlign; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultTextBaseline", function() { return defaultTextBaseline; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultPadding", function() { return defaultPadding; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultLineWidth", function() { return defaultLineWidth; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkedFonts", function() { return checkedFonts; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "labelCache", function() { return labelCache; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "textHeights", function() { return textHeights; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerFont", function() { return registerFont; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "measureTextHeight", function() { return measureTextHeight; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "measureTextWidth", function() { return measureTextWidth; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "measureAndCacheTextWidth", function() { return measureAndCacheTextWidth; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "measureTextWidths", function() { return measureTextWidths; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotateAtOffset", function() { return rotateAtOffset; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "drawImageOrLabel", function() { return drawImageOrLabel; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTransformString", function() { return createTransformString; });
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _events_Target_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/Target.js */ "./node_modules/ol/events/Target.js");
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../has.js */ "./node_modules/ol/has.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../transform.js */ "./node_modules/ol/transform.js");
/**
 * @module ol/render/canvas
 */







/**
 * @typedef {Object} FillState
 * @property {import("../colorlike.js").ColorLike} fillStyle
 */
/**
 * @typedef Label
 * @property {number} width
 * @property {number} height
 * @property {Array<string|number>} contextInstructions
 */
/**
 * @typedef {Object} FillStrokeState
 * @property {import("../colorlike.js").ColorLike} [currentFillStyle]
 * @property {import("../colorlike.js").ColorLike} [currentStrokeStyle]
 * @property {CanvasLineCap} [currentLineCap]
 * @property {Array<number>} currentLineDash
 * @property {number} [currentLineDashOffset]
 * @property {CanvasLineJoin} [currentLineJoin]
 * @property {number} [currentLineWidth]
 * @property {number} [currentMiterLimit]
 * @property {number} [lastStroke]
 * @property {import("../colorlike.js").ColorLike} [fillStyle]
 * @property {import("../colorlike.js").ColorLike} [strokeStyle]
 * @property {CanvasLineCap} [lineCap]
 * @property {Array<number>} lineDash
 * @property {number} [lineDashOffset]
 * @property {CanvasLineJoin} [lineJoin]
 * @property {number} [lineWidth]
 * @property {number} [miterLimit]
 */
/**
 * @typedef {Object} StrokeState
 * @property {CanvasLineCap} lineCap
 * @property {Array<number>} lineDash
 * @property {number} lineDashOffset
 * @property {CanvasLineJoin} lineJoin
 * @property {number} lineWidth
 * @property {number} miterLimit
 * @property {import("../colorlike.js").ColorLike} strokeStyle
 */
/**
 * @typedef {Object} TextState
 * @property {string} font
 * @property {string} [textAlign]
 * @property {string} textBaseline
 * @property {string} [placement]
 * @property {number} [maxAngle]
 * @property {boolean} [overflow]
 * @property {import("../style/Fill.js").default} [backgroundFill]
 * @property {import("../style/Stroke.js").default} [backgroundStroke]
 * @property {number} [scale]
 * @property {Array<number>} [padding]
 */
/**
 * Container for decluttered replay instructions that need to be rendered or
 * omitted together, i.e. when styles render both an image and text, or for the
 * characters that form text along lines. The basic elements of this array are
 * `[minX, minY, maxX, maxY, count]`, where the first four entries are the
 * rendered extent of the group in pixel space. `count` is the number of styles
 * in the group, i.e. 2 when an image and a text are grouped, or 1 otherwise.
 * In addition to these four elements, declutter instruction arrays (i.e. the
 * arguments to {@link module:ol/render/canvas~drawImage} are appended to the array.
 * @typedef {Array<*>} DeclutterGroup
 */
/**
 * Declutter groups for support of multi geometries.
 * @typedef {Array<DeclutterGroup>} DeclutterGroups
 */
/**
 * @const
 * @type {string}
 */
var defaultFont = '10px sans-serif';
/**
 * @const
 * @type {import("../colorlike.js").ColorLike}
 */
var defaultFillStyle = '#000';
/**
 * @const
 * @type {CanvasLineCap}
 */
var defaultLineCap = 'round';
/**
 * @const
 * @type {Array<number>}
 */
var defaultLineDash = [];
/**
 * @const
 * @type {number}
 */
var defaultLineDashOffset = 0;
/**
 * @const
 * @type {CanvasLineJoin}
 */
var defaultLineJoin = 'round';
/**
 * @const
 * @type {number}
 */
var defaultMiterLimit = 10;
/**
 * @const
 * @type {import("../colorlike.js").ColorLike}
 */
var defaultStrokeStyle = '#000';
/**
 * @const
 * @type {string}
 */
var defaultTextAlign = 'center';
/**
 * @const
 * @type {string}
 */
var defaultTextBaseline = 'middle';
/**
 * @const
 * @type {Array<number>}
 */
var defaultPadding = [0, 0, 0, 0];
/**
 * @const
 * @type {number}
 */
var defaultLineWidth = 1;
/**
 * @type {BaseObject}
 */
var checkedFonts = new _Object_js__WEBPACK_IMPORTED_MODULE_3__["default"]();
/**
 * The label cache for text rendering. To change the default cache size of 2048
 * entries, use {@link module:ol/structs/LRUCache#setSize}.
 * Deprecated - there is no label cache any more.
 * @type {?}
 * @api
 * @deprecated
 */
var labelCache = new _events_Target_js__WEBPACK_IMPORTED_MODULE_4__["default"]();
labelCache.setSize = function () {
    console.warn('labelCache is deprecated.'); //eslint-disable-line
};
/**
 * @type {CanvasRenderingContext2D}
 */
var measureContext = null;
/**
 * @type {string}
 */
var measureFont;
/**
 * @type {!Object<string, number>}
 */
var textHeights = {};
/**
 * Clears the label cache when a font becomes available.
 * @param {string} fontSpec CSS font spec.
 */
var registerFont = (function () {
    var retries = 100;
    var size = '32px ';
    var referenceFonts = ['monospace', 'serif'];
    var len = referenceFonts.length;
    var text = 'wmytzilWMYTZIL@#/&?$%10\uF013';
    var interval, referenceWidth;
    /**
     * @param {string} fontStyle Css font-style
     * @param {string} fontWeight Css font-weight
     * @param {*} fontFamily Css font-family
     * @return {boolean} Font with style and weight is available
     */
    function isAvailable(fontStyle, fontWeight, fontFamily) {
        var available = true;
        for (var i = 0; i < len; ++i) {
            var referenceFont = referenceFonts[i];
            referenceWidth = measureTextWidth(fontStyle + ' ' + fontWeight + ' ' + size + referenceFont, text);
            if (fontFamily != referenceFont) {
                var width = measureTextWidth(fontStyle + ' ' + fontWeight + ' ' + size + fontFamily + ',' + referenceFont, text);
                // If width and referenceWidth are the same, then the fallback was used
                // instead of the font we wanted, so the font is not available.
                available = available && width != referenceWidth;
            }
        }
        if (available) {
            return true;
        }
        return false;
    }
    function check() {
        var done = true;
        var fonts = checkedFonts.getKeys();
        for (var i = 0, ii = fonts.length; i < ii; ++i) {
            var font = fonts[i];
            if (checkedFonts.get(font) < retries) {
                if (isAvailable.apply(this, font.split('\n'))) {
                    Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["clear"])(textHeights);
                    // Make sure that loaded fonts are picked up by Safari
                    measureContext = null;
                    measureFont = undefined;
                    checkedFonts.set(font, retries);
                }
                else {
                    checkedFonts.set(font, checkedFonts.get(font) + 1, true);
                    done = false;
                }
            }
        }
        if (done) {
            clearInterval(interval);
            interval = undefined;
        }
    }
    return function (fontSpec) {
        var font = Object(_css_js__WEBPACK_IMPORTED_MODULE_0__["getFontParameters"])(fontSpec);
        if (!font) {
            return;
        }
        var families = font.families;
        for (var i = 0, ii = families.length; i < ii; ++i) {
            var family = families[i];
            var key = font.style + '\n' + font.weight + '\n' + family;
            if (checkedFonts.get(key) === undefined) {
                checkedFonts.set(key, retries, true);
                if (!isAvailable(font.style, font.weight, family)) {
                    checkedFonts.set(key, 0, true);
                    if (interval === undefined) {
                        interval = setInterval(check, 32);
                    }
                }
            }
        }
    };
})();
/**
 * @param {string} font Font to use for measuring.
 * @return {import("../size.js").Size} Measurement.
 */
var measureTextHeight = (function () {
    /**
     * @type {HTMLDivElement}
     */
    var div;
    var heights = textHeights;
    return function (fontSpec) {
        var height = heights[fontSpec];
        if (height == undefined) {
            if (_has_js__WEBPACK_IMPORTED_MODULE_5__["WORKER_OFFSCREEN_CANVAS"]) {
                var font = Object(_css_js__WEBPACK_IMPORTED_MODULE_0__["getFontParameters"])(fontSpec);
                var metrics = measureText(fontSpec, 'Žg');
                var lineHeight = isNaN(Number(font.lineHeight)) ? 1.2 : Number(font.lineHeight);
                textHeights[fontSpec] = lineHeight * (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
            }
            else {
                if (!div) {
                    div = document.createElement('div');
                    div.innerHTML = 'M';
                    div.style.margin = '0 !important';
                    div.style.padding = '0 !important';
                    div.style.position = 'absolute !important';
                    div.style.left = '-99999px !important';
                }
                div.style.font = fontSpec;
                document.body.appendChild(div);
                height = div.offsetHeight;
                heights[fontSpec] = height;
                document.body.removeChild(div);
            }
        }
        return height;
    };
})();
/**
 * @param {string} font Font.
 * @param {string} text Text.
 * @return {TextMetrics} Text metrics.
 */
function measureText(font, text) {
    if (!measureContext) {
        measureContext = Object(_dom_js__WEBPACK_IMPORTED_MODULE_1__["createCanvasContext2D"])(1, 1);
    }
    if (font != measureFont) {
        measureContext.font = font;
        measureFont = measureContext.font;
    }
    return measureContext.measureText(text);
}
/**
 * @param {string} font Font.
 * @param {string} text Text.
 * @return {number} Width.
 */
function measureTextWidth(font, text) {
    return measureText(font, text).width;
}
/**
 * Measure text width using a cache.
 * @param {string} font The font.
 * @param {string} text The text to measure.
 * @param {Object<string, number>} cache A lookup of cached widths by text.
 * @returns {number} The text width.
 */
function measureAndCacheTextWidth(font, text, cache) {
    if (text in cache) {
        return cache[text];
    }
    var width = measureTextWidth(font, text);
    cache[text] = width;
    return width;
}
/**
 * @param {string} font Font to use for measuring.
 * @param {Array<string>} lines Lines to measure.
 * @param {Array<number>} widths Array will be populated with the widths of
 * each line.
 * @return {number} Width of the whole text.
 */
function measureTextWidths(font, lines, widths) {
    var numLines = lines.length;
    var width = 0;
    for (var i = 0; i < numLines; ++i) {
        var currentWidth = measureTextWidth(font, lines[i]);
        width = Math.max(width, currentWidth);
        widths.push(currentWidth);
    }
    return width;
}
/**
 * @param {CanvasRenderingContext2D} context Context.
 * @param {number} rotation Rotation.
 * @param {number} offsetX X offset.
 * @param {number} offsetY Y offset.
 */
function rotateAtOffset(context, rotation, offsetX, offsetY) {
    if (rotation !== 0) {
        context.translate(offsetX, offsetY);
        context.rotate(rotation);
        context.translate(-offsetX, -offsetY);
    }
}
/**
 * @param {CanvasRenderingContext2D} context Context.
 * @param {import("../transform.js").Transform|null} transform Transform.
 * @param {number} opacity Opacity.
 * @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label.
 * @param {number} originX Origin X.
 * @param {number} originY Origin Y.
 * @param {number} w Width.
 * @param {number} h Height.
 * @param {number} x X.
 * @param {number} y Y.
 * @param {number} scale Scale.
 */
function drawImageOrLabel(context, transform, opacity, labelOrImage, originX, originY, w, h, x, y, scale) {
    context.save();
    if (opacity !== 1) {
        context.globalAlpha *= opacity;
    }
    if (transform) {
        context.setTransform.apply(context, transform);
    }
    if (( /** @type {*} */(labelOrImage).contextInstructions)) {
        // label
        context.translate(x, y);
        context.scale(scale, scale);
        executeLabelInstructions(/** @type {Label} */ (labelOrImage), context);
    }
    else {
        // image
        context.drawImage(/** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage), originX, originY, w, h, x, y, w * scale, h * scale);
    }
    context.restore();
}
/**
 * @param {Label} label Label.
 * @param {CanvasRenderingContext2D} context Context.
 */
function executeLabelInstructions(label, context) {
    var contextInstructions = label.contextInstructions;
    for (var i = 0, ii = contextInstructions.length; i < ii; i += 2) {
        if (Array.isArray(contextInstructions[i + 1])) {
            context[contextInstructions[i]].apply(context, contextInstructions[i + 1]);
        }
        else {
            context[contextInstructions[i]] = contextInstructions[i + 1];
        }
    }
}
/**
 * @type {HTMLCanvasElement}
 * @private
 */
var createTransformStringCanvas = null;
/**
 * @param {import("../transform.js").Transform} transform Transform.
 * @return {string} CSS transform.
 */
function createTransformString(transform) {
    if (_has_js__WEBPACK_IMPORTED_MODULE_5__["WORKER_OFFSCREEN_CANVAS"]) {
        return Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["toString"])(transform);
    }
    else {
        if (!createTransformStringCanvas) {
            createTransformStringCanvas = Object(_dom_js__WEBPACK_IMPORTED_MODULE_1__["createCanvasContext2D"])(1, 1).canvas;
        }
        createTransformStringCanvas.style.transform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["toString"])(transform);
        return createTransformStringCanvas.style.transform;
    }
}
//# sourceMappingURL=canvas.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/Builder.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/render/canvas/Builder.js ***!
  \**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _colorlike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../colorlike.js */ "./node_modules/ol/colorlike.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../extent/Relationship.js */ "./node_modules/ol/extent/Relationship.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_flat_inflate_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../geom/flat/inflate.js */ "./node_modules/ol/geom/flat/inflate.js");
/* harmony import */ var _VectorContext_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../VectorContext.js */ "./node_modules/ol/render/VectorContext.js");
/* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/ol/render/canvas.js");
/* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/ol/render/canvas/Instruction.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/render/canvas/Builder
 */









/**
 * @typedef {Object} SerializableInstructions
 * @property {Array<*>} instructions The rendering instructions.
 * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.
 * @property {Array<number>} coordinates The array of all coordinates.
 * @property {!Object<string, import("../canvas.js").TextState>} [textStates] The text states (decluttering).
 * @property {!Object<string, import("../canvas.js").FillState>} [fillStates] The fill states (decluttering).
 * @property {!Object<string, import("../canvas.js").StrokeState>} [strokeStates] The stroke states (decluttering).
 */
var CanvasBuilder = /** @class */ (function (_super) {
    __extends(CanvasBuilder, _super);
    /**
     * @param {number} tolerance Tolerance.
     * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     */
    function CanvasBuilder(tolerance, maxExtent, resolution, pixelRatio) {
        var _this = _super.call(this) || this;
        /**
         * @protected
         * @type {number}
         */
        _this.tolerance = tolerance;
        /**
         * @protected
         * @const
         * @type {import("../../extent.js").Extent}
         */
        _this.maxExtent = maxExtent;
        /**
         * @protected
         * @type {number}
         */
        _this.pixelRatio = pixelRatio;
        /**
         * @protected
         * @type {number}
         */
        _this.maxLineWidth = 0;
        /**
         * @protected
         * @const
         * @type {number}
         */
        _this.resolution = resolution;
        /**
         * @private
         * @type {Array<*>}
         */
        _this.beginGeometryInstruction1_ = null;
        /**
         * @private
         * @type {Array<*>}
         */
        _this.beginGeometryInstruction2_ = null;
        /**
         * @private
         * @type {import("../../extent.js").Extent}
         */
        _this.bufferedMaxExtent_ = null;
        /**
         * @protected
         * @type {Array<*>}
         */
        _this.instructions = [];
        /**
         * @protected
         * @type {Array<number>}
         */
        _this.coordinates = [];
        /**
         * @private
         * @type {import("../../coordinate.js").Coordinate}
         */
        _this.tmpCoordinate_ = [];
        /**
         * @protected
         * @type {Array<*>}
         */
        _this.hitDetectionInstructions = [];
        /**
         * @protected
         * @type {import("../canvas.js").FillStrokeState}
         */
        _this.state = /** @type {import("../canvas.js").FillStrokeState} */ ({});
        return _this;
    }
    /**
     * @protected
     * @param {Array<number>} dashArray Dash array.
     * @return {Array<number>} Dash array with pixel ratio applied
     */
    CanvasBuilder.prototype.applyPixelRatio = function (dashArray) {
        var pixelRatio = this.pixelRatio;
        return pixelRatio == 1 ? dashArray : dashArray.map(function (dash) {
            return dash * pixelRatio;
        });
    };
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {number} end End.
     * @param {number} stride Stride.
     * @param {boolean} closed Last input coordinate equals first.
     * @param {boolean} skipFirst Skip first coordinate.
     * @protected
     * @return {number} My end.
     */
    CanvasBuilder.prototype.appendFlatCoordinates = function (flatCoordinates, offset, end, stride, closed, skipFirst) {
        var myEnd = this.coordinates.length;
        var extent = this.getBufferedMaxExtent();
        if (skipFirst) {
            offset += stride;
        }
        var lastXCoord = flatCoordinates[offset];
        var lastYCoord = flatCoordinates[offset + 1];
        var nextCoord = this.tmpCoordinate_;
        var skipped = true;
        var i, lastRel, nextRel;
        for (i = offset + stride; i < end; i += stride) {
            nextCoord[0] = flatCoordinates[i];
            nextCoord[1] = flatCoordinates[i + 1];
            nextRel = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["coordinateRelationship"])(extent, nextCoord);
            if (nextRel !== lastRel) {
                if (skipped) {
                    this.coordinates[myEnd++] = lastXCoord;
                    this.coordinates[myEnd++] = lastYCoord;
                }
                this.coordinates[myEnd++] = nextCoord[0];
                this.coordinates[myEnd++] = nextCoord[1];
                skipped = false;
            }
            else if (nextRel === _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_3__["default"].INTERSECTING) {
                this.coordinates[myEnd++] = nextCoord[0];
                this.coordinates[myEnd++] = nextCoord[1];
                skipped = false;
            }
            else {
                skipped = true;
            }
            lastXCoord = nextCoord[0];
            lastYCoord = nextCoord[1];
            lastRel = nextRel;
        }
        // Last coordinate equals first or only one point to append:
        if ((closed && skipped) || i === offset + stride) {
            this.coordinates[myEnd++] = lastXCoord;
            this.coordinates[myEnd++] = lastYCoord;
        }
        return myEnd;
    };
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {Array<number>} ends Ends.
     * @param {number} stride Stride.
     * @param {Array<number>} builderEnds Builder ends.
     * @return {number} Offset.
     */
    CanvasBuilder.prototype.drawCustomCoordinates_ = function (flatCoordinates, offset, ends, stride, builderEnds) {
        for (var i = 0, ii = ends.length; i < ii; ++i) {
            var end = ends[i];
            var builderEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false);
            builderEnds.push(builderEnd);
            offset = end;
        }
        return offset;
    };
    /**
     * @inheritDoc.
     */
    CanvasBuilder.prototype.drawCustom = function (geometry, feature, renderer) {
        this.beginGeometry(geometry, feature);
        var type = geometry.getType();
        var stride = geometry.getStride();
        var builderBegin = this.coordinates.length;
        var flatCoordinates, builderEnd, builderEnds, builderEndss;
        var offset;
        if (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].MULTI_POLYGON) {
            geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry);
            flatCoordinates = geometry.getOrientedFlatCoordinates();
            builderEndss = [];
            var endss = geometry.getEndss();
            offset = 0;
            for (var i = 0, ii = endss.length; i < ii; ++i) {
                var myEnds = [];
                offset = this.drawCustomCoordinates_(flatCoordinates, offset, endss[i], stride, myEnds);
                builderEndss.push(myEnds);
            }
            this.instructions.push([_Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].CUSTOM,
                builderBegin, builderEndss, geometry, renderer, _geom_flat_inflate_js__WEBPACK_IMPORTED_MODULE_5__["inflateMultiCoordinatesArray"]]);
        }
        else if (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POLYGON || type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].MULTI_LINE_STRING) {
            builderEnds = [];
            flatCoordinates = (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POLYGON) ?
                /** @type {import("../../geom/Polygon.js").default} */ (geometry).getOrientedFlatCoordinates() :
                geometry.getFlatCoordinates();
            offset = this.drawCustomCoordinates_(flatCoordinates, 0, 
            /** @type {import("../../geom/Polygon.js").default|import("../../geom/MultiLineString.js").default} */ (geometry).getEnds(), stride, builderEnds);
            this.instructions.push([_Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].CUSTOM,
                builderBegin, builderEnds, geometry, renderer, _geom_flat_inflate_js__WEBPACK_IMPORTED_MODULE_5__["inflateCoordinatesArray"]]);
        }
        else if (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].LINE_STRING || type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].MULTI_POINT) {
            flatCoordinates = geometry.getFlatCoordinates();
            builderEnd = this.appendFlatCoordinates(flatCoordinates, 0, flatCoordinates.length, stride, false, false);
            this.instructions.push([_Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].CUSTOM,
                builderBegin, builderEnd, geometry, renderer, _geom_flat_inflate_js__WEBPACK_IMPORTED_MODULE_5__["inflateCoordinates"]]);
        }
        else if (type == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POINT) {
            flatCoordinates = geometry.getFlatCoordinates();
            this.coordinates.push(flatCoordinates[0], flatCoordinates[1]);
            builderEnd = this.coordinates.length;
            this.instructions.push([_Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].CUSTOM,
                builderBegin, builderEnd, geometry, renderer]);
        }
        this.endGeometry(feature);
    };
    /**
     * @protected
     * @param {import("../../geom/Geometry").default|import("../Feature.js").default} geometry The geometry.
     * @param {import("../../Feature.js").FeatureLike} feature Feature.
     */
    CanvasBuilder.prototype.beginGeometry = function (geometry, feature) {
        var extent = geometry.getExtent();
        this.beginGeometryInstruction1_ = [_Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].BEGIN_GEOMETRY, feature, 0, extent];
        this.instructions.push(this.beginGeometryInstruction1_);
        this.beginGeometryInstruction2_ = [_Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].BEGIN_GEOMETRY, feature, 0, extent];
        this.hitDetectionInstructions.push(this.beginGeometryInstruction2_);
    };
    /**
     * @return {SerializableInstructions} the serializable instructions.
     */
    CanvasBuilder.prototype.finish = function () {
        return {
            instructions: this.instructions,
            hitDetectionInstructions: this.hitDetectionInstructions,
            coordinates: this.coordinates
        };
    };
    /**
     * Reverse the hit detection instructions.
     */
    CanvasBuilder.prototype.reverseHitDetectionInstructions = function () {
        var hitDetectionInstructions = this.hitDetectionInstructions;
        // step 1 - reverse array
        hitDetectionInstructions.reverse();
        // step 2 - reverse instructions within geometry blocks
        var i;
        var n = hitDetectionInstructions.length;
        var instruction;
        var type;
        var begin = -1;
        for (i = 0; i < n; ++i) {
            instruction = hitDetectionInstructions[i];
            type = /** @type {CanvasInstruction} */ (instruction[0]);
            if (type == _Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].END_GEOMETRY) {
                begin = i;
            }
            else if (type == _Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].BEGIN_GEOMETRY) {
                instruction[2] = i;
                Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["reverseSubArray"])(this.hitDetectionInstructions, begin, i);
                begin = -1;
            }
        }
    };
    /**
     * @inheritDoc
     */
    CanvasBuilder.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) {
        var state = this.state;
        if (fillStyle) {
            var fillStyleColor = fillStyle.getColor();
            state.fillStyle = Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(fillStyleColor ?
                fillStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultFillStyle"]);
        }
        else {
            state.fillStyle = undefined;
        }
        if (strokeStyle) {
            var strokeStyleColor = strokeStyle.getColor();
            state.strokeStyle = Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(strokeStyleColor ?
                strokeStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultStrokeStyle"]);
            var strokeStyleLineCap = strokeStyle.getLineCap();
            state.lineCap = strokeStyleLineCap !== undefined ?
                strokeStyleLineCap : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineCap"];
            var strokeStyleLineDash = strokeStyle.getLineDash();
            state.lineDash = strokeStyleLineDash ?
                strokeStyleLineDash.slice() : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineDash"];
            var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
            state.lineDashOffset = strokeStyleLineDashOffset ?
                strokeStyleLineDashOffset : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineDashOffset"];
            var strokeStyleLineJoin = strokeStyle.getLineJoin();
            state.lineJoin = strokeStyleLineJoin !== undefined ?
                strokeStyleLineJoin : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineJoin"];
            var strokeStyleWidth = strokeStyle.getWidth();
            state.lineWidth = strokeStyleWidth !== undefined ?
                strokeStyleWidth : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineWidth"];
            var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
            state.miterLimit = strokeStyleMiterLimit !== undefined ?
                strokeStyleMiterLimit : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultMiterLimit"];
            if (state.lineWidth > this.maxLineWidth) {
                this.maxLineWidth = state.lineWidth;
                // invalidate the buffered max extent cache
                this.bufferedMaxExtent_ = null;
            }
        }
        else {
            state.strokeStyle = undefined;
            state.lineCap = undefined;
            state.lineDash = null;
            state.lineDashOffset = undefined;
            state.lineJoin = undefined;
            state.lineWidth = undefined;
            state.miterLimit = undefined;
        }
    };
    /**
     * @param {import("../canvas.js").FillStrokeState} state State.
     * @return {Array<*>} Fill instruction.
     */
    CanvasBuilder.prototype.createFill = function (state) {
        var fillStyle = state.fillStyle;
        /** @type {Array<*>} */
        var fillInstruction = [_Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].SET_FILL_STYLE, fillStyle];
        if (typeof fillStyle !== 'string') {
            // Fill is a pattern or gradient - align it!
            fillInstruction.push(true);
        }
        return fillInstruction;
    };
    /**
     * @param {import("../canvas.js").FillStrokeState} state State.
     */
    CanvasBuilder.prototype.applyStroke = function (state) {
        this.instructions.push(this.createStroke(state));
    };
    /**
     * @param {import("../canvas.js").FillStrokeState} state State.
     * @return {Array<*>} Stroke instruction.
     */
    CanvasBuilder.prototype.createStroke = function (state) {
        return [
            _Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].SET_STROKE_STYLE,
            state.strokeStyle, state.lineWidth * this.pixelRatio, state.lineCap,
            state.lineJoin, state.miterLimit,
            this.applyPixelRatio(state.lineDash), state.lineDashOffset * this.pixelRatio
        ];
    };
    /**
     * @param {import("../canvas.js").FillStrokeState} state State.
     * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState):Array<*>} createFill Create fill.
     */
    CanvasBuilder.prototype.updateFillStyle = function (state, createFill) {
        var fillStyle = state.fillStyle;
        if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {
            if (fillStyle !== undefined) {
                this.instructions.push(createFill.call(this, state));
            }
            state.currentFillStyle = fillStyle;
        }
    };
    /**
     * @param {import("../canvas.js").FillStrokeState} state State.
     * @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState): void} applyStroke Apply stroke.
     */
    CanvasBuilder.prototype.updateStrokeStyle = function (state, applyStroke) {
        var strokeStyle = state.strokeStyle;
        var lineCap = state.lineCap;
        var lineDash = state.lineDash;
        var lineDashOffset = state.lineDashOffset;
        var lineJoin = state.lineJoin;
        var lineWidth = state.lineWidth;
        var miterLimit = state.miterLimit;
        if (state.currentStrokeStyle != strokeStyle ||
            state.currentLineCap != lineCap ||
            (lineDash != state.currentLineDash && !Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["equals"])(state.currentLineDash, lineDash)) ||
            state.currentLineDashOffset != lineDashOffset ||
            state.currentLineJoin != lineJoin ||
            state.currentLineWidth != lineWidth ||
            state.currentMiterLimit != miterLimit) {
            if (strokeStyle !== undefined) {
                applyStroke.call(this, state);
            }
            state.currentStrokeStyle = strokeStyle;
            state.currentLineCap = lineCap;
            state.currentLineDash = lineDash;
            state.currentLineDashOffset = lineDashOffset;
            state.currentLineJoin = lineJoin;
            state.currentLineWidth = lineWidth;
            state.currentMiterLimit = miterLimit;
        }
    };
    /**
     * @param {import("../../Feature.js").FeatureLike} feature Feature.
     */
    CanvasBuilder.prototype.endGeometry = function (feature) {
        this.beginGeometryInstruction1_[2] = this.instructions.length;
        this.beginGeometryInstruction1_ = null;
        this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
        this.beginGeometryInstruction2_ = null;
        var endGeometryInstruction = [_Instruction_js__WEBPACK_IMPORTED_MODULE_8__["default"].END_GEOMETRY, feature];
        this.instructions.push(endGeometryInstruction);
        this.hitDetectionInstructions.push(endGeometryInstruction);
    };
    /**
     * Get the buffered rendering extent.  Rendering will be clipped to the extent
     * provided to the constructor.  To account for symbolizers that may intersect
     * this extent, we calculate a buffered extent (e.g. based on stroke width).
     * @return {import("../../extent.js").Extent} The buffered rendering extent.
     * @protected
     */
    CanvasBuilder.prototype.getBufferedMaxExtent = function () {
        if (!this.bufferedMaxExtent_) {
            this.bufferedMaxExtent_ = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["clone"])(this.maxExtent);
            if (this.maxLineWidth > 0) {
                var width = this.resolution * (this.maxLineWidth + 1) / 2;
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["buffer"])(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_);
            }
        }
        return this.bufferedMaxExtent_;
    };
    return CanvasBuilder;
}(_VectorContext_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasBuilder);
//# sourceMappingURL=Builder.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/BuilderGroup.js":
/*!*******************************************************!*\
  !*** ./node_modules/ol/render/canvas/BuilderGroup.js ***!
  \*******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Builder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Builder.js */ "./node_modules/ol/render/canvas/Builder.js");
/* harmony import */ var _ImageBuilder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ImageBuilder.js */ "./node_modules/ol/render/canvas/ImageBuilder.js");
/* harmony import */ var _LineStringBuilder_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LineStringBuilder.js */ "./node_modules/ol/render/canvas/LineStringBuilder.js");
/* harmony import */ var _PolygonBuilder_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PolygonBuilder.js */ "./node_modules/ol/render/canvas/PolygonBuilder.js");
/* harmony import */ var _TextBuilder_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TextBuilder.js */ "./node_modules/ol/render/canvas/TextBuilder.js");
/**
 * @module ol/render/canvas/BuilderGroup
 */






/**
 * @type {Object<import("./BuilderType").default, typeof Builder>}
 */
var BATCH_CONSTRUCTORS = {
    'Circle': _PolygonBuilder_js__WEBPACK_IMPORTED_MODULE_4__["default"],
    'Default': _Builder_js__WEBPACK_IMPORTED_MODULE_1__["default"],
    'Image': _ImageBuilder_js__WEBPACK_IMPORTED_MODULE_2__["default"],
    'LineString': _LineStringBuilder_js__WEBPACK_IMPORTED_MODULE_3__["default"],
    'Polygon': _PolygonBuilder_js__WEBPACK_IMPORTED_MODULE_4__["default"],
    'Text': _TextBuilder_js__WEBPACK_IMPORTED_MODULE_5__["default"]
};
var BuilderGroup = /** @class */ (function () {
    /**
     * @param {number} tolerance Tolerance.
     * @param {import("../../extent.js").Extent} maxExtent Max extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {boolean} declutter Decluttering enabled.
     */
    function BuilderGroup(tolerance, maxExtent, resolution, pixelRatio, declutter) {
        /**
         * @type {boolean}
         * @private
         */
        this.declutter_ = declutter;
        /**
         * @type {import("../canvas.js").DeclutterGroups}
         * @private
         */
        this.declutterGroups_ = null;
        /**
         * @private
         * @type {number}
         */
        this.tolerance_ = tolerance;
        /**
         * @private
         * @type {import("../../extent.js").Extent}
         */
        this.maxExtent_ = maxExtent;
        /**
         * @private
         * @type {number}
         */
        this.pixelRatio_ = pixelRatio;
        /**
         * @private
         * @type {number}
         */
        this.resolution_ = resolution;
        /**
         * @private
         * @type {!Object<string, !Object<import("./BuilderType").default, Builder>>}
         */
        this.buildersByZIndex_ = {};
    }
    /**
     * @param {boolean} group Group with previous builder.
     * @return {import("../canvas").DeclutterGroups} The resulting instruction groups.
     */
    BuilderGroup.prototype.addDeclutter = function (group) {
        var declutter = null;
        if (this.declutter_) {
            if (group) {
                declutter = this.declutterGroups_;
                /** @type {number} */ (declutter[0][4])++;
            }
            else {
                declutter = [Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createEmpty"])()];
                this.declutterGroups_ = declutter;
                declutter[0].push(1);
            }
        }
        return declutter;
    };
    /**
     * @return {!Object<string, !Object<import("./BuilderType").default, import("./Builder.js").SerializableInstructions>>} The serializable instructions
     */
    BuilderGroup.prototype.finish = function () {
        var builderInstructions = {};
        for (var zKey in this.buildersByZIndex_) {
            builderInstructions[zKey] = builderInstructions[zKey] || {};
            var builders = this.buildersByZIndex_[zKey];
            for (var builderKey in builders) {
                var builderInstruction = builders[builderKey].finish();
                builderInstructions[zKey][builderKey] = builderInstruction;
            }
        }
        return builderInstructions;
    };
    /**
     * @param {number|undefined} zIndex Z index.
     * @param {import("./BuilderType.js").default} builderType Replay type.
     * @return {import("../VectorContext.js").default} Replay.
     */
    BuilderGroup.prototype.getBuilder = function (zIndex, builderType) {
        var zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
        var replays = this.buildersByZIndex_[zIndexKey];
        if (replays === undefined) {
            replays = {};
            this.buildersByZIndex_[zIndexKey] = replays;
        }
        var replay = replays[builderType];
        if (replay === undefined) {
            var Constructor = BATCH_CONSTRUCTORS[builderType];
            replay = new Constructor(this.tolerance_, this.maxExtent_, this.resolution_, this.pixelRatio_);
            replays[builderType] = replay;
        }
        return replay;
    };
    return BuilderGroup;
}());
/* harmony default export */ __webpack_exports__["default"] = (BuilderGroup);
//# sourceMappingURL=BuilderGroup.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/BuilderType.js":
/*!******************************************************!*\
  !*** ./node_modules/ol/render/canvas/BuilderType.js ***!
  \******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/render/canvas/BuilderType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    CIRCLE: 'Circle',
    DEFAULT: 'Default',
    IMAGE: 'Image',
    LINE_STRING: 'LineString',
    POLYGON: 'Polygon',
    TEXT: 'Text'
});
//# sourceMappingURL=BuilderType.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/Executor.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/render/canvas/Executor.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_flat_length_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../geom/flat/length.js */ "./node_modules/ol/geom/flat/length.js");
/* harmony import */ var _geom_flat_textpath_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../geom/flat/textpath.js */ "./node_modules/ol/geom/flat/textpath.js");
/* harmony import */ var _geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../geom/flat/transform.js */ "./node_modules/ol/geom/flat/transform.js");
/* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/ol/render/canvas.js");
/* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/ol/render/canvas/Instruction.js");
/* harmony import */ var _TextBuilder_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TextBuilder.js */ "./node_modules/ol/render/canvas/TextBuilder.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var rbush_rbush_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! rbush/rbush.js */ "./node_modules/rbush/rbush.js");
/* harmony import */ var rbush_rbush_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(rbush_rbush_js__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../has.js */ "./node_modules/ol/has.js");
/**
 * @module ol/render/canvas/Executor
 */












/**
 * @typedef {Object} SerializableInstructions
 * @property {Array<*>} instructions The rendering instructions.
 * @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.
 * @property {Array<number>} coordinates The array of all coordinates.
 * @property {!Object<string, import("../canvas.js").TextState>} textStates The text states (decluttering).
 * @property {!Object<string, import("../canvas.js").FillState>} fillStates The fill states (decluttering).
 * @property {!Object<string, import("../canvas.js").StrokeState>} strokeStates The stroke states (decluttering).
 */
/**
 * @type {import("../../extent.js").Extent}
 */
var tmpExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createEmpty"])();
/**
 * @type {!import("../../transform.js").Transform}
 */
var tmpTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["create"])();
/** @type {import("../../coordinate.js").Coordinate} */
var p1 = [];
/** @type {import("../../coordinate.js").Coordinate} */
var p2 = [];
/** @type {import("../../coordinate.js").Coordinate} */
var p3 = [];
/** @type {import("../../coordinate.js").Coordinate} */
var p4 = [];
var Executor = /** @class */ (function () {
    /**
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {boolean} overlaps The replay can have overlapping geometries.
     * @param {SerializableInstructions} instructions The serializable instructions
     */
    function Executor(resolution, pixelRatio, overlaps, instructions) {
        /**
         * @protected
         * @type {boolean}
         */
        this.overlaps = overlaps;
        /**
         * @protected
         * @type {number}
         */
        this.pixelRatio = pixelRatio;
        /**
         * @protected
         * @const
         * @type {number}
         */
        this.resolution = resolution;
        /**
         * @private
         * @type {boolean}
         */
        this.alignFill_;
        /**
         * @type {Array<*>}
         */
        this.declutterItems = [];
        /**
         * @protected
         * @type {Array<*>}
         */
        this.instructions = instructions.instructions;
        /**
         * @protected
         * @type {Array<number>}
         */
        this.coordinates = instructions.coordinates;
        /**
         * @private
         * @type {!Object<number,import("../../coordinate.js").Coordinate|Array<import("../../coordinate.js").Coordinate>|Array<Array<import("../../coordinate.js").Coordinate>>>}
         */
        this.coordinateCache_ = {};
        /**
         * @private
         * @type {!import("../../transform.js").Transform}
         */
        this.renderedTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["create"])();
        /**
         * @protected
         * @type {Array<*>}
         */
        this.hitDetectionInstructions = instructions.hitDetectionInstructions;
        /**
         * @private
         * @type {Array<number>}
         */
        this.pixelCoordinates_ = null;
        /**
         * @private
         * @type {number}
         */
        this.viewRotation_ = 0;
        /**
         * @type {!Object<string, import("../canvas.js").FillState>}
         */
        this.fillStates = instructions.fillStates || {};
        /**
         * @type {!Object<string, import("../canvas.js").StrokeState>}
         */
        this.strokeStates = instructions.strokeStates || {};
        /**
         * @type {!Object<string, import("../canvas.js").TextState>}
         */
        this.textStates = instructions.textStates || {};
        /**
         * @private
         * @type {Object<string, Object<string, number>>}
         */
        this.widths_ = {};
        /**
         * @private
         * @type {Object<string, import("../canvas.js").Label>}
         */
        this.labels_ = {};
    }
    /**
     * @param {string} text Text.
     * @param {string} textKey Text style key.
     * @param {string} fillKey Fill style key.
     * @param {string} strokeKey Stroke style key.
     * @return {import("../canvas.js").Label} Label.
     */
    Executor.prototype.createLabel = function (text, textKey, fillKey, strokeKey) {
        var key = text + textKey + fillKey + strokeKey;
        if (this.labels_[key]) {
            return this.labels_[key];
        }
        var strokeState = strokeKey ? this.strokeStates[strokeKey] : null;
        var fillState = fillKey ? this.fillStates[fillKey] : null;
        var textState = this.textStates[textKey];
        var pixelRatio = this.pixelRatio;
        var scale = textState.scale * pixelRatio;
        var align = _TextBuilder_js__WEBPACK_IMPORTED_MODULE_7__["TEXT_ALIGN"][textState.textAlign || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultTextAlign"]];
        var strokeWidth = strokeKey && strokeState.lineWidth ? strokeState.lineWidth : 0;
        var lines = text.split('\n');
        var numLines = lines.length;
        var widths = [];
        var width = Object(_canvas_js__WEBPACK_IMPORTED_MODULE_5__["measureTextWidths"])(textState.font, lines, widths);
        var lineHeight = Object(_canvas_js__WEBPACK_IMPORTED_MODULE_5__["measureTextHeight"])(textState.font);
        var height = lineHeight * numLines;
        var renderWidth = width + strokeWidth;
        var contextInstructions = [];
        /** @type {import("../canvas.js").Label} */
        var label = {
            // make canvas 2 pixels wider to account for italic text width measurement errors
            width: Math.ceil((renderWidth + 2) * scale),
            height: Math.ceil((height + strokeWidth) * scale),
            contextInstructions: contextInstructions
        };
        if (scale != 1) {
            contextInstructions.push('scale', [scale, scale]);
        }
        contextInstructions.push('font', textState.font);
        if (strokeKey) {
            contextInstructions.push('strokeStyle', strokeState.strokeStyle);
            contextInstructions.push('lineWidth', strokeWidth);
            contextInstructions.push('lineCap', strokeState.lineCap);
            contextInstructions.push('lineJoin', strokeState.lineJoin);
            contextInstructions.push('miterLimit', strokeState.miterLimit);
            // eslint-disable-next-line
            var Context = _has_js__WEBPACK_IMPORTED_MODULE_10__["WORKER_OFFSCREEN_CANVAS"] ? OffscreenCanvasRenderingContext2D : CanvasRenderingContext2D;
            if (Context.prototype.setLineDash) {
                contextInstructions.push('setLineDash', [strokeState.lineDash]);
                contextInstructions.push('lineDashOffset', strokeState.lineDashOffset);
            }
        }
        if (fillKey) {
            contextInstructions.push('fillStyle', fillState.fillStyle);
        }
        contextInstructions.push('textBaseline', 'middle');
        contextInstructions.push('textAlign', 'center');
        var leftRight = (0.5 - align);
        var x = align * renderWidth + leftRight * strokeWidth;
        var i;
        if (strokeKey) {
            for (i = 0; i < numLines; ++i) {
                contextInstructions.push('strokeText', [lines[i], x + leftRight * widths[i], 0.5 * (strokeWidth + lineHeight) + i * lineHeight]);
            }
        }
        if (fillKey) {
            for (i = 0; i < numLines; ++i) {
                contextInstructions.push('fillText', [lines[i], x + leftRight * widths[i], 0.5 * (strokeWidth + lineHeight) + i * lineHeight]);
            }
        }
        this.labels_[key] = label;
        return label;
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../coordinate.js").Coordinate} p1 1st point of the background box.
     * @param {import("../../coordinate.js").Coordinate} p2 2nd point of the background box.
     * @param {import("../../coordinate.js").Coordinate} p3 3rd point of the background box.
     * @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box.
     * @param {Array<*>} fillInstruction Fill instruction.
     * @param {Array<*>} strokeInstruction Stroke instruction.
     */
    Executor.prototype.replayTextBackground_ = function (context, p1, p2, p3, p4, fillInstruction, strokeInstruction) {
        context.beginPath();
        context.moveTo.apply(context, p1);
        context.lineTo.apply(context, p2);
        context.lineTo.apply(context, p3);
        context.lineTo.apply(context, p4);
        context.lineTo.apply(context, p1);
        if (fillInstruction) {
            this.alignFill_ = /** @type {boolean} */ (fillInstruction[2]);
            this.fill_(context);
        }
        if (strokeInstruction) {
            this.setStrokeStyle_(context, /** @type {Array<*>} */ (strokeInstruction));
            context.stroke();
        }
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {number} x X.
     * @param {number} y Y.
     * @param {import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.
     * @param {number} anchorX Anchor X.
     * @param {number} anchorY Anchor Y.
     * @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group.
     * @param {number} height Height.
     * @param {number} opacity Opacity.
     * @param {number} originX Origin X.
     * @param {number} originY Origin Y.
     * @param {number} rotation Rotation.
     * @param {number} scale Scale.
     * @param {boolean} snapToPixel Snap to pixel.
     * @param {number} width Width.
     * @param {Array<number>} padding Padding.
     * @param {Array<*>} fillInstruction Fill instruction.
     * @param {Array<*>} strokeInstruction Stroke instruction.
     */
    Executor.prototype.replayImageOrLabel_ = function (context, x, y, imageOrLabel, anchorX, anchorY, declutterGroup, height, opacity, originX, originY, rotation, scale, snapToPixel, width, padding, fillInstruction, strokeInstruction) {
        var fillStroke = fillInstruction || strokeInstruction;
        anchorX *= scale;
        anchorY *= scale;
        x -= anchorX;
        y -= anchorY;
        var w = (width + originX > imageOrLabel.width) ? imageOrLabel.width - originX : width;
        var h = (height + originY > imageOrLabel.height) ? imageOrLabel.height - originY : height;
        var boxW = padding[3] + w * scale + padding[1];
        var boxH = padding[0] + h * scale + padding[2];
        var boxX = x - padding[3];
        var boxY = y - padding[0];
        if (fillStroke || rotation !== 0) {
            p1[0] = boxX;
            p4[0] = boxX;
            p1[1] = boxY;
            p2[1] = boxY;
            p2[0] = boxX + boxW;
            p3[0] = p2[0];
            p3[1] = boxY + boxH;
            p4[1] = p3[1];
        }
        var transform = null;
        if (rotation !== 0) {
            var centerX = x + anchorX;
            var centerY = y + anchorY;
            transform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["compose"])(tmpTransform, centerX, centerY, 1, 1, rotation, -centerX, -centerY);
            Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["apply"])(tmpTransform, p1);
            Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["apply"])(tmpTransform, p2);
            Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["apply"])(tmpTransform, p3);
            Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["apply"])(tmpTransform, p4);
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createOrUpdate"])(Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1]), tmpExtent);
        }
        else {
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createOrUpdate"])(boxX, boxY, boxX + boxW, boxY + boxH, tmpExtent);
        }
        var canvas = context.canvas;
        var strokePadding = strokeInstruction ? (strokeInstruction[2] * scale / 2) : 0;
        var intersects = tmpExtent[0] - strokePadding <= canvas.width && tmpExtent[2] + strokePadding >= 0 &&
            tmpExtent[1] - strokePadding <= canvas.height && tmpExtent[3] + strokePadding >= 0;
        if (snapToPixel) {
            x = Math.round(x);
            y = Math.round(y);
        }
        if (declutterGroup) {
            if (!intersects && declutterGroup[4] == 1) {
                return;
            }
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(declutterGroup, tmpExtent);
            var declutterArgs = intersects ?
                [context, transform ? transform.slice(0) : null, opacity, imageOrLabel, originX, originY, w, h, x, y, scale] :
                null;
            if (declutterArgs) {
                if (fillStroke) {
                    declutterArgs.push(fillInstruction, strokeInstruction, p1.slice(0), p2.slice(0), p3.slice(0), p4.slice(0));
                }
                declutterGroup.push(declutterArgs);
            }
        }
        else if (intersects) {
            if (fillStroke) {
                this.replayTextBackground_(context, p1, p2, p3, p4, 
                /** @type {Array<*>} */ (fillInstruction), 
                /** @type {Array<*>} */ (strokeInstruction));
            }
            Object(_canvas_js__WEBPACK_IMPORTED_MODULE_5__["drawImageOrLabel"])(context, transform, opacity, imageOrLabel, originX, originY, w, h, x, y, scale);
        }
    };
    /**
     * @private
     * @param {CanvasRenderingContext2D} context Context.
     */
    Executor.prototype.fill_ = function (context) {
        if (this.alignFill_) {
            var origin_1 = Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["apply"])(this.renderedTransform_, [0, 0]);
            var repeatSize = 512 * this.pixelRatio;
            context.save();
            context.translate(origin_1[0] % repeatSize, origin_1[1] % repeatSize);
            context.rotate(this.viewRotation_);
        }
        context.fill();
        if (this.alignFill_) {
            context.restore();
        }
    };
    /**
     * @private
     * @param {CanvasRenderingContext2D} context Context.
     * @param {Array<*>} instruction Instruction.
     */
    Executor.prototype.setStrokeStyle_ = function (context, instruction) {
        context.strokeStyle = /** @type {import("../../colorlike.js").ColorLike} */ (instruction[1]);
        context.lineWidth = /** @type {number} */ (instruction[2]);
        context.lineCap = /** @type {CanvasLineCap} */ (instruction[3]);
        context.lineJoin = /** @type {CanvasLineJoin} */ (instruction[4]);
        context.miterLimit = /** @type {number} */ (instruction[5]);
        if (context.setLineDash) {
            context.lineDashOffset = /** @type {number} */ (instruction[7]);
            context.setLineDash(/** @type {Array<number>} */ (instruction[6]));
        }
    };
    /**
     * @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group.
     * @param {import("../../Feature.js").FeatureLike} feature Feature.
     * @param {number} opacity Layer opacity.
     * @param {?} declutterTree Declutter tree.
     * @return {?} Declutter tree.
     */
    Executor.prototype.renderDeclutter = function (declutterGroup, feature, opacity, declutterTree) {
        if (declutterGroup && declutterGroup.length > 5) {
            var groupCount = declutterGroup[4];
            if (groupCount == 1 || groupCount == declutterGroup.length - 5) {
                /** @type {import("../../structs/RBush.js").Entry} */
                var box = {
                    minX: /** @type {number} */ (declutterGroup[0]),
                    minY: /** @type {number} */ (declutterGroup[1]),
                    maxX: /** @type {number} */ (declutterGroup[2]),
                    maxY: /** @type {number} */ (declutterGroup[3]),
                    value: feature
                };
                if (!declutterTree) {
                    declutterTree = new rbush_rbush_js__WEBPACK_IMPORTED_MODULE_9___default.a(9);
                }
                if (!declutterTree.collides(box)) {
                    declutterTree.insert(box);
                    for (var j = 5, jj = declutterGroup.length; j < jj; ++j) {
                        var declutterData = /** @type {Array} */ (declutterGroup[j]);
                        var context = declutterData[0];
                        var currentAlpha = context.globalAlpha;
                        if (currentAlpha !== opacity) {
                            context.globalAlpha = opacity;
                        }
                        if (declutterData.length > 11) {
                            this.replayTextBackground_(declutterData[0], declutterData[13], declutterData[14], declutterData[15], declutterData[16], declutterData[11], declutterData[12]);
                        }
                        _canvas_js__WEBPACK_IMPORTED_MODULE_5__["drawImageOrLabel"].apply(undefined, declutterData);
                        if (currentAlpha !== opacity) {
                            context.globalAlpha = currentAlpha;
                        }
                    }
                }
                declutterGroup.length = 5;
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createOrUpdateEmpty"])(declutterGroup);
            }
        }
        return declutterTree;
    };
    /**
     * @private
     * @param {string} text The text to draw.
     * @param {string} textKey The key of the text state.
     * @param {string} strokeKey The key for the stroke state.
     * @param {string} fillKey The key for the fill state.
     * @return {{label: import("../canvas.js").Label, anchorX: number, anchorY: number}} The text image and its anchor.
     */
    Executor.prototype.drawLabelWithPointPlacement_ = function (text, textKey, strokeKey, fillKey) {
        var textState = this.textStates[textKey];
        var label = this.createLabel(text, textKey, fillKey, strokeKey);
        var strokeState = this.strokeStates[strokeKey];
        var pixelRatio = this.pixelRatio;
        var align = _TextBuilder_js__WEBPACK_IMPORTED_MODULE_7__["TEXT_ALIGN"][textState.textAlign || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultTextAlign"]];
        var baseline = _TextBuilder_js__WEBPACK_IMPORTED_MODULE_7__["TEXT_ALIGN"][textState.textBaseline || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultTextBaseline"]];
        var strokeWidth = strokeState && strokeState.lineWidth ? strokeState.lineWidth : 0;
        // Remove the 2 pixels we added in createLabel() for the anchor
        var width = label.width / pixelRatio - 2 * textState.scale;
        var anchorX = align * width + 2 * (0.5 - align) * strokeWidth;
        var anchorY = baseline * label.height / pixelRatio + 2 * (0.5 - baseline) * strokeWidth;
        return {
            label: label,
            anchorX: anchorX,
            anchorY: anchorY
        };
    };
    /**
     * @private
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../transform.js").Transform} transform Transform.
     * @param {Array<*>} instructions Instructions array.
     * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
     * @param {function(import("../../Feature.js").FeatureLike): T|undefined} featureCallback Feature callback.
     * @param {import("../../extent.js").Extent=} opt_hitExtent Only check features that intersect this
     *     extent.
     * @return {T|undefined} Callback result.
     * @template T
     */
    Executor.prototype.execute_ = function (context, transform, instructions, snapToPixel, featureCallback, opt_hitExtent) {
        this.declutterItems.length = 0;
        /** @type {Array<number>} */
        var pixelCoordinates;
        if (this.pixelCoordinates_ && Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["equals"])(transform, this.renderedTransform_)) {
            pixelCoordinates = this.pixelCoordinates_;
        }
        else {
            if (!this.pixelCoordinates_) {
                this.pixelCoordinates_ = [];
            }
            pixelCoordinates = Object(_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_4__["transform2D"])(this.coordinates, 0, this.coordinates.length, 2, transform, this.pixelCoordinates_);
            Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["setFromArray"])(this.renderedTransform_, transform);
        }
        var i = 0; // instruction index
        var ii = instructions.length; // end of instructions
        var d = 0; // data index
        var dd; // end of per-instruction data
        var anchorX, anchorY, prevX, prevY, roundX, roundY, declutterGroup, declutterGroups, image, text, textKey;
        var strokeKey, fillKey;
        var pendingFill = 0;
        var pendingStroke = 0;
        var lastFillInstruction = null;
        var lastStrokeInstruction = null;
        var coordinateCache = this.coordinateCache_;
        var viewRotation = this.viewRotation_;
        var viewRotationFromTransform = Math.round(Math.atan2(-transform[1], transform[0]) * 1e12) / 1e12;
        var state = /** @type {import("../../render.js").State} */ ({
            context: context,
            pixelRatio: this.pixelRatio,
            resolution: this.resolution,
            rotation: viewRotation
        });
        // When the batch size gets too big, performance decreases. 200 is a good
        // balance between batch size and number of fill/stroke instructions.
        var batchSize = this.instructions != instructions || this.overlaps ? 0 : 200;
        var /** @type {import("../../Feature.js").FeatureLike} */ feature;
        var x, y;
        while (i < ii) {
            var instruction = instructions[i];
            var type = /** @type {CanvasInstruction} */ (instruction[0]);
            switch (type) {
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].BEGIN_GEOMETRY:
                    feature = /** @type {import("../../Feature.js").FeatureLike} */ (instruction[1]);
                    if (!feature.getGeometry()) {
                        i = /** @type {number} */ (instruction[2]);
                    }
                    else if (opt_hitExtent !== undefined && !Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["intersects"])(opt_hitExtent, instruction[3])) {
                        i = /** @type {number} */ (instruction[2]) + 1;
                    }
                    else {
                        ++i;
                    }
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].BEGIN_PATH:
                    if (pendingFill > batchSize) {
                        this.fill_(context);
                        pendingFill = 0;
                    }
                    if (pendingStroke > batchSize) {
                        context.stroke();
                        pendingStroke = 0;
                    }
                    if (!pendingFill && !pendingStroke) {
                        context.beginPath();
                        prevX = NaN;
                        prevY = NaN;
                    }
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].CIRCLE:
                    d = /** @type {number} */ (instruction[1]);
                    var x1 = pixelCoordinates[d];
                    var y1 = pixelCoordinates[d + 1];
                    var x2 = pixelCoordinates[d + 2];
                    var y2 = pixelCoordinates[d + 3];
                    var dx = x2 - x1;
                    var dy = y2 - y1;
                    var r = Math.sqrt(dx * dx + dy * dy);
                    context.moveTo(x1 + r, y1);
                    context.arc(x1, y1, r, 0, 2 * Math.PI, true);
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].CLOSE_PATH:
                    context.closePath();
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].CUSTOM:
                    d = /** @type {number} */ (instruction[1]);
                    dd = instruction[2];
                    var geometry = /** @type {import("../../geom/SimpleGeometry.js").default} */ (instruction[3]);
                    var renderer = instruction[4];
                    var fn = instruction.length == 6 ? instruction[5] : undefined;
                    state.geometry = geometry;
                    state.feature = feature;
                    if (!(i in coordinateCache)) {
                        coordinateCache[i] = [];
                    }
                    var coords = coordinateCache[i];
                    if (fn) {
                        fn(pixelCoordinates, d, dd, 2, coords);
                    }
                    else {
                        coords[0] = pixelCoordinates[d];
                        coords[1] = pixelCoordinates[d + 1];
                        coords.length = 2;
                    }
                    renderer(coords, state);
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_IMAGE:
                    d = /** @type {number} */ (instruction[1]);
                    dd = /** @type {number} */ (instruction[2]);
                    image = /** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */ (instruction[3]);
                    // Remaining arguments in DRAW_IMAGE are in alphabetical order
                    anchorX = /** @type {number} */ (instruction[4]);
                    anchorY = /** @type {number} */ (instruction[5]);
                    declutterGroups = featureCallback ? null : instruction[6];
                    var height = /** @type {number} */ (instruction[7]);
                    var opacity = /** @type {number} */ (instruction[8]);
                    var originX = /** @type {number} */ (instruction[9]);
                    var originY = /** @type {number} */ (instruction[10]);
                    var rotateWithView = /** @type {boolean} */ (instruction[11]);
                    var rotation = /** @type {number} */ (instruction[12]);
                    var scale = /** @type {number} */ (instruction[13]);
                    var width = /** @type {number} */ (instruction[14]);
                    if (!image && instruction.length >= 19) {
                        // create label images
                        text = /** @type {string} */ (instruction[18]);
                        textKey = /** @type {string} */ (instruction[19]);
                        strokeKey = /** @type {string} */ (instruction[20]);
                        fillKey = /** @type {string} */ (instruction[21]);
                        var labelWithAnchor = this.drawLabelWithPointPlacement_(text, textKey, strokeKey, fillKey);
                        image = labelWithAnchor.label;
                        instruction[3] = image;
                        var textOffsetX = /** @type {number} */ (instruction[22]);
                        anchorX = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio;
                        instruction[4] = anchorX;
                        var textOffsetY = /** @type {number} */ (instruction[23]);
                        anchorY = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio;
                        instruction[5] = anchorY;
                        height = image.height;
                        instruction[7] = height;
                        width = image.width;
                        instruction[14] = width;
                    }
                    var geometryWidths = void 0;
                    if (instruction.length > 24) {
                        geometryWidths = /** @type {number} */ (instruction[24]);
                    }
                    var padding = void 0, backgroundFill = void 0, backgroundStroke = void 0;
                    if (instruction.length > 16) {
                        padding = /** @type {Array<number>} */ (instruction[15]);
                        backgroundFill = /** @type {boolean} */ (instruction[16]);
                        backgroundStroke = /** @type {boolean} */ (instruction[17]);
                    }
                    else {
                        padding = _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultPadding"];
                        backgroundFill = false;
                        backgroundStroke = false;
                    }
                    if (rotateWithView && viewRotationFromTransform) {
                        // Canvas is expected to be rotated to reverse view rotation.
                        rotation += viewRotation;
                    }
                    else if (!rotateWithView && !viewRotationFromTransform) {
                        // Canvas is not rotated, images need to be rotated back to be north-up.
                        rotation -= viewRotation;
                    }
                    var widthIndex = 0;
                    var declutterGroupIndex = 0;
                    for (; d < dd; d += 2) {
                        if (geometryWidths && geometryWidths[widthIndex++] < width / this.pixelRatio) {
                            continue;
                        }
                        if (declutterGroups) {
                            var index = Math.floor(declutterGroupIndex);
                            if (declutterGroups.length < index + 1) {
                                declutterGroup = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createEmpty"])();
                                declutterGroup.push(declutterGroups[0][4]);
                                declutterGroups.push(declutterGroup);
                            }
                            declutterGroup = declutterGroups[index];
                        }
                        this.replayImageOrLabel_(context, pixelCoordinates[d], pixelCoordinates[d + 1], image, anchorX, anchorY, declutterGroup, height, opacity, originX, originY, rotation, scale, snapToPixel, width, padding, backgroundFill ? /** @type {Array<*>} */ (lastFillInstruction) : null, backgroundStroke ? /** @type {Array<*>} */ (lastStrokeInstruction) : null);
                        if (declutterGroup) {
                            if (declutterGroupIndex === Math.floor(declutterGroupIndex)) {
                                this.declutterItems.push(this, declutterGroup, feature);
                            }
                            declutterGroupIndex += 1 / declutterGroup[4];
                        }
                    }
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_CHARS:
                    var begin = /** @type {number} */ (instruction[1]);
                    var end = /** @type {number} */ (instruction[2]);
                    var baseline = /** @type {number} */ (instruction[3]);
                    declutterGroup = featureCallback ? null : instruction[4];
                    var overflow = /** @type {number} */ (instruction[5]);
                    fillKey = /** @type {string} */ (instruction[6]);
                    var maxAngle = /** @type {number} */ (instruction[7]);
                    var measurePixelRatio = /** @type {number} */ (instruction[8]);
                    var offsetY = /** @type {number} */ (instruction[9]);
                    strokeKey = /** @type {string} */ (instruction[10]);
                    var strokeWidth = /** @type {number} */ (instruction[11]);
                    text = /** @type {string} */ (instruction[12]);
                    textKey = /** @type {string} */ (instruction[13]);
                    var pixelRatioScale = /** @type {number} */ (instruction[14]);
                    var textState = this.textStates[textKey];
                    var font = textState.font;
                    var textScale = textState.scale * measurePixelRatio;
                    var cachedWidths = void 0;
                    if (font in this.widths_) {
                        cachedWidths = this.widths_[font];
                    }
                    else {
                        cachedWidths = {};
                        this.widths_[font] = cachedWidths;
                    }
                    var pathLength = Object(_geom_flat_length_js__WEBPACK_IMPORTED_MODULE_2__["lineStringLength"])(pixelCoordinates, begin, end, 2);
                    var textLength = textScale * Object(_canvas_js__WEBPACK_IMPORTED_MODULE_5__["measureAndCacheTextWidth"])(font, text, cachedWidths);
                    if (overflow || textLength <= pathLength) {
                        var textAlign = this.textStates[textKey].textAlign;
                        var startM = (pathLength - textLength) * _TextBuilder_js__WEBPACK_IMPORTED_MODULE_7__["TEXT_ALIGN"][textAlign];
                        var parts = Object(_geom_flat_textpath_js__WEBPACK_IMPORTED_MODULE_3__["drawTextOnPath"])(pixelCoordinates, begin, end, 2, text, startM, maxAngle, textScale, _canvas_js__WEBPACK_IMPORTED_MODULE_5__["measureAndCacheTextWidth"], font, cachedWidths);
                        if (parts) {
                            var c = void 0, cc = void 0, chars = void 0, label = void 0, part = void 0;
                            if (strokeKey) {
                                for (c = 0, cc = parts.length; c < cc; ++c) {
                                    part = parts[c]; // x, y, anchorX, rotation, chunk
                                    chars = /** @type {string} */ (part[4]);
                                    label = this.createLabel(chars, textKey, '', strokeKey);
                                    anchorX = /** @type {number} */ (part[2]) + strokeWidth;
                                    anchorY = baseline * label.height + (0.5 - baseline) * 2 * strokeWidth - offsetY;
                                    this.replayImageOrLabel_(context, 
                                    /** @type {number} */ (part[0]), /** @type {number} */ (part[1]), label, anchorX, anchorY, declutterGroup, label.height, 1, 0, 0, 
                                    /** @type {number} */ (part[3]), pixelRatioScale, false, label.width, _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultPadding"], null, null);
                                }
                            }
                            if (fillKey) {
                                for (c = 0, cc = parts.length; c < cc; ++c) {
                                    part = parts[c]; // x, y, anchorX, rotation, chunk
                                    chars = /** @type {string} */ (part[4]);
                                    label = this.createLabel(chars, textKey, fillKey, '');
                                    anchorX = /** @type {number} */ (part[2]);
                                    anchorY = baseline * label.height - offsetY;
                                    this.replayImageOrLabel_(context, 
                                    /** @type {number} */ (part[0]), /** @type {number} */ (part[1]), label, anchorX, anchorY, declutterGroup, label.height, 1, 0, 0, 
                                    /** @type {number} */ (part[3]), pixelRatioScale, false, label.width, _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultPadding"], null, null);
                                }
                            }
                        }
                    }
                    this.declutterItems.push(this, declutterGroup, feature);
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].END_GEOMETRY:
                    if (featureCallback !== undefined) {
                        feature = /** @type {import("../../Feature.js").FeatureLike} */ (instruction[1]);
                        var result = featureCallback(feature);
                        if (result) {
                            return result;
                        }
                    }
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].FILL:
                    if (batchSize) {
                        pendingFill++;
                    }
                    else {
                        this.fill_(context);
                    }
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].MOVE_TO_LINE_TO:
                    d = /** @type {number} */ (instruction[1]);
                    dd = /** @type {number} */ (instruction[2]);
                    x = pixelCoordinates[d];
                    y = pixelCoordinates[d + 1];
                    roundX = (x + 0.5) | 0;
                    roundY = (y + 0.5) | 0;
                    if (roundX !== prevX || roundY !== prevY) {
                        context.moveTo(x, y);
                        prevX = roundX;
                        prevY = roundY;
                    }
                    for (d += 2; d < dd; d += 2) {
                        x = pixelCoordinates[d];
                        y = pixelCoordinates[d + 1];
                        roundX = (x + 0.5) | 0;
                        roundY = (y + 0.5) | 0;
                        if (d == dd - 2 || roundX !== prevX || roundY !== prevY) {
                            context.lineTo(x, y);
                            prevX = roundX;
                            prevY = roundY;
                        }
                    }
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].SET_FILL_STYLE:
                    lastFillInstruction = instruction;
                    this.alignFill_ = instruction[2];
                    if (pendingFill) {
                        this.fill_(context);
                        pendingFill = 0;
                        if (pendingStroke) {
                            context.stroke();
                            pendingStroke = 0;
                        }
                    }
                    context.fillStyle = /** @type {import("../../colorlike.js").ColorLike} */ (instruction[1]);
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].SET_STROKE_STYLE:
                    lastStrokeInstruction = instruction;
                    if (pendingStroke) {
                        context.stroke();
                        pendingStroke = 0;
                    }
                    this.setStrokeStyle_(context, /** @type {Array<*>} */ (instruction));
                    ++i;
                    break;
                case _Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].STROKE:
                    if (batchSize) {
                        pendingStroke++;
                    }
                    else {
                        context.stroke();
                    }
                    ++i;
                    break;
                default:
                    ++i; // consume the instruction anyway, to avoid an infinite loop
                    break;
            }
        }
        if (pendingFill) {
            this.fill_(context);
        }
        if (pendingStroke) {
            context.stroke();
        }
        return undefined;
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../transform.js").Transform} transform Transform.
     * @param {number} viewRotation View rotation.
     * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
     */
    Executor.prototype.execute = function (context, transform, viewRotation, snapToPixel) {
        this.viewRotation_ = viewRotation;
        this.execute_(context, transform, this.instructions, snapToPixel, undefined, undefined);
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../transform.js").Transform} transform Transform.
     * @param {number} viewRotation View rotation.
     * @param {function(import("../../Feature.js").FeatureLike): T=} opt_featureCallback
     *     Feature callback.
     * @param {import("../../extent.js").Extent=} opt_hitExtent Only check features that intersect this
     *     extent.
     * @return {T|undefined} Callback result.
     * @template T
     */
    Executor.prototype.executeHitDetection = function (context, transform, viewRotation, opt_featureCallback, opt_hitExtent) {
        this.viewRotation_ = viewRotation;
        return this.execute_(context, transform, this.hitDetectionInstructions, true, opt_featureCallback, opt_hitExtent);
    };
    return Executor;
}());
/* harmony default export */ __webpack_exports__["default"] = (Executor);
//# sourceMappingURL=Executor.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/ExecutorGroup.js":
/*!********************************************************!*\
  !*** ./node_modules/ol/render/canvas/ExecutorGroup.js ***!
  \********************************************************/
/*! exports provided: getCircleArray, replayDeclutter, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCircleArray", function() { return getCircleArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "replayDeclutter", function() { return replayDeclutter; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../geom/flat/transform.js */ "./node_modules/ol/geom/flat/transform.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BuilderType.js */ "./node_modules/ol/render/canvas/BuilderType.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _Executor_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Executor.js */ "./node_modules/ol/render/canvas/Executor.js");
/**
 * @module ol/render/canvas/ExecutorGroup
 */








/**
 * @const
 * @type {Array<BuilderType>}
 */
var ORDER = [
    _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].POLYGON,
    _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].CIRCLE,
    _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].LINE_STRING,
    _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].IMAGE,
    _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].TEXT,
    _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].DEFAULT
];
var ExecutorGroup = /** @class */ (function () {
    /**
     * @param {import("../../extent.js").Extent} maxExtent Max extent for clipping. When a
     * `maxExtent` was set on the Buillder for this executor group, the same `maxExtent`
     * should be set here, unless the target context does not exceet that extent (which
     * can be the case when rendering to tiles).
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {boolean} overlaps The executor group can have overlapping geometries.
     * @param {!Object<string, !Object<BuilderType, import("./Builder.js").SerializableInstructions>>} allInstructions
     * The serializable instructions.
     * @param {number=} opt_renderBuffer Optional rendering buffer.
     */
    function ExecutorGroup(maxExtent, resolution, pixelRatio, overlaps, allInstructions, opt_renderBuffer) {
        /**
         * @private
         * @type {import("../../extent.js").Extent}
         */
        this.maxExtent_ = maxExtent;
        /**
         * @private
         * @type {boolean}
         */
        this.overlaps_ = overlaps;
        /**
         * @private
         * @type {number}
         */
        this.pixelRatio_ = pixelRatio;
        /**
         * @private
         * @type {number}
         */
        this.resolution_ = resolution;
        /**
         * @private
         * @type {number|undefined}
         */
        this.renderBuffer_ = opt_renderBuffer;
        /**
         * @private
         * @type {!Object<string, !Object<BuilderType, import("./Executor").default>>}
         */
        this.executorsByZIndex_ = {};
        /**
         * @private
         * @type {CanvasRenderingContext2D}
         */
        this.hitDetectionContext_ = null;
        /**
         * @private
         * @type {import("../../transform.js").Transform}
         */
        this.hitDetectionTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["create"])();
        this.createExecutors_(allInstructions);
    }
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../transform.js").Transform} transform Transform.
     */
    ExecutorGroup.prototype.clip = function (context, transform) {
        var flatClipCoords = this.getClipCoords(transform);
        context.beginPath();
        context.moveTo(flatClipCoords[0], flatClipCoords[1]);
        context.lineTo(flatClipCoords[2], flatClipCoords[3]);
        context.lineTo(flatClipCoords[4], flatClipCoords[5]);
        context.lineTo(flatClipCoords[6], flatClipCoords[7]);
        context.clip();
    };
    /**
     * Create executors and populate them using the provided instructions.
     * @private
     * @param {!Object<string, !Object<BuilderType, import("./Builder.js").SerializableInstructions>>} allInstructions The serializable instructions
     */
    ExecutorGroup.prototype.createExecutors_ = function (allInstructions) {
        for (var zIndex in allInstructions) {
            var executors = this.executorsByZIndex_[zIndex];
            if (executors === undefined) {
                executors = {};
                this.executorsByZIndex_[zIndex] = executors;
            }
            var instructionByZindex = allInstructions[zIndex];
            for (var builderType in instructionByZindex) {
                var instructions = instructionByZindex[builderType];
                executors[builderType] = new _Executor_js__WEBPACK_IMPORTED_MODULE_7__["default"](this.resolution_, this.pixelRatio_, this.overlaps_, instructions);
            }
        }
    };
    /**
     * @param {Array<BuilderType>} executors Executors.
     * @return {boolean} Has executors of the provided types.
     */
    ExecutorGroup.prototype.hasExecutors = function (executors) {
        for (var zIndex in this.executorsByZIndex_) {
            var candidates = this.executorsByZIndex_[zIndex];
            for (var i = 0, ii = executors.length; i < ii; ++i) {
                if (executors[i] in candidates) {
                    return true;
                }
            }
        }
        return false;
    };
    /**
     * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {number} resolution Resolution.
     * @param {number} rotation Rotation.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @param {function(import("../../Feature.js").FeatureLike): T} callback Feature callback.
     * @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
     * @return {T|undefined} Callback result.
     * @template T
     */
    ExecutorGroup.prototype.forEachFeatureAtCoordinate = function (coordinate, resolution, rotation, hitTolerance, callback, declutteredFeatures) {
        hitTolerance = Math.round(hitTolerance);
        var contextSize = hitTolerance * 2 + 1;
        var transform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["compose"])(this.hitDetectionTransform_, hitTolerance + 0.5, hitTolerance + 0.5, 1 / resolution, -1 / resolution, -rotation, -coordinate[0], -coordinate[1]);
        if (!this.hitDetectionContext_) {
            this.hitDetectionContext_ = Object(_dom_js__WEBPACK_IMPORTED_MODULE_1__["createCanvasContext2D"])(contextSize, contextSize);
        }
        var context = this.hitDetectionContext_;
        if (context.canvas.width !== contextSize || context.canvas.height !== contextSize) {
            context.canvas.width = contextSize;
            context.canvas.height = contextSize;
        }
        else {
            context.clearRect(0, 0, contextSize, contextSize);
        }
        /**
         * @type {import("../../extent.js").Extent}
         */
        var hitExtent;
        if (this.renderBuffer_ !== undefined) {
            hitExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["createEmpty"])();
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["extendCoordinate"])(hitExtent, coordinate);
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["buffer"])(hitExtent, resolution * (this.renderBuffer_ + hitTolerance), hitExtent);
        }
        var mask = getCircleArray(hitTolerance);
        var builderType;
        /**
         * @param {import("../../Feature.js").FeatureLike} feature Feature.
         * @return {?} Callback result.
         */
        function featureCallback(feature) {
            var imageData = context.getImageData(0, 0, contextSize, contextSize).data;
            for (var i_1 = 0; i_1 < contextSize; i_1++) {
                for (var j_1 = 0; j_1 < contextSize; j_1++) {
                    if (mask[i_1][j_1]) {
                        if (imageData[(j_1 * contextSize + i_1) * 4 + 3] > 0) {
                            var result_1 = void 0;
                            if (!(declutteredFeatures && (builderType == _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].IMAGE || builderType == _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].TEXT)) ||
                                declutteredFeatures.indexOf(feature) !== -1) {
                                result_1 = callback(feature);
                            }
                            if (result_1) {
                                return result_1;
                            }
                            else {
                                context.clearRect(0, 0, contextSize, contextSize);
                                return undefined;
                            }
                        }
                    }
                }
            }
        }
        /** @type {Array<number>} */
        var zs = Object.keys(this.executorsByZIndex_).map(Number);
        zs.sort(_array_js__WEBPACK_IMPORTED_MODULE_0__["numberSafeCompareFunction"]);
        var i, j, executors, executor, result;
        for (i = zs.length - 1; i >= 0; --i) {
            var zIndexKey = zs[i].toString();
            executors = this.executorsByZIndex_[zIndexKey];
            for (j = ORDER.length - 1; j >= 0; --j) {
                builderType = ORDER[j];
                executor = executors[builderType];
                if (executor !== undefined) {
                    result = executor.executeHitDetection(context, transform, rotation, featureCallback, hitExtent);
                    if (result) {
                        return result;
                    }
                }
            }
        }
        return undefined;
    };
    /**
     * @param {import("../../transform.js").Transform} transform Transform.
     * @return {Array<number>} Clip coordinates.
     */
    ExecutorGroup.prototype.getClipCoords = function (transform) {
        var maxExtent = this.maxExtent_;
        if (!maxExtent) {
            return null;
        }
        var minX = maxExtent[0];
        var minY = maxExtent[1];
        var maxX = maxExtent[2];
        var maxY = maxExtent[3];
        var flatClipCoords = [minX, minY, minX, maxY, maxX, maxY, maxX, minY];
        Object(_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_3__["transform2D"])(flatClipCoords, 0, 8, 2, transform, flatClipCoords);
        return flatClipCoords;
    };
    /**
     * @return {boolean} Is empty.
     */
    ExecutorGroup.prototype.isEmpty = function () {
        return Object(_obj_js__WEBPACK_IMPORTED_MODULE_4__["isEmpty"])(this.executorsByZIndex_);
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../transform.js").Transform} transform Transform.
     * @param {number} viewRotation View rotation.
     * @param {boolean} snapToPixel Snap point symbols and test to integer pixel.
     * @param {Array<BuilderType>=} opt_builderTypes Ordered replay types to replay.
     *     Default is {@link module:ol/render/replay~ORDER}
     * @param {Object<string, import("../canvas.js").DeclutterGroup>=} opt_declutterReplays Declutter replays.
     */
    ExecutorGroup.prototype.execute = function (context, transform, viewRotation, snapToPixel, opt_builderTypes, opt_declutterReplays) {
        /** @type {Array<number>} */
        var zs = Object.keys(this.executorsByZIndex_).map(Number);
        zs.sort(_array_js__WEBPACK_IMPORTED_MODULE_0__["numberSafeCompareFunction"]);
        // setup clipping so that the parts of over-simplified geometries are not
        // visible outside the current extent when panning
        if (this.maxExtent_) {
            context.save();
            this.clip(context, transform);
        }
        var builderTypes = opt_builderTypes ? opt_builderTypes : ORDER;
        var i, ii, j, jj, replays, replay;
        for (i = 0, ii = zs.length; i < ii; ++i) {
            var zIndexKey = zs[i].toString();
            replays = this.executorsByZIndex_[zIndexKey];
            for (j = 0, jj = builderTypes.length; j < jj; ++j) {
                var builderType = builderTypes[j];
                replay = replays[builderType];
                if (replay !== undefined) {
                    if (opt_declutterReplays &&
                        (builderType == _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].IMAGE || builderType == _BuilderType_js__WEBPACK_IMPORTED_MODULE_5__["default"].TEXT)) {
                        var declutter = opt_declutterReplays[zIndexKey];
                        if (!declutter) {
                            opt_declutterReplays[zIndexKey] = [replay, transform.slice(0)];
                        }
                        else {
                            declutter.push(replay, transform.slice(0));
                        }
                    }
                    else {
                        replay.execute(context, transform, viewRotation, snapToPixel);
                    }
                }
            }
        }
        if (this.maxExtent_) {
            context.restore();
        }
    };
    return ExecutorGroup;
}());
/**
 * This cache is used for storing calculated pixel circles for increasing performance.
 * It is a static property to allow each Replaygroup to access it.
 * @type {Object<number, Array<Array<(boolean|undefined)>>>}
 */
var circleArrayCache = {
    0: [[true]]
};
/**
 * This method fills a row in the array from the given coordinate to the
 * middle with `true`.
 * @param {Array<Array<(boolean|undefined)>>} array The array that will be altered.
 * @param {number} x X coordinate.
 * @param {number} y Y coordinate.
 */
function fillCircleArrayRowToMiddle(array, x, y) {
    var i;
    var radius = Math.floor(array.length / 2);
    if (x >= radius) {
        for (i = radius; i < x; i++) {
            array[i][y] = true;
        }
    }
    else if (x < radius) {
        for (i = x + 1; i < radius; i++) {
            array[i][y] = true;
        }
    }
}
/**
 * This methods creates a circle inside a fitting array. Points inside the
 * circle are marked by true, points on the outside are undefined.
 * It uses the midpoint circle algorithm.
 * A cache is used to increase performance.
 * @param {number} radius Radius.
 * @returns {Array<Array<(boolean|undefined)>>} An array with marked circle points.
 */
function getCircleArray(radius) {
    if (circleArrayCache[radius] !== undefined) {
        return circleArrayCache[radius];
    }
    var arraySize = radius * 2 + 1;
    var arr = new Array(arraySize);
    for (var i = 0; i < arraySize; i++) {
        arr[i] = new Array(arraySize);
    }
    var x = radius;
    var y = 0;
    var error = 0;
    while (x >= y) {
        fillCircleArrayRowToMiddle(arr, radius + x, radius + y);
        fillCircleArrayRowToMiddle(arr, radius + y, radius + x);
        fillCircleArrayRowToMiddle(arr, radius - y, radius + x);
        fillCircleArrayRowToMiddle(arr, radius - x, radius + y);
        fillCircleArrayRowToMiddle(arr, radius - x, radius - y);
        fillCircleArrayRowToMiddle(arr, radius - y, radius - x);
        fillCircleArrayRowToMiddle(arr, radius + y, radius - x);
        fillCircleArrayRowToMiddle(arr, radius + x, radius - y);
        y++;
        error += 1 + 2 * y;
        if (2 * (error - x) + 1 > 0) {
            x -= 1;
            error += 1 - 2 * x;
        }
    }
    circleArrayCache[radius] = arr;
    return arr;
}
/**
 * @param {!Object<string, Array<*>>} declutterReplays Declutter replays.
 * @param {CanvasRenderingContext2D} context Context.
 * @param {number} rotation Rotation.
 * @param {number} opacity Opacity.
 * @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
 * @param {Array<import("../../PluggableMap.js").DeclutterItems>} declutterItems Declutter items.
 */
function replayDeclutter(declutterReplays, context, rotation, opacity, snapToPixel, declutterItems) {
    var zs = Object.keys(declutterReplays).map(Number).sort(_array_js__WEBPACK_IMPORTED_MODULE_0__["numberSafeCompareFunction"]);
    for (var z = 0, zz = zs.length; z < zz; ++z) {
        var executorData = declutterReplays[zs[z].toString()];
        var currentExecutor = void 0;
        for (var i = 0, ii = executorData.length; i < ii;) {
            var executor = executorData[i++];
            if (executor !== currentExecutor) {
                currentExecutor = executor;
                declutterItems.push({
                    items: executor.declutterItems,
                    opacity: opacity
                });
            }
            var transform = executorData[i++];
            executor.execute(context, transform, rotation, snapToPixel);
        }
    }
}
/* harmony default export */ __webpack_exports__["default"] = (ExecutorGroup);
//# sourceMappingURL=ExecutorGroup.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/ImageBuilder.js":
/*!*******************************************************!*\
  !*** ./node_modules/ol/render/canvas/ImageBuilder.js ***!
  \*******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/ol/render/canvas/Instruction.js");
/* harmony import */ var _Builder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Builder.js */ "./node_modules/ol/render/canvas/Builder.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/render/canvas/ImageBuilder
 */


var CanvasImageBuilder = /** @class */ (function (_super) {
    __extends(CanvasImageBuilder, _super);
    /**
     * @param {number} tolerance Tolerance.
     * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     */
    function CanvasImageBuilder(tolerance, maxExtent, resolution, pixelRatio) {
        var _this = _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
        /**
         * @private
         * @type {import("../canvas.js").DeclutterGroups}
         */
        _this.declutterGroups_ = null;
        /**
         * @private
         * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
         */
        _this.hitDetectionImage_ = null;
        /**
         * @private
         * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
         */
        _this.image_ = null;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.anchorX_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.anchorY_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.height_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.opacity_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.originX_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.originY_ = undefined;
        /**
         * @private
         * @type {boolean|undefined}
         */
        _this.rotateWithView_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.rotation_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.scale_ = undefined;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.width_ = undefined;
        return _this;
    }
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {number} end End.
     * @param {number} stride Stride.
     * @private
     * @return {number} My end.
     */
    CanvasImageBuilder.prototype.drawCoordinates_ = function (flatCoordinates, offset, end, stride) {
        return this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false);
    };
    /**
     * @inheritDoc
     */
    CanvasImageBuilder.prototype.drawPoint = function (pointGeometry, feature) {
        if (!this.image_) {
            return;
        }
        this.beginGeometry(pointGeometry, feature);
        var flatCoordinates = pointGeometry.getFlatCoordinates();
        var stride = pointGeometry.getStride();
        var myBegin = this.coordinates.length;
        var myEnd = this.drawCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
        this.instructions.push([
            _Instruction_js__WEBPACK_IMPORTED_MODULE_0__["default"].DRAW_IMAGE, myBegin, myEnd, this.image_,
            // Remaining arguments to DRAW_IMAGE are in alphabetical order
            this.anchorX_, this.anchorY_, this.declutterGroups_, this.height_, this.opacity_,
            this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
            this.scale_ * this.pixelRatio, this.width_
        ]);
        this.hitDetectionInstructions.push([
            _Instruction_js__WEBPACK_IMPORTED_MODULE_0__["default"].DRAW_IMAGE, myBegin, myEnd, this.hitDetectionImage_,
            // Remaining arguments to DRAW_IMAGE are in alphabetical order
            this.anchorX_, this.anchorY_, this.declutterGroups_, this.height_, this.opacity_,
            this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
            this.scale_, this.width_
        ]);
        this.endGeometry(feature);
    };
    /**
     * @inheritDoc
     */
    CanvasImageBuilder.prototype.drawMultiPoint = function (multiPointGeometry, feature) {
        if (!this.image_) {
            return;
        }
        this.beginGeometry(multiPointGeometry, feature);
        var flatCoordinates = multiPointGeometry.getFlatCoordinates();
        var stride = multiPointGeometry.getStride();
        var myBegin = this.coordinates.length;
        var myEnd = this.drawCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
        this.instructions.push([
            _Instruction_js__WEBPACK_IMPORTED_MODULE_0__["default"].DRAW_IMAGE, myBegin, myEnd, this.image_,
            // Remaining arguments to DRAW_IMAGE are in alphabetical order
            this.anchorX_, this.anchorY_, this.declutterGroups_, this.height_, this.opacity_,
            this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
            this.scale_ * this.pixelRatio, this.width_
        ]);
        this.hitDetectionInstructions.push([
            _Instruction_js__WEBPACK_IMPORTED_MODULE_0__["default"].DRAW_IMAGE, myBegin, myEnd, this.hitDetectionImage_,
            // Remaining arguments to DRAW_IMAGE are in alphabetical order
            this.anchorX_, this.anchorY_, this.declutterGroups_, this.height_, this.opacity_,
            this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
            this.scale_, this.width_
        ]);
        this.endGeometry(feature);
    };
    /**
     * @inheritDoc
     */
    CanvasImageBuilder.prototype.finish = function () {
        this.reverseHitDetectionInstructions();
        // FIXME this doesn't really protect us against further calls to draw*Geometry
        this.anchorX_ = undefined;
        this.anchorY_ = undefined;
        this.hitDetectionImage_ = null;
        this.image_ = null;
        this.height_ = undefined;
        this.scale_ = undefined;
        this.opacity_ = undefined;
        this.originX_ = undefined;
        this.originY_ = undefined;
        this.rotateWithView_ = undefined;
        this.rotation_ = undefined;
        this.width_ = undefined;
        return _super.prototype.finish.call(this);
    };
    /**
     * @inheritDoc
     */
    CanvasImageBuilder.prototype.setImageStyle = function (imageStyle, declutterGroups) {
        var anchor = imageStyle.getAnchor();
        var size = imageStyle.getSize();
        var hitDetectionImage = imageStyle.getHitDetectionImage(1);
        var image = imageStyle.getImage(1);
        var origin = imageStyle.getOrigin();
        this.anchorX_ = anchor[0];
        this.anchorY_ = anchor[1];
        this.declutterGroups_ = /** @type {import("../canvas.js").DeclutterGroups} */ (declutterGroups);
        this.hitDetectionImage_ = hitDetectionImage;
        this.image_ = image;
        this.height_ = size[1];
        this.opacity_ = imageStyle.getOpacity();
        this.originX_ = origin[0];
        this.originY_ = origin[1];
        this.rotateWithView_ = imageStyle.getRotateWithView();
        this.rotation_ = imageStyle.getRotation();
        this.scale_ = imageStyle.getScale();
        this.width_ = size[0];
    };
    return CanvasImageBuilder;
}(_Builder_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasImageBuilder);
//# sourceMappingURL=ImageBuilder.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/Immediate.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/render/canvas/Immediate.js ***!
  \****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _colorlike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../colorlike.js */ "./node_modules/ol/colorlike.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../geom/SimpleGeometry.js */ "./node_modules/ol/geom/SimpleGeometry.js");
/* harmony import */ var _geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../geom/flat/transform.js */ "./node_modules/ol/geom/flat/transform.js");
/* harmony import */ var _VectorContext_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../VectorContext.js */ "./node_modules/ol/render/VectorContext.js");
/* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/ol/render/canvas.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
/**
 * @module ol/render/canvas/Immediate
 */
// FIXME test, especially polygons with holes and multipolygons
// FIXME need to handle large thick features (where pixel size matters)
// FIXME add offset and end to ol/geom/flat/transform~transform2D?
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();









/**
 * @classdesc
 * A concrete subclass of {@link module:ol/render/VectorContext} that implements
 * direct rendering of features and geometries to an HTML5 Canvas context.
 * Instances of this class are created internally by the library and
 * provided to application code as vectorContext member of the
 * {@link module:ol/render/Event~RenderEvent} object associated with postcompose, precompose and
 * render events emitted by layers and maps.
 */
var CanvasImmediateRenderer = /** @class */ (function (_super) {
    __extends(CanvasImmediateRenderer, _super);
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../../extent.js").Extent} extent Extent.
     * @param {import("../../transform.js").Transform} transform Transform.
     * @param {number} viewRotation View rotation.
     * @param {number=} opt_squaredTolerance Optional squared tolerance for simplification.
     * @param {import("../../proj.js").TransformFunction=} opt_userTransform Transform from user to view projection.
     */
    function CanvasImmediateRenderer(context, pixelRatio, extent, transform, viewRotation, opt_squaredTolerance, opt_userTransform) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {CanvasRenderingContext2D}
         */
        _this.context_ = context;
        /**
         * @private
         * @type {number}
         */
        _this.pixelRatio_ = pixelRatio;
        /**
         * @private
         * @type {import("../../extent.js").Extent}
         */
        _this.extent_ = extent;
        /**
         * @private
         * @type {import("../../transform.js").Transform}
         */
        _this.transform_ = transform;
        /**
         * @private
         * @type {number}
         */
        _this.viewRotation_ = viewRotation;
        /**
         * @private
         * @type {number}
         */
        _this.squaredTolerance_ = opt_squaredTolerance;
        /**
         * @private
         * @type {import("../../proj.js").TransformFunction}
         */
        _this.userTransform_ = opt_userTransform;
        /**
         * @private
         * @type {?import("../canvas.js").FillState}
         */
        _this.contextFillState_ = null;
        /**
         * @private
         * @type {?import("../canvas.js").StrokeState}
         */
        _this.contextStrokeState_ = null;
        /**
         * @private
         * @type {?import("../canvas.js").TextState}
         */
        _this.contextTextState_ = null;
        /**
         * @private
         * @type {?import("../canvas.js").FillState}
         */
        _this.fillState_ = null;
        /**
         * @private
         * @type {?import("../canvas.js").StrokeState}
         */
        _this.strokeState_ = null;
        /**
         * @private
         * @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
         */
        _this.image_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.imageAnchorX_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.imageAnchorY_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.imageHeight_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.imageOpacity_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.imageOriginX_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.imageOriginY_ = 0;
        /**
         * @private
         * @type {boolean}
         */
        _this.imageRotateWithView_ = false;
        /**
         * @private
         * @type {number}
         */
        _this.imageRotation_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.imageScale_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.imageWidth_ = 0;
        /**
         * @private
         * @type {string}
         */
        _this.text_ = '';
        /**
         * @private
         * @type {number}
         */
        _this.textOffsetX_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.textOffsetY_ = 0;
        /**
         * @private
         * @type {boolean}
         */
        _this.textRotateWithView_ = false;
        /**
         * @private
         * @type {number}
         */
        _this.textRotation_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.textScale_ = 0;
        /**
         * @private
         * @type {?import("../canvas.js").FillState}
         */
        _this.textFillState_ = null;
        /**
         * @private
         * @type {?import("../canvas.js").StrokeState}
         */
        _this.textStrokeState_ = null;
        /**
         * @private
         * @type {?import("../canvas.js").TextState}
         */
        _this.textState_ = null;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.pixelCoordinates_ = [];
        /**
         * @private
         * @type {import("../../transform.js").Transform}
         */
        _this.tmpLocalTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["create"])();
        return _this;
    }
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {number} end End.
     * @param {number} stride Stride.
     * @private
     */
    CanvasImmediateRenderer.prototype.drawImages_ = function (flatCoordinates, offset, end, stride) {
        if (!this.image_) {
            return;
        }
        var pixelCoordinates = Object(_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_5__["transform2D"])(flatCoordinates, offset, end, 2, this.transform_, this.pixelCoordinates_);
        var context = this.context_;
        var localTransform = this.tmpLocalTransform_;
        var alpha = context.globalAlpha;
        if (this.imageOpacity_ != 1) {
            context.globalAlpha = alpha * this.imageOpacity_;
        }
        var rotation = this.imageRotation_;
        if (this.imageRotateWithView_) {
            rotation += this.viewRotation_;
        }
        for (var i = 0, ii = pixelCoordinates.length; i < ii; i += 2) {
            var x = pixelCoordinates[i] - this.imageAnchorX_;
            var y = pixelCoordinates[i + 1] - this.imageAnchorY_;
            if (rotation !== 0 || this.imageScale_ != 1) {
                var centerX = x + this.imageAnchorX_;
                var centerY = y + this.imageAnchorY_;
                Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["compose"])(localTransform, centerX, centerY, this.imageScale_, this.imageScale_, rotation, -centerX, -centerY);
                context.setTransform.apply(context, localTransform);
            }
            context.drawImage(this.image_, this.imageOriginX_, this.imageOriginY_, this.imageWidth_, this.imageHeight_, x, y, this.imageWidth_, this.imageHeight_);
        }
        if (rotation !== 0 || this.imageScale_ != 1) {
            context.setTransform(1, 0, 0, 1, 0, 0);
        }
        if (this.imageOpacity_ != 1) {
            context.globalAlpha = alpha;
        }
    };
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {number} end End.
     * @param {number} stride Stride.
     * @private
     */
    CanvasImmediateRenderer.prototype.drawText_ = function (flatCoordinates, offset, end, stride) {
        if (!this.textState_ || this.text_ === '') {
            return;
        }
        if (this.textFillState_) {
            this.setContextFillState_(this.textFillState_);
        }
        if (this.textStrokeState_) {
            this.setContextStrokeState_(this.textStrokeState_);
        }
        this.setContextTextState_(this.textState_);
        var pixelCoordinates = Object(_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_5__["transform2D"])(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_);
        var context = this.context_;
        var rotation = this.textRotation_;
        if (this.textRotateWithView_) {
            rotation += this.viewRotation_;
        }
        for (; offset < end; offset += stride) {
            var x = pixelCoordinates[offset] + this.textOffsetX_;
            var y = pixelCoordinates[offset + 1] + this.textOffsetY_;
            if (rotation !== 0 || this.textScale_ != 1) {
                var localTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__["compose"])(this.tmpLocalTransform_, x, y, this.textScale_, this.textScale_, rotation, -x, -y);
                context.setTransform.apply(context, localTransform);
            }
            if (this.textStrokeState_) {
                context.strokeText(this.text_, x, y);
            }
            if (this.textFillState_) {
                context.fillText(this.text_, x, y);
            }
        }
        if (rotation !== 0 || this.textScale_ != 1) {
            context.setTransform(1, 0, 0, 1, 0, 0);
        }
    };
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {number} end End.
     * @param {number} stride Stride.
     * @param {boolean} close Close.
     * @private
     * @return {number} end End.
     */
    CanvasImmediateRenderer.prototype.moveToLineTo_ = function (flatCoordinates, offset, end, stride, close) {
        var context = this.context_;
        var pixelCoordinates = Object(_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_5__["transform2D"])(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_);
        context.moveTo(pixelCoordinates[0], pixelCoordinates[1]);
        var length = pixelCoordinates.length;
        if (close) {
            length -= 2;
        }
        for (var i = 2; i < length; i += 2) {
            context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]);
        }
        if (close) {
            context.closePath();
        }
        return end;
    };
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {Array<number>} ends Ends.
     * @param {number} stride Stride.
     * @private
     * @return {number} End.
     */
    CanvasImmediateRenderer.prototype.drawRings_ = function (flatCoordinates, offset, ends, stride) {
        for (var i = 0, ii = ends.length; i < ii; ++i) {
            offset = this.moveToLineTo_(flatCoordinates, offset, ends[i], stride, true);
        }
        return offset;
    };
    /**
     * Render a circle geometry into the canvas.  Rendering is immediate and uses
     * the current fill and stroke styles.
     *
     * @param {import("../../geom/Circle.js").default} geometry Circle geometry.
     * @override
     * @api
     */
    CanvasImmediateRenderer.prototype.drawCircle = function (geometry) {
        if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(this.extent_, geometry.getExtent())) {
            return;
        }
        if (this.fillState_ || this.strokeState_) {
            if (this.fillState_) {
                this.setContextFillState_(this.fillState_);
            }
            if (this.strokeState_) {
                this.setContextStrokeState_(this.strokeState_);
            }
            var pixelCoordinates = Object(_geom_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_4__["transformGeom2D"])(geometry, this.transform_, this.pixelCoordinates_);
            var dx = pixelCoordinates[2] - pixelCoordinates[0];
            var dy = pixelCoordinates[3] - pixelCoordinates[1];
            var radius = Math.sqrt(dx * dx + dy * dy);
            var context = this.context_;
            context.beginPath();
            context.arc(pixelCoordinates[0], pixelCoordinates[1], radius, 0, 2 * Math.PI);
            if (this.fillState_) {
                context.fill();
            }
            if (this.strokeState_) {
                context.stroke();
            }
        }
        if (this.text_ !== '') {
            this.drawText_(geometry.getCenter(), 0, 2, 2);
        }
    };
    /**
     * Set the rendering style.  Note that since this is an immediate rendering API,
     * any `zIndex` on the provided style will be ignored.
     *
     * @param {import("../../style/Style.js").default} style The rendering style.
     * @override
     * @api
     */
    CanvasImmediateRenderer.prototype.setStyle = function (style) {
        this.setFillStrokeStyle(style.getFill(), style.getStroke());
        this.setImageStyle(style.getImage());
        this.setTextStyle(style.getText());
    };
    /**
     * @param {import("../../transform.js").Transform} transform Transform.
     */
    CanvasImmediateRenderer.prototype.setTransform = function (transform) {
        this.transform_ = transform;
    };
    /**
     * Render a geometry into the canvas.  Call
     * {@link module:ol/render/canvas/Immediate#setStyle} first to set the rendering style.
     *
     * @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
     * @override
     * @api
     */
    CanvasImmediateRenderer.prototype.drawGeometry = function (geometry) {
        var type = geometry.getType();
        switch (type) {
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POINT:
                this.drawPoint(/** @type {import("../../geom/Point.js").default} */ (geometry));
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].LINE_STRING:
                this.drawLineString(/** @type {import("../../geom/LineString.js").default} */ (geometry));
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POLYGON:
                this.drawPolygon(/** @type {import("../../geom/Polygon.js").default} */ (geometry));
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].MULTI_POINT:
                this.drawMultiPoint(/** @type {import("../../geom/MultiPoint.js").default} */ (geometry));
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].MULTI_LINE_STRING:
                this.drawMultiLineString(/** @type {import("../../geom/MultiLineString.js").default} */ (geometry));
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].MULTI_POLYGON:
                this.drawMultiPolygon(/** @type {import("../../geom/MultiPolygon.js").default} */ (geometry));
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].GEOMETRY_COLLECTION:
                this.drawGeometryCollection(/** @type {import("../../geom/GeometryCollection.js").default} */ (geometry));
                break;
            case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].CIRCLE:
                this.drawCircle(/** @type {import("../../geom/Circle.js").default} */ (geometry));
                break;
            default:
        }
    };
    /**
     * Render a feature into the canvas.  Note that any `zIndex` on the provided
     * style will be ignored - features are rendered immediately in the order that
     * this method is called.  If you need `zIndex` support, you should be using an
     * {@link module:ol/layer/Vector~VectorLayer} instead.
     *
     * @param {import("../../Feature.js").default} feature Feature.
     * @param {import("../../style/Style.js").default} style Style.
     * @override
     * @api
     */
    CanvasImmediateRenderer.prototype.drawFeature = function (feature, style) {
        var geometry = style.getGeometryFunction()(feature);
        if (!geometry || !Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(this.extent_, geometry.getExtent())) {
            return;
        }
        this.setStyle(style);
        this.drawGeometry(geometry);
    };
    /**
     * Render a GeometryCollection to the canvas.  Rendering is immediate and
     * uses the current styles appropriate for each geometry in the collection.
     *
     * @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
     * @override
     */
    CanvasImmediateRenderer.prototype.drawGeometryCollection = function (geometry) {
        var geometries = geometry.getGeometriesArray();
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            this.drawGeometry(geometries[i]);
        }
    };
    /**
     * Render a Point geometry into the canvas.  Rendering is immediate and uses
     * the current style.
     *
     * @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
     * @override
     */
    CanvasImmediateRenderer.prototype.drawPoint = function (geometry) {
        if (this.squaredTolerance_) {
            geometry = /** @type {import("../../geom/Point.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
        }
        var flatCoordinates = geometry.getFlatCoordinates();
        var stride = geometry.getStride();
        if (this.image_) {
            this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
        }
        if (this.text_ !== '') {
            this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);
        }
    };
    /**
     * Render a MultiPoint geometry  into the canvas.  Rendering is immediate and
     * uses the current style.
     *
     * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
     * @override
     */
    CanvasImmediateRenderer.prototype.drawMultiPoint = function (geometry) {
        if (this.squaredTolerance_) {
            geometry = /** @type {import("../../geom/MultiPoint.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
        }
        var flatCoordinates = geometry.getFlatCoordinates();
        var stride = geometry.getStride();
        if (this.image_) {
            this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
        }
        if (this.text_ !== '') {
            this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);
        }
    };
    /**
     * Render a LineString into the canvas.  Rendering is immediate and uses
     * the current style.
     *
     * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
     * @override
     */
    CanvasImmediateRenderer.prototype.drawLineString = function (geometry) {
        if (this.squaredTolerance_) {
            geometry = /** @type {import("../../geom/LineString.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
        }
        if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(this.extent_, geometry.getExtent())) {
            return;
        }
        if (this.strokeState_) {
            this.setContextStrokeState_(this.strokeState_);
            var context = this.context_;
            var flatCoordinates = geometry.getFlatCoordinates();
            context.beginPath();
            this.moveToLineTo_(flatCoordinates, 0, flatCoordinates.length, geometry.getStride(), false);
            context.stroke();
        }
        if (this.text_ !== '') {
            var flatMidpoint = geometry.getFlatMidpoint();
            this.drawText_(flatMidpoint, 0, 2, 2);
        }
    };
    /**
     * Render a MultiLineString geometry into the canvas.  Rendering is immediate
     * and uses the current style.
     *
     * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
     * @override
     */
    CanvasImmediateRenderer.prototype.drawMultiLineString = function (geometry) {
        if (this.squaredTolerance_) {
            geometry = /** @type {import("../../geom/MultiLineString.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
        }
        var geometryExtent = geometry.getExtent();
        if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(this.extent_, geometryExtent)) {
            return;
        }
        if (this.strokeState_) {
            this.setContextStrokeState_(this.strokeState_);
            var context = this.context_;
            var flatCoordinates = geometry.getFlatCoordinates();
            var offset = 0;
            var ends = /** @type {Array<number>} */ (geometry.getEnds());
            var stride = geometry.getStride();
            context.beginPath();
            for (var i = 0, ii = ends.length; i < ii; ++i) {
                offset = this.moveToLineTo_(flatCoordinates, offset, ends[i], stride, false);
            }
            context.stroke();
        }
        if (this.text_ !== '') {
            var flatMidpoints = geometry.getFlatMidpoints();
            this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2);
        }
    };
    /**
     * Render a Polygon geometry into the canvas.  Rendering is immediate and uses
     * the current style.
     *
     * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
     * @override
     */
    CanvasImmediateRenderer.prototype.drawPolygon = function (geometry) {
        if (this.squaredTolerance_) {
            geometry = /** @type {import("../../geom/Polygon.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
        }
        if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(this.extent_, geometry.getExtent())) {
            return;
        }
        if (this.strokeState_ || this.fillState_) {
            if (this.fillState_) {
                this.setContextFillState_(this.fillState_);
            }
            if (this.strokeState_) {
                this.setContextStrokeState_(this.strokeState_);
            }
            var context = this.context_;
            context.beginPath();
            this.drawRings_(geometry.getOrientedFlatCoordinates(), 0, /** @type {Array<number>} */ (geometry.getEnds()), geometry.getStride());
            if (this.fillState_) {
                context.fill();
            }
            if (this.strokeState_) {
                context.stroke();
            }
        }
        if (this.text_ !== '') {
            var flatInteriorPoint = geometry.getFlatInteriorPoint();
            this.drawText_(flatInteriorPoint, 0, 2, 2);
        }
    };
    /**
     * Render MultiPolygon geometry into the canvas.  Rendering is immediate and
     * uses the current style.
     * @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
     * @override
     */
    CanvasImmediateRenderer.prototype.drawMultiPolygon = function (geometry) {
        if (this.squaredTolerance_) {
            geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
        }
        if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(this.extent_, geometry.getExtent())) {
            return;
        }
        if (this.strokeState_ || this.fillState_) {
            if (this.fillState_) {
                this.setContextFillState_(this.fillState_);
            }
            if (this.strokeState_) {
                this.setContextStrokeState_(this.strokeState_);
            }
            var context = this.context_;
            var flatCoordinates = geometry.getOrientedFlatCoordinates();
            var offset = 0;
            var endss = geometry.getEndss();
            var stride = geometry.getStride();
            context.beginPath();
            for (var i = 0, ii = endss.length; i < ii; ++i) {
                var ends = endss[i];
                offset = this.drawRings_(flatCoordinates, offset, ends, stride);
            }
            if (this.fillState_) {
                context.fill();
            }
            if (this.strokeState_) {
                context.stroke();
            }
        }
        if (this.text_ !== '') {
            var flatInteriorPoints = geometry.getFlatInteriorPoints();
            this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2);
        }
    };
    /**
     * @param {import("../canvas.js").FillState} fillState Fill state.
     * @private
     */
    CanvasImmediateRenderer.prototype.setContextFillState_ = function (fillState) {
        var context = this.context_;
        var contextFillState = this.contextFillState_;
        if (!contextFillState) {
            context.fillStyle = fillState.fillStyle;
            this.contextFillState_ = {
                fillStyle: fillState.fillStyle
            };
        }
        else {
            if (contextFillState.fillStyle != fillState.fillStyle) {
                contextFillState.fillStyle = fillState.fillStyle;
                context.fillStyle = fillState.fillStyle;
            }
        }
    };
    /**
     * @param {import("../canvas.js").StrokeState} strokeState Stroke state.
     * @private
     */
    CanvasImmediateRenderer.prototype.setContextStrokeState_ = function (strokeState) {
        var context = this.context_;
        var contextStrokeState = this.contextStrokeState_;
        if (!contextStrokeState) {
            context.lineCap = strokeState.lineCap;
            if (context.setLineDash) {
                context.setLineDash(strokeState.lineDash);
                context.lineDashOffset = strokeState.lineDashOffset;
            }
            context.lineJoin = strokeState.lineJoin;
            context.lineWidth = strokeState.lineWidth;
            context.miterLimit = strokeState.miterLimit;
            context.strokeStyle = strokeState.strokeStyle;
            this.contextStrokeState_ = {
                lineCap: strokeState.lineCap,
                lineDash: strokeState.lineDash,
                lineDashOffset: strokeState.lineDashOffset,
                lineJoin: strokeState.lineJoin,
                lineWidth: strokeState.lineWidth,
                miterLimit: strokeState.miterLimit,
                strokeStyle: strokeState.strokeStyle
            };
        }
        else {
            if (contextStrokeState.lineCap != strokeState.lineCap) {
                contextStrokeState.lineCap = strokeState.lineCap;
                context.lineCap = strokeState.lineCap;
            }
            if (context.setLineDash) {
                if (!Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["equals"])(contextStrokeState.lineDash, strokeState.lineDash)) {
                    context.setLineDash(contextStrokeState.lineDash = strokeState.lineDash);
                }
                if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {
                    contextStrokeState.lineDashOffset = strokeState.lineDashOffset;
                    context.lineDashOffset = strokeState.lineDashOffset;
                }
            }
            if (contextStrokeState.lineJoin != strokeState.lineJoin) {
                contextStrokeState.lineJoin = strokeState.lineJoin;
                context.lineJoin = strokeState.lineJoin;
            }
            if (contextStrokeState.lineWidth != strokeState.lineWidth) {
                contextStrokeState.lineWidth = strokeState.lineWidth;
                context.lineWidth = strokeState.lineWidth;
            }
            if (contextStrokeState.miterLimit != strokeState.miterLimit) {
                contextStrokeState.miterLimit = strokeState.miterLimit;
                context.miterLimit = strokeState.miterLimit;
            }
            if (contextStrokeState.strokeStyle != strokeState.strokeStyle) {
                contextStrokeState.strokeStyle = strokeState.strokeStyle;
                context.strokeStyle = strokeState.strokeStyle;
            }
        }
    };
    /**
     * @param {import("../canvas.js").TextState} textState Text state.
     * @private
     */
    CanvasImmediateRenderer.prototype.setContextTextState_ = function (textState) {
        var context = this.context_;
        var contextTextState = this.contextTextState_;
        var textAlign = textState.textAlign ?
            textState.textAlign : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultTextAlign"];
        if (!contextTextState) {
            context.font = textState.font;
            context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
            context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
            this.contextTextState_ = {
                font: textState.font,
                textAlign: textAlign,
                textBaseline: textState.textBaseline
            };
        }
        else {
            if (contextTextState.font != textState.font) {
                contextTextState.font = textState.font;
                context.font = textState.font;
            }
            if (contextTextState.textAlign != textAlign) {
                contextTextState.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
                context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
            }
            if (contextTextState.textBaseline != textState.textBaseline) {
                contextTextState.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
                context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
            }
        }
    };
    /**
     * Set the fill and stroke style for subsequent draw operations.  To clear
     * either fill or stroke styles, pass null for the appropriate parameter.
     *
     * @param {import("../../style/Fill.js").default} fillStyle Fill style.
     * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
     * @override
     */
    CanvasImmediateRenderer.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) {
        if (!fillStyle) {
            this.fillState_ = null;
        }
        else {
            var fillStyleColor = fillStyle.getColor();
            this.fillState_ = {
                fillStyle: Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(fillStyleColor ?
                    fillStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultFillStyle"])
            };
        }
        if (!strokeStyle) {
            this.strokeState_ = null;
        }
        else {
            var strokeStyleColor = strokeStyle.getColor();
            var strokeStyleLineCap = strokeStyle.getLineCap();
            var strokeStyleLineDash = strokeStyle.getLineDash();
            var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
            var strokeStyleLineJoin = strokeStyle.getLineJoin();
            var strokeStyleWidth = strokeStyle.getWidth();
            var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
            this.strokeState_ = {
                lineCap: strokeStyleLineCap !== undefined ?
                    strokeStyleLineCap : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineCap"],
                lineDash: strokeStyleLineDash ?
                    strokeStyleLineDash : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineDash"],
                lineDashOffset: strokeStyleLineDashOffset ?
                    strokeStyleLineDashOffset : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineDashOffset"],
                lineJoin: strokeStyleLineJoin !== undefined ?
                    strokeStyleLineJoin : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineJoin"],
                lineWidth: this.pixelRatio_ * (strokeStyleWidth !== undefined ?
                    strokeStyleWidth : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineWidth"]),
                miterLimit: strokeStyleMiterLimit !== undefined ?
                    strokeStyleMiterLimit : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultMiterLimit"],
                strokeStyle: Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(strokeStyleColor ?
                    strokeStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultStrokeStyle"])
            };
        }
    };
    /**
     * Set the image style for subsequent draw operations.  Pass null to remove
     * the image style.
     *
     * @param {import("../../style/Image.js").default} imageStyle Image style.
     * @override
     */
    CanvasImmediateRenderer.prototype.setImageStyle = function (imageStyle) {
        if (!imageStyle) {
            this.image_ = null;
        }
        else {
            var imageAnchor = imageStyle.getAnchor();
            // FIXME pixel ratio
            var imageImage = imageStyle.getImage(1);
            var imageOrigin = imageStyle.getOrigin();
            var imageSize = imageStyle.getSize();
            this.imageAnchorX_ = imageAnchor[0];
            this.imageAnchorY_ = imageAnchor[1];
            this.imageHeight_ = imageSize[1];
            this.image_ = imageImage;
            this.imageOpacity_ = imageStyle.getOpacity();
            this.imageOriginX_ = imageOrigin[0];
            this.imageOriginY_ = imageOrigin[1];
            this.imageRotateWithView_ = imageStyle.getRotateWithView();
            this.imageRotation_ = imageStyle.getRotation();
            this.imageScale_ = imageStyle.getScale() * this.pixelRatio_;
            this.imageWidth_ = imageSize[0];
        }
    };
    /**
     * Set the text style for subsequent draw operations.  Pass null to
     * remove the text style.
     *
     * @param {import("../../style/Text.js").default} textStyle Text style.
     * @override
     */
    CanvasImmediateRenderer.prototype.setTextStyle = function (textStyle) {
        if (!textStyle) {
            this.text_ = '';
        }
        else {
            var textFillStyle = textStyle.getFill();
            if (!textFillStyle) {
                this.textFillState_ = null;
            }
            else {
                var textFillStyleColor = textFillStyle.getColor();
                this.textFillState_ = {
                    fillStyle: Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(textFillStyleColor ?
                        textFillStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultFillStyle"])
                };
            }
            var textStrokeStyle = textStyle.getStroke();
            if (!textStrokeStyle) {
                this.textStrokeState_ = null;
            }
            else {
                var textStrokeStyleColor = textStrokeStyle.getColor();
                var textStrokeStyleLineCap = textStrokeStyle.getLineCap();
                var textStrokeStyleLineDash = textStrokeStyle.getLineDash();
                var textStrokeStyleLineDashOffset = textStrokeStyle.getLineDashOffset();
                var textStrokeStyleLineJoin = textStrokeStyle.getLineJoin();
                var textStrokeStyleWidth = textStrokeStyle.getWidth();
                var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();
                this.textStrokeState_ = {
                    lineCap: textStrokeStyleLineCap !== undefined ?
                        textStrokeStyleLineCap : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineCap"],
                    lineDash: textStrokeStyleLineDash ?
                        textStrokeStyleLineDash : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineDash"],
                    lineDashOffset: textStrokeStyleLineDashOffset ?
                        textStrokeStyleLineDashOffset : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineDashOffset"],
                    lineJoin: textStrokeStyleLineJoin !== undefined ?
                        textStrokeStyleLineJoin : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineJoin"],
                    lineWidth: textStrokeStyleWidth !== undefined ?
                        textStrokeStyleWidth : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultLineWidth"],
                    miterLimit: textStrokeStyleMiterLimit !== undefined ?
                        textStrokeStyleMiterLimit : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultMiterLimit"],
                    strokeStyle: Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(textStrokeStyleColor ?
                        textStrokeStyleColor : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultStrokeStyle"])
                };
            }
            var textFont = textStyle.getFont();
            var textOffsetX = textStyle.getOffsetX();
            var textOffsetY = textStyle.getOffsetY();
            var textRotateWithView = textStyle.getRotateWithView();
            var textRotation = textStyle.getRotation();
            var textScale = textStyle.getScale();
            var textText = textStyle.getText();
            var textTextAlign = textStyle.getTextAlign();
            var textTextBaseline = textStyle.getTextBaseline();
            this.textState_ = {
                font: textFont !== undefined ?
                    textFont : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultFont"],
                textAlign: textTextAlign !== undefined ?
                    textTextAlign : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultTextAlign"],
                textBaseline: textTextBaseline !== undefined ?
                    textTextBaseline : _canvas_js__WEBPACK_IMPORTED_MODULE_7__["defaultTextBaseline"]
            };
            this.text_ = textText !== undefined ? textText : '';
            this.textOffsetX_ =
                textOffsetX !== undefined ? (this.pixelRatio_ * textOffsetX) : 0;
            this.textOffsetY_ =
                textOffsetY !== undefined ? (this.pixelRatio_ * textOffsetY) : 0;
            this.textRotateWithView_ = textRotateWithView !== undefined ? textRotateWithView : false;
            this.textRotation_ = textRotation !== undefined ? textRotation : 0;
            this.textScale_ = this.pixelRatio_ * (textScale !== undefined ?
                textScale : 1);
        }
    };
    return CanvasImmediateRenderer;
}(_VectorContext_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasImmediateRenderer);
//# sourceMappingURL=Immediate.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/Instruction.js":
/*!******************************************************!*\
  !*** ./node_modules/ol/render/canvas/Instruction.js ***!
  \******************************************************/
/*! exports provided: fillInstruction, strokeInstruction, beginPathInstruction, closePathInstruction, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fillInstruction", function() { return fillInstruction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strokeInstruction", function() { return strokeInstruction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "beginPathInstruction", function() { return beginPathInstruction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closePathInstruction", function() { return closePathInstruction; });
/**
 * @module ol/render/canvas/Instruction
 */
/**
 * @enum {number}
 */
var Instruction = {
    BEGIN_GEOMETRY: 0,
    BEGIN_PATH: 1,
    CIRCLE: 2,
    CLOSE_PATH: 3,
    CUSTOM: 4,
    DRAW_CHARS: 5,
    DRAW_IMAGE: 6,
    END_GEOMETRY: 7,
    FILL: 8,
    MOVE_TO_LINE_TO: 9,
    SET_FILL_STYLE: 10,
    SET_STROKE_STYLE: 11,
    STROKE: 12
};
/**
 * @type {Array<Instruction>}
 */
var fillInstruction = [Instruction.FILL];
/**
 * @type {Array<Instruction>}
 */
var strokeInstruction = [Instruction.STROKE];
/**
 * @type {Array<Instruction>}
 */
var beginPathInstruction = [Instruction.BEGIN_PATH];
/**
 * @type {Array<Instruction>}
 */
var closePathInstruction = [Instruction.CLOSE_PATH];
/* harmony default export */ __webpack_exports__["default"] = (Instruction);
//# sourceMappingURL=Instruction.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/LineStringBuilder.js":
/*!************************************************************!*\
  !*** ./node_modules/ol/render/canvas/LineStringBuilder.js ***!
  \************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/ol/render/canvas/Instruction.js");
/* harmony import */ var _Builder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Builder.js */ "./node_modules/ol/render/canvas/Builder.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/render/canvas/LineStringBuilder
 */


var CanvasLineStringBuilder = /** @class */ (function (_super) {
    __extends(CanvasLineStringBuilder, _super);
    /**
     * @param {number} tolerance Tolerance.
     * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     */
    function CanvasLineStringBuilder(tolerance, maxExtent, resolution, pixelRatio) {
        return _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
    }
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {number} end End.
     * @param {number} stride Stride.
     * @private
     * @return {number} end.
     */
    CanvasLineStringBuilder.prototype.drawFlatCoordinates_ = function (flatCoordinates, offset, end, stride) {
        var myBegin = this.coordinates.length;
        var myEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false, false);
        var moveToLineToInstruction = [_Instruction_js__WEBPACK_IMPORTED_MODULE_0__["default"].MOVE_TO_LINE_TO, myBegin, myEnd];
        this.instructions.push(moveToLineToInstruction);
        this.hitDetectionInstructions.push(moveToLineToInstruction);
        return end;
    };
    /**
     * @inheritDoc
     */
    CanvasLineStringBuilder.prototype.drawLineString = function (lineStringGeometry, feature) {
        var state = this.state;
        var strokeStyle = state.strokeStyle;
        var lineWidth = state.lineWidth;
        if (strokeStyle === undefined || lineWidth === undefined) {
            return;
        }
        this.updateStrokeStyle(state, this.applyStroke);
        this.beginGeometry(lineStringGeometry, feature);
        this.hitDetectionInstructions.push([
            _Instruction_js__WEBPACK_IMPORTED_MODULE_0__["default"].SET_STROKE_STYLE,
            state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
            state.miterLimit, state.lineDash, state.lineDashOffset
        ], _Instruction_js__WEBPACK_IMPORTED_MODULE_0__["beginPathInstruction"]);
        var flatCoordinates = lineStringGeometry.getFlatCoordinates();
        var stride = lineStringGeometry.getStride();
        this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
        this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_0__["strokeInstruction"]);
        this.endGeometry(feature);
    };
    /**
     * @inheritDoc
     */
    CanvasLineStringBuilder.prototype.drawMultiLineString = function (multiLineStringGeometry, feature) {
        var state = this.state;
        var strokeStyle = state.strokeStyle;
        var lineWidth = state.lineWidth;
        if (strokeStyle === undefined || lineWidth === undefined) {
            return;
        }
        this.updateStrokeStyle(state, this.applyStroke);
        this.beginGeometry(multiLineStringGeometry, feature);
        this.hitDetectionInstructions.push([
            _Instruction_js__WEBPACK_IMPORTED_MODULE_0__["default"].SET_STROKE_STYLE,
            state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
            state.miterLimit, state.lineDash, state.lineDashOffset
        ], _Instruction_js__WEBPACK_IMPORTED_MODULE_0__["beginPathInstruction"]);
        var ends = multiLineStringGeometry.getEnds();
        var flatCoordinates = multiLineStringGeometry.getFlatCoordinates();
        var stride = multiLineStringGeometry.getStride();
        var offset = 0;
        for (var i = 0, ii = ends.length; i < ii; ++i) {
            offset = this.drawFlatCoordinates_(flatCoordinates, offset, ends[i], stride);
        }
        this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_0__["strokeInstruction"]);
        this.endGeometry(feature);
    };
    /**
     * @inheritDoc
     */
    CanvasLineStringBuilder.prototype.finish = function () {
        var state = this.state;
        if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) {
            this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_0__["strokeInstruction"]);
        }
        this.reverseHitDetectionInstructions();
        this.state = null;
        return _super.prototype.finish.call(this);
    };
    /**
     * @inheritDoc.
     */
    CanvasLineStringBuilder.prototype.applyStroke = function (state) {
        if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) {
            this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_0__["strokeInstruction"]);
            state.lastStroke = this.coordinates.length;
        }
        state.lastStroke = 0;
        _super.prototype.applyStroke.call(this, state);
        this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_0__["beginPathInstruction"]);
    };
    return CanvasLineStringBuilder;
}(_Builder_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasLineStringBuilder);
//# sourceMappingURL=LineStringBuilder.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/PolygonBuilder.js":
/*!*********************************************************!*\
  !*** ./node_modules/ol/render/canvas/PolygonBuilder.js ***!
  \*********************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _geom_flat_simplify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../geom/flat/simplify.js */ "./node_modules/ol/geom/flat/simplify.js");
/* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/ol/render/canvas.js");
/* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/ol/render/canvas/Instruction.js");
/* harmony import */ var _Builder_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Builder.js */ "./node_modules/ol/render/canvas/Builder.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/render/canvas/PolygonBuilder
 */




var CanvasPolygonBuilder = /** @class */ (function (_super) {
    __extends(CanvasPolygonBuilder, _super);
    /**
     * @param {number} tolerance Tolerance.
     * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     */
    function CanvasPolygonBuilder(tolerance, maxExtent, resolution, pixelRatio) {
        return _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
    }
    /**
     * @param {Array<number>} flatCoordinates Flat coordinates.
     * @param {number} offset Offset.
     * @param {Array<number>} ends Ends.
     * @param {number} stride Stride.
     * @private
     * @return {number} End.
     */
    CanvasPolygonBuilder.prototype.drawFlatCoordinatess_ = function (flatCoordinates, offset, ends, stride) {
        var state = this.state;
        var fill = state.fillStyle !== undefined;
        var stroke = state.strokeStyle !== undefined;
        var numEnds = ends.length;
        this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["beginPathInstruction"]);
        this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["beginPathInstruction"]);
        for (var i = 0; i < numEnds; ++i) {
            var end = ends[i];
            var myBegin = this.coordinates.length;
            var myEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride, true, !stroke);
            var moveToLineToInstruction = [_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["default"].MOVE_TO_LINE_TO, myBegin, myEnd];
            this.instructions.push(moveToLineToInstruction);
            this.hitDetectionInstructions.push(moveToLineToInstruction);
            if (stroke) {
                // Performance optimization: only call closePath() when we have a stroke.
                // Otherwise the ring is closed already (see appendFlatCoordinates above).
                this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["closePathInstruction"]);
                this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["closePathInstruction"]);
            }
            offset = end;
        }
        if (fill) {
            this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["fillInstruction"]);
            this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["fillInstruction"]);
        }
        if (stroke) {
            this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["strokeInstruction"]);
            this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["strokeInstruction"]);
        }
        return offset;
    };
    /**
     * @inheritDoc
     */
    CanvasPolygonBuilder.prototype.drawCircle = function (circleGeometry, feature) {
        var state = this.state;
        var fillStyle = state.fillStyle;
        var strokeStyle = state.strokeStyle;
        if (fillStyle === undefined && strokeStyle === undefined) {
            return;
        }
        this.setFillStrokeStyles_();
        this.beginGeometry(circleGeometry, feature);
        if (state.fillStyle !== undefined) {
            this.hitDetectionInstructions.push([
                _Instruction_js__WEBPACK_IMPORTED_MODULE_2__["default"].SET_FILL_STYLE,
                _canvas_js__WEBPACK_IMPORTED_MODULE_1__["defaultFillStyle"]
            ]);
        }
        if (state.strokeStyle !== undefined) {
            this.hitDetectionInstructions.push([
                _Instruction_js__WEBPACK_IMPORTED_MODULE_2__["default"].SET_STROKE_STYLE,
                state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
                state.miterLimit, state.lineDash, state.lineDashOffset
            ]);
        }
        var flatCoordinates = circleGeometry.getFlatCoordinates();
        var stride = circleGeometry.getStride();
        var myBegin = this.coordinates.length;
        this.appendFlatCoordinates(flatCoordinates, 0, flatCoordinates.length, stride, false, false);
        var circleInstruction = [_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["default"].CIRCLE, myBegin];
        this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["beginPathInstruction"], circleInstruction);
        this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["beginPathInstruction"], circleInstruction);
        if (state.fillStyle !== undefined) {
            this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["fillInstruction"]);
            this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["fillInstruction"]);
        }
        if (state.strokeStyle !== undefined) {
            this.instructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["strokeInstruction"]);
            this.hitDetectionInstructions.push(_Instruction_js__WEBPACK_IMPORTED_MODULE_2__["strokeInstruction"]);
        }
        this.endGeometry(feature);
    };
    /**
     * @inheritDoc
     */
    CanvasPolygonBuilder.prototype.drawPolygon = function (polygonGeometry, feature) {
        var state = this.state;
        var fillStyle = state.fillStyle;
        var strokeStyle = state.strokeStyle;
        if (fillStyle === undefined && strokeStyle === undefined) {
            return;
        }
        this.setFillStrokeStyles_();
        this.beginGeometry(polygonGeometry, feature);
        if (state.fillStyle !== undefined) {
            this.hitDetectionInstructions.push([
                _Instruction_js__WEBPACK_IMPORTED_MODULE_2__["default"].SET_FILL_STYLE,
                _canvas_js__WEBPACK_IMPORTED_MODULE_1__["defaultFillStyle"]
            ]);
        }
        if (state.strokeStyle !== undefined) {
            this.hitDetectionInstructions.push([
                _Instruction_js__WEBPACK_IMPORTED_MODULE_2__["default"].SET_STROKE_STYLE,
                state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
                state.miterLimit, state.lineDash, state.lineDashOffset
            ]);
        }
        var ends = polygonGeometry.getEnds();
        var flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
        var stride = polygonGeometry.getStride();
        this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride);
        this.endGeometry(feature);
    };
    /**
     * @inheritDoc
     */
    CanvasPolygonBuilder.prototype.drawMultiPolygon = function (multiPolygonGeometry, feature) {
        var state = this.state;
        var fillStyle = state.fillStyle;
        var strokeStyle = state.strokeStyle;
        if (fillStyle === undefined && strokeStyle === undefined) {
            return;
        }
        this.setFillStrokeStyles_();
        this.beginGeometry(multiPolygonGeometry, feature);
        if (state.fillStyle !== undefined) {
            this.hitDetectionInstructions.push([
                _Instruction_js__WEBPACK_IMPORTED_MODULE_2__["default"].SET_FILL_STYLE,
                _canvas_js__WEBPACK_IMPORTED_MODULE_1__["defaultFillStyle"]
            ]);
        }
        if (state.strokeStyle !== undefined) {
            this.hitDetectionInstructions.push([
                _Instruction_js__WEBPACK_IMPORTED_MODULE_2__["default"].SET_STROKE_STYLE,
                state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
                state.miterLimit, state.lineDash, state.lineDashOffset
            ]);
        }
        var endss = multiPolygonGeometry.getEndss();
        var flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();
        var stride = multiPolygonGeometry.getStride();
        var offset = 0;
        for (var i = 0, ii = endss.length; i < ii; ++i) {
            offset = this.drawFlatCoordinatess_(flatCoordinates, offset, endss[i], stride);
        }
        this.endGeometry(feature);
    };
    /**
     * @inheritDoc
     */
    CanvasPolygonBuilder.prototype.finish = function () {
        this.reverseHitDetectionInstructions();
        this.state = null;
        // We want to preserve topology when drawing polygons.  Polygons are
        // simplified using quantization and point elimination. However, we might
        // have received a mix of quantized and non-quantized geometries, so ensure
        // that all are quantized by quantizing all coordinates in the batch.
        var tolerance = this.tolerance;
        if (tolerance !== 0) {
            var coordinates = this.coordinates;
            for (var i = 0, ii = coordinates.length; i < ii; ++i) {
                coordinates[i] = Object(_geom_flat_simplify_js__WEBPACK_IMPORTED_MODULE_0__["snap"])(coordinates[i], tolerance);
            }
        }
        return _super.prototype.finish.call(this);
    };
    /**
     * @private
     */
    CanvasPolygonBuilder.prototype.setFillStrokeStyles_ = function () {
        var state = this.state;
        var fillStyle = state.fillStyle;
        if (fillStyle !== undefined) {
            this.updateFillStyle(state, this.createFill);
        }
        if (state.strokeStyle !== undefined) {
            this.updateStrokeStyle(state, this.applyStroke);
        }
    };
    return CanvasPolygonBuilder;
}(_Builder_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasPolygonBuilder);
//# sourceMappingURL=PolygonBuilder.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/TextBuilder.js":
/*!******************************************************!*\
  !*** ./node_modules/ol/render/canvas/TextBuilder.js ***!
  \******************************************************/
/*! exports provided: TEXT_ALIGN, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TEXT_ALIGN", function() { return TEXT_ALIGN; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _colorlike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../colorlike.js */ "./node_modules/ol/colorlike.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_flat_straightchunk_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../geom/flat/straightchunk.js */ "./node_modules/ol/geom/flat/straightchunk.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _canvas_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../canvas.js */ "./node_modules/ol/render/canvas.js");
/* harmony import */ var _Instruction_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Instruction.js */ "./node_modules/ol/render/canvas/Instruction.js");
/* harmony import */ var _Builder_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Builder.js */ "./node_modules/ol/render/canvas/Builder.js");
/* harmony import */ var _style_TextPlacement_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../style/TextPlacement.js */ "./node_modules/ol/style/TextPlacement.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/render/canvas/TextBuilder
 */









/**
 * @const
 * @enum {number}
 */
var TEXT_ALIGN = {
    'left': 0,
    'end': 0,
    'center': 0.5,
    'right': 1,
    'start': 1,
    'top': 0,
    'middle': 0.5,
    'hanging': 0.2,
    'alphabetic': 0.8,
    'ideographic': 0.8,
    'bottom': 1
};
var CanvasTextBuilder = /** @class */ (function (_super) {
    __extends(CanvasTextBuilder, _super);
    /**
     * @param {number} tolerance Tolerance.
     * @param {import("../../extent.js").Extent} maxExtent Maximum extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     */
    function CanvasTextBuilder(tolerance, maxExtent, resolution, pixelRatio) {
        var _this = _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
        /**
         * @private
         * @type {import("../canvas.js").DeclutterGroups}
         */
        _this.declutterGroups_;
        /**
         * @private
         * @type {Array<HTMLCanvasElement>}
         */
        _this.labels_ = null;
        /**
         * @private
         * @type {string}
         */
        _this.text_ = '';
        /**
         * @private
         * @type {number}
         */
        _this.textOffsetX_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.textOffsetY_ = 0;
        /**
         * @private
         * @type {boolean|undefined}
         */
        _this.textRotateWithView_ = undefined;
        /**
         * @private
         * @type {number}
         */
        _this.textRotation_ = 0;
        /**
         * @private
         * @type {?import("../canvas.js").FillState}
         */
        _this.textFillState_ = null;
        /**
         * @type {!Object<string, import("../canvas.js").FillState>}
         */
        _this.fillStates = {};
        /**
         * @private
         * @type {?import("../canvas.js").StrokeState}
         */
        _this.textStrokeState_ = null;
        /**
         * @type {!Object<string, import("../canvas.js").StrokeState>}
         */
        _this.strokeStates = {};
        /**
         * @private
         * @type {import("../canvas.js").TextState}
         */
        _this.textState_ = /** @type {import("../canvas.js").TextState} */ ({});
        /**
         * @type {!Object<string, import("../canvas.js").TextState>}
         */
        _this.textStates = {};
        /**
         * @private
         * @type {string}
         */
        _this.textKey_ = '';
        /**
         * @private
         * @type {string}
         */
        _this.fillKey_ = '';
        /**
         * @private
         * @type {string}
         */
        _this.strokeKey_ = '';
        return _this;
    }
    /**
     * @inheritDoc
     */
    CanvasTextBuilder.prototype.finish = function () {
        var instructions = _super.prototype.finish.call(this);
        instructions.textStates = this.textStates;
        instructions.fillStates = this.fillStates;
        instructions.strokeStates = this.strokeStates;
        return instructions;
    };
    /**
     * @inheritDoc
     */
    CanvasTextBuilder.prototype.drawText = function (geometry, feature) {
        var fillState = this.textFillState_;
        var strokeState = this.textStrokeState_;
        var textState = this.textState_;
        if (this.text_ === '' || !textState || (!fillState && !strokeState)) {
            return;
        }
        var begin = this.coordinates.length;
        var geometryType = geometry.getType();
        var flatCoordinates = null;
        var end = 2;
        var stride = 2;
        var i, ii;
        if (textState.placement === _style_TextPlacement_js__WEBPACK_IMPORTED_MODULE_8__["default"].LINE) {
            if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(this.getBufferedMaxExtent(), geometry.getExtent())) {
                return;
            }
            var ends = void 0;
            flatCoordinates = geometry.getFlatCoordinates();
            stride = geometry.getStride();
            if (geometryType == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].LINE_STRING) {
                ends = [flatCoordinates.length];
            }
            else if (geometryType == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].MULTI_LINE_STRING) {
                ends = geometry.getEnds();
            }
            else if (geometryType == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POLYGON) {
                ends = geometry.getEnds().slice(0, 1);
            }
            else if (geometryType == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].MULTI_POLYGON) {
                var endss = geometry.getEndss();
                ends = [];
                for (i = 0, ii = endss.length; i < ii; ++i) {
                    ends.push(endss[i][0]);
                }
            }
            this.beginGeometry(geometry, feature);
            var textAlign = textState.textAlign;
            var flatOffset = 0;
            var flatEnd = void 0;
            for (var o = 0, oo = ends.length; o < oo; ++o) {
                if (textAlign == undefined) {
                    var range = Object(_geom_flat_straightchunk_js__WEBPACK_IMPORTED_MODULE_3__["matchingChunk"])(textState.maxAngle, flatCoordinates, flatOffset, ends[o], stride);
                    flatOffset = range[0];
                    flatEnd = range[1];
                }
                else {
                    flatEnd = ends[o];
                }
                for (i = flatOffset; i < flatEnd; i += stride) {
                    this.coordinates.push(flatCoordinates[i], flatCoordinates[i + 1]);
                }
                end = this.coordinates.length;
                flatOffset = ends[o];
                var declutterGroup = this.declutterGroups_ ?
                    (o === 0 ? this.declutterGroups_[0] : [].concat(this.declutterGroups_[0])) :
                    null;
                this.drawChars_(begin, end, declutterGroup);
                begin = end;
            }
            this.endGeometry(feature);
        }
        else {
            var geometryWidths = null;
            if (!textState.overflow) {
                geometryWidths = [];
            }
            switch (geometryType) {
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POINT:
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].MULTI_POINT:
                    flatCoordinates = geometry.getFlatCoordinates();
                    end = flatCoordinates.length;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].LINE_STRING:
                    flatCoordinates = /** @type {import("../../geom/LineString.js").default} */ (geometry).getFlatMidpoint();
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CIRCLE:
                    flatCoordinates = /** @type {import("../../geom/Circle.js").default} */ (geometry).getCenter();
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].MULTI_LINE_STRING:
                    flatCoordinates = /** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getFlatMidpoints();
                    end = flatCoordinates.length;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POLYGON:
                    flatCoordinates = /** @type {import("../../geom/Polygon.js").default} */ (geometry).getFlatInteriorPoint();
                    if (!textState.overflow) {
                        geometryWidths.push(flatCoordinates[2] / this.resolution);
                    }
                    stride = 3;
                    break;
                case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].MULTI_POLYGON:
                    var interiorPoints = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getFlatInteriorPoints();
                    flatCoordinates = [];
                    for (i = 0, ii = interiorPoints.length; i < ii; i += 3) {
                        if (!textState.overflow) {
                            geometryWidths.push(interiorPoints[i + 2] / this.resolution);
                        }
                        flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]);
                    }
                    end = flatCoordinates.length;
                    if (end == 0) {
                        return;
                    }
                    break;
                default:
            }
            end = this.appendFlatCoordinates(flatCoordinates, 0, end, stride, false, false);
            this.saveTextStates_();
            if (textState.backgroundFill || textState.backgroundStroke) {
                this.setFillStrokeStyle(textState.backgroundFill, textState.backgroundStroke);
                if (textState.backgroundFill) {
                    this.updateFillStyle(this.state, this.createFill);
                    this.hitDetectionInstructions.push(this.createFill(this.state));
                }
                if (textState.backgroundStroke) {
                    this.updateStrokeStyle(this.state, this.applyStroke);
                    this.hitDetectionInstructions.push(this.createStroke(this.state));
                }
            }
            this.beginGeometry(geometry, feature);
            // The image is unknown at this stage so we pass null; it will be computed at render time.
            // For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at
            // render time.
            var pixelRatio_1 = this.pixelRatio;
            this.instructions.push([_Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_IMAGE, begin, end,
                null, NaN, NaN, this.declutterGroups_, NaN, 1, 0, 0,
                this.textRotateWithView_, this.textRotation_, 1, NaN,
                textState.padding == _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultPadding"] ?
                    _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultPadding"] : textState.padding.map(function (p) {
                    return p * pixelRatio_1;
                }),
                !!textState.backgroundFill, !!textState.backgroundStroke,
                this.text_, this.textKey_, this.strokeKey_, this.fillKey_,
                this.textOffsetX_, this.textOffsetY_, geometryWidths
            ]);
            this.hitDetectionInstructions.push([_Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_IMAGE, begin, end,
                null, NaN, NaN, this.declutterGroups_, NaN, 1, 0, 0,
                this.textRotateWithView_, this.textRotation_, 1 / this.pixelRatio, NaN,
                textState.padding,
                !!textState.backgroundFill, !!textState.backgroundStroke,
                this.text_, this.textKey_, this.strokeKey_, this.fillKey_,
                this.textOffsetX_, this.textOffsetY_, geometryWidths
            ]);
            this.endGeometry(feature);
        }
    };
    /**
     * @private
     */
    CanvasTextBuilder.prototype.saveTextStates_ = function () {
        var strokeState = this.textStrokeState_;
        var textState = this.textState_;
        var fillState = this.textFillState_;
        var strokeKey = this.strokeKey_;
        if (strokeState) {
            if (!(strokeKey in this.strokeStates)) {
                this.strokeStates[strokeKey] = {
                    strokeStyle: strokeState.strokeStyle,
                    lineCap: strokeState.lineCap,
                    lineDashOffset: strokeState.lineDashOffset,
                    lineWidth: strokeState.lineWidth,
                    lineJoin: strokeState.lineJoin,
                    miterLimit: strokeState.miterLimit,
                    lineDash: strokeState.lineDash
                };
            }
        }
        var textKey = this.textKey_;
        if (!(textKey in this.textStates)) {
            this.textStates[textKey] = {
                font: textState.font,
                textAlign: textState.textAlign || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultTextAlign"],
                textBaseline: textState.textBaseline || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultTextBaseline"],
                scale: textState.scale
            };
        }
        var fillKey = this.fillKey_;
        if (fillState) {
            if (!(fillKey in this.fillStates)) {
                this.fillStates[fillKey] = {
                    fillStyle: fillState.fillStyle
                };
            }
        }
    };
    /**
     * @private
     * @param {number} begin Begin.
     * @param {number} end End.
     * @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group.
     */
    CanvasTextBuilder.prototype.drawChars_ = function (begin, end, declutterGroup) {
        var strokeState = this.textStrokeState_;
        var textState = this.textState_;
        var strokeKey = this.strokeKey_;
        var textKey = this.textKey_;
        var fillKey = this.fillKey_;
        this.saveTextStates_();
        var pixelRatio = this.pixelRatio;
        var baseline = TEXT_ALIGN[textState.textBaseline];
        var offsetY = this.textOffsetY_ * pixelRatio;
        var text = this.text_;
        var textScale = textState.scale;
        var strokeWidth = strokeState ? strokeState.lineWidth * textScale / 2 : 0;
        this.instructions.push([_Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_CHARS,
            begin, end, baseline, declutterGroup,
            textState.overflow, fillKey, textState.maxAngle,
            pixelRatio,
            offsetY, strokeKey, strokeWidth * pixelRatio, text, textKey, 1
        ]);
        this.hitDetectionInstructions.push([_Instruction_js__WEBPACK_IMPORTED_MODULE_6__["default"].DRAW_CHARS,
            begin, end, baseline, declutterGroup,
            textState.overflow, fillKey, textState.maxAngle,
            1,
            offsetY, strokeKey, strokeWidth, text, textKey, 1 / pixelRatio
        ]);
    };
    /**
     * @inheritDoc
     */
    CanvasTextBuilder.prototype.setTextStyle = function (textStyle, declutterGroups) {
        var textState, fillState, strokeState;
        if (!textStyle) {
            this.text_ = '';
        }
        else {
            this.declutterGroups_ = /** @type {import("../canvas.js").DeclutterGroups} */ (declutterGroups);
            var textFillStyle = textStyle.getFill();
            if (!textFillStyle) {
                fillState = null;
                this.textFillState_ = fillState;
            }
            else {
                fillState = this.textFillState_;
                if (!fillState) {
                    fillState = /** @type {import("../canvas.js").FillState} */ ({});
                    this.textFillState_ = fillState;
                }
                fillState.fillStyle = Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(textFillStyle.getColor() || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultFillStyle"]);
            }
            var textStrokeStyle = textStyle.getStroke();
            if (!textStrokeStyle) {
                strokeState = null;
                this.textStrokeState_ = strokeState;
            }
            else {
                strokeState = this.textStrokeState_;
                if (!strokeState) {
                    strokeState = /** @type {import("../canvas.js").StrokeState} */ ({});
                    this.textStrokeState_ = strokeState;
                }
                var lineDash = textStrokeStyle.getLineDash();
                var lineDashOffset = textStrokeStyle.getLineDashOffset();
                var lineWidth = textStrokeStyle.getWidth();
                var miterLimit = textStrokeStyle.getMiterLimit();
                strokeState.lineCap = textStrokeStyle.getLineCap() || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultLineCap"];
                strokeState.lineDash = lineDash ? lineDash.slice() : _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultLineDash"];
                strokeState.lineDashOffset =
                    lineDashOffset === undefined ? _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultLineDashOffset"] : lineDashOffset;
                strokeState.lineJoin = textStrokeStyle.getLineJoin() || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultLineJoin"];
                strokeState.lineWidth =
                    lineWidth === undefined ? _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultLineWidth"] : lineWidth;
                strokeState.miterLimit =
                    miterLimit === undefined ? _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultMiterLimit"] : miterLimit;
                strokeState.strokeStyle = Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(textStrokeStyle.getColor() || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultStrokeStyle"]);
            }
            textState = this.textState_;
            var font = textStyle.getFont() || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultFont"];
            Object(_canvas_js__WEBPACK_IMPORTED_MODULE_5__["registerFont"])(font);
            var textScale = textStyle.getScale();
            textState.overflow = textStyle.getOverflow();
            textState.font = font;
            textState.maxAngle = textStyle.getMaxAngle();
            textState.placement = textStyle.getPlacement();
            textState.textAlign = textStyle.getTextAlign();
            textState.textBaseline = textStyle.getTextBaseline() || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultTextBaseline"];
            textState.backgroundFill = textStyle.getBackgroundFill();
            textState.backgroundStroke = textStyle.getBackgroundStroke();
            textState.padding = textStyle.getPadding() || _canvas_js__WEBPACK_IMPORTED_MODULE_5__["defaultPadding"];
            textState.scale = textScale === undefined ? 1 : textScale;
            var textOffsetX = textStyle.getOffsetX();
            var textOffsetY = textStyle.getOffsetY();
            var textRotateWithView = textStyle.getRotateWithView();
            var textRotation = textStyle.getRotation();
            this.text_ = textStyle.getText() || '';
            this.textOffsetX_ = textOffsetX === undefined ? 0 : textOffsetX;
            this.textOffsetY_ = textOffsetY === undefined ? 0 : textOffsetY;
            this.textRotateWithView_ = textRotateWithView === undefined ? false : textRotateWithView;
            this.textRotation_ = textRotation === undefined ? 0 : textRotation;
            this.strokeKey_ = strokeState ?
                (typeof strokeState.strokeStyle == 'string' ? strokeState.strokeStyle : Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(strokeState.strokeStyle)) +
                    strokeState.lineCap + strokeState.lineDashOffset + '|' + strokeState.lineWidth +
                    strokeState.lineJoin + strokeState.miterLimit + '[' + strokeState.lineDash.join() + ']' :
                '';
            this.textKey_ = textState.font + textState.scale + (textState.textAlign || '?') + (textState.textBaseline || '?');
            this.fillKey_ = fillState ?
                (typeof fillState.fillStyle == 'string' ? fillState.fillStyle : ('|' + Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(fillState.fillStyle))) :
                '';
        }
    };
    return CanvasTextBuilder;
}(_Builder_js__WEBPACK_IMPORTED_MODULE_7__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasTextBuilder);
//# sourceMappingURL=TextBuilder.js.map

/***/ }),

/***/ "./node_modules/ol/render/canvas/hitdetect.js":
/*!****************************************************!*\
  !*** ./node_modules/ol/render/canvas/hitdetect.js ***!
  \****************************************************/
/*! exports provided: createHitDetectionImageData, hitDetect */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createHitDetectionImageData", function() { return createHitDetectionImageData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hitDetect", function() { return hitDetect; });
/* harmony import */ var _Immediate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Immediate.js */ "./node_modules/ol/render/canvas/Immediate.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _style_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../style.js */ "./node_modules/ol/style.js");
/* harmony import */ var _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style/IconAnchorUnits.js */ "./node_modules/ol/style/IconAnchorUnits.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
/**
 * @module ol/render/canvas/hitdetet
 */







/**
 * @param {import("../../size.js").Size} size Canvas size in css pixels.
 * @param {Array<import("../../transform.js").Transform>} transforms Transforms
 * for rendering features to all worlds of the viewport, from coordinates to css
 * pixels.
 * @param {Array<import("../../Feature.js").FeatureLike>} features
 * Features to consider for hit detection.
 * @param {import("../../style/Style.js").StyleFunction|undefined} styleFunction
 * Layer style function.
 * @param {import("../../extent.js").Extent} extent Extent.
 * @param {number} resolution Resolution.
 * @param {number} rotation Rotation.
 * @return {ImageData} Hit detection image data.
 */
function createHitDetectionImageData(size, transforms, features, styleFunction, extent, resolution, rotation) {
    var width = size[0] / 2;
    var height = size[1] / 2;
    var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_1__["createCanvasContext2D"])(width, height);
    context.imageSmoothingEnabled = false;
    var canvas = context.canvas;
    var renderer = new _Immediate_js__WEBPACK_IMPORTED_MODULE_0__["default"](context, 0.5, extent, null, rotation);
    var featureCount = features.length;
    // Stretch hit detection index to use the whole available color range
    var indexFactor = Math.floor((256 * 256 * 256 - 1) / featureCount);
    var featuresByZIndex = {};
    for (var i = 1; i <= featureCount; ++i) {
        var feature = features[i - 1];
        var featureStyleFunction = feature.getStyleFunction() || styleFunction;
        if (!styleFunction) {
            continue;
        }
        var styles = featureStyleFunction(feature, resolution);
        if (!styles) {
            continue;
        }
        if (!Array.isArray(styles)) {
            styles = [styles];
        }
        var index = i * indexFactor;
        var color = '#' + ('000000' + index.toString(16)).slice(-6);
        for (var j = 0, jj = styles.length; j < jj; ++j) {
            var originalStyle = styles[j];
            var style = originalStyle.clone();
            var fill = style.getFill();
            if (fill) {
                fill.setColor(color);
            }
            var stroke = style.getStroke();
            if (stroke) {
                stroke.setColor(color);
            }
            style.setText(undefined);
            var image = originalStyle.getImage();
            if (image) {
                var imgSize = image.getImageSize();
                if (!imgSize) {
                    continue;
                }
                var canvas_1 = document.createElement('canvas');
                canvas_1.width = imgSize[0];
                canvas_1.height = imgSize[1];
                var imgContext = canvas_1.getContext('2d', { alpha: false });
                imgContext.fillStyle = color;
                var img = imgContext.canvas;
                imgContext.fillRect(0, 0, img.width, img.height);
                var width_1 = imgSize ? imgSize[0] : img.width;
                var height_1 = imgSize ? imgSize[1] : img.height;
                var iconContext = Object(_dom_js__WEBPACK_IMPORTED_MODULE_1__["createCanvasContext2D"])(width_1, height_1);
                iconContext.drawImage(img, 0, 0);
                style.setImage(new _style_js__WEBPACK_IMPORTED_MODULE_2__["Icon"]({
                    img: img,
                    imgSize: imgSize,
                    anchor: image.getAnchor(),
                    anchorXUnits: _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_3__["default"].PIXELS,
                    anchorYUnits: _style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_3__["default"].PIXELS,
                    offset: image.getOrigin(),
                    size: image.getSize(),
                    opacity: image.getOpacity(),
                    scale: image.getScale(),
                    rotation: image.getRotation(),
                    rotateWithView: image.getRotateWithView()
                }));
            }
            var zIndex = Number(style.getZIndex());
            var byGeometryType = featuresByZIndex[zIndex];
            if (!byGeometryType) {
                byGeometryType = {};
                featuresByZIndex[zIndex] = byGeometryType;
                byGeometryType[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POLYGON] = [];
                byGeometryType[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CIRCLE] = [];
                byGeometryType[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].LINE_STRING] = [];
                byGeometryType[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_4__["default"].POINT] = [];
            }
            var geometry = style.getGeometryFunction()(feature);
            if (geometry && Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["intersects"])(extent, geometry.getExtent())) {
                byGeometryType[geometry.getType().replace('Multi', '')].push(geometry, style);
            }
        }
    }
    var zIndexKeys = Object.keys(featuresByZIndex).map(Number).sort(_array_js__WEBPACK_IMPORTED_MODULE_6__["numberSafeCompareFunction"]);
    for (var i = 0, ii = zIndexKeys.length; i < ii; ++i) {
        var byGeometryType = featuresByZIndex[zIndexKeys[i]];
        for (var type in byGeometryType) {
            var geomAndStyle = byGeometryType[type];
            for (var j = 0, jj = geomAndStyle.length; j < jj; j += 2) {
                renderer.setStyle(geomAndStyle[j + 1]);
                for (var k = 0, kk = transforms.length; k < kk; ++k) {
                    renderer.setTransform(transforms[k]);
                    renderer.drawGeometry(geomAndStyle[j]);
                }
            }
        }
    }
    document.body.appendChild(context.canvas);
    return context.getImageData(0, 0, canvas.width, canvas.height);
}
/**
 * @param {import("../../pixel").Pixel} pixel Pixel coordinate on the hit
 * detection canvas in css pixels.
 * @param {Array<import("../../Feature").FeatureLike>} features Features. Has to
 * match the `features` array that was passed to `createHitDetectionImageData()`.
 * @param {ImageData} imageData Hit detection image data generated by
 * `createHitDetectionImageData()`.
 * @return {Array<import("../../Feature").FeatureLike>} features Features.
 */
function hitDetect(pixel, features, imageData) {
    var resultFeatures = [];
    if (imageData) {
        var index = (Math.round(pixel[0] / 2) + Math.round(pixel[1] / 2) * imageData.width) * 4;
        var r = imageData.data[index];
        var g = imageData.data[index + 1];
        var b = imageData.data[index + 2];
        var i = b + (256 * (g + (256 * r)));
        var indexFactor = Math.floor((256 * 256 * 256 - 1) / features.length);
        if (i && i % indexFactor === 0) {
            resultFeatures.push(features[i / indexFactor - 1]);
        }
    }
    return resultFeatures;
}
//# sourceMappingURL=hitdetect.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/Composite.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/renderer/Composite.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
/* harmony import */ var _layer_Layer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../layer/Layer.js */ "./node_modules/ol/layer/Layer.js");
/* harmony import */ var _render_Event_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../render/Event.js */ "./node_modules/ol/render/Event.js");
/* harmony import */ var _render_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../render/EventType.js */ "./node_modules/ol/render/EventType.js");
/* harmony import */ var _Map_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Map.js */ "./node_modules/ol/renderer/Map.js");
/* harmony import */ var _source_State_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../source/State.js */ "./node_modules/ol/source/State.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _render_canvas_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../render/canvas.js */ "./node_modules/ol/render/canvas.js");
/* harmony import */ var _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../ObjectEventType.js */ "./node_modules/ol/ObjectEventType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/Composite
 */










/**
 * @classdesc
 * Canvas map renderer.
 * @api
 */
var CompositeMapRenderer = /** @class */ (function (_super) {
    __extends(CompositeMapRenderer, _super);
    /**
     * @param {import("../PluggableMap.js").default} map Map.
     */
    function CompositeMapRenderer(map) {
        var _this = _super.call(this, map) || this;
        /**
         * @type {import("../events.js").EventsKey}
         */
        _this.fontChangeListenerKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_7__["listen"])(_render_canvas_js__WEBPACK_IMPORTED_MODULE_8__["checkedFonts"], _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_9__["default"].PROPERTYCHANGE, map.redrawText.bind(map));
        /**
         * @private
         * @type {HTMLDivElement}
         */
        _this.element_ = document.createElement('div');
        var style = _this.element_.style;
        style.position = 'absolute';
        style.width = '100%';
        style.height = '100%';
        style.zIndex = '0';
        _this.element_.className = _css_js__WEBPACK_IMPORTED_MODULE_0__["CLASS_UNSELECTABLE"] + ' ol-layers';
        var container = map.getViewport();
        container.insertBefore(_this.element_, container.firstChild || null);
        /**
         * @private
         * @type {Array<HTMLElement>}
         */
        _this.children_ = [];
        /**
         * @private
         * @type {boolean}
         */
        _this.renderedVisible_ = true;
        return _this;
    }
    /**
     * @param {import("../render/EventType.js").default} type Event type.
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     */
    CompositeMapRenderer.prototype.dispatchRenderEvent = function (type, frameState) {
        var map = this.getMap();
        if (map.hasListener(type)) {
            var event_1 = new _render_Event_js__WEBPACK_IMPORTED_MODULE_2__["default"](type, undefined, frameState);
            map.dispatchEvent(event_1);
        }
    };
    CompositeMapRenderer.prototype.disposeInternal = function () {
        Object(_events_js__WEBPACK_IMPORTED_MODULE_7__["unlistenByKey"])(this.fontChangeListenerKey_);
        this.element_.parentNode.removeChild(this.element_);
        _super.prototype.disposeInternal.call(this);
    };
    /**
     * @inheritDoc
     */
    CompositeMapRenderer.prototype.renderFrame = function (frameState) {
        if (!frameState) {
            if (this.renderedVisible_) {
                this.element_.style.display = 'none';
                this.renderedVisible_ = false;
            }
            return;
        }
        this.calculateMatrices2D(frameState);
        this.dispatchRenderEvent(_render_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].PRECOMPOSE, frameState);
        var layerStatesArray = frameState.layerStatesArray.sort(function (a, b) {
            return a.zIndex - b.zIndex;
        });
        var viewState = frameState.viewState;
        this.children_.length = 0;
        var previousElement = null;
        for (var i = 0, ii = layerStatesArray.length; i < ii; ++i) {
            var layerState = layerStatesArray[i];
            frameState.layerIndex = i;
            if (!Object(_layer_Layer_js__WEBPACK_IMPORTED_MODULE_1__["inView"])(layerState, viewState) ||
                (layerState.sourceState != _source_State_js__WEBPACK_IMPORTED_MODULE_5__["default"].READY && layerState.sourceState != _source_State_js__WEBPACK_IMPORTED_MODULE_5__["default"].UNDEFINED)) {
                continue;
            }
            var layer = layerState.layer;
            var element = layer.render(frameState, previousElement);
            if (!element) {
                continue;
            }
            if (element !== previousElement) {
                this.children_.push(element);
                previousElement = element;
            }
        }
        _super.prototype.renderFrame.call(this, frameState);
        Object(_dom_js__WEBPACK_IMPORTED_MODULE_6__["replaceChildren"])(this.element_, this.children_);
        this.dispatchRenderEvent(_render_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POSTCOMPOSE, frameState);
        if (!this.renderedVisible_) {
            this.element_.style.display = '';
            this.renderedVisible_ = true;
        }
        this.scheduleExpireIconCache(frameState);
    };
    /**
     * @inheritDoc
     */
    CompositeMapRenderer.prototype.forEachLayerAtPixel = function (pixel, frameState, hitTolerance, callback, layerFilter) {
        var viewState = frameState.viewState;
        var layerStates = frameState.layerStatesArray;
        var numLayers = layerStates.length;
        for (var i = numLayers - 1; i >= 0; --i) {
            var layerState = layerStates[i];
            var layer = layerState.layer;
            if (layer.hasRenderer() && Object(_layer_Layer_js__WEBPACK_IMPORTED_MODULE_1__["inView"])(layerState, viewState) && layerFilter(layer)) {
                var layerRenderer = layer.getRenderer();
                var data = layerRenderer.getDataAtPixel(pixel, frameState, hitTolerance);
                if (data) {
                    var result = callback(layer, data);
                    if (result) {
                        return result;
                    }
                }
            }
        }
        return undefined;
    };
    return CompositeMapRenderer;
}(_Map_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CompositeMapRenderer);
//# sourceMappingURL=Composite.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/Layer.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/renderer/Layer.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _Observable_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Observable.js */ "./node_modules/ol/Observable.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _source_State_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../source/State.js */ "./node_modules/ol/source/State.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/Layer
 */





/**
 * @template {import("../layer/Layer.js").default} LayerType
 */
var LayerRenderer = /** @class */ (function (_super) {
    __extends(LayerRenderer, _super);
    /**
     * @param {LayerType} layer Layer.
     */
    function LayerRenderer(layer) {
        var _this = _super.call(this) || this;
        /** @private */
        _this.boundHandleImageChange_ = _this.handleImageChange_.bind(_this);
        /**
         * @private
         * @type {LayerType}
         */
        _this.layer_ = layer;
        return _this;
    }
    /**
     * Asynchronous layer level hit detection.
     * @param {import("../pixel.js").Pixel} pixel Pixel.
     * @return {Promise<Array<import("../Feature").default>>} Promise that resolves with
     * an array of features.
     */
    LayerRenderer.prototype.getFeatures = function (pixel) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Determine whether render should be called.
     * @abstract
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @return {boolean} Layer is ready to be rendered.
     */
    LayerRenderer.prototype.prepareFrame = function (frameState) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Render the layer.
     * @abstract
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @param {HTMLElement} target Target that may be used to render content to.
     * @return {HTMLElement} The rendered element.
     */
    LayerRenderer.prototype.renderFrame = function (frameState, target) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
     * @param {number} zoom Zoom level.
     * @param {import("../Tile.js").default} tile Tile.
     */
    LayerRenderer.prototype.loadedTileCallback = function (tiles, zoom, tile) {
        if (!tiles[zoom]) {
            tiles[zoom] = {};
        }
        tiles[zoom][tile.tileCoord.toString()] = tile;
    };
    /**
     * Create a function that adds loaded tiles to the tile lookup.
     * @param {import("../source/Tile.js").default} source Tile source.
     * @param {import("../proj/Projection.js").default} projection Projection of the tiles.
     * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
     * @return {function(number, import("../TileRange.js").default):boolean} A function that can be
     *     called with a zoom level and a tile range to add loaded tiles to the lookup.
     * @protected
     */
    LayerRenderer.prototype.createLoadedTileFinder = function (source, projection, tiles) {
        return (
        /**
         * @param {number} zoom Zoom level.
         * @param {import("../TileRange.js").default} tileRange Tile range.
         * @return {boolean} The tile range is fully loaded.
         * @this {LayerRenderer}
         */
        function (zoom, tileRange) {
            var callback = this.loadedTileCallback.bind(this, tiles, zoom);
            return source.forEachLoadedTile(projection, zoom, tileRange, callback);
        }).bind(this);
    };
    /**
     * @abstract
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @param {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default): T} callback Feature callback.
     * @param {Array<import("../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
     * @return {T|void} Callback result.
     * @template T
     */
    LayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, declutteredFeatures) { };
    /**
     * @abstract
     * @param {import("../pixel.js").Pixel} pixel Pixel.
     * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @return {Uint8ClampedArray|Uint8Array} The result.  If there is no data at the pixel
     *    location, null will be returned.  If there is data, but pixel values cannot be
     *    returned, and empty array will be returned.
     */
    LayerRenderer.prototype.getDataAtPixel = function (pixel, frameState, hitTolerance) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @return {LayerType} Layer.
     */
    LayerRenderer.prototype.getLayer = function () {
        return this.layer_;
    };
    /**
     * Perform action necessary to get the layer rendered after new fonts have loaded
     * @abstract
     */
    LayerRenderer.prototype.handleFontsChanged = function () { };
    /**
     * Handle changes in image state.
     * @param {import("../events/Event.js").default} event Image change event.
     * @private
     */
    LayerRenderer.prototype.handleImageChange_ = function (event) {
        var image = /** @type {import("../Image.js").default} */ (event.target);
        if (image.getState() === _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED) {
            this.renderIfReadyAndVisible();
        }
    };
    /**
     * Load the image if not already loaded, and register the image change
     * listener if needed.
     * @param {import("../ImageBase.js").default} image Image.
     * @return {boolean} `true` if the image is already loaded, `false` otherwise.
     * @protected
     */
    LayerRenderer.prototype.loadImage = function (image) {
        var imageState = image.getState();
        if (imageState != _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED && imageState != _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR) {
            image.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].CHANGE, this.boundHandleImageChange_);
        }
        if (imageState == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE) {
            image.load();
            imageState = image.getState();
        }
        return imageState == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED;
    };
    /**
     * @protected
     */
    LayerRenderer.prototype.renderIfReadyAndVisible = function () {
        var layer = this.getLayer();
        if (layer.getVisible() && layer.getSourceState() == _source_State_js__WEBPACK_IMPORTED_MODULE_4__["default"].READY) {
            layer.changed();
        }
    };
    return LayerRenderer;
}(_Observable_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (LayerRenderer);
//# sourceMappingURL=Layer.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/Map.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/renderer/Map.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Disposable_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Disposable.js */ "./node_modules/ol/Disposable.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _layer_Layer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../layer/Layer.js */ "./node_modules/ol/layer/Layer.js");
/* harmony import */ var _style_IconImageCache_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../style/IconImageCache.js */ "./node_modules/ol/style/IconImageCache.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _render_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../render.js */ "./node_modules/ol/render.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/Map
 */









/**
 * @abstract
 */
var MapRenderer = /** @class */ (function (_super) {
    __extends(MapRenderer, _super);
    /**
     * @param {import("../PluggableMap.js").default} map Map.
     */
    function MapRenderer(map) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {import("../PluggableMap.js").default}
         */
        _this.map_ = map;
        /**
         * @private
         */
        _this.declutterTree_ = null;
        return _this;
    }
    /**
     * @abstract
     * @param {import("../render/EventType.js").default} type Event type.
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     */
    MapRenderer.prototype.dispatchRenderEvent = function (type, frameState) {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
     * @protected
     */
    MapRenderer.prototype.calculateMatrices2D = function (frameState) {
        var viewState = frameState.viewState;
        var coordinateToPixelTransform = frameState.coordinateToPixelTransform;
        var pixelToCoordinateTransform = frameState.pixelToCoordinateTransform;
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["compose"])(coordinateToPixelTransform, frameState.size[0] / 2, frameState.size[1] / 2, 1 / viewState.resolution, -1 / viewState.resolution, -viewState.rotation, -viewState.center[0], -viewState.center[1]);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["makeInverse"])(pixelToCoordinateTransform, coordinateToPixelTransform);
    };
    /**
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @param {boolean} checkWrapped Check for wrapped geometries.
     * @param {function(this: S, import("../Feature.js").FeatureLike,
     *     import("../layer/Layer.js").default): T} callback Feature callback.
     * @param {S} thisArg Value to use as `this` when executing `callback`.
     * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
     *     function, only layers which are visible and for which this function
     *     returns `true` will be tested for features.  By default, all visible
     *     layers will be tested.
     * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`.
     * @return {T|undefined} Callback result.
     * @template S,T,U
     */
    MapRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, checkWrapped, callback, thisArg, layerFilter, thisArg2) {
        var result;
        var viewState = frameState.viewState;
        /**
         * @param {boolean} managed Managed layer.
         * @param {import("../Feature.js").FeatureLike} feature Feature.
         * @param {import("../layer/Layer.js").default} layer Layer.
         * @return {?} Callback result.
         */
        function forEachFeatureAtCoordinate(managed, feature, layer) {
            return callback.call(thisArg, feature, managed ? layer : null);
        }
        var projection = viewState.projection;
        var translatedCoordinate = Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_8__["wrapX"])(coordinate.slice(), projection);
        var offsets = [[0, 0]];
        if (projection.canWrapX() && checkWrapped) {
            var projectionExtent = projection.getExtent();
            var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(projectionExtent);
            offsets.push([-worldWidth, 0], [worldWidth, 0]);
        }
        var layerStates = frameState.layerStatesArray;
        var numLayers = layerStates.length;
        var declutteredFeatures;
        if (this.declutterTree_) {
            declutteredFeatures = this.declutterTree_.all().map(function (entry) {
                return entry.value;
            });
        }
        var tmpCoord = [];
        for (var i = 0; i < offsets.length; i++) {
            for (var j = numLayers - 1; j >= 0; --j) {
                var layerState = layerStates[j];
                var layer = /** @type {import("../layer/Layer.js").default} */ (layerState.layer);
                if (layer.hasRenderer() && Object(_layer_Layer_js__WEBPACK_IMPORTED_MODULE_4__["inView"])(layerState, viewState) && layerFilter.call(thisArg2, layer)) {
                    var layerRenderer = layer.getRenderer();
                    var source = layer.getSource();
                    if (layerRenderer && source) {
                        var coordinates = source.getWrapX() ? translatedCoordinate : coordinate;
                        var callback_1 = forEachFeatureAtCoordinate.bind(null, layerState.managed);
                        tmpCoord[0] = coordinates[0] + offsets[i][0];
                        tmpCoord[1] = coordinates[1] + offsets[i][1];
                        result = layerRenderer.forEachFeatureAtCoordinate(tmpCoord, frameState, hitTolerance, callback_1, declutteredFeatures);
                    }
                    if (result) {
                        return result;
                    }
                }
            }
        }
        return undefined;
    };
    /**
     * @abstract
     * @param {import("../pixel.js").Pixel} pixel Pixel.
     * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @param {function(this: S, import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer
     *     callback.
     * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
     *     function, only layers which are visible and for which this function
     *     returns `true` will be tested for features.  By default, all visible
     *     layers will be tested.
     * @return {T|undefined} Callback result.
     * @template S,T,U
     */
    MapRenderer.prototype.forEachLayerAtPixel = function (pixel, frameState, hitTolerance, callback, layerFilter) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @param {boolean} checkWrapped Check for wrapped geometries.
     * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
     *     function, only layers which are visible and for which this function
     *     returns `true` will be tested for features.  By default, all visible
     *     layers will be tested.
     * @param {U} thisArg Value to use as `this` when executing `layerFilter`.
     * @return {boolean} Is there a feature at the given coordinate?
     * @template U
     */
    MapRenderer.prototype.hasFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, checkWrapped, layerFilter, thisArg) {
        var hasFeature = this.forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, checkWrapped, _functions_js__WEBPACK_IMPORTED_MODULE_3__["TRUE"], this, layerFilter, thisArg);
        return hasFeature !== undefined;
    };
    /**
     * @return {import("../PluggableMap.js").default} Map.
     */
    MapRenderer.prototype.getMap = function () {
        return this.map_;
    };
    /**
     * Render.
     * @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
     */
    MapRenderer.prototype.renderFrame = function (frameState) {
        this.declutterTree_ = Object(_render_js__WEBPACK_IMPORTED_MODULE_7__["renderDeclutterItems"])(frameState, this.declutterTree_);
    };
    /**
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @protected
     */
    MapRenderer.prototype.scheduleExpireIconCache = function (frameState) {
        if (_style_IconImageCache_js__WEBPACK_IMPORTED_MODULE_5__["shared"].canExpireCache()) {
            frameState.postRenderFunctions.push(expireIconCache);
        }
    };
    return MapRenderer;
}(_Disposable_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * @param {import("../PluggableMap.js").default} map Map.
 * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
 */
function expireIconCache(map, frameState) {
    _style_IconImageCache_js__WEBPACK_IMPORTED_MODULE_5__["shared"].expire();
}
/* harmony default export */ __webpack_exports__["default"] = (MapRenderer);
//# sourceMappingURL=Map.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/canvas/ImageLayer.js":
/*!*******************************************************!*\
  !*** ./node_modules/ol/renderer/canvas/ImageLayer.js ***!
  \*******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _reproj_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../reproj/common.js */ "./node_modules/ol/reproj/common.js");
/* harmony import */ var _ViewHint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../ViewHint.js */ "./node_modules/ol/ViewHint.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Layer.js */ "./node_modules/ol/renderer/canvas/Layer.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _render_canvas_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../render/canvas.js */ "./node_modules/ol/render/canvas.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/canvas/ImageLayer
 */








/**
 * @classdesc
 * Canvas renderer for image layers.
 * @api
 */
var CanvasImageLayerRenderer = /** @class */ (function (_super) {
    __extends(CanvasImageLayerRenderer, _super);
    /**
     * @param {import("../../layer/Image.js").default} imageLayer Image layer.
     */
    function CanvasImageLayerRenderer(imageLayer) {
        var _this = _super.call(this, imageLayer) || this;
        /**
         * @protected
         * @type {?import("../../ImageBase.js").default}
         */
        _this.image_ = null;
        return _this;
    }
    /**
     * @inheritDoc
     */
    CanvasImageLayerRenderer.prototype.getImage = function () {
        return !this.image_ ? null : this.image_.getImage();
    };
    /**
     * @inheritDoc
     */
    CanvasImageLayerRenderer.prototype.prepareFrame = function (frameState) {
        var layerState = frameState.layerStatesArray[frameState.layerIndex];
        var pixelRatio = frameState.pixelRatio;
        var viewState = frameState.viewState;
        var viewResolution = viewState.resolution;
        var imageSource = this.getLayer().getSource();
        var hints = frameState.viewHints;
        var renderedExtent = frameState.extent;
        if (layerState.extent !== undefined) {
            renderedExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getIntersection"])(renderedExtent, Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["fromUserExtent"])(layerState.extent, viewState.projection));
        }
        if (!hints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].ANIMATING] && !hints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].INTERACTING] && !Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["isEmpty"])(renderedExtent)) {
            if (imageSource) {
                var projection = viewState.projection;
                if (!_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"]) {
                    var sourceProjection = imageSource.getProjection();
                    if (sourceProjection) {
                        projection = sourceProjection;
                    }
                }
                var image = imageSource.getImage(renderedExtent, viewResolution, pixelRatio, projection);
                if (image && this.loadImage(image)) {
                    this.image_ = image;
                }
            }
            else {
                this.image_ = null;
            }
        }
        return !!this.image_;
    };
    /**
     * @inheritDoc
     */
    CanvasImageLayerRenderer.prototype.renderFrame = function (frameState, target) {
        var image = this.image_;
        var imageExtent = image.getExtent();
        var imageResolution = image.getResolution();
        var imagePixelRatio = image.getPixelRatio();
        var layerState = frameState.layerStatesArray[frameState.layerIndex];
        var pixelRatio = frameState.pixelRatio;
        var viewState = frameState.viewState;
        var viewCenter = viewState.center;
        var viewResolution = viewState.resolution;
        var size = frameState.size;
        var scale = pixelRatio * imageResolution / (viewResolution * imagePixelRatio);
        var width = Math.round(size[0] * pixelRatio);
        var height = Math.round(size[1] * pixelRatio);
        var rotation = viewState.rotation;
        if (rotation) {
            var size_1 = Math.round(Math.sqrt(width * width + height * height));
            width = size_1;
            height = size_1;
        }
        // set forward and inverse pixel transforms
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_5__["compose"])(this.pixelTransform, frameState.size[0] / 2, frameState.size[1] / 2, 1 / pixelRatio, 1 / pixelRatio, rotation, -width / 2, -height / 2);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_5__["makeInverse"])(this.inversePixelTransform, this.pixelTransform);
        var canvasTransform = Object(_render_canvas_js__WEBPACK_IMPORTED_MODULE_6__["createTransformString"])(this.pixelTransform);
        this.useContainer(target, canvasTransform, layerState.opacity);
        var context = this.context;
        var canvas = context.canvas;
        if (canvas.width != width || canvas.height != height) {
            canvas.width = width;
            canvas.height = height;
        }
        else if (!this.containerReused) {
            context.clearRect(0, 0, width, height);
        }
        // clipped rendering if layer extent is set
        var clipped = false;
        if (layerState.extent) {
            var layerExtent = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["fromUserExtent"])(layerState.extent, viewState.projection);
            clipped = !Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsExtent"])(layerExtent, frameState.extent) && Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(layerExtent, frameState.extent);
            if (clipped) {
                this.clipUnrotated(context, frameState, layerExtent);
            }
        }
        var img = image.getImage();
        var transform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_5__["compose"])(this.tempTransform_, width / 2, height / 2, scale, scale, 0, imagePixelRatio * (imageExtent[0] - viewCenter[0]) / imageResolution, imagePixelRatio * (viewCenter[1] - imageExtent[3]) / imageResolution);
        this.renderedResolution = imageResolution * pixelRatio / imagePixelRatio;
        var dx = transform[4];
        var dy = transform[5];
        var dw = img.width * transform[0];
        var dh = img.height * transform[3];
        this.preRender(context, frameState);
        if (dw >= 0.5 && dh >= 0.5) {
            var opacity = layerState.opacity;
            var previousAlpha = void 0;
            if (opacity !== 1) {
                previousAlpha = this.context.globalAlpha;
                this.context.globalAlpha = opacity;
            }
            this.context.drawImage(img, 0, 0, +img.width, +img.height, Math.round(dx), Math.round(dy), Math.round(dw), Math.round(dh));
            if (opacity !== 1) {
                this.context.globalAlpha = previousAlpha;
            }
        }
        this.postRender(context, frameState);
        if (clipped) {
            context.restore();
        }
        if (canvasTransform !== canvas.style.transform) {
            canvas.style.transform = canvasTransform;
        }
        return this.container;
    };
    return CanvasImageLayerRenderer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasImageLayerRenderer);
//# sourceMappingURL=ImageLayer.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/canvas/Layer.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/renderer/canvas/Layer.js ***!
  \**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _render_Event_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../render/Event.js */ "./node_modules/ol/render/Event.js");
/* harmony import */ var _render_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../render/EventType.js */ "./node_modules/ol/render/EventType.js");
/* harmony import */ var _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../render/canvas.js */ "./node_modules/ol/render/canvas.js");
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Layer.js */ "./node_modules/ol/renderer/Layer.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/canvas/Layer
 */







/**
 * @abstract
 * @template {import("../../layer/Layer.js").default} LayerType
 */
var CanvasLayerRenderer = /** @class */ (function (_super) {
    __extends(CanvasLayerRenderer, _super);
    /**
     * @param {LayerType} layer Layer.
     */
    function CanvasLayerRenderer(layer) {
        var _this = _super.call(this, layer) || this;
        /**
         * @protected
         * @type {HTMLElement}
         */
        _this.container = null;
        /**
         * @protected
         * @type {number}
         */
        _this.renderedResolution;
        /**
         * A temporary transform.  The values in this transform should only be used in a
         * function that sets the values.
         * @private
         * @type {import("../../transform.js").Transform}
         */
        _this.tempTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["create"])();
        /**
         * The transform for rendered pixels to viewport CSS pixels.  This transform must
         * be set when rendering a frame and may be used by other functions after rendering.
         * @protected
         * @type {import("../../transform.js").Transform}
         */
        _this.pixelTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["create"])();
        /**
         * The transform for viewport CSS pixels to rendered pixels.  This transform must
         * be set when rendering a frame and may be used by other functions after rendering.
         * @protected
         * @type {import("../../transform.js").Transform}
         */
        _this.inversePixelTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["create"])();
        /**
         * @protected
         * @type {CanvasRenderingContext2D}
         */
        _this.context = null;
        /**
         * @type {boolean}
         */
        _this.containerReused = false;
        return _this;
    }
    /**
     * Get a rendering container from an existing target, if compatible.
     * @param {HTMLElement} target Potential render target.
     * @param {string} transform CSS Transform.
     * @param {number} opacity Opacity.
     */
    CanvasLayerRenderer.prototype.useContainer = function (target, transform, opacity) {
        var layerClassName = this.getLayer().getClassName();
        var container, context;
        if (target && target.style.opacity === '' && target.className === layerClassName) {
            var canvas = target.firstElementChild;
            if (canvas instanceof HTMLCanvasElement) {
                context = canvas.getContext('2d');
            }
        }
        if (context && context.canvas.style.transform === transform) {
            // Container of the previous layer renderer can be used.
            this.container = target;
            this.context = context;
            this.containerReused = true;
        }
        else if (this.containerReused) {
            // Previously reused container cannot be used any more.
            this.container = null;
            this.context = null;
            this.containerReused = false;
        }
        if (!this.container) {
            container = document.createElement('div');
            container.className = layerClassName;
            var style = container.style;
            style.position = 'absolute';
            style.width = '100%';
            style.height = '100%';
            context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_1__["createCanvasContext2D"])();
            var canvas = context.canvas;
            container.appendChild(canvas);
            style = canvas.style;
            style.position = 'absolute';
            style.left = '0';
            style.transformOrigin = 'top left';
            this.container = container;
            this.context = context;
        }
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @param {import("../../extent.js").Extent} extent Clip extent.
     * @protected
     */
    CanvasLayerRenderer.prototype.clip = function (context, frameState, extent) {
        var pixelRatio = frameState.pixelRatio;
        var halfWidth = (frameState.size[0] * pixelRatio) / 2;
        var halfHeight = (frameState.size[1] * pixelRatio) / 2;
        var rotation = frameState.viewState.rotation;
        var topLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getTopLeft"])(extent);
        var topRight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getTopRight"])(extent);
        var bottomRight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getBottomRight"])(extent);
        var bottomLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getBottomLeft"])(extent);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(frameState.coordinateToPixelTransform, topLeft);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(frameState.coordinateToPixelTransform, topRight);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(frameState.coordinateToPixelTransform, bottomRight);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(frameState.coordinateToPixelTransform, bottomLeft);
        context.save();
        Object(_render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["rotateAtOffset"])(context, -rotation, halfWidth, halfHeight);
        context.beginPath();
        context.moveTo(topLeft[0] * pixelRatio, topLeft[1] * pixelRatio);
        context.lineTo(topRight[0] * pixelRatio, topRight[1] * pixelRatio);
        context.lineTo(bottomRight[0] * pixelRatio, bottomRight[1] * pixelRatio);
        context.lineTo(bottomLeft[0] * pixelRatio, bottomLeft[1] * pixelRatio);
        context.clip();
        Object(_render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["rotateAtOffset"])(context, rotation, halfWidth, halfHeight);
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @param {import("../../extent.js").Extent} extent Clip extent.
     * @protected
     */
    CanvasLayerRenderer.prototype.clipUnrotated = function (context, frameState, extent) {
        var topLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getTopLeft"])(extent);
        var topRight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getTopRight"])(extent);
        var bottomRight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getBottomRight"])(extent);
        var bottomLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getBottomLeft"])(extent);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(frameState.coordinateToPixelTransform, topLeft);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(frameState.coordinateToPixelTransform, topRight);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(frameState.coordinateToPixelTransform, bottomRight);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(frameState.coordinateToPixelTransform, bottomLeft);
        var inverted = this.inversePixelTransform;
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(inverted, topLeft);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(inverted, topRight);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(inverted, bottomRight);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(inverted, bottomLeft);
        context.save();
        context.beginPath();
        context.moveTo(Math.round(topLeft[0]), Math.round(topLeft[1]));
        context.lineTo(Math.round(topRight[0]), Math.round(topRight[1]));
        context.lineTo(Math.round(bottomRight[0]), Math.round(bottomRight[1]));
        context.lineTo(Math.round(bottomLeft[0]), Math.round(bottomLeft[1]));
        context.clip();
    };
    /**
     * @param {import("../../render/EventType.js").default} type Event type.
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @private
     */
    CanvasLayerRenderer.prototype.dispatchRenderEvent_ = function (type, context, frameState) {
        var layer = this.getLayer();
        if (layer.hasListener(type)) {
            var event_1 = new _render_Event_js__WEBPACK_IMPORTED_MODULE_2__["default"](type, this.inversePixelTransform, frameState, context);
            layer.dispatchEvent(event_1);
        }
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @protected
     */
    CanvasLayerRenderer.prototype.preRender = function (context, frameState) {
        this.dispatchRenderEvent_(_render_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].PRERENDER, context, frameState);
    };
    /**
     * @param {CanvasRenderingContext2D} context Context.
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @protected
     */
    CanvasLayerRenderer.prototype.postRender = function (context, frameState) {
        this.dispatchRenderEvent_(_render_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POSTRENDER, context, frameState);
    };
    /**
     * Creates a transform for rendering to an element that will be rotated after rendering.
     * @param {import("../../coordinate.js").Coordinate} center Center.
     * @param {number} resolution Resolution.
     * @param {number} rotation Rotation.
     * @param {number} pixelRatio Pixel ratio.
     * @param {number} width Width of the rendered element (in pixels).
     * @param {number} height Height of the rendered element (in pixels).
     * @param {number} offsetX Offset on the x-axis in view coordinates.
     * @protected
     * @return {!import("../../transform.js").Transform} Transform.
     */
    CanvasLayerRenderer.prototype.getRenderTransform = function (center, resolution, rotation, pixelRatio, width, height, offsetX) {
        var dx1 = width / 2;
        var dy1 = height / 2;
        var sx = pixelRatio / resolution;
        var sy = -sx;
        var dx2 = -center[0] + offsetX;
        var dy2 = -center[1];
        return Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["compose"])(this.tempTransform_, dx1, dy1, sx, sy, -rotation, dx2, dy2);
    };
    /**
     * @param {import("../../pixel.js").Pixel} pixel Pixel.
     * @param {import("../../PluggableMap.js").FrameState} frameState FrameState.
     * @param {number} hitTolerance Hit tolerance in pixels.
     * @return {Uint8ClampedArray|Uint8Array} The result.  If there is no data at the pixel
     *    location, null will be returned.  If there is data, but pixel values cannot be
     *    returned, and empty array will be returned.
     */
    CanvasLayerRenderer.prototype.getDataAtPixel = function (pixel, frameState, hitTolerance) {
        var renderPixel = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(this.inversePixelTransform, pixel.slice());
        var context = this.context;
        var data;
        try {
            data = context.getImageData(Math.round(renderPixel[0]), Math.round(renderPixel[1]), 1, 1).data;
        }
        catch (err) {
            if (err.name === 'SecurityError') {
                // tainted canvas, we assume there is data at the given pixel (although there might not be)
                return new Uint8Array();
            }
            return data;
        }
        if (data[3] === 0) {
            return null;
        }
        return data;
    };
    return CanvasLayerRenderer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasLayerRenderer);
//# sourceMappingURL=Layer.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/canvas/TileLayer.js":
/*!******************************************************!*\
  !*** ./node_modules/ol/renderer/canvas/TileLayer.js ***!
  \******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _TileRange_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../TileRange.js */ "./node_modules/ol/TileRange.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Layer.js */ "./node_modules/ol/renderer/canvas/Layer.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _render_canvas_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../render/canvas.js */ "./node_modules/ol/render/canvas.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/canvas/TileLayer
 */









/**
 * @classdesc
 * Canvas renderer for tile layers.
 * @api
 */
var CanvasTileLayerRenderer = /** @class */ (function (_super) {
    __extends(CanvasTileLayerRenderer, _super);
    /**
     * @param {import("../../layer/Tile.js").default|import("../../layer/VectorTile.js").default} tileLayer Tile layer.
     */
    function CanvasTileLayerRenderer(tileLayer) {
        var _this = _super.call(this, tileLayer) || this;
        /**
         * Rendered extent has changed since the previous `renderFrame()` call
         * @type {boolean}
         */
        _this.extentChanged = true;
        /**
         * @private
         * @type {?import("../../extent.js").Extent}
         */
        _this.renderedExtent_ = null;
        /**
         * @protected
         * @type {number}
         */
        _this.renderedPixelRatio;
        /**
         * @protected
         * @type {import("../../proj/Projection.js").default}
         */
        _this.renderedProjection = null;
        /**
         * @protected
         * @type {number}
         */
        _this.renderedRevision;
        /**
         * @protected
         * @type {!Array<import("../../Tile.js").default>}
         */
        _this.renderedTiles = [];
        /**
         * @private
         * @type {boolean}
         */
        _this.newTiles_ = false;
        /**
         * @protected
         * @type {import("../../extent.js").Extent}
         */
        _this.tmpExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["createEmpty"])();
        /**
         * @private
         * @type {import("../../TileRange.js").default}
         */
        _this.tmpTileRange_ = new _TileRange_js__WEBPACK_IMPORTED_MODULE_2__["default"](0, 0, 0, 0);
        return _this;
    }
    /**
     * @protected
     * @param {import("../../Tile.js").default} tile Tile.
     * @return {boolean} Tile is drawable.
     */
    CanvasTileLayerRenderer.prototype.isDrawableTile = function (tile) {
        var tileLayer = this.getLayer();
        var tileState = tile.getState();
        var useInterimTilesOnError = tileLayer.getUseInterimTilesOnError();
        return tileState == _TileState_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOADED ||
            tileState == _TileState_js__WEBPACK_IMPORTED_MODULE_3__["default"].EMPTY ||
            tileState == _TileState_js__WEBPACK_IMPORTED_MODULE_3__["default"].ERROR && !useInterimTilesOnError;
    };
    /**
     * @param {number} z Tile coordinate z.
     * @param {number} x Tile coordinate x.
     * @param {number} y Tile coordinate y.
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @return {!import("../../Tile.js").default} Tile.
     */
    CanvasTileLayerRenderer.prototype.getTile = function (z, x, y, frameState) {
        var pixelRatio = frameState.pixelRatio;
        var projection = frameState.viewState.projection;
        var tileLayer = this.getLayer();
        var tileSource = tileLayer.getSource();
        var tile = tileSource.getTile(z, x, y, pixelRatio, projection);
        if (tile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_3__["default"].ERROR) {
            if (!tileLayer.getUseInterimTilesOnError()) {
                // When useInterimTilesOnError is false, we consider the error tile as loaded.
                tile.setState(_TileState_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOADED);
            }
            else if (tileLayer.getPreload() > 0) {
                // Preloaded tiles for lower resolutions might have finished loading.
                this.newTiles_ = true;
            }
        }
        if (!this.isDrawableTile(tile)) {
            tile = tile.getInterimTile();
        }
        return tile;
    };
    /**
     * @inheritDoc
     */
    CanvasTileLayerRenderer.prototype.loadedTileCallback = function (tiles, zoom, tile) {
        if (this.isDrawableTile(tile)) {
            return _super.prototype.loadedTileCallback.call(this, tiles, zoom, tile);
        }
        return false;
    };
    /**
     * @inheritDoc
     */
    CanvasTileLayerRenderer.prototype.prepareFrame = function (frameState) {
        return !!this.getLayer().getSource();
    };
    /**
     * TODO: File a TypeScript issue about inheritDoc not being followed
     * all the way.  Without this explicit return type, the VectorTileLayer
     * renderFrame function does not pass.
     *
     * @inheritDoc
     * @returns {HTMLElement} The rendered element.
     */
    CanvasTileLayerRenderer.prototype.renderFrame = function (frameState, target) {
        var layerState = frameState.layerStatesArray[frameState.layerIndex];
        var viewState = frameState.viewState;
        var projection = viewState.projection;
        var viewResolution = viewState.resolution;
        var viewCenter = viewState.center;
        var rotation = viewState.rotation;
        var pixelRatio = frameState.pixelRatio;
        var tileLayer = this.getLayer();
        var tileSource = tileLayer.getSource();
        var sourceRevision = tileSource.getRevision();
        var tileGrid = tileSource.getTileGridForProjection(projection);
        var z = tileGrid.getZForResolution(viewResolution, tileSource.zDirection);
        var tileResolution = tileGrid.getResolution(z);
        var extent = frameState.extent;
        var layerExtent = layerState.extent && Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["fromUserExtent"])(layerState.extent, projection);
        if (layerExtent) {
            extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getIntersection"])(extent, Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["fromUserExtent"])(layerState.extent, projection));
        }
        var tilePixelRatio = tileSource.getTilePixelRatio(pixelRatio);
        // desired dimensions of the canvas in pixels
        var width = Math.round(frameState.size[0] * tilePixelRatio);
        var height = Math.round(frameState.size[1] * tilePixelRatio);
        if (rotation) {
            var size = Math.round(Math.sqrt(width * width + height * height));
            width = size;
            height = size;
        }
        var dx = tileResolution * width / 2 / tilePixelRatio;
        var dy = tileResolution * height / 2 / tilePixelRatio;
        var canvasExtent = [
            viewCenter[0] - dx,
            viewCenter[1] - dy,
            viewCenter[0] + dx,
            viewCenter[1] + dy
        ];
        var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);
        /**
         * @type {Object<number, Object<string, import("../../Tile.js").default>>}
         */
        var tilesToDrawByZ = {};
        tilesToDrawByZ[z] = {};
        var findLoadedTiles = this.createLoadedTileFinder(tileSource, projection, tilesToDrawByZ);
        var tmpExtent = this.tmpExtent;
        var tmpTileRange = this.tmpTileRange_;
        this.newTiles_ = false;
        for (var x = tileRange.minX; x <= tileRange.maxX; ++x) {
            for (var y = tileRange.minY; y <= tileRange.maxY; ++y) {
                var tile = this.getTile(z, x, y, frameState);
                if (this.isDrawableTile(tile)) {
                    var uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(this);
                    if (tile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOADED) {
                        tilesToDrawByZ[z][tile.tileCoord.toString()] = tile;
                        var inTransition = tile.inTransition(uid);
                        if (!this.newTiles_ && (inTransition || this.renderedTiles.indexOf(tile) === -1)) {
                            this.newTiles_ = true;
                        }
                    }
                    if (tile.getAlpha(uid, frameState.time) === 1) {
                        // don't look for alt tiles if alpha is 1
                        continue;
                    }
                }
                var childTileRange = tileGrid.getTileCoordChildTileRange(tile.tileCoord, tmpTileRange, tmpExtent);
                var covered = false;
                if (childTileRange) {
                    covered = findLoadedTiles(z + 1, childTileRange);
                }
                if (!covered) {
                    tileGrid.forEachTileCoordParentTileRange(tile.tileCoord, findLoadedTiles, tmpTileRange, tmpExtent);
                }
            }
        }
        var canvasScale = tileResolution / viewResolution;
        // set forward and inverse pixel transforms
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["compose"])(this.pixelTransform, frameState.size[0] / 2, frameState.size[1] / 2, 1 / tilePixelRatio, 1 / tilePixelRatio, rotation, -width / 2, -height / 2);
        var canvasTransform = Object(_render_canvas_js__WEBPACK_IMPORTED_MODULE_8__["createTransformString"])(this.pixelTransform);
        this.useContainer(target, canvasTransform, layerState.opacity);
        var context = this.context;
        var canvas = context.canvas;
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["makeInverse"])(this.inversePixelTransform, this.pixelTransform);
        // set scale transform for calculating tile positions on the canvas
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["compose"])(this.tempTransform_, width / 2, height / 2, canvasScale, canvasScale, 0, -width / 2, -height / 2);
        if (canvas.width != width || canvas.height != height) {
            canvas.width = width;
            canvas.height = height;
        }
        else if (!this.containerReused) {
            context.clearRect(0, 0, width, height);
        }
        if (layerExtent) {
            this.clipUnrotated(context, frameState, layerExtent);
        }
        this.preRender(context, frameState);
        this.renderedTiles.length = 0;
        /** @type {Array<number>} */
        var zs = Object.keys(tilesToDrawByZ).map(Number);
        zs.sort(_array_js__WEBPACK_IMPORTED_MODULE_7__["numberSafeCompareFunction"]);
        var clips, clipZs, currentClip;
        if (layerState.opacity === 1 && (!this.containerReused || tileSource.getOpaque(frameState.viewState.projection))) {
            zs = zs.reverse();
        }
        else {
            clips = [];
            clipZs = [];
        }
        for (var i = zs.length - 1; i >= 0; --i) {
            var currentZ = zs[i];
            var currentTilePixelSize = tileSource.getTilePixelSize(currentZ, pixelRatio, projection);
            var currentResolution = tileGrid.getResolution(currentZ);
            var currentScale = currentResolution / tileResolution;
            var dx_1 = currentTilePixelSize[0] * currentScale * canvasScale;
            var dy_1 = currentTilePixelSize[1] * currentScale * canvasScale;
            var originTileCoord = tileGrid.getTileCoordForCoordAndZ(Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getTopLeft"])(canvasExtent), currentZ);
            var originTileExtent = tileGrid.getTileCoordExtent(originTileCoord);
            var origin_1 = Object(_transform_js__WEBPACK_IMPORTED_MODULE_6__["apply"])(this.tempTransform_, [
                tilePixelRatio * (originTileExtent[0] - canvasExtent[0]) / tileResolution,
                tilePixelRatio * (canvasExtent[3] - originTileExtent[3]) / tileResolution
            ]);
            var tileGutter = tilePixelRatio * tileSource.getGutterForProjection(projection);
            var tilesToDraw = tilesToDrawByZ[currentZ];
            for (var tileCoordKey in tilesToDraw) {
                var tile = /** @type {import("../../ImageTile.js").default} */ (tilesToDraw[tileCoordKey]);
                var tileCoord = tile.tileCoord;
                // Calculate integer positions and sizes so that tiles align
                var floatX = (origin_1[0] - (originTileCoord[1] - tileCoord[1]) * dx_1);
                var nextX = Math.round(floatX + dx_1);
                var floatY = (origin_1[1] - (originTileCoord[2] - tileCoord[2]) * dy_1);
                var nextY = Math.round(floatY + dy_1);
                var x = Math.round(floatX);
                var y = Math.round(floatY);
                var w = nextX - x;
                var h = nextY - y;
                var transition = z === currentZ;
                var inTransition = transition && tile.getAlpha(Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(this), frameState.time) !== 1;
                if (!inTransition) {
                    if (clips) {
                        // Clip mask for regions in this tile that already filled by a higher z tile
                        context.save();
                        currentClip = [x, y, x + w, y, x + w, y + h, x, y + h];
                        for (var i_1 = 0, ii = clips.length; i_1 < ii; ++i_1) {
                            if (z !== currentZ && currentZ < clipZs[i_1]) {
                                var clip = clips[i_1];
                                context.beginPath();
                                // counter-clockwise (outer ring) for current tile
                                context.moveTo(currentClip[0], currentClip[1]);
                                context.lineTo(currentClip[2], currentClip[3]);
                                context.lineTo(currentClip[4], currentClip[5]);
                                context.lineTo(currentClip[6], currentClip[7]);
                                // clockwise (inner ring) for higher z tile
                                context.moveTo(clip[6], clip[7]);
                                context.lineTo(clip[4], clip[5]);
                                context.lineTo(clip[2], clip[3]);
                                context.lineTo(clip[0], clip[1]);
                                context.clip();
                            }
                        }
                        clips.push(currentClip);
                        clipZs.push(currentZ);
                    }
                    else {
                        context.clearRect(x, y, w, h);
                    }
                }
                this.drawTileImage(tile, frameState, x, y, w, h, tileGutter, transition, layerState.opacity);
                if (clips && !inTransition) {
                    context.restore();
                }
                this.renderedTiles.push(tile);
                this.updateUsedTiles(frameState.usedTiles, tileSource, tile);
            }
        }
        this.renderedRevision = sourceRevision;
        this.renderedResolution = tileResolution;
        this.extentChanged = !this.renderedExtent_ || !Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["equals"])(this.renderedExtent_, canvasExtent);
        this.renderedExtent_ = canvasExtent;
        this.renderedPixelRatio = pixelRatio;
        this.renderedProjection = projection;
        this.manageTilePyramid(frameState, tileSource, tileGrid, pixelRatio, projection, extent, z, tileLayer.getPreload());
        this.scheduleExpireCache(frameState, tileSource);
        this.postRender(context, frameState);
        if (layerState.extent) {
            context.restore();
        }
        if (canvasTransform !== canvas.style.transform) {
            canvas.style.transform = canvasTransform;
        }
        return this.container;
    };
    /**
     * @param {import("../../ImageTile.js").default} tile Tile.
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @param {number} x Left of the tile.
     * @param {number} y Top of the tile.
     * @param {number} w Width of the tile.
     * @param {number} h Height of the tile.
     * @param {number} gutter Tile gutter.
     * @param {boolean} transition Apply an alpha transition.
     * @param {number} opacity Opacity.
     */
    CanvasTileLayerRenderer.prototype.drawTileImage = function (tile, frameState, x, y, w, h, gutter, transition, opacity) {
        var image = this.getTileImage(tile);
        if (!image) {
            return;
        }
        var uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(this);
        var tileAlpha = transition ? tile.getAlpha(uid, frameState.time) : 1;
        var alpha = opacity * tileAlpha;
        var alphaChanged = alpha !== this.context.globalAlpha;
        if (alphaChanged) {
            this.context.save();
            this.context.globalAlpha = alpha;
        }
        this.context.drawImage(image, gutter, gutter, image.width - 2 * gutter, image.height - 2 * gutter, x, y, w, h);
        if (alphaChanged) {
            this.context.restore();
        }
        if (tileAlpha !== 1) {
            frameState.animate = true;
        }
        else if (transition) {
            tile.endTransition(uid);
        }
    };
    /**
     * @inheritDoc
     */
    CanvasTileLayerRenderer.prototype.getImage = function () {
        var context = this.context;
        return context ? context.canvas : null;
    };
    /**
     * Get the image from a tile.
     * @param {import("../../ImageTile.js").default} tile Tile.
     * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
     * @protected
     */
    CanvasTileLayerRenderer.prototype.getTileImage = function (tile) {
        return tile.getImage();
    };
    /**
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @param {import("../../source/Tile.js").default} tileSource Tile source.
     * @protected
     */
    CanvasTileLayerRenderer.prototype.scheduleExpireCache = function (frameState, tileSource) {
        if (tileSource.canExpireCache()) {
            /**
             * @param {import("../../source/Tile.js").default} tileSource Tile source.
             * @param {import("../../PluggableMap.js").default} map Map.
             * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
             */
            var postRenderFunction = function (tileSource, map, frameState) {
                var tileSourceKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(tileSource);
                if (tileSourceKey in frameState.usedTiles) {
                    tileSource.expireCache(frameState.viewState.projection, frameState.usedTiles[tileSourceKey]);
                }
            }.bind(null, tileSource);
            frameState.postRenderFunctions.push(
            /** @type {import("../../PluggableMap.js").PostRenderFunction} */ (postRenderFunction));
        }
    };
    /**
     * @param {!Object<string, !Object<string, boolean>>} usedTiles Used tiles.
     * @param {import("../../source/Tile.js").default} tileSource Tile source.
     * @param {import('../../Tile.js').default} tile Tile.
     * @protected
     */
    CanvasTileLayerRenderer.prototype.updateUsedTiles = function (usedTiles, tileSource, tile) {
        // FIXME should we use tilesToDrawByZ instead?
        var tileSourceKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(tileSource);
        if (!(tileSourceKey in usedTiles)) {
            usedTiles[tileSourceKey] = {};
        }
        usedTiles[tileSourceKey][tile.getKey()] = true;
    };
    /**
     * Manage tile pyramid.
     * This function performs a number of functions related to the tiles at the
     * current zoom and lower zoom levels:
     * - registers idle tiles in frameState.wantedTiles so that they are not
     *   discarded by the tile queue
     * - enqueues missing tiles
     * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
     * @param {import("../../source/Tile.js").default} tileSource Tile source.
     * @param {import("../../tilegrid/TileGrid.js").default} tileGrid Tile grid.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../../proj/Projection.js").default} projection Projection.
     * @param {import("../../extent.js").Extent} extent Extent.
     * @param {number} currentZ Current Z.
     * @param {number} preload Load low resolution tiles up to 'preload' levels.
     * @param {function(import("../../Tile.js").default)=} opt_tileCallback Tile callback.
     * @protected
     */
    CanvasTileLayerRenderer.prototype.manageTilePyramid = function (frameState, tileSource, tileGrid, pixelRatio, projection, extent, currentZ, preload, opt_tileCallback) {
        var tileSourceKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(tileSource);
        if (!(tileSourceKey in frameState.wantedTiles)) {
            frameState.wantedTiles[tileSourceKey] = {};
        }
        var wantedTiles = frameState.wantedTiles[tileSourceKey];
        var tileQueue = frameState.tileQueue;
        var minZoom = tileGrid.getMinZoom();
        var tile, tileRange, tileResolution, x, y, z;
        for (z = minZoom; z <= currentZ; ++z) {
            tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z, tileRange);
            tileResolution = tileGrid.getResolution(z);
            for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
                for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
                    if (currentZ - z <= preload) {
                        tile = tileSource.getTile(z, x, y, pixelRatio, projection);
                        if (tile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_3__["default"].IDLE) {
                            wantedTiles[tile.getKey()] = true;
                            if (!tileQueue.isKeyQueued(tile.getKey())) {
                                tileQueue.enqueue([tile, tileSourceKey,
                                    tileGrid.getTileCoordCenter(tile.tileCoord), tileResolution]);
                            }
                        }
                        if (opt_tileCallback !== undefined) {
                            opt_tileCallback(tile);
                        }
                    }
                    else {
                        tileSource.useTile(z, x, y, projection);
                    }
                }
            }
        }
    };
    return CanvasTileLayerRenderer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/**
 * @function
 * @return {import("../../layer/Tile.js").default|import("../../layer/VectorTile.js").default}
 */
CanvasTileLayerRenderer.prototype.getLayer;
/* harmony default export */ __webpack_exports__["default"] = (CanvasTileLayerRenderer);
//# sourceMappingURL=TileLayer.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/canvas/VectorImageLayer.js":
/*!*************************************************************!*\
  !*** ./node_modules/ol/renderer/canvas/VectorImageLayer.js ***!
  \*************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ImageCanvas_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ImageCanvas.js */ "./node_modules/ol/ImageCanvas.js");
/* harmony import */ var _ViewHint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../ViewHint.js */ "./node_modules/ol/ViewHint.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _ImageLayer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ImageLayer.js */ "./node_modules/ol/renderer/canvas/ImageLayer.js");
/* harmony import */ var _VectorLayer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./VectorLayer.js */ "./node_modules/ol/renderer/canvas/VectorLayer.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _render_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../render.js */ "./node_modules/ol/render.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/canvas/VectorImageLayer
 */










/**
 * @classdesc
 * Canvas renderer for image layers.
 * @api
 */
var CanvasVectorImageLayerRenderer = /** @class */ (function (_super) {
    __extends(CanvasVectorImageLayerRenderer, _super);
    /**
     * @param {import("../../layer/VectorImage.js").default} layer Vector image layer.
     */
    function CanvasVectorImageLayerRenderer(layer) {
        var _this = _super.call(this, layer) || this;
        /**
         * @private
         * @type {import("./VectorLayer.js").default}
         */
        _this.vectorRenderer_ = new _VectorLayer_js__WEBPACK_IMPORTED_MODULE_5__["default"](layer);
        /**
         * @private
         * @type {number}
         */
        _this.layerImageRatio_ = layer.getImageRatio();
        /**
         * @private
         * @type {import("../../transform.js").Transform}
         */
        _this.coordinateToVectorPixelTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_9__["create"])();
        /**
         * @private
         * @type {import("../../transform.js").Transform}
         */
        _this.renderedPixelToCoordinateTransform_ = null;
        return _this;
    }
    /**
     * @inheritDoc
     */
    CanvasVectorImageLayerRenderer.prototype.disposeInternal = function () {
        this.vectorRenderer_.dispose();
        _super.prototype.disposeInternal.call(this);
    };
    /**
     * @inheritDoc
     */
    CanvasVectorImageLayerRenderer.prototype.getFeatures = function (pixel) {
        if (this.vectorRenderer_) {
            var vectorPixel = Object(_transform_js__WEBPACK_IMPORTED_MODULE_9__["apply"])(this.coordinateToVectorPixelTransform_, Object(_transform_js__WEBPACK_IMPORTED_MODULE_9__["apply"])(this.renderedPixelToCoordinateTransform_, pixel.slice()));
            return this.vectorRenderer_.getFeatures(vectorPixel);
        }
        else {
            var promise = new Promise(function (resolve, reject) {
                resolve([]);
            });
            return promise;
        }
    };
    /**
     * @inheritDoc
     */
    CanvasVectorImageLayerRenderer.prototype.handleFontsChanged = function () {
        this.vectorRenderer_.handleFontsChanged();
    };
    /**
     * @inheritDoc
     */
    CanvasVectorImageLayerRenderer.prototype.prepareFrame = function (frameState) {
        var pixelRatio = frameState.pixelRatio;
        var viewState = frameState.viewState;
        var viewResolution = viewState.resolution;
        var hints = frameState.viewHints;
        var vectorRenderer = this.vectorRenderer_;
        var renderedExtent = frameState.extent;
        if (this.layerImageRatio_ !== 1) {
            renderedExtent = renderedExtent.slice(0);
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["scaleFromCenter"])(renderedExtent, this.layerImageRatio_);
        }
        var width = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(renderedExtent) / viewResolution;
        var height = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getHeight"])(renderedExtent) / viewResolution;
        if (!hints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].ANIMATING] && !hints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].INTERACTING] && !Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["isEmpty"])(renderedExtent)) {
            vectorRenderer.useContainer(null, null, 1);
            var context = vectorRenderer.context;
            var imageFrameState_1 = /** @type {import("../../PluggableMap.js").FrameState} */ (Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])({}, frameState, {
                declutterItems: [],
                extent: renderedExtent,
                size: [width, height],
                viewState: /** @type {import("../../View.js").State} */ (Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])({}, frameState.viewState, {
                    rotation: 0
                }))
            }));
            var image_1 = new _ImageCanvas_js__WEBPACK_IMPORTED_MODULE_0__["default"](renderedExtent, viewResolution, pixelRatio, context.canvas, function (callback) {
                if (vectorRenderer.prepareFrame(imageFrameState_1) && vectorRenderer.replayGroupChanged) {
                    vectorRenderer.renderFrame(imageFrameState_1, null);
                    Object(_render_js__WEBPACK_IMPORTED_MODULE_8__["renderDeclutterItems"])(imageFrameState_1, null);
                    callback();
                }
            });
            image_1.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_6__["default"].CHANGE, function () {
                if (image_1.getState() === _ImageState_js__WEBPACK_IMPORTED_MODULE_7__["default"].LOADED) {
                    this.image_ = image_1;
                }
            }.bind(this));
            image_1.load();
        }
        if (this.image_) {
            var image = this.image_;
            var imageResolution = image.getResolution();
            var imagePixelRatio = image.getPixelRatio();
            var renderedResolution = imageResolution * pixelRatio / imagePixelRatio;
            this.renderedResolution = renderedResolution;
            this.renderedPixelToCoordinateTransform_ = frameState.pixelToCoordinateTransform.slice();
            this.coordinateToVectorPixelTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_9__["compose"])(this.coordinateToVectorPixelTransform_, width / 2, height / 2, 1 / renderedResolution, -1 / renderedResolution, 0, -viewState.center[0], -viewState.center[1]);
        }
        return !!this.image_;
    };
    /**
     * @override
     */
    CanvasVectorImageLayerRenderer.prototype.preRender = function () { };
    /**
     * @override
     */
    CanvasVectorImageLayerRenderer.prototype.postRender = function () { };
    /**
     * @inheritDoc
     */
    CanvasVectorImageLayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
        if (this.vectorRenderer_) {
            return this.vectorRenderer_.forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures);
        }
        else {
            return _super.prototype.forEachFeatureAtCoordinate.call(this, coordinate, frameState, hitTolerance, callback, declutteredFeatures);
        }
    };
    return CanvasVectorImageLayerRenderer;
}(_ImageLayer_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasVectorImageLayerRenderer);
//# sourceMappingURL=VectorImageLayer.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/canvas/VectorLayer.js":
/*!********************************************************!*\
  !*** ./node_modules/ol/renderer/canvas/VectorLayer.js ***!
  \********************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _ViewHint_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../ViewHint.js */ "./node_modules/ol/ViewHint.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _render_canvas_BuilderGroup_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../render/canvas/BuilderGroup.js */ "./node_modules/ol/render/canvas/BuilderGroup.js");
/* harmony import */ var _render_canvas_ExecutorGroup_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../render/canvas/ExecutorGroup.js */ "./node_modules/ol/render/canvas/ExecutorGroup.js");
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Layer.js */ "./node_modules/ol/renderer/canvas/Layer.js");
/* harmony import */ var _vector_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../vector.js */ "./node_modules/ol/renderer/vector.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _render_canvas_hitdetect_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../render/canvas/hitdetect.js */ "./node_modules/ol/render/canvas/hitdetect.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/canvas/VectorLayer
 */











/**
 * @classdesc
 * Canvas renderer for vector layers.
 * @api
 */
var CanvasVectorLayerRenderer = /** @class */ (function (_super) {
    __extends(CanvasVectorLayerRenderer, _super);
    /**
     * @param {import("../../layer/Vector.js").default} vectorLayer Vector layer.
     */
    function CanvasVectorLayerRenderer(vectorLayer) {
        var _this = _super.call(this, vectorLayer) || this;
        /** @private */
        _this.boundHandleStyleImageChange_ = _this.handleStyleImageChange_.bind(_this);
        /**
         * @type {boolean}
         */
        _this.animatingOrInteracting_;
        /**
         * @private
         * @type {boolean}
         */
        _this.dirty_ = false;
        /**
         * @type {ImageData}
         */
        _this.hitDetectionImageData_ = null;
        /**
         * @type {Array<import("../../Feature.js").default>}
         */
        _this.renderedFeatures_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.renderedRevision_ = -1;
        /**
         * @private
         * @type {number}
         */
        _this.renderedResolution_ = NaN;
        /**
         * @private
         * @type {import("../../extent.js").Extent}
         */
        _this.renderedExtent_ = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["createEmpty"])();
        /**
         * @private
         * @type {number}
         */
        _this.renderedRotation_;
        /**
         * @private
         * @type {import("../../coordinate").Coordinate}
         */
        _this.renderedCenter_ = null;
        /**
         * @private
         * @type {import("../../proj/Projection").default}
         */
        _this.renderedProjection_ = null;
        /**
         * @private
         * @type {function(import("../../Feature.js").default, import("../../Feature.js").default): number|null}
         */
        _this.renderedRenderOrder_ = null;
        /**
         * @private
         * @type {import("../../render/canvas/ExecutorGroup").default}
         */
        _this.replayGroup_ = null;
        /**
         * A new replay group had to be created by `prepareFrame()`
         * @type {boolean}
         */
        _this.replayGroupChanged = true;
        return _this;
    }
    /**
     * @inheritDoc
     */
    CanvasVectorLayerRenderer.prototype.useContainer = function (target, transform, opacity) {
        if (opacity < 1) {
            target = null;
        }
        _super.prototype.useContainer.call(this, target, transform, opacity);
    };
    /**
     * @inheritDoc
     */
    CanvasVectorLayerRenderer.prototype.renderFrame = function (frameState, target) {
        var pixelRatio = frameState.pixelRatio;
        var layerState = frameState.layerStatesArray[frameState.layerIndex];
        // set forward and inverse pixel transforms
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_9__["makeScale"])(this.pixelTransform, 1 / pixelRatio, 1 / pixelRatio);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_9__["makeInverse"])(this.inversePixelTransform, this.pixelTransform);
        var canvasTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_9__["toString"])(this.pixelTransform);
        this.useContainer(target, canvasTransform, layerState.opacity);
        var context = this.context;
        var canvas = context.canvas;
        var replayGroup = this.replayGroup_;
        if (!replayGroup || replayGroup.isEmpty()) {
            if (!this.containerReused && canvas.width > 0) {
                canvas.width = 0;
            }
            return this.container;
        }
        // resize and clear
        var width = Math.round(frameState.size[0] * pixelRatio);
        var height = Math.round(frameState.size[1] * pixelRatio);
        if (canvas.width != width || canvas.height != height) {
            canvas.width = width;
            canvas.height = height;
            if (canvas.style.transform !== canvasTransform) {
                canvas.style.transform = canvasTransform;
            }
        }
        else if (!this.containerReused) {
            context.clearRect(0, 0, width, height);
        }
        this.preRender(context, frameState);
        var extent = frameState.extent;
        var viewState = frameState.viewState;
        var center = viewState.center;
        var resolution = viewState.resolution;
        var projection = viewState.projection;
        var rotation = viewState.rotation;
        var projectionExtent = projection.getExtent();
        var vectorSource = this.getLayer().getSource();
        // clipped rendering if layer extent is set
        var clipped = false;
        if (layerState.extent) {
            var layerExtent = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["fromUserExtent"])(layerState.extent, projection);
            clipped = !Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsExtent"])(layerExtent, frameState.extent) && Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(layerExtent, frameState.extent);
            if (clipped) {
                this.clip(context, frameState, layerExtent);
            }
        }
        var viewHints = frameState.viewHints;
        var snapToPixel = !(viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].ANIMATING] || viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].INTERACTING]);
        var transform = this.getRenderTransform(center, resolution, rotation, pixelRatio, width, height, 0);
        var declutterReplays = this.getLayer().getDeclutter() ? {} : null;
        replayGroup.execute(context, transform, rotation, snapToPixel, undefined, declutterReplays);
        if (vectorSource.getWrapX() && projection.canWrapX() && !Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsExtent"])(projectionExtent, extent)) {
            var startX = extent[0];
            var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(projectionExtent);
            var world = 0;
            var offsetX = void 0;
            while (startX < projectionExtent[0]) {
                --world;
                offsetX = worldWidth * world;
                var transform_1 = this.getRenderTransform(center, resolution, rotation, pixelRatio, width, height, offsetX);
                replayGroup.execute(context, transform_1, rotation, snapToPixel, undefined, declutterReplays);
                startX += worldWidth;
            }
            world = 0;
            startX = extent[2];
            while (startX > projectionExtent[2]) {
                ++world;
                offsetX = worldWidth * world;
                var transform_2 = this.getRenderTransform(center, resolution, rotation, pixelRatio, width, height, offsetX);
                replayGroup.execute(context, transform_2, rotation, snapToPixel, undefined, declutterReplays);
                startX -= worldWidth;
            }
        }
        if (declutterReplays) {
            var viewHints_1 = frameState.viewHints;
            var hifi = !(viewHints_1[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].ANIMATING] || viewHints_1[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].INTERACTING]);
            Object(_render_canvas_ExecutorGroup_js__WEBPACK_IMPORTED_MODULE_6__["replayDeclutter"])(declutterReplays, context, rotation, 1, hifi, frameState.declutterItems);
        }
        if (clipped) {
            context.restore();
        }
        this.postRender(context, frameState);
        var opacity = layerState.opacity;
        var container = this.container;
        if (opacity !== parseFloat(container.style.opacity)) {
            container.style.opacity = opacity === 1 ? '' : opacity;
        }
        return this.container;
    };
    /**
     * @inheritDoc
     */
    CanvasVectorLayerRenderer.prototype.getFeatures = function (pixel) {
        return new Promise(function (resolve, reject) {
            if (!this.hitDetectionImageData_ && !this.animatingOrInteracting_) {
                var size = [this.context.canvas.width, this.context.canvas.height];
                Object(_transform_js__WEBPACK_IMPORTED_MODULE_9__["apply"])(this.pixelTransform, size);
                var center = this.renderedCenter_;
                var resolution = this.renderedResolution_;
                var rotation = this.renderedRotation_;
                var projection = this.renderedProjection_;
                var extent = this.renderedExtent_;
                var layer = this.getLayer();
                var transforms = [];
                var width = size[0] / 2;
                var height = size[1] / 2;
                transforms.push(this.getRenderTransform(center, resolution, rotation, 0.5, width, height, 0).slice());
                var source = layer.getSource();
                var projectionExtent = projection.getExtent();
                if (source.getWrapX() && projection.canWrapX() && !Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsExtent"])(projectionExtent, extent)) {
                    var startX = extent[0];
                    var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(projectionExtent);
                    var world = 0;
                    var offsetX = void 0;
                    while (startX < projectionExtent[0]) {
                        --world;
                        offsetX = worldWidth * world;
                        transforms.push(this.getRenderTransform(center, resolution, rotation, 0.5, width, height, offsetX).slice());
                        startX += worldWidth;
                    }
                    world = 0;
                    startX = extent[2];
                    while (startX > projectionExtent[2]) {
                        ++world;
                        offsetX = worldWidth * world;
                        transforms.push(this.getRenderTransform(center, resolution, rotation, 0.5, width, height, offsetX).slice());
                        startX -= worldWidth;
                    }
                }
                this.hitDetectionImageData_ = Object(_render_canvas_hitdetect_js__WEBPACK_IMPORTED_MODULE_10__["createHitDetectionImageData"])(size, transforms, this.renderedFeatures_, layer.getStyleFunction(), extent, resolution, rotation);
            }
            resolve(Object(_render_canvas_hitdetect_js__WEBPACK_IMPORTED_MODULE_10__["hitDetect"])(pixel, this.renderedFeatures_, this.hitDetectionImageData_));
        }.bind(this));
    };
    /**
     * @inheritDoc
     */
    CanvasVectorLayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
        if (!this.replayGroup_) {
            return undefined;
        }
        else {
            var resolution = frameState.viewState.resolution;
            var rotation = frameState.viewState.rotation;
            var layer_1 = this.getLayer();
            /** @type {!Object<string, boolean>} */
            var features_1 = {};
            var result = this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, 
            /**
             * @param {import("../../Feature.js").FeatureLike} feature Feature.
             * @return {?} Callback result.
             */
            function (feature) {
                var key = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
                if (!(key in features_1)) {
                    features_1[key] = true;
                    return callback(feature, layer_1);
                }
            }, layer_1.getDeclutter() ? declutteredFeatures : null);
            return result;
        }
    };
    /**
     * @inheritDoc
     */
    CanvasVectorLayerRenderer.prototype.handleFontsChanged = function () {
        var layer = this.getLayer();
        if (layer.getVisible() && this.replayGroup_) {
            layer.changed();
        }
    };
    /**
     * Handle changes in image style state.
     * @param {import("../../events/Event.js").default} event Image style change event.
     * @private
     */
    CanvasVectorLayerRenderer.prototype.handleStyleImageChange_ = function (event) {
        this.renderIfReadyAndVisible();
    };
    /**
     * @inheritDoc
     */
    CanvasVectorLayerRenderer.prototype.prepareFrame = function (frameState) {
        var vectorLayer = this.getLayer();
        var vectorSource = vectorLayer.getSource();
        if (!vectorSource) {
            return false;
        }
        var animating = frameState.viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].ANIMATING];
        var interacting = frameState.viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_1__["default"].INTERACTING];
        var updateWhileAnimating = vectorLayer.getUpdateWhileAnimating();
        var updateWhileInteracting = vectorLayer.getUpdateWhileInteracting();
        if (!this.dirty_ && (!updateWhileAnimating && animating) ||
            (!updateWhileInteracting && interacting)) {
            this.animatingOrInteracting_ = true;
            return true;
        }
        this.animatingOrInteracting_ = false;
        var frameStateExtent = frameState.extent;
        var viewState = frameState.viewState;
        var projection = viewState.projection;
        var resolution = viewState.resolution;
        var pixelRatio = frameState.pixelRatio;
        var vectorLayerRevision = vectorLayer.getRevision();
        var vectorLayerRenderBuffer = vectorLayer.getRenderBuffer();
        var vectorLayerRenderOrder = vectorLayer.getRenderOrder();
        if (vectorLayerRenderOrder === undefined) {
            vectorLayerRenderOrder = _vector_js__WEBPACK_IMPORTED_MODULE_8__["defaultOrder"];
        }
        var center = viewState.center.slice();
        var extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["buffer"])(frameStateExtent, vectorLayerRenderBuffer * resolution);
        var loadExtents = [extent.slice()];
        var projectionExtent = projection.getExtent();
        if (vectorSource.getWrapX() && projection.canWrapX() &&
            !Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsExtent"])(projectionExtent, frameState.extent)) {
            // For the replay group, we need an extent that intersects the real world
            // (-180° to +180°). To support geometries in a coordinate range from -540°
            // to +540°, we add at least 1 world width on each side of the projection
            // extent. If the viewport is wider than the world, we need to add half of
            // the viewport width to make sure we cover the whole viewport.
            var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(projectionExtent);
            var gutter = Math.max(Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(extent) / 2, worldWidth);
            extent[0] = projectionExtent[0] - gutter;
            extent[2] = projectionExtent[2] + gutter;
            Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_3__["wrapX"])(center, projection);
            var loadExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["wrapX"])(loadExtents[0], projection);
            // If the extent crosses the date line, we load data for both edges of the worlds
            if (loadExtent[0] < projectionExtent[0] && loadExtent[2] < projectionExtent[2]) {
                loadExtents.push([loadExtent[0] + worldWidth, loadExtent[1], loadExtent[2] + worldWidth, loadExtent[3]]);
            }
            else if (loadExtent[0] > projectionExtent[0] && loadExtent[2] > projectionExtent[2]) {
                loadExtents.push([loadExtent[0] - worldWidth, loadExtent[1], loadExtent[2] - worldWidth, loadExtent[3]]);
            }
        }
        if (!this.dirty_ &&
            this.renderedResolution_ == resolution &&
            this.renderedRevision_ == vectorLayerRevision &&
            this.renderedRenderOrder_ == vectorLayerRenderOrder &&
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsExtent"])(this.renderedExtent_, extent)) {
            this.replayGroupChanged = false;
            return true;
        }
        this.replayGroup_ = null;
        this.dirty_ = false;
        var replayGroup = new _render_canvas_BuilderGroup_js__WEBPACK_IMPORTED_MODULE_5__["default"](Object(_vector_js__WEBPACK_IMPORTED_MODULE_8__["getTolerance"])(resolution, pixelRatio), extent, resolution, pixelRatio, vectorLayer.getDeclutter());
        var userProjection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["getUserProjection"])();
        var userTransform;
        if (userProjection) {
            for (var i = 0, ii = loadExtents.length; i < ii; ++i) {
                vectorSource.loadFeatures(Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["toUserExtent"])(loadExtents[i], projection), resolution, userProjection);
            }
            userTransform = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["getTransformFromProjections"])(userProjection, projection);
        }
        else {
            for (var i = 0, ii = loadExtents.length; i < ii; ++i) {
                vectorSource.loadFeatures(loadExtents[i], resolution, projection);
            }
        }
        var squaredTolerance = Object(_vector_js__WEBPACK_IMPORTED_MODULE_8__["getSquaredTolerance"])(resolution, pixelRatio);
        /**
         * @param {import("../../Feature.js").default} feature Feature.
         * @this {CanvasVectorLayerRenderer}
         */
        var render = function (feature) {
            var styles;
            var styleFunction = feature.getStyleFunction() || vectorLayer.getStyleFunction();
            if (styleFunction) {
                styles = styleFunction(feature, resolution);
            }
            if (styles) {
                var dirty = this.renderFeature(feature, squaredTolerance, styles, replayGroup, userTransform);
                this.dirty_ = this.dirty_ || dirty;
            }
        }.bind(this);
        var userExtent = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["toUserExtent"])(extent, projection);
        /** @type {Array<import("../../Feature.js").default>} */
        var features = vectorSource.getFeaturesInExtent(userExtent);
        if (vectorLayerRenderOrder) {
            features.sort(vectorLayerRenderOrder);
        }
        for (var i = 0, ii = features.length; i < ii; ++i) {
            render(features[i]);
        }
        this.renderedFeatures_ = features;
        var replayGroupInstructions = replayGroup.finish();
        var executorGroup = new _render_canvas_ExecutorGroup_js__WEBPACK_IMPORTED_MODULE_6__["default"](extent, resolution, pixelRatio, vectorSource.getOverlaps(), replayGroupInstructions, vectorLayer.getRenderBuffer());
        this.renderedResolution_ = resolution;
        this.renderedRevision_ = vectorLayerRevision;
        this.renderedRenderOrder_ = vectorLayerRenderOrder;
        this.renderedExtent_ = extent;
        this.renderedRotation_ = viewState.rotation;
        this.renderedCenter_ = center;
        this.renderedProjection_ = projection;
        this.replayGroup_ = executorGroup;
        this.hitDetectionImageData_ = null;
        this.replayGroupChanged = true;
        return true;
    };
    /**
     * @param {import("../../Feature.js").default} feature Feature.
     * @param {number} squaredTolerance Squared render tolerance.
     * @param {import("../../style/Style.js").default|Array<import("../../style/Style.js").default>} styles The style or array of styles.
     * @param {import("../../render/canvas/BuilderGroup.js").default} builderGroup Builder group.
     * @param {import("../../proj.js").TransformFunction=} opt_transform Transform from user to view projection.
     * @return {boolean} `true` if an image is loading.
     */
    CanvasVectorLayerRenderer.prototype.renderFeature = function (feature, squaredTolerance, styles, builderGroup, opt_transform) {
        if (!styles) {
            return false;
        }
        var loading = false;
        if (Array.isArray(styles)) {
            for (var i = 0, ii = styles.length; i < ii; ++i) {
                loading = Object(_vector_js__WEBPACK_IMPORTED_MODULE_8__["renderFeature"])(builderGroup, feature, styles[i], squaredTolerance, this.boundHandleStyleImageChange_, opt_transform) || loading;
            }
        }
        else {
            loading = Object(_vector_js__WEBPACK_IMPORTED_MODULE_8__["renderFeature"])(builderGroup, feature, styles, squaredTolerance, this.boundHandleStyleImageChange_, opt_transform);
        }
        return loading;
    };
    return CanvasVectorLayerRenderer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_7__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasVectorLayerRenderer);
//# sourceMappingURL=VectorLayer.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/canvas/VectorTileLayer.js":
/*!************************************************************!*\
  !*** ./node_modules/ol/renderer/canvas/VectorTileLayer.js ***!
  \************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _ViewHint_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../ViewHint.js */ "./node_modules/ol/ViewHint.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _layer_VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../layer/VectorTileRenderType.js */ "./node_modules/ol/layer/VectorTileRenderType.js");
/* harmony import */ var _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../render/canvas/BuilderType.js */ "./node_modules/ol/render/canvas/BuilderType.js");
/* harmony import */ var _render_canvas_BuilderGroup_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../render/canvas/BuilderGroup.js */ "./node_modules/ol/render/canvas/BuilderGroup.js");
/* harmony import */ var _TileLayer_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TileLayer.js */ "./node_modules/ol/renderer/canvas/TileLayer.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _vector_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../vector.js */ "./node_modules/ol/renderer/vector.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _render_canvas_ExecutorGroup_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../render/canvas/ExecutorGroup.js */ "./node_modules/ol/render/canvas/ExecutorGroup.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _render_canvas_hitdetect_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../render/canvas/hitdetect.js */ "./node_modules/ol/render/canvas/hitdetect.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../coordinate.js */ "./node_modules/ol/coordinate.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/canvas/VectorTileLayer
 */

















/**
 * @type {!Object<string, Array<import("../../render/canvas/BuilderType.js").default>>}
 */
var IMAGE_REPLAYS = {
    'image': [_render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].POLYGON, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].CIRCLE,
        _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].LINE_STRING, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].IMAGE, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].TEXT],
    'hybrid': [_render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].POLYGON, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].LINE_STRING],
    'vector': []
};
/**
 * @type {!Object<string, Array<import("../../render/canvas/BuilderType.js").default>>}
 */
var VECTOR_REPLAYS = {
    'image': [_render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].DEFAULT],
    'hybrid': [_render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].IMAGE, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].TEXT, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].DEFAULT],
    'vector': [_render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].POLYGON, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].CIRCLE, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].LINE_STRING, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].IMAGE, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].TEXT, _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_7__["default"].DEFAULT]
};
/**
 * @classdesc
 * Canvas renderer for vector tile layers.
 * @api
 */
var CanvasVectorTileLayerRenderer = /** @class */ (function (_super) {
    __extends(CanvasVectorTileLayerRenderer, _super);
    /**
     * @param {import("../../layer/VectorTile.js").default} layer VectorTile layer.
     */
    function CanvasVectorTileLayerRenderer(layer) {
        var _this = _super.call(this, layer) || this;
        /** @private */
        _this.boundHandleStyleImageChange_ = _this.handleStyleImageChange_.bind(_this);
        /**
         * @private
         * @type {boolean}
         */
        _this.dirty_ = false;
        /**
         * @private
         * @type {number}
         */
        _this.renderedLayerRevision_;
        /**
         * @private
         * @type {import("../../transform").Transform}
         */
        _this.renderedPixelToCoordinateTransform_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.renderedRotation_;
        /**
         * @private
         * @type {!Object<string, import("../../VectorRenderTile.js").default>}
         */
        _this.renderTileImageQueue_ = {};
        /**
         * @type {Object<string, import("../../events.js").EventsKey>}
         */
        _this.tileListenerKeys_ = {};
        /**
         * @private
         * @type {import("../../transform.js").Transform}
         */
        _this.tmpTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["create"])();
        return _this;
    }
    /**
     * @param {import("../../VectorRenderTile.js").default} tile Tile.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../../proj/Projection").default} projection Projection.
     * @param {boolean} queue Queue tile for rendering.
     * @return {boolean|undefined} Tile needs to be rendered.
     */
    CanvasVectorTileLayerRenderer.prototype.prepareTile = function (tile, pixelRatio, projection, queue) {
        var render;
        var tileUid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(tile);
        var state = tile.getState();
        if (((state === _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED && tile.hifi) || state === _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR) &&
            tileUid in this.tileListenerKeys_) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["unlistenByKey"])(this.tileListenerKeys_[tileUid]);
            delete this.tileListenerKeys_[tileUid];
        }
        if (state === _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED || state === _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR) {
            this.updateExecutorGroup_(tile, pixelRatio, projection);
            if (this.tileImageNeedsRender_(tile, pixelRatio, projection)) {
                render = true;
                if (queue) {
                    this.renderTileImageQueue_[tileUid] = tile;
                }
            }
        }
        return render;
    };
    /**
     * @inheritDoc
     */
    CanvasVectorTileLayerRenderer.prototype.getTile = function (z, x, y, frameState) {
        var pixelRatio = frameState.pixelRatio;
        var viewState = frameState.viewState;
        var resolution = viewState.resolution;
        var projection = viewState.projection;
        var layer = this.getLayer();
        var tile = layer.getSource().getTile(z, x, y, pixelRatio, projection);
        if (tile.getState() < _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED) {
            tile.wantedResolution = resolution;
            var tileUid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(tile);
            if (!(tileUid in this.tileListenerKeys_)) {
                var listenerKey = Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(tile, _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CHANGE, this.prepareTile.bind(this, tile, pixelRatio, projection, true));
                this.tileListenerKeys_[tileUid] = listenerKey;
            }
        }
        else {
            var viewHints = frameState.viewHints;
            var hifi = !(viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_2__["default"].ANIMATING] || viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_2__["default"].INTERACTING]);
            if (hifi || !tile.wantedResolution) {
                tile.wantedResolution = resolution;
            }
            var render = this.prepareTile(tile, pixelRatio, projection, false);
            if (render && layer.getRenderMode() !== _layer_VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_6__["default"].VECTOR) {
                this.renderTileImage_(tile, frameState);
            }
        }
        return _super.prototype.getTile.call(this, z, x, y, frameState);
    };
    /**
     * @inheritdoc
     */
    CanvasVectorTileLayerRenderer.prototype.isDrawableTile = function (tile) {
        var layer = this.getLayer();
        return _super.prototype.isDrawableTile.call(this, tile) && layer.getRenderMode() === _layer_VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_6__["default"].VECTOR || tile.hasContext(layer);
    };
    /**
     * @inheritDoc
     */
    CanvasVectorTileLayerRenderer.prototype.getTileImage = function (tile) {
        return tile.getImage(this.getLayer());
    };
    /**
     * @inheritDoc
     */
    CanvasVectorTileLayerRenderer.prototype.prepareFrame = function (frameState) {
        var layerRevision = this.getLayer().getRevision();
        if (this.renderedLayerRevision_ != layerRevision) {
            this.renderedTiles.length = 0;
        }
        this.renderedLayerRevision_ = layerRevision;
        return _super.prototype.prepareFrame.call(this, frameState);
    };
    /**
     * @param {import("../../VectorRenderTile.js").default} tile Tile.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../../proj/Projection.js").default} projection Projection.
     * @private
     */
    CanvasVectorTileLayerRenderer.prototype.updateExecutorGroup_ = function (tile, pixelRatio, projection) {
        var layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer());
        var revision = layer.getRevision();
        var renderOrder = layer.getRenderOrder() || null;
        var resolution = tile.wantedResolution;
        var builderState = tile.getReplayState(layer);
        if (!builderState.dirty && builderState.renderedResolution === resolution &&
            builderState.renderedRevision == revision &&
            builderState.renderedRenderOrder == renderOrder && builderState.renderedZ === tile.sourceZ) {
            return;
        }
        var source = layer.getSource();
        var sourceTileGrid = source.getTileGrid();
        var tileGrid = source.getTileGridForProjection(projection);
        var tileExtent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);
        var sourceTiles = source.getSourceTiles(pixelRatio, projection, tile);
        var layerUid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer);
        delete tile.hitDetectionImageData[layerUid];
        tile.executorGroups[layerUid] = [];
        var _loop_1 = function (t, tt) {
            var sourceTile = sourceTiles[t];
            if (sourceTile.getState() != _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED) {
                return "continue";
            }
            var sourceTileCoord = sourceTile.tileCoord;
            var sourceTileExtent = sourceTileGrid.getTileCoordExtent(sourceTileCoord);
            var sharedExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getIntersection"])(tileExtent, sourceTileExtent);
            var bufferedExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["equals"])(sourceTileExtent, sharedExtent) ? null :
                Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["buffer"])(sharedExtent, layer.getRenderBuffer() * resolution, this_1.tmpExtent);
            builderState.dirty = false;
            var builderGroup = new _render_canvas_BuilderGroup_js__WEBPACK_IMPORTED_MODULE_8__["default"](0, sharedExtent, resolution, pixelRatio, layer.getDeclutter());
            var squaredTolerance = Object(_vector_js__WEBPACK_IMPORTED_MODULE_11__["getSquaredTolerance"])(resolution, pixelRatio);
            /**
             * @param {import("../../Feature.js").FeatureLike} feature Feature.
             * @this {CanvasVectorTileLayerRenderer}
             */
            var render = function (feature) {
                var styles;
                var styleFunction = feature.getStyleFunction() || layer.getStyleFunction();
                if (styleFunction) {
                    styles = styleFunction(feature, resolution);
                }
                if (styles) {
                    var dirty = this.renderFeature(feature, squaredTolerance, styles, builderGroup);
                    this.dirty_ = this.dirty_ || dirty;
                    builderState.dirty = builderState.dirty || dirty;
                }
            };
            var features = sourceTile.getFeatures();
            if (renderOrder && renderOrder !== builderState.renderedRenderOrder) {
                features.sort(renderOrder);
            }
            for (var i = 0, ii = features.length; i < ii; ++i) {
                var feature = features[i];
                if (!bufferedExtent || Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["intersects"])(bufferedExtent, feature.getGeometry().getExtent())) {
                    render.call(this_1, feature);
                }
            }
            var executorGroupInstructions = builderGroup.finish();
            // no need to clip when the render tile is covered by a single source tile
            var replayExtent = layer.getRenderMode() !== _layer_VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_6__["default"].VECTOR && layer.getDeclutter() && sourceTiles.length === 1 ?
                null :
                sharedExtent;
            var renderingReplayGroup = new _render_canvas_ExecutorGroup_js__WEBPACK_IMPORTED_MODULE_13__["default"](replayExtent, resolution, pixelRatio, source.getOverlaps(), executorGroupInstructions, layer.getRenderBuffer());
            tile.executorGroups[layerUid].push(renderingReplayGroup);
        };
        var this_1 = this;
        for (var t = 0, tt = sourceTiles.length; t < tt; ++t) {
            _loop_1(t, tt);
        }
        builderState.renderedRevision = revision;
        builderState.renderedZ = tile.sourceZ;
        builderState.renderedRenderOrder = renderOrder;
        builderState.renderedResolution = resolution;
    };
    /**
     * @inheritDoc
     */
    CanvasVectorTileLayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
        var resolution = frameState.viewState.resolution;
        var rotation = frameState.viewState.rotation;
        hitTolerance = hitTolerance == undefined ? 0 : hitTolerance;
        var layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer());
        var declutter = layer.getDeclutter();
        var source = layer.getSource();
        var tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
        /** @type {!Object<string, boolean>} */
        var features = {};
        var renderedTiles = /** @type {Array<import("../../VectorRenderTile.js").default>} */ (this.renderedTiles);
        var found;
        var i, ii;
        var _loop_2 = function () {
            var tile = renderedTiles[i];
            var tileExtent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);
            var tileContainsCoordinate = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["containsCoordinate"])(tileExtent, coordinate);
            if (!declutter) {
                // When not decluttering, we only need to consider the tile that contains the given
                // coordinate, because each feature will be rendered for each tile that contains it.
                if (!tileContainsCoordinate) {
                    return "continue";
                }
            }
            var executorGroups = tile.executorGroups[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer)];
            for (var t = 0, tt = executorGroups.length; t < tt; ++t) {
                var executorGroup = executorGroups[t];
                found = found || executorGroup.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, 
                /**
                 * @param {import("../../Feature.js").FeatureLike} feature Feature.
                 * @return {?} Callback result.
                 */
                function (feature) {
                    if (tileContainsCoordinate || (declutteredFeatures && declutteredFeatures.indexOf(feature) !== -1)) {
                        var key = feature.getId();
                        if (key === undefined) {
                            key = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
                        }
                        if (!(key in features)) {
                            features[key] = true;
                            return callback(feature, layer);
                        }
                    }
                }, layer.getDeclutter() ? declutteredFeatures : null);
            }
        };
        for (i = 0, ii = renderedTiles.length; i < ii; ++i) {
            _loop_2();
        }
        return found;
    };
    /**
     * @inheritDoc
     */
    CanvasVectorTileLayerRenderer.prototype.getFeatures = function (pixel) {
        return new Promise(function (resolve, reject) {
            var layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer());
            var layerUid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer);
            var source = layer.getSource();
            var projection = this.renderedProjection;
            var projectionExtent = projection.getExtent();
            var resolution = this.renderedResolution;
            var tileGrid = source.getTileGridForProjection(projection);
            var coordinate = Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["apply"])(this.renderedPixelToCoordinateTransform_, pixel.slice());
            var tileCoord = tileGrid.getTileCoordForCoordAndResolution(coordinate, resolution);
            var tile;
            for (var i = 0, ii = this.renderedTiles.length; i < ii; ++i) {
                if (tileCoord.toString() === this.renderedTiles[i].tileCoord.toString()) {
                    tile = this.renderedTiles[i];
                    if (tile.getState() === _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED && tile.hifi) {
                        var extent_1 = tileGrid.getTileCoordExtent(tile.tileCoord);
                        if (source.getWrapX() && projection.canWrapX() && !Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["containsExtent"])(projectionExtent, extent_1)) {
                            Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_16__["wrapX"])(coordinate, projection);
                        }
                        break;
                    }
                    tile = undefined;
                }
            }
            if (!tile || tile.loadingSourceTiles > 0) {
                resolve([]);
                return;
            }
            var extent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);
            var corner = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getTopLeft"])(extent);
            var tilePixel = [
                (coordinate[0] - corner[0]) / resolution,
                (corner[1] - coordinate[1]) / resolution
            ];
            var features = tile.getSourceTiles().reduce(function (accumulator, sourceTile) {
                return accumulator.concat(sourceTile.getFeatures());
            }, []);
            var hitDetectionImageData = tile.hitDetectionImageData[layerUid];
            if (!hitDetectionImageData && !this.animatingOrInteracting_) {
                var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_10__["toSize"])(tileGrid.getTileSize(tileGrid.getZForResolution(resolution)));
                var size = [tileSize[0] / 2, tileSize[1] / 2];
                var rotation = this.renderedRotation_;
                var transforms = [
                    this.getRenderTransform(tileGrid.getTileCoordCenter(tile.wrappedTileCoord), resolution, 0, 0.5, size[0], size[1], 0)
                ];
                hitDetectionImageData = Object(_render_canvas_hitdetect_js__WEBPACK_IMPORTED_MODULE_15__["createHitDetectionImageData"])(tileSize, transforms, features, layer.getStyleFunction(), tileGrid.getTileCoordExtent(tile.wrappedTileCoord), tile.getReplayState(layer).renderedResolution, rotation);
                tile.hitDetectionImageData[layerUid] = hitDetectionImageData;
            }
            resolve(Object(_render_canvas_hitdetect_js__WEBPACK_IMPORTED_MODULE_15__["hitDetect"])(tilePixel, features, hitDetectionImageData));
        }.bind(this));
    };
    /**
     * @inheritDoc
     */
    CanvasVectorTileLayerRenderer.prototype.handleFontsChanged = function () {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_14__["clear"])(this.renderTileImageQueue_);
        var layer = this.getLayer();
        if (layer.getVisible() && this.renderedLayerRevision_ !== undefined) {
            layer.changed();
        }
    };
    /**
     * Handle changes in image style state.
     * @param {import("../../events/Event.js").default} event Image style change event.
     * @private
     */
    CanvasVectorTileLayerRenderer.prototype.handleStyleImageChange_ = function (event) {
        this.renderIfReadyAndVisible();
    };
    /**
     * @inheritDoc
     */
    CanvasVectorTileLayerRenderer.prototype.renderFrame = function (frameState, target) {
        var viewHints = frameState.viewHints;
        var hifi = !(viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_2__["default"].ANIMATING] || viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_2__["default"].INTERACTING]);
        this.renderQueuedTileImages_(hifi, frameState);
        _super.prototype.renderFrame.call(this, frameState, target);
        this.renderedPixelToCoordinateTransform_ = frameState.pixelToCoordinateTransform.slice();
        this.renderedRotation_ = frameState.viewState.rotation;
        var layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer());
        var renderMode = layer.getRenderMode();
        if (renderMode === _layer_VectorTileRenderType_js__WEBPACK_IMPORTED_MODULE_6__["default"].IMAGE) {
            return this.container;
        }
        var source = layer.getSource();
        // Unqueue tiles from the image queue when we don't need any more
        var usedTiles = frameState.usedTiles[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(source)];
        for (var tileUid in this.renderTileImageQueue_) {
            if (!usedTiles || !(tileUid in usedTiles)) {
                delete this.renderTileImageQueue_[tileUid];
            }
        }
        var context = this.context;
        var declutterReplays = layer.getDeclutter() ? {} : null;
        var replayTypes = VECTOR_REPLAYS[renderMode];
        var pixelRatio = frameState.pixelRatio;
        var viewState = frameState.viewState;
        var center = viewState.center;
        var resolution = viewState.resolution;
        var rotation = viewState.rotation;
        var size = frameState.size;
        var width = Math.round(size[0] * pixelRatio);
        var height = Math.round(size[1] * pixelRatio);
        var tiles = this.renderedTiles;
        var tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
        var clips = [];
        var clipZs = [];
        for (var i = tiles.length - 1; i >= 0; --i) {
            var tile = /** @type {import("../../VectorRenderTile.js").default} */ (tiles[i]);
            var tileCoord = tile.tileCoord;
            var tileExtent = tileGrid.getTileCoordExtent(tile.wrappedTileCoord);
            var worldOffset = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent)[0] - tileExtent[0];
            var transform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["multiply"])(Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["scale"])(this.inversePixelTransform.slice(), 1 / pixelRatio, 1 / pixelRatio), this.getRenderTransform(center, resolution, rotation, pixelRatio, width, height, worldOffset));
            var executorGroups = tile.executorGroups[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer)];
            var clipped = false;
            for (var t = 0, tt = executorGroups.length; t < tt; ++t) {
                var executorGroup = executorGroups[t];
                if (!executorGroup.hasExecutors(replayTypes)) {
                    // sourceTile has no instructions of the types we want to render
                    continue;
                }
                var currentZ = tile.tileCoord[0];
                var currentClip = void 0;
                if (!declutterReplays && !clipped) {
                    currentClip = executorGroup.getClipCoords(transform);
                    context.save();
                    // Create a clip mask for regions in this low resolution tile that are
                    // already filled by a higher resolution tile
                    for (var j = 0, jj = clips.length; j < jj; ++j) {
                        var clip = clips[j];
                        if (currentZ < clipZs[j]) {
                            context.beginPath();
                            // counter-clockwise (outer ring) for current tile
                            context.moveTo(currentClip[0], currentClip[1]);
                            context.lineTo(currentClip[2], currentClip[3]);
                            context.lineTo(currentClip[4], currentClip[5]);
                            context.lineTo(currentClip[6], currentClip[7]);
                            // clockwise (inner ring) for higher resolution tile
                            context.moveTo(clip[6], clip[7]);
                            context.lineTo(clip[4], clip[5]);
                            context.lineTo(clip[2], clip[3]);
                            context.lineTo(clip[0], clip[1]);
                            context.clip();
                        }
                    }
                }
                executorGroup.execute(context, transform, rotation, hifi, replayTypes, declutterReplays);
                if (!declutterReplays && !clipped) {
                    context.restore();
                    clips.push(currentClip);
                    clipZs.push(currentZ);
                    clipped = true;
                }
            }
        }
        if (declutterReplays) {
            var layerState = frameState.layerStatesArray[frameState.layerIndex];
            Object(_render_canvas_ExecutorGroup_js__WEBPACK_IMPORTED_MODULE_13__["replayDeclutter"])(declutterReplays, context, rotation, layerState.opacity, hifi, frameState.declutterItems);
        }
        return this.container;
    };
    /**
     * @param {boolean} hifi We have time to render a high fidelity map image.
     * @param {import('../../PluggableMap.js').FrameState} frameState Frame state.
     */
    CanvasVectorTileLayerRenderer.prototype.renderQueuedTileImages_ = function (hifi, frameState) {
        // When we don't have time to render hifi, only render tiles until we have used up
        // half of the frame budget of 16 ms
        for (var uid in this.renderTileImageQueue_) {
            if (!hifi && Date.now() - frameState.time > 8) {
                frameState.animate = true;
                break;
            }
            var tile = this.renderTileImageQueue_[uid];
            delete this.renderTileImageQueue_[uid];
            this.renderTileImage_(tile, frameState);
        }
    };
    /**
     * @param {import("../../Feature.js").FeatureLike} feature Feature.
     * @param {number} squaredTolerance Squared tolerance.
     * @param {import("../../style/Style.js").default|Array<import("../../style/Style.js").default>} styles The style or array of styles.
     * @param {import("../../render/canvas/BuilderGroup.js").default} executorGroup Replay group.
     * @return {boolean} `true` if an image is loading.
     */
    CanvasVectorTileLayerRenderer.prototype.renderFeature = function (feature, squaredTolerance, styles, executorGroup) {
        if (!styles) {
            return false;
        }
        var loading = false;
        if (Array.isArray(styles)) {
            for (var i = 0, ii = styles.length; i < ii; ++i) {
                loading = Object(_vector_js__WEBPACK_IMPORTED_MODULE_11__["renderFeature"])(executorGroup, feature, styles[i], squaredTolerance, this.boundHandleStyleImageChange_) || loading;
            }
        }
        else {
            loading = Object(_vector_js__WEBPACK_IMPORTED_MODULE_11__["renderFeature"])(executorGroup, feature, styles, squaredTolerance, this.boundHandleStyleImageChange_);
        }
        return loading;
    };
    /**
     * @param {import("../../VectorRenderTile.js").default} tile Tile.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../../proj/Projection.js").default} projection Projection.
     * @return {boolean} A new tile image was rendered.
     * @private
     */
    CanvasVectorTileLayerRenderer.prototype.tileImageNeedsRender_ = function (tile, pixelRatio, projection) {
        var layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer());
        var replayState = tile.getReplayState(layer);
        var revision = layer.getRevision();
        var sourceZ = tile.sourceZ;
        var resolution = tile.wantedResolution;
        return replayState.renderedTileResolution !== resolution || replayState.renderedTileRevision !== revision || replayState.renderedTileZ !== sourceZ;
    };
    /**
     * @param {import("../../VectorRenderTile.js").default} tile Tile.
     * @param {import("../../PluggableMap").FrameState} frameState Frame state.
     * @private
     */
    CanvasVectorTileLayerRenderer.prototype.renderTileImage_ = function (tile, frameState) {
        var layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer());
        var replayState = tile.getReplayState(layer);
        var revision = layer.getRevision();
        var executorGroups = tile.executorGroups[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(layer)];
        replayState.renderedTileRevision = revision;
        replayState.renderedTileZ = tile.sourceZ;
        var tileCoord = tile.wrappedTileCoord;
        var z = tileCoord[0];
        var source = layer.getSource();
        var pixelRatio = frameState.pixelRatio;
        var viewState = frameState.viewState;
        var projection = viewState.projection;
        var tileGrid = source.getTileGridForProjection(projection);
        var tileResolution = tileGrid.getResolution(tile.tileCoord[0]);
        var renderPixelRatio = frameState.pixelRatio / tile.wantedResolution * tileResolution;
        var resolution = tileGrid.getResolution(z);
        var context = tile.getContext(layer);
        // Increase tile size when overzooming for low pixel ratio, to avoid blurry tiles
        pixelRatio = Math.max(pixelRatio, renderPixelRatio / pixelRatio);
        var size = source.getTilePixelSize(z, pixelRatio, projection);
        context.canvas.width = size[0];
        context.canvas.height = size[1];
        var renderScale = pixelRatio / renderPixelRatio;
        if (renderScale !== 1) {
            var canvasTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["reset"])(this.tmpTransform_);
            Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["scale"])(canvasTransform, renderScale, renderScale);
            context.setTransform.apply(context, canvasTransform);
        }
        var tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent);
        var pixelScale = renderPixelRatio / resolution;
        var transform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["reset"])(this.tmpTransform_);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["scale"])(transform, pixelScale, -pixelScale);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_12__["translate"])(transform, -tileExtent[0], -tileExtent[3]);
        for (var i = 0, ii = executorGroups.length; i < ii; ++i) {
            var executorGroup = executorGroups[i];
            executorGroup.execute(context, transform, 0, true, IMAGE_REPLAYS[layer.getRenderMode()]);
        }
        replayState.renderedTileResolution = tile.wantedResolution;
    };
    return CanvasVectorTileLayerRenderer;
}(_TileLayer_js__WEBPACK_IMPORTED_MODULE_9__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CanvasVectorTileLayerRenderer);
//# sourceMappingURL=VectorTileLayer.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/vector.js":
/*!********************************************!*\
  !*** ./node_modules/ol/renderer/vector.js ***!
  \********************************************/
/*! exports provided: defaultOrder, getSquaredTolerance, getTolerance, renderFeature */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultOrder", function() { return defaultOrder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSquaredTolerance", function() { return getSquaredTolerance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTolerance", function() { return getTolerance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderFeature", function() { return renderFeature; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../render/canvas/BuilderType.js */ "./node_modules/ol/render/canvas/BuilderType.js");
/**
 * @module ol/renderer/vector
 */




/**
 * Tolerance for geometry simplification in device pixels.
 * @type {number}
 */
var SIMPLIFY_TOLERANCE = 0.5;
/**
 * @const
 * @type {Object<import("../geom/GeometryType.js").default,
 *                function(import("../render/canvas/BuilderGroup.js").default, import("../geom/Geometry.js").default,
 *                         import("../style/Style.js").default, Object): void>}
 */
var GEOMETRY_RENDERERS = {
    'Point': renderPointGeometry,
    'LineString': renderLineStringGeometry,
    'Polygon': renderPolygonGeometry,
    'MultiPoint': renderMultiPointGeometry,
    'MultiLineString': renderMultiLineStringGeometry,
    'MultiPolygon': renderMultiPolygonGeometry,
    'GeometryCollection': renderGeometryCollectionGeometry,
    'Circle': renderCircleGeometry
};
/**
 * @param {import("../Feature.js").FeatureLike} feature1 Feature 1.
 * @param {import("../Feature.js").FeatureLike} feature2 Feature 2.
 * @return {number} Order.
 */
function defaultOrder(feature1, feature2) {
    return parseInt(Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature1), 10) - parseInt(Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature2), 10);
}
/**
 * @param {number} resolution Resolution.
 * @param {number} pixelRatio Pixel ratio.
 * @return {number} Squared pixel tolerance.
 */
function getSquaredTolerance(resolution, pixelRatio) {
    var tolerance = getTolerance(resolution, pixelRatio);
    return tolerance * tolerance;
}
/**
 * @param {number} resolution Resolution.
 * @param {number} pixelRatio Pixel ratio.
 * @return {number} Pixel tolerance.
 */
function getTolerance(resolution, pixelRatio) {
    return SIMPLIFY_TOLERANCE * resolution / pixelRatio;
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Builder group.
 * @param {import("../geom/Circle.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").default} feature Feature.
 */
function renderCircleGeometry(builderGroup, geometry, style, feature) {
    var fillStyle = style.getFill();
    var strokeStyle = style.getStroke();
    if (fillStyle || strokeStyle) {
        var circleReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].CIRCLE);
        circleReplay.setFillStrokeStyle(fillStyle, strokeStyle);
        circleReplay.drawCircle(geometry, feature);
    }
    var textStyle = style.getText();
    if (textStyle) {
        var textReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].TEXT);
        textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
        textReplay.drawText(geometry, feature);
    }
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group.
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 * @param {import("../style/Style.js").default} style Style.
 * @param {number} squaredTolerance Squared tolerance.
 * @param {function(import("../events/Event.js").default): void} listener Listener function.
 * @param {import("../proj.js").TransformFunction} [opt_transform] Transform from user to view projection.
 * @return {boolean} `true` if style is loading.
 * @template T
 */
function renderFeature(replayGroup, feature, style, squaredTolerance, listener, opt_transform) {
    var loading = false;
    var imageStyle = style.getImage();
    if (imageStyle) {
        var imageState = imageStyle.getImageState();
        if (imageState == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED || imageState == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR) {
            imageStyle.unlistenImageChange(listener);
        }
        else {
            if (imageState == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE) {
                imageStyle.load();
            }
            imageState = imageStyle.getImageState();
            imageStyle.listenImageChange(listener);
            loading = true;
        }
    }
    renderFeatureInternal(replayGroup, feature, style, squaredTolerance, opt_transform);
    return loading;
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group.
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 * @param {import("../style/Style.js").default} style Style.
 * @param {number} squaredTolerance Squared tolerance.
 * @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
 */
function renderFeatureInternal(replayGroup, feature, style, squaredTolerance, opt_transform) {
    var geometry = style.getGeometryFunction()(feature);
    if (!geometry) {
        return;
    }
    var simplifiedGeometry = geometry.simplifyTransformed(squaredTolerance, opt_transform);
    var renderer = style.getRenderer();
    if (renderer) {
        renderGeometry(replayGroup, simplifiedGeometry, style, feature);
    }
    else {
        var geometryRenderer = GEOMETRY_RENDERERS[simplifiedGeometry.getType()];
        geometryRenderer(replayGroup, simplifiedGeometry, style, feature);
    }
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group.
 * @param {import("../geom/Geometry.js").default|import("../render/Feature.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 */
function renderGeometry(replayGroup, geometry, style, feature) {
    if (geometry.getType() == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_2__["default"].GEOMETRY_COLLECTION) {
        var geometries = /** @type {import("../geom/GeometryCollection.js").default} */ (geometry).getGeometries();
        for (var i = 0, ii = geometries.length; i < ii; ++i) {
            renderGeometry(replayGroup, geometries[i], style, feature);
        }
        return;
    }
    var replay = replayGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].DEFAULT);
    replay.drawCustom(/** @type {import("../geom/SimpleGeometry.js").default} */ (geometry), feature, style.getRenderer());
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} replayGroup Replay group.
 * @param {import("../geom/GeometryCollection.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").default} feature Feature.
 */
function renderGeometryCollectionGeometry(replayGroup, geometry, style, feature) {
    var geometries = geometry.getGeometriesArray();
    var i, ii;
    for (i = 0, ii = geometries.length; i < ii; ++i) {
        var geometryRenderer = GEOMETRY_RENDERERS[geometries[i].getType()];
        geometryRenderer(replayGroup, geometries[i], style, feature);
    }
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
 * @param {import("../geom/LineString.js").default|import("../render/Feature.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 */
function renderLineStringGeometry(builderGroup, geometry, style, feature) {
    var strokeStyle = style.getStroke();
    if (strokeStyle) {
        var lineStringReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].LINE_STRING);
        lineStringReplay.setFillStrokeStyle(null, strokeStyle);
        lineStringReplay.drawLineString(geometry, feature);
    }
    var textStyle = style.getText();
    if (textStyle) {
        var textReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].TEXT);
        textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
        textReplay.drawText(geometry, feature);
    }
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
 * @param {import("../geom/MultiLineString.js").default|import("../render/Feature.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 */
function renderMultiLineStringGeometry(builderGroup, geometry, style, feature) {
    var strokeStyle = style.getStroke();
    if (strokeStyle) {
        var lineStringReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].LINE_STRING);
        lineStringReplay.setFillStrokeStyle(null, strokeStyle);
        lineStringReplay.drawMultiLineString(geometry, feature);
    }
    var textStyle = style.getText();
    if (textStyle) {
        var textReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].TEXT);
        textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
        textReplay.drawText(geometry, feature);
    }
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
 * @param {import("../geom/MultiPolygon.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").default} feature Feature.
 */
function renderMultiPolygonGeometry(builderGroup, geometry, style, feature) {
    var fillStyle = style.getFill();
    var strokeStyle = style.getStroke();
    if (strokeStyle || fillStyle) {
        var polygonReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POLYGON);
        polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
        polygonReplay.drawMultiPolygon(geometry, feature);
    }
    var textStyle = style.getText();
    if (textStyle) {
        var textReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].TEXT);
        textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
        textReplay.drawText(geometry, feature);
    }
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
 * @param {import("../geom/Point.js").default|import("../render/Feature.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 */
function renderPointGeometry(builderGroup, geometry, style, feature) {
    var imageStyle = style.getImage();
    if (imageStyle) {
        if (imageStyle.getImageState() != _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED) {
            return;
        }
        var imageReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].IMAGE);
        imageReplay.setImageStyle(imageStyle, builderGroup.addDeclutter(false));
        imageReplay.drawPoint(geometry, feature);
    }
    var textStyle = style.getText();
    if (textStyle) {
        var textReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].TEXT);
        textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(!!imageStyle));
        textReplay.drawText(geometry, feature);
    }
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
 * @param {import("../geom/MultiPoint.js").default|import("../render/Feature.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 */
function renderMultiPointGeometry(builderGroup, geometry, style, feature) {
    var imageStyle = style.getImage();
    if (imageStyle) {
        if (imageStyle.getImageState() != _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED) {
            return;
        }
        var imageReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].IMAGE);
        imageReplay.setImageStyle(imageStyle, builderGroup.addDeclutter(false));
        imageReplay.drawMultiPoint(geometry, feature);
    }
    var textStyle = style.getText();
    if (textStyle) {
        var textReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].TEXT);
        textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(!!imageStyle));
        textReplay.drawText(geometry, feature);
    }
}
/**
 * @param {import("../render/canvas/BuilderGroup.js").default} builderGroup Replay group.
 * @param {import("../geom/Polygon.js").default|import("../render/Feature.js").default} geometry Geometry.
 * @param {import("../style/Style.js").default} style Style.
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 */
function renderPolygonGeometry(builderGroup, geometry, style, feature) {
    var fillStyle = style.getFill();
    var strokeStyle = style.getStroke();
    if (fillStyle || strokeStyle) {
        var polygonReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POLYGON);
        polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
        polygonReplay.drawPolygon(geometry, feature);
    }
    var textStyle = style.getText();
    if (textStyle) {
        var textReplay = builderGroup.getBuilder(style.getZIndex(), _render_canvas_BuilderType_js__WEBPACK_IMPORTED_MODULE_3__["default"].TEXT);
        textReplay.setTextStyle(textStyle, builderGroup.addDeclutter(false));
        textReplay.drawText(geometry, feature);
    }
}
//# sourceMappingURL=vector.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/webgl/Layer.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/renderer/webgl/Layer.js ***!
  \*************************************************/
/*! exports provided: WebGLWorkerMessageType, writePointFeatureToBuffers, getBlankImageData, colorEncodeId, colorDecodeId, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLWorkerMessageType", function() { return WebGLWorkerMessageType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writePointFeatureToBuffers", function() { return writePointFeatureToBuffers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBlankImageData", function() { return getBlankImageData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorEncodeId", function() { return colorEncodeId; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorDecodeId", function() { return colorDecodeId; });
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Layer.js */ "./node_modules/ol/renderer/Layer.js");
/* harmony import */ var _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../webgl/Helper.js */ "./node_modules/ol/webgl/Helper.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/webgl/Layer
 */


/**
 * @enum {string}
 */
var WebGLWorkerMessageType = {
    GENERATE_BUFFERS: 'GENERATE_BUFFERS'
};
/**
 * @typedef {Object} WebGLWorkerGenerateBuffersMessage
 * This message will trigger the generation of a vertex and an index buffer based on the given render instructions.
 * When the buffers are generated, the worked will send a message of the same type to the main thread, with
 * the generated buffers in it.
 * Note that any addition properties present in the message *will* be sent back to the main thread.
 * @property {WebGLWorkerMessageType} type Message type
 * @property {ArrayBuffer} renderInstructions Render instructions raw binary buffer.
 * @property {ArrayBuffer} [vertexBuffer] Vertices array raw binary buffer (sent by the worker).
 * @property {ArrayBuffer} [indexBuffer] Indices array raw binary buffer (sent by the worker).
 * @property {number} [customAttributesCount] Amount of custom attributes count in the render instructions.
 */
/**
 * @typedef {Object} PostProcessesOptions
 * @property {number} [scaleRatio] Scale ratio; if < 1, the post process will render to a texture smaller than
 * the main canvas that will then be sampled up (useful for saving resource on blur steps).
 * @property {string} [vertexShader] Vertex shader source
 * @property {string} [fragmentShader] Fragment shader source
 * @property {Object.<string,import("../../webgl/Helper").UniformValue>} [uniforms] Uniform definitions for the post process step
 */
/**
 * @typedef {Object} Options
 * @property {Object.<string,import("../../webgl/Helper").UniformValue>} [uniforms] Uniform definitions for the post process steps
 * @property {Array<PostProcessesOptions>} [postProcesses] Post-processes definitions
 */
/**
 * @classdesc
 * Base WebGL renderer class.
 * Holds all logic related to data manipulation & some common rendering logic
 * @template {import("../../layer/Layer.js").default} LayerType
 */
var WebGLLayerRenderer = /** @class */ (function (_super) {
    __extends(WebGLLayerRenderer, _super);
    /**
     * @param {LayerType} layer Layer.
     * @param {Options=} [opt_options] Options.
     */
    function WebGLLayerRenderer(layer, opt_options) {
        var _this = _super.call(this, layer) || this;
        var options = opt_options || {};
        /**
         * @type {WebGLHelper}
         * @protected
         */
        _this.helper = new _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_1__["default"]({
            postProcesses: options.postProcesses,
            uniforms: options.uniforms
        });
        return _this;
    }
    /**
     * @inheritDoc
     */
    WebGLLayerRenderer.prototype.disposeInternal = function () {
        this.helper.dispose();
        _super.prototype.disposeInternal.call(this);
    };
    /**
     * Will return the last shader compilation errors. If no error happened, will return null;
     * @return {string|null} Errors, or null if last compilation was successful
     * @api
     */
    WebGLLayerRenderer.prototype.getShaderCompileErrors = function () {
        return this.helper.getShaderCompileErrors();
    };
    return WebGLLayerRenderer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
var tmpArray_ = [];
var bufferPositions_ = { vertexPosition: 0, indexPosition: 0 };
function writePointVertex(buffer, pos, x, y, index) {
    buffer[pos + 0] = x;
    buffer[pos + 1] = y;
    buffer[pos + 2] = index;
}
/**
 * An object holding positions both in an index and a vertex buffer.
 * @typedef {Object} BufferPositions
 * @property {number} vertexPosition Position in the vertex buffer
 * @property {number} indexPosition Position in the index buffer
 */
/**
 * Pushes a quad (two triangles) based on a point geometry
 * @param {Float32Array} instructions Array of render instructions for points.
 * @param {number} elementIndex Index from which render instructions will be read.
 * @param {Float32Array} vertexBuffer Buffer in the form of a typed array.
 * @param {Uint32Array} indexBuffer Buffer in the form of a typed array.
 * @param {number} customAttributesCount Amount of custom attributes for each element.
 * @param {BufferPositions} [bufferPositions] Buffer write positions; if not specified, positions will be set at 0.
 * @return {BufferPositions} New buffer positions where to write next
 * @property {number} vertexPosition New position in the vertex buffer where future writes should start.
 * @property {number} indexPosition New position in the index buffer where future writes should start.
 * @private
 */
function writePointFeatureToBuffers(instructions, elementIndex, vertexBuffer, indexBuffer, customAttributesCount, bufferPositions) {
    // This is for x, y and index
    var baseVertexAttrsCount = 3;
    var baseInstructionsCount = 2;
    var stride = baseVertexAttrsCount + customAttributesCount;
    var x = instructions[elementIndex + 0];
    var y = instructions[elementIndex + 1];
    // read custom numerical attributes on the feature
    var customAttrs = tmpArray_;
    customAttrs.length = customAttributesCount;
    for (var i = 0; i < customAttrs.length; i++) {
        customAttrs[i] = instructions[elementIndex + baseInstructionsCount + i];
    }
    var vPos = bufferPositions ? bufferPositions.vertexPosition : 0;
    var iPos = bufferPositions ? bufferPositions.indexPosition : 0;
    var baseIndex = vPos / stride;
    // push vertices for each of the four quad corners (first standard then custom attributes)
    writePointVertex(vertexBuffer, vPos, x, y, 0);
    customAttrs.length && vertexBuffer.set(customAttrs, vPos + baseVertexAttrsCount);
    vPos += stride;
    writePointVertex(vertexBuffer, vPos, x, y, 1);
    customAttrs.length && vertexBuffer.set(customAttrs, vPos + baseVertexAttrsCount);
    vPos += stride;
    writePointVertex(vertexBuffer, vPos, x, y, 2);
    customAttrs.length && vertexBuffer.set(customAttrs, vPos + baseVertexAttrsCount);
    vPos += stride;
    writePointVertex(vertexBuffer, vPos, x, y, 3);
    customAttrs.length && vertexBuffer.set(customAttrs, vPos + baseVertexAttrsCount);
    vPos += stride;
    indexBuffer[iPos++] = baseIndex;
    indexBuffer[iPos++] = baseIndex + 1;
    indexBuffer[iPos++] = baseIndex + 3;
    indexBuffer[iPos++] = baseIndex + 1;
    indexBuffer[iPos++] = baseIndex + 2;
    indexBuffer[iPos++] = baseIndex + 3;
    bufferPositions_.vertexPosition = vPos;
    bufferPositions_.indexPosition = iPos;
    return bufferPositions_;
}
/**
 * Returns a texture of 1x1 pixel, white
 * @private
 * @return {ImageData} Image data.
 */
function getBlankImageData() {
    var canvas = document.createElement('canvas');
    var image = canvas.getContext('2d').createImageData(1, 1);
    image.data[0] = 255;
    image.data[1] = 255;
    image.data[2] = 255;
    image.data[3] = 255;
    return image;
}
/**
 * Generates a color array based on a numerical id
 * Note: the range for each component is 0 to 1 with 256 steps
 * @param {number} id Id
 * @param {Array<number>} [opt_array] Reusable array
 * @return {Array<number>} Color array containing the encoded id
 */
function colorEncodeId(id, opt_array) {
    var array = opt_array || [];
    var radix = 256;
    var divide = radix - 1;
    array[0] = Math.floor(id / radix / radix / radix) / divide;
    array[1] = (Math.floor(id / radix / radix) % radix) / divide;
    array[2] = (Math.floor(id / radix) % radix) / divide;
    array[3] = (id % radix) / divide;
    return array;
}
/**
 * Reads an id from a color-encoded array
 * Note: the expected range for each component is 0 to 1 with 256 steps.
 * @param {Array<number>} color Color array containing the encoded id
 * @return {number} Decoded id
 */
function colorDecodeId(color) {
    var id = 0;
    var radix = 256;
    var mult = radix - 1;
    id += Math.round(color[0] * radix * radix * radix * mult);
    id += Math.round(color[1] * radix * radix * mult);
    id += Math.round(color[2] * radix * mult);
    id += Math.round(color[3] * mult);
    return id;
}
/* harmony default export */ __webpack_exports__["default"] = (WebGLLayerRenderer);
//# sourceMappingURL=Layer.js.map

/***/ }),

/***/ "./node_modules/ol/renderer/webgl/PointsLayer.js":
/*!*******************************************************!*\
  !*** ./node_modules/ol/renderer/webgl/PointsLayer.js ***!
  \*******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _webgl_Buffer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../webgl/Buffer.js */ "./node_modules/ol/webgl/Buffer.js");
/* harmony import */ var _webgl_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../webgl.js */ "./node_modules/ol/webgl.js");
/* harmony import */ var _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../webgl/Helper.js */ "./node_modules/ol/webgl/Helper.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Layer.js */ "./node_modules/ol/renderer/webgl/Layer.js");
/* harmony import */ var _ViewHint_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ViewHint.js */ "./node_modules/ol/ViewHint.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _worker_webgl_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../worker/webgl.js */ "./node_modules/ol/worker/webgl.js");
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _webgl_RenderTarget_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../webgl/RenderTarget.js */ "./node_modules/ol/webgl/RenderTarget.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _layer_BaseVector_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../layer/BaseVector.js */ "./node_modules/ol/layer/BaseVector.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../source/VectorEventType.js */ "./node_modules/ol/source/VectorEventType.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/renderer/webgl/PointsLayer
 */















/**
 * @typedef {Object} CustomAttribute A description of a custom attribute to be passed on to the GPU, with a value different
 * for each feature.
 * @property {string} name Attribute name.
 * @property {function(import("../../Feature").default, Object<string, *>):number} callback This callback computes the numerical value of the
 * attribute for a given feature (properties are available as 2nd arg for quicker access).
 */
/**
 * @typedef {Object} FeatureCacheItem Object that holds a reference to a feature, its geometry and properties. Used to optimize
 * rebuildBuffers by accessing these objects quicker.
 * @property {import("../../Feature").default} feature Feature
 * @property {Object<string, *>} properties Feature properties
 * @property {import("../../geom").Geometry} geometry Feature geometry
 */
/**
 * @typedef {Object} Options
 * @property {Array<CustomAttribute>} [attributes] These attributes will be read from the features in the source and then
 * passed to the GPU. The `name` property of each attribute will serve as its identifier:
 *  * In the vertex shader as an `attribute` by prefixing it with `a_`
 *  * In the fragment shader as a `varying` by prefixing it with `v_`
 * Please note that these can only be numerical values.
 * @property {string} vertexShader Vertex shader source, mandatory.
 * @property {string} fragmentShader Fragment shader source, mandatory.
 * @property {string} [hitVertexShader] Vertex shader source for hit detection rendering.
 * @property {string} [hitFragmentShader] Fragment shader source for hit detection rendering.
 * @property {Object.<string,import("../../webgl/Helper").UniformValue>} [uniforms] Uniform definitions for the post process steps
 * Please note that `u_texture` is reserved for the main texture slot.
 * @property {Array<import("./Layer").PostProcessesOptions>} [postProcesses] Post-processes definitions
 */
/**
 * @classdesc
 * WebGL vector renderer optimized for points.
 * All features will be rendered as quads (two triangles forming a square). New data will be flushed to the GPU
 * every time the vector source changes.
 *
 * You need to provide vertex and fragment shaders for rendering. This can be done using
 * {@link module:ol/webgl/ShaderBuilder} utilities. These shaders shall expect a `a_position` attribute
 * containing the screen-space projected center of the quad, as well as a `a_index` attribute
 * whose value (0, 1, 2 or 3) indicates which quad vertex is currently getting processed (see structure below).
 *
 * To include variable attributes in the shaders, you need to declare them using the `attributes` property of
 * the options object like so:
 * ```js
 * new WebGLPointsLayerRenderer(layer, {
 *   attributes: [
 *     {
 *       name: 'size',
 *       callback: function(feature) {
 *         // compute something with the feature
 *       }
 *     },
 *     {
 *       name: 'weight',
 *       callback: function(feature) {
 *         // compute something with the feature
 *       }
 *     },
 *   ],
 *   vertexShader:
 *     // shader using attribute a_weight and a_size
 *   fragmentShader:
 *     // shader using varying v_weight and v_size
 * ```
 *
 * To enable hit detection, you must as well provide dedicated shaders using the `hitVertexShader`
 * and `hitFragmentShader` properties. These shall expect the `a_hitColor` attribute to contain
 * the final color that will have to be output for hit detection to work.
 *
 * The following uniform is used for the main texture: `u_texture`.
 *
 * Please note that the main shader output should have premultiplied alpha, otherwise visual anomalies may occur.
 *
 * Points are rendered as quads with the following structure:
 *
 * ```
 *   (u0, v1)      (u1, v1)
 *  [3]----------[2]
 *   |`           |
 *   |  `         |
 *   |    `       |
 *   |      `     |
 *   |        `   |
 *   |          ` |
 *  [0]----------[1]
 *   (u0, v0)      (u1, v0)
 *  ```
 *
 * This uses {@link module:ol/webgl/Helper~WebGLHelper} internally.
 *
 * @api
 */
var WebGLPointsLayerRenderer = /** @class */ (function (_super) {
    __extends(WebGLPointsLayerRenderer, _super);
    /**
     * @param {import("../../layer/Layer.js").default} layer Layer.
     * @param {Options} options Options.
     */
    function WebGLPointsLayerRenderer(layer, options) {
        var _this = this;
        var uniforms = options.uniforms || {};
        var projectionMatrixTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_7__["create"])();
        uniforms[_webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__["DefaultUniform"].PROJECTION_MATRIX] = projectionMatrixTransform;
        _this = _super.call(this, layer, {
            uniforms: uniforms,
            postProcesses: options.postProcesses
        }) || this;
        _this.sourceRevision_ = -1;
        _this.verticesBuffer_ = new _webgl_Buffer_js__WEBPACK_IMPORTED_MODULE_0__["default"](_webgl_js__WEBPACK_IMPORTED_MODULE_1__["ARRAY_BUFFER"], _webgl_js__WEBPACK_IMPORTED_MODULE_1__["DYNAMIC_DRAW"]);
        _this.hitVerticesBuffer_ = new _webgl_Buffer_js__WEBPACK_IMPORTED_MODULE_0__["default"](_webgl_js__WEBPACK_IMPORTED_MODULE_1__["ARRAY_BUFFER"], _webgl_js__WEBPACK_IMPORTED_MODULE_1__["DYNAMIC_DRAW"]);
        _this.indicesBuffer_ = new _webgl_Buffer_js__WEBPACK_IMPORTED_MODULE_0__["default"](_webgl_js__WEBPACK_IMPORTED_MODULE_1__["ELEMENT_ARRAY_BUFFER"], _webgl_js__WEBPACK_IMPORTED_MODULE_1__["DYNAMIC_DRAW"]);
        _this.program_ = _this.helper.getProgram(options.fragmentShader, options.vertexShader);
        /**
         * @type {boolean}
         * @private
         */
        _this.hitDetectionEnabled_ = options.hitFragmentShader && options.hitVertexShader ? true : false;
        _this.hitProgram_ = _this.hitDetectionEnabled_ && _this.helper.getProgram(options.hitFragmentShader, options.hitVertexShader);
        var customAttributes = options.attributes ?
            options.attributes.map(function (attribute) {
                return {
                    name: 'a_' + attribute.name,
                    size: 1,
                    type: _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__["AttributeType"].FLOAT
                };
            }) : [];
        /**
         * A list of attributes used by the renderer. By default only the position and
         * index of the vertex (0 to 3) are required.
         * @type {Array<import('../../webgl/Helper.js').AttributeDescription>}
         */
        _this.attributes = [{
                name: 'a_position',
                size: 2,
                type: _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__["AttributeType"].FLOAT
            }, {
                name: 'a_index',
                size: 1,
                type: _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__["AttributeType"].FLOAT
            }].concat(customAttributes);
        /**
         * A list of attributes used for hit detection.
         * @type {Array<import('../../webgl/Helper.js').AttributeDescription>}
         */
        _this.hitDetectionAttributes = [{
                name: 'a_position',
                size: 2,
                type: _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__["AttributeType"].FLOAT
            }, {
                name: 'a_index',
                size: 1,
                type: _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__["AttributeType"].FLOAT
            }, {
                name: 'a_hitColor',
                size: 4,
                type: _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__["AttributeType"].FLOAT
            }, {
                name: 'a_featureUid',
                size: 1,
                type: _webgl_Helper_js__WEBPACK_IMPORTED_MODULE_2__["AttributeType"].FLOAT
            }].concat(customAttributes);
        _this.customAttributes = options.attributes ? options.attributes : [];
        _this.previousExtent_ = Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["createEmpty"])();
        /**
         * This transform is updated on every frame and is the composition of:
         * - invert of the world->screen transform that was used when rebuilding buffers (see `this.renderTransform_`)
         * - current world->screen transform
         * @type {import("../../transform.js").Transform}
         * @private
         */
        _this.currentTransform_ = projectionMatrixTransform;
        /**
         * This transform is updated when buffers are rebuilt and converts world space coordinates to screen space
         * @type {import("../../transform.js").Transform}
         * @private
         */
        _this.renderTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_7__["create"])();
        /**
         * @type {import("../../transform.js").Transform}
         * @private
         */
        _this.invertRenderTransform_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_7__["create"])();
        /**
         * @type {Float32Array}
         * @private
         */
        _this.renderInstructions_ = new Float32Array(0);
        /**
         * These instructions are used for hit detection
         * @type {Float32Array}
         * @private
         */
        _this.hitRenderInstructions_ = new Float32Array(0);
        /**
         * @type {WebGLRenderTarget}
         * @private
         */
        _this.hitRenderTarget_ = _this.hitDetectionEnabled_ && new _webgl_RenderTarget_js__WEBPACK_IMPORTED_MODULE_10__["default"](_this.helper);
        _this.worker_ = Object(_worker_webgl_js__WEBPACK_IMPORTED_MODULE_8__["create"])();
        _this.worker_.addEventListener('message', function (event) {
            var received = event.data;
            if (received.type === _Layer_js__WEBPACK_IMPORTED_MODULE_4__["WebGLWorkerMessageType"].GENERATE_BUFFERS) {
                var projectionTransform = received.projectionTransform;
                if (received.hitDetection) {
                    this.hitVerticesBuffer_.fromArrayBuffer(received.vertexBuffer);
                    this.helper.flushBufferData(this.hitVerticesBuffer_);
                }
                else {
                    this.verticesBuffer_.fromArrayBuffer(received.vertexBuffer);
                    this.helper.flushBufferData(this.verticesBuffer_);
                }
                this.indicesBuffer_.fromArrayBuffer(received.indexBuffer);
                this.helper.flushBufferData(this.indicesBuffer_);
                this.renderTransform_ = projectionTransform;
                Object(_transform_js__WEBPACK_IMPORTED_MODULE_7__["makeInverse"])(this.invertRenderTransform_, this.renderTransform_);
                if (received.hitDetection) {
                    this.hitRenderInstructions_ = new Float32Array(event.data.renderInstructions);
                }
                else {
                    this.renderInstructions_ = new Float32Array(event.data.renderInstructions);
                }
                this.getLayer().changed();
            }
        }.bind(_this));
        /**
         * This object will be updated when the source changes. Key is uid.
         * @type {Object<string, FeatureCacheItem>}
         * @private
         */
        _this.featureCache_ = {};
        /**
         * Amount of features in the cache.
         * @type {number}
         * @private
         */
        _this.featureCount_ = 0;
        var source = _this.getLayer().getSource();
        _this.sourceListenKeys_ = [
            Object(_events_js__WEBPACK_IMPORTED_MODULE_13__["listen"])(source, _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].ADDFEATURE, _this.handleSourceFeatureAdded_, _this),
            Object(_events_js__WEBPACK_IMPORTED_MODULE_13__["listen"])(source, _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].CHANGEFEATURE, _this.handleSourceFeatureChanged_, _this),
            Object(_events_js__WEBPACK_IMPORTED_MODULE_13__["listen"])(source, _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].REMOVEFEATURE, _this.handleSourceFeatureDelete_, _this),
            Object(_events_js__WEBPACK_IMPORTED_MODULE_13__["listen"])(source, _source_VectorEventType_js__WEBPACK_IMPORTED_MODULE_14__["default"].CLEAR, _this.handleSourceFeatureClear_, _this)
        ];
        source.forEachFeature(function (feature) {
            this.featureCache_[Object(_util_js__WEBPACK_IMPORTED_MODULE_9__["getUid"])(feature)] = {
                feature: feature,
                properties: feature.getProperties(),
                geometry: feature.getGeometry()
            };
            this.featureCount_++;
        }.bind(_this));
        return _this;
    }
    /**
     * @param {import("../../source/Vector.js").VectorSourceEvent} event Event.
     * @private
     */
    WebGLPointsLayerRenderer.prototype.handleSourceFeatureAdded_ = function (event) {
        var feature = event.feature;
        this.featureCache_[Object(_util_js__WEBPACK_IMPORTED_MODULE_9__["getUid"])(feature)] = {
            feature: feature,
            properties: feature.getProperties(),
            geometry: feature.getGeometry()
        };
        this.featureCount_++;
    };
    /**
     * @param {import("../../source/Vector.js").VectorSourceEvent} event Event.
     * @private
     */
    WebGLPointsLayerRenderer.prototype.handleSourceFeatureChanged_ = function (event) {
        var feature = event.feature;
        this.featureCache_[Object(_util_js__WEBPACK_IMPORTED_MODULE_9__["getUid"])(feature)] = {
            feature: feature,
            properties: feature.getProperties(),
            geometry: feature.getGeometry()
        };
    };
    /**
     * @param {import("../../source/Vector.js").VectorSourceEvent} event Event.
     * @private
     */
    WebGLPointsLayerRenderer.prototype.handleSourceFeatureDelete_ = function (event) {
        var feature = event.feature;
        delete this.featureCache_[Object(_util_js__WEBPACK_IMPORTED_MODULE_9__["getUid"])(feature)];
        this.featureCount_--;
    };
    /**
     * @private
     */
    WebGLPointsLayerRenderer.prototype.handleSourceFeatureClear_ = function () {
        this.featureCache_ = {};
        this.featureCount_ = 0;
    };
    /**
     * @inheritDoc
     */
    WebGLPointsLayerRenderer.prototype.renderFrame = function (frameState) {
        var renderCount = this.indicesBuffer_.getSize();
        this.helper.drawElements(0, renderCount);
        this.helper.finalizeDraw(frameState);
        var canvas = this.helper.getCanvas();
        var layerState = frameState.layerStatesArray[frameState.layerIndex];
        var opacity = layerState.opacity;
        if (opacity !== parseFloat(canvas.style.opacity)) {
            canvas.style.opacity = opacity;
        }
        if (this.hitDetectionEnabled_) {
            this.renderHitDetection(frameState);
            this.hitRenderTarget_.clearCachedData();
        }
        return canvas;
    };
    /**
     * @inheritDoc
     */
    WebGLPointsLayerRenderer.prototype.prepareFrame = function (frameState) {
        var layer = this.getLayer();
        var vectorSource = layer.getSource();
        var viewState = frameState.viewState;
        var viewNotMoving = !frameState.viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_5__["default"].ANIMATING] && !frameState.viewHints[_ViewHint_js__WEBPACK_IMPORTED_MODULE_5__["default"].INTERACTING];
        var extentChanged = !Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(this.previousExtent_, frameState.extent);
        var sourceChanged = this.sourceRevision_ < vectorSource.getRevision();
        if (sourceChanged) {
            this.sourceRevision_ = vectorSource.getRevision();
        }
        if (viewNotMoving && (extentChanged || sourceChanged)) {
            var projection = viewState.projection;
            var resolution = viewState.resolution;
            var renderBuffer = layer instanceof _layer_BaseVector_js__WEBPACK_IMPORTED_MODULE_12__["default"] ? layer.getRenderBuffer() : 0;
            var extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["buffer"])(frameState.extent, renderBuffer * resolution);
            vectorSource.loadFeatures(extent, resolution, projection);
            this.rebuildBuffers_(frameState);
            this.previousExtent_ = frameState.extent.slice();
        }
        // apply the current projection transform with the invert of the one used to fill buffers
        this.helper.makeProjectionTransform(frameState, this.currentTransform_);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_7__["multiply"])(this.currentTransform_, this.invertRenderTransform_);
        this.helper.useProgram(this.program_);
        this.helper.prepareDraw(frameState);
        // write new data
        this.helper.bindBuffer(this.verticesBuffer_);
        this.helper.bindBuffer(this.indicesBuffer_);
        this.helper.enableAttributes(this.attributes);
        return true;
    };
    /**
     * Rebuild internal webgl buffers based on current view extent; costly, should not be called too much
     * @param {import("../../PluggableMap").FrameState} frameState Frame state.
     * @private
     */
    WebGLPointsLayerRenderer.prototype.rebuildBuffers_ = function (frameState) {
        // saves the projection transform for the current frame state
        var projectionTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_7__["create"])();
        this.helper.makeProjectionTransform(frameState, projectionTransform);
        // here we anticipate the amount of render instructions that we well generate
        // this can be done since we know that for normal render we only have x, y as base instructions,
        // and x, y, r, g, b, a and featureUid for hit render instructions
        // and we also know the amount of custom attributes to append to these
        var totalInstructionsCount = (2 + this.customAttributes.length) * this.featureCount_;
        if (!this.renderInstructions_ || this.renderInstructions_.length !== totalInstructionsCount) {
            this.renderInstructions_ = new Float32Array(totalInstructionsCount);
        }
        if (this.hitDetectionEnabled_) {
            var totalHitInstructionsCount = (7 + this.customAttributes.length) * this.featureCount_;
            if (!this.hitRenderInstructions_ || this.hitRenderInstructions_.length !== totalHitInstructionsCount) {
                this.hitRenderInstructions_ = new Float32Array(totalHitInstructionsCount);
            }
        }
        // loop on features to fill the buffer
        var featureCache, geometry;
        var tmpCoords = [];
        var tmpColor = [];
        var renderIndex = 0;
        var hitIndex = 0;
        var hitColor;
        for (var featureUid in this.featureCache_) {
            featureCache = this.featureCache_[featureUid];
            geometry = /** @type {import("../../geom").Point} */ (featureCache.geometry);
            if (!geometry || geometry.getType() !== _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POINT) {
                continue;
            }
            tmpCoords[0] = geometry.getFlatCoordinates()[0];
            tmpCoords[1] = geometry.getFlatCoordinates()[1];
            Object(_transform_js__WEBPACK_IMPORTED_MODULE_7__["apply"])(projectionTransform, tmpCoords);
            hitColor = Object(_Layer_js__WEBPACK_IMPORTED_MODULE_4__["colorEncodeId"])(hitIndex + 6, tmpColor);
            this.renderInstructions_[renderIndex++] = tmpCoords[0];
            this.renderInstructions_[renderIndex++] = tmpCoords[1];
            // for hit detection, the feature uid is saved in the opacity value
            // and the index of the opacity value is encoded in the color values
            if (this.hitDetectionEnabled_) {
                this.hitRenderInstructions_[hitIndex++] = tmpCoords[0];
                this.hitRenderInstructions_[hitIndex++] = tmpCoords[1];
                this.hitRenderInstructions_[hitIndex++] = hitColor[0];
                this.hitRenderInstructions_[hitIndex++] = hitColor[1];
                this.hitRenderInstructions_[hitIndex++] = hitColor[2];
                this.hitRenderInstructions_[hitIndex++] = hitColor[3];
                this.hitRenderInstructions_[hitIndex++] = Number(featureUid);
            }
            // pushing custom attributes
            var value = void 0;
            for (var j = 0; j < this.customAttributes.length; j++) {
                value = this.customAttributes[j].callback(featureCache.feature, featureCache.properties);
                this.renderInstructions_[renderIndex++] = value;
                if (this.hitDetectionEnabled_) {
                    this.hitRenderInstructions_[hitIndex++] = value;
                }
            }
        }
        /** @type {import('./Layer').WebGLWorkerGenerateBuffersMessage} */
        var message = {
            type: _Layer_js__WEBPACK_IMPORTED_MODULE_4__["WebGLWorkerMessageType"].GENERATE_BUFFERS,
            renderInstructions: this.renderInstructions_.buffer,
            customAttributesCount: this.customAttributes.length
        };
        // additional properties will be sent back as-is by the worker
        message['projectionTransform'] = projectionTransform;
        this.worker_.postMessage(message, [this.renderInstructions_.buffer]);
        this.renderInstructions_ = null;
        /** @type {import('./Layer').WebGLWorkerGenerateBuffersMessage} */
        if (this.hitDetectionEnabled_) {
            var hitMessage = {
                type: _Layer_js__WEBPACK_IMPORTED_MODULE_4__["WebGLWorkerMessageType"].GENERATE_BUFFERS,
                renderInstructions: this.hitRenderInstructions_.buffer,
                customAttributesCount: 5 + this.customAttributes.length
            };
            hitMessage['projectionTransform'] = projectionTransform;
            hitMessage['hitDetection'] = true;
            this.worker_.postMessage(hitMessage, [this.hitRenderInstructions_.buffer]);
            this.hitRenderInstructions_ = null;
        }
    };
    /**
     * @inheritDoc
     */
    WebGLPointsLayerRenderer.prototype.forEachFeatureAtCoordinate = function (coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_11__["assert"])(this.hitDetectionEnabled_, 66);
        if (!this.hitRenderInstructions_) {
            return;
        }
        var pixel = Object(_transform_js__WEBPACK_IMPORTED_MODULE_7__["apply"])(frameState.coordinateToPixelTransform, coordinate.slice());
        var data = this.hitRenderTarget_.readPixel(pixel[0] / 2, pixel[1] / 2);
        var color = [
            data[0] / 255,
            data[1] / 255,
            data[2] / 255,
            data[3] / 255
        ];
        var index = Object(_Layer_js__WEBPACK_IMPORTED_MODULE_4__["colorDecodeId"])(color);
        var opacity = this.hitRenderInstructions_[index];
        var uid = Math.floor(opacity).toString();
        var source = this.getLayer().getSource();
        var feature = source.getFeatureByUid(uid);
        if (feature) {
            return callback(feature, this.getLayer());
        }
    };
    /**
     * Render the hit detection data to the corresponding render target
     * @param {import("../../PluggableMap.js").FrameState} frameState current frame state
     */
    WebGLPointsLayerRenderer.prototype.renderHitDetection = function (frameState) {
        // skip render entirely if vertex buffers not ready/generated yet
        if (!this.hitVerticesBuffer_.getSize()) {
            return;
        }
        this.hitRenderTarget_.setSize([
            Math.floor(frameState.size[0] / 2),
            Math.floor(frameState.size[1] / 2)
        ]);
        this.helper.useProgram(this.hitProgram_);
        this.helper.prepareDrawToRenderTarget(frameState, this.hitRenderTarget_, true);
        this.helper.bindBuffer(this.hitVerticesBuffer_);
        this.helper.bindBuffer(this.indicesBuffer_);
        this.helper.enableAttributes(this.hitDetectionAttributes);
        var renderCount = this.indicesBuffer_.getSize();
        this.helper.drawElements(0, renderCount);
    };
    /**
     * @inheritDoc
     */
    WebGLPointsLayerRenderer.prototype.disposeInternal = function () {
        this.worker_.terminate();
        this.layer_ = null;
        this.sourceListenKeys_.forEach(function (key) {
            Object(_events_js__WEBPACK_IMPORTED_MODULE_13__["unlistenByKey"])(key);
        });
        this.sourceListenKeys_ = null;
        _super.prototype.disposeInternal.call(this);
    };
    return WebGLPointsLayerRenderer;
}(_Layer_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (WebGLPointsLayerRenderer);
//# sourceMappingURL=PointsLayer.js.map

/***/ }),

/***/ "./node_modules/ol/reproj.js":
/*!***********************************!*\
  !*** ./node_modules/ol/reproj.js ***!
  \***********************************/
/*! exports provided: calculateSourceResolution, render */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "calculateSourceResolution", function() { return calculateSourceResolution; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./proj.js */ "./node_modules/ol/proj.js");
/**
 * @module ol/reproj
 */




/**
 * Calculates ideal resolution to use from the source in order to achieve
 * pixel mapping as close as possible to 1:1 during reprojection.
 * The resolution is calculated regardless of what resolutions
 * are actually available in the dataset (TileGrid, Image, ...).
 *
 * @param {import("./proj/Projection.js").default} sourceProj Source projection.
 * @param {import("./proj/Projection.js").default} targetProj Target projection.
 * @param {import("./coordinate.js").Coordinate} targetCenter Target center.
 * @param {number} targetResolution Target resolution.
 * @return {number} The best resolution to use. Can be +-Infinity, NaN or 0.
 */
function calculateSourceResolution(sourceProj, targetProj, targetCenter, targetResolution) {
    var sourceCenter = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["transform"])(targetCenter, targetProj, sourceProj);
    // calculate the ideal resolution of the source data
    var sourceResolution = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["getPointResolution"])(targetProj, targetResolution, targetCenter);
    var targetMetersPerUnit = targetProj.getMetersPerUnit();
    if (targetMetersPerUnit !== undefined) {
        sourceResolution *= targetMetersPerUnit;
    }
    var sourceMetersPerUnit = sourceProj.getMetersPerUnit();
    if (sourceMetersPerUnit !== undefined) {
        sourceResolution /= sourceMetersPerUnit;
    }
    // Based on the projection properties, the point resolution at the specified
    // coordinates may be slightly different. We need to reverse-compensate this
    // in order to achieve optimal results.
    var sourceExtent = sourceProj.getExtent();
    if (!sourceExtent || Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["containsCoordinate"])(sourceExtent, sourceCenter)) {
        var compensationFactor = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["getPointResolution"])(sourceProj, sourceResolution, sourceCenter) /
            sourceResolution;
        if (isFinite(compensationFactor) && compensationFactor > 0) {
            sourceResolution /= compensationFactor;
        }
    }
    return sourceResolution;
}
/**
 * Enlarge the clipping triangle point by 1 pixel to ensure the edges overlap
 * in order to mask gaps caused by antialiasing.
 *
 * @param {number} centroidX Centroid of the triangle (x coordinate in pixels).
 * @param {number} centroidY Centroid of the triangle (y coordinate in pixels).
 * @param {number} x X coordinate of the point (in pixels).
 * @param {number} y Y coordinate of the point (in pixels).
 * @return {import("./coordinate.js").Coordinate} New point 1 px farther from the centroid.
 */
function enlargeClipPoint(centroidX, centroidY, x, y) {
    var dX = x - centroidX;
    var dY = y - centroidY;
    var distance = Math.sqrt(dX * dX + dY * dY);
    return [Math.round(x + dX / distance), Math.round(y + dY / distance)];
}
/**
 * Renders the source data into new canvas based on the triangulation.
 *
 * @param {number} width Width of the canvas.
 * @param {number} height Height of the canvas.
 * @param {number} pixelRatio Pixel ratio.
 * @param {number} sourceResolution Source resolution.
 * @param {import("./extent.js").Extent} sourceExtent Extent of the data source.
 * @param {number} targetResolution Target resolution.
 * @param {import("./extent.js").Extent} targetExtent Target extent.
 * @param {import("./reproj/Triangulation.js").default} triangulation
 * Calculated triangulation.
 * @param {Array<{extent: import("./extent.js").Extent,
 *                 image: (HTMLCanvasElement|HTMLImageElement|HTMLVideoElement)}>} sources
 * Array of sources.
 * @param {number} gutter Gutter of the sources.
 * @param {boolean=} opt_renderEdges Render reprojection edges.
 * @return {HTMLCanvasElement} Canvas with reprojected data.
 */
function render(width, height, pixelRatio, sourceResolution, sourceExtent, targetResolution, targetExtent, triangulation, sources, gutter, opt_renderEdges) {
    var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_0__["createCanvasContext2D"])(Math.round(pixelRatio * width), Math.round(pixelRatio * height));
    if (sources.length === 0) {
        return context.canvas;
    }
    context.scale(pixelRatio, pixelRatio);
    var sourceDataExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["createEmpty"])();
    sources.forEach(function (src, i, arr) {
        Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["extend"])(sourceDataExtent, src.extent);
    });
    var canvasWidthInUnits = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getWidth"])(sourceDataExtent);
    var canvasHeightInUnits = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getHeight"])(sourceDataExtent);
    var stitchContext = Object(_dom_js__WEBPACK_IMPORTED_MODULE_0__["createCanvasContext2D"])(Math.round(pixelRatio * canvasWidthInUnits / sourceResolution), Math.round(pixelRatio * canvasHeightInUnits / sourceResolution));
    var stitchScale = pixelRatio / sourceResolution;
    sources.forEach(function (src, i, arr) {
        var xPos = src.extent[0] - sourceDataExtent[0];
        var yPos = -(src.extent[3] - sourceDataExtent[3]);
        var srcWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getWidth"])(src.extent);
        var srcHeight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getHeight"])(src.extent);
        stitchContext.drawImage(src.image, gutter, gutter, src.image.width - 2 * gutter, src.image.height - 2 * gutter, xPos * stitchScale, yPos * stitchScale, srcWidth * stitchScale, srcHeight * stitchScale);
    });
    var targetTopLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getTopLeft"])(targetExtent);
    triangulation.getTriangles().forEach(function (triangle, i, arr) {
        /* Calculate affine transform (src -> dst)
         * Resulting matrix can be used to transform coordinate
         * from `sourceProjection` to destination pixels.
         *
         * To optimize number of context calls and increase numerical stability,
         * we also do the following operations:
         * trans(-topLeftExtentCorner), scale(1 / targetResolution), scale(1, -1)
         * here before solving the linear system so [ui, vi] are pixel coordinates.
         *
         * Src points: xi, yi
         * Dst points: ui, vi
         * Affine coefficients: aij
         *
         * | x0 y0 1  0  0 0 |   |a00|   |u0|
         * | x1 y1 1  0  0 0 |   |a01|   |u1|
         * | x2 y2 1  0  0 0 | x |a02| = |u2|
         * |  0  0 0 x0 y0 1 |   |a10|   |v0|
         * |  0  0 0 x1 y1 1 |   |a11|   |v1|
         * |  0  0 0 x2 y2 1 |   |a12|   |v2|
         */
        var source = triangle.source;
        var target = triangle.target;
        var x0 = source[0][0], y0 = source[0][1];
        var x1 = source[1][0], y1 = source[1][1];
        var x2 = source[2][0], y2 = source[2][1];
        var u0 = (target[0][0] - targetTopLeft[0]) / targetResolution;
        var v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution;
        var u1 = (target[1][0] - targetTopLeft[0]) / targetResolution;
        var v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution;
        var u2 = (target[2][0] - targetTopLeft[0]) / targetResolution;
        var v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution;
        // Shift all the source points to improve numerical stability
        // of all the subsequent calculations. The [x0, y0] is used here.
        // This is also used to simplify the linear system.
        var sourceNumericalShiftX = x0;
        var sourceNumericalShiftY = y0;
        x0 = 0;
        y0 = 0;
        x1 -= sourceNumericalShiftX;
        y1 -= sourceNumericalShiftY;
        x2 -= sourceNumericalShiftX;
        y2 -= sourceNumericalShiftY;
        var augmentedMatrix = [
            [x1, y1, 0, 0, u1 - u0],
            [x2, y2, 0, 0, u2 - u0],
            [0, 0, x1, y1, v1 - v0],
            [0, 0, x2, y2, v2 - v0]
        ];
        var affineCoefs = Object(_math_js__WEBPACK_IMPORTED_MODULE_2__["solveLinearSystem"])(augmentedMatrix);
        if (!affineCoefs) {
            return;
        }
        context.save();
        context.beginPath();
        var centroidX = (u0 + u1 + u2) / 3;
        var centroidY = (v0 + v1 + v2) / 3;
        var p0 = enlargeClipPoint(centroidX, centroidY, u0, v0);
        var p1 = enlargeClipPoint(centroidX, centroidY, u1, v1);
        var p2 = enlargeClipPoint(centroidX, centroidY, u2, v2);
        context.moveTo(p1[0], p1[1]);
        context.lineTo(p0[0], p0[1]);
        context.lineTo(p2[0], p2[1]);
        context.clip();
        context.transform(affineCoefs[0], affineCoefs[2], affineCoefs[1], affineCoefs[3], u0, v0);
        context.translate(sourceDataExtent[0] - sourceNumericalShiftX, sourceDataExtent[3] - sourceNumericalShiftY);
        context.scale(sourceResolution / pixelRatio, -sourceResolution / pixelRatio);
        context.drawImage(stitchContext.canvas, 0, 0);
        context.restore();
    });
    if (opt_renderEdges) {
        context.save();
        context.strokeStyle = 'black';
        context.lineWidth = 1;
        triangulation.getTriangles().forEach(function (triangle, i, arr) {
            var target = triangle.target;
            var u0 = (target[0][0] - targetTopLeft[0]) / targetResolution;
            var v0 = -(target[0][1] - targetTopLeft[1]) / targetResolution;
            var u1 = (target[1][0] - targetTopLeft[0]) / targetResolution;
            var v1 = -(target[1][1] - targetTopLeft[1]) / targetResolution;
            var u2 = (target[2][0] - targetTopLeft[0]) / targetResolution;
            var v2 = -(target[2][1] - targetTopLeft[1]) / targetResolution;
            context.beginPath();
            context.moveTo(u1, v1);
            context.lineTo(u0, v0);
            context.lineTo(u2, v2);
            context.closePath();
            context.stroke();
        });
        context.restore();
    }
    return context.canvas;
}
//# sourceMappingURL=reproj.js.map

/***/ }),

/***/ "./node_modules/ol/reproj/Image.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/reproj/Image.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/ol/reproj/common.js");
/* harmony import */ var _ImageBase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ImageBase.js */ "./node_modules/ol/ImageBase.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _reproj_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../reproj.js */ "./node_modules/ol/reproj.js");
/* harmony import */ var _Triangulation_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Triangulation.js */ "./node_modules/ol/reproj/Triangulation.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/reproj/Image
 */








/**
 * @typedef {function(import("../extent.js").Extent, number, number) : import("../ImageBase.js").default} FunctionType
 */
/**
 * @classdesc
 * Class encapsulating single reprojected image.
 * See {@link module:ol/source/Image~ImageSource}.
 */
var ReprojImage = /** @class */ (function (_super) {
    __extends(ReprojImage, _super);
    /**
     * @param {import("../proj/Projection.js").default} sourceProj Source projection (of the data).
     * @param {import("../proj/Projection.js").default} targetProj Target projection.
     * @param {import("../extent.js").Extent} targetExtent Target extent.
     * @param {number} targetResolution Target resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {FunctionType} getImageFunction
     *     Function returning source images (extent, resolution, pixelRatio).
     */
    function ReprojImage(sourceProj, targetProj, targetExtent, targetResolution, pixelRatio, getImageFunction) {
        var _this = this;
        var maxSourceExtent = sourceProj.getExtent();
        var maxTargetExtent = targetProj.getExtent();
        var limitedTargetExtent = maxTargetExtent ?
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getIntersection"])(targetExtent, maxTargetExtent) : targetExtent;
        var targetCenter = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getCenter"])(limitedTargetExtent);
        var sourceResolution = Object(_reproj_js__WEBPACK_IMPORTED_MODULE_6__["calculateSourceResolution"])(sourceProj, targetProj, targetCenter, targetResolution);
        var errorThresholdInPixels = _common_js__WEBPACK_IMPORTED_MODULE_0__["ERROR_THRESHOLD"];
        var triangulation = new _Triangulation_js__WEBPACK_IMPORTED_MODULE_7__["default"](sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, sourceResolution * errorThresholdInPixels, targetResolution);
        var sourceExtent = triangulation.calculateSourceExtent();
        var sourceImage = getImageFunction(sourceExtent, sourceResolution, pixelRatio);
        var state = sourceImage ? _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].IDLE : _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].EMPTY;
        var sourcePixelRatio = sourceImage ? sourceImage.getPixelRatio() : 1;
        _this = _super.call(this, targetExtent, targetResolution, sourcePixelRatio, state) || this;
        /**
         * @private
         * @type {import("../proj/Projection.js").default}
         */
        _this.targetProj_ = targetProj;
        /**
         * @private
         * @type {import("../extent.js").Extent}
         */
        _this.maxSourceExtent_ = maxSourceExtent;
        /**
         * @private
         * @type {!import("./Triangulation.js").default}
         */
        _this.triangulation_ = triangulation;
        /**
         * @private
         * @type {number}
         */
        _this.targetResolution_ = targetResolution;
        /**
         * @private
         * @type {import("../extent.js").Extent}
         */
        _this.targetExtent_ = targetExtent;
        /**
         * @private
         * @type {import("../ImageBase.js").default}
         */
        _this.sourceImage_ = sourceImage;
        /**
         * @private
         * @type {number}
         */
        _this.sourcePixelRatio_ = sourcePixelRatio;
        /**
         * @private
         * @type {HTMLCanvasElement}
         */
        _this.canvas_ = null;
        /**
         * @private
         * @type {?import("../events.js").EventsKey}
         */
        _this.sourceListenerKey_ = null;
        return _this;
    }
    /**
     * @inheritDoc
     */
    ReprojImage.prototype.disposeInternal = function () {
        if (this.state == _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADING) {
            this.unlistenSource_();
        }
        _super.prototype.disposeInternal.call(this);
    };
    /**
     * @inheritDoc
     */
    ReprojImage.prototype.getImage = function () {
        return this.canvas_;
    };
    /**
     * @return {import("../proj/Projection.js").default} Projection.
     */
    ReprojImage.prototype.getProjection = function () {
        return this.targetProj_;
    };
    /**
     * @private
     */
    ReprojImage.prototype.reproject_ = function () {
        var sourceState = this.sourceImage_.getState();
        if (sourceState == _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED) {
            var width = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getWidth"])(this.targetExtent_) / this.targetResolution_;
            var height = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getHeight"])(this.targetExtent_) / this.targetResolution_;
            this.canvas_ = Object(_reproj_js__WEBPACK_IMPORTED_MODULE_6__["render"])(width, height, this.sourcePixelRatio_, this.sourceImage_.getResolution(), this.maxSourceExtent_, this.targetResolution_, this.targetExtent_, this.triangulation_, [{
                    extent: this.sourceImage_.getExtent(),
                    image: this.sourceImage_.getImage()
                }], 0);
        }
        this.state = sourceState;
        this.changed();
    };
    /**
     * @inheritDoc
     */
    ReprojImage.prototype.load = function () {
        if (this.state == _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].IDLE) {
            this.state = _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADING;
            this.changed();
            var sourceState = this.sourceImage_.getState();
            if (sourceState == _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED || sourceState == _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].ERROR) {
                this.reproject_();
            }
            else {
                this.sourceListenerKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(this.sourceImage_, _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CHANGE, function (e) {
                    var sourceState = this.sourceImage_.getState();
                    if (sourceState == _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED || sourceState == _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].ERROR) {
                        this.unlistenSource_();
                        this.reproject_();
                    }
                }, this);
                this.sourceImage_.load();
            }
        }
    };
    /**
     * @private
     */
    ReprojImage.prototype.unlistenSource_ = function () {
        Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["unlistenByKey"])(/** @type {!import("../events.js").EventsKey} */ (this.sourceListenerKey_));
        this.sourceListenerKey_ = null;
    };
    return ReprojImage;
}(_ImageBase_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ReprojImage);
//# sourceMappingURL=Image.js.map

/***/ }),

/***/ "./node_modules/ol/reproj/Tile.js":
/*!****************************************!*\
  !*** ./node_modules/ol/reproj/Tile.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/ol/reproj/common.js");
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Tile.js */ "./node_modules/ol/Tile.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _reproj_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../reproj.js */ "./node_modules/ol/reproj.js");
/* harmony import */ var _Triangulation_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Triangulation.js */ "./node_modules/ol/reproj/Triangulation.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/reproj/Tile
 */









/**
 * @typedef {function(number, number, number, number) : import("../Tile.js").default} FunctionType
 */
/**
 * @classdesc
 * Class encapsulating single reprojected tile.
 * See {@link module:ol/source/TileImage~TileImage}.
 *
 */
var ReprojTile = /** @class */ (function (_super) {
    __extends(ReprojTile, _super);
    /**
     * @param {import("../proj/Projection.js").default} sourceProj Source projection.
     * @param {import("../tilegrid/TileGrid.js").default} sourceTileGrid Source tile grid.
     * @param {import("../proj/Projection.js").default} targetProj Target projection.
     * @param {import("../tilegrid/TileGrid.js").default} targetTileGrid Target tile grid.
     * @param {import("../tilecoord.js").TileCoord} tileCoord Coordinate of the tile.
     * @param {import("../tilecoord.js").TileCoord} wrappedTileCoord Coordinate of the tile wrapped in X.
     * @param {number} pixelRatio Pixel ratio.
     * @param {number} gutter Gutter of the source tiles.
     * @param {FunctionType} getTileFunction
     *     Function returning source tiles (z, x, y, pixelRatio).
     * @param {number=} opt_errorThreshold Acceptable reprojection error (in px).
     * @param {boolean=} opt_renderEdges Render reprojection edges.
     */
    function ReprojTile(sourceProj, sourceTileGrid, targetProj, targetTileGrid, tileCoord, wrappedTileCoord, pixelRatio, gutter, getTileFunction, opt_errorThreshold, opt_renderEdges) {
        var _this = _super.call(this, tileCoord, _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].IDLE) || this;
        /**
         * @private
         * @type {boolean}
         */
        _this.renderEdges_ = opt_renderEdges !== undefined ? opt_renderEdges : false;
        /**
         * @private
         * @type {number}
         */
        _this.pixelRatio_ = pixelRatio;
        /**
         * @private
         * @type {number}
         */
        _this.gutter_ = gutter;
        /**
         * @private
         * @type {HTMLCanvasElement}
         */
        _this.canvas_ = null;
        /**
         * @private
         * @type {import("../tilegrid/TileGrid.js").default}
         */
        _this.sourceTileGrid_ = sourceTileGrid;
        /**
         * @private
         * @type {import("../tilegrid/TileGrid.js").default}
         */
        _this.targetTileGrid_ = targetTileGrid;
        /**
         * @private
         * @type {import("../tilecoord.js").TileCoord}
         */
        _this.wrappedTileCoord_ = wrappedTileCoord ? wrappedTileCoord : tileCoord;
        /**
         * @private
         * @type {!Array<import("../Tile.js").default>}
         */
        _this.sourceTiles_ = [];
        /**
         * @private
         * @type {?Array<import("../events.js").EventsKey>}
         */
        _this.sourcesListenerKeys_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.sourceZ_ = 0;
        var targetExtent = targetTileGrid.getTileCoordExtent(_this.wrappedTileCoord_);
        var maxTargetExtent = _this.targetTileGrid_.getExtent();
        var maxSourceExtent = _this.sourceTileGrid_.getExtent();
        var limitedTargetExtent = maxTargetExtent ?
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getIntersection"])(targetExtent, maxTargetExtent) : targetExtent;
        if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getArea"])(limitedTargetExtent) === 0) {
            // Tile is completely outside range -> EMPTY
            // TODO: is it actually correct that the source even creates the tile ?
            _this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].EMPTY;
            return _this;
        }
        var sourceProjExtent = sourceProj.getExtent();
        if (sourceProjExtent) {
            if (!maxSourceExtent) {
                maxSourceExtent = sourceProjExtent;
            }
            else {
                maxSourceExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getIntersection"])(maxSourceExtent, sourceProjExtent);
            }
        }
        var targetResolution = targetTileGrid.getResolution(_this.wrappedTileCoord_[0]);
        var targetCenter = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getCenter"])(limitedTargetExtent);
        var sourceResolution = Object(_reproj_js__WEBPACK_IMPORTED_MODULE_7__["calculateSourceResolution"])(sourceProj, targetProj, targetCenter, targetResolution);
        if (!isFinite(sourceResolution) || sourceResolution <= 0) {
            // invalid sourceResolution -> EMPTY
            // probably edges of the projections when no extent is defined
            _this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].EMPTY;
            return _this;
        }
        var errorThresholdInPixels = opt_errorThreshold !== undefined ?
            opt_errorThreshold : _common_js__WEBPACK_IMPORTED_MODULE_0__["ERROR_THRESHOLD"];
        /**
         * @private
         * @type {!import("./Triangulation.js").default}
         */
        _this.triangulation_ = new _Triangulation_js__WEBPACK_IMPORTED_MODULE_8__["default"](sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, sourceResolution * errorThresholdInPixels, targetResolution);
        if (_this.triangulation_.getTriangles().length === 0) {
            // no valid triangles -> EMPTY
            _this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].EMPTY;
            return _this;
        }
        _this.sourceZ_ = sourceTileGrid.getZForResolution(sourceResolution);
        var sourceExtent = _this.triangulation_.calculateSourceExtent();
        if (maxSourceExtent) {
            if (sourceProj.canWrapX()) {
                sourceExtent[1] = Object(_math_js__WEBPACK_IMPORTED_MODULE_6__["clamp"])(sourceExtent[1], maxSourceExtent[1], maxSourceExtent[3]);
                sourceExtent[3] = Object(_math_js__WEBPACK_IMPORTED_MODULE_6__["clamp"])(sourceExtent[3], maxSourceExtent[1], maxSourceExtent[3]);
            }
            else {
                sourceExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getIntersection"])(sourceExtent, maxSourceExtent);
            }
        }
        if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["getArea"])(sourceExtent)) {
            _this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].EMPTY;
        }
        else {
            var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(sourceExtent, _this.sourceZ_);
            for (var srcX = sourceRange.minX; srcX <= sourceRange.maxX; srcX++) {
                for (var srcY = sourceRange.minY; srcY <= sourceRange.maxY; srcY++) {
                    var tile = getTileFunction(_this.sourceZ_, srcX, srcY, pixelRatio);
                    if (tile) {
                        _this.sourceTiles_.push(tile);
                    }
                }
            }
            if (_this.sourceTiles_.length === 0) {
                _this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].EMPTY;
            }
        }
        return _this;
    }
    /**
     * Get the HTML Canvas element for this tile.
     * @return {HTMLCanvasElement} Canvas.
     */
    ReprojTile.prototype.getImage = function () {
        return this.canvas_;
    };
    /**
     * @private
     */
    ReprojTile.prototype.reproject_ = function () {
        var sources = [];
        this.sourceTiles_.forEach(function (tile, i, arr) {
            if (tile && tile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED) {
                sources.push({
                    extent: this.sourceTileGrid_.getTileCoordExtent(tile.tileCoord),
                    image: tile.getImage()
                });
            }
        }.bind(this));
        this.sourceTiles_.length = 0;
        if (sources.length === 0) {
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].ERROR;
        }
        else {
            var z = this.wrappedTileCoord_[0];
            var size = this.targetTileGrid_.getTileSize(z);
            var width = typeof size === 'number' ? size : size[0];
            var height = typeof size === 'number' ? size : size[1];
            var targetResolution = this.targetTileGrid_.getResolution(z);
            var sourceResolution = this.sourceTileGrid_.getResolution(this.sourceZ_);
            var targetExtent = this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);
            this.canvas_ = Object(_reproj_js__WEBPACK_IMPORTED_MODULE_7__["render"])(width, height, this.pixelRatio_, sourceResolution, this.sourceTileGrid_.getExtent(), targetResolution, targetExtent, this.triangulation_, sources, this.gutter_, this.renderEdges_);
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED;
        }
        this.changed();
    };
    /**
     * @inheritDoc
     */
    ReprojTile.prototype.load = function () {
        if (this.state == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].IDLE) {
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADING;
            this.changed();
            var leftToLoad_1 = 0;
            this.sourcesListenerKeys_ = [];
            this.sourceTiles_.forEach(function (tile, i, arr) {
                var state = tile.getState();
                if (state == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].IDLE || state == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADING) {
                    leftToLoad_1++;
                    var sourceListenKey_1 = Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["listen"])(tile, _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CHANGE, function (e) {
                        var state = tile.getState();
                        if (state == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED ||
                            state == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].ERROR ||
                            state == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].EMPTY) {
                            Object(_events_js__WEBPACK_IMPORTED_MODULE_3__["unlistenByKey"])(sourceListenKey_1);
                            leftToLoad_1--;
                            if (leftToLoad_1 === 0) {
                                this.unlistenSources_();
                                this.reproject_();
                            }
                        }
                    }, this);
                    this.sourcesListenerKeys_.push(sourceListenKey_1);
                }
            }.bind(this));
            this.sourceTiles_.forEach(function (tile, i, arr) {
                var state = tile.getState();
                if (state == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].IDLE) {
                    tile.load();
                }
            });
            if (leftToLoad_1 === 0) {
                setTimeout(this.reproject_.bind(this), 0);
            }
        }
    };
    /**
     * @private
     */
    ReprojTile.prototype.unlistenSources_ = function () {
        this.sourcesListenerKeys_.forEach(_events_js__WEBPACK_IMPORTED_MODULE_3__["unlistenByKey"]);
        this.sourcesListenerKeys_ = null;
    };
    return ReprojTile;
}(_Tile_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ReprojTile);
//# sourceMappingURL=Tile.js.map

/***/ }),

/***/ "./node_modules/ol/reproj/Triangulation.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/reproj/Triangulation.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/**
 * @module ol/reproj/Triangulation
 */



/**
 * Single triangle; consists of 3 source points and 3 target points.
 * @typedef {Object} Triangle
 * @property {Array<import("../coordinate.js").Coordinate>} source
 * @property {Array<import("../coordinate.js").Coordinate>} target
 */
/**
 * Maximum number of subdivision steps during raster reprojection triangulation.
 * Prevents high memory usage and large number of proj4 calls (for certain
 * transformations and areas). At most `2*(2^this)` triangles are created for
 * each triangulated extent (tile/image).
 * @type {number}
 */
var MAX_SUBDIVISION = 10;
/**
 * Maximum allowed size of triangle relative to world width. When transforming
 * corners of world extent between certain projections, the resulting
 * triangulation seems to have zero error and no subdivision is performed. If
 * the triangle width is more than this (relative to world width; 0-1),
 * subdivison is forced (up to `MAX_SUBDIVISION`). Default is `0.25`.
 * @type {number}
 */
var MAX_TRIANGLE_WIDTH = 0.25;
/**
 * @classdesc
 * Class containing triangulation of the given target extent.
 * Used for determining source data and the reprojection itself.
 */
var Triangulation = /** @class */ (function () {
    /**
     * @param {import("../proj/Projection.js").default} sourceProj Source projection.
     * @param {import("../proj/Projection.js").default} targetProj Target projection.
     * @param {import("../extent.js").Extent} targetExtent Target extent to triangulate.
     * @param {import("../extent.js").Extent} maxSourceExtent Maximal source extent that can be used.
     * @param {number} errorThreshold Acceptable error (in source units).
     * @param {?number} opt_destinationResolution The (optional) resolution of the destination.
     */
    function Triangulation(sourceProj, targetProj, targetExtent, maxSourceExtent, errorThreshold, opt_destinationResolution) {
        /**
         * @type {import("../proj/Projection.js").default}
         * @private
         */
        this.sourceProj_ = sourceProj;
        /**
         * @type {import("../proj/Projection.js").default}
         * @private
         */
        this.targetProj_ = targetProj;
        /** @type {!Object<string, import("../coordinate.js").Coordinate>} */
        var transformInvCache = {};
        var transformInv = Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["getTransform"])(this.targetProj_, this.sourceProj_);
        /**
         * @param {import("../coordinate.js").Coordinate} c A coordinate.
         * @return {import("../coordinate.js").Coordinate} Transformed coordinate.
         * @private
         */
        this.transformInv_ = function (c) {
            var key = c[0] + '/' + c[1];
            if (!transformInvCache[key]) {
                transformInvCache[key] = transformInv(c);
            }
            return transformInvCache[key];
        };
        /**
         * @type {import("../extent.js").Extent}
         * @private
         */
        this.maxSourceExtent_ = maxSourceExtent;
        /**
         * @type {number}
         * @private
         */
        this.errorThresholdSquared_ = errorThreshold * errorThreshold;
        /**
         * @type {Array<Triangle>}
         * @private
         */
        this.triangles_ = [];
        /**
         * Indicates that the triangulation crosses edge of the source projection.
         * @type {boolean}
         * @private
         */
        this.wrapsXInSource_ = false;
        /**
         * @type {boolean}
         * @private
         */
        this.canWrapXInSource_ = this.sourceProj_.canWrapX() &&
            !!maxSourceExtent &&
            !!this.sourceProj_.getExtent() &&
            (Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getWidth"])(maxSourceExtent) == Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getWidth"])(this.sourceProj_.getExtent()));
        /**
         * @type {?number}
         * @private
         */
        this.sourceWorldWidth_ = this.sourceProj_.getExtent() ?
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getWidth"])(this.sourceProj_.getExtent()) : null;
        /**
         * @type {?number}
         * @private
         */
        this.targetWorldWidth_ = this.targetProj_.getExtent() ?
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getWidth"])(this.targetProj_.getExtent()) : null;
        var destinationTopLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getTopLeft"])(targetExtent);
        var destinationTopRight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getTopRight"])(targetExtent);
        var destinationBottomRight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getBottomRight"])(targetExtent);
        var destinationBottomLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getBottomLeft"])(targetExtent);
        var sourceTopLeft = this.transformInv_(destinationTopLeft);
        var sourceTopRight = this.transformInv_(destinationTopRight);
        var sourceBottomRight = this.transformInv_(destinationBottomRight);
        var sourceBottomLeft = this.transformInv_(destinationBottomLeft);
        /*
         * The maxSubdivision controls how many splittings of the target area can
         * be done. The idea here is to do a linear mapping of the target areas
         * but the actual overal reprojection (can be) extremely non-linear. The
         * default value of MAX_SUBDIVISION was chosen based on mapping a 256x256
         * tile size. However this function is also called to remap canvas rendered
         * layers which can be much larger. This calculation increases the maxSubdivision
         * value by the right factor so that each 256x256 pixel area has
         * MAX_SUBDIVISION divisions.
         */
        var maxSubdivision = MAX_SUBDIVISION + (opt_destinationResolution ?
            Math.max(0, Math.ceil(Math.log2(Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getArea"])(targetExtent) /
                (opt_destinationResolution * opt_destinationResolution * 256 * 256))))
            : 0);
        this.addQuad_(destinationTopLeft, destinationTopRight, destinationBottomRight, destinationBottomLeft, sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft, maxSubdivision);
        if (this.wrapsXInSource_) {
            var leftBound_1 = Infinity;
            this.triangles_.forEach(function (triangle, i, arr) {
                leftBound_1 = Math.min(leftBound_1, triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]);
            });
            // Shift triangles to be as close to `leftBound` as possible
            // (if the distance is more than `worldWidth / 2` it can be closer.
            this.triangles_.forEach(function (triangle) {
                if (Math.max(triangle.source[0][0], triangle.source[1][0], triangle.source[2][0]) - leftBound_1 > this.sourceWorldWidth_ / 2) {
                    var newTriangle = [[triangle.source[0][0], triangle.source[0][1]],
                        [triangle.source[1][0], triangle.source[1][1]],
                        [triangle.source[2][0], triangle.source[2][1]]];
                    if ((newTriangle[0][0] - leftBound_1) > this.sourceWorldWidth_ / 2) {
                        newTriangle[0][0] -= this.sourceWorldWidth_;
                    }
                    if ((newTriangle[1][0] - leftBound_1) > this.sourceWorldWidth_ / 2) {
                        newTriangle[1][0] -= this.sourceWorldWidth_;
                    }
                    if ((newTriangle[2][0] - leftBound_1) > this.sourceWorldWidth_ / 2) {
                        newTriangle[2][0] -= this.sourceWorldWidth_;
                    }
                    // Rarely (if the extent contains both the dateline and prime meridian)
                    // the shift can in turn break some triangles.
                    // Detect this here and don't shift in such cases.
                    var minX = Math.min(newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]);
                    var maxX = Math.max(newTriangle[0][0], newTriangle[1][0], newTriangle[2][0]);
                    if ((maxX - minX) < this.sourceWorldWidth_ / 2) {
                        triangle.source = newTriangle;
                    }
                }
            }.bind(this));
        }
        transformInvCache = {};
    }
    /**
     * Adds triangle to the triangulation.
     * @param {import("../coordinate.js").Coordinate} a The target a coordinate.
     * @param {import("../coordinate.js").Coordinate} b The target b coordinate.
     * @param {import("../coordinate.js").Coordinate} c The target c coordinate.
     * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate.
     * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate.
     * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate.
     * @private
     */
    Triangulation.prototype.addTriangle_ = function (a, b, c, aSrc, bSrc, cSrc) {
        this.triangles_.push({
            source: [aSrc, bSrc, cSrc],
            target: [a, b, c]
        });
    };
    /**
     * Adds quad (points in clock-wise order) to the triangulation
     * (and reprojects the vertices) if valid.
     * Performs quad subdivision if needed to increase precision.
     *
     * @param {import("../coordinate.js").Coordinate} a The target a coordinate.
     * @param {import("../coordinate.js").Coordinate} b The target b coordinate.
     * @param {import("../coordinate.js").Coordinate} c The target c coordinate.
     * @param {import("../coordinate.js").Coordinate} d The target d coordinate.
     * @param {import("../coordinate.js").Coordinate} aSrc The source a coordinate.
     * @param {import("../coordinate.js").Coordinate} bSrc The source b coordinate.
     * @param {import("../coordinate.js").Coordinate} cSrc The source c coordinate.
     * @param {import("../coordinate.js").Coordinate} dSrc The source d coordinate.
     * @param {number} maxSubdivision Maximal allowed subdivision of the quad.
     * @private
     */
    Triangulation.prototype.addQuad_ = function (a, b, c, d, aSrc, bSrc, cSrc, dSrc, maxSubdivision) {
        var sourceQuadExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["boundingExtent"])([aSrc, bSrc, cSrc, dSrc]);
        var sourceCoverageX = this.sourceWorldWidth_ ?
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getWidth"])(sourceQuadExtent) / this.sourceWorldWidth_ : null;
        var sourceWorldWidth = /** @type {number} */ (this.sourceWorldWidth_);
        // when the quad is wrapped in the source projection
        // it covers most of the projection extent, but not fully
        var wrapsX = this.sourceProj_.canWrapX() &&
            sourceCoverageX > 0.5 && sourceCoverageX < 1;
        var needsSubdivision = false;
        if (maxSubdivision > 0) {
            if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {
                var targetQuadExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["boundingExtent"])([a, b, c, d]);
                var targetCoverageX = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["getWidth"])(targetQuadExtent) / this.targetWorldWidth_;
                needsSubdivision = targetCoverageX > MAX_TRIANGLE_WIDTH ||
                    needsSubdivision;
            }
            if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) {
                needsSubdivision = sourceCoverageX > MAX_TRIANGLE_WIDTH ||
                    needsSubdivision;
            }
        }
        if (!needsSubdivision && this.maxSourceExtent_) {
            if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["intersects"])(sourceQuadExtent, this.maxSourceExtent_)) {
                // whole quad outside source projection extent -> ignore
                return;
            }
        }
        if (!needsSubdivision) {
            if (!isFinite(aSrc[0]) || !isFinite(aSrc[1]) ||
                !isFinite(bSrc[0]) || !isFinite(bSrc[1]) ||
                !isFinite(cSrc[0]) || !isFinite(cSrc[1]) ||
                !isFinite(dSrc[0]) || !isFinite(dSrc[1])) {
                if (maxSubdivision > 0) {
                    needsSubdivision = true;
                }
                else {
                    return;
                }
            }
        }
        if (maxSubdivision > 0) {
            if (!needsSubdivision) {
                var center = [(a[0] + c[0]) / 2, (a[1] + c[1]) / 2];
                var centerSrc = this.transformInv_(center);
                var dx = void 0;
                if (wrapsX) {
                    var centerSrcEstimX = (Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["modulo"])(aSrc[0], sourceWorldWidth) +
                        Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["modulo"])(cSrc[0], sourceWorldWidth)) / 2;
                    dx = centerSrcEstimX -
                        Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["modulo"])(centerSrc[0], sourceWorldWidth);
                }
                else {
                    dx = (aSrc[0] + cSrc[0]) / 2 - centerSrc[0];
                }
                var dy = (aSrc[1] + cSrc[1]) / 2 - centerSrc[1];
                var centerSrcErrorSquared = dx * dx + dy * dy;
                needsSubdivision = centerSrcErrorSquared > this.errorThresholdSquared_;
            }
            if (needsSubdivision) {
                if (Math.abs(a[0] - c[0]) <= Math.abs(a[1] - c[1])) {
                    // split horizontally (top & bottom)
                    var bc = [(b[0] + c[0]) / 2, (b[1] + c[1]) / 2];
                    var bcSrc = this.transformInv_(bc);
                    var da = [(d[0] + a[0]) / 2, (d[1] + a[1]) / 2];
                    var daSrc = this.transformInv_(da);
                    this.addQuad_(a, b, bc, da, aSrc, bSrc, bcSrc, daSrc, maxSubdivision - 1);
                    this.addQuad_(da, bc, c, d, daSrc, bcSrc, cSrc, dSrc, maxSubdivision - 1);
                }
                else {
                    // split vertically (left & right)
                    var ab = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];
                    var abSrc = this.transformInv_(ab);
                    var cd = [(c[0] + d[0]) / 2, (c[1] + d[1]) / 2];
                    var cdSrc = this.transformInv_(cd);
                    this.addQuad_(a, ab, cd, d, aSrc, abSrc, cdSrc, dSrc, maxSubdivision - 1);
                    this.addQuad_(ab, b, c, cd, abSrc, bSrc, cSrc, cdSrc, maxSubdivision - 1);
                }
                return;
            }
        }
        if (wrapsX) {
            if (!this.canWrapXInSource_) {
                return;
            }
            this.wrapsXInSource_ = true;
        }
        this.addTriangle_(a, c, d, aSrc, cSrc, dSrc);
        this.addTriangle_(a, b, c, aSrc, bSrc, cSrc);
    };
    /**
     * Calculates extent of the 'source' coordinates from all the triangles.
     *
     * @return {import("../extent.js").Extent} Calculated extent.
     */
    Triangulation.prototype.calculateSourceExtent = function () {
        var extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createEmpty"])();
        this.triangles_.forEach(function (triangle, i, arr) {
            var src = triangle.source;
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["extendCoordinate"])(extent, src[0]);
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["extendCoordinate"])(extent, src[1]);
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["extendCoordinate"])(extent, src[2]);
        });
        return extent;
    };
    /**
     * @return {Array<Triangle>} Array of the calculated triangles.
     */
    Triangulation.prototype.getTriangles = function () {
        return this.triangles_;
    };
    return Triangulation;
}());
/* harmony default export */ __webpack_exports__["default"] = (Triangulation);
//# sourceMappingURL=Triangulation.js.map

/***/ }),

/***/ "./node_modules/ol/reproj/common.js":
/*!******************************************!*\
  !*** ./node_modules/ol/reproj/common.js ***!
  \******************************************/
/*! exports provided: ERROR_THRESHOLD, ENABLE_RASTER_REPROJECTION */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_THRESHOLD", function() { return ERROR_THRESHOLD; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ENABLE_RASTER_REPROJECTION", function() { return ENABLE_RASTER_REPROJECTION; });
/**
 * @module ol/reproj/common
 */
/**
 * Default maximum allowed threshold  (in pixels) for reprojection
 * triangulation.
 * @type {number}
 */
var ERROR_THRESHOLD = 0.5;
/**
 * Enable automatic reprojection of raster sources. Default is `true`.
 * TODO: decide if we want to expose this as a build flag or remove it
 * @type {boolean}
 */
var ENABLE_RASTER_REPROJECTION = true;
//# sourceMappingURL=common.js.map

/***/ }),

/***/ "./node_modules/ol/resolutionconstraint.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/resolutionconstraint.js ***!
  \*************************************************/
/*! exports provided: createSnapToResolutions, createSnapToPower, createMinMaxResolution */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSnapToResolutions", function() { return createSnapToResolutions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSnapToPower", function() { return createSnapToPower; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMinMaxResolution", function() { return createMinMaxResolution; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/**
 * @module ol/resolutionconstraint
 */



/**
 * @typedef {function((number|undefined), number, import("./size.js").Size, boolean=): (number|undefined)} Type
 */
/**
 * Returns a modified resolution taking into account the viewport size and maximum
 * allowed extent.
 * @param {number} resolution Resolution
 * @param {import("./extent.js").Extent=} maxExtent Maximum allowed extent.
 * @param {import("./size.js").Size} viewportSize Viewport size.
 * @param {boolean} showFullExtent Whether to show the full extent.
 * @return {number} Capped resolution.
 */
function getViewportClampedResolution(resolution, maxExtent, viewportSize, showFullExtent) {
    var xResolution = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getWidth"])(maxExtent) / viewportSize[0];
    var yResolution = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getHeight"])(maxExtent) / viewportSize[1];
    if (showFullExtent) {
        return Math.min(resolution, Math.max(xResolution, yResolution));
    }
    return Math.min(resolution, Math.min(xResolution, yResolution));
}
/**
 * Returns a modified resolution to be between maxResolution and minResolution while
 * still allowing the value to be slightly out of bounds.
 * Note: the computation is based on the logarithm function (ln):
 *  - at 1, ln(x) is 0
 *  - above 1, ln(x) keeps increasing but at a much slower pace than x
 * The final result is clamped to prevent getting too far away from bounds.
 * @param {number} resolution Resolution.
 * @param {number} maxResolution Max resolution.
 * @param {number} minResolution Min resolution.
 * @return {number} Smoothed resolution.
 */
function getSmoothClampedResolution(resolution, maxResolution, minResolution) {
    var result = Math.min(resolution, maxResolution);
    var ratio = 50;
    result *= Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio + 1;
    if (minResolution) {
        result = Math.max(result, minResolution);
        result /= Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) / ratio + 1;
    }
    return Object(_math_js__WEBPACK_IMPORTED_MODULE_2__["clamp"])(result, minResolution / 2, maxResolution * 2);
}
/**
 * @param {Array<number>} resolutions Resolutions.
 * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.
 * @param {import("./extent.js").Extent=} opt_maxExtent Maximum allowed extent.
 * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false.
 * @return {Type} Zoom function.
 */
function createSnapToResolutions(resolutions, opt_smooth, opt_maxExtent, opt_showFullExtent) {
    return (
    /**
     * @param {number|undefined} resolution Resolution.
     * @param {number} direction Direction.
     * @param {import("./size.js").Size} size Viewport size.
     * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.
     * @return {number|undefined} Resolution.
     */
    function (resolution, direction, size, opt_isMoving) {
        if (resolution !== undefined) {
            var maxResolution = resolutions[0];
            var minResolution = resolutions[resolutions.length - 1];
            var cappedMaxRes = opt_maxExtent ?
                getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent) :
                maxResolution;
            // during interacting or animating, allow intermediary values
            if (opt_isMoving) {
                var smooth = opt_smooth !== undefined ? opt_smooth : true;
                if (!smooth) {
                    return Object(_math_js__WEBPACK_IMPORTED_MODULE_2__["clamp"])(resolution, minResolution, cappedMaxRes);
                }
                return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);
            }
            var capped = Math.min(cappedMaxRes, resolution);
            var z = Math.floor(Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["linearFindNearest"])(resolutions, capped, direction));
            if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) {
                return resolutions[z + 1];
            }
            return resolutions[z];
        }
        else {
            return undefined;
        }
    });
}
/**
 * @param {number} power Power.
 * @param {number} maxResolution Maximum resolution.
 * @param {number=} opt_minResolution Minimum resolution.
 * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.
 * @param {import("./extent.js").Extent=} opt_maxExtent Maximum allowed extent.
 * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false.
 * @return {Type} Zoom function.
 */
function createSnapToPower(power, maxResolution, opt_minResolution, opt_smooth, opt_maxExtent, opt_showFullExtent) {
    return (
    /**
     * @param {number|undefined} resolution Resolution.
     * @param {number} direction Direction.
     * @param {import("./size.js").Size} size Viewport size.
     * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.
     * @return {number|undefined} Resolution.
     */
    function (resolution, direction, size, opt_isMoving) {
        if (resolution !== undefined) {
            var cappedMaxRes = opt_maxExtent ?
                getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent) :
                maxResolution;
            var minResolution = opt_minResolution !== undefined ? opt_minResolution : 0;
            // during interacting or animating, allow intermediary values
            if (opt_isMoving) {
                var smooth = opt_smooth !== undefined ? opt_smooth : true;
                if (!smooth) {
                    return Object(_math_js__WEBPACK_IMPORTED_MODULE_2__["clamp"])(resolution, minResolution, cappedMaxRes);
                }
                return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);
            }
            var tolerance = 1e-9;
            var minZoomLevel = Math.ceil(Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance);
            var offset = -direction * (0.5 - tolerance) + 0.5;
            var capped = Math.min(cappedMaxRes, resolution);
            var cappedZoomLevel = Math.floor(Math.log(maxResolution / capped) / Math.log(power) + offset);
            var zoomLevel = Math.max(minZoomLevel, cappedZoomLevel);
            var newResolution = maxResolution / Math.pow(power, zoomLevel);
            return Object(_math_js__WEBPACK_IMPORTED_MODULE_2__["clamp"])(newResolution, minResolution, cappedMaxRes);
        }
        else {
            return undefined;
        }
    });
}
/**
 * @param {number} maxResolution Max resolution.
 * @param {number} minResolution Min resolution.
 * @param {boolean=} opt_smooth If true, the view will be able to slightly exceed resolution limits. Default: true.
 * @param {import("./extent.js").Extent=} opt_maxExtent Maximum allowed extent.
 * @param {boolean=} opt_showFullExtent If true, allows us to show the full extent. Default: false.
 * @return {Type} Zoom function.
 */
function createMinMaxResolution(maxResolution, minResolution, opt_smooth, opt_maxExtent, opt_showFullExtent) {
    return (
    /**
     * @param {number|undefined} resolution Resolution.
     * @param {number} direction Direction.
     * @param {import("./size.js").Size} size Viewport size.
     * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.
     * @return {number|undefined} Resolution.
     */
    function (resolution, direction, size, opt_isMoving) {
        if (resolution !== undefined) {
            var cappedMaxRes = opt_maxExtent ?
                getViewportClampedResolution(maxResolution, opt_maxExtent, size, opt_showFullExtent) :
                maxResolution;
            var smooth = opt_smooth !== undefined ? opt_smooth : true;
            if (!smooth || !opt_isMoving) {
                return Object(_math_js__WEBPACK_IMPORTED_MODULE_2__["clamp"])(resolution, minResolution, cappedMaxRes);
            }
            return getSmoothClampedResolution(resolution, cappedMaxRes, minResolution);
        }
        else {
            return undefined;
        }
    });
}
//# sourceMappingURL=resolutionconstraint.js.map

/***/ }),

/***/ "./node_modules/ol/rotationconstraint.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/rotationconstraint.js ***!
  \***********************************************/
/*! exports provided: disable, none, createSnapToN, createSnapToZero */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disable", function() { return disable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "none", function() { return none; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSnapToN", function() { return createSnapToN; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSnapToZero", function() { return createSnapToZero; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/**
 * @module ol/rotationconstraint
 */

/**
 * @typedef {function((number|undefined), boolean=): (number|undefined)} Type
 */
/**
 * @param {number|undefined} rotation Rotation.
 * @return {number|undefined} Rotation.
 */
function disable(rotation) {
    if (rotation !== undefined) {
        return 0;
    }
    else {
        return undefined;
    }
}
/**
 * @param {number|undefined} rotation Rotation.
 * @return {number|undefined} Rotation.
 */
function none(rotation) {
    if (rotation !== undefined) {
        return rotation;
    }
    else {
        return undefined;
    }
}
/**
 * @param {number} n N.
 * @return {Type} Rotation constraint.
 */
function createSnapToN(n) {
    var theta = 2 * Math.PI / n;
    return (
    /**
     * @param {number|undefined} rotation Rotation.
     * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.
     * @return {number|undefined} Rotation.
     */
    function (rotation, opt_isMoving) {
        if (opt_isMoving) {
            return rotation;
        }
        if (rotation !== undefined) {
            rotation = Math.floor(rotation / theta + 0.5) * theta;
            return rotation;
        }
        else {
            return undefined;
        }
    });
}
/**
 * @param {number=} opt_tolerance Tolerance.
 * @return {Type} Rotation constraint.
 */
function createSnapToZero(opt_tolerance) {
    var tolerance = opt_tolerance || Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(5);
    return (
    /**
     * @param {number|undefined} rotation Rotation.
     * @param {boolean=} opt_isMoving True if an interaction or animation is in progress.
     * @return {number|undefined} Rotation.
     */
    function (rotation, opt_isMoving) {
        if (opt_isMoving) {
            return rotation;
        }
        if (rotation !== undefined) {
            if (Math.abs(rotation) <= tolerance) {
                return 0;
            }
            else {
                return rotation;
            }
        }
        else {
            return undefined;
        }
    });
}
//# sourceMappingURL=rotationconstraint.js.map

/***/ }),

/***/ "./node_modules/ol/size.js":
/*!*********************************!*\
  !*** ./node_modules/ol/size.js ***!
  \*********************************/
/*! exports provided: buffer, hasArea, scale, toSize */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buffer", function() { return buffer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasArea", function() { return hasArea; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toSize", function() { return toSize; });
/**
 * @module ol/size
 */
/**
 * An array of numbers representing a size: `[width, height]`.
 * @typedef {Array<number>} Size
 * @api
 */
/**
 * Returns a buffered size.
 * @param {Size} size Size.
 * @param {number} num The amount by which to buffer.
 * @param {Size=} opt_size Optional reusable size array.
 * @return {Size} The buffered size.
 */
function buffer(size, num, opt_size) {
    if (opt_size === undefined) {
        opt_size = [0, 0];
    }
    opt_size[0] = size[0] + 2 * num;
    opt_size[1] = size[1] + 2 * num;
    return opt_size;
}
/**
 * Determines if a size has a positive area.
 * @param {Size} size The size to test.
 * @return {boolean} The size has a positive area.
 */
function hasArea(size) {
    return size[0] > 0 && size[1] > 0;
}
/**
 * Returns a size scaled by a ratio. The result will be an array of integers.
 * @param {Size} size Size.
 * @param {number} ratio Ratio.
 * @param {Size=} opt_size Optional reusable size array.
 * @return {Size} The scaled size.
 */
function scale(size, ratio, opt_size) {
    if (opt_size === undefined) {
        opt_size = [0, 0];
    }
    opt_size[0] = (size[0] * ratio + 0.5) | 0;
    opt_size[1] = (size[1] * ratio + 0.5) | 0;
    return opt_size;
}
/**
 * Returns an `Size` array for the passed in number (meaning: square) or
 * `Size` array.
 * (meaning: non-square),
 * @param {number|Size} size Width and height.
 * @param {Size=} opt_size Optional reusable size array.
 * @return {Size} Size.
 * @api
 */
function toSize(size, opt_size) {
    if (Array.isArray(size)) {
        return size;
    }
    else {
        if (opt_size === undefined) {
            opt_size = [size, size];
        }
        else {
            opt_size[0] = size;
            opt_size[1] = size;
        }
        return opt_size;
    }
}
//# sourceMappingURL=size.js.map

/***/ }),

/***/ "./node_modules/ol/source.js":
/*!***********************************!*\
  !*** ./node_modules/ol/source.js ***!
  \***********************************/
/*! exports provided: BingMaps, CartoDB, Cluster, IIIF, Image, ImageArcGISRest, ImageCanvas, ImageMapGuide, ImageStatic, ImageWMS, OSM, Raster, Source, Stamen, Tile, TileArcGISRest, TileDebug, TileImage, TileJSON, TileWMS, UrlTile, UTFGrid, Vector, VectorTile, WMTS, XYZ, Zoomify */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _source_BingMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./source/BingMaps.js */ "./node_modules/ol/source/BingMaps.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BingMaps", function() { return _source_BingMaps_js__WEBPACK_IMPORTED_MODULE_0__["default"]; });

/* harmony import */ var _source_CartoDB_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./source/CartoDB.js */ "./node_modules/ol/source/CartoDB.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CartoDB", function() { return _source_CartoDB_js__WEBPACK_IMPORTED_MODULE_1__["default"]; });

/* harmony import */ var _source_Cluster_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./source/Cluster.js */ "./node_modules/ol/source/Cluster.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Cluster", function() { return _source_Cluster_js__WEBPACK_IMPORTED_MODULE_2__["default"]; });

/* harmony import */ var _source_IIIF_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./source/IIIF.js */ "./node_modules/ol/source/IIIF.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IIIF", function() { return _source_IIIF_js__WEBPACK_IMPORTED_MODULE_3__["default"]; });

/* harmony import */ var _source_Image_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./source/Image.js */ "./node_modules/ol/source/Image.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Image", function() { return _source_Image_js__WEBPACK_IMPORTED_MODULE_4__["default"]; });

/* harmony import */ var _source_ImageArcGISRest_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./source/ImageArcGISRest.js */ "./node_modules/ol/source/ImageArcGISRest.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ImageArcGISRest", function() { return _source_ImageArcGISRest_js__WEBPACK_IMPORTED_MODULE_5__["default"]; });

/* harmony import */ var _source_ImageCanvas_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./source/ImageCanvas.js */ "./node_modules/ol/source/ImageCanvas.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ImageCanvas", function() { return _source_ImageCanvas_js__WEBPACK_IMPORTED_MODULE_6__["default"]; });

/* harmony import */ var _source_ImageMapGuide_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./source/ImageMapGuide.js */ "./node_modules/ol/source/ImageMapGuide.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ImageMapGuide", function() { return _source_ImageMapGuide_js__WEBPACK_IMPORTED_MODULE_7__["default"]; });

/* harmony import */ var _source_ImageStatic_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./source/ImageStatic.js */ "./node_modules/ol/source/ImageStatic.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ImageStatic", function() { return _source_ImageStatic_js__WEBPACK_IMPORTED_MODULE_8__["default"]; });

/* harmony import */ var _source_ImageWMS_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./source/ImageWMS.js */ "./node_modules/ol/source/ImageWMS.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ImageWMS", function() { return _source_ImageWMS_js__WEBPACK_IMPORTED_MODULE_9__["default"]; });

/* harmony import */ var _source_OSM_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./source/OSM.js */ "./node_modules/ol/source/OSM.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OSM", function() { return _source_OSM_js__WEBPACK_IMPORTED_MODULE_10__["default"]; });

/* harmony import */ var _source_Raster_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./source/Raster.js */ "./node_modules/ol/source/Raster.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Raster", function() { return _source_Raster_js__WEBPACK_IMPORTED_MODULE_11__["default"]; });

/* harmony import */ var _source_Source_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./source/Source.js */ "./node_modules/ol/source/Source.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Source", function() { return _source_Source_js__WEBPACK_IMPORTED_MODULE_12__["default"]; });

/* harmony import */ var _source_Stamen_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./source/Stamen.js */ "./node_modules/ol/source/Stamen.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Stamen", function() { return _source_Stamen_js__WEBPACK_IMPORTED_MODULE_13__["default"]; });

/* harmony import */ var _source_Tile_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./source/Tile.js */ "./node_modules/ol/source/Tile.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Tile", function() { return _source_Tile_js__WEBPACK_IMPORTED_MODULE_14__["default"]; });

/* harmony import */ var _source_TileArcGISRest_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./source/TileArcGISRest.js */ "./node_modules/ol/source/TileArcGISRest.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TileArcGISRest", function() { return _source_TileArcGISRest_js__WEBPACK_IMPORTED_MODULE_15__["default"]; });

/* harmony import */ var _source_TileDebug_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./source/TileDebug.js */ "./node_modules/ol/source/TileDebug.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TileDebug", function() { return _source_TileDebug_js__WEBPACK_IMPORTED_MODULE_16__["default"]; });

/* harmony import */ var _source_TileImage_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./source/TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TileImage", function() { return _source_TileImage_js__WEBPACK_IMPORTED_MODULE_17__["default"]; });

/* harmony import */ var _source_TileJSON_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./source/TileJSON.js */ "./node_modules/ol/source/TileJSON.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TileJSON", function() { return _source_TileJSON_js__WEBPACK_IMPORTED_MODULE_18__["default"]; });

/* harmony import */ var _source_TileWMS_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./source/TileWMS.js */ "./node_modules/ol/source/TileWMS.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TileWMS", function() { return _source_TileWMS_js__WEBPACK_IMPORTED_MODULE_19__["default"]; });

/* harmony import */ var _source_UrlTile_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./source/UrlTile.js */ "./node_modules/ol/source/UrlTile.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UrlTile", function() { return _source_UrlTile_js__WEBPACK_IMPORTED_MODULE_20__["default"]; });

/* harmony import */ var _source_UTFGrid_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./source/UTFGrid.js */ "./node_modules/ol/source/UTFGrid.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UTFGrid", function() { return _source_UTFGrid_js__WEBPACK_IMPORTED_MODULE_21__["default"]; });

/* harmony import */ var _source_Vector_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./source/Vector.js */ "./node_modules/ol/source/Vector.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Vector", function() { return _source_Vector_js__WEBPACK_IMPORTED_MODULE_22__["default"]; });

/* harmony import */ var _source_VectorTile_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./source/VectorTile.js */ "./node_modules/ol/source/VectorTile.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VectorTile", function() { return _source_VectorTile_js__WEBPACK_IMPORTED_MODULE_23__["default"]; });

/* harmony import */ var _source_WMTS_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./source/WMTS.js */ "./node_modules/ol/source/WMTS.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WMTS", function() { return _source_WMTS_js__WEBPACK_IMPORTED_MODULE_24__["default"]; });

/* harmony import */ var _source_XYZ_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./source/XYZ.js */ "./node_modules/ol/source/XYZ.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "XYZ", function() { return _source_XYZ_js__WEBPACK_IMPORTED_MODULE_25__["default"]; });

/* harmony import */ var _source_Zoomify_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./source/Zoomify.js */ "./node_modules/ol/source/Zoomify.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Zoomify", function() { return _source_Zoomify_js__WEBPACK_IMPORTED_MODULE_26__["default"]; });

/**
 * @module ol/source
 */



























//# sourceMappingURL=source.js.map

/***/ }),

/***/ "./node_modules/ol/source/BingMaps.js":
/*!********************************************!*\
  !*** ./node_modules/ol/source/BingMaps.js ***!
  \********************************************/
/*! exports provided: quadKey, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quadKey", function() { return quadKey; });
/* harmony import */ var _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../tileurlfunction.js */ "./node_modules/ol/tileurlfunction.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _net_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../net.js */ "./node_modules/ol/net.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _State_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./State.js */ "./node_modules/ol/source/State.js");
/* harmony import */ var _TileImage_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/* harmony import */ var _tilegrid_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../tilegrid.js */ "./node_modules/ol/tilegrid.js");
/**
 * @module ol/source/BingMaps
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();








/**
 * @param {import('../tilecoord.js').TileCoord} tileCoord Tile coord.
 * @return {string} Quad key.
 */
function quadKey(tileCoord) {
    var z = tileCoord[0];
    var digits = new Array(z);
    var mask = 1 << (z - 1);
    var i, charCode;
    for (i = 0; i < z; ++i) {
        // 48 is charCode for 0 - '0'.charCodeAt(0)
        charCode = 48;
        if (tileCoord[1] & mask) {
            charCode += 1;
        }
        if (tileCoord[2] & mask) {
            charCode += 2;
        }
        digits[i] = String.fromCharCode(charCode);
        mask >>= 1;
    }
    return digits.join('');
}
/**
 * The attribution containing a link to the Microsoft® Bing™ Maps Platform APIs’
 * Terms Of Use.
 * @const
 * @type {string}
 */
var TOS_ATTRIBUTION = '<a class="ol-attribution-bing-tos" ' +
    'href="https://www.microsoft.com/maps/product/terms.html" target="_blank">' +
    'Terms of Use</a>';
/**
 * @typedef {Object} Options
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {boolean} [hidpi=false] If `true` hidpi tiles will be requested.
 * @property {string} [culture='en-us'] Culture code.
 * @property {string} key Bing Maps API key. Get yours at http://www.bingmapsportal.com/.
 * @property {string} imagerySet Type of imagery.
 * @property {number} [maxZoom=21] Max zoom. Default is what's advertized by the BingMaps service.
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 * @property {number} [transition] Duration of the opacity transition for rendering.
 * To disable the opacity transition, pass `transition: 0`.
 */
/**
 * @typedef {Object} BingMapsImageryMetadataResponse
 * @property {number} statusCode The response status code
 * @property {string} statusDescription The response status description
 * @property {string} authenticationResultCode The authentication result code
 * @property {Array<ResourceSet>} resourceSets The array of resource sets
 */
/**
 * @typedef {Object} ResourceSet
 * @property {Array<Resource>} resources
 */
/**
 * @typedef {Object} Resource
 * @property {number} imageHeight The image height
 * @property {number} imageWidth The image width
 * @property {number} zoomMin The minimum zoom level
 * @property {number} zoomMax The maximum zoom level
 * @property {string} imageUrl The image URL
 * @property {Array<string>} imageUrlSubdomains The image URL subdomains for rotation
 * @property {Array<ImageryProvider>} [imageryProviders] The array of ImageryProviders
 */
/**
 * @typedef {Object} ImageryProvider
 * @property {Array<CoverageArea>} coverageAreas The coverage areas
 * @property {string} [attribution] The attribution
 */
/**
 * @typedef {Object} CoverageArea
 * @property {number} zoomMin The minimum zoom
 * @property {number} zoomMax The maximum zoom
 * @property {Array<number>} bbox The coverage bounding box
 */
/**
 * @classdesc
 * Layer source for Bing Maps tile data.
 * @api
 */
var BingMaps = /** @class */ (function (_super) {
    __extends(BingMaps, _super);
    /**
     * @param {Options} options Bing Maps options.
     */
    function BingMaps(options) {
        var _this = this;
        var hidpi = options.hidpi !== undefined ? options.hidpi : false;
        _this = _super.call(this, {
            cacheSize: options.cacheSize,
            crossOrigin: 'anonymous',
            opaque: true,
            projection: Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])('EPSG:3857'),
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            state: _State_js__WEBPACK_IMPORTED_MODULE_4__["default"].LOADING,
            tileLoadFunction: options.tileLoadFunction,
            tilePixelRatio: hidpi ? 2 : 1,
            wrapX: options.wrapX !== undefined ? options.wrapX : true,
            transition: options.transition
        }) || this;
        /**
         * @private
         * @type {boolean}
         */
        _this.hidpi_ = hidpi;
        /**
         * @private
         * @type {string}
         */
        _this.culture_ = options.culture !== undefined ? options.culture : 'en-us';
        /**
         * @private
         * @type {number}
         */
        _this.maxZoom_ = options.maxZoom !== undefined ? options.maxZoom : -1;
        /**
         * @private
         * @type {string}
         */
        _this.apiKey_ = options.key;
        /**
         * @private
         * @type {string}
         */
        _this.imagerySet_ = options.imagerySet;
        var url = 'https://dev.virtualearth.net/REST/v1/Imagery/Metadata/' +
            _this.imagerySet_ +
            '?uriScheme=https&include=ImageryProviders&key=' + _this.apiKey_ +
            '&c=' + _this.culture_;
        Object(_net_js__WEBPACK_IMPORTED_MODULE_2__["jsonp"])(url, _this.handleImageryMetadataResponse.bind(_this), undefined, 'jsonp');
        return _this;
    }
    /**
     * Get the api key used for this source.
     *
     * @return {string} The api key.
     * @api
     */
    BingMaps.prototype.getApiKey = function () {
        return this.apiKey_;
    };
    /**
     * Get the imagery set associated with this source.
     *
     * @return {string} The imagery set.
     * @api
     */
    BingMaps.prototype.getImagerySet = function () {
        return this.imagerySet_;
    };
    /**
     * @param {BingMapsImageryMetadataResponse} response Response.
     */
    BingMaps.prototype.handleImageryMetadataResponse = function (response) {
        if (response.statusCode != 200 ||
            response.statusDescription != 'OK' ||
            response.authenticationResultCode != 'ValidCredentials' ||
            response.resourceSets.length != 1 ||
            response.resourceSets[0].resources.length != 1) {
            this.setState(_State_js__WEBPACK_IMPORTED_MODULE_4__["default"].ERROR);
            return;
        }
        var resource = response.resourceSets[0].resources[0];
        var maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_;
        var sourceProjection = this.getProjection();
        var extent = Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_7__["extentFromProjection"])(sourceProjection);
        var scale = this.hidpi_ ? 2 : 1;
        var tileSize = resource.imageWidth == resource.imageHeight ?
            resource.imageWidth / scale :
            [resource.imageWidth / scale, resource.imageHeight / scale];
        var tileGrid = Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_7__["createXYZ"])({
            extent: extent,
            minZoom: resource.zoomMin,
            maxZoom: maxZoom,
            tileSize: tileSize
        });
        this.tileGrid = tileGrid;
        var culture = this.culture_;
        var hidpi = this.hidpi_;
        this.tileUrlFunction = Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__["createFromTileUrlFunctions"])(resource.imageUrlSubdomains.map(function (subdomain) {
            /** @type {import('../tilecoord.js').TileCoord} */
            var quadKeyTileCoord = [0, 0, 0];
            var imageUrl = resource.imageUrl
                .replace('{subdomain}', subdomain)
                .replace('{culture}', culture);
            return (
            /**
             * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
             * @param {number} pixelRatio Pixel ratio.
             * @param {import("../proj/Projection.js").default} projection Projection.
             * @return {string|undefined} Tile URL.
             */
            function (tileCoord, pixelRatio, projection) {
                if (!tileCoord) {
                    return undefined;
                }
                else {
                    Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_6__["createOrUpdate"])(tileCoord[0], tileCoord[1], tileCoord[2], quadKeyTileCoord);
                    var url = imageUrl;
                    if (hidpi) {
                        url += '&dpi=d1&device=mobile';
                    }
                    return url.replace('{quadkey}', quadKey(quadKeyTileCoord));
                }
            });
        }));
        if (resource.imageryProviders) {
            var transform_1 = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["getTransformFromProjections"])(Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])('EPSG:4326'), this.getProjection());
            this.setAttributions(function (frameState) {
                var attributions = [];
                var viewState = frameState.viewState;
                var tileGrid = this.getTileGrid();
                var z = tileGrid.getZForResolution(viewState.resolution, this.zDirection);
                var tileCoord = tileGrid.getTileCoordForCoordAndZ(viewState.center, z);
                var zoom = tileCoord[0];
                resource.imageryProviders.map(function (imageryProvider) {
                    var intersecting = false;
                    var coverageAreas = imageryProvider.coverageAreas;
                    for (var i = 0, ii = coverageAreas.length; i < ii; ++i) {
                        var coverageArea = coverageAreas[i];
                        if (zoom >= coverageArea.zoomMin && zoom <= coverageArea.zoomMax) {
                            var bbox = coverageArea.bbox;
                            var epsg4326Extent = [bbox[1], bbox[0], bbox[3], bbox[2]];
                            var extent_1 = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["applyTransform"])(epsg4326Extent, transform_1);
                            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["intersects"])(extent_1, frameState.extent)) {
                                intersecting = true;
                                break;
                            }
                        }
                    }
                    if (intersecting) {
                        attributions.push(imageryProvider.attribution);
                    }
                });
                attributions.push(TOS_ATTRIBUTION);
                return attributions;
            }.bind(this));
        }
        this.setState(_State_js__WEBPACK_IMPORTED_MODULE_4__["default"].READY);
    };
    return BingMaps;
}(_TileImage_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (BingMaps);
//# sourceMappingURL=BingMaps.js.map

/***/ }),

/***/ "./node_modules/ol/source/CartoDB.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/source/CartoDB.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _State_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./State.js */ "./node_modules/ol/source/State.js");
/* harmony import */ var _XYZ_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./XYZ.js */ "./node_modules/ol/source/XYZ.js");
/**
 * @module ol/source/CartoDB
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();



/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection.
 * @property {number} [maxZoom=18] Max zoom.
 * @property {number} [minZoom] Minimum zoom.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 * @property {Object} [config] If using anonymous maps, the CartoDB config to use. See
 * http://docs.cartodb.com/cartodb-platform/maps-api/anonymous-maps/
 * for more detail.
 * If using named maps, a key-value lookup with the template parameters.
 * See http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/
 * for more detail.
 * @property {string} [map] If using named maps, this will be the name of the template to load.
 * See http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/
 * for more detail.
 * @property {string} account If using named maps, this will be the name of the template to load.
 */
/**
 * @typedef {Object} CartoDBLayerInfo
 * @property {string} layergroupid The layer group ID
 * @property {{https: string}} cdn_url The CDN URL
 */
/**
 * @classdesc
 * Layer source for the CartoDB Maps API.
 * @api
 */
var CartoDB = /** @class */ (function (_super) {
    __extends(CartoDB, _super);
    /**
     * @param {Options} options CartoDB options.
     */
    function CartoDB(options) {
        var _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            crossOrigin: options.crossOrigin,
            maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18,
            minZoom: options.minZoom,
            projection: options.projection,
            wrapX: options.wrapX
        }) || this;
        /**
         * @type {string}
         * @private
         */
        _this.account_ = options.account;
        /**
         * @type {string}
         * @private
         */
        _this.mapId_ = options.map || '';
        /**
         * @type {!Object}
         * @private
         */
        _this.config_ = options.config || {};
        /**
         * @type {!Object<string, CartoDBLayerInfo>}
         * @private
         */
        _this.templateCache_ = {};
        _this.initializeMap_();
        return _this;
    }
    /**
     * Returns the current config.
     * @return {!Object} The current configuration.
     * @api
     */
    CartoDB.prototype.getConfig = function () {
        return this.config_;
    };
    /**
     * Updates the carto db config.
     * @param {Object} config a key-value lookup. Values will replace current values
     *     in the config.
     * @api
     */
    CartoDB.prototype.updateConfig = function (config) {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_0__["assign"])(this.config_, config);
        this.initializeMap_();
    };
    /**
     * Sets the CartoDB config
     * @param {Object} config In the case of anonymous maps, a CartoDB configuration
     *     object.
     * If using named maps, a key-value lookup with the template parameters.
     * @api
     */
    CartoDB.prototype.setConfig = function (config) {
        this.config_ = config || {};
        this.initializeMap_();
    };
    /**
     * Issue a request to initialize the CartoDB map.
     * @private
     */
    CartoDB.prototype.initializeMap_ = function () {
        var paramHash = JSON.stringify(this.config_);
        if (this.templateCache_[paramHash]) {
            this.applyTemplate_(this.templateCache_[paramHash]);
            return;
        }
        var mapUrl = 'https://' + this.account_ + '.carto.com/api/v1/map';
        if (this.mapId_) {
            mapUrl += '/named/' + this.mapId_;
        }
        var client = new XMLHttpRequest();
        client.addEventListener('load', this.handleInitResponse_.bind(this, paramHash));
        client.addEventListener('error', this.handleInitError_.bind(this));
        client.open('POST', mapUrl);
        client.setRequestHeader('Content-type', 'application/json');
        client.send(JSON.stringify(this.config_));
    };
    /**
     * Handle map initialization response.
     * @param {string} paramHash a hash representing the parameter set that was used
     *     for the request
     * @param {Event} event Event.
     * @private
     */
    CartoDB.prototype.handleInitResponse_ = function (paramHash, event) {
        var client = /** @type {XMLHttpRequest} */ (event.target);
        // status will be 0 for file:// urls
        if (!client.status || client.status >= 200 && client.status < 300) {
            var response = void 0;
            try {
                response = /** @type {CartoDBLayerInfo} */ (JSON.parse(client.responseText));
            }
            catch (err) {
                this.setState(_State_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR);
                return;
            }
            this.applyTemplate_(response);
            this.templateCache_[paramHash] = response;
            this.setState(_State_js__WEBPACK_IMPORTED_MODULE_1__["default"].READY);
        }
        else {
            this.setState(_State_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR);
        }
    };
    /**
     * @private
     * @param {Event} event Event.
     */
    CartoDB.prototype.handleInitError_ = function (event) {
        this.setState(_State_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR);
    };
    /**
     * Apply the new tile urls returned by carto db
     * @param {CartoDBLayerInfo} data Result of carto db call.
     * @private
     */
    CartoDB.prototype.applyTemplate_ = function (data) {
        var tilesUrl = 'https://' + data.cdn_url.https + '/' + this.account_ +
            '/api/v1/map/' + data.layergroupid + '/{z}/{x}/{y}.png';
        this.setUrl(tilesUrl);
    };
    return CartoDB;
}(_XYZ_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CartoDB);
//# sourceMappingURL=CartoDB.js.map

/***/ }),

/***/ "./node_modules/ol/source/Cluster.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/source/Cluster.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _coordinate_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _geom_Point_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../geom/Point.js */ "./node_modules/ol/geom/Point.js");
/* harmony import */ var _Vector_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Vector.js */ "./node_modules/ol/source/Vector.js");
/**
 * @module ol/source/Cluster
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();









/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {number} [distance=20] Minimum distance in pixels between clusters.
 * @property {function(Feature):Point} [geometryFunction]
 * Function that takes an {@link module:ol/Feature} as argument and returns an
 * {@link module:ol/geom/Point} as cluster calculation point for the feature. When a
 * feature should not be considered for clustering, the function should return
 * `null`. The default, which works when the underyling source contains point
 * features only, is
 * ```js
 * function(feature) {
 *   return feature.getGeometry();
 * }
 * ```
 * See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster
 * calculation point for polygons.
 * @property {VectorSource} [source] Source.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 */
/**
 * @classdesc
 * Layer source to cluster vector data. Works out of the box with point
 * geometries. For other geometry types, or if not all geometries should be
 * considered for clustering, a custom `geometryFunction` can be defined.
 *
 * If the instance is disposed without also disposing the underlying
 * source `setSource(null)` has to be called to remove the listener reference
 * from the wrapped source.
 * @api
 */
var Cluster = /** @class */ (function (_super) {
    __extends(Cluster, _super);
    /**
     * @param {Options} options Cluster options.
     */
    function Cluster(options) {
        var _this = _super.call(this, {
            attributions: options.attributions,
            wrapX: options.wrapX
        }) || this;
        /**
         * @type {number|undefined}
         * @protected
         */
        _this.resolution = undefined;
        /**
         * @type {number}
         * @protected
         */
        _this.distance = options.distance !== undefined ? options.distance : 20;
        /**
         * @type {Array<Feature>}
         * @protected
         */
        _this.features = [];
        /**
         * @param {Feature} feature Feature.
         * @return {Point} Cluster calculation point.
         * @protected
         */
        _this.geometryFunction = options.geometryFunction || function (feature) {
            var geometry = feature.getGeometry();
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(geometry.getType() == _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_3__["default"].POINT, 10); // The default `geometryFunction` can only handle `Point` geometries
            return geometry;
        };
        _this.boundRefresh_ = _this.refresh.bind(_this);
        _this.setSource(options.source || null);
        return _this;
    }
    /**
     * @override
     */
    Cluster.prototype.clear = function (opt_fast) {
        this.features.length = 0;
        _super.prototype.clear.call(this, opt_fast);
    };
    /**
     * Get the distance in pixels between clusters.
     * @return {number} Distance.
     * @api
     */
    Cluster.prototype.getDistance = function () {
        return this.distance;
    };
    /**
     * Get a reference to the wrapped source.
     * @return {VectorSource} Source.
     * @api
     */
    Cluster.prototype.getSource = function () {
        return this.source;
    };
    /**
     * @inheritDoc
     */
    Cluster.prototype.loadFeatures = function (extent, resolution, projection) {
        this.source.loadFeatures(extent, resolution, projection);
        if (resolution !== this.resolution) {
            this.clear();
            this.resolution = resolution;
            this.cluster();
            this.addFeatures(this.features);
        }
    };
    /**
     * Set the distance in pixels between clusters.
     * @param {number} distance The distance in pixels.
     * @api
     */
    Cluster.prototype.setDistance = function (distance) {
        this.distance = distance;
        this.refresh();
    };
    /**
     * Replace the wrapped source.
     * @param {VectorSource} source The new source for this instance.
     * @api
     */
    Cluster.prototype.setSource = function (source) {
        if (this.source) {
            this.source.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].CHANGE, this.boundRefresh_);
        }
        this.source = source;
        if (source) {
            source.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].CHANGE, this.boundRefresh_);
        }
        this.refresh();
    };
    /**
     * Handle the source changing.
     * @override
     */
    Cluster.prototype.refresh = function () {
        this.clear();
        this.cluster();
        this.addFeatures(this.features);
    };
    /**
     * @protected
     */
    Cluster.prototype.cluster = function () {
        if (this.resolution === undefined || !this.source) {
            return;
        }
        var extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["createEmpty"])();
        var mapDistance = this.distance * this.resolution;
        var features = this.source.getFeatures();
        /**
         * @type {!Object<string, boolean>}
         */
        var clustered = {};
        for (var i = 0, ii = features.length; i < ii; i++) {
            var feature = features[i];
            if (!(Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature) in clustered)) {
                var geometry = this.geometryFunction(feature);
                if (geometry) {
                    var coordinates = geometry.getCoordinates();
                    Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["createOrUpdateFromCoordinate"])(coordinates, extent);
                    Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["buffer"])(extent, mapDistance, extent);
                    var neighbors = this.source.getFeaturesInExtent(extent);
                    neighbors = neighbors.filter(function (neighbor) {
                        var uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(neighbor);
                        if (!(uid in clustered)) {
                            clustered[uid] = true;
                            return true;
                        }
                        else {
                            return false;
                        }
                    });
                    this.features.push(this.createCluster(neighbors));
                }
            }
        }
    };
    /**
     * @param {Array<Feature>} features Features
     * @return {Feature} The cluster feature.
     * @protected
     */
    Cluster.prototype.createCluster = function (features) {
        var centroid = [0, 0];
        for (var i = features.length - 1; i >= 0; --i) {
            var geometry = this.geometryFunction(features[i]);
            if (geometry) {
                Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_4__["add"])(centroid, geometry.getCoordinates());
            }
            else {
                features.splice(i, 1);
            }
        }
        Object(_coordinate_js__WEBPACK_IMPORTED_MODULE_4__["scale"])(centroid, 1 / features.length);
        var cluster = new _Feature_js__WEBPACK_IMPORTED_MODULE_2__["default"](new _geom_Point_js__WEBPACK_IMPORTED_MODULE_7__["default"](centroid));
        cluster.set('features', features);
        return cluster;
    };
    return Cluster;
}(_Vector_js__WEBPACK_IMPORTED_MODULE_8__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Cluster);
//# sourceMappingURL=Cluster.js.map

/***/ }),

/***/ "./node_modules/ol/source/IIIF.js":
/*!****************************************!*\
  !*** ./node_modules/ol/source/IIIF.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../tilegrid/common.js */ "./node_modules/ol/tilegrid/common.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Zoomify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Zoomify.js */ "./node_modules/ol/source/Zoomify.js");
/* harmony import */ var _format_IIIFInfo_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../format/IIIFInfo.js */ "./node_modules/ol/format/IIIFInfo.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tilegrid/TileGrid.js */ "./node_modules/ol/tilegrid/TileGrid.js");
/* harmony import */ var _TileImage_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../size.js */ "./node_modules/ol/size.js");
/**
 * @module ol/source/IIIF
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();








/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
 * @property {number} [cacheSize]
 * @property {null|string} [crossOrigin]
 * @property {import("../extent.js").Extent} [extent=[0, -height, width, 0]]
 * @property {string} [format='jpg'] Requested image format.
 * @property {import("../proj.js").ProjectionLike} [projection]
 * @property {string} [quality] Requested IIIF image quality. Default is 'native'
 * for version 1, 'default' for versions 2 and 3.
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {Array<number>} [resolutions] Supported resolutions as given in IIIF 'scaleFactors'
 * @property {import("../size.js").Size} size Size of the image [width, height].
 * @property {Array<import("../size.js").Size>} [sizes] Supported scaled image sizes.
 * Content of the IIIF info.json 'sizes' property, but as array of Size objects.
 * @property {import("./State.js").default} [state] Source state.
 * @property {Array<string>} [supports=[]] Supported IIIF region and size calculation
 * features.
 * @property {number} [tilePixelRatio]
 * @property {number|import("../size.js").Size} [tileSize] Tile size.
 * Same tile size is used for all zoom levels. If tile size is a number,
 * a square tile is assumed. If the IIIF image service supports arbitrary
 * tiling (sizeByH, sizeByW, sizeByWh or sizeByPct as well as regionByPx or regionByPct
 * are supported), the default tilesize is 256.
 * @property {number} [transition]
 * @property {string} [url] Base URL of the IIIF Image service.
 * This should be the same as the IIIF Image ID.
 * @property {Versions} [version=Versions.VERSION2] Service's IIIF Image API version.
 * @property {number} [zDirection=0] Indicate which resolution should be used
 * by a renderer if the view resolution does not match any resolution of the tile source.
 * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
 * will be used. If -1, the nearest higher resolution will be used.
 */
function formatPercentage(percentage) {
    return percentage.toLocaleString('en', { maximumFractionDigits: 10 });
}
/**
 * @classdesc
 * Layer source for IIIF Image API services.
 * @api
 */
var IIIF = /** @class */ (function (_super) {
    __extends(IIIF, _super);
    /**
     * @param {Options=} opt_options Tile source options. Use {@link import("../format/IIIFInfo.js").IIIFInfo}
     * to parse Image API service information responses into constructor options.
     * @api
     */
    function IIIF(opt_options) {
        var _this = this;
        /**
         * @type {Partial<Options>}
         */
        var options = opt_options || {};
        var baseUrl = options.url || '';
        baseUrl = baseUrl + (baseUrl.lastIndexOf('/') === baseUrl.length - 1 || baseUrl === '' ? '' : '/');
        var version = options.version || _format_IIIFInfo_js__WEBPACK_IMPORTED_MODULE_3__["Versions"].VERSION2;
        var sizes = options.sizes || [];
        var size = options.size;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_4__["assert"])(size != undefined && Array.isArray(size) && size.length == 2 &&
            !isNaN(size[0]) && size[0] > 0 && !isNaN(size[1]) && size[1] > 0, 60);
        var width = size[0];
        var height = size[1];
        var tileSize = options.tileSize;
        var tilePixelRatio = options.tilePixelRatio || 1;
        var format = options.format || 'jpg';
        var quality = options.quality || (options.version == _format_IIIFInfo_js__WEBPACK_IMPORTED_MODULE_3__["Versions"].VERSION1 ? 'native' : 'default');
        var resolutions = options.resolutions || [];
        var supports = options.supports || [];
        var extent = options.extent || [0, -height, width, 0];
        var supportsListedSizes = sizes != undefined && Array.isArray(sizes) && sizes.length > 0;
        var supportsListedTiles = tileSize !== undefined && (typeof tileSize === 'number' && Number.isInteger(tileSize) && tileSize > 0 || Array.isArray(tileSize) && tileSize.length > 0);
        var supportsArbitraryTiling = supports != undefined && Array.isArray(supports) &&
            (supports.includes('regionByPx') || supports.includes('regionByPct')) &&
            (supports.includes('sizeByWh') || supports.includes('sizeByH') ||
                supports.includes('sizeByW') || supports.includes('sizeByPct'));
        var tileWidth, tileHeight, maxZoom;
        resolutions.sort(function (a, b) {
            return b - a;
        });
        if (supportsListedTiles || supportsArbitraryTiling) {
            if (tileSize != undefined) {
                if (typeof tileSize === 'number' && Number.isInteger(tileSize) && tileSize > 0) {
                    tileWidth = tileSize;
                    tileHeight = tileSize;
                }
                else if (Array.isArray(tileSize) && tileSize.length > 0) {
                    if (tileSize.length == 1 || tileSize[1] == undefined && Number.isInteger(tileSize[0])) {
                        tileWidth = tileSize[0];
                        tileHeight = tileSize[0];
                    }
                    if (tileSize.length == 2) {
                        if (Number.isInteger(tileSize[0]) && Number.isInteger(tileSize[1])) {
                            tileWidth = tileSize[0];
                            tileHeight = tileSize[1];
                        }
                        else if (tileSize[0] == undefined && Number.isInteger(tileSize[1])) {
                            tileWidth = tileSize[1];
                            tileHeight = tileSize[1];
                        }
                    }
                }
            }
            if (tileWidth === undefined || tileHeight === undefined) {
                tileWidth = _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_TILE_SIZE"];
                tileHeight = _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_TILE_SIZE"];
            }
            if (resolutions.length == 0) {
                maxZoom = Math.max(Math.ceil(Math.log(width / tileWidth) / Math.LN2), Math.ceil(Math.log(height / tileHeight) / Math.LN2));
                for (var i = maxZoom; i >= 0; i--) {
                    resolutions.push(Math.pow(2, i));
                }
            }
            else {
                var maxScaleFactor = Math.max.apply(Math, resolutions);
                // TODO maxScaleFactor might not be a power to 2
                maxZoom = Math.round(Math.log(maxScaleFactor) / Math.LN2);
            }
        }
        else {
            // No tile support.
            tileWidth = width;
            tileHeight = height;
            resolutions = [];
            if (supportsListedSizes) {
                /*
                 * 'sizes' provided. Use full region in different resolutions. Every
                 * resolution has only one tile.
                 */
                sizes.sort(function (a, b) {
                    return a[0] - b[0];
                });
                maxZoom = -1;
                var ignoredSizesIndex = [];
                for (var i = 0; i < sizes.length; i++) {
                    var resolution = width / sizes[i][0];
                    if (resolutions.length > 0 && resolutions[resolutions.length - 1] == resolution) {
                        ignoredSizesIndex.push(i);
                        continue;
                    }
                    resolutions.push(resolution);
                    maxZoom++;
                }
                if (ignoredSizesIndex.length > 0) {
                    for (var i = 0; i < ignoredSizesIndex.length; i++) {
                        sizes.splice(ignoredSizesIndex[i] - i, 1);
                    }
                }
            }
            else {
                // No useful image information at all. Try pseudo tile with full image.
                resolutions.push(1);
                sizes.push([width, height]);
                maxZoom = 0;
            }
        }
        var tileGrid = new _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_5__["default"]({
            tileSize: [tileWidth, tileHeight],
            extent: extent,
            origin: Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getTopLeft"])(extent),
            resolutions: resolutions
        });
        var tileUrlFunction = function (tileCoord, pixelRatio, projection) {
            var regionParam, sizeParam;
            var zoom = tileCoord[0];
            if (zoom > maxZoom) {
                return;
            }
            var tileX = tileCoord[1], tileY = tileCoord[2], scale = resolutions[zoom];
            if (tileX === undefined || tileY === undefined || scale === undefined ||
                tileX < 0 || Math.ceil(width / scale / tileWidth) <= tileX ||
                tileY < 0 || Math.ceil(height / scale / tileHeight) <= tileY) {
                return;
            }
            if (supportsArbitraryTiling || supportsListedTiles) {
                var regionX = tileX * tileWidth * scale, regionY = tileY * tileHeight * scale;
                var regionW = tileWidth * scale, regionH = tileHeight * scale, sizeW = tileWidth, sizeH = tileHeight;
                if (regionX + regionW > width) {
                    regionW = width - regionX;
                }
                if (regionY + regionH > height) {
                    regionH = height - regionY;
                }
                if (regionX + tileWidth * scale > width) {
                    sizeW = Math.floor((width - regionX + scale - 1) / scale);
                }
                if (regionY + tileHeight * scale > height) {
                    sizeH = Math.floor((height - regionY + scale - 1) / scale);
                }
                if (regionX == 0 && regionW == width && regionY == 0 && regionH == height) {
                    // canonical full image region parameter is 'full', not 'x,y,w,h'
                    regionParam = 'full';
                }
                else if (!supportsArbitraryTiling || supports.includes('regionByPx')) {
                    regionParam = regionX + ',' + regionY + ',' + regionW + ',' + regionH;
                }
                else if (supports.includes('regionByPct')) {
                    var pctX = formatPercentage(regionX / width * 100), pctY = formatPercentage(regionY / height * 100), pctW = formatPercentage(regionW / width * 100), pctH = formatPercentage(regionH / height * 100);
                    regionParam = 'pct:' + pctX + ',' + pctY + ',' + pctW + ',' + pctH;
                }
                if (version == _format_IIIFInfo_js__WEBPACK_IMPORTED_MODULE_3__["Versions"].VERSION3 && (!supportsArbitraryTiling || supports.includes('sizeByWh'))) {
                    sizeParam = sizeW + ',' + sizeH;
                }
                else if (!supportsArbitraryTiling || supports.includes('sizeByW')) {
                    sizeParam = sizeW + ',';
                }
                else if (supports.includes('sizeByH')) {
                    sizeParam = ',' + sizeH;
                }
                else if (supports.includes('sizeByWh')) {
                    sizeParam = sizeW + ',' + sizeH;
                }
                else if (supports.includes('sizeByPct')) {
                    sizeParam = 'pct:' + formatPercentage(100 / scale);
                }
            }
            else {
                regionParam = 'full';
                if (supportsListedSizes) {
                    var regionWidth = sizes[zoom][0], regionHeight = sizes[zoom][1];
                    if (version == _format_IIIFInfo_js__WEBPACK_IMPORTED_MODULE_3__["Versions"].VERSION3) {
                        if (regionWidth == width && regionHeight == height) {
                            sizeParam = 'max';
                        }
                        else {
                            sizeParam = regionWidth + ',' + regionHeight;
                        }
                    }
                    else {
                        if (regionWidth == width) {
                            sizeParam = 'full';
                        }
                        else {
                            sizeParam = regionWidth + ',';
                        }
                    }
                }
                else {
                    sizeParam = version == _format_IIIFInfo_js__WEBPACK_IMPORTED_MODULE_3__["Versions"].VERSION3 ? 'max' : 'full';
                }
            }
            return baseUrl + regionParam + '/' + sizeParam + '/0/' + quality + '.' + format;
        };
        var IiifTileClass = _Zoomify_js__WEBPACK_IMPORTED_MODULE_2__["CustomTile"].bind(null, Object(_size_js__WEBPACK_IMPORTED_MODULE_7__["toSize"])(tileSize || 256).map(function (size) {
            return size * tilePixelRatio;
        }));
        _this = _super.call(this, {
            attributions: options.attributions,
            attributionsCollapsible: options.attributionsCollapsible,
            cacheSize: options.cacheSize,
            crossOrigin: options.crossOrigin,
            projection: options.projection,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            state: options.state,
            tileClass: IiifTileClass,
            tileGrid: tileGrid,
            tilePixelRatio: options.tilePixelRatio,
            tileUrlFunction: tileUrlFunction,
            transition: options.transition
        }) || this;
        /**
         * @inheritDoc
         */
        _this.zDirection = options.zDirection;
        return _this;
    }
    return IIIF;
}(_TileImage_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (IIIF);
//# sourceMappingURL=IIIF.js.map

/***/ }),

/***/ "./node_modules/ol/source/Image.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/source/Image.js ***!
  \*****************************************/
/*! exports provided: ImageSourceEventType, ImageSourceEvent, defaultImageLoadFunction, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageSourceEventType", function() { return ImageSourceEventType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageSourceEvent", function() { return ImageSourceEvent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultImageLoadFunction", function() { return defaultImageLoadFunction; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _reproj_common_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../reproj/common.js */ "./node_modules/ol/reproj/common.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _reproj_Image_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../reproj/Image.js */ "./node_modules/ol/reproj/Image.js");
/* harmony import */ var _Source_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Source.js */ "./node_modules/ol/source/Source.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/source/Image
 */









/**
 * @enum {string}
 */
var ImageSourceEventType = {
    /**
     * Triggered when an image starts loading.
     * @event module:ol/source/Image.ImageSourceEvent#imageloadstart
     * @api
     */
    IMAGELOADSTART: 'imageloadstart',
    /**
     * Triggered when an image finishes loading.
     * @event module:ol/source/Image.ImageSourceEvent#imageloadend
     * @api
     */
    IMAGELOADEND: 'imageloadend',
    /**
     * Triggered if image loading results in an error.
     * @event module:ol/source/Image.ImageSourceEvent#imageloaderror
     * @api
     */
    IMAGELOADERROR: 'imageloaderror'
};
/**
 * @classdesc
 * Events emitted by {@link module:ol/source/Image~ImageSource} instances are instances of this
 * type.
 */
var ImageSourceEvent = /** @class */ (function (_super) {
    __extends(ImageSourceEvent, _super);
    /**
     * @param {string} type Type.
     * @param {import("../Image.js").default} image The image.
     */
    function ImageSourceEvent(type, image) {
        var _this = _super.call(this, type) || this;
        /**
         * The image related to the event.
         * @type {import("../Image.js").default}
         * @api
         */
        _this.image = image;
        return _this;
    }
    return ImageSourceEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_4__["default"]));

/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions]
 * @property {import("../proj.js").ProjectionLike} [projection]
 * @property {Array<number>} [resolutions]
 * @property {import("./State.js").default} [state]
 */
/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Base class for sources providing a single image.
 * @abstract
 * @fires module:ol/source/Image.ImageSourceEvent
 * @api
 */
var ImageSource = /** @class */ (function (_super) {
    __extends(ImageSource, _super);
    /**
     * @param {Options} options Single image source options.
     */
    function ImageSource(options) {
        var _this = _super.call(this, {
            attributions: options.attributions,
            projection: options.projection,
            state: options.state
        }) || this;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.resolutions_ = options.resolutions !== undefined ?
            options.resolutions : null;
        /**
         * @private
         * @type {import("../reproj/Image.js").default}
         */
        _this.reprojectedImage_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.reprojectedRevision_ = 0;
        return _this;
    }
    /**
     * @return {Array<number>} Resolutions.
     * @override
     */
    ImageSource.prototype.getResolutions = function () {
        return this.resolutions_;
    };
    /**
     * @protected
     * @param {number} resolution Resolution.
     * @return {number} Resolution.
     */
    ImageSource.prototype.findNearestResolution = function (resolution) {
        if (this.resolutions_) {
            var idx = Object(_array_js__WEBPACK_IMPORTED_MODULE_3__["linearFindNearest"])(this.resolutions_, resolution, 0);
            resolution = this.resolutions_[idx];
        }
        return resolution;
    };
    /**
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {import("../ImageBase.js").default} Single image.
     */
    ImageSource.prototype.getImage = function (extent, resolution, pixelRatio, projection) {
        var sourceProjection = this.getProjection();
        if (!_reproj_common_js__WEBPACK_IMPORTED_MODULE_1__["ENABLE_RASTER_REPROJECTION"] ||
            !sourceProjection ||
            !projection ||
            Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["equivalent"])(sourceProjection, projection)) {
            if (sourceProjection) {
                projection = sourceProjection;
            }
            return this.getImageInternal(extent, resolution, pixelRatio, projection);
        }
        else {
            if (this.reprojectedImage_) {
                if (this.reprojectedRevision_ == this.getRevision() &&
                    Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["equivalent"])(this.reprojectedImage_.getProjection(), projection) &&
                    this.reprojectedImage_.getResolution() == resolution &&
                    Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__["equals"])(this.reprojectedImage_.getExtent(), extent)) {
                    return this.reprojectedImage_;
                }
                this.reprojectedImage_.dispose();
                this.reprojectedImage_ = null;
            }
            this.reprojectedImage_ = new _reproj_Image_js__WEBPACK_IMPORTED_MODULE_7__["default"](sourceProjection, projection, extent, resolution, pixelRatio, function (extent, resolution, pixelRatio) {
                return this.getImageInternal(extent, resolution, pixelRatio, sourceProjection);
            }.bind(this));
            this.reprojectedRevision_ = this.getRevision();
            return this.reprojectedImage_;
        }
    };
    /**
     * @abstract
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} resolution Resolution.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {import("../ImageBase.js").default} Single image.
     * @protected
     */
    ImageSource.prototype.getImageInternal = function (extent, resolution, pixelRatio, projection) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Handle image change events.
     * @param {import("../events/Event.js").default} event Event.
     * @protected
     */
    ImageSource.prototype.handleImageChange = function (event) {
        var image = /** @type {import("../Image.js").default} */ (event.target);
        switch (image.getState()) {
            case _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADING:
                this.loading = true;
                this.dispatchEvent(new ImageSourceEvent(ImageSourceEventType.IMAGELOADSTART, image));
                break;
            case _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED:
                this.loading = false;
                this.dispatchEvent(new ImageSourceEvent(ImageSourceEventType.IMAGELOADEND, image));
                break;
            case _ImageState_js__WEBPACK_IMPORTED_MODULE_2__["default"].ERROR:
                this.loading = false;
                this.dispatchEvent(new ImageSourceEvent(ImageSourceEventType.IMAGELOADERROR, image));
                break;
            default:
            // pass
        }
    };
    return ImageSource;
}(_Source_js__WEBPACK_IMPORTED_MODULE_8__["default"]));
/**
 * Default image load function for image sources that use import("../Image.js").Image image
 * instances.
 * @param {import("../Image.js").default} image Image.
 * @param {string} src Source.
 */
function defaultImageLoadFunction(image, src) {
    /** @type {HTMLImageElement|HTMLVideoElement} */ (image.getImage()).src = src;
}
/* harmony default export */ __webpack_exports__["default"] = (ImageSource);
//# sourceMappingURL=Image.js.map

/***/ }),

/***/ "./node_modules/ol/source/ImageArcGISRest.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/source/ImageArcGISRest.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Image.js */ "./node_modules/ol/Image.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/source/Image.js");
/* harmony import */ var _uri_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../uri.js */ "./node_modules/ol/uri.js");
/**
 * @module ol/source/ImageArcGISRest
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();







/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting the image from
 * the remote server.
 * @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given
 * a URL.
 * @property {Object<string,*>} [params] ArcGIS Rest parameters. This field is optional. Service
 * defaults will be used for any fields not specified. `FORMAT` is `PNG32` by default. `F` is
 * `IMAGE` by default. `TRANSPARENT` is `true` by default.  `BBOX`, `SIZE`, `BBOXSR`, and `IMAGESR`
 * will be set dynamically. Set `LAYERS` to override the default service layer visibility. See
 * {@link http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/}
 * for further reference.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport,
 * `2` means twice the size of the map viewport, and so on.
 * @property {Array<number>} [resolutions] Resolutions. If specified, requests will be made for
 * these resolutions only.
 * @property {string} [url] ArcGIS Rest service URL for a Map Service or Image Service. The url
 * should include /MapServer or /ImageServer.
 */
/**
 * @classdesc
 * Source for data from ArcGIS Rest services providing single, untiled images.
 * Useful when underlying map service has labels.
 *
 * If underlying map service is not using labels,
 * take advantage of ol image caching and use
 * {@link module:ol/source/TileArcGISRest} data source.
 *
 * @fires module:ol/source/Image.ImageSourceEvent
 * @api
 */
var ImageArcGISRest = /** @class */ (function (_super) {
    __extends(ImageArcGISRest, _super);
    /**
     * @param {Options=} opt_options Image ArcGIS Rest Options.
     */
    function ImageArcGISRest(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            attributions: options.attributions,
            projection: options.projection,
            resolutions: options.resolutions
        }) || this;
        /**
         * @private
         * @type {?string}
         */
        _this.crossOrigin_ =
            options.crossOrigin !== undefined ? options.crossOrigin : null;
        /**
         * @private
         * @type {boolean}
         */
        _this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;
        /**
         * @private
         * @type {string|undefined}
         */
        _this.url_ = options.url;
        /**
         * @private
         * @type {import("../Image.js").LoadFunction}
         */
        _this.imageLoadFunction_ = options.imageLoadFunction !== undefined ?
            options.imageLoadFunction : _Image_js__WEBPACK_IMPORTED_MODULE_5__["defaultImageLoadFunction"];
        /**
         * @private
         * @type {!Object}
         */
        _this.params_ = options.params || {};
        /**
         * @private
         * @type {import("../Image.js").default}
         */
        _this.image_ = null;
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        _this.imageSize_ = [0, 0];
        /**
         * @private
         * @type {number}
         */
        _this.renderedRevision_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5;
        return _this;
    }
    /**
     * Get the user-provided params, i.e. those passed to the constructor through
     * the "params" option, and possibly updated using the updateParams method.
     * @return {Object} Params.
     * @api
     */
    ImageArcGISRest.prototype.getParams = function () {
        return this.params_;
    };
    /**
     * @inheritDoc
     */
    ImageArcGISRest.prototype.getImageInternal = function (extent, resolution, pixelRatio, projection) {
        if (this.url_ === undefined) {
            return null;
        }
        resolution = this.findNearestResolution(resolution);
        pixelRatio = this.hidpi_ ? pixelRatio : 1;
        var image = this.image_;
        if (image &&
            this.renderedRevision_ == this.getRevision() &&
            image.getResolution() == resolution &&
            image.getPixelRatio() == pixelRatio &&
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_3__["containsExtent"])(image.getExtent(), extent)) {
            return image;
        }
        var params = {
            'F': 'image',
            'FORMAT': 'PNG32',
            'TRANSPARENT': true
        };
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_4__["assign"])(params, this.params_);
        extent = extent.slice();
        var centerX = (extent[0] + extent[2]) / 2;
        var centerY = (extent[1] + extent[3]) / 2;
        if (this.ratio_ != 1) {
            var halfWidth = this.ratio_ * Object(_extent_js__WEBPACK_IMPORTED_MODULE_3__["getWidth"])(extent) / 2;
            var halfHeight = this.ratio_ * Object(_extent_js__WEBPACK_IMPORTED_MODULE_3__["getHeight"])(extent) / 2;
            extent[0] = centerX - halfWidth;
            extent[1] = centerY - halfHeight;
            extent[2] = centerX + halfWidth;
            extent[3] = centerY + halfHeight;
        }
        var imageResolution = resolution / pixelRatio;
        // Compute an integer width and height.
        var width = Math.ceil(Object(_extent_js__WEBPACK_IMPORTED_MODULE_3__["getWidth"])(extent) / imageResolution);
        var height = Math.ceil(Object(_extent_js__WEBPACK_IMPORTED_MODULE_3__["getHeight"])(extent) / imageResolution);
        // Modify the extent to match the integer width and height.
        extent[0] = centerX - imageResolution * width / 2;
        extent[2] = centerX + imageResolution * width / 2;
        extent[1] = centerY - imageResolution * height / 2;
        extent[3] = centerY + imageResolution * height / 2;
        this.imageSize_[0] = width;
        this.imageSize_[1] = height;
        var url = this.getRequestUrl_(extent, this.imageSize_, pixelRatio, projection, params);
        this.image_ = new _Image_js__WEBPACK_IMPORTED_MODULE_0__["default"](extent, resolution, pixelRatio, url, this.crossOrigin_, this.imageLoadFunction_);
        this.renderedRevision_ = this.getRevision();
        this.image_.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].CHANGE, this.handleImageChange.bind(this));
        return this.image_;
    };
    /**
     * Return the image load function of the source.
     * @return {import("../Image.js").LoadFunction} The image load function.
     * @api
     */
    ImageArcGISRest.prototype.getImageLoadFunction = function () {
        return this.imageLoadFunction_;
    };
    /**
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {import("../size.js").Size} size Size.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @param {Object} params Params.
     * @return {string} Request URL.
     * @private
     */
    ImageArcGISRest.prototype.getRequestUrl_ = function (extent, size, pixelRatio, projection, params) {
        // ArcGIS Server only wants the numeric portion of the projection ID.
        var srid = projection.getCode().split(':').pop();
        params['SIZE'] = size[0] + ',' + size[1];
        params['BBOX'] = extent.join(',');
        params['BBOXSR'] = srid;
        params['IMAGESR'] = srid;
        params['DPI'] = Math.round(90 * pixelRatio);
        var url = this.url_;
        var modifiedUrl = url
            .replace(/MapServer\/?$/, 'MapServer/export')
            .replace(/ImageServer\/?$/, 'ImageServer/exportImage');
        if (modifiedUrl == url) {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(false, 50); // `options.featureTypes` should be an Array
        }
        return Object(_uri_js__WEBPACK_IMPORTED_MODULE_6__["appendParams"])(modifiedUrl, params);
    };
    /**
     * Return the URL used for this ArcGIS source.
     * @return {string|undefined} URL.
     * @api
     */
    ImageArcGISRest.prototype.getUrl = function () {
        return this.url_;
    };
    /**
     * Set the image load function of the source.
     * @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
     * @api
     */
    ImageArcGISRest.prototype.setImageLoadFunction = function (imageLoadFunction) {
        this.image_ = null;
        this.imageLoadFunction_ = imageLoadFunction;
        this.changed();
    };
    /**
     * Set the URL to use for requests.
     * @param {string|undefined} url URL.
     * @api
     */
    ImageArcGISRest.prototype.setUrl = function (url) {
        if (url != this.url_) {
            this.url_ = url;
            this.image_ = null;
            this.changed();
        }
    };
    /**
     * Update the user-provided params.
     * @param {Object} params Params.
     * @api
     */
    ImageArcGISRest.prototype.updateParams = function (params) {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_4__["assign"])(this.params_, params);
        this.image_ = null;
        this.changed();
    };
    return ImageArcGISRest;
}(_Image_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ImageArcGISRest);
//# sourceMappingURL=ImageArcGISRest.js.map

/***/ }),

/***/ "./node_modules/ol/source/ImageCanvas.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/source/ImageCanvas.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ImageCanvas_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ImageCanvas.js */ "./node_modules/ol/ImageCanvas.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/source/Image.js");
/**
 * @module ol/source/ImageCanvas
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();



/**
 * A function returning the canvas element (`{HTMLCanvasElement}`)
 * used by the source as an image. The arguments passed to the function are:
 * {@link module:ol/extent~Extent} the image extent, `{number}` the image resolution,
 * `{number}` the device pixel ratio, {@link module:ol/size~Size} the image size, and
 * {@link module:ol/proj/Projection} the image projection. The canvas returned by
 * this function is cached by the source. The this keyword inside the function
 * references the {@link module:ol/source/ImageCanvas}.
 *
 * @typedef {function(this:import("../ImageCanvas.js").default, import("../extent.js").Extent, number,
 *     number, import("../size.js").Size, import("../proj/Projection.js").default): HTMLCanvasElement} FunctionType
 */
/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {FunctionType} [canvasFunction] Canvas function.
 * The function returning the canvas element used by the source
 * as an image. The arguments passed to the function are: `{import("../extent.js").Extent}` the
 * image extent, `{number}` the image resolution, `{number}` the device pixel
 * ratio, `{import("../size.js").Size}` the image size, and `{import("../proj/Projection.js").Projection}` the image
 * projection. The canvas returned by this function is cached by the source. If
 * the value returned by the function is later changed then
 * `changed` should be called on the source for the source to
 * invalidate the current cached image. See: {@link module:ol/Observable~Observable#changed}
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {number} [ratio=1.5] Ratio. 1 means canvases are the size of the map viewport, 2 means twice the
 * width and height of the map viewport, and so on. Must be `1` or higher.
 * @property {Array<number>} [resolutions] Resolutions.
 * If specified, new canvases will be created for these resolutions
 * @property {import("./State.js").default} [state] Source state.
 */
/**
 * @classdesc
 * Base class for image sources where a canvas element is the image.
 * @api
 */
var ImageCanvasSource = /** @class */ (function (_super) {
    __extends(ImageCanvasSource, _super);
    /**
     * @param {Options=} opt_options ImageCanvas options.
     */
    function ImageCanvasSource(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            attributions: options.attributions,
            projection: options.projection,
            resolutions: options.resolutions,
            state: options.state
        }) || this;
        /**
        * @private
        * @type {FunctionType}
        */
        _this.canvasFunction_ = options.canvasFunction;
        /**
        * @private
        * @type {import("../ImageCanvas.js").default}
        */
        _this.canvas_ = null;
        /**
        * @private
        * @type {number}
        */
        _this.renderedRevision_ = 0;
        /**
        * @private
        * @type {number}
        */
        _this.ratio_ = options.ratio !== undefined ?
            options.ratio : 1.5;
        return _this;
    }
    /**
    * @inheritDoc
    */
    ImageCanvasSource.prototype.getImageInternal = function (extent, resolution, pixelRatio, projection) {
        resolution = this.findNearestResolution(resolution);
        var canvas = this.canvas_;
        if (canvas &&
            this.renderedRevision_ == this.getRevision() &&
            canvas.getResolution() == resolution &&
            canvas.getPixelRatio() == pixelRatio &&
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["containsExtent"])(canvas.getExtent(), extent)) {
            return canvas;
        }
        extent = extent.slice();
        Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["scaleFromCenter"])(extent, this.ratio_);
        var width = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getWidth"])(extent) / resolution;
        var height = Object(_extent_js__WEBPACK_IMPORTED_MODULE_1__["getHeight"])(extent) / resolution;
        var size = [width * pixelRatio, height * pixelRatio];
        var canvasElement = this.canvasFunction_.call(this, extent, resolution, pixelRatio, size, projection);
        if (canvasElement) {
            canvas = new _ImageCanvas_js__WEBPACK_IMPORTED_MODULE_0__["default"](extent, resolution, pixelRatio, canvasElement);
        }
        this.canvas_ = canvas;
        this.renderedRevision_ = this.getRevision();
        return canvas;
    };
    return ImageCanvasSource;
}(_Image_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ImageCanvasSource);
//# sourceMappingURL=ImageCanvas.js.map

/***/ }),

/***/ "./node_modules/ol/source/ImageMapGuide.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/source/ImageMapGuide.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Image.js */ "./node_modules/ol/Image.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/source/Image.js");
/* harmony import */ var _uri_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../uri.js */ "./node_modules/ol/uri.js");
/**
 * @module ol/source/ImageMapGuide
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();






/**
 * @typedef {Object} Options
 * @property {string} [url] The mapagent url.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {number} [displayDpi=96] The display resolution.
 * @property {number} [metersPerUnit=1] The meters-per-unit value.
 * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
 * the image from the remote server.
 * @property {boolean} [useOverlay] If `true`, will use `GETDYNAMICMAPOVERLAYIMAGE`.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {number} [ratio=1] Ratio. `1` means image requests are the size of the map viewport, `2` means
 * twice the width and height of the map viewport, and so on. Must be `1` or higher.
 * @property {Array<number>} [resolutions] Resolutions.
 * If specified, requests will be made for these resolutions only.
 * @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
 * @property {Object} [params] Additional parameters.
 */
/**
 * @classdesc
 * Source for images from Mapguide servers
 *
 * @fires module:ol/source/Image.ImageSourceEvent
 * @api
 */
var ImageMapGuide = /** @class */ (function (_super) {
    __extends(ImageMapGuide, _super);
    /**
     * @param {Options} options ImageMapGuide options.
     */
    function ImageMapGuide(options) {
        var _this = _super.call(this, {
            projection: options.projection,
            resolutions: options.resolutions
        }) || this;
        /**
         * @private
         * @type {?string}
         */
        _this.crossOrigin_ =
            options.crossOrigin !== undefined ? options.crossOrigin : null;
        /**
         * @private
         * @type {number}
         */
        _this.displayDpi_ = options.displayDpi !== undefined ?
            options.displayDpi : 96;
        /**
         * @private
         * @type {!Object}
         */
        _this.params_ = options.params || {};
        /**
         * @private
         * @type {string|undefined}
         */
        _this.url_ = options.url;
        /**
         * @private
         * @type {import("../Image.js").LoadFunction}
         */
        _this.imageLoadFunction_ = options.imageLoadFunction !== undefined ?
            options.imageLoadFunction : _Image_js__WEBPACK_IMPORTED_MODULE_4__["defaultImageLoadFunction"];
        /**
         * @private
         * @type {boolean}
         */
        _this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;
        /**
         * @private
         * @type {number}
         */
        _this.metersPerUnit_ = options.metersPerUnit !== undefined ?
            options.metersPerUnit : 1;
        /**
         * @private
         * @type {number}
         */
        _this.ratio_ = options.ratio !== undefined ? options.ratio : 1;
        /**
         * @private
         * @type {boolean}
         */
        _this.useOverlay_ = options.useOverlay !== undefined ?
            options.useOverlay : false;
        /**
         * @private
         * @type {import("../Image.js").default}
         */
        _this.image_ = null;
        /**
         * @private
         * @type {number}
         */
        _this.renderedRevision_ = 0;
        return _this;
    }
    /**
     * Get the user-provided params, i.e. those passed to the constructor through
     * the "params" option, and possibly updated using the updateParams method.
     * @return {Object} Params.
     * @api
     */
    ImageMapGuide.prototype.getParams = function () {
        return this.params_;
    };
    /**
     * @inheritDoc
     */
    ImageMapGuide.prototype.getImageInternal = function (extent, resolution, pixelRatio, projection) {
        resolution = this.findNearestResolution(resolution);
        pixelRatio = this.hidpi_ ? pixelRatio : 1;
        var image = this.image_;
        if (image &&
            this.renderedRevision_ == this.getRevision() &&
            image.getResolution() == resolution &&
            image.getPixelRatio() == pixelRatio &&
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsExtent"])(image.getExtent(), extent)) {
            return image;
        }
        if (this.ratio_ != 1) {
            extent = extent.slice();
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["scaleFromCenter"])(extent, this.ratio_);
        }
        var width = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(extent) / resolution;
        var height = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getHeight"])(extent) / resolution;
        var size = [width * pixelRatio, height * pixelRatio];
        if (this.url_ !== undefined) {
            var imageUrl = this.getUrl(this.url_, this.params_, extent, size, projection);
            image = new _Image_js__WEBPACK_IMPORTED_MODULE_0__["default"](extent, resolution, pixelRatio, imageUrl, this.crossOrigin_, this.imageLoadFunction_);
            image.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_1__["default"].CHANGE, this.handleImageChange.bind(this));
        }
        else {
            image = null;
        }
        this.image_ = image;
        this.renderedRevision_ = this.getRevision();
        return image;
    };
    /**
     * Return the image load function of the source.
     * @return {import("../Image.js").LoadFunction} The image load function.
     * @api
     */
    ImageMapGuide.prototype.getImageLoadFunction = function () {
        return this.imageLoadFunction_;
    };
    /**
     * Update the user-provided params.
     * @param {Object} params Params.
     * @api
     */
    ImageMapGuide.prototype.updateParams = function (params) {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])(this.params_, params);
        this.changed();
    };
    /**
     * @param {string} baseUrl The mapagent url.
     * @param {Object<string, string|number>} params Request parameters.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {import("../size.js").Size} size Size.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {string} The mapagent map image request URL.
     */
    ImageMapGuide.prototype.getUrl = function (baseUrl, params, extent, size, projection) {
        var scale = getScale(extent, size, this.metersPerUnit_, this.displayDpi_);
        var center = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getCenter"])(extent);
        var baseParams = {
            'OPERATION': this.useOverlay_ ? 'GETDYNAMICMAPOVERLAYIMAGE' : 'GETMAPIMAGE',
            'VERSION': '2.0.0',
            'LOCALE': 'en',
            'CLIENTAGENT': 'ol/source/ImageMapGuide source',
            'CLIP': '1',
            'SETDISPLAYDPI': this.displayDpi_,
            'SETDISPLAYWIDTH': Math.round(size[0]),
            'SETDISPLAYHEIGHT': Math.round(size[1]),
            'SETVIEWSCALE': scale,
            'SETVIEWCENTERX': center[0],
            'SETVIEWCENTERY': center[1]
        };
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])(baseParams, params);
        return Object(_uri_js__WEBPACK_IMPORTED_MODULE_5__["appendParams"])(baseUrl, baseParams);
    };
    /**
     * Set the image load function of the MapGuide source.
     * @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
     * @api
     */
    ImageMapGuide.prototype.setImageLoadFunction = function (imageLoadFunction) {
        this.image_ = null;
        this.imageLoadFunction_ = imageLoadFunction;
        this.changed();
    };
    return ImageMapGuide;
}(_Image_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/**
 * @param {import("../extent.js").Extent} extent The map extents.
 * @param {import("../size.js").Size} size The viewport size.
 * @param {number} metersPerUnit The meters-per-unit value.
 * @param {number} dpi The display resolution.
 * @return {number} The computed map scale.
 */
function getScale(extent, size, metersPerUnit, dpi) {
    var mcsW = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(extent);
    var mcsH = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getHeight"])(extent);
    var devW = size[0];
    var devH = size[1];
    var mpp = 0.0254 / dpi;
    if (devH * mcsW > devW * mcsH) {
        return mcsW * metersPerUnit / (devW * mpp); // width limited
    }
    else {
        return mcsH * metersPerUnit / (devH * mpp); // height limited
    }
}
/* harmony default export */ __webpack_exports__["default"] = (ImageMapGuide);
//# sourceMappingURL=ImageMapGuide.js.map

/***/ }),

/***/ "./node_modules/ol/source/ImageStatic.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/source/ImageStatic.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Image.js */ "./node_modules/ol/Image.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/source/Image.js");
/**
 * @module ol/source/ImageStatic
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();







/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {import("../extent.js").Extent} [imageExtent] Extent of the image in map coordinates.
 * This is the [left, bottom, right, top] map coordinates of your image.
 * @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {import("../size.js").Size} [imageSize] Size of the image in pixels. Usually the image size is auto-detected, so this
 * only needs to be set if auto-detection fails for some reason.
 * @property {string} url Image URL.
 */
/**
 * @classdesc
 * A layer source for displaying a single, static image.
 * @api
 */
var Static = /** @class */ (function (_super) {
    __extends(Static, _super);
    /**
     * @param {Options} options ImageStatic options.
     */
    function Static(options) {
        var _this = this;
        var crossOrigin = options.crossOrigin !== undefined ?
            options.crossOrigin : null;
        var /** @type {import("../Image.js").LoadFunction} */ imageLoadFunction = options.imageLoadFunction !== undefined ?
            options.imageLoadFunction : _Image_js__WEBPACK_IMPORTED_MODULE_6__["defaultImageLoadFunction"];
        _this = _super.call(this, {
            attributions: options.attributions,
            projection: Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])(options.projection)
        }) || this;
        /**
         * @private
         * @type {string}
         */
        _this.url_ = options.url;
        /**
         * @private
         * @type {import("../extent.js").Extent}
         */
        _this.imageExtent_ = options.imageExtent;
        /**
         * @private
         * @type {import("../Image.js").default}
         */
        _this.image_ = new _Image_js__WEBPACK_IMPORTED_MODULE_0__["default"](_this.imageExtent_, undefined, 1, _this.url_, crossOrigin, imageLoadFunction);
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        _this.imageSize_ = options.imageSize ? options.imageSize : null;
        _this.image_.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].CHANGE, _this.handleImageChange.bind(_this));
        return _this;
    }
    /**
     * Returns the image extent
     * @return {import("../extent.js").Extent} image extent.
     * @api
     */
    Static.prototype.getImageExtent = function () {
        return this.imageExtent_;
    };
    /**
     * @inheritDoc
     */
    Static.prototype.getImageInternal = function (extent, resolution, pixelRatio, projection) {
        if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["intersects"])(extent, this.image_.getExtent())) {
            return this.image_;
        }
        return null;
    };
    /**
     * Return the URL used for this image source.
     * @return {string} URL.
     * @api
     */
    Static.prototype.getUrl = function () {
        return this.url_;
    };
    /**
     * @inheritDoc
     */
    Static.prototype.handleImageChange = function (evt) {
        if (this.image_.getState() == _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED) {
            var imageExtent = this.image_.getExtent();
            var image = this.image_.getImage();
            var imageWidth = void 0, imageHeight = void 0;
            if (this.imageSize_) {
                imageWidth = this.imageSize_[0];
                imageHeight = this.imageSize_[1];
            }
            else {
                imageWidth = image.width;
                imageHeight = image.height;
            }
            var resolution = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getHeight"])(imageExtent) / imageHeight;
            var targetWidth = Math.ceil(Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getWidth"])(imageExtent) / resolution);
            if (targetWidth != imageWidth) {
                var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(targetWidth, imageHeight);
                var canvas = context.canvas;
                context.drawImage(image, 0, 0, imageWidth, imageHeight, 0, 0, canvas.width, canvas.height);
                this.image_.setImage(canvas);
            }
        }
        _super.prototype.handleImageChange.call(this, evt);
    };
    return Static;
}(_Image_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Static);
//# sourceMappingURL=ImageStatic.js.map

/***/ }),

/***/ "./node_modules/ol/source/ImageWMS.js":
/*!********************************************!*\
  !*** ./node_modules/ol/source/ImageWMS.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/ol/source/common.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Image.js */ "./node_modules/ol/Image.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _reproj_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../reproj.js */ "./node_modules/ol/reproj.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/source/Image.js");
/* harmony import */ var _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./WMSServerType.js */ "./node_modules/ol/source/WMSServerType.js");
/* harmony import */ var _string_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../string.js */ "./node_modules/ol/string.js");
/* harmony import */ var _uri_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../uri.js */ "./node_modules/ol/uri.js");
/**
 * @module ol/source/ImageWMS
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();












/**
 * @const
 * @type {import("../size.js").Size}
 */
var GETFEATUREINFO_IMAGE_SIZE = [101, 101];
/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
 * the image from the remote server.
 * @property {import("./WMSServerType.js").default|string} [serverType] The type of
 * the remote WMS server: `mapserver`, `geoserver` or `qgis`. Only needed if `hidpi` is `true`.
 * @property {import("../Image.js").LoadFunction} [imageLoadFunction] Optional function to load an image given a URL.
 * @property {Object<string,*>} params WMS request parameters.
 * At least a `LAYERS` param is required. `STYLES` is
 * `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
 * and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, `2` means
 * twice the width and height of the map viewport, and so on. Must be `1` or
 * higher.
 * @property {Array<number>} [resolutions] Resolutions.
 * If specified, requests will be made for these resolutions only.
 * @property {string} url WMS service URL.
 */
/**
 * @classdesc
 * Source for WMS servers providing single, untiled images.
 *
 * @fires module:ol/source/Image.ImageSourceEvent
 * @api
 */
var ImageWMS = /** @class */ (function (_super) {
    __extends(ImageWMS, _super);
    /**
     * @param {Options=} [opt_options] ImageWMS options.
     */
    function ImageWMS(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            attributions: options.attributions,
            projection: options.projection,
            resolutions: options.resolutions
        }) || this;
        /**
         * @private
         * @type {?string}
         */
        _this.crossOrigin_ =
            options.crossOrigin !== undefined ? options.crossOrigin : null;
        /**
         * @private
         * @type {string|undefined}
         */
        _this.url_ = options.url;
        /**
         * @private
         * @type {import("../Image.js").LoadFunction}
         */
        _this.imageLoadFunction_ = options.imageLoadFunction !== undefined ?
            options.imageLoadFunction : _Image_js__WEBPACK_IMPORTED_MODULE_8__["defaultImageLoadFunction"];
        /**
         * @private
         * @type {!Object}
         */
        _this.params_ = options.params || {};
        /**
         * @private
         * @type {boolean}
         */
        _this.v13_ = true;
        _this.updateV13_();
        /**
         * @private
         * @type {import("./WMSServerType.js").default|undefined}
         */
        _this.serverType_ = /** @type {import("./WMSServerType.js").default|undefined} */ (options.serverType);
        /**
         * @private
         * @type {boolean}
         */
        _this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;
        /**
         * @private
         * @type {import("../Image.js").default}
         */
        _this.image_ = null;
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        _this.imageSize_ = [0, 0];
        /**
         * @private
         * @type {number}
         */
        _this.renderedRevision_ = 0;
        /**
         * @private
         * @type {number}
         */
        _this.ratio_ = options.ratio !== undefined ? options.ratio : 1.5;
        return _this;
    }
    /**
     * Return the GetFeatureInfo URL for the passed coordinate, resolution, and
     * projection. Return `undefined` if the GetFeatureInfo URL cannot be
     * constructed.
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {number} resolution Resolution.
     * @param {import("../proj.js").ProjectionLike} projection Projection.
     * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should
     *     be provided. If `QUERY_LAYERS` is not provided then the layers specified
     *     in the `LAYERS` parameter will be used. `VERSION` should not be
     *     specified here.
     * @return {string|undefined} GetFeatureInfo URL.
     * @api
     */
    ImageWMS.prototype.getFeatureInfoUrl = function (coordinate, resolution, projection, params) {
        if (this.url_ === undefined) {
            return undefined;
        }
        var projectionObj = Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["get"])(projection);
        var sourceProjectionObj = this.getProjection();
        if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
            resolution = Object(_reproj_js__WEBPACK_IMPORTED_MODULE_7__["calculateSourceResolution"])(sourceProjectionObj, projectionObj, coordinate, resolution);
            coordinate = Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["transform"])(coordinate, projectionObj, sourceProjectionObj);
        }
        var extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getForViewAndSize"])(coordinate, resolution, 0, GETFEATUREINFO_IMAGE_SIZE);
        var baseParams = {
            'SERVICE': 'WMS',
            'VERSION': _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_WMS_VERSION"],
            'REQUEST': 'GetFeatureInfo',
            'FORMAT': 'image/png',
            'TRANSPARENT': true,
            'QUERY_LAYERS': this.params_['LAYERS']
        };
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_5__["assign"])(baseParams, this.params_, params);
        var x = Math.floor((coordinate[0] - extent[0]) / resolution);
        var y = Math.floor((extent[3] - coordinate[1]) / resolution);
        baseParams[this.v13_ ? 'I' : 'X'] = x;
        baseParams[this.v13_ ? 'J' : 'Y'] = y;
        return this.getRequestUrl_(extent, GETFEATUREINFO_IMAGE_SIZE, 1, sourceProjectionObj || projectionObj, baseParams);
    };
    /**
     * Return the GetLegendGraphic URL, optionally optimized for the passed
     * resolution and possibly including any passed specific parameters. Returns
     * `undefined` if the GetLegendGraphic URL cannot be constructed.
     *
     * @param {number} [resolution] Resolution. If set to undefined, `SCALE`
     *     will not be calculated and included in URL.
     * @param {Object} [params] GetLegendGraphic params. If `LAYER` is set, the
     *     request is generated for this wms layer, else it will try to use the
     *     configured wms layer. Default `FORMAT` is `image/png`.
     *     `VERSION` should not be specified here.
     * @return {string|undefined} GetLegendGraphic URL.
     * @api
     */
    ImageWMS.prototype.getLegendUrl = function (resolution, params) {
        if (this.url_ === undefined) {
            return undefined;
        }
        var baseParams = {
            'SERVICE': 'WMS',
            'VERSION': _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_WMS_VERSION"],
            'REQUEST': 'GetLegendGraphic',
            'FORMAT': 'image/png'
        };
        if (params === undefined || params['LAYER'] === undefined) {
            var layers = this.params_.LAYERS;
            var isSingleLayer = !Array.isArray(layers) || layers.length === 1;
            if (!isSingleLayer) {
                return undefined;
            }
            baseParams['LAYER'] = layers;
        }
        if (resolution !== undefined) {
            var mpu = this.getProjection() ? this.getProjection().getMetersPerUnit() : 1;
            var dpi = 25.4 / 0.28;
            var inchesPerMeter = 39.37;
            baseParams['SCALE'] = resolution * mpu * inchesPerMeter * dpi;
        }
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_5__["assign"])(baseParams, params);
        return Object(_uri_js__WEBPACK_IMPORTED_MODULE_11__["appendParams"])(/** @type {string} */ (this.url_), baseParams);
    };
    /**
     * Get the user-provided params, i.e. those passed to the constructor through
     * the "params" option, and possibly updated using the updateParams method.
     * @return {Object} Params.
     * @api
     */
    ImageWMS.prototype.getParams = function () {
        return this.params_;
    };
    /**
     * @inheritDoc
     */
    ImageWMS.prototype.getImageInternal = function (extent, resolution, pixelRatio, projection) {
        if (this.url_ === undefined) {
            return null;
        }
        resolution = this.findNearestResolution(resolution);
        if (pixelRatio != 1 && (!this.hidpi_ || this.serverType_ === undefined)) {
            pixelRatio = 1;
        }
        var imageResolution = resolution / pixelRatio;
        var center = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getCenter"])(extent);
        var viewWidth = Math.ceil(Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getWidth"])(extent) / imageResolution);
        var viewHeight = Math.ceil(Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getHeight"])(extent) / imageResolution);
        var viewExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getForViewAndSize"])(center, imageResolution, 0, [viewWidth, viewHeight]);
        var requestWidth = Math.ceil(this.ratio_ * Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getWidth"])(extent) / imageResolution);
        var requestHeight = Math.ceil(this.ratio_ * Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getHeight"])(extent) / imageResolution);
        var requestExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getForViewAndSize"])(center, imageResolution, 0, [requestWidth, requestHeight]);
        var image = this.image_;
        if (image &&
            this.renderedRevision_ == this.getRevision() &&
            image.getResolution() == resolution &&
            image.getPixelRatio() == pixelRatio &&
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["containsExtent"])(image.getExtent(), viewExtent)) {
            return image;
        }
        var params = {
            'SERVICE': 'WMS',
            'VERSION': _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_WMS_VERSION"],
            'REQUEST': 'GetMap',
            'FORMAT': 'image/png',
            'TRANSPARENT': true
        };
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_5__["assign"])(params, this.params_);
        this.imageSize_[0] = Math.round(Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getWidth"])(requestExtent) / imageResolution);
        this.imageSize_[1] = Math.round(Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getHeight"])(requestExtent) / imageResolution);
        var url = this.getRequestUrl_(requestExtent, this.imageSize_, pixelRatio, projection, params);
        this.image_ = new _Image_js__WEBPACK_IMPORTED_MODULE_1__["default"](requestExtent, resolution, pixelRatio, url, this.crossOrigin_, this.imageLoadFunction_);
        this.renderedRevision_ = this.getRevision();
        this.image_.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].CHANGE, this.handleImageChange.bind(this));
        return this.image_;
    };
    /**
     * Return the image load function of the source.
     * @return {import("../Image.js").LoadFunction} The image load function.
     * @api
     */
    ImageWMS.prototype.getImageLoadFunction = function () {
        return this.imageLoadFunction_;
    };
    /**
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {import("../size.js").Size} size Size.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @param {Object} params Params.
     * @return {string} Request URL.
     * @private
     */
    ImageWMS.prototype.getRequestUrl_ = function (extent, size, pixelRatio, projection, params) {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(this.url_ !== undefined, 9); // `url` must be configured or set using `#setUrl()`
        params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode();
        if (!('STYLES' in this.params_)) {
            params['STYLES'] = '';
        }
        if (pixelRatio != 1) {
            switch (this.serverType_) {
                case _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOSERVER:
                    var dpi = (90 * pixelRatio + 0.5) | 0;
                    if ('FORMAT_OPTIONS' in params) {
                        params['FORMAT_OPTIONS'] += ';dpi:' + dpi;
                    }
                    else {
                        params['FORMAT_OPTIONS'] = 'dpi:' + dpi;
                    }
                    break;
                case _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MAPSERVER:
                    params['MAP_RESOLUTION'] = 90 * pixelRatio;
                    break;
                case _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__["default"].CARMENTA_SERVER:
                case _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__["default"].QGIS:
                    params['DPI'] = 90 * pixelRatio;
                    break;
                default:
                    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(false, 8); // Unknown `serverType` configured
                    break;
            }
        }
        params['WIDTH'] = size[0];
        params['HEIGHT'] = size[1];
        var axisOrientation = projection.getAxisOrientation();
        var bbox;
        if (this.v13_ && axisOrientation.substr(0, 2) == 'ne') {
            bbox = [extent[1], extent[0], extent[3], extent[2]];
        }
        else {
            bbox = extent;
        }
        params['BBOX'] = bbox.join(',');
        return Object(_uri_js__WEBPACK_IMPORTED_MODULE_11__["appendParams"])(/** @type {string} */ (this.url_), params);
    };
    /**
     * Return the URL used for this WMS source.
     * @return {string|undefined} URL.
     * @api
     */
    ImageWMS.prototype.getUrl = function () {
        return this.url_;
    };
    /**
     * Set the image load function of the source.
     * @param {import("../Image.js").LoadFunction} imageLoadFunction Image load function.
     * @api
     */
    ImageWMS.prototype.setImageLoadFunction = function (imageLoadFunction) {
        this.image_ = null;
        this.imageLoadFunction_ = imageLoadFunction;
        this.changed();
    };
    /**
     * Set the URL to use for requests.
     * @param {string|undefined} url URL.
     * @api
     */
    ImageWMS.prototype.setUrl = function (url) {
        if (url != this.url_) {
            this.url_ = url;
            this.image_ = null;
            this.changed();
        }
    };
    /**
     * Update the user-provided params.
     * @param {Object} params Params.
     * @api
     */
    ImageWMS.prototype.updateParams = function (params) {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_5__["assign"])(this.params_, params);
        this.updateV13_();
        this.image_ = null;
        this.changed();
    };
    /**
     * @private
     */
    ImageWMS.prototype.updateV13_ = function () {
        var version = this.params_['VERSION'] || _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_WMS_VERSION"];
        this.v13_ = Object(_string_js__WEBPACK_IMPORTED_MODULE_10__["compareVersions"])(version, '1.3') >= 0;
    };
    return ImageWMS;
}(_Image_js__WEBPACK_IMPORTED_MODULE_8__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (ImageWMS);
//# sourceMappingURL=ImageWMS.js.map

/***/ }),

/***/ "./node_modules/ol/source/OSM.js":
/*!***************************************!*\
  !*** ./node_modules/ol/source/OSM.js ***!
  \***************************************/
/*! exports provided: ATTRIBUTION, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ATTRIBUTION", function() { return ATTRIBUTION; });
/* harmony import */ var _XYZ_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./XYZ.js */ "./node_modules/ol/source/XYZ.js");
/**
 * @module ol/source/OSM
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();

/**
 * The attribution containing a link to the OpenStreetMap Copyright and License
 * page.
 * @const
 * @type {string}
 * @api
 */
var ATTRIBUTION = '&#169; ' +
    '<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> ' +
    'contributors.';
/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {number} [maxZoom=19] Max zoom.
 * @property {boolean} [opaque=true] Whether the layer is opaque.
 * @property {number} [reprojectionErrorThreshold=1.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {string} [url='https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template.
 * Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 */
/**
 * @classdesc
 * Layer source for the OpenStreetMap tile server.
 * @api
 */
var OSM = /** @class */ (function (_super) {
    __extends(OSM, _super);
    /**
     * @param {Options=} [opt_options] Open Street Map options.
     */
    function OSM(opt_options) {
        var _this = this;
        var options = opt_options || {};
        var attributions;
        if (options.attributions !== undefined) {
            attributions = options.attributions;
        }
        else {
            attributions = [ATTRIBUTION];
        }
        var crossOrigin = options.crossOrigin !== undefined ?
            options.crossOrigin : 'anonymous';
        var url = options.url !== undefined ?
            options.url : 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
        _this = _super.call(this, {
            attributions: attributions,
            cacheSize: options.cacheSize,
            crossOrigin: crossOrigin,
            opaque: options.opaque !== undefined ? options.opaque : true,
            maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            tileLoadFunction: options.tileLoadFunction,
            url: url,
            wrapX: options.wrapX,
            attributionsCollapsible: false
        }) || this;
        return _this;
    }
    return OSM;
}(_XYZ_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (OSM);
//# sourceMappingURL=OSM.js.map

/***/ }),

/***/ "./node_modules/ol/source/Raster.js":
/*!******************************************!*\
  !*** ./node_modules/ol/source/Raster.js ***!
  \******************************************/
/*! exports provided: RasterSourceEvent, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RasterSourceEvent", function() { return RasterSourceEvent; });
/* harmony import */ var _ImageCanvas_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ImageCanvas.js */ "./node_modules/ol/ImageCanvas.js");
/* harmony import */ var _TileQueue_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../TileQueue.js */ "./node_modules/ol/TileQueue.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var pixelworks_lib_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! pixelworks/lib/index.js */ "./node_modules/pixelworks/lib/index.js");
/* harmony import */ var pixelworks_lib_index_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(pixelworks_lib_index_js__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _layer_Image_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../layer/Image.js */ "./node_modules/ol/layer/Image.js");
/* harmony import */ var _layer_Tile_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../layer/Tile.js */ "./node_modules/ol/layer/Tile.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/source/Image.js");
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Tile.js */ "./node_modules/ol/source/Tile.js");
/* harmony import */ var _State_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./State.js */ "./node_modules/ol/source/State.js");
/* harmony import */ var _Source_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Source.js */ "./node_modules/ol/source/Source.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/source/Raster
 */















/**
 * A function that takes an array of input data, performs some operation, and
 * returns an array of output data.
 * For `pixel` type operations, the function will be called with an array of
 * pixels, where each pixel is an array of four numbers (`[r, g, b, a]`) in the
 * range of 0 - 255. It should return a single pixel array.
 * For `'image'` type operations, functions will be called with an array of
 * {@link ImageData https://developer.mozilla.org/en-US/docs/Web/API/ImageData}
 * and should return a single {@link ImageData
 * https://developer.mozilla.org/en-US/docs/Web/API/ImageData}.  The operations
 * are called with a second "data" argument, which can be used for storage.  The
 * data object is accessible from raster events, where it can be initialized in
 * "beforeoperations" and accessed again in "afteroperations".
 *
 * @typedef {function((Array<Array<number>>|Array<ImageData>), Object):
 *     (Array<number>|ImageData)} Operation
 */
/**
 * @enum {string}
 */
var RasterEventType = {
    /**
     * Triggered before operations are run.
     * @event module:ol/source/Raster.RasterSourceEvent#beforeoperations
     * @api
     */
    BEFOREOPERATIONS: 'beforeoperations',
    /**
     * Triggered after operations are run.
     * @event module:ol/source/Raster.RasterSourceEvent#afteroperations
     * @api
     */
    AFTEROPERATIONS: 'afteroperations'
};
/**
 * Raster operation type. Supported values are `'pixel'` and `'image'`.
 * @enum {string}
 */
var RasterOperationType = {
    PIXEL: 'pixel',
    IMAGE: 'image'
};
/**
 * @classdesc
 * Events emitted by {@link module:ol/source/Raster} instances are instances of this
 * type.
 */
var RasterSourceEvent = /** @class */ (function (_super) {
    __extends(RasterSourceEvent, _super);
    /**
     * @param {string} type Type.
     * @param {import("../PluggableMap.js").FrameState} frameState The frame state.
     * @param {Object} data An object made available to operations.
     */
    function RasterSourceEvent(type, frameState, data) {
        var _this = _super.call(this, type) || this;
        /**
         * The raster extent.
         * @type {import("../extent.js").Extent}
         * @api
         */
        _this.extent = frameState.extent;
        /**
         * The pixel resolution (map units per pixel).
         * @type {number}
         * @api
         */
        _this.resolution = frameState.viewState.resolution / frameState.pixelRatio;
        /**
         * An object made available to all operations.  This can be used by operations
         * as a storage object (e.g. for calculating statistics).
         * @type {Object}
         * @api
         */
        _this.data = data;
        return _this;
    }
    return RasterSourceEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_3__["default"]));

/**
 * @typedef {Object} Options
 * @property {Array<import("./Source.js").default|import("../layer/Layer.js").default>} sources Input
 * sources or layers.  For vector data, use an VectorImage layer.
 * @property {Operation} [operation] Raster operation.
 * The operation will be called with data from input sources
 * and the output will be assigned to the raster source.
 * @property {Object} [lib] Functions that will be made available to operations run in a worker.
 * @property {number} [threads] By default, operations will be run in a single worker thread.
 * To avoid using workers altogether, set `threads: 0`.  For pixel operations, operations can
 * be run in multiple worker threads.  Note that there is additional overhead in
 * transferring data to multiple workers, and that depending on the user's
 * system, it may not be possible to parallelize the work.
 * @property {RasterOperationType} [operationType='pixel'] Operation type.
 * Supported values are `'pixel'` and `'image'`.  By default,
 * `'pixel'` operations are assumed, and operations will be called with an
 * array of pixels from input sources.  If set to `'image'`, operations will
 * be called with an array of ImageData objects from input sources.
 */
/**
 * @classdesc
 * A source that transforms data from any number of input sources using an
 * {@link module:ol/source/Raster~Operation} function to transform input pixel values into
 * output pixel values.
 *
 * @fires module:ol/source/Raster.RasterSourceEvent
 * @api
 */
var RasterSource = /** @class */ (function (_super) {
    __extends(RasterSource, _super);
    /**
     * @param {Options} options Options.
     */
    function RasterSource(options) {
        var _this = _super.call(this, {
            projection: null
        }) || this;
        /**
         * @private
         * @type {*}
         */
        _this.worker_ = null;
        /**
         * @private
         * @type {RasterOperationType}
         */
        _this.operationType_ = options.operationType !== undefined ?
            options.operationType : RasterOperationType.PIXEL;
        /**
         * @private
         * @type {number}
         */
        _this.threads_ = options.threads !== undefined ? options.threads : 1;
        /**
         * @private
         * @type {Array<import("../layer/Layer.js").default>}
         */
        _this.layers_ = createLayers(options.sources);
        var changed = _this.changed.bind(_this);
        for (var i = 0, ii = _this.layers_.length; i < ii; ++i) {
            _this.layers_[i].addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CHANGE, changed);
        }
        /**
         * @private
         * @type {import("../TileQueue.js").default}
         */
        _this.tileQueue_ = new _TileQueue_js__WEBPACK_IMPORTED_MODULE_1__["default"](function () {
            return 1;
        }, _this.changed.bind(_this));
        /**
         * The most recently requested frame state.
         * @type {import("../PluggableMap.js").FrameState}
         * @private
         */
        _this.requestedFrameState_;
        /**
         * The most recently rendered image canvas.
         * @type {import("../ImageCanvas.js").default}
         * @private
         */
        _this.renderedImageCanvas_ = null;
        /**
         * The most recently rendered revision.
         * @type {number}
         */
        _this.renderedRevision_;
        /**
         * @private
         * @type {import("../PluggableMap.js").FrameState}
         */
        _this.frameState_ = {
            animate: false,
            coordinateToPixelTransform: Object(_transform_js__WEBPACK_IMPORTED_MODULE_10__["create"])(),
            extent: null,
            index: 0,
            layerIndex: 0,
            layerStatesArray: getLayerStatesArray(_this.layers_),
            pixelRatio: 1,
            pixelToCoordinateTransform: Object(_transform_js__WEBPACK_IMPORTED_MODULE_10__["create"])(),
            postRenderFunctions: [],
            size: [0, 0],
            tileQueue: _this.tileQueue_,
            time: Date.now(),
            usedTiles: {},
            viewState: /** @type {import("../View.js").State} */ ({
                rotation: 0
            }),
            viewHints: [],
            wantedTiles: {},
            declutterItems: []
        };
        _this.setAttributions(function (frameState) {
            var attributions = [];
            for (var index = 0, iMax = options.sources.length; index < iMax; ++index) {
                var sourceOrLayer = options.sources[index];
                var source = sourceOrLayer instanceof _Source_js__WEBPACK_IMPORTED_MODULE_14__["default"] ? sourceOrLayer : sourceOrLayer.getSource();
                var attributionGetter = source.getAttributions();
                if (typeof attributionGetter === 'function') {
                    var sourceAttribution = attributionGetter(frameState);
                    attributions.push.apply(attributions, sourceAttribution);
                }
            }
            return attributions.length !== 0 ? attributions : null;
        });
        if (options.operation !== undefined) {
            _this.setOperation(options.operation, options.lib);
        }
        return _this;
    }
    /**
     * Set the operation.
     * @param {Operation} operation New operation.
     * @param {Object=} opt_lib Functions that will be available to operations run
     *     in a worker.
     * @api
     */
    RasterSource.prototype.setOperation = function (operation, opt_lib) {
        this.worker_ = new pixelworks_lib_index_js__WEBPACK_IMPORTED_MODULE_5__["Processor"]({
            operation: operation,
            imageOps: this.operationType_ === RasterOperationType.IMAGE,
            queue: 1,
            lib: opt_lib,
            threads: this.threads_
        });
        this.changed();
    };
    /**
     * Update the stored frame state.
     * @param {import("../extent.js").Extent} extent The view extent (in map units).
     * @param {number} resolution The view resolution.
     * @param {import("../proj/Projection.js").default} projection The view projection.
     * @return {import("../PluggableMap.js").FrameState} The updated frame state.
     * @private
     */
    RasterSource.prototype.updateFrameState_ = function (extent, resolution, projection) {
        var frameState = /** @type {import("../PluggableMap.js").FrameState} */ (Object(_obj_js__WEBPACK_IMPORTED_MODULE_9__["assign"])({}, this.frameState_));
        frameState.viewState = /** @type {import("../View.js").State} */ (Object(_obj_js__WEBPACK_IMPORTED_MODULE_9__["assign"])({}, frameState.viewState));
        var center = Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["getCenter"])(extent);
        frameState.extent = extent.slice();
        frameState.size[0] = Math.round(Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["getWidth"])(extent) / resolution);
        frameState.size[1] = Math.round(Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["getHeight"])(extent) / resolution);
        frameState.time = Infinity;
        var viewState = frameState.viewState;
        viewState.center = center;
        viewState.projection = projection;
        viewState.resolution = resolution;
        return frameState;
    };
    /**
     * Determine if all sources are ready.
     * @return {boolean} All sources are ready.
     * @private
     */
    RasterSource.prototype.allSourcesReady_ = function () {
        var ready = true;
        var source;
        for (var i = 0, ii = this.layers_.length; i < ii; ++i) {
            source = this.layers_[i].getSource();
            if (source.getState() !== _State_js__WEBPACK_IMPORTED_MODULE_13__["default"].READY) {
                ready = false;
                break;
            }
        }
        return ready;
    };
    /**
     * @inheritDoc
     */
    RasterSource.prototype.getImage = function (extent, resolution, pixelRatio, projection) {
        if (!this.allSourcesReady_()) {
            return null;
        }
        var frameState = this.updateFrameState_(extent, resolution, projection);
        this.requestedFrameState_ = frameState;
        // check if we can't reuse the existing ol/ImageCanvas
        if (this.renderedImageCanvas_) {
            var renderedResolution = this.renderedImageCanvas_.getResolution();
            var renderedExtent = this.renderedImageCanvas_.getExtent();
            if (resolution !== renderedResolution || !Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(extent, renderedExtent)) {
                this.renderedImageCanvas_ = null;
            }
        }
        if (!this.renderedImageCanvas_ || this.getRevision() !== this.renderedRevision_) {
            this.processSources_();
        }
        frameState.tileQueue.loadMoreTiles(16, 16);
        if (frameState.animate) {
            requestAnimationFrame(this.changed.bind(this));
        }
        return this.renderedImageCanvas_;
    };
    /**
     * Start processing source data.
     * @private
     */
    RasterSource.prototype.processSources_ = function () {
        var frameState = this.requestedFrameState_;
        var len = this.layers_.length;
        var imageDatas = new Array(len);
        for (var i = 0; i < len; ++i) {
            frameState.layerIndex = i;
            var imageData = getImageData(this.layers_[i], frameState);
            if (imageData) {
                imageDatas[i] = imageData;
            }
            else {
                return;
            }
        }
        var data = {};
        this.dispatchEvent(new RasterSourceEvent(RasterEventType.BEFOREOPERATIONS, frameState, data));
        this.worker_.process(imageDatas, data, this.onWorkerComplete_.bind(this, frameState));
    };
    /**
     * Called when pixel processing is complete.
     * @param {import("../PluggableMap.js").FrameState} frameState The frame state.
     * @param {Error} err Any error during processing.
     * @param {ImageData} output The output image data.
     * @param {Object} data The user data.
     * @private
     */
    RasterSource.prototype.onWorkerComplete_ = function (frameState, err, output, data) {
        if (err || !output) {
            return;
        }
        // do nothing if extent or resolution changed
        var extent = frameState.extent;
        var resolution = frameState.viewState.resolution;
        if (resolution !== this.requestedFrameState_.viewState.resolution ||
            !Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["equals"])(extent, this.requestedFrameState_.extent)) {
            return;
        }
        var context;
        if (this.renderedImageCanvas_) {
            context = this.renderedImageCanvas_.getImage().getContext('2d');
        }
        else {
            var width = Math.round(Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["getWidth"])(extent) / resolution);
            var height = Math.round(Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["getHeight"])(extent) / resolution);
            context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(width, height);
            this.renderedImageCanvas_ = new _ImageCanvas_js__WEBPACK_IMPORTED_MODULE_0__["default"](extent, resolution, 1, context.canvas);
        }
        context.putImageData(output, 0, 0);
        this.changed();
        this.renderedRevision_ = this.getRevision();
        this.dispatchEvent(new RasterSourceEvent(RasterEventType.AFTEROPERATIONS, frameState, data));
    };
    /**
     * @override
     */
    RasterSource.prototype.getImageInternal = function () {
        return null; // not implemented
    };
    return RasterSource;
}(_Image_js__WEBPACK_IMPORTED_MODULE_11__["default"]));
/**
 * A reusable canvas context.
 * @type {CanvasRenderingContext2D}
 * @private
 */
var sharedContext = null;
/**
 * Get image data from a layer.
 * @param {import("../layer/Layer.js").default} layer Layer to render.
 * @param {import("../PluggableMap.js").FrameState} frameState The frame state.
 * @return {ImageData} The image data.
 */
function getImageData(layer, frameState) {
    var renderer = layer.getRenderer();
    if (!renderer) {
        throw new Error('Unsupported layer type: ' + layer);
    }
    if (!renderer.prepareFrame(frameState)) {
        return null;
    }
    var width = frameState.size[0];
    var height = frameState.size[1];
    var container = renderer.renderFrame(frameState, null);
    var element;
    if (container) {
        element = container.firstElementChild;
    }
    if (!(element instanceof HTMLCanvasElement)) {
        throw new Error('Unsupported rendered element: ' + element);
    }
    if (element.width === width && element.height === height) {
        var context = element.getContext('2d');
        return context.getImageData(0, 0, width, height);
    }
    if (!sharedContext) {
        sharedContext = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(width, height);
    }
    else {
        var canvas = sharedContext.canvas;
        if (canvas.width !== width || canvas.height !== height) {
            sharedContext = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(width, height);
        }
        else {
            sharedContext.clearRect(0, 0, width, height);
        }
    }
    sharedContext.drawImage(element, 0, 0, width, height);
    return sharedContext.getImageData(0, 0, width, height);
}
/**
 * Get a list of layer states from a list of layers.
 * @param {Array<import("../layer/Layer.js").default>} layers Layers.
 * @return {Array<import("../layer/Layer.js").State>} The layer states.
 */
function getLayerStatesArray(layers) {
    return layers.map(function (layer) {
        return layer.getLayerState();
    });
}
/**
 * Create layers for all sources.
 * @param {Array<import("./Source.js").default|import("../layer/Layer.js").default>} sources The sources.
 * @return {Array<import("../layer/Layer.js").default>} Array of layers.
 */
function createLayers(sources) {
    var len = sources.length;
    var layers = new Array(len);
    for (var i = 0; i < len; ++i) {
        layers[i] = createLayer(sources[i]);
    }
    return layers;
}
/**
 * Create a layer for the provided source.
 * @param {import("./Source.js").default|import("../layer/Layer.js").default} layerOrSource The layer or source.
 * @return {import("../layer/Layer.js").default} The layer.
 */
function createLayer(layerOrSource) {
    // @type {import("../layer/Layer.js").default}
    var layer;
    if (layerOrSource instanceof _Source_js__WEBPACK_IMPORTED_MODULE_14__["default"]) {
        if (layerOrSource instanceof _Tile_js__WEBPACK_IMPORTED_MODULE_12__["default"]) {
            layer = new _layer_Tile_js__WEBPACK_IMPORTED_MODULE_8__["default"]({ source: layerOrSource });
        }
        else if (layerOrSource instanceof _Image_js__WEBPACK_IMPORTED_MODULE_11__["default"]) {
            layer = new _layer_Image_js__WEBPACK_IMPORTED_MODULE_7__["default"]({ source: layerOrSource });
        }
    }
    else {
        layer = layerOrSource;
    }
    return layer;
}
/* harmony default export */ __webpack_exports__["default"] = (RasterSource);
//# sourceMappingURL=Raster.js.map

/***/ }),

/***/ "./node_modules/ol/source/Source.js":
/*!******************************************!*\
  !*** ./node_modules/ol/source/Source.js ***!
  \******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _State_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./State.js */ "./node_modules/ol/source/State.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/source/Source
 */




/**
 * A function that returns a string or an array of strings representing source
 * attributions.
 *
 * @typedef {function(import("../PluggableMap.js").FrameState): (string|Array<string>)} Attribution
 */
/**
 * A type that can be used to provide attribution information for data sources.
 *
 * It represents either
 * * a simple string (e.g. `'© Acme Inc.'`)
 * * an array of simple strings (e.g. `['© Acme Inc.', '© Bacme Inc.']`)
 * * a function that returns a string or array of strings ({@link module:ol/source/Source~Attribution})
 *
 * @typedef {string|Array<string>|Attribution} AttributionLike
 */
/**
 * @typedef {Object} Options
 * @property {AttributionLike} [attributions]
 * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {SourceState} [state='ready']
 * @property {boolean} [wrapX=false]
 */
/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Base class for {@link module:ol/layer/Layer~Layer} sources.
 *
 * A generic `change` event is triggered when the state of the source changes.
 * @abstract
 * @api
 */
var Source = /** @class */ (function (_super) {
    __extends(Source, _super);
    /**
     * @param {Options} options Source options.
     */
    function Source(options) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {import("../proj/Projection.js").default}
         */
        _this.projection_ = Object(_proj_js__WEBPACK_IMPORTED_MODULE_2__["get"])(options.projection);
        /**
         * @private
         * @type {?Attribution}
         */
        _this.attributions_ = adaptAttributions(options.attributions);
        /**
         * @private
         * @type {boolean}
         */
        _this.attributionsCollapsible_ = options.attributionsCollapsible !== undefined ?
            options.attributionsCollapsible : true;
        /**
         * This source is currently loading data. Sources that defer loading to the
         * map's tile queue never set this to `true`.
         * @type {boolean}
         */
        _this.loading = false;
        /**
         * @private
         * @type {SourceState}
         */
        _this.state_ = options.state !== undefined ?
            options.state : _State_js__WEBPACK_IMPORTED_MODULE_3__["default"].READY;
        /**
         * @private
         * @type {boolean}
         */
        _this.wrapX_ = options.wrapX !== undefined ? options.wrapX : false;
        return _this;
    }
    /**
     * Get the attribution function for the source.
     * @return {?Attribution} Attribution function.
     */
    Source.prototype.getAttributions = function () {
        return this.attributions_;
    };
    /**
     * @return {boolean} Attributions are collapsible.
     */
    Source.prototype.getAttributionsCollapsible = function () {
        return this.attributionsCollapsible_;
    };
    /**
     * Get the projection of the source.
     * @return {import("../proj/Projection.js").default} Projection.
     * @api
     */
    Source.prototype.getProjection = function () {
        return this.projection_;
    };
    /**
     * @abstract
     * @return {Array<number>|undefined} Resolutions.
     */
    Source.prototype.getResolutions = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Get the state of the source, see {@link module:ol/source/State~State} for possible states.
     * @return {SourceState} State.
     * @api
     */
    Source.prototype.getState = function () {
        return this.state_;
    };
    /**
     * @return {boolean|undefined} Wrap X.
     */
    Source.prototype.getWrapX = function () {
        return this.wrapX_;
    };
    /**
     * Refreshes the source. The source will be cleared, and data from the server will be reloaded.
     * @api
     */
    Source.prototype.refresh = function () {
        this.changed();
    };
    /**
     * Set the attributions of the source.
     * @param {AttributionLike|undefined} attributions Attributions.
     *     Can be passed as `string`, `Array<string>`, {@link module:ol/source/Source~Attribution},
     *     or `undefined`.
     * @api
     */
    Source.prototype.setAttributions = function (attributions) {
        this.attributions_ = adaptAttributions(attributions);
        this.changed();
    };
    /**
     * Set the state of the source.
     * @param {SourceState} state State.
     * @protected
     */
    Source.prototype.setState = function (state) {
        this.state_ = state;
        this.changed();
    };
    return Source;
}(_Object_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * Turns the attributions option into an attributions function.
 * @param {AttributionLike|undefined} attributionLike The attribution option.
 * @return {?Attribution} An attribution function (or null).
 */
function adaptAttributions(attributionLike) {
    if (!attributionLike) {
        return null;
    }
    if (Array.isArray(attributionLike)) {
        return function (frameState) {
            return attributionLike;
        };
    }
    if (typeof attributionLike === 'function') {
        return attributionLike;
    }
    return function (frameState) {
        return [attributionLike];
    };
}
/* harmony default export */ __webpack_exports__["default"] = (Source);
//# sourceMappingURL=Source.js.map

/***/ }),

/***/ "./node_modules/ol/source/Stamen.js":
/*!******************************************!*\
  !*** ./node_modules/ol/source/Stamen.js ***!
  \******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _OSM_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./OSM.js */ "./node_modules/ol/source/OSM.js");
/* harmony import */ var _XYZ_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./XYZ.js */ "./node_modules/ol/source/XYZ.js");
/**
 * @module ol/source/Stamen
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();


/**
 * @const
 * @type {Array<string>}
 */
var ATTRIBUTIONS = [
    'Map tiles by <a href="https://stamen.com/" target="_blank">Stamen Design</a>, ' +
        'under <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY' +
        ' 3.0</a>.',
    _OSM_js__WEBPACK_IMPORTED_MODULE_0__["ATTRIBUTION"]
];
/**
 * @type {Object<string, {extension: string, opaque: boolean}>}
 */
var LayerConfig = {
    'terrain': {
        extension: 'jpg',
        opaque: true
    },
    'terrain-background': {
        extension: 'jpg',
        opaque: true
    },
    'terrain-labels': {
        extension: 'png',
        opaque: false
    },
    'terrain-lines': {
        extension: 'png',
        opaque: false
    },
    'toner-background': {
        extension: 'png',
        opaque: true
    },
    'toner': {
        extension: 'png',
        opaque: true
    },
    'toner-hybrid': {
        extension: 'png',
        opaque: false
    },
    'toner-labels': {
        extension: 'png',
        opaque: false
    },
    'toner-lines': {
        extension: 'png',
        opaque: false
    },
    'toner-lite': {
        extension: 'png',
        opaque: true
    },
    'watercolor': {
        extension: 'jpg',
        opaque: true
    }
};
/**
 * @type {Object<string, {minZoom: number, maxZoom: number}>}
 */
var ProviderConfig = {
    'terrain': {
        minZoom: 0,
        maxZoom: 18
    },
    'toner': {
        minZoom: 0,
        maxZoom: 20
    },
    'watercolor': {
        minZoom: 0,
        maxZoom: 18
    }
};
/**
 * @typedef {Object} Options
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {string} layer Layer name.
 * @property {number} [minZoom] Minimum zoom.
 * @property {number} [maxZoom] Maximum zoom.
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction]
 * Optional function to load a tile given a URL. The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {number} [transition] Duration of the opacity transition for rendering.
 * To disable the opacity transition, pass `transition: 0`.
 * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 */
/**
 * @classdesc
 * Layer source for the Stamen tile server.
 * @api
 */
var Stamen = /** @class */ (function (_super) {
    __extends(Stamen, _super);
    /**
     * @param {Options} options Stamen options.
     */
    function Stamen(options) {
        var _this = this;
        var i = options.layer.indexOf('-');
        var provider = i == -1 ? options.layer : options.layer.slice(0, i);
        var providerConfig = ProviderConfig[provider];
        var layerConfig = LayerConfig[options.layer];
        var url = options.url !== undefined ? options.url :
            'https://stamen-tiles-{a-d}.a.ssl.fastly.net/' + options.layer +
                '/{z}/{x}/{y}.' + layerConfig.extension;
        _this = _super.call(this, {
            attributions: ATTRIBUTIONS,
            cacheSize: options.cacheSize,
            crossOrigin: 'anonymous',
            maxZoom: options.maxZoom != undefined ? options.maxZoom : providerConfig.maxZoom,
            minZoom: options.minZoom != undefined ? options.minZoom : providerConfig.minZoom,
            opaque: layerConfig.opaque,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            tileLoadFunction: options.tileLoadFunction,
            transition: options.transition,
            url: url,
            wrapX: options.wrapX
        }) || this;
        return _this;
    }
    return Stamen;
}(_XYZ_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Stamen);
//# sourceMappingURL=Stamen.js.map

/***/ }),

/***/ "./node_modules/ol/source/State.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/source/State.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/source/State
 */
/**
 * @enum {string}
 * State of the source, one of 'undefined', 'loading', 'ready' or 'error'.
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    UNDEFINED: 'undefined',
    LOADING: 'loading',
    READY: 'ready',
    ERROR: 'error'
});
//# sourceMappingURL=State.js.map

/***/ }),

/***/ "./node_modules/ol/source/Tile.js":
/*!****************************************!*\
  !*** ./node_modules/ol/source/Tile.js ***!
  \****************************************/
/*! exports provided: TileSourceEvent, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TileSourceEvent", function() { return TileSourceEvent; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _TileCache_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../TileCache.js */ "./node_modules/ol/TileCache.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _Source_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Source.js */ "./node_modules/ol/source/Source.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/* harmony import */ var _tilegrid_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../tilegrid.js */ "./node_modules/ol/tilegrid.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/source/Tile
 */









/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions]
 * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
 * @property {number} [cacheSize]
 * @property {boolean} [opaque]
 * @property {number} [tilePixelRatio]
 * @property {import("../proj.js").ProjectionLike} [projection]
 * @property {import("./State.js").default} [state]
 * @property {import("../tilegrid/TileGrid.js").default} [tileGrid]
 * @property {boolean} [wrapX=true]
 * @property {number} [transition]
 * @property {string} [key]
 * @property {number} [zDirection=0]
 */
/**
 * @classdesc
 * Abstract base class; normally only used for creating subclasses and not
 * instantiated in apps.
 * Base class for sources providing images divided into a tile grid.
 * @abstract
 * @api
 */
var TileSource = /** @class */ (function (_super) {
    __extends(TileSource, _super);
    /**
     * @param {Options} options SourceTile source options.
     */
    function TileSource(options) {
        var _this = _super.call(this, {
            attributions: options.attributions,
            attributionsCollapsible: options.attributionsCollapsible,
            projection: options.projection,
            state: options.state,
            wrapX: options.wrapX
        }) || this;
        /**
         * @private
         * @type {boolean}
         */
        _this.opaque_ = options.opaque !== undefined ? options.opaque : false;
        /**
         * @private
         * @type {number}
         */
        _this.tilePixelRatio_ = options.tilePixelRatio !== undefined ?
            options.tilePixelRatio : 1;
        /**
         * @protected
         * @type {import("../tilegrid/TileGrid.js").default}
         */
        _this.tileGrid = options.tileGrid !== undefined ? options.tileGrid : null;
        var tileSize = [256, 256];
        var tileGrid = options.tileGrid;
        if (tileGrid) {
            Object(_size_js__WEBPACK_IMPORTED_MODULE_5__["toSize"])(tileGrid.getTileSize(tileGrid.getMinZoom()), tileSize);
        }
        var canUseScreen = typeof screen !== 'undefined';
        var width = canUseScreen ? (screen.availWidth || screen.width) : 1920;
        var height = canUseScreen ? (screen.availHeight || screen.height) : 1080;
        var minCacheSize = 4 * Math.ceil(width / tileSize[0]) * Math.ceil(height / tileSize[1]);
        /**
         * @protected
         * @type {import("../TileCache.js").default}
         */
        _this.tileCache = new _TileCache_js__WEBPACK_IMPORTED_MODULE_1__["default"](Math.max(minCacheSize, options.cacheSize || 0));
        /**
         * @protected
         * @type {import("../size.js").Size}
         */
        _this.tmpSize = [0, 0];
        /**
         * @private
         * @type {string}
         */
        _this.key_ = options.key || '';
        /**
         * @protected
         * @type {import("../Tile.js").Options}
         */
        _this.tileOptions = { transition: options.transition };
        /**
         * zDirection hint, read by the renderer. Indicates which resolution should be used
         * by a renderer if the views resolution does not match any resolution of the tile source.
         * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
         * will be used. If -1, the nearest higher resolution will be used.
         * @type {number}
         */
        _this.zDirection = options.zDirection ? options.zDirection : 0;
        return _this;
    }
    /**
     * @return {boolean} Can expire cache.
     */
    TileSource.prototype.canExpireCache = function () {
        return this.tileCache.canExpireCache();
    };
    /**
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @param {!Object<string, boolean>} usedTiles Used tiles.
     */
    TileSource.prototype.expireCache = function (projection, usedTiles) {
        var tileCache = this.getTileCacheForProjection(projection);
        if (tileCache) {
            tileCache.expireCache(usedTiles);
        }
    };
    /**
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @param {number} z Zoom level.
     * @param {import("../TileRange.js").default} tileRange Tile range.
     * @param {function(import("../Tile.js").default):(boolean|void)} callback Called with each
     *     loaded tile.  If the callback returns `false`, the tile will not be
     *     considered loaded.
     * @return {boolean} The tile range is fully covered with loaded tiles.
     */
    TileSource.prototype.forEachLoadedTile = function (projection, z, tileRange, callback) {
        var tileCache = this.getTileCacheForProjection(projection);
        if (!tileCache) {
            return false;
        }
        var covered = true;
        var tile, tileCoordKey, loaded;
        for (var x = tileRange.minX; x <= tileRange.maxX; ++x) {
            for (var y = tileRange.minY; y <= tileRange.maxY; ++y) {
                tileCoordKey = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_7__["getKeyZXY"])(z, x, y);
                loaded = false;
                if (tileCache.containsKey(tileCoordKey)) {
                    tile = /** @type {!import("../Tile.js").default} */ (tileCache.get(tileCoordKey));
                    loaded = tile.getState() === _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED;
                    if (loaded) {
                        loaded = (callback(tile) !== false);
                    }
                }
                if (!loaded) {
                    covered = false;
                }
            }
        }
        return covered;
    };
    /**
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {number} Gutter.
     */
    TileSource.prototype.getGutterForProjection = function (projection) {
        return 0;
    };
    /**
     * Return the key to be used for all tiles in the source.
     * @return {string} The key for all tiles.
     * @protected
     */
    TileSource.prototype.getKey = function () {
        return this.key_;
    };
    /**
     * Set the value to be used as the key for all tiles in the source.
     * @param {string} key The key for tiles.
     * @protected
     */
    TileSource.prototype.setKey = function (key) {
        if (this.key_ !== key) {
            this.key_ = key;
            this.changed();
        }
    };
    /**
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {boolean} Opaque.
     */
    TileSource.prototype.getOpaque = function (projection) {
        return this.opaque_;
    };
    /**
     * @inheritDoc
     */
    TileSource.prototype.getResolutions = function () {
        return this.tileGrid.getResolutions();
    };
    /**
     * @abstract
     * @param {number} z Tile coordinate z.
     * @param {number} x Tile coordinate x.
     * @param {number} y Tile coordinate y.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {!import("../Tile.js").default} Tile.
     */
    TileSource.prototype.getTile = function (z, x, y, pixelRatio, projection) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Return the tile grid of the tile source.
     * @return {import("../tilegrid/TileGrid.js").default} Tile grid.
     * @api
     */
    TileSource.prototype.getTileGrid = function () {
        return this.tileGrid;
    };
    /**
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {!import("../tilegrid/TileGrid.js").default} Tile grid.
     */
    TileSource.prototype.getTileGridForProjection = function (projection) {
        if (!this.tileGrid) {
            return Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_8__["getForProjection"])(projection);
        }
        else {
            return this.tileGrid;
        }
    };
    /**
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {import("../TileCache.js").default} Tile cache.
     * @protected
     */
    TileSource.prototype.getTileCacheForProjection = function (projection) {
        var thisProj = this.getProjection();
        if (thisProj && !Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["equivalent"])(thisProj, projection)) {
            return null;
        }
        else {
            return this.tileCache;
        }
    };
    /**
     * Get the tile pixel ratio for this source. Subclasses may override this
     * method, which is meant to return a supported pixel ratio that matches the
     * provided `pixelRatio` as close as possible.
     * @param {number} pixelRatio Pixel ratio.
     * @return {number} Tile pixel ratio.
     */
    TileSource.prototype.getTilePixelRatio = function (pixelRatio) {
        return this.tilePixelRatio_;
    };
    /**
     * @param {number} z Z.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {import("../size.js").Size} Tile size.
     */
    TileSource.prototype.getTilePixelSize = function (z, pixelRatio, projection) {
        var tileGrid = this.getTileGridForProjection(projection);
        var tilePixelRatio = this.getTilePixelRatio(pixelRatio);
        var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_5__["toSize"])(tileGrid.getTileSize(z), this.tmpSize);
        if (tilePixelRatio == 1) {
            return tileSize;
        }
        else {
            return Object(_size_js__WEBPACK_IMPORTED_MODULE_5__["scale"])(tileSize, tilePixelRatio, this.tmpSize);
        }
    };
    /**
     * Returns a tile coordinate wrapped around the x-axis. When the tile coordinate
     * is outside the resolution and extent range of the tile grid, `null` will be
     * returned.
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {import("../proj/Projection.js").default=} opt_projection Projection.
     * @return {import("../tilecoord.js").TileCoord} Tile coordinate to be passed to the tileUrlFunction or
     *     null if no tile URL should be created for the passed `tileCoord`.
     */
    TileSource.prototype.getTileCoordForTileUrlFunction = function (tileCoord, opt_projection) {
        var projection = opt_projection !== undefined ?
            opt_projection : this.getProjection();
        var tileGrid = this.getTileGridForProjection(projection);
        if (this.getWrapX() && projection.isGlobal()) {
            tileCoord = Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_8__["wrapX"])(tileGrid, tileCoord, projection);
        }
        return Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_7__["withinExtentAndZ"])(tileCoord, tileGrid) ? tileCoord : null;
    };
    /**
     * Remove all cached tiles from the source. The next render cycle will fetch new tiles.
     * @api
     */
    TileSource.prototype.clear = function () {
        this.tileCache.clear();
    };
    TileSource.prototype.refresh = function () {
        this.clear();
        _super.prototype.refresh.call(this);
    };
    /**
     * Marks a tile coord as being used, without triggering a load.
     * @abstract
     * @param {number} z Tile coordinate z.
     * @param {number} x Tile coordinate x.
     * @param {number} y Tile coordinate y.
     * @param {import("../proj/Projection.js").default} projection Projection.
     */
    TileSource.prototype.useTile = function (z, x, y, projection) { };
    return TileSource;
}(_Source_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/**
 * @classdesc
 * Events emitted by {@link module:ol/source/Tile~TileSource} instances are instances of this
 * type.
 */
var TileSourceEvent = /** @class */ (function (_super) {
    __extends(TileSourceEvent, _super);
    /**
     * @param {string} type Type.
     * @param {import("../Tile.js").default} tile The tile.
     */
    function TileSourceEvent(type, tile) {
        var _this = _super.call(this, type) || this;
        /**
         * The tile related to the event.
         * @type {import("../Tile.js").default}
         * @api
         */
        _this.tile = tile;
        return _this;
    }
    return TileSourceEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_3__["default"]));

/* harmony default export */ __webpack_exports__["default"] = (TileSource);
//# sourceMappingURL=Tile.js.map

/***/ }),

/***/ "./node_modules/ol/source/TileArcGISRest.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/source/TileArcGISRest.js ***!
  \**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _TileImage_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/* harmony import */ var _uri_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../uri.js */ "./node_modules/ol/uri.js");
/**
 * @module ol/source/TileArcGISRest
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();







/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {Object<string,*>} [params] ArcGIS Rest parameters. This field is optional. Service defaults will be
 * used for any fields not specified. `FORMAT` is `PNG32` by default. `F` is `IMAGE` by
 * default. `TRANSPARENT` is `true` by default.  `BBOX`, `SIZE`, `BBOXSR`,
 * and `IMAGESR` will be set dynamically. Set `LAYERS` to
 * override the default service layer visibility. See
 * http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Export_Map/02r3000000v7000000/
 * for further reference.
 * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
 * the image from the remote server.
 * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid. Base this on the resolutions,
 * tilesize and extent supported by the server.
 * If this is not defined, a default grid will be used: if there is a projection
 * extent, the grid will be based on that; if not, a grid based on a global
 * extent with origin at 0,0 will be used.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL.
 * The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {string} [url] ArcGIS Rest service URL for a Map Service or Image Service. The
 * url should include /MapServer or /ImageServer.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 * @property {number} [transition] Duration of the opacity transition for rendering.  To disable the opacity
 * transition, pass `transition: 0`.
 * @property {Array<string>} [urls] ArcGIS Rest service urls. Use this instead of `url` when the ArcGIS
 * Service supports multiple urls for export requests.
 */
/**
 * @classdesc
 * Layer source for tile data from ArcGIS Rest services. Map and Image
 * Services are supported.
 *
 * For cached ArcGIS services, better performance is available using the
 * {@link module:ol/source/XYZ~XYZ} data source.
 * @api
 */
var TileArcGISRest = /** @class */ (function (_super) {
    __extends(TileArcGISRest, _super);
    /**
     * @param {Options=} opt_options Tile ArcGIS Rest options.
     */
    function TileArcGISRest(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            crossOrigin: options.crossOrigin,
            projection: options.projection,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            tileGrid: options.tileGrid,
            tileLoadFunction: options.tileLoadFunction,
            tileUrlFunction: tileUrlFunction,
            url: options.url,
            urls: options.urls,
            wrapX: options.wrapX !== undefined ? options.wrapX : true,
            transition: options.transition
        }) || this;
        /**
         * @private
         * @type {!Object}
         */
        _this.params_ = options.params || {};
        /**
         * @private
         * @type {boolean}
         */
        _this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;
        /**
         * @private
         * @type {import("../extent.js").Extent}
         */
        _this.tmpExtent_ = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__["createEmpty"])();
        _this.setKey(_this.getKeyForParams_());
        return _this;
    }
    /**
     * @private
     * @return {string} The key for the current params.
     */
    TileArcGISRest.prototype.getKeyForParams_ = function () {
        var i = 0;
        var res = [];
        for (var key in this.params_) {
            res[i++] = key + '-' + this.params_[key];
        }
        return res.join('/');
    };
    /**
     * Get the user-provided params, i.e. those passed to the constructor through
     * the "params" option, and possibly updated using the updateParams method.
     * @return {Object} Params.
     * @api
     */
    TileArcGISRest.prototype.getParams = function () {
        return this.params_;
    };
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {import("../size.js").Size} tileSize Tile size.
     * @param {import("../extent.js").Extent} tileExtent Tile extent.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @param {Object} params Params.
     * @return {string|undefined} Request URL.
     * @private
     */
    TileArcGISRest.prototype.getRequestUrl_ = function (tileCoord, tileSize, tileExtent, pixelRatio, projection, params) {
        var urls = this.urls;
        if (!urls) {
            return undefined;
        }
        // ArcGIS Server only wants the numeric portion of the projection ID.
        var srid = projection.getCode().split(':').pop();
        params['SIZE'] = tileSize[0] + ',' + tileSize[1];
        params['BBOX'] = tileExtent.join(',');
        params['BBOXSR'] = srid;
        params['IMAGESR'] = srid;
        params['DPI'] = Math.round(params['DPI'] ? params['DPI'] * pixelRatio : 90 * pixelRatio);
        var url;
        if (urls.length == 1) {
            url = urls[0];
        }
        else {
            var index = Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["modulo"])(Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_5__["hash"])(tileCoord), urls.length);
            url = urls[index];
        }
        var modifiedUrl = url
            .replace(/MapServer\/?$/, 'MapServer/export')
            .replace(/ImageServer\/?$/, 'ImageServer/exportImage');
        return Object(_uri_js__WEBPACK_IMPORTED_MODULE_6__["appendParams"])(modifiedUrl, params);
    };
    /**
     * @inheritDoc
     */
    TileArcGISRest.prototype.getTilePixelRatio = function (pixelRatio) {
        return this.hidpi_ ? /** @type {number} */ (pixelRatio) : 1;
    };
    /**
     * Update the user-provided params.
     * @param {Object} params Params.
     * @api
     */
    TileArcGISRest.prototype.updateParams = function (params) {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["assign"])(this.params_, params);
        this.setKey(this.getKeyForParams_());
    };
    return TileArcGISRest;
}(_TileImage_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/**
 * @param {import("../tilecoord.js").TileCoord} tileCoord The tile coordinate
 * @param {number} pixelRatio The pixel ratio
 * @param {import("../proj/Projection.js").default} projection The projection
 * @return {string|undefined} The tile URL
 * @this {TileArcGISRest}
 */
function tileUrlFunction(tileCoord, pixelRatio, projection) {
    var tileGrid = this.getTileGrid();
    if (!tileGrid) {
        tileGrid = this.getTileGridForProjection(projection);
    }
    if (tileGrid.getResolutions().length <= tileCoord[0]) {
        return undefined;
    }
    if (pixelRatio != 1 && !this.hidpi_) {
        pixelRatio = 1;
    }
    var tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);
    var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_3__["toSize"])(tileGrid.getTileSize(tileCoord[0]), this.tmpSize);
    if (pixelRatio != 1) {
        tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_3__["scale"])(tileSize, pixelRatio, this.tmpSize);
    }
    // Apply default params and override with user specified values.
    var baseParams = {
        'F': 'image',
        'FORMAT': 'PNG32',
        'TRANSPARENT': true
    };
    Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["assign"])(baseParams, this.params_);
    return this.getRequestUrl_(tileCoord, tileSize, tileExtent, pixelRatio, projection, baseParams);
}
/* harmony default export */ __webpack_exports__["default"] = (TileArcGISRest);
//# sourceMappingURL=TileArcGISRest.js.map

/***/ }),

/***/ "./node_modules/ol/source/TileDebug.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/source/TileDebug.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Tile.js */ "./node_modules/ol/Tile.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _XYZ_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./XYZ.js */ "./node_modules/ol/source/XYZ.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/**
 * @module ol/source/TileDebug
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();






var LabeledTile = /** @class */ (function (_super) {
    __extends(LabeledTile, _super);
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {import("../size.js").Size} tileSize Tile size.
     * @param {string} text Text.
     */
    function LabeledTile(tileCoord, tileSize, text) {
        var _this = _super.call(this, tileCoord, _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED) || this;
        /**
        * @private
        * @type {import("../size.js").Size}
        */
        _this.tileSize_ = tileSize;
        /**
        * @private
        * @type {string}
        */
        _this.text_ = text;
        /**
        * @private
        * @type {HTMLCanvasElement}
        */
        _this.canvas_ = null;
        return _this;
    }
    /**
    * Get the image element for this tile.
    * @return {HTMLCanvasElement} Image.
    */
    LabeledTile.prototype.getImage = function () {
        if (this.canvas_) {
            return this.canvas_;
        }
        else {
            var tileSize = this.tileSize_;
            var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(tileSize[0], tileSize[1]);
            context.strokeStyle = 'grey';
            context.strokeRect(0.5, 0.5, tileSize[0] + 0.5, tileSize[1] + 0.5);
            context.fillStyle = 'grey';
            context.strokeStyle = 'white';
            context.textAlign = 'center';
            context.textBaseline = 'middle';
            context.font = '24px sans-serif';
            context.lineWidth = 4;
            context.strokeText(this.text_, tileSize[0] / 2, tileSize[1] / 2, tileSize[0]);
            context.fillText(this.text_, tileSize[0] / 2, tileSize[1] / 2, tileSize[0]);
            this.canvas_ = context.canvas;
            return context.canvas;
        }
    };
    /**
    * @override
    */
    LabeledTile.prototype.load = function () { };
    return LabeledTile;
}(_Tile_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/**
 * @typedef {Object} Options
 * @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Optional projection.
 * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 * @property {number} [zDirection=0] Set to `1` when debugging `VectorTile` sources with
 * a default configuration. Indicates which resolution should be used by a renderer if
 * the view resolution does not match any resolution of the tile source. If 0, the nearest
 * resolution will be used. If 1, the nearest lower resolution will be used. If -1, the
 * nearest higher resolution will be used.
 */
/**
 * @classdesc
 * A pseudo tile source, which does not fetch tiles from a server, but renders
 * a grid outline for the tile grid/projection along with the coordinates for
 * each tile. See examples/canvas-tiles for an example.
 *
 * Uses Canvas context2d, so requires Canvas support.
 * @api
 */
var TileDebug = /** @class */ (function (_super) {
    __extends(TileDebug, _super);
    /**
     * @param {Options=} opt_options Debug tile options.
     */
    function TileDebug(opt_options) {
        var _this = this;
        /**
         * @type {Options}
         */
        var options = opt_options || {};
        _this = _super.call(this, {
            opaque: false,
            projection: options.projection,
            tileGrid: options.tileGrid,
            wrapX: options.wrapX !== undefined ? options.wrapX : true,
            zDirection: options.zDirection
        }) || this;
        return _this;
    }
    /**
    * @inheritDoc
    */
    TileDebug.prototype.getTile = function (z, x, y) {
        var tileCoordKey = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_5__["getKeyZXY"])(z, x, y);
        if (this.tileCache.containsKey(tileCoordKey)) {
            return /** @type {!LabeledTile} */ (this.tileCache.get(tileCoordKey));
        }
        else {
            var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_3__["toSize"])(this.tileGrid.getTileSize(z));
            var tileCoord = [z, x, y];
            var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord);
            var text = void 0;
            if (textTileCoord) {
                text = 'z:' + textTileCoord[0] + ' x:' + textTileCoord[1] + ' y:' + textTileCoord[2];
            }
            else {
                text = 'none';
            }
            var tile = new LabeledTile(tileCoord, tileSize, text);
            this.tileCache.set(tileCoordKey, tile);
            return tile;
        }
    };
    return TileDebug;
}(_XYZ_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (TileDebug);
//# sourceMappingURL=TileDebug.js.map

/***/ }),

/***/ "./node_modules/ol/source/TileEventType.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/source/TileEventType.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/source/TileEventType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Triggered when a tile starts loading.
     * @event module:ol/source/Tile.TileSourceEvent#tileloadstart
     * @api
     */
    TILELOADSTART: 'tileloadstart',
    /**
     * Triggered when a tile finishes loading, either when its data is loaded,
     * or when loading was aborted because the tile is no longer needed.
     * @event module:ol/source/Tile.TileSourceEvent#tileloadend
     * @api
     */
    TILELOADEND: 'tileloadend',
    /**
     * Triggered if tile loading results in an error.
     * @event module:ol/source/Tile.TileSourceEvent#tileloaderror
     * @api
     */
    TILELOADERROR: 'tileloaderror'
});
//# sourceMappingURL=TileEventType.js.map

/***/ }),

/***/ "./node_modules/ol/source/TileImage.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/source/TileImage.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _reproj_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../reproj/common.js */ "./node_modules/ol/reproj/common.js");
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _ImageTile_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ImageTile.js */ "./node_modules/ol/ImageTile.js");
/* harmony import */ var _TileCache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../TileCache.js */ "./node_modules/ol/TileCache.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _reproj_Tile_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../reproj/Tile.js */ "./node_modules/ol/reproj/Tile.js");
/* harmony import */ var _UrlTile_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./UrlTile.js */ "./node_modules/ol/source/UrlTile.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/* harmony import */ var _tilegrid_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../tilegrid.js */ "./node_modules/ol/tilegrid.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/source/TileImage
 */











/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {boolean} [opaque=true] Whether the layer is opaque.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {import("./State.js").default} [state] Source state.
 * @property {typeof import("../ImageTile.js").default} [tileClass] Class used to instantiate image tiles.
 * Default is {@link module:ol/ImageTile~ImageTile}.
 * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service. For example, if the tile
 * service advertizes 256px by 256px tiles but actually sends 512px
 * by 512px images (for retina/hidpi devices) then `tilePixelRatio`
 * should be set to `2`.
 * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.
 * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
 * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
 * used instead of defining each one separately in the `urls` option.
 * @property {Array<string>} [urls] An array of URL templates.
 * @property {boolean} [wrapX] Whether to wrap the world horizontally. The default, is to
 * request out-of-bounds tiles from the server. When set to `false`, only one
 * world will be rendered. When set to `true`, tiles will be requested for one
 * world only, but they will be wrapped horizontally to render multiple worlds.
 * @property {number} [transition] Duration of the opacity transition for rendering.
 * To disable the opacity transition, pass `transition: 0`.
 * @property {string} [key] Optional tile key for proper cache fetching
 * @property {number} [zDirection=0] Indicate which resolution should be used
 * by a renderer if the view resolution does not match any resolution of the tile source.
 * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
 * will be used. If -1, the nearest higher resolution will be used.
 */
/**
 * @classdesc
 * Base class for sources providing images divided into a tile grid.
 *
 * @fires import("./Tile.js").TileSourceEvent
 * @api
 */
var TileImage = /** @class */ (function (_super) {
    __extends(TileImage, _super);
    /**
     * @param {!Options} options Image tile options.
     */
    function TileImage(options) {
        var _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            opaque: options.opaque,
            projection: options.projection,
            state: options.state,
            tileGrid: options.tileGrid,
            tileLoadFunction: options.tileLoadFunction ?
                options.tileLoadFunction : defaultTileLoadFunction,
            tilePixelRatio: options.tilePixelRatio,
            tileUrlFunction: options.tileUrlFunction,
            url: options.url,
            urls: options.urls,
            wrapX: options.wrapX,
            transition: options.transition,
            key: options.key,
            attributionsCollapsible: options.attributionsCollapsible,
            zDirection: options.zDirection
        }) || this;
        /**
         * @protected
         * @type {?string}
         */
        _this.crossOrigin =
            options.crossOrigin !== undefined ? options.crossOrigin : null;
        /**
         * @protected
         * @type {typeof ImageTile}
         */
        _this.tileClass = options.tileClass !== undefined ?
            options.tileClass : _ImageTile_js__WEBPACK_IMPORTED_MODULE_2__["default"];
        /**
         * @protected
         * @type {!Object<string, TileCache>}
         */
        _this.tileCacheForProjection = {};
        /**
         * @protected
         * @type {!Object<string, import("../tilegrid/TileGrid.js").default>}
         */
        _this.tileGridForProjection = {};
        /**
         * @private
         * @type {number|undefined}
         */
        _this.reprojectionErrorThreshold_ = options.reprojectionErrorThreshold;
        /**
         * @private
         * @type {boolean}
         */
        _this.renderReprojectionEdges_ = false;
        return _this;
    }
    /**
     * @inheritDoc
     */
    TileImage.prototype.canExpireCache = function () {
        if (!_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"]) {
            return _super.prototype.canExpireCache.call(this);
        }
        if (this.tileCache.canExpireCache()) {
            return true;
        }
        else {
            for (var key in this.tileCacheForProjection) {
                if (this.tileCacheForProjection[key].canExpireCache()) {
                    return true;
                }
            }
        }
        return false;
    };
    /**
     * @inheritDoc
     */
    TileImage.prototype.expireCache = function (projection, usedTiles) {
        if (!_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"]) {
            _super.prototype.expireCache.call(this, projection, usedTiles);
            return;
        }
        var usedTileCache = this.getTileCacheForProjection(projection);
        this.tileCache.expireCache(this.tileCache == usedTileCache ? usedTiles : {});
        for (var id in this.tileCacheForProjection) {
            var tileCache = this.tileCacheForProjection[id];
            tileCache.expireCache(tileCache == usedTileCache ? usedTiles : {});
        }
    };
    /**
     * @inheritDoc
     */
    TileImage.prototype.getGutterForProjection = function (projection) {
        if (_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"] &&
            this.getProjection() && projection && !Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["equivalent"])(this.getProjection(), projection)) {
            return 0;
        }
        else {
            return this.getGutter();
        }
    };
    /**
     * @return {number} Gutter.
     */
    TileImage.prototype.getGutter = function () {
        return 0;
    };
    /**
     * @inheritDoc
     */
    TileImage.prototype.getOpaque = function (projection) {
        if (_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"] &&
            this.getProjection() && projection && !Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["equivalent"])(this.getProjection(), projection)) {
            return false;
        }
        else {
            return _super.prototype.getOpaque.call(this, projection);
        }
    };
    /**
     * @inheritDoc
     */
    TileImage.prototype.getTileGridForProjection = function (projection) {
        if (!_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"]) {
            return _super.prototype.getTileGridForProjection.call(this, projection);
        }
        var thisProj = this.getProjection();
        if (this.tileGrid && (!thisProj || Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["equivalent"])(thisProj, projection))) {
            return this.tileGrid;
        }
        else {
            var projKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["getUid"])(projection);
            if (!(projKey in this.tileGridForProjection)) {
                this.tileGridForProjection[projKey] = Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_10__["getForProjection"])(projection);
            }
            return (
            /** @type {!import("../tilegrid/TileGrid.js").default} */ (this.tileGridForProjection[projKey]));
        }
    };
    /**
     * @inheritDoc
     */
    TileImage.prototype.getTileCacheForProjection = function (projection) {
        if (!_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"]) {
            return _super.prototype.getTileCacheForProjection.call(this, projection);
        }
        var thisProj = this.getProjection();
        if (!thisProj || Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["equivalent"])(thisProj, projection)) {
            return this.tileCache;
        }
        else {
            var projKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["getUid"])(projection);
            if (!(projKey in this.tileCacheForProjection)) {
                this.tileCacheForProjection[projKey] = new _TileCache_js__WEBPACK_IMPORTED_MODULE_3__["default"](this.tileCache.highWaterMark);
            }
            return this.tileCacheForProjection[projKey];
        }
    };
    /**
     * @param {number} z Tile coordinate z.
     * @param {number} x Tile coordinate x.
     * @param {number} y Tile coordinate y.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @param {string} key The key set on the tile.
     * @return {!import("../Tile.js").default} Tile.
     * @private
     */
    TileImage.prototype.createTile_ = function (z, x, y, pixelRatio, projection, key) {
        var tileCoord = [z, x, y];
        var urlTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection);
        var tileUrl = urlTileCoord ?
            this.tileUrlFunction(urlTileCoord, pixelRatio, projection) : undefined;
        var tile = new this.tileClass(tileCoord, tileUrl !== undefined ? _TileState_js__WEBPACK_IMPORTED_MODULE_4__["default"].IDLE : _TileState_js__WEBPACK_IMPORTED_MODULE_4__["default"].EMPTY, tileUrl !== undefined ? tileUrl : '', this.crossOrigin, this.tileLoadFunction, this.tileOptions);
        tile.key = key;
        tile.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].CHANGE, this.handleTileChange.bind(this));
        return tile;
    };
    /**
     * @inheritDoc
     */
    TileImage.prototype.getTile = function (z, x, y, pixelRatio, projection) {
        var sourceProjection = /** @type {!import("../proj/Projection.js").default} */ (this.getProjection());
        if (!_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"] ||
            !sourceProjection || !projection || Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["equivalent"])(sourceProjection, projection)) {
            return this.getTileInternal(z, x, y, pixelRatio, sourceProjection || projection);
        }
        else {
            var cache = this.getTileCacheForProjection(projection);
            var tileCoord = [z, x, y];
            var tile = void 0;
            var tileCoordKey = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_9__["getKey"])(tileCoord);
            if (cache.containsKey(tileCoordKey)) {
                tile = /** @type {!import("../Tile.js").default} */ (cache.get(tileCoordKey));
            }
            var key = this.getKey();
            if (tile && tile.key == key) {
                return tile;
            }
            else {
                var sourceTileGrid = this.getTileGridForProjection(sourceProjection);
                var targetTileGrid = this.getTileGridForProjection(projection);
                var wrappedTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection);
                var newTile = new _reproj_Tile_js__WEBPACK_IMPORTED_MODULE_7__["default"](sourceProjection, sourceTileGrid, projection, targetTileGrid, tileCoord, wrappedTileCoord, this.getTilePixelRatio(pixelRatio), this.getGutter(), function (z, x, y, pixelRatio) {
                    return this.getTileInternal(z, x, y, pixelRatio, sourceProjection);
                }.bind(this), this.reprojectionErrorThreshold_, this.renderReprojectionEdges_);
                newTile.key = key;
                if (tile) {
                    newTile.interimTile = tile;
                    newTile.refreshInterimChain();
                    cache.replace(tileCoordKey, newTile);
                }
                else {
                    cache.set(tileCoordKey, newTile);
                }
                return newTile;
            }
        }
    };
    /**
     * @param {number} z Tile coordinate z.
     * @param {number} x Tile coordinate x.
     * @param {number} y Tile coordinate y.
     * @param {number} pixelRatio Pixel ratio.
     * @param {!import("../proj/Projection.js").default} projection Projection.
     * @return {!import("../Tile.js").default} Tile.
     * @protected
     */
    TileImage.prototype.getTileInternal = function (z, x, y, pixelRatio, projection) {
        var tile = null;
        var tileCoordKey = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_9__["getKeyZXY"])(z, x, y);
        var key = this.getKey();
        if (!this.tileCache.containsKey(tileCoordKey)) {
            tile = this.createTile_(z, x, y, pixelRatio, projection, key);
            this.tileCache.set(tileCoordKey, tile);
        }
        else {
            tile = this.tileCache.get(tileCoordKey);
            if (tile.key != key) {
                // The source's params changed. If the tile has an interim tile and if we
                // can use it then we use it. Otherwise we create a new tile.  In both
                // cases we attempt to assign an interim tile to the new tile.
                var interimTile = tile;
                tile = this.createTile_(z, x, y, pixelRatio, projection, key);
                //make the new tile the head of the list,
                if (interimTile.getState() == _TileState_js__WEBPACK_IMPORTED_MODULE_4__["default"].IDLE) {
                    //the old tile hasn't begun loading yet, and is now outdated, so we can simply discard it
                    tile.interimTile = interimTile.interimTile;
                }
                else {
                    tile.interimTile = interimTile;
                }
                tile.refreshInterimChain();
                this.tileCache.replace(tileCoordKey, tile);
            }
        }
        return tile;
    };
    /**
     * Sets whether to render reprojection edges or not (usually for debugging).
     * @param {boolean} render Render the edges.
     * @api
     */
    TileImage.prototype.setRenderReprojectionEdges = function (render) {
        if (!_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"] ||
            this.renderReprojectionEdges_ == render) {
            return;
        }
        this.renderReprojectionEdges_ = render;
        for (var id in this.tileCacheForProjection) {
            this.tileCacheForProjection[id].clear();
        }
        this.changed();
    };
    /**
     * Sets the tile grid to use when reprojecting the tiles to the given
     * projection instead of the default tile grid for the projection.
     *
     * This can be useful when the default tile grid cannot be created
     * (e.g. projection has no extent defined) or
     * for optimization reasons (custom tile size, resolutions, ...).
     *
     * @param {import("../proj.js").ProjectionLike} projection Projection.
     * @param {import("../tilegrid/TileGrid.js").default} tilegrid Tile grid to use for the projection.
     * @api
     */
    TileImage.prototype.setTileGridForProjection = function (projection, tilegrid) {
        if (_reproj_common_js__WEBPACK_IMPORTED_MODULE_0__["ENABLE_RASTER_REPROJECTION"]) {
            var proj = Object(_proj_js__WEBPACK_IMPORTED_MODULE_6__["get"])(projection);
            if (proj) {
                var projKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_1__["getUid"])(proj);
                if (!(projKey in this.tileGridForProjection)) {
                    this.tileGridForProjection[projKey] = tilegrid;
                }
            }
        }
    };
    return TileImage;
}(_UrlTile_js__WEBPACK_IMPORTED_MODULE_8__["default"]));
/**
 * @param {ImageTile} imageTile Image tile.
 * @param {string} src Source.
 */
function defaultTileLoadFunction(imageTile, src) {
    /** @type {HTMLImageElement|HTMLVideoElement} */ (imageTile.getImage()).src = src;
}
/* harmony default export */ __webpack_exports__["default"] = (TileImage);
//# sourceMappingURL=TileImage.js.map

/***/ }),

/***/ "./node_modules/ol/source/TileJSON.js":
/*!********************************************!*\
  !*** ./node_modules/ol/source/TileJSON.js ***!
  \********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../tileurlfunction.js */ "./node_modules/ol/tileurlfunction.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _net_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../net.js */ "./node_modules/ol/net.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _State_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./State.js */ "./node_modules/ol/source/State.js");
/* harmony import */ var _TileImage_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony import */ var _tilegrid_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../tilegrid.js */ "./node_modules/ol/tilegrid.js");
/**
 * @module ol/source/TileJSON
 */
// FIXME check order of async callbacks
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * See https://mapbox.com/developers/api/.
 */








/**
 * @typedef {Object} Config
 * @property {string} [name] The name.
 * @property {string} [description] The description.
 * @property {string} [version] The version.
 * @property {string} [attribution] The attribution.
 * @property {string} [template] The template.
 * @property {string} [legend] The legend.
 * @property {string} [scheme] The scheme.
 * @property {Array<string>} tiles The tile URL templates.
 * @property {Array<string>} [grids] Optional grids.
 * @property {number} [minzoom] Minimum zoom level.
 * @property {number} [maxzoom] Maximum zoom level.
 * @property {Array<number>} [bounds] Optional bounds.
 * @property {Array<number>} [center] Optional center.
 */
/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON.
 * Useful when the server does not support CORS..
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {Config} [tileJSON] TileJSON configuration for this source.
 * If not provided, `url` must be configured.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {number|import("../size.js").Size} [tileSize=[256, 256]] The tile size used by the tile service.
 * Note: `tileSize` and other non-standard TileJSON properties are currently ignored.
 * @property {string} [url] URL to the TileJSON file. If not provided, `tileJSON` must be configured.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 * @property {number} [transition] Duration of the opacity transition for rendering.
 * To disable the opacity transition, pass `transition: 0`.
 */
/**
 * @classdesc
 * Layer source for tile data in TileJSON format.
 * @api
 */
var TileJSON = /** @class */ (function (_super) {
    __extends(TileJSON, _super);
    /**
     * @param {Options} options TileJSON options.
     */
    function TileJSON(options) {
        var _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            crossOrigin: options.crossOrigin,
            projection: Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["get"])('EPSG:3857'),
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            state: _State_js__WEBPACK_IMPORTED_MODULE_5__["default"].LOADING,
            tileLoadFunction: options.tileLoadFunction,
            wrapX: options.wrapX !== undefined ? options.wrapX : true,
            transition: options.transition
        }) || this;
        /**
         * @type {Config}
         * @private
         */
        _this.tileJSON_ = null;
        /**
         * @type {number|import("../size.js").Size}
         * @private
         */
        _this.tileSize_ = options.tileSize;
        if (options.url) {
            if (options.jsonp) {
                Object(_net_js__WEBPACK_IMPORTED_MODULE_3__["jsonp"])(options.url, _this.handleTileJSONResponse.bind(_this), _this.handleTileJSONError.bind(_this));
            }
            else {
                var client = new XMLHttpRequest();
                client.addEventListener('load', _this.onXHRLoad_.bind(_this));
                client.addEventListener('error', _this.onXHRError_.bind(_this));
                client.open('GET', options.url);
                client.send();
            }
        }
        else if (options.tileJSON) {
            _this.handleTileJSONResponse(options.tileJSON);
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(false, 51); // Either `url` or `tileJSON` options must be provided
        }
        return _this;
    }
    /**
     * @private
     * @param {Event} event The load event.
     */
    TileJSON.prototype.onXHRLoad_ = function (event) {
        var client = /** @type {XMLHttpRequest} */ (event.target);
        // status will be 0 for file:// urls
        if (!client.status || client.status >= 200 && client.status < 300) {
            var response = void 0;
            try {
                response = /** @type {TileJSON} */ (JSON.parse(client.responseText));
            }
            catch (err) {
                this.handleTileJSONError();
                return;
            }
            this.handleTileJSONResponse(response);
        }
        else {
            this.handleTileJSONError();
        }
    };
    /**
     * @private
     * @param {Event} event The error event.
     */
    TileJSON.prototype.onXHRError_ = function (event) {
        this.handleTileJSONError();
    };
    /**
     * @return {Config} The tilejson object.
     * @api
     */
    TileJSON.prototype.getTileJSON = function () {
        return this.tileJSON_;
    };
    /**
     * @protected
     * @param {Config} tileJSON Tile JSON.
     */
    TileJSON.prototype.handleTileJSONResponse = function (tileJSON) {
        var epsg4326Projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["get"])('EPSG:4326');
        var sourceProjection = this.getProjection();
        var extent;
        if (tileJSON['bounds'] !== undefined) {
            var transform = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["getTransformFromProjections"])(epsg4326Projection, sourceProjection);
            extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["applyTransform"])(tileJSON['bounds'], transform);
        }
        var minZoom = tileJSON['minzoom'] || 0;
        var maxZoom = tileJSON['maxzoom'] || 22;
        var tileGrid = Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_7__["createXYZ"])({
            extent: Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_7__["extentFromProjection"])(sourceProjection),
            maxZoom: maxZoom,
            minZoom: minZoom,
            tileSize: this.tileSize_
        });
        this.tileGrid = tileGrid;
        this.tileUrlFunction = Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__["createFromTemplates"])(tileJSON['tiles'], tileGrid);
        if (tileJSON['attribution'] !== undefined && !this.getAttributions()) {
            var attributionExtent_1 = extent !== undefined ?
                extent : epsg4326Projection.getExtent();
            this.setAttributions(function (frameState) {
                if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["intersects"])(attributionExtent_1, frameState.extent)) {
                    return [tileJSON['attribution']];
                }
                return null;
            });
        }
        this.tileJSON_ = tileJSON;
        this.setState(_State_js__WEBPACK_IMPORTED_MODULE_5__["default"].READY);
    };
    /**
     * @protected
     */
    TileJSON.prototype.handleTileJSONError = function () {
        this.setState(_State_js__WEBPACK_IMPORTED_MODULE_5__["default"].ERROR);
    };
    return TileJSON;
}(_TileImage_js__WEBPACK_IMPORTED_MODULE_6__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (TileJSON);
//# sourceMappingURL=TileJSON.js.map

/***/ }),

/***/ "./node_modules/ol/source/TileWMS.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/source/TileWMS.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/ol/source/common.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _reproj_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../reproj.js */ "./node_modules/ol/reproj.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _TileImage_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony import */ var _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./WMSServerType.js */ "./node_modules/ol/source/WMSServerType.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/* harmony import */ var _string_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../string.js */ "./node_modules/ol/string.js");
/* harmony import */ var _uri_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../uri.js */ "./node_modules/ol/uri.js");
/**
 * @module ol/source/TileWMS
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();













/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {Object<string,*>} params WMS request parameters.
 * At least a `LAYERS` param is required. `STYLES` is
 * `''` by default. `VERSION` is `1.3.0` by default. `WIDTH`, `HEIGHT`, `BBOX`
 * and `CRS` (`SRS` for WMS version < 1.3.0) will be set dynamically.
 * @property {number} [gutter=0]
 * The size in pixels of the gutter around image tiles to ignore. By setting
 * this property to a non-zero value, images will be requested that are wider
 * and taller than the tile size by a value of `2 x gutter`.
 * Using a non-zero value allows artifacts of rendering at tile edges to be
 * ignored. If you control the WMS service it is recommended to address
 * "artifacts at tile edges" issues by properly configuring the WMS service. For
 * example, MapServer has a `tile_map_edge_buffer` configuration parameter for
 * this. See http://mapserver.org/output/tile_mode.html.
 * @property {boolean} [hidpi=true] Use the `ol/Map#pixelRatio` value when requesting
 * the image from the remote server.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {typeof import("../ImageTile.js").default} [tileClass] Class used to instantiate image tiles.
 * Default is {@link module:ol/ImageTile~ImageTile}.
 * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid. Base this on the resolutions,
 * tilesize and extent supported by the server.
 * If this is not defined, a default grid will be used: if there is a projection
 * extent, the grid will be based on that; if not, a grid based on a global
 * extent with origin at 0,0 will be used..
 * @property {import("./WMSServerType.js").default|string} [serverType]
 * The type of the remote WMS server. Currently only used when `hidpi` is
 * `true`.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {string} [url] WMS service URL.
 * @property {Array<string>} [urls] WMS service urls.
 * Use this instead of `url` when the WMS supports multiple urls for GetMap requests.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 * When set to `false`, only one world
 * will be rendered. When `true`, tiles will be requested for one world only,
 * but they will be wrapped horizontally to render multiple worlds.
 * @property {number} [transition] Duration of the opacity transition for rendering.
 * To disable the opacity transition, pass `transition: 0`.
 */
/**
 * @classdesc
 * Layer source for tile data from WMS servers.
 * @api
 */
var TileWMS = /** @class */ (function (_super) {
    __extends(TileWMS, _super);
    /**
     * @param {Options=} [opt_options] Tile WMS options.
     */
    function TileWMS(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : /** @type {Options} */ ({});
        var params = options.params || {};
        var transparent = 'TRANSPARENT' in params ? params['TRANSPARENT'] : true;
        _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            crossOrigin: options.crossOrigin,
            opaque: !transparent,
            projection: options.projection,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            tileClass: options.tileClass,
            tileGrid: options.tileGrid,
            tileLoadFunction: options.tileLoadFunction,
            tileUrlFunction: tileUrlFunction,
            url: options.url,
            urls: options.urls,
            wrapX: options.wrapX !== undefined ? options.wrapX : true,
            transition: options.transition
        }) || this;
        /**
         * @private
         * @type {number}
         */
        _this.gutter_ = options.gutter !== undefined ? options.gutter : 0;
        /**
         * @private
         * @type {!Object}
         */
        _this.params_ = params;
        /**
         * @private
         * @type {boolean}
         */
        _this.v13_ = true;
        /**
         * @private
         * @type {import("./WMSServerType.js").default|undefined}
         */
        _this.serverType_ = /** @type {import("./WMSServerType.js").default|undefined} */ (options.serverType);
        /**
         * @private
         * @type {boolean}
         */
        _this.hidpi_ = options.hidpi !== undefined ? options.hidpi : true;
        /**
         * @private
         * @type {import("../extent.js").Extent}
         */
        _this.tmpExtent_ = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["createEmpty"])();
        _this.updateV13_();
        _this.setKey(_this.getKeyForParams_());
        return _this;
    }
    /**
     * Return the GetFeatureInfo URL for the passed coordinate, resolution, and
     * projection. Return `undefined` if the GetFeatureInfo URL cannot be
     * constructed.
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {number} resolution Resolution.
     * @param {import("../proj.js").ProjectionLike} projection Projection.
     * @param {!Object} params GetFeatureInfo params. `INFO_FORMAT` at least should
     *     be provided. If `QUERY_LAYERS` is not provided then the layers specified
     *     in the `LAYERS` parameter will be used. `VERSION` should not be
     *     specified here.
     * @return {string|undefined} GetFeatureInfo URL.
     * @api
     */
    TileWMS.prototype.getFeatureInfoUrl = function (coordinate, resolution, projection, params) {
        var projectionObj = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["get"])(projection);
        var sourceProjectionObj = this.getProjection();
        var tileGrid = this.getTileGrid();
        if (!tileGrid) {
            tileGrid = this.getTileGridForProjection(projectionObj);
        }
        var z = tileGrid.getZForResolution(resolution, this.zDirection);
        var tileCoord = tileGrid.getTileCoordForCoordAndZ(coordinate, z);
        if (tileGrid.getResolutions().length <= tileCoord[0]) {
            return undefined;
        }
        var tileResolution = tileGrid.getResolution(tileCoord[0]);
        var tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);
        var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_7__["toSize"])(tileGrid.getTileSize(tileCoord[0]), this.tmpSize);
        var gutter = this.gutter_;
        if (gutter !== 0) {
            tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_7__["buffer"])(tileSize, gutter, this.tmpSize);
            tileExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["buffer"])(tileExtent, tileResolution * gutter, tileExtent);
        }
        if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
            tileResolution = Object(_reproj_js__WEBPACK_IMPORTED_MODULE_6__["calculateSourceResolution"])(sourceProjectionObj, projectionObj, coordinate, tileResolution);
            tileExtent = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["transformExtent"])(tileExtent, projectionObj, sourceProjectionObj);
            coordinate = Object(_proj_js__WEBPACK_IMPORTED_MODULE_5__["transform"])(coordinate, projectionObj, sourceProjectionObj);
        }
        var baseParams = {
            'SERVICE': 'WMS',
            'VERSION': _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_WMS_VERSION"],
            'REQUEST': 'GetFeatureInfo',
            'FORMAT': 'image/png',
            'TRANSPARENT': true,
            'QUERY_LAYERS': this.params_['LAYERS']
        };
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])(baseParams, this.params_, params);
        var x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution);
        var y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution);
        baseParams[this.v13_ ? 'I' : 'X'] = x;
        baseParams[this.v13_ ? 'J' : 'Y'] = y;
        return this.getRequestUrl_(tileCoord, tileSize, tileExtent, 1, sourceProjectionObj || projectionObj, baseParams);
    };
    /**
     * Return the GetLegendGraphic URL, optionally optimized for the passed
     * resolution and possibly including any passed specific parameters. Returns
     * `undefined` if the GetLegendGraphic URL cannot be constructed.
     *
     * @param {number} [resolution] Resolution. If set to undefined, `SCALE`
     *     will not be calculated and included in URL.
     * @param {Object} [params] GetLegendGraphic params. If `LAYER` is set, the
     *     request is generated for this wms layer, else it will try to use the
     *     configured wms layer. Default `FORMAT` is `image/png`.
     *     `VERSION` should not be specified here.
     * @return {string|undefined} GetLegendGraphic URL.
     * @api
     */
    TileWMS.prototype.getLegendUrl = function (resolution, params) {
        if (this.urls[0] === undefined) {
            return undefined;
        }
        var baseParams = {
            'SERVICE': 'WMS',
            'VERSION': _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_WMS_VERSION"],
            'REQUEST': 'GetLegendGraphic',
            'FORMAT': 'image/png'
        };
        if (params === undefined || params['LAYER'] === undefined) {
            var layers = this.params_.LAYERS;
            var isSingleLayer = !Array.isArray(layers) || layers.length === 1;
            if (!isSingleLayer) {
                return undefined;
            }
            baseParams['LAYER'] = layers;
        }
        if (resolution !== undefined) {
            var mpu = this.getProjection() ? this.getProjection().getMetersPerUnit() : 1;
            var dpi = 25.4 / 0.28;
            var inchesPerMeter = 39.37;
            baseParams['SCALE'] = resolution * mpu * inchesPerMeter * dpi;
        }
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])(baseParams, params);
        return Object(_uri_js__WEBPACK_IMPORTED_MODULE_12__["appendParams"])(/** @type {string} */ (this.urls[0]), baseParams);
    };
    /**
     * @inheritDoc
     */
    TileWMS.prototype.getGutter = function () {
        return this.gutter_;
    };
    /**
     * Get the user-provided params, i.e. those passed to the constructor through
     * the "params" option, and possibly updated using the updateParams method.
     * @return {Object} Params.
     * @api
     */
    TileWMS.prototype.getParams = function () {
        return this.params_;
    };
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {import("../size.js").Size} tileSize Tile size.
     * @param {import("../extent.js").Extent} tileExtent Tile extent.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @param {Object} params Params.
     * @return {string|undefined} Request URL.
     * @private
     */
    TileWMS.prototype.getRequestUrl_ = function (tileCoord, tileSize, tileExtent, pixelRatio, projection, params) {
        var urls = this.urls;
        if (!urls) {
            return undefined;
        }
        params['WIDTH'] = tileSize[0];
        params['HEIGHT'] = tileSize[1];
        params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode();
        if (!('STYLES' in this.params_)) {
            params['STYLES'] = '';
        }
        if (pixelRatio != 1) {
            switch (this.serverType_) {
                case _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__["default"].GEOSERVER:
                    var dpi = (90 * pixelRatio + 0.5) | 0;
                    if ('FORMAT_OPTIONS' in params) {
                        params['FORMAT_OPTIONS'] += ';dpi:' + dpi;
                    }
                    else {
                        params['FORMAT_OPTIONS'] = 'dpi:' + dpi;
                    }
                    break;
                case _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__["default"].MAPSERVER:
                    params['MAP_RESOLUTION'] = 90 * pixelRatio;
                    break;
                case _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__["default"].CARMENTA_SERVER:
                case _WMSServerType_js__WEBPACK_IMPORTED_MODULE_9__["default"].QGIS:
                    params['DPI'] = 90 * pixelRatio;
                    break;
                default:
                    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(false, 52); // Unknown `serverType` configured
                    break;
            }
        }
        var axisOrientation = projection.getAxisOrientation();
        var bbox = tileExtent;
        if (this.v13_ && axisOrientation.substr(0, 2) == 'ne') {
            var tmp = void 0;
            tmp = tileExtent[0];
            bbox[0] = tileExtent[1];
            bbox[1] = tmp;
            tmp = tileExtent[2];
            bbox[2] = tileExtent[3];
            bbox[3] = tmp;
        }
        params['BBOX'] = bbox.join(',');
        var url;
        if (urls.length == 1) {
            url = urls[0];
        }
        else {
            var index = Object(_math_js__WEBPACK_IMPORTED_MODULE_4__["modulo"])(Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_10__["hash"])(tileCoord), urls.length);
            url = urls[index];
        }
        return Object(_uri_js__WEBPACK_IMPORTED_MODULE_12__["appendParams"])(url, params);
    };
    /**
     * @inheritDoc
     */
    TileWMS.prototype.getTilePixelRatio = function (pixelRatio) {
        return (!this.hidpi_ || this.serverType_ === undefined) ? 1 :
            /** @type {number} */ (pixelRatio);
    };
    /**
     * @private
     * @return {string} The key for the current params.
     */
    TileWMS.prototype.getKeyForParams_ = function () {
        var i = 0;
        var res = [];
        for (var key in this.params_) {
            res[i++] = key + '-' + this.params_[key];
        }
        return res.join('/');
    };
    /**
     * Update the user-provided params.
     * @param {Object} params Params.
     * @api
     */
    TileWMS.prototype.updateParams = function (params) {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])(this.params_, params);
        this.updateV13_();
        this.setKey(this.getKeyForParams_());
    };
    /**
     * @private
     */
    TileWMS.prototype.updateV13_ = function () {
        var version = this.params_['VERSION'] || _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_WMS_VERSION"];
        this.v13_ = Object(_string_js__WEBPACK_IMPORTED_MODULE_11__["compareVersions"])(version, '1.3') >= 0;
    };
    return TileWMS;
}(_TileImage_js__WEBPACK_IMPORTED_MODULE_8__["default"]));
/**
 * @param {import("../tilecoord.js").TileCoord} tileCoord The tile coordinate
 * @param {number} pixelRatio The pixel ratio
 * @param {import("../proj/Projection.js").default} projection The projection
 * @return {string|undefined} The tile URL
 * @this {TileWMS}
 */
function tileUrlFunction(tileCoord, pixelRatio, projection) {
    var tileGrid = this.getTileGrid();
    if (!tileGrid) {
        tileGrid = this.getTileGridForProjection(projection);
    }
    if (tileGrid.getResolutions().length <= tileCoord[0]) {
        return undefined;
    }
    if (pixelRatio != 1 && (!this.hidpi_ || this.serverType_ === undefined)) {
        pixelRatio = 1;
    }
    var tileResolution = tileGrid.getResolution(tileCoord[0]);
    var tileExtent = tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);
    var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_7__["toSize"])(tileGrid.getTileSize(tileCoord[0]), this.tmpSize);
    var gutter = this.gutter_;
    if (gutter !== 0) {
        tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_7__["buffer"])(tileSize, gutter, this.tmpSize);
        tileExtent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["buffer"])(tileExtent, tileResolution * gutter, tileExtent);
    }
    if (pixelRatio != 1) {
        tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_7__["scale"])(tileSize, pixelRatio, this.tmpSize);
    }
    var baseParams = {
        'SERVICE': 'WMS',
        'VERSION': _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_WMS_VERSION"],
        'REQUEST': 'GetMap',
        'FORMAT': 'image/png',
        'TRANSPARENT': true
    };
    Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["assign"])(baseParams, this.params_);
    return this.getRequestUrl_(tileCoord, tileSize, tileExtent, pixelRatio, projection, baseParams);
}
/* harmony default export */ __webpack_exports__["default"] = (TileWMS);
//# sourceMappingURL=TileWMS.js.map

/***/ }),

/***/ "./node_modules/ol/source/UTFGrid.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/source/UTFGrid.js ***!
  \*******************************************/
/*! exports provided: CustomTile, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomTile", function() { return CustomTile; });
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Tile.js */ "./node_modules/ol/Tile.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../tileurlfunction.js */ "./node_modules/ol/tileurlfunction.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _net_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../net.js */ "./node_modules/ol/net.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _State_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./State.js */ "./node_modules/ol/source/State.js");
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Tile.js */ "./node_modules/ol/source/Tile.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/* harmony import */ var _tilegrid_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../tilegrid.js */ "./node_modules/ol/tilegrid.js");
/**
 * @module ol/source/UTFGrid
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();













/**
 * @typedef {Object} UTFGridJSON
 * @property {Array<string>} grid The grid.
 * @property {Array<string>} keys The keys.
 * @property {Object<string, Object>} [data] Optional data.
 */
var CustomTile = /** @class */ (function (_super) {
    __extends(CustomTile, _super);
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {TileState} state State.
     * @param {string} src Image source URI.
     * @param {import("../extent.js").Extent} extent Extent of the tile.
     * @param {boolean} preemptive Load the tile when visible (before it's needed).
     * @param {boolean} jsonp Load the tile as a script.
     */
    function CustomTile(tileCoord, state, src, extent, preemptive, jsonp) {
        var _this = _super.call(this, tileCoord, state) || this;
        /**
         * @private
         * @type {string}
         */
        _this.src_ = src;
        /**
         * @private
         * @type {import("../extent.js").Extent}
         */
        _this.extent_ = extent;
        /**
         * @private
         * @type {boolean}
         */
        _this.preemptive_ = preemptive;
        /**
         * @private
         * @type {Array<string>}
         */
        _this.grid_ = null;
        /**
         * @private
         * @type {Array<string>}
         */
        _this.keys_ = null;
        /**
         * @private
         * @type {Object<string, Object>|undefined}
         */
        _this.data_ = null;
        /**
         * @private
         * @type {boolean}
         */
        _this.jsonp_ = jsonp;
        return _this;
    }
    /**
     * Get the image element for this tile.
     * @return {HTMLImageElement} Image.
     */
    CustomTile.prototype.getImage = function () {
        return null;
    };
    /**
     * Synchronously returns data at given coordinate (if available).
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @return {*} The data.
     */
    CustomTile.prototype.getData = function (coordinate) {
        if (!this.grid_ || !this.keys_) {
            return null;
        }
        var xRelative = (coordinate[0] - this.extent_[0]) /
            (this.extent_[2] - this.extent_[0]);
        var yRelative = (coordinate[1] - this.extent_[1]) /
            (this.extent_[3] - this.extent_[1]);
        var row = this.grid_[Math.floor((1 - yRelative) * this.grid_.length)];
        if (typeof row !== 'string') {
            return null;
        }
        var code = row.charCodeAt(Math.floor(xRelative * row.length));
        if (code >= 93) {
            code--;
        }
        if (code >= 35) {
            code--;
        }
        code -= 32;
        var data = null;
        if (code in this.keys_) {
            var id = this.keys_[code];
            if (this.data_ && id in this.data_) {
                data = this.data_[id];
            }
            else {
                data = id;
            }
        }
        return data;
    };
    /**
     * Calls the callback (synchronously by default) with the available data
     * for given coordinate (or `null` if not yet loaded).
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {function(*): void} callback Callback.
     * @param {boolean=} opt_request If `true` the callback is always async.
     *                               The tile data is requested if not yet loaded.
     */
    CustomTile.prototype.forDataAtCoordinate = function (coordinate, callback, opt_request) {
        if (this.state == _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].EMPTY && opt_request === true) {
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE;
            Object(_events_js__WEBPACK_IMPORTED_MODULE_4__["listenOnce"])(this, _events_EventType_js__WEBPACK_IMPORTED_MODULE_5__["default"].CHANGE, function (e) {
                callback(this.getData(coordinate));
            }, this);
            this.loadInternal_();
        }
        else {
            if (opt_request === true) {
                setTimeout(function () {
                    callback(this.getData(coordinate));
                }.bind(this), 0);
            }
            else {
                callback(this.getData(coordinate));
            }
        }
    };
    /**
     * @inheritDoc
     */
    CustomTile.prototype.getKey = function () {
        return this.src_;
    };
    /**
     * @private
     */
    CustomTile.prototype.handleError_ = function () {
        this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR;
        this.changed();
    };
    /**
     * @param {!UTFGridJSON} json UTFGrid data.
     * @private
     */
    CustomTile.prototype.handleLoad_ = function (json) {
        this.grid_ = json['grid'];
        this.keys_ = json['keys'];
        this.data_ = json['data'];
        this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED;
        this.changed();
    };
    /**
     * @private
     */
    CustomTile.prototype.loadInternal_ = function () {
        if (this.state == _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE) {
            this.state = _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADING;
            if (this.jsonp_) {
                Object(_net_js__WEBPACK_IMPORTED_MODULE_7__["jsonp"])(this.src_, this.handleLoad_.bind(this), this.handleError_.bind(this));
            }
            else {
                var client = new XMLHttpRequest();
                client.addEventListener('load', this.onXHRLoad_.bind(this));
                client.addEventListener('error', this.onXHRError_.bind(this));
                client.open('GET', this.src_);
                client.send();
            }
        }
    };
    /**
     * @private
     * @param {Event} event The load event.
     */
    CustomTile.prototype.onXHRLoad_ = function (event) {
        var client = /** @type {XMLHttpRequest} */ (event.target);
        // status will be 0 for file:// urls
        if (!client.status || client.status >= 200 && client.status < 300) {
            var response = void 0;
            try {
                response = /** @type {!UTFGridJSON} */ (JSON.parse(client.responseText));
            }
            catch (err) {
                this.handleError_();
                return;
            }
            this.handleLoad_(response);
        }
        else {
            this.handleError_();
        }
    };
    /**
     * @private
     * @param {Event} event The error event.
     */
    CustomTile.prototype.onXHRError_ = function (event) {
        this.handleError_();
    };
    /**
     * @override
     */
    CustomTile.prototype.load = function () {
        if (this.preemptive_) {
            this.loadInternal_();
        }
        else {
            this.setState(_TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].EMPTY);
        }
    };
    return CustomTile;
}(_Tile_js__WEBPACK_IMPORTED_MODULE_0__["default"]));

/**
 * @typedef {Object} Options
 * @property {boolean} [preemptive=true]
 * If `true` the UTFGrid source loads the tiles based on their "visibility".
 * This improves the speed of response, but increases traffic.
 * Note that if set to `false` (lazy loading), you need to pass `true` as
 * `opt_request` to the `forDataAtCoordinateAndResolution` method otherwise no
 * data will ever be loaded.
 * @property {boolean} [jsonp=false] Use JSONP with callback to load the TileJSON.
 * Useful when the server does not support CORS..
 * @property {import("./TileJSON.js").Config} [tileJSON] TileJSON configuration for this source.
 * If not provided, `url` must be configured.
 * @property {string} [url] TileJSON endpoint that provides the configuration for this source.
 * Request will be made through JSONP. If not provided, `tileJSON` must be configured.
 */
/**
 * @classdesc
 * Layer source for UTFGrid interaction data loaded from TileJSON format.
 * @api
 */
var UTFGrid = /** @class */ (function (_super) {
    __extends(UTFGrid, _super);
    /**
     * @param {Options} options Source options.
     */
    function UTFGrid(options) {
        var _this = _super.call(this, {
            projection: Object(_proj_js__WEBPACK_IMPORTED_MODULE_8__["get"])('EPSG:3857'),
            state: _State_js__WEBPACK_IMPORTED_MODULE_9__["default"].LOADING
        }) || this;
        /**
         * @private
         * @type {boolean}
         */
        _this.preemptive_ = options.preemptive !== undefined ?
            options.preemptive : true;
        /**
         * @private
         * @type {!import("../Tile.js").UrlFunction}
         */
        _this.tileUrlFunction_ = _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_2__["nullTileUrlFunction"];
        /**
         * @private
         * @type {string|undefined}
         */
        _this.template_ = undefined;
        /**
         * @private
         * @type {boolean}
         */
        _this.jsonp_ = options.jsonp || false;
        if (options.url) {
            if (_this.jsonp_) {
                Object(_net_js__WEBPACK_IMPORTED_MODULE_7__["jsonp"])(options.url, _this.handleTileJSONResponse.bind(_this), _this.handleTileJSONError.bind(_this));
            }
            else {
                var client = new XMLHttpRequest();
                client.addEventListener('load', _this.onXHRLoad_.bind(_this));
                client.addEventListener('error', _this.onXHRError_.bind(_this));
                client.open('GET', options.url);
                client.send();
            }
        }
        else if (options.tileJSON) {
            _this.handleTileJSONResponse(options.tileJSON);
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_3__["assert"])(false, 51); // Either `url` or `tileJSON` options must be provided
        }
        return _this;
    }
    /**
     * @private
     * @param {Event} event The load event.
     */
    UTFGrid.prototype.onXHRLoad_ = function (event) {
        var client = /** @type {XMLHttpRequest} */ (event.target);
        // status will be 0 for file:// urls
        if (!client.status || client.status >= 200 && client.status < 300) {
            var response = void 0;
            try {
                response = /** @type {import("./TileJSON.js").Config} */ (JSON.parse(client.responseText));
            }
            catch (err) {
                this.handleTileJSONError();
                return;
            }
            this.handleTileJSONResponse(response);
        }
        else {
            this.handleTileJSONError();
        }
    };
    /**
     * @private
     * @param {Event} event The error event.
     */
    UTFGrid.prototype.onXHRError_ = function (event) {
        this.handleTileJSONError();
    };
    /**
     * Return the template from TileJSON.
     * @return {string|undefined} The template from TileJSON.
     * @api
     */
    UTFGrid.prototype.getTemplate = function () {
        return this.template_;
    };
    /**
     * Calls the callback (synchronously by default) with the available data
     * for given coordinate and resolution (or `null` if not yet loaded or
     * in case of an error).
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {number} resolution Resolution.
     * @param {function(*): void} callback Callback.
     * @param {boolean=} opt_request If `true` the callback is always async.
     *                               The tile data is requested if not yet loaded.
     * @api
     */
    UTFGrid.prototype.forDataAtCoordinateAndResolution = function (coordinate, resolution, callback, opt_request) {
        if (this.tileGrid) {
            var z = this.tileGrid.getZForResolution(resolution, this.zDirection);
            var tileCoord = this.tileGrid.getTileCoordForCoordAndZ(coordinate, z);
            var tile = /** @type {!CustomTile} */ (this.getTile(tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection()));
            tile.forDataAtCoordinate(coordinate, callback, opt_request);
        }
        else {
            if (opt_request === true) {
                setTimeout(function () {
                    callback(null);
                }, 0);
            }
            else {
                callback(null);
            }
        }
    };
    /**
     * @protected
     */
    UTFGrid.prototype.handleTileJSONError = function () {
        this.setState(_State_js__WEBPACK_IMPORTED_MODULE_9__["default"].ERROR);
    };
    /**
     * TODO: very similar to ol/source/TileJSON#handleTileJSONResponse
     * @protected
     * @param {import("./TileJSON.js").Config} tileJSON Tile JSON.
     */
    UTFGrid.prototype.handleTileJSONResponse = function (tileJSON) {
        var epsg4326Projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_8__["get"])('EPSG:4326');
        var sourceProjection = this.getProjection();
        var extent;
        if (tileJSON['bounds'] !== undefined) {
            var transform = Object(_proj_js__WEBPACK_IMPORTED_MODULE_8__["getTransformFromProjections"])(epsg4326Projection, sourceProjection);
            extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["applyTransform"])(tileJSON['bounds'], transform);
        }
        var minZoom = tileJSON['minzoom'] || 0;
        var maxZoom = tileJSON['maxzoom'] || 22;
        var tileGrid = Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_12__["createXYZ"])({
            extent: Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_12__["extentFromProjection"])(sourceProjection),
            maxZoom: maxZoom,
            minZoom: minZoom
        });
        this.tileGrid = tileGrid;
        this.template_ = tileJSON['template'];
        var grids = tileJSON['grids'];
        if (!grids) {
            this.setState(_State_js__WEBPACK_IMPORTED_MODULE_9__["default"].ERROR);
            return;
        }
        this.tileUrlFunction_ = Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_2__["createFromTemplates"])(grids, tileGrid);
        if (tileJSON['attribution'] !== undefined) {
            var attributionExtent_1 = extent !== undefined ?
                extent : epsg4326Projection.getExtent();
            this.setAttributions(function (frameState) {
                if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_6__["intersects"])(attributionExtent_1, frameState.extent)) {
                    return [tileJSON['attribution']];
                }
                return null;
            });
        }
        this.setState(_State_js__WEBPACK_IMPORTED_MODULE_9__["default"].READY);
    };
    /**
     * @inheritDoc
     */
    UTFGrid.prototype.getTile = function (z, x, y, pixelRatio, projection) {
        var tileCoordKey = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_11__["getKeyZXY"])(z, x, y);
        if (this.tileCache.containsKey(tileCoordKey)) {
            return (
            /** @type {!import("../Tile.js").default} */ (this.tileCache.get(tileCoordKey)));
        }
        else {
            var tileCoord = [z, x, y];
            var urlTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection);
            var tileUrl = this.tileUrlFunction_(urlTileCoord, pixelRatio, projection);
            var tile = new CustomTile(tileCoord, tileUrl !== undefined ? _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE : _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].EMPTY, tileUrl !== undefined ? tileUrl : '', this.tileGrid.getTileCoordExtent(tileCoord), this.preemptive_, this.jsonp_);
            this.tileCache.set(tileCoordKey, tile);
            return tile;
        }
    };
    /**
     * @inheritDoc
     */
    UTFGrid.prototype.useTile = function (z, x, y) {
        var tileCoordKey = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_11__["getKeyZXY"])(z, x, y);
        if (this.tileCache.containsKey(tileCoordKey)) {
            this.tileCache.get(tileCoordKey);
        }
    };
    return UTFGrid;
}(_Tile_js__WEBPACK_IMPORTED_MODULE_10__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (UTFGrid);
//# sourceMappingURL=UTFGrid.js.map

/***/ }),

/***/ "./node_modules/ol/source/UrlTile.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/source/UrlTile.js ***!
  \*******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../tileurlfunction.js */ "./node_modules/ol/tileurlfunction.js");
/* harmony import */ var _Tile_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Tile.js */ "./node_modules/ol/source/Tile.js");
/* harmony import */ var _TileEventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TileEventType.js */ "./node_modules/ol/source/TileEventType.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/source/UrlTile
 */






/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions]
 * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
 * @property {number} [cacheSize]
 * @property {boolean} [opaque]
 * @property {import("../proj.js").ProjectionLike} [projection]
 * @property {import("./State.js").default} [state]
 * @property {import("../tilegrid/TileGrid.js").default} [tileGrid]
 * @property {import("../Tile.js").LoadFunction} tileLoadFunction
 * @property {number} [tilePixelRatio]
 * @property {import("../Tile.js").UrlFunction} [tileUrlFunction]
 * @property {string} [url]
 * @property {Array<string>} [urls]
 * @property {boolean} [wrapX=true]
 * @property {number} [transition]
 * @property {string} [key]
 * @property {number} [zDirection=0]
 */
/**
 * @classdesc
 * Base class for sources providing tiles divided into a tile grid over http.
 *
 * @fires import("./Tile.js").TileSourceEvent
 */
var UrlTile = /** @class */ (function (_super) {
    __extends(UrlTile, _super);
    /**
     * @param {Options} options Image tile options.
     */
    function UrlTile(options) {
        var _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            opaque: options.opaque,
            projection: options.projection,
            state: options.state,
            tileGrid: options.tileGrid,
            tilePixelRatio: options.tilePixelRatio,
            wrapX: options.wrapX,
            transition: options.transition,
            key: options.key,
            attributionsCollapsible: options.attributionsCollapsible,
            zDirection: options.zDirection
        }) || this;
        /**
         * @private
         * @type {boolean}
         */
        _this.generateTileUrlFunction_ = !options.tileUrlFunction;
        /**
         * @protected
         * @type {import("../Tile.js").LoadFunction}
         */
        _this.tileLoadFunction = options.tileLoadFunction;
        /**
         * @protected
         * @type {import("../Tile.js").UrlFunction}
         */
        _this.tileUrlFunction = options.tileUrlFunction ? options.tileUrlFunction.bind(_this) : _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_2__["nullTileUrlFunction"];
        /**
         * @protected
         * @type {!Array<string>|null}
         */
        _this.urls = null;
        if (options.urls) {
            _this.setUrls(options.urls);
        }
        else if (options.url) {
            _this.setUrl(options.url);
        }
        /**
         * @private
         * @type {!Object<string, boolean>}
         */
        _this.tileLoadingKeys_ = {};
        return _this;
    }
    /**
     * Return the tile load function of the source.
     * @return {import("../Tile.js").LoadFunction} TileLoadFunction
     * @api
     */
    UrlTile.prototype.getTileLoadFunction = function () {
        return this.tileLoadFunction;
    };
    /**
     * Return the tile URL function of the source.
     * @return {import("../Tile.js").UrlFunction} TileUrlFunction
     * @api
     */
    UrlTile.prototype.getTileUrlFunction = function () {
        return this.tileUrlFunction;
    };
    /**
     * Return the URLs used for this source.
     * When a tileUrlFunction is used instead of url or urls,
     * null will be returned.
     * @return {!Array<string>|null} URLs.
     * @api
     */
    UrlTile.prototype.getUrls = function () {
        return this.urls;
    };
    /**
     * Handle tile change events.
     * @param {import("../events/Event.js").default} event Event.
     * @protected
     */
    UrlTile.prototype.handleTileChange = function (event) {
        var tile = /** @type {import("../Tile.js").default} */ (event.target);
        var uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(tile);
        var tileState = tile.getState();
        var type;
        if (tileState == _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADING) {
            this.tileLoadingKeys_[uid] = true;
            type = _TileEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].TILELOADSTART;
        }
        else if (uid in this.tileLoadingKeys_) {
            delete this.tileLoadingKeys_[uid];
            type = tileState == _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR ? _TileEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].TILELOADERROR :
                tileState == _TileState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED ?
                    _TileEventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].TILELOADEND : undefined;
        }
        if (type != undefined) {
            this.dispatchEvent(new _Tile_js__WEBPACK_IMPORTED_MODULE_3__["TileSourceEvent"](type, tile));
        }
    };
    /**
     * Set the tile load function of the source.
     * @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
     * @api
     */
    UrlTile.prototype.setTileLoadFunction = function (tileLoadFunction) {
        this.tileCache.clear();
        this.tileLoadFunction = tileLoadFunction;
        this.changed();
    };
    /**
     * Set the tile URL function of the source.
     * @param {import("../Tile.js").UrlFunction} tileUrlFunction Tile URL function.
     * @param {string=} key Optional new tile key for the source.
     * @api
     */
    UrlTile.prototype.setTileUrlFunction = function (tileUrlFunction, key) {
        this.tileUrlFunction = tileUrlFunction;
        this.tileCache.pruneExceptNewestZ();
        if (typeof key !== 'undefined') {
            this.setKey(key);
        }
        else {
            this.changed();
        }
    };
    /**
     * Set the URL to use for requests.
     * @param {string} url URL.
     * @api
     */
    UrlTile.prototype.setUrl = function (url) {
        var urls = Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_2__["expandUrl"])(url);
        this.urls = urls;
        this.setUrls(urls);
    };
    /**
     * Set the URLs to use for requests.
     * @param {Array<string>} urls URLs.
     * @api
     */
    UrlTile.prototype.setUrls = function (urls) {
        this.urls = urls;
        var key = urls.join('\n');
        if (this.generateTileUrlFunction_) {
            this.setTileUrlFunction(Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_2__["createFromTemplates"])(urls, this.tileGrid), key);
        }
        else {
            this.setKey(key);
        }
    };
    /**
     * @inheritDoc
     */
    UrlTile.prototype.useTile = function (z, x, y) {
        var tileCoordKey = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_5__["getKeyZXY"])(z, x, y);
        if (this.tileCache.containsKey(tileCoordKey)) {
            this.tileCache.get(tileCoordKey);
        }
    };
    return UrlTile;
}(_Tile_js__WEBPACK_IMPORTED_MODULE_3__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (UrlTile);
//# sourceMappingURL=UrlTile.js.map

/***/ }),

/***/ "./node_modules/ol/source/Vector.js":
/*!******************************************!*\
  !*** ./node_modules/ol/source/Vector.js ***!
  \******************************************/
/*! exports provided: VectorSourceEvent, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VectorSourceEvent", function() { return VectorSourceEvent; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Collection_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var _CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../CollectionEventType.js */ "./node_modules/ol/CollectionEventType.js");
/* harmony import */ var _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ObjectEventType.js */ "./node_modules/ol/ObjectEventType.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../events.js */ "./node_modules/ol/events.js");
/* harmony import */ var _events_Event_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _featureloader_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../featureloader.js */ "./node_modules/ol/featureloader.js");
/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../functions.js */ "./node_modules/ol/functions.js");
/* harmony import */ var _loadingstrategy_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../loadingstrategy.js */ "./node_modules/ol/loadingstrategy.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _Source_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Source.js */ "./node_modules/ol/source/Source.js");
/* harmony import */ var _State_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./State.js */ "./node_modules/ol/source/State.js");
/* harmony import */ var _VectorEventType_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./VectorEventType.js */ "./node_modules/ol/source/VectorEventType.js");
/* harmony import */ var _structs_RBush_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../structs/RBush.js */ "./node_modules/ol/structs/RBush.js");
/**
 * @module ol/source/Vector
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();


















/**
 * A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and
 * returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this
 * is one of the standard {@link module:ol/loadingstrategy} strategies.
 *
 * @typedef {function(import("../extent.js").Extent, number): Array<import("../extent.js").Extent>} LoadingStrategy
 * @api
 */
/**
 * @classdesc
 * Events emitted by {@link module:ol/source/Vector} instances are instances of this
 * type.
 * @template {import("../geom/Geometry.js").default} Geometry
 */
var VectorSourceEvent = /** @class */ (function (_super) {
    __extends(VectorSourceEvent, _super);
    /**
     * @param {string} type Type.
     * @param {import("../Feature.js").default<Geometry>=} opt_feature Feature.
     */
    function VectorSourceEvent(type, opt_feature) {
        var _this = _super.call(this, type) || this;
        /**
         * The feature being added or removed.
         * @type {import("../Feature.js").default<Geometry>|undefined}
         * @api
         */
        _this.feature = opt_feature;
        return _this;
    }
    return VectorSourceEvent;
}(_events_Event_js__WEBPACK_IMPORTED_MODULE_7__["default"]));

/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {Array<import("../Feature.js").default>|Collection<import("../Feature.js").default>} [features]
 * Features. If provided as {@link module:ol/Collection}, the features in the source
 * and the collection will stay in sync.
 * @property {import("../format/Feature.js").default} [format] The feature format used by the XHR
 * feature loader when `url` is set. Required if `url` is set, otherwise ignored.
 * @property {import("../featureloader.js").FeatureLoader} [loader]
 * The loader function used to load features, from a remote source for example.
 * If this is not set and `url` is set, the source will create and use an XHR
 * feature loader.
 *
 * Example:
 *
 * ```js
 * import {Vector} from 'ol/source';
 * import {GeoJSON} from 'ol/format';
 * import {bbox} from 'ol/loadingstrategy';
 *
 * var vectorSource = new Vector({
 *   format: new GeoJSON(),
 *   loader: function(extent, resolution, projection) {
 *      var proj = projection.getCode();
 *      var url = 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
 *          'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
 *          'outputFormat=application/json&srsname=' + proj + '&' +
 *          'bbox=' + extent.join(',') + ',' + proj;
 *      var xhr = new XMLHttpRequest();
 *      xhr.open('GET', url);
 *      var onError = function() {
 *        vectorSource.removeLoadedExtent(extent);
 *      }
 *      xhr.onerror = onError;
 *      xhr.onload = function() {
 *        if (xhr.status == 200) {
 *          vectorSource.addFeatures(
 *              vectorSource.getFormat().readFeatures(xhr.responseText));
 *        } else {
 *          onError();
 *        }
 *      }
 *      xhr.send();
 *    },
 *    strategy: bbox
 *  });
 * ```
 * @property {boolean} [overlaps=true] This source may have overlapping geometries.
 * Setting this to `false` (e.g. for sources with polygons that represent administrative
 * boundaries or TopoJSON sources) allows the renderer to optimise fill and
 * stroke operations.
 * @property {LoadingStrategy} [strategy] The loading strategy to use.
 * By default an {@link module:ol/loadingstrategy~all}
 * strategy is used, a one-off strategy which loads all features at once.
 * @property {string|import("../featureloader.js").FeatureUrlFunction} [url]
 * Setting this option instructs the source to load features using an XHR loader
 * (see {@link module:ol/featureloader~xhr}). Use a `string` and an
 * {@link module:ol/loadingstrategy~all} for a one-off download of all features from
 * the given URL. Use a {@link module:ol/featureloader~FeatureUrlFunction} to generate the url with
 * other loading strategies.
 * Requires `format` to be set as well.
 * When default XHR feature loader is provided, the features will
 * be transformed from the data projection to the view projection
 * during parsing. If your remote data source does not advertise its projection
 * properly, this transformation will be incorrect. For some formats, the
 * default projection (usually EPSG:4326) can be overridden by setting the
 * dataProjection constructor option on the format.
 * Note that if a source contains non-feature data, such as a GeoJSON geometry
 * or a KML NetworkLink, these will be ignored. Use a custom loader to load these.
 * @property {boolean} [useSpatialIndex=true]
 * By default, an RTree is used as spatial index. When features are removed and
 * added frequently, and the total number of features is low, setting this to
 * `false` may improve performance.
 *
 * Note that
 * {@link module:ol/source/Vector~VectorSource#getFeaturesInExtent},
 * {@link module:ol/source/Vector~VectorSource#getClosestFeatureToCoordinate} and
 * {@link module:ol/source/Vector~VectorSource#getExtent} cannot be used when `useSpatialIndex` is
 * set to `false`, and {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent} will loop
 * through all features.
 *
 * When set to `false`, the features will be maintained in an
 * {@link module:ol/Collection}, which can be retrieved through
 * {@link module:ol/source/Vector~VectorSource#getFeaturesCollection}.
 * @property {boolean} [wrapX=true] Wrap the world horizontally. For vector editing across the
 * -180° and 180° meridians to work properly, this should be set to `false`. The
 * resulting geometry coordinates will then exceed the world bounds.
 */
/**
 * @classdesc
 * Provides a source of features for vector layers. Vector features provided
 * by this source are suitable for editing. See {@link module:ol/source/VectorTile~VectorTile} for
 * vector data that is optimized for rendering.
 *
 * @fires VectorSourceEvent
 * @api
 * @template {import("../geom/Geometry.js").default} Geometry
 */
var VectorSource = /** @class */ (function (_super) {
    __extends(VectorSource, _super);
    /**
     * @param {Options=} opt_options Vector source options.
     */
    function VectorSource(opt_options) {
        var _this = this;
        var options = opt_options || {};
        _this = _super.call(this, {
            attributions: options.attributions,
            projection: undefined,
            state: _State_js__WEBPACK_IMPORTED_MODULE_15__["default"].READY,
            wrapX: options.wrapX !== undefined ? options.wrapX : true
        }) || this;
        /**
         * @private
         * @type {import("../featureloader.js").FeatureLoader}
         */
        _this.loader_ = _functions_js__WEBPACK_IMPORTED_MODULE_11__["VOID"];
        /**
         * @private
         * @type {import("../format/Feature.js").default|undefined}
         */
        _this.format_ = options.format;
        /**
         * @private
         * @type {boolean}
         */
        _this.overlaps_ = options.overlaps === undefined ? true : options.overlaps;
        /**
         * @private
         * @type {string|import("../featureloader.js").FeatureUrlFunction|undefined}
         */
        _this.url_ = options.url;
        if (options.loader !== undefined) {
            _this.loader_ = options.loader;
        }
        else if (_this.url_ !== undefined) {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_5__["assert"])(_this.format_, 7); // `format` must be set when `url` is set
            // create a XHR feature loader for "url" and "format"
            _this.loader_ = Object(_featureloader_js__WEBPACK_IMPORTED_MODULE_10__["xhr"])(_this.url_, /** @type {import("../format/Feature.js").default} */ (_this.format_));
        }
        /**
         * @private
         * @type {LoadingStrategy}
         */
        _this.strategy_ = options.strategy !== undefined ? options.strategy : _loadingstrategy_js__WEBPACK_IMPORTED_MODULE_12__["all"];
        var useSpatialIndex = options.useSpatialIndex !== undefined ? options.useSpatialIndex : true;
        /**
         * @private
         * @type {RBush<import("../Feature.js").default<Geometry>>}
         */
        _this.featuresRtree_ = useSpatialIndex ? new _structs_RBush_js__WEBPACK_IMPORTED_MODULE_17__["default"]() : null;
        /**
         * @private
         * @type {RBush<{extent: import("../extent.js").Extent}>}
         */
        _this.loadedExtentsRtree_ = new _structs_RBush_js__WEBPACK_IMPORTED_MODULE_17__["default"]();
        /**
         * @private
         * @type {!Object<string, import("../Feature.js").default<Geometry>>}
         */
        _this.nullGeometryFeatures_ = {};
        /**
         * A lookup of features by id (the return from feature.getId()).
         * @private
         * @type {!Object<string, import("../Feature.js").default<Geometry>>}
         */
        _this.idIndex_ = {};
        /**
         * A lookup of features by uid (using getUid(feature)).
         * @private
         * @type {!Object<string, import("../Feature.js").default<Geometry>>}
         */
        _this.uidIndex_ = {};
        /**
         * @private
         * @type {Object<string, Array<import("../events.js").EventsKey>>}
         */
        _this.featureChangeKeys_ = {};
        /**
         * @private
         * @type {Collection<import("../Feature.js").default<Geometry>>}
         */
        _this.featuresCollection_ = null;
        var collection, features;
        if (Array.isArray(options.features)) {
            features = options.features;
        }
        else if (options.features) {
            collection = options.features;
            features = collection.getArray();
        }
        if (!useSpatialIndex && collection === undefined) {
            collection = new _Collection_js__WEBPACK_IMPORTED_MODULE_1__["default"](features);
        }
        if (features !== undefined) {
            _this.addFeaturesInternal(features);
        }
        if (collection !== undefined) {
            _this.bindFeaturesCollection_(collection);
        }
        return _this;
    }
    /**
     * Add a single feature to the source.  If you want to add a batch of features
     * at once, call {@link module:ol/source/Vector~VectorSource#addFeatures #addFeatures()}
     * instead. A feature will not be added to the source if feature with
     * the same id is already there. The reason for this behavior is to avoid
     * feature duplication when using bbox or tile loading strategies.
     * Note: this also applies if an {@link module:ol/Collection} is used for features,
     * meaning that if a feature with a duplicate id is added in the collection, it will
     * be removed from it right away.
     * @param {import("../Feature.js").default<Geometry>} feature Feature to add.
     * @api
     */
    VectorSource.prototype.addFeature = function (feature) {
        this.addFeatureInternal(feature);
        this.changed();
    };
    /**
     * Add a feature without firing a `change` event.
     * @param {import("../Feature.js").default<Geometry>} feature Feature.
     * @protected
     */
    VectorSource.prototype.addFeatureInternal = function (feature) {
        var featureKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
        if (!this.addToIndex_(featureKey, feature)) {
            if (this.featuresCollection_) {
                this.featuresCollection_.remove(feature);
            }
            return;
        }
        this.setupChangeEvents_(featureKey, feature);
        var geometry = feature.getGeometry();
        if (geometry) {
            var extent = geometry.getExtent();
            if (this.featuresRtree_) {
                this.featuresRtree_.insert(extent, feature);
            }
        }
        else {
            this.nullGeometryFeatures_[featureKey] = feature;
        }
        this.dispatchEvent(new VectorSourceEvent(_VectorEventType_js__WEBPACK_IMPORTED_MODULE_16__["default"].ADDFEATURE, feature));
    };
    /**
     * @param {string} featureKey Unique identifier for the feature.
     * @param {import("../Feature.js").default<Geometry>} feature The feature.
     * @private
     */
    VectorSource.prototype.setupChangeEvents_ = function (featureKey, feature) {
        this.featureChangeKeys_[featureKey] = [
            Object(_events_js__WEBPACK_IMPORTED_MODULE_6__["listen"])(feature, _events_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].CHANGE, this.handleFeatureChange_, this),
            Object(_events_js__WEBPACK_IMPORTED_MODULE_6__["listen"])(feature, _ObjectEventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].PROPERTYCHANGE, this.handleFeatureChange_, this)
        ];
    };
    /**
     * @param {string} featureKey Unique identifier for the feature.
     * @param {import("../Feature.js").default<Geometry>} feature The feature.
     * @return {boolean} The feature is "valid", in the sense that it is also a
     *     candidate for insertion into the Rtree.
     * @private
     */
    VectorSource.prototype.addToIndex_ = function (featureKey, feature) {
        var valid = true;
        var id = feature.getId();
        if (id !== undefined) {
            if (!(id.toString() in this.idIndex_)) {
                this.idIndex_[id.toString()] = feature;
            }
            else {
                valid = false;
            }
        }
        if (valid) {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_5__["assert"])(!(featureKey in this.uidIndex_), 30); // The passed `feature` was already added to the source
            this.uidIndex_[featureKey] = feature;
        }
        return valid;
    };
    /**
     * Add a batch of features to the source.
     * @param {Array<import("../Feature.js").default<Geometry>>} features Features to add.
     * @api
     */
    VectorSource.prototype.addFeatures = function (features) {
        this.addFeaturesInternal(features);
        this.changed();
    };
    /**
     * Add features without firing a `change` event.
     * @param {Array<import("../Feature.js").default<Geometry>>} features Features.
     * @protected
     */
    VectorSource.prototype.addFeaturesInternal = function (features) {
        var extents = [];
        var newFeatures = [];
        var geometryFeatures = [];
        for (var i = 0, length_1 = features.length; i < length_1; i++) {
            var feature = features[i];
            var featureKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
            if (this.addToIndex_(featureKey, feature)) {
                newFeatures.push(feature);
            }
        }
        for (var i = 0, length_2 = newFeatures.length; i < length_2; i++) {
            var feature = newFeatures[i];
            var featureKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
            this.setupChangeEvents_(featureKey, feature);
            var geometry = feature.getGeometry();
            if (geometry) {
                var extent = geometry.getExtent();
                extents.push(extent);
                geometryFeatures.push(feature);
            }
            else {
                this.nullGeometryFeatures_[featureKey] = feature;
            }
        }
        if (this.featuresRtree_) {
            this.featuresRtree_.load(extents, geometryFeatures);
        }
        for (var i = 0, length_3 = newFeatures.length; i < length_3; i++) {
            this.dispatchEvent(new VectorSourceEvent(_VectorEventType_js__WEBPACK_IMPORTED_MODULE_16__["default"].ADDFEATURE, newFeatures[i]));
        }
    };
    /**
     * @param {!Collection<import("../Feature.js").default<Geometry>>} collection Collection.
     * @private
     */
    VectorSource.prototype.bindFeaturesCollection_ = function (collection) {
        var modifyingCollection = false;
        this.addEventListener(_VectorEventType_js__WEBPACK_IMPORTED_MODULE_16__["default"].ADDFEATURE, 
        /**
         * @param {VectorSourceEvent<Geometry>} evt The vector source event
         */
        function (evt) {
            if (!modifyingCollection) {
                modifyingCollection = true;
                collection.push(evt.feature);
                modifyingCollection = false;
            }
        });
        this.addEventListener(_VectorEventType_js__WEBPACK_IMPORTED_MODULE_16__["default"].REMOVEFEATURE, 
        /**
         * @param {VectorSourceEvent<Geometry>} evt The vector source event
         */
        function (evt) {
            if (!modifyingCollection) {
                modifyingCollection = true;
                collection.remove(evt.feature);
                modifyingCollection = false;
            }
        });
        collection.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].ADD, 
        /**
         * @param {import("../Collection.js").CollectionEvent} evt The collection event
         */
        function (evt) {
            if (!modifyingCollection) {
                modifyingCollection = true;
                this.addFeature(/** @type {import("../Feature.js").default<Geometry>} */ (evt.element));
                modifyingCollection = false;
            }
        }.bind(this));
        collection.addEventListener(_CollectionEventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].REMOVE, 
        /**
         * @param {import("../Collection.js").CollectionEvent} evt The collection event
         */
        function (evt) {
            if (!modifyingCollection) {
                modifyingCollection = true;
                this.removeFeature(/** @type {import("../Feature.js").default<Geometry>} */ (evt.element));
                modifyingCollection = false;
            }
        }.bind(this));
        this.featuresCollection_ = collection;
    };
    /**
     * Remove all features from the source.
     * @param {boolean=} opt_fast Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#removefeature} events.
     * @api
     */
    VectorSource.prototype.clear = function (opt_fast) {
        if (opt_fast) {
            for (var featureId in this.featureChangeKeys_) {
                var keys = this.featureChangeKeys_[featureId];
                keys.forEach(_events_js__WEBPACK_IMPORTED_MODULE_6__["unlistenByKey"]);
            }
            if (!this.featuresCollection_) {
                this.featureChangeKeys_ = {};
                this.idIndex_ = {};
                this.uidIndex_ = {};
            }
        }
        else {
            if (this.featuresRtree_) {
                this.featuresRtree_.forEach(this.removeFeatureInternal.bind(this));
                for (var id in this.nullGeometryFeatures_) {
                    this.removeFeatureInternal(this.nullGeometryFeatures_[id]);
                }
            }
        }
        if (this.featuresCollection_) {
            this.featuresCollection_.clear();
        }
        if (this.featuresRtree_) {
            this.featuresRtree_.clear();
        }
        this.nullGeometryFeatures_ = {};
        var clearEvent = new VectorSourceEvent(_VectorEventType_js__WEBPACK_IMPORTED_MODULE_16__["default"].CLEAR);
        this.dispatchEvent(clearEvent);
        this.changed();
    };
    /**
     * Iterate through all features on the source, calling the provided callback
     * with each one.  If the callback returns any "truthy" value, iteration will
     * stop and the function will return the same value.
     * Note: this function only iterate through the feature that have a defined geometry.
     *
     * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
     *     on the source.  Return a truthy value to stop iteration.
     * @return {T|undefined} The return value from the last call to the callback.
     * @template T
     * @api
     */
    VectorSource.prototype.forEachFeature = function (callback) {
        if (this.featuresRtree_) {
            return this.featuresRtree_.forEach(callback);
        }
        else if (this.featuresCollection_) {
            this.featuresCollection_.forEach(callback);
        }
    };
    /**
     * Iterate through all features whose geometries contain the provided
     * coordinate, calling the callback with each feature.  If the callback returns
     * a "truthy" value, iteration will stop and the function will return the same
     * value.
     *
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
     *     whose goemetry contains the provided coordinate.
     * @return {T|undefined} The return value from the last call to the callback.
     * @template T
     */
    VectorSource.prototype.forEachFeatureAtCoordinateDirect = function (coordinate, callback) {
        var extent = [coordinate[0], coordinate[1], coordinate[0], coordinate[1]];
        return this.forEachFeatureInExtent(extent, function (feature) {
            var geometry = feature.getGeometry();
            if (geometry.intersectsCoordinate(coordinate)) {
                return callback(feature);
            }
            else {
                return undefined;
            }
        });
    };
    /**
     * Iterate through all features whose bounding box intersects the provided
     * extent (note that the feature's geometry may not intersect the extent),
     * calling the callback with each feature.  If the callback returns a "truthy"
     * value, iteration will stop and the function will return the same value.
     *
     * If you are interested in features whose geometry intersects an extent, call
     * the {@link module:ol/source/Vector~VectorSource#forEachFeatureIntersectingExtent #forEachFeatureIntersectingExtent()} method instead.
     *
     * When `useSpatialIndex` is set to false, this method will loop through all
     * features, equivalent to {@link module:ol/source/Vector~VectorSource#forEachFeature #forEachFeature()}.
     *
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
     *     whose bounding box intersects the provided extent.
     * @return {T|undefined} The return value from the last call to the callback.
     * @template T
     * @api
     */
    VectorSource.prototype.forEachFeatureInExtent = function (extent, callback) {
        if (this.featuresRtree_) {
            return this.featuresRtree_.forEachInExtent(extent, callback);
        }
        else if (this.featuresCollection_) {
            this.featuresCollection_.forEach(callback);
        }
    };
    /**
     * Iterate through all features whose geometry intersects the provided extent,
     * calling the callback with each feature.  If the callback returns a "truthy"
     * value, iteration will stop and the function will return the same value.
     *
     * If you only want to test for bounding box intersection, call the
     * {@link module:ol/source/Vector~VectorSource#forEachFeatureInExtent #forEachFeatureInExtent()} method instead.
     *
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {function(import("../Feature.js").default<Geometry>): T} callback Called with each feature
     *     whose geometry intersects the provided extent.
     * @return {T|undefined} The return value from the last call to the callback.
     * @template T
     * @api
     */
    VectorSource.prototype.forEachFeatureIntersectingExtent = function (extent, callback) {
        return this.forEachFeatureInExtent(extent, 
        /**
         * @param {import("../Feature.js").default<Geometry>} feature Feature.
         * @return {T|undefined} The return value from the last call to the callback.
         */
        function (feature) {
            var geometry = feature.getGeometry();
            if (geometry.intersectsExtent(extent)) {
                var result = callback(feature);
                if (result) {
                    return result;
                }
            }
        });
    };
    /**
     * Get the features collection associated with this source. Will be `null`
     * unless the source was configured with `useSpatialIndex` set to `false`, or
     * with an {@link module:ol/Collection} as `features`.
     * @return {Collection<import("../Feature.js").default<Geometry>>} The collection of features.
     * @api
     */
    VectorSource.prototype.getFeaturesCollection = function () {
        return this.featuresCollection_;
    };
    /**
     * Get all features on the source in random order.
     * @return {Array<import("../Feature.js").default<Geometry>>} Features.
     * @api
     */
    VectorSource.prototype.getFeatures = function () {
        var features;
        if (this.featuresCollection_) {
            features = this.featuresCollection_.getArray();
        }
        else if (this.featuresRtree_) {
            features = this.featuresRtree_.getAll();
            if (!Object(_obj_js__WEBPACK_IMPORTED_MODULE_13__["isEmpty"])(this.nullGeometryFeatures_)) {
                Object(_array_js__WEBPACK_IMPORTED_MODULE_4__["extend"])(features, Object(_obj_js__WEBPACK_IMPORTED_MODULE_13__["getValues"])(this.nullGeometryFeatures_));
            }
        }
        return (
        /** @type {Array<import("../Feature.js").default<Geometry>>} */ (features));
    };
    /**
     * Get all features whose geometry intersects the provided coordinate.
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @return {Array<import("../Feature.js").default<Geometry>>} Features.
     * @api
     */
    VectorSource.prototype.getFeaturesAtCoordinate = function (coordinate) {
        var features = [];
        this.forEachFeatureAtCoordinateDirect(coordinate, function (feature) {
            features.push(feature);
        });
        return features;
    };
    /**
     * Get all features whose bounding box intersects the provided extent.  Note that this returns an array of
     * all features intersecting the given extent in random order (so it may include
     * features whose geometries do not intersect the extent).
     *
     * When `useSpatialIndex` is set to false, this method will return all
     * features.
     *
     * @param {import("../extent.js").Extent} extent Extent.
     * @return {Array<import("../Feature.js").default<Geometry>>} Features.
     * @api
     */
    VectorSource.prototype.getFeaturesInExtent = function (extent) {
        if (this.featuresRtree_) {
            return this.featuresRtree_.getInExtent(extent);
        }
        else if (this.featuresCollection_) {
            return this.featuresCollection_.getArray();
        }
        else {
            return [];
        }
    };
    /**
     * Get the closest feature to the provided coordinate.
     *
     * This method is not available when the source is configured with
     * `useSpatialIndex` set to `false`.
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {function(import("../Feature.js").default<Geometry>):boolean=} opt_filter Feature filter function.
     *     The filter function will receive one argument, the {@link module:ol/Feature feature}
     *     and it should return a boolean value. By default, no filtering is made.
     * @return {import("../Feature.js").default<Geometry>} Closest feature.
     * @api
     */
    VectorSource.prototype.getClosestFeatureToCoordinate = function (coordinate, opt_filter) {
        // Find the closest feature using branch and bound.  We start searching an
        // infinite extent, and find the distance from the first feature found.  This
        // becomes the closest feature.  We then compute a smaller extent which any
        // closer feature must intersect.  We continue searching with this smaller
        // extent, trying to find a closer feature.  Every time we find a closer
        // feature, we update the extent being searched so that any even closer
        // feature must intersect it.  We continue until we run out of features.
        var x = coordinate[0];
        var y = coordinate[1];
        var closestFeature = null;
        var closestPoint = [NaN, NaN];
        var minSquaredDistance = Infinity;
        var extent = [-Infinity, -Infinity, Infinity, Infinity];
        var filter = opt_filter ? opt_filter : _functions_js__WEBPACK_IMPORTED_MODULE_11__["TRUE"];
        this.featuresRtree_.forEachInExtent(extent, 
        /**
         * @param {import("../Feature.js").default<Geometry>} feature Feature.
         */
        function (feature) {
            if (filter(feature)) {
                var geometry = feature.getGeometry();
                var previousMinSquaredDistance = minSquaredDistance;
                minSquaredDistance = geometry.closestPointXY(x, y, closestPoint, minSquaredDistance);
                if (minSquaredDistance < previousMinSquaredDistance) {
                    closestFeature = feature;
                    // This is sneaky.  Reduce the extent that it is currently being
                    // searched while the R-Tree traversal using this same extent object
                    // is still in progress.  This is safe because the new extent is
                    // strictly contained by the old extent.
                    var minDistance = Math.sqrt(minSquaredDistance);
                    extent[0] = x - minDistance;
                    extent[1] = y - minDistance;
                    extent[2] = x + minDistance;
                    extent[3] = y + minDistance;
                }
            }
        });
        return closestFeature;
    };
    /**
     * Get the extent of the features currently in the source.
     *
     * This method is not available when the source is configured with
     * `useSpatialIndex` set to `false`.
     * @param {import("../extent.js").Extent=} opt_extent Destination extent. If provided, no new extent
     *     will be created. Instead, that extent's coordinates will be overwritten.
     * @return {import("../extent.js").Extent} Extent.
     * @api
     */
    VectorSource.prototype.getExtent = function (opt_extent) {
        return this.featuresRtree_.getExtent(opt_extent);
    };
    /**
     * Get a feature by its identifier (the value returned by feature.getId()).
     * Note that the index treats string and numeric identifiers as the same.  So
     * `source.getFeatureById(2)` will return a feature with id `'2'` or `2`.
     *
     * @param {string|number} id Feature identifier.
     * @return {import("../Feature.js").default<Geometry>} The feature (or `null` if not found).
     * @api
     */
    VectorSource.prototype.getFeatureById = function (id) {
        var feature = this.idIndex_[id.toString()];
        return feature !== undefined ? feature : null;
    };
    /**
     * Get a feature by its internal unique identifier (using `getUid`).
     *
     * @param {string} uid Feature identifier.
     * @return {import("../Feature.js").default<Geometry>} The feature (or `null` if not found).
     */
    VectorSource.prototype.getFeatureByUid = function (uid) {
        var feature = this.uidIndex_[uid];
        return feature !== undefined ? feature : null;
    };
    /**
     * Get the format associated with this source.
     *
     * @return {import("../format/Feature.js").default|undefined} The feature format.
     * @api
     */
    VectorSource.prototype.getFormat = function () {
        return this.format_;
    };
    /**
     * @return {boolean} The source can have overlapping geometries.
     */
    VectorSource.prototype.getOverlaps = function () {
        return this.overlaps_;
    };
    /**
     * Get the url associated with this source.
     *
     * @return {string|import("../featureloader.js").FeatureUrlFunction|undefined} The url.
     * @api
     */
    VectorSource.prototype.getUrl = function () {
        return this.url_;
    };
    /**
     * @param {Event} event Event.
     * @private
     */
    VectorSource.prototype.handleFeatureChange_ = function (event) {
        var feature = /** @type {import("../Feature.js").default<Geometry>} */ (event.target);
        var featureKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
        var geometry = feature.getGeometry();
        if (!geometry) {
            if (!(featureKey in this.nullGeometryFeatures_)) {
                if (this.featuresRtree_) {
                    this.featuresRtree_.remove(feature);
                }
                this.nullGeometryFeatures_[featureKey] = feature;
            }
        }
        else {
            var extent = geometry.getExtent();
            if (featureKey in this.nullGeometryFeatures_) {
                delete this.nullGeometryFeatures_[featureKey];
                if (this.featuresRtree_) {
                    this.featuresRtree_.insert(extent, feature);
                }
            }
            else {
                if (this.featuresRtree_) {
                    this.featuresRtree_.update(extent, feature);
                }
            }
        }
        var id = feature.getId();
        if (id !== undefined) {
            var sid = id.toString();
            if (this.idIndex_[sid] !== feature) {
                this.removeFromIdIndex_(feature);
                this.idIndex_[sid] = feature;
            }
        }
        else {
            this.removeFromIdIndex_(feature);
            this.uidIndex_[featureKey] = feature;
        }
        this.changed();
        this.dispatchEvent(new VectorSourceEvent(_VectorEventType_js__WEBPACK_IMPORTED_MODULE_16__["default"].CHANGEFEATURE, feature));
    };
    /**
     * Returns true if the feature is contained within the source.
     * @param {import("../Feature.js").default<Geometry>} feature Feature.
     * @return {boolean} Has feature.
     * @api
     */
    VectorSource.prototype.hasFeature = function (feature) {
        var id = feature.getId();
        if (id !== undefined) {
            return id in this.idIndex_;
        }
        else {
            return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature) in this.uidIndex_;
        }
    };
    /**
     * @return {boolean} Is empty.
     */
    VectorSource.prototype.isEmpty = function () {
        return this.featuresRtree_.isEmpty() && Object(_obj_js__WEBPACK_IMPORTED_MODULE_13__["isEmpty"])(this.nullGeometryFeatures_);
    };
    /**
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} resolution Resolution.
     * @param {import("../proj/Projection.js").default} projection Projection.
     */
    VectorSource.prototype.loadFeatures = function (extent, resolution, projection) {
        var loadedExtentsRtree = this.loadedExtentsRtree_;
        var extentsToLoad = this.strategy_(extent, resolution);
        this.loading = false;
        var _loop_1 = function (i, ii) {
            var extentToLoad = extentsToLoad[i];
            var alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad, 
            /**
             * @param {{extent: import("../extent.js").Extent}} object Object.
             * @return {boolean} Contains.
             */
            function (object) {
                return Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["containsExtent"])(object.extent, extentToLoad);
            });
            if (!alreadyLoaded) {
                this_1.loader_.call(this_1, extentToLoad, resolution, projection);
                loadedExtentsRtree.insert(extentToLoad, { extent: extentToLoad.slice() });
                this_1.loading = this_1.loader_ !== _functions_js__WEBPACK_IMPORTED_MODULE_11__["VOID"];
            }
        };
        var this_1 = this;
        for (var i = 0, ii = extentsToLoad.length; i < ii; ++i) {
            _loop_1(i, ii);
        }
    };
    VectorSource.prototype.refresh = function () {
        this.clear(true);
        this.loadedExtentsRtree_.clear();
        _super.prototype.refresh.call(this);
    };
    /**
     * Remove an extent from the list of loaded extents.
     * @param {import("../extent.js").Extent} extent Extent.
     * @api
     */
    VectorSource.prototype.removeLoadedExtent = function (extent) {
        var loadedExtentsRtree = this.loadedExtentsRtree_;
        var obj;
        loadedExtentsRtree.forEachInExtent(extent, function (object) {
            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["equals"])(object.extent, extent)) {
                obj = object;
                return true;
            }
        });
        if (obj) {
            loadedExtentsRtree.remove(obj);
        }
    };
    /**
     * Remove a single feature from the source.  If you want to remove all features
     * at once, use the {@link module:ol/source/Vector~VectorSource#clear #clear()} method
     * instead.
     * @param {import("../Feature.js").default<Geometry>} feature Feature to remove.
     * @api
     */
    VectorSource.prototype.removeFeature = function (feature) {
        var featureKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
        if (featureKey in this.nullGeometryFeatures_) {
            delete this.nullGeometryFeatures_[featureKey];
        }
        else {
            if (this.featuresRtree_) {
                this.featuresRtree_.remove(feature);
            }
        }
        this.removeFeatureInternal(feature);
        this.changed();
    };
    /**
     * Remove feature without firing a `change` event.
     * @param {import("../Feature.js").default<Geometry>} feature Feature.
     * @protected
     */
    VectorSource.prototype.removeFeatureInternal = function (feature) {
        var featureKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(feature);
        this.featureChangeKeys_[featureKey].forEach(_events_js__WEBPACK_IMPORTED_MODULE_6__["unlistenByKey"]);
        delete this.featureChangeKeys_[featureKey];
        var id = feature.getId();
        if (id !== undefined) {
            delete this.idIndex_[id.toString()];
        }
        delete this.uidIndex_[featureKey];
        this.dispatchEvent(new VectorSourceEvent(_VectorEventType_js__WEBPACK_IMPORTED_MODULE_16__["default"].REMOVEFEATURE, feature));
    };
    /**
     * Remove a feature from the id index.  Called internally when the feature id
     * may have changed.
     * @param {import("../Feature.js").default<Geometry>} feature The feature.
     * @return {boolean} Removed the feature from the index.
     * @private
     */
    VectorSource.prototype.removeFromIdIndex_ = function (feature) {
        var removed = false;
        for (var id in this.idIndex_) {
            if (this.idIndex_[id] === feature) {
                delete this.idIndex_[id];
                removed = true;
                break;
            }
        }
        return removed;
    };
    /**
     * Set the new loader of the source. The next render cycle will use the
     * new loader.
     * @param {import("../featureloader.js").FeatureLoader} loader The loader to set.
     * @api
     */
    VectorSource.prototype.setLoader = function (loader) {
        this.loader_ = loader;
    };
    /**
     * Points the source to a new url. The next render cycle will use the new url.
     * @param {string|import("../featureloader.js").FeatureUrlFunction} url Url.
     * @api
     */
    VectorSource.prototype.setUrl = function (url) {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_5__["assert"])(this.format_, 7); // `format` must be set when `url` is set
        this.setLoader(Object(_featureloader_js__WEBPACK_IMPORTED_MODULE_10__["xhr"])(url, this.format_));
    };
    return VectorSource;
}(_Source_js__WEBPACK_IMPORTED_MODULE_14__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (VectorSource);
//# sourceMappingURL=Vector.js.map

/***/ }),

/***/ "./node_modules/ol/source/VectorEventType.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/source/VectorEventType.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/source/VectorEventType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Triggered when a feature is added to the source.
     * @event module:ol/source/Vector.VectorSourceEvent#addfeature
     * @api
     */
    ADDFEATURE: 'addfeature',
    /**
     * Triggered when a feature is updated.
     * @event module:ol/source/Vector.VectorSourceEvent#changefeature
     * @api
     */
    CHANGEFEATURE: 'changefeature',
    /**
     * Triggered when the clear method is called on the source.
     * @event module:ol/source/Vector.VectorSourceEvent#clear
     * @api
     */
    CLEAR: 'clear',
    /**
     * Triggered when a feature is removed from the source.
     * See {@link module:ol/source/Vector#clear source.clear()} for exceptions.
     * @event module:ol/source/Vector.VectorSourceEvent#removefeature
     * @api
     */
    REMOVEFEATURE: 'removefeature'
});
//# sourceMappingURL=VectorEventType.js.map

/***/ }),

/***/ "./node_modules/ol/source/VectorTile.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/source/VectorTile.js ***!
  \**********************************************/
/*! exports provided: default, defaultLoadFunction */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultLoadFunction", function() { return defaultLoadFunction; });
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _VectorRenderTile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../VectorRenderTile.js */ "./node_modules/ol/VectorRenderTile.js");
/* harmony import */ var _VectorTile_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../VectorTile.js */ "./node_modules/ol/VectorTile.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _UrlTile_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./UrlTile.js */ "./node_modules/ol/source/UrlTile.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/* harmony import */ var _tilegrid_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../tilegrid.js */ "./node_modules/ol/tilegrid.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _featureloader_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../featureloader.js */ "./node_modules/ol/featureloader.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _TileCache_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../TileCache.js */ "./node_modules/ol/TileCache.js");
/**
 * @module ol/source/VectorTile
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();












/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
 * @property {number} [cacheSize=128] Cache size.
 * @property {import("../extent.js").Extent} [extent]
 * @property {import("../format/Feature.js").default} [format] Feature format for tiles. Used and required by the default.
 * @property {boolean} [overlaps=true] This source may have overlapping geometries. Setting this
 * to `false` (e.g. for sources with polygons that represent administrative
 * boundaries or TopoJSON sources) allows the renderer to optimise fill and
 * stroke operations.
 * @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection of the tile grid.
 * @property {import("./State.js").default} [state] Source state.
 * @property {typeof import("../VectorTile.js").default} [tileClass] Class used to instantiate image tiles.
 * Default is {@link module:ol/VectorTile}.
 * @property {number} [maxZoom=22] Optional max zoom level. Not used if `tileGrid` is provided.
 * @property {number} [minZoom] Optional min zoom level. Not used if `tileGrid` is provided.
 * @property {number|import("../size.js").Size} [tileSize=512] Optional tile size. Not used if `tileGrid` is provided.
 * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided.
 * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction]
 * Optional function to load a tile given a URL. Could look like this for pbf tiles:
 * ```js
 * function(tile, url) {
 *   tile.setLoader(function(extent, resolution, projection) {
 *     fetch(url).then(function(response) {
 *       response.arrayBuffer().then(function(data) {
 *         const format = tile.getFormat() // ol/format/MVT configured as source format
 *         const features = format.readFeatures(data, {
 *           extent: extent,
 *           featureProjection: projection
 *         });
 *         tile.setFeatures(features);
 *       });
 *     });
 *   });
 * }
 * ```
 * If you do not need extent, resolution and projection to get the features for a tile (e.g.
 * for GeoJSON tiles), your `tileLoadFunction` does not need a `setLoader()` call. Only make sure
 * to call `setFeatures()` on the tile:
 * ```js
 * const format = new GeoJSON({featureProjection: map.getView().getProjection()});
 * async function tileLoadFunction(tile, url) {
 *   const response = await fetch(url);
 *   const data = await response.json();
 *   tile.setFeatures(format.readFeatures(data));
 * }
 * ```
 * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get tile URL given a tile coordinate and the projection.
 * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
 * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
 * used instead of defining each one separately in the `urls` option.
 * @property {number} [transition] A duration for tile opacity
 * transitions in milliseconds. A duration of 0 disables the opacity transition.
 * @property {Array<string>} [urls] An array of URL templates.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 * When set to `false`, only one world
 * will be rendered. When set to `true`, tiles will be wrapped horizontally to
 * render multiple worlds.
 * @property {number} [zDirection=1] Indicate which resolution should be used
 * by a renderer if the view resolution does not match any resolution of the tile source.
 * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
 * will be used. If -1, the nearest higher resolution will be used.
 */
/**
 * @classdesc
 * Class for layer sources providing vector data divided into a tile grid, to be
 * used with {@link module:ol/layer/VectorTile~VectorTile}. Although this source receives tiles
 * with vector features from the server, it is not meant for feature editing.
 * Features are optimized for rendering, their geometries are clipped at or near
 * tile boundaries and simplified for a view resolution. See
 * {@link module:ol/source/Vector} for vector sources that are suitable for feature
 * editing.
 *
 * @fires import("./Tile.js").TileSourceEvent
 * @api
 */
var VectorTile = /** @class */ (function (_super) {
    __extends(VectorTile, _super);
    /**
     * @param {!Options} options Vector tile options.
     */
    function VectorTile(options) {
        var _this = this;
        var projection = options.projection || 'EPSG:3857';
        var extent = options.extent || Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_6__["extentFromProjection"])(projection);
        var tileGrid = options.tileGrid || Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_6__["createXYZ"])({
            extent: extent,
            maxResolution: options.maxResolution,
            maxZoom: options.maxZoom !== undefined ? options.maxZoom : 22,
            minZoom: options.minZoom,
            tileSize: options.tileSize || 512
        });
        _this = _super.call(this, {
            attributions: options.attributions,
            attributionsCollapsible: options.attributionsCollapsible,
            cacheSize: options.cacheSize,
            opaque: false,
            projection: projection,
            state: options.state,
            tileGrid: tileGrid,
            tileLoadFunction: options.tileLoadFunction ? options.tileLoadFunction : defaultLoadFunction,
            tileUrlFunction: options.tileUrlFunction,
            url: options.url,
            urls: options.urls,
            wrapX: options.wrapX === undefined ? true : options.wrapX,
            transition: options.transition,
            zDirection: options.zDirection === undefined ? 1 : options.zDirection
        }) || this;
        /**
         * @private
         * @type {import("../format/Feature.js").default}
         */
        _this.format_ = options.format ? options.format : null;
        /**
         * @type {Object<string, import("./VectorTile").default>}
         */
        _this.loadingTiles_ = {};
        /**
         * @private
         * @type {TileCache}
         */
        _this.sourceTileCache = new _TileCache_js__WEBPACK_IMPORTED_MODULE_11__["default"](_this.tileCache.highWaterMark);
        /**
         * @private
         * @type {boolean}
         */
        _this.overlaps_ = options.overlaps == undefined ? true : options.overlaps;
        /**
         * @protected
         * @type {typeof import("../VectorTile.js").default}
         */
        _this.tileClass = options.tileClass ? options.tileClass : _VectorTile_js__WEBPACK_IMPORTED_MODULE_2__["default"];
        /**
         * @private
         * @type {Object<string, import("../tilegrid/TileGrid.js").default>}
         */
        _this.tileGrids_ = {};
        return _this;
    }
    /**
     * Get features whose bounding box intersects the provided extent. Only features for cached
     * tiles for the last rendered zoom level are available in the source. So this method is only
     * suitable for requesting tiles for extents that are currently rendered.
     *
     * Features are returned in random tile order and as they are included in the tiles. This means
     * they can be clipped, duplicated across tiles, and simplified to the render resolution.
     *
     * @param {import("../extent.js").Extent} extent Extent.
     * @return {Array<import("../Feature.js").FeatureLike>} Features.
     * @api
     */
    VectorTile.prototype.getFeaturesInExtent = function (extent) {
        var features = [];
        var tileCache = this.tileCache;
        if (tileCache.getCount() === 0) {
            return features;
        }
        var z = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_5__["fromKey"])(tileCache.peekFirstKey())[0];
        var tileGrid = this.tileGrid;
        tileCache.forEach(function (tile) {
            if (tile.tileCoord[0] !== z || tile.getState() !== _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED) {
                return;
            }
            var sourceTiles = tile.getSourceTiles();
            for (var i = 0, ii = sourceTiles.length; i < ii; ++i) {
                var sourceTile = sourceTiles[i];
                var tileCoord = sourceTile.tileCoord;
                if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_7__["intersects"])(extent, tileGrid.getTileCoordExtent(tileCoord))) {
                    var tileFeatures = sourceTile.getFeatures();
                    if (tileFeatures) {
                        for (var j = 0, jj = tileFeatures.length; j < jj; ++j) {
                            var candidate = tileFeatures[j];
                            var geometry = candidate.getGeometry();
                            if (Object(_extent_js__WEBPACK_IMPORTED_MODULE_7__["intersects"])(extent, geometry.getExtent())) {
                                features.push(candidate);
                            }
                        }
                    }
                }
            }
        });
        return features;
    };
    /**
     * @return {boolean} The source can have overlapping geometries.
     */
    VectorTile.prototype.getOverlaps = function () {
        return this.overlaps_;
    };
    /**
     * clear {@link module:ol/TileCache~TileCache} and delete all source tiles
     * @api
     */
    VectorTile.prototype.clear = function () {
        this.tileCache.clear();
        this.sourceTileCache.clear();
    };
    /**
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @param {!Object<string, boolean>} usedTiles Used tiles.
     */
    VectorTile.prototype.expireCache = function (projection, usedTiles) {
        _super.prototype.expireCache.call(this, projection, usedTiles);
        this.sourceTileCache.expireCache({});
    };
    /**
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection").default} projection Projection.
     * @param {VectorRenderTile} tile Vector image tile.
     * @return {Array<import("../VectorTile").default>} Tile keys.
     */
    VectorTile.prototype.getSourceTiles = function (pixelRatio, projection, tile) {
        var urlTileCoord = tile.wrappedTileCoord;
        var tileGrid = this.getTileGridForProjection(projection);
        var extent = tileGrid.getTileCoordExtent(urlTileCoord);
        var z = urlTileCoord[0];
        var resolution = tileGrid.getResolution(z);
        // make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space
        Object(_extent_js__WEBPACK_IMPORTED_MODULE_7__["buffer"])(extent, -resolution, extent);
        var sourceTileGrid = this.tileGrid;
        var sourceExtent = sourceTileGrid.getExtent();
        if (sourceExtent) {
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_7__["getIntersection"])(extent, sourceExtent, extent);
        }
        var sourceZ = sourceTileGrid.getZForResolution(resolution, 1);
        var minZoom = sourceTileGrid.getMinZoom();
        var previousSourceTiles = tile.sourceTiles;
        var sourceTiles, covered, loadedZ;
        if (previousSourceTiles && previousSourceTiles.length > 0 && previousSourceTiles[0].tileCoord[0] === sourceZ) {
            sourceTiles = previousSourceTiles;
            covered = true;
            loadedZ = sourceZ;
        }
        else {
            sourceTiles = [];
            loadedZ = sourceZ + 1;
            do {
                --loadedZ;
                covered = true;
                sourceTileGrid.forEachTileCoord(extent, loadedZ, function (sourceTileCoord) {
                    var tileUrl = this.tileUrlFunction(sourceTileCoord, pixelRatio, projection);
                    var sourceTile;
                    if (tileUrl !== undefined) {
                        if (this.sourceTileCache.containsKey(tileUrl)) {
                            sourceTile = this.sourceTileCache.get(tileUrl);
                            var state = sourceTile.getState();
                            if (state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED || state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].ERROR || state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].EMPTY) {
                                sourceTiles.push(sourceTile);
                                return;
                            }
                        }
                        else if (loadedZ === sourceZ) {
                            sourceTile = new this.tileClass(sourceTileCoord, _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].IDLE, tileUrl, this.format_, this.tileLoadFunction);
                            sourceTile.extent = sourceTileGrid.getTileCoordExtent(sourceTileCoord);
                            sourceTile.projection = projection;
                            sourceTile.resolution = sourceTileGrid.getResolution(sourceTileCoord[0]);
                            this.sourceTileCache.set(tileUrl, sourceTile);
                            sourceTile.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].CHANGE, this.handleTileChange.bind(this));
                            sourceTile.load();
                        }
                    }
                    covered = covered && sourceTile && sourceTile.getState() === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED;
                    if (!sourceTile) {
                        return;
                    }
                    if (sourceTile.getState() !== _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].EMPTY && tile.getState() === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].IDLE) {
                        tile.loadingSourceTiles++;
                        sourceTile.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].CHANGE, function listenChange() {
                            var state = sourceTile.getState();
                            var sourceTileKey = sourceTile.getKey();
                            if (state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED || state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].ERROR) {
                                if (state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED) {
                                    sourceTile.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_8__["default"].CHANGE, listenChange);
                                    tile.loadingSourceTiles--;
                                    delete tile.errorSourceTileKeys[sourceTileKey];
                                }
                                else if (state === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].ERROR) {
                                    tile.errorSourceTileKeys[sourceTileKey] = true;
                                }
                                var errorTileCount = Object.keys(tile.errorSourceTileKeys).length;
                                if (tile.loadingSourceTiles - errorTileCount === 0) {
                                    tile.hifi = errorTileCount === 0;
                                    tile.sourceZ = sourceZ;
                                    tile.setState(_TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED);
                                }
                            }
                        });
                    }
                }.bind(this));
                if (!covered) {
                    sourceTiles.length = 0;
                }
            } while (!covered && loadedZ > minZoom);
        }
        if (tile.getState() === _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].IDLE) {
            tile.setState(_TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADING);
        }
        if (covered) {
            tile.hifi = sourceZ === loadedZ;
            tile.sourceZ = loadedZ;
            if (tile.getState() < _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED) {
                tile.setState(_TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].LOADED);
            }
            else if (!previousSourceTiles || !Object(_array_js__WEBPACK_IMPORTED_MODULE_10__["equals"])(sourceTiles, previousSourceTiles)) {
                tile.sourceTiles = sourceTiles;
            }
        }
        return sourceTiles;
    };
    /**
     * @inheritDoc
     */
    VectorTile.prototype.getTile = function (z, x, y, pixelRatio, projection) {
        var coordKey = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_5__["getKeyZXY"])(z, x, y);
        var key = this.getKey();
        var tile;
        if (this.tileCache.containsKey(coordKey)) {
            tile = /** @type {!import("../Tile.js").default} */ (this.tileCache.get(coordKey));
            if (tile.key === key) {
                return tile;
            }
        }
        var tileCoord = [z, x, y];
        var urlTileCoord = this.getTileCoordForTileUrlFunction(tileCoord, projection);
        var sourceExtent = this.getTileGrid().getExtent();
        var tileGrid = this.getTileGridForProjection(projection);
        if (urlTileCoord && sourceExtent) {
            var tileExtent = tileGrid.getTileCoordExtent(urlTileCoord);
            // make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_7__["buffer"])(tileExtent, -tileGrid.getResolution(z), tileExtent);
            if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_7__["intersects"])(sourceExtent, tileExtent)) {
                urlTileCoord = null;
            }
        }
        var empty = true;
        if (urlTileCoord !== null) {
            var sourceTileGrid = this.tileGrid;
            var resolution = tileGrid.getResolution(z);
            var sourceZ = sourceTileGrid.getZForResolution(resolution, 1);
            // make extent 1 pixel smaller so we don't load tiles for < 0.5 pixel render space
            var extent = tileGrid.getTileCoordExtent(urlTileCoord);
            Object(_extent_js__WEBPACK_IMPORTED_MODULE_7__["buffer"])(extent, -resolution, extent);
            sourceTileGrid.forEachTileCoord(extent, sourceZ, function (sourceTileCoord) {
                empty = empty && !this.tileUrlFunction(sourceTileCoord, pixelRatio, projection);
            }.bind(this));
        }
        var newTile = new _VectorRenderTile_js__WEBPACK_IMPORTED_MODULE_1__["default"](tileCoord, empty ? _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].EMPTY : _TileState_js__WEBPACK_IMPORTED_MODULE_0__["default"].IDLE, urlTileCoord, this.getSourceTiles.bind(this, pixelRatio, projection));
        newTile.key = key;
        if (tile) {
            newTile.interimTile = tile;
            newTile.refreshInterimChain();
            this.tileCache.replace(coordKey, newTile);
        }
        else {
            this.tileCache.set(coordKey, newTile);
        }
        return newTile;
    };
    /**
     * @inheritDoc
     */
    VectorTile.prototype.getTileGridForProjection = function (projection) {
        var code = projection.getCode();
        var tileGrid = this.tileGrids_[code];
        if (!tileGrid) {
            // A tile grid that matches the tile size of the source tile grid is more
            // likely to have 1:1 relationships between source tiles and rendered tiles.
            var sourceTileGrid = this.tileGrid;
            tileGrid = Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_6__["createForProjection"])(projection, undefined, sourceTileGrid ? sourceTileGrid.getTileSize(sourceTileGrid.getMinZoom()) : undefined);
            this.tileGrids_[code] = tileGrid;
        }
        return tileGrid;
    };
    /**
     * @inheritDoc
     */
    VectorTile.prototype.getTilePixelRatio = function (pixelRatio) {
        return pixelRatio;
    };
    /**
     * @inheritDoc
     */
    VectorTile.prototype.getTilePixelSize = function (z, pixelRatio, projection) {
        var tileGrid = this.getTileGridForProjection(projection);
        var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_3__["toSize"])(tileGrid.getTileSize(z), this.tmpSize);
        return [Math.round(tileSize[0] * pixelRatio), Math.round(tileSize[1] * pixelRatio)];
    };
    return VectorTile;
}(_UrlTile_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (VectorTile);
/**
 * Sets the loader for a tile.
 * @param {import("../VectorTile.js").default} tile Vector tile.
 * @param {string} url URL.
 */
function defaultLoadFunction(tile, url) {
    var loader = Object(_featureloader_js__WEBPACK_IMPORTED_MODULE_9__["loadFeaturesXhr"])(url, tile.getFormat(), tile.onLoad.bind(tile), tile.onError.bind(tile));
    tile.setLoader(loader);
}
//# sourceMappingURL=VectorTile.js.map

/***/ }),

/***/ "./node_modules/ol/source/WMSServerType.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/source/WMSServerType.js ***!
  \*************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/source/WMSServerType
 */
/**
 * Available server types: `'carmentaserver'`, `'geoserver'`, `'mapserver'`,
 *     `'qgis'`. These are servers that have vendor parameters beyond the WMS
 *     specification that OpenLayers can make use of.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * HiDPI support for [Carmenta Server](https://www.carmenta.com/en/products/carmenta-server)
     * @api
     */
    CARMENTA_SERVER: 'carmentaserver',
    /**
     * HiDPI support for [GeoServer](https://geoserver.org/)
     * @api
     */
    GEOSERVER: 'geoserver',
    /**
     * HiDPI support for [MapServer](https://mapserver.org/)
     * @api
     */
    MAPSERVER: 'mapserver',
    /**
     * HiDPI support for [QGIS](https://qgis.org/)
     * @api
     */
    QGIS: 'qgis'
});
//# sourceMappingURL=WMSServerType.js.map

/***/ }),

/***/ "./node_modules/ol/source/WMTS.js":
/*!****************************************!*\
  !*** ./node_modules/ol/source/WMTS.js ***!
  \****************************************/
/*! exports provided: default, optionsFromCapabilities */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "optionsFromCapabilities", function() { return optionsFromCapabilities; });
/* harmony import */ var _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../tileurlfunction.js */ "./node_modules/ol/tileurlfunction.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _TileImage_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony import */ var _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./WMTSRequestEncoding.js */ "./node_modules/ol/source/WMTSRequestEncoding.js");
/* harmony import */ var _tilegrid_WMTS_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../tilegrid/WMTS.js */ "./node_modules/ol/tilegrid/WMTS.js");
/* harmony import */ var _uri_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../uri.js */ "./node_modules/ol/uri.js");
/**
 * @module ol/source/WMTS
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();








/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {import("../tilegrid/WMTS.js").default} tileGrid Tile grid.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {import("./WMTSRequestEncoding.js").default|string} [requestEncoding='KVP'] Request encoding.
 * @property {string} layer Layer name as advertised in the WMTS capabilities.
 * @property {string} style Style name as advertised in the WMTS capabilities.
 * @property {typeof import("../ImageTile.js").default} [tileClass]  Class used to instantiate image tiles. Default is {@link module:ol/ImageTile~ImageTile}.
 * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.
 * For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px
 * by 512px images (for retina/hidpi devices) then `tilePixelRatio`
 * should be set to `2`.
 * @property {string} [format='image/jpeg'] Image format. Only used when `requestEncoding` is `'KVP'`.
 * @property {string} [version='1.0.0'] WMTS version.
 * @property {string} matrixSet Matrix set.
 * @property {!Object} [dimensions] Additional "dimensions" for tile requests.
 * This is an object with properties named like the advertised WMTS dimensions.
 * @property {string} [url]  A URL for the service.
 * For the RESTful request encoding, this is a URL
 * template.  For KVP encoding, it is normal URL. A `{?-?}` template pattern,
 * for example `subdomain{a-f}.domain.com`, may be used instead of defining
 * each one separately in the `urls` option.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {Array<string>} [urls] An array of URLs.
 * Requests will be distributed among the URLs in this array.
 * @property {boolean} [wrapX=false] Whether to wrap the world horizontally.
 * @property {number} [transition] Duration of the opacity transition for rendering.
 * To disable the opacity transition, pass `transition: 0`.
 */
/**
 * @classdesc
 * Layer source for tile data from WMTS servers.
 * @api
 */
var WMTS = /** @class */ (function (_super) {
    __extends(WMTS, _super);
    /**
     * @param {Options} options WMTS options.
     */
    function WMTS(options) {
        // TODO: add support for TileMatrixLimits
        var _this = this;
        var requestEncoding = options.requestEncoding !== undefined ?
            /** @type {import("./WMTSRequestEncoding.js").default} */ (options.requestEncoding) :
            _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__["default"].KVP;
        // FIXME: should we create a default tileGrid?
        // we could issue a getCapabilities xhr to retrieve missing configuration
        var tileGrid = options.tileGrid;
        var urls = options.urls;
        if (urls === undefined && options.url !== undefined) {
            urls = Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__["expandUrl"])(options.url);
        }
        _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            crossOrigin: options.crossOrigin,
            projection: options.projection,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            tileClass: options.tileClass,
            tileGrid: tileGrid,
            tileLoadFunction: options.tileLoadFunction,
            tilePixelRatio: options.tilePixelRatio,
            tileUrlFunction: _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__["nullTileUrlFunction"],
            urls: urls,
            wrapX: options.wrapX !== undefined ? options.wrapX : false,
            transition: options.transition
        }) || this;
        /**
         * @private
         * @type {string}
         */
        _this.version_ = options.version !== undefined ? options.version : '1.0.0';
        /**
         * @private
         * @type {string}
         */
        _this.format_ = options.format !== undefined ? options.format : 'image/jpeg';
        /**
         * @private
         * @type {!Object}
         */
        _this.dimensions_ = options.dimensions !== undefined ? options.dimensions : {};
        /**
         * @private
         * @type {string}
         */
        _this.layer_ = options.layer;
        /**
         * @private
         * @type {string}
         */
        _this.matrixSet_ = options.matrixSet;
        /**
         * @private
         * @type {string}
         */
        _this.style_ = options.style;
        // FIXME: should we guess this requestEncoding from options.url(s)
        //        structure? that would mean KVP only if a template is not provided.
        /**
         * @private
         * @type {import("./WMTSRequestEncoding.js").default}
         */
        _this.requestEncoding_ = requestEncoding;
        _this.setKey(_this.getKeyForDimensions_());
        if (urls && urls.length > 0) {
            _this.tileUrlFunction = Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__["createFromTileUrlFunctions"])(urls.map(createFromWMTSTemplate.bind(_this)));
        }
        return _this;
    }
    /**
     * Set the URLs to use for requests.
     * URLs may contain OGC conform URL Template Variables: {TileMatrix}, {TileRow}, {TileCol}.
     * @override
     */
    WMTS.prototype.setUrls = function (urls) {
        this.urls = urls;
        var key = urls.join('\n');
        this.setTileUrlFunction(Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_0__["createFromTileUrlFunctions"])(urls.map(createFromWMTSTemplate.bind(this))), key);
    };
    /**
     * Get the dimensions, i.e. those passed to the constructor through the
     * "dimensions" option, and possibly updated using the updateDimensions
     * method.
     * @return {!Object} Dimensions.
     * @api
     */
    WMTS.prototype.getDimensions = function () {
        return this.dimensions_;
    };
    /**
     * Return the image format of the WMTS source.
     * @return {string} Format.
     * @api
     */
    WMTS.prototype.getFormat = function () {
        return this.format_;
    };
    /**
     * Return the layer of the WMTS source.
     * @return {string} Layer.
     * @api
     */
    WMTS.prototype.getLayer = function () {
        return this.layer_;
    };
    /**
     * Return the matrix set of the WMTS source.
     * @return {string} MatrixSet.
     * @api
     */
    WMTS.prototype.getMatrixSet = function () {
        return this.matrixSet_;
    };
    /**
     * Return the request encoding, either "KVP" or "REST".
     * @return {import("./WMTSRequestEncoding.js").default} Request encoding.
     * @api
     */
    WMTS.prototype.getRequestEncoding = function () {
        return this.requestEncoding_;
    };
    /**
     * Return the style of the WMTS source.
     * @return {string} Style.
     * @api
     */
    WMTS.prototype.getStyle = function () {
        return this.style_;
    };
    /**
     * Return the version of the WMTS source.
     * @return {string} Version.
     * @api
     */
    WMTS.prototype.getVersion = function () {
        return this.version_;
    };
    /**
     * @private
     * @return {string} The key for the current dimensions.
     */
    WMTS.prototype.getKeyForDimensions_ = function () {
        var i = 0;
        var res = [];
        for (var key in this.dimensions_) {
            res[i++] = key + '-' + this.dimensions_[key];
        }
        return res.join('/');
    };
    /**
     * Update the dimensions.
     * @param {Object} dimensions Dimensions.
     * @api
     */
    WMTS.prototype.updateDimensions = function (dimensions) {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["assign"])(this.dimensions_, dimensions);
        this.setKey(this.getKeyForDimensions_());
    };
    return WMTS;
}(_TileImage_js__WEBPACK_IMPORTED_MODULE_4__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (WMTS);
/**
 * Generate source options from a capabilities object.
 * @param {Object} wmtsCap An object representing the capabilities document.
 * @param {!Object} config Configuration properties for the layer.  Defaults for
 *                  the layer will apply if not provided.
 *
 * Required config properties:
 *  - layer - {string} The layer identifier.
 *
 * Optional config properties:
 *  - matrixSet - {string} The matrix set identifier, required if there is
 *       more than one matrix set in the layer capabilities.
 *  - projection - {string} The desired CRS when no matrixSet is specified.
 *       eg: "EPSG:3857". If the desired projection is not available,
 *       an error is thrown.
 *  - requestEncoding - {string} url encoding format for the layer. Default is
 *       the first tile url format found in the GetCapabilities response.
 *  - style - {string} The name of the style
 *  - format - {string} Image format for the layer. Default is the first
 *       format returned in the GetCapabilities response.
 *  - crossOrigin - {string|null|undefined} Cross origin. Default is `undefined`.
 * @return {?Options} WMTS source options object or `null` if the layer was not found.
 * @api
 */
function optionsFromCapabilities(wmtsCap, config) {
    var layers = wmtsCap['Contents']['Layer'];
    var l = Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["find"])(layers, function (elt, index, array) {
        return elt['Identifier'] == config['layer'];
    });
    if (l === null) {
        return null;
    }
    var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet'];
    var idx;
    if (l['TileMatrixSetLink'].length > 1) {
        if ('projection' in config) {
            idx = Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["findIndex"])(l['TileMatrixSetLink'], function (elt, index, array) {
                var tileMatrixSet = Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["find"])(tileMatrixSets, function (el) {
                    return el['Identifier'] == elt['TileMatrixSet'];
                });
                var supportedCRS = tileMatrixSet['SupportedCRS'];
                var proj1 = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])(supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')) ||
                    Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])(supportedCRS);
                var proj2 = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])(config['projection']);
                if (proj1 && proj2) {
                    return Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["equivalent"])(proj1, proj2);
                }
                else {
                    return supportedCRS == config['projection'];
                }
            });
        }
        else {
            idx = Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["findIndex"])(l['TileMatrixSetLink'], function (elt, index, array) {
                return elt['TileMatrixSet'] == config['matrixSet'];
            });
        }
    }
    else {
        idx = 0;
    }
    if (idx < 0) {
        idx = 0;
    }
    var matrixSet = /** @type {string} */ (l['TileMatrixSetLink'][idx]['TileMatrixSet']);
    var matrixLimits = /** @type {Array<Object>} */ (l['TileMatrixSetLink'][idx]['TileMatrixSetLimits']);
    var format = /** @type {string} */ (l['Format'][0]);
    if ('format' in config) {
        format = config['format'];
    }
    idx = Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["findIndex"])(l['Style'], function (elt, index, array) {
        if ('style' in config) {
            return elt['Title'] == config['style'];
        }
        else {
            return elt['isDefault'];
        }
    });
    if (idx < 0) {
        idx = 0;
    }
    var style = /** @type {string} */ (l['Style'][idx]['Identifier']);
    var dimensions = {};
    if ('Dimension' in l) {
        l['Dimension'].forEach(function (elt, index, array) {
            var key = elt['Identifier'];
            var value = elt['Default'];
            if (value === undefined) {
                value = elt['Value'][0];
            }
            dimensions[key] = value;
        });
    }
    var matrixSets = wmtsCap['Contents']['TileMatrixSet'];
    var matrixSetObj = Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["find"])(matrixSets, function (elt, index, array) {
        return elt['Identifier'] == matrixSet;
    });
    var projection;
    var code = matrixSetObj['SupportedCRS'];
    if (code) {
        projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])(code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')) ||
            Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])(code);
    }
    if ('projection' in config) {
        var projConfig = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])(config['projection']);
        if (projConfig) {
            if (!projection || Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["equivalent"])(projConfig, projection)) {
                projection = projConfig;
            }
        }
    }
    var wrapX = false;
    var matrix0 = matrixSetObj.TileMatrix[0];
    var resolution = matrix0.ScaleDenominator * 0.00028; // WMTS 1.0.0: standardized rendering pixel size
    var origin = projection === Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__["get"])('EPSG:4326')
        ? [matrix0.TopLeftCorner[1], matrix0.TopLeftCorner[0]]
        : matrix0.TopLeftCorner;
    var tileSpanX = matrix0.TileWidth * resolution;
    var tileSpanY = matrix0.TileHeight * resolution;
    var extent = [
        origin[0],
        origin[1] - tileSpanY * matrix0.MatrixHeight,
        origin[0] + tileSpanX * matrix0.MatrixWidth,
        origin[1]
    ];
    if (projection.getExtent() === null) {
        projection.setExtent(extent);
    }
    var tileGrid = Object(_tilegrid_WMTS_js__WEBPACK_IMPORTED_MODULE_6__["createFromCapabilitiesMatrixSet"])(matrixSetObj, extent, matrixLimits);
    /** @type {!Array<string>} */
    var urls = [];
    var requestEncoding = config['requestEncoding'];
    requestEncoding = requestEncoding !== undefined ? requestEncoding : '';
    if ('OperationsMetadata' in wmtsCap && 'GetTile' in wmtsCap['OperationsMetadata']) {
        var gets = wmtsCap['OperationsMetadata']['GetTile']['DCP']['HTTP']['Get'];
        for (var i = 0, ii = gets.length; i < ii; ++i) {
            if (gets[i]['Constraint']) {
                var constraint = Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["find"])(gets[i]['Constraint'], function (element) {
                    return element['name'] == 'GetEncoding';
                });
                var encodings = constraint['AllowedValues']['Value'];
                if (requestEncoding === '') {
                    // requestEncoding not provided, use the first encoding from the list
                    requestEncoding = encodings[0];
                }
                if (requestEncoding === _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__["default"].KVP) {
                    if (Object(_array_js__WEBPACK_IMPORTED_MODULE_1__["includes"])(encodings, _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__["default"].KVP)) {
                        urls.push(/** @type {string} */ (gets[i]['href']));
                    }
                }
                else {
                    break;
                }
            }
            else if (gets[i]['href']) {
                requestEncoding = _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__["default"].KVP;
                urls.push(/** @type {string} */ (gets[i]['href']));
            }
        }
    }
    if (urls.length === 0) {
        requestEncoding = _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__["default"].REST;
        l['ResourceURL'].forEach(function (element) {
            if (element['resourceType'] === 'tile') {
                format = element['format'];
                urls.push(/** @type {string} */ (element['template']));
            }
        });
    }
    return {
        urls: urls,
        layer: config['layer'],
        matrixSet: matrixSet,
        format: format,
        projection: projection,
        requestEncoding: requestEncoding,
        tileGrid: tileGrid,
        style: style,
        dimensions: dimensions,
        wrapX: wrapX,
        crossOrigin: config['crossOrigin']
    };
}
/**
 * @param {string} template Template.
 * @return {import("../Tile.js").UrlFunction} Tile URL function.
 * @this {WMTS}
 */
function createFromWMTSTemplate(template) {
    var requestEncoding = this.requestEncoding_;
    // context property names are lower case to allow for a case insensitive
    // replacement as some services use different naming conventions
    var context = {
        'layer': this.layer_,
        'style': this.style_,
        'tilematrixset': this.matrixSet_
    };
    if (requestEncoding == _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__["default"].KVP) {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["assign"])(context, {
            'Service': 'WMTS',
            'Request': 'GetTile',
            'Version': this.version_,
            'Format': this.format_
        });
    }
    // TODO: we may want to create our own appendParams function so that params
    // order conforms to wmts spec guidance, and so that we can avoid to escape
    // special template params
    template = (requestEncoding == _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__["default"].KVP) ?
        Object(_uri_js__WEBPACK_IMPORTED_MODULE_7__["appendParams"])(template, context) :
        template.replace(/\{(\w+?)\}/g, function (m, p) {
            return (p.toLowerCase() in context) ? context[p.toLowerCase()] : m;
        });
    var tileGrid = /** @type {import("../tilegrid/WMTS.js").default} */ (this.tileGrid);
    var dimensions = this.dimensions_;
    return (
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("../proj/Projection.js").default} projection Projection.
     * @return {string|undefined} Tile URL.
     */
    function (tileCoord, pixelRatio, projection) {
        if (!tileCoord) {
            return undefined;
        }
        else {
            var localContext_1 = {
                'TileMatrix': tileGrid.getMatrixId(tileCoord[0]),
                'TileCol': tileCoord[1],
                'TileRow': tileCoord[2]
            };
            Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["assign"])(localContext_1, dimensions);
            var url = template;
            if (requestEncoding == _WMTSRequestEncoding_js__WEBPACK_IMPORTED_MODULE_5__["default"].KVP) {
                url = Object(_uri_js__WEBPACK_IMPORTED_MODULE_7__["appendParams"])(url, localContext_1);
            }
            else {
                url = url.replace(/\{(\w+?)\}/g, function (m, p) {
                    return localContext_1[p];
                });
            }
            return url;
        }
    });
}
//# sourceMappingURL=WMTS.js.map

/***/ }),

/***/ "./node_modules/ol/source/WMTSRequestEncoding.js":
/*!*******************************************************!*\
  !*** ./node_modules/ol/source/WMTSRequestEncoding.js ***!
  \*******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/source/WMTSRequestEncoding
 */
/**
 * Request encoding. One of 'KVP', 'REST'.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    KVP: 'KVP',
    REST: 'REST' // see spec §10
});
//# sourceMappingURL=WMTSRequestEncoding.js.map

/***/ }),

/***/ "./node_modules/ol/source/XYZ.js":
/*!***************************************!*\
  !*** ./node_modules/ol/source/XYZ.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _TileImage_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony import */ var _tilegrid_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../tilegrid.js */ "./node_modules/ol/tilegrid.js");
/**
 * @module ol/source/XYZ
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();


/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {boolean} [opaque=true] Whether the layer is opaque.
 * @property {import("../proj.js").ProjectionLike} [projection='EPSG:3857'] Projection.
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {number} [maxZoom=42] Optional max zoom level. Not used if `tileGrid` is provided.
 * @property {number} [minZoom=0] Optional min zoom level. Not used if `tileGrid` is provided.
 * @property {number} [maxResolution] Optional tile grid resolution at level zero. Not used if `tileGrid` is provided.
 * @property {import("../tilegrid/TileGrid.js").default} [tileGrid] Tile grid.
 * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
 * ```js
 * function(imageTile, src) {
 *   imageTile.getImage().src = src;
 * };
 * ```
 * @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.
 * For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px
 * by 512px images (for retina/hidpi devices) then `tilePixelRatio`
 * should be set to `2`.
 * @property {number|import("../size.js").Size} [tileSize=[256, 256]] The tile size used by the tile service.
 * Not used if `tileGrid` is provided.
 * @property {import("../Tile.js").UrlFunction} [tileUrlFunction] Optional function to get
 * tile URL given a tile coordinate and the projection.
 * Required if `url` or `urls` are not provided.
 * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`,
 * and `{z}` placeholders. A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`,
 * may be used instead of defining each one separately in the `urls` option.
 * @property {Array<string>} [urls] An array of URL templates.
 * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
 * @property {number} [transition] Duration of the opacity transition for rendering.
 * To disable the opacity transition, pass `transition: 0`.
 * @property {number} [zDirection=0] Indicate which resolution should be used
 * by a renderer if the view resolution does not match any resolution of the tile source.
 * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
 * will be used. If -1, the nearest higher resolution will be used.
 */
/**
 * @classdesc
 * Layer source for tile data with URLs in a set XYZ format that are
 * defined in a URL template. By default, this follows the widely-used
 * Google grid where `x` 0 and `y` 0 are in the top left. Grids like
 * TMS where `x` 0 and `y` 0 are in the bottom left can be used by
 * using the `{-y}` placeholder in the URL template, so long as the
 * source does not have a custom tile grid. In this case,
 * {@link module:ol/source/TileImage} can be used with a `tileUrlFunction`
 * such as:
 *
 *  tileUrlFunction: function(coordinate) {
 *    return 'http://mapserver.com/' + coordinate[0] + '/' +
 *        coordinate[1] + '/' + coordinate[2] + '.png';
 *    }
 *
 * @api
 */
var XYZ = /** @class */ (function (_super) {
    __extends(XYZ, _super);
    /**
     * @param {Options=} opt_options XYZ options.
     */
    function XYZ(opt_options) {
        var _this = this;
        var options = opt_options || {};
        var projection = options.projection !== undefined ?
            options.projection : 'EPSG:3857';
        var tileGrid = options.tileGrid !== undefined ? options.tileGrid :
            Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_1__["createXYZ"])({
                extent: Object(_tilegrid_js__WEBPACK_IMPORTED_MODULE_1__["extentFromProjection"])(projection),
                maxResolution: options.maxResolution,
                maxZoom: options.maxZoom,
                minZoom: options.minZoom,
                tileSize: options.tileSize
            });
        _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            crossOrigin: options.crossOrigin,
            opaque: options.opaque,
            projection: projection,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            tileGrid: tileGrid,
            tileLoadFunction: options.tileLoadFunction,
            tilePixelRatio: options.tilePixelRatio,
            tileUrlFunction: options.tileUrlFunction,
            url: options.url,
            urls: options.urls,
            wrapX: options.wrapX !== undefined ? options.wrapX : true,
            transition: options.transition,
            attributionsCollapsible: options.attributionsCollapsible,
            zDirection: options.zDirection
        }) || this;
        return _this;
    }
    return XYZ;
}(_TileImage_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (XYZ);
//# sourceMappingURL=XYZ.js.map

/***/ }),

/***/ "./node_modules/ol/source/Zoomify.js":
/*!*******************************************!*\
  !*** ./node_modules/ol/source/Zoomify.js ***!
  \*******************************************/
/*! exports provided: CustomTile, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomTile", function() { return CustomTile; });
/* harmony import */ var _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../tilegrid/common.js */ "./node_modules/ol/tilegrid/common.js");
/* harmony import */ var _ImageTile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ImageTile.js */ "./node_modules/ol/ImageTile.js");
/* harmony import */ var _TileState_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../TileState.js */ "./node_modules/ol/TileState.js");
/* harmony import */ var _tileurlfunction_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../tileurlfunction.js */ "./node_modules/ol/tileurlfunction.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _TileImage_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./TileImage.js */ "./node_modules/ol/source/TileImage.js");
/* harmony import */ var _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../tilegrid/TileGrid.js */ "./node_modules/ol/tilegrid/TileGrid.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/source/Zoomify
 */










/**
 * @enum {string}
 */
var TierSizeCalculation = {
    DEFAULT: 'default',
    TRUNCATED: 'truncated'
};
var CustomTile = /** @class */ (function (_super) {
    __extends(CustomTile, _super);
    /**
     * @param {import("../size.js").Size} tileSize Full tile size.
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {TileState} state State.
     * @param {string} src Image source URI.
     * @param {?string} crossOrigin Cross origin.
     * @param {import("../Tile.js").LoadFunction} tileLoadFunction Tile load function.
     * @param {import("../Tile.js").Options=} opt_options Tile options.
     */
    function CustomTile(tileSize, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) {
        var _this = _super.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction, opt_options) || this;
        /**
         * @private
         * @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement}
         */
        _this.zoomifyImage_ = null;
        /**
         * @type {import("../size.js").Size}
         */
        _this.tileSize_ = tileSize;
        return _this;
    }
    /**
     * @inheritDoc
     */
    CustomTile.prototype.getImage = function () {
        if (this.zoomifyImage_) {
            return this.zoomifyImage_;
        }
        var image = _super.prototype.getImage.call(this);
        if (this.state == _TileState_js__WEBPACK_IMPORTED_MODULE_2__["default"].LOADED) {
            var tileSize = this.tileSize_;
            if (image.width == tileSize[0] && image.height == tileSize[1]) {
                this.zoomifyImage_ = image;
                return image;
            }
            else {
                var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_5__["createCanvasContext2D"])(tileSize[0], tileSize[1]);
                context.drawImage(image, 0, 0);
                this.zoomifyImage_ = context.canvas;
                return context.canvas;
            }
        }
        else {
            return image;
        }
    };
    return CustomTile;
}(_ImageTile_js__WEBPACK_IMPORTED_MODULE_1__["default"]));

/**
 * @typedef {Object} Options
 * @property {import("./Source.js").AttributionLike} [attributions] Attributions.
 * @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images.  Note that
 * you must provide a `crossOrigin` value  you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {import("../proj.js").ProjectionLike} [projection] Projection.
 * @property {number} [tilePixelRatio] The pixel ratio used by the tile service. For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px by 512px images (for retina/hidpi devices) then `tilePixelRatio` should be set to `2`
 * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
 * Higher values can increase reprojection performance, but decrease precision.
 * @property {string} url URL template or base URL of the Zoomify service.
 * A base URL is the fixed part
 * of the URL, excluding the tile group, z, x, and y folder structure, e.g.
 * `http://my.zoomify.info/IMAGE.TIF/`. A URL template must include
 * `{TileGroup}`, `{x}`, `{y}`, and `{z}` placeholders, e.g.
 * `http://my.zoomify.info/IMAGE.TIF/{TileGroup}/{z}-{x}-{y}.jpg`.
 * Internet Imaging Protocol (IIP) with JTL extension can be also used with
 * `{tileIndex}` and `{z}` placeholders, e.g.
 * `http://my.zoomify.info?FIF=IMAGE.TIF&JTL={z},{tileIndex}`.
 * A `{?-?}` template pattern, for example `subdomain{a-f}.domain.com`, may be
 * used instead of defining each one separately in the `urls` option.
 * @property {string} [tierSizeCalculation] Tier size calculation method: `default` or `truncated`.
 * @property {import("../size.js").Size} size
 * @property {import("../extent.js").Extent} [extent] Extent for the TileGrid that is created.
 * Default sets the TileGrid in the
 * fourth quadrant, meaning extent is `[0, -height, width, 0]`. To change the
 * extent to the first quadrant (the default for OpenLayers 2) set the extent
 * as `[0, 0, width, height]`.
 * @property {number} [transition] Duration of the opacity transition for rendering.
 * To disable the opacity transition, pass `transition: 0`.
 * @property {number} [tileSize=256] Tile size. Same tile size is used for all zoom levels.
 * @property {number} [zDirection] Indicate which resolution should be used
 * by a renderer if the views resolution does not match any resolution of the tile source.
 * If 0, the nearest resolution will be used. If 1, the nearest lower resolution
 * will be used. If -1, the nearest higher resolution will be used.
 */
/**
 * @classdesc
 * Layer source for tile data in Zoomify format (both Zoomify and Internet
 * Imaging Protocol are supported).
 * @api
 */
var Zoomify = /** @class */ (function (_super) {
    __extends(Zoomify, _super);
    /**
     * @param {Options} opt_options Options.
     */
    function Zoomify(opt_options) {
        var _this = this;
        var options = opt_options;
        var size = options.size;
        var tierSizeCalculation = options.tierSizeCalculation !== undefined ?
            options.tierSizeCalculation :
            TierSizeCalculation.DEFAULT;
        var tilePixelRatio = options.tilePixelRatio || 1;
        var imageWidth = size[0];
        var imageHeight = size[1];
        var tierSizeInTiles = [];
        var tileSize = options.tileSize || _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_TILE_SIZE"];
        var tileSizeForTierSizeCalculation = tileSize * tilePixelRatio;
        switch (tierSizeCalculation) {
            case TierSizeCalculation.DEFAULT:
                while (imageWidth > tileSizeForTierSizeCalculation || imageHeight > tileSizeForTierSizeCalculation) {
                    tierSizeInTiles.push([
                        Math.ceil(imageWidth / tileSizeForTierSizeCalculation),
                        Math.ceil(imageHeight / tileSizeForTierSizeCalculation)
                    ]);
                    tileSizeForTierSizeCalculation += tileSizeForTierSizeCalculation;
                }
                break;
            case TierSizeCalculation.TRUNCATED:
                var width = imageWidth;
                var height = imageHeight;
                while (width > tileSizeForTierSizeCalculation || height > tileSizeForTierSizeCalculation) {
                    tierSizeInTiles.push([
                        Math.ceil(width / tileSizeForTierSizeCalculation),
                        Math.ceil(height / tileSizeForTierSizeCalculation)
                    ]);
                    width >>= 1;
                    height >>= 1;
                }
                break;
            default:
                Object(_asserts_js__WEBPACK_IMPORTED_MODULE_4__["assert"])(false, 53); // Unknown `tierSizeCalculation` configured
                break;
        }
        tierSizeInTiles.push([1, 1]);
        tierSizeInTiles.reverse();
        var resolutions = [tilePixelRatio];
        var tileCountUpToTier = [0];
        for (var i = 1, ii = tierSizeInTiles.length; i < ii; i++) {
            resolutions.push(tilePixelRatio << i);
            tileCountUpToTier.push(tierSizeInTiles[i - 1][0] * tierSizeInTiles[i - 1][1] +
                tileCountUpToTier[i - 1]);
        }
        resolutions.reverse();
        var tileGrid = new _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_8__["default"]({
            tileSize: tileSize,
            extent: options.extent || [0, -imageHeight, imageWidth, 0],
            resolutions: resolutions
        });
        var url = options.url;
        if (url && url.indexOf('{TileGroup}') == -1 && url.indexOf('{tileIndex}') == -1) {
            url += '{TileGroup}/{z}-{x}-{y}.jpg';
        }
        var urls = Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_3__["expandUrl"])(url);
        var tileWidth = tileSize * tilePixelRatio;
        /**
         * @param {string} template Template.
         * @return {import("../Tile.js").UrlFunction} Tile URL function.
         */
        function createFromTemplate(template) {
            return (
            /**
             * @param {import("../tilecoord.js").TileCoord} tileCoord Tile Coordinate.
             * @param {number} pixelRatio Pixel ratio.
             * @param {import("../proj/Projection.js").default} projection Projection.
             * @return {string|undefined} Tile URL.
             */
            function (tileCoord, pixelRatio, projection) {
                if (!tileCoord) {
                    return undefined;
                }
                else {
                    var tileCoordZ = tileCoord[0];
                    var tileCoordX = tileCoord[1];
                    var tileCoordY = tileCoord[2];
                    var tileIndex = tileCoordX +
                        tileCoordY * tierSizeInTiles[tileCoordZ][0];
                    var tileGroup = ((tileIndex + tileCountUpToTier[tileCoordZ]) / tileWidth) | 0;
                    var localContext_1 = {
                        'z': tileCoordZ,
                        'x': tileCoordX,
                        'y': tileCoordY,
                        'tileIndex': tileIndex,
                        'TileGroup': 'TileGroup' + tileGroup
                    };
                    return template.replace(/\{(\w+?)\}/g, function (m, p) {
                        return localContext_1[p];
                    });
                }
            });
        }
        var tileUrlFunction = Object(_tileurlfunction_js__WEBPACK_IMPORTED_MODULE_3__["createFromTileUrlFunctions"])(urls.map(createFromTemplate));
        var ZoomifyTileClass = CustomTile.bind(null, Object(_size_js__WEBPACK_IMPORTED_MODULE_6__["toSize"])(tileSize * tilePixelRatio));
        _this = _super.call(this, {
            attributions: options.attributions,
            cacheSize: options.cacheSize,
            crossOrigin: options.crossOrigin,
            projection: options.projection,
            tilePixelRatio: tilePixelRatio,
            reprojectionErrorThreshold: options.reprojectionErrorThreshold,
            tileClass: ZoomifyTileClass,
            tileGrid: tileGrid,
            tileUrlFunction: tileUrlFunction,
            transition: options.transition
        }) || this;
        /**
         * @inheritDoc
         */
        _this.zDirection = options.zDirection;
        // Server retina tile detection (non-standard):
        // Try loading the center tile for the highest resolution. If it is not
        // available, we are dealing with retina tiles, and need to adjust the
        // tile url calculation.
        var tileUrl = tileGrid.getTileCoordForCoordAndResolution(Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__["getCenter"])(tileGrid.getExtent()), resolutions[resolutions.length - 1]);
        var testTileUrl = tileUrlFunction(tileUrl, 1, null);
        var image = new Image();
        image.addEventListener('error', function () {
            tileWidth = tileSize;
            this.changed();
        }.bind(_this));
        image.src = testTileUrl;
        return _this;
    }
    return Zoomify;
}(_TileImage_js__WEBPACK_IMPORTED_MODULE_7__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Zoomify);
//# sourceMappingURL=Zoomify.js.map

/***/ }),

/***/ "./node_modules/ol/source/common.js":
/*!******************************************!*\
  !*** ./node_modules/ol/source/common.js ***!
  \******************************************/
/*! exports provided: DEFAULT_WMS_VERSION */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_WMS_VERSION", function() { return DEFAULT_WMS_VERSION; });
/**
 * @module ol/source/common
 */
/**
 * Default WMS version.
 * @type {string}
 */
var DEFAULT_WMS_VERSION = '1.3.0';
//# sourceMappingURL=common.js.map

/***/ }),

/***/ "./node_modules/ol/sphere.js":
/*!***********************************!*\
  !*** ./node_modules/ol/sphere.js ***!
  \***********************************/
/*! exports provided: DEFAULT_RADIUS, getDistance, getLength, getArea, offset */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_RADIUS", function() { return DEFAULT_RADIUS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDistance", function() { return getDistance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLength", function() { return getLength; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getArea", function() { return getArea; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "offset", function() { return offset; });
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/**
 * @module ol/sphere
 */


/**
 * Object literal with options for the {@link getLength} or {@link getArea}
 * functions.
 * @typedef {Object} SphereMetricOptions
 * @property {import("./proj.js").ProjectionLike} [projection='EPSG:3857']
 * Projection of the  geometry.  By default, the geometry is assumed to be in
 * Web Mercator.
 * @property {number} [radius=6371008.8] Sphere radius.  By default, the
 * [mean Earth radius](https://en.wikipedia.org/wiki/Earth_radius#Mean_radius)
 * for the WGS84 ellipsoid is used.
 */
/**
 * The mean Earth radius (1/3 * (2a + b)) for the WGS84 ellipsoid.
 * https://en.wikipedia.org/wiki/Earth_radius#Mean_radius
 * @type {number}
 */
var DEFAULT_RADIUS = 6371008.8;
/**
 * Get the great circle distance (in meters) between two geographic coordinates.
 * @param {Array} c1 Starting coordinate.
 * @param {Array} c2 Ending coordinate.
 * @param {number=} opt_radius The sphere radius to use.  Defaults to the Earth's
 *     mean radius using the WGS84 ellipsoid.
 * @return {number} The great circle distance between the points (in meters).
 * @api
 */
function getDistance(c1, c2, opt_radius) {
    var radius = opt_radius || DEFAULT_RADIUS;
    var lat1 = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(c1[1]);
    var lat2 = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(c2[1]);
    var deltaLatBy2 = (lat2 - lat1) / 2;
    var deltaLonBy2 = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(c2[0] - c1[0]) / 2;
    var a = Math.sin(deltaLatBy2) * Math.sin(deltaLatBy2) +
        Math.sin(deltaLonBy2) * Math.sin(deltaLonBy2) *
            Math.cos(lat1) * Math.cos(lat2);
    return 2 * radius * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
}
/**
 * Get the cumulative great circle length of linestring coordinates (geographic).
 * @param {Array} coordinates Linestring coordinates.
 * @param {number} radius The sphere radius to use.
 * @return {number} The length (in meters).
 */
function getLengthInternal(coordinates, radius) {
    var length = 0;
    for (var i = 0, ii = coordinates.length; i < ii - 1; ++i) {
        length += getDistance(coordinates[i], coordinates[i + 1], radius);
    }
    return length;
}
/**
 * Get the spherical length of a geometry.  This length is the sum of the
 * great circle distances between coordinates.  For polygons, the length is
 * the sum of all rings.  For points, the length is zero.  For multi-part
 * geometries, the length is the sum of the length of each part.
 * @param {import("./geom/Geometry.js").default} geometry A geometry.
 * @param {SphereMetricOptions=} opt_options Options for the
 * length calculation.  By default, geometries are assumed to be in 'EPSG:3857'.
 * You can change this by providing a `projection` option.
 * @return {number} The spherical length (in meters).
 * @api
 */
function getLength(geometry, opt_options) {
    var options = opt_options || {};
    var radius = options.radius || DEFAULT_RADIUS;
    var projection = options.projection || 'EPSG:3857';
    var type = geometry.getType();
    if (type !== _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].GEOMETRY_COLLECTION) {
        geometry = geometry.clone().transform(projection, 'EPSG:4326');
    }
    var length = 0;
    var coordinates, coords, i, ii, j, jj;
    switch (type) {
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINT:
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_POINT: {
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].LINE_STRING:
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].LINEAR_RING: {
            coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates();
            length = getLengthInternal(coordinates, radius);
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_LINE_STRING:
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POLYGON: {
            coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates();
            for (i = 0, ii = coordinates.length; i < ii; ++i) {
                length += getLengthInternal(coordinates[i], radius);
            }
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_POLYGON: {
            coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates();
            for (i = 0, ii = coordinates.length; i < ii; ++i) {
                coords = coordinates[i];
                for (j = 0, jj = coords.length; j < jj; ++j) {
                    length += getLengthInternal(coords[j], radius);
                }
            }
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].GEOMETRY_COLLECTION: {
            var geometries = /** @type {import("./geom/GeometryCollection.js").default} */ (geometry).getGeometries();
            for (i = 0, ii = geometries.length; i < ii; ++i) {
                length += getLength(geometries[i], opt_options);
            }
            break;
        }
        default: {
            throw new Error('Unsupported geometry type: ' + type);
        }
    }
    return length;
}
/**
 * Returns the spherical area for a list of coordinates.
 *
 * [Reference](https://trs-new.jpl.nasa.gov/handle/2014/40409)
 * Robert. G. Chamberlain and William H. Duquette, "Some Algorithms for
 * Polygons on a Sphere", JPL Publication 07-03, Jet Propulsion
 * Laboratory, Pasadena, CA, June 2007
 *
 * @param {Array<import("./coordinate.js").Coordinate>} coordinates List of coordinates of a linear
 * ring. If the ring is oriented clockwise, the area will be positive,
 * otherwise it will be negative.
 * @param {number} radius The sphere radius.
 * @return {number} Area (in square meters).
 */
function getAreaInternal(coordinates, radius) {
    var area = 0;
    var len = coordinates.length;
    var x1 = coordinates[len - 1][0];
    var y1 = coordinates[len - 1][1];
    for (var i = 0; i < len; i++) {
        var x2 = coordinates[i][0];
        var y2 = coordinates[i][1];
        area += Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(x2 - x1) *
            (2 + Math.sin(Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(y1)) +
                Math.sin(Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(y2)));
        x1 = x2;
        y1 = y2;
    }
    return area * radius * radius / 2.0;
}
/**
 * Get the spherical area of a geometry.  This is the area (in meters) assuming
 * that polygon edges are segments of great circles on a sphere.
 * @param {import("./geom/Geometry.js").default} geometry A geometry.
 * @param {SphereMetricOptions=} opt_options Options for the area
 *     calculation.  By default, geometries are assumed to be in 'EPSG:3857'.
 *     You can change this by providing a `projection` option.
 * @return {number} The spherical area (in square meters).
 * @api
 */
function getArea(geometry, opt_options) {
    var options = opt_options || {};
    var radius = options.radius || DEFAULT_RADIUS;
    var projection = options.projection || 'EPSG:3857';
    var type = geometry.getType();
    if (type !== _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].GEOMETRY_COLLECTION) {
        geometry = geometry.clone().transform(projection, 'EPSG:4326');
    }
    var area = 0;
    var coordinates, coords, i, ii, j, jj;
    switch (type) {
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINT:
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_POINT:
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].LINE_STRING:
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_LINE_STRING:
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].LINEAR_RING: {
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POLYGON: {
            coordinates = /** @type {import("./geom/Polygon.js").default} */ (geometry).getCoordinates();
            area = Math.abs(getAreaInternal(coordinates[0], radius));
            for (i = 1, ii = coordinates.length; i < ii; ++i) {
                area -= Math.abs(getAreaInternal(coordinates[i], radius));
            }
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_POLYGON: {
            coordinates = /** @type {import("./geom/SimpleGeometry.js").default} */ (geometry).getCoordinates();
            for (i = 0, ii = coordinates.length; i < ii; ++i) {
                coords = coordinates[i];
                area += Math.abs(getAreaInternal(coords[0], radius));
                for (j = 1, jj = coords.length; j < jj; ++j) {
                    area -= Math.abs(getAreaInternal(coords[j], radius));
                }
            }
            break;
        }
        case _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].GEOMETRY_COLLECTION: {
            var geometries = /** @type {import("./geom/GeometryCollection.js").default} */ (geometry).getGeometries();
            for (i = 0, ii = geometries.length; i < ii; ++i) {
                area += getArea(geometries[i], opt_options);
            }
            break;
        }
        default: {
            throw new Error('Unsupported geometry type: ' + type);
        }
    }
    return area;
}
/**
 * Returns the coordinate at the given distance and bearing from `c1`.
 *
 * @param {import("./coordinate.js").Coordinate} c1 The origin point (`[lon, lat]` in degrees).
 * @param {number} distance The great-circle distance between the origin
 *     point and the target point.
 * @param {number} bearing The bearing (in radians).
 * @param {number=} opt_radius The sphere radius to use.  Defaults to the Earth's
 *     mean radius using the WGS84 ellipsoid.
 * @return {import("./coordinate.js").Coordinate} The target point.
 */
function offset(c1, distance, bearing, opt_radius) {
    var radius = opt_radius || DEFAULT_RADIUS;
    var lat1 = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(c1[1]);
    var lon1 = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toRadians"])(c1[0]);
    var dByR = distance / radius;
    var lat = Math.asin(Math.sin(lat1) * Math.cos(dByR) +
        Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing));
    var lon = lon1 + Math.atan2(Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1), Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat));
    return [Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toDegrees"])(lon), Object(_math_js__WEBPACK_IMPORTED_MODULE_0__["toDegrees"])(lat)];
}
//# sourceMappingURL=sphere.js.map

/***/ }),

/***/ "./node_modules/ol/string.js":
/*!***********************************!*\
  !*** ./node_modules/ol/string.js ***!
  \***********************************/
/*! exports provided: padNumber, compareVersions */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "padNumber", function() { return padNumber; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareVersions", function() { return compareVersions; });
/**
 * @module ol/string
 */
/**
 * @param {number} number Number to be formatted
 * @param {number} width The desired width
 * @param {number=} opt_precision Precision of the output string (i.e. number of decimal places)
 * @returns {string} Formatted string
 */
function padNumber(number, width, opt_precision) {
    var numberString = opt_precision !== undefined ? number.toFixed(opt_precision) : '' + number;
    var decimal = numberString.indexOf('.');
    decimal = decimal === -1 ? numberString.length : decimal;
    return decimal > width ? numberString : new Array(1 + width - decimal).join('0') + numberString;
}
/**
 * Adapted from https://github.com/omichelsen/compare-versions/blob/master/index.js
 * @param {string|number} v1 First version
 * @param {string|number} v2 Second version
 * @returns {number} Value
 */
function compareVersions(v1, v2) {
    var s1 = ('' + v1).split('.');
    var s2 = ('' + v2).split('.');
    for (var i = 0; i < Math.max(s1.length, s2.length); i++) {
        var n1 = parseInt(s1[i] || '0', 10);
        var n2 = parseInt(s2[i] || '0', 10);
        if (n1 > n2) {
            return 1;
        }
        if (n2 > n1) {
            return -1;
        }
    }
    return 0;
}
//# sourceMappingURL=string.js.map

/***/ }),

/***/ "./node_modules/ol/structs/LRUCache.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/structs/LRUCache.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/**
 * @module ol/structs/LRUCache
 */

/**
 * @typedef {Object} Entry
 * @property {string} key_
 * @property {Object} newer
 * @property {Object} older
 * @property {*} value_
 */
/**
 * @classdesc
 * Implements a Least-Recently-Used cache where the keys do not conflict with
 * Object's properties (e.g. 'hasOwnProperty' is not allowed as a key). Expiring
 * items from the cache is the responsibility of the user.
 *
 * @fires import("../events/Event.js").default
 * @template T
 */
var LRUCache = /** @class */ (function () {
    /**
     * @param {number=} opt_highWaterMark High water mark.
     */
    function LRUCache(opt_highWaterMark) {
        /**
         * @type {number}
         */
        this.highWaterMark = opt_highWaterMark !== undefined ? opt_highWaterMark : 2048;
        /**
         * @private
         * @type {number}
         */
        this.count_ = 0;
        /**
         * @private
         * @type {!Object<string, Entry>}
         */
        this.entries_ = {};
        /**
         * @private
         * @type {?Entry}
         */
        this.oldest_ = null;
        /**
         * @private
         * @type {?Entry}
         */
        this.newest_ = null;
    }
    /**
     * @return {boolean} Can expire cache.
     */
    LRUCache.prototype.canExpireCache = function () {
        return this.getCount() > this.highWaterMark;
    };
    /**
     * FIXME empty description for jsdoc
     */
    LRUCache.prototype.clear = function () {
        this.count_ = 0;
        this.entries_ = {};
        this.oldest_ = null;
        this.newest_ = null;
    };
    /**
     * @param {string} key Key.
     * @return {boolean} Contains key.
     */
    LRUCache.prototype.containsKey = function (key) {
        return this.entries_.hasOwnProperty(key);
    };
    /**
     * @param {function(T, string, LRUCache<T>): ?} f The function
     *     to call for every entry from the oldest to the newer. This function takes
     *     3 arguments (the entry value, the entry key and the LRUCache object).
     *     The return value is ignored.
     */
    LRUCache.prototype.forEach = function (f) {
        var entry = this.oldest_;
        while (entry) {
            f(entry.value_, entry.key_, this);
            entry = entry.newer;
        }
    };
    /**
     * @param {string} key Key.
     * @param {*=} opt_options Options (reserverd for subclasses).
     * @return {T} Value.
     */
    LRUCache.prototype.get = function (key, opt_options) {
        var entry = this.entries_[key];
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
        if (entry === this.newest_) {
            return entry.value_;
        }
        else if (entry === this.oldest_) {
            this.oldest_ = /** @type {Entry} */ (this.oldest_.newer);
            this.oldest_.older = null;
        }
        else {
            entry.newer.older = entry.older;
            entry.older.newer = entry.newer;
        }
        entry.newer = null;
        entry.older = this.newest_;
        this.newest_.newer = entry;
        this.newest_ = entry;
        return entry.value_;
    };
    /**
     * Remove an entry from the cache.
     * @param {string} key The entry key.
     * @return {T} The removed entry.
     */
    LRUCache.prototype.remove = function (key) {
        var entry = this.entries_[key];
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(entry !== undefined, 15); // Tried to get a value for a key that does not exist in the cache
        if (entry === this.newest_) {
            this.newest_ = /** @type {Entry} */ (entry.older);
            if (this.newest_) {
                this.newest_.newer = null;
            }
        }
        else if (entry === this.oldest_) {
            this.oldest_ = /** @type {Entry} */ (entry.newer);
            if (this.oldest_) {
                this.oldest_.older = null;
            }
        }
        else {
            entry.newer.older = entry.older;
            entry.older.newer = entry.newer;
        }
        delete this.entries_[key];
        --this.count_;
        return entry.value_;
    };
    /**
     * @return {number} Count.
     */
    LRUCache.prototype.getCount = function () {
        return this.count_;
    };
    /**
     * @return {Array<string>} Keys.
     */
    LRUCache.prototype.getKeys = function () {
        var keys = new Array(this.count_);
        var i = 0;
        var entry;
        for (entry = this.newest_; entry; entry = entry.older) {
            keys[i++] = entry.key_;
        }
        return keys;
    };
    /**
     * @return {Array<T>} Values.
     */
    LRUCache.prototype.getValues = function () {
        var values = new Array(this.count_);
        var i = 0;
        var entry;
        for (entry = this.newest_; entry; entry = entry.older) {
            values[i++] = entry.value_;
        }
        return values;
    };
    /**
     * @return {T} Last value.
     */
    LRUCache.prototype.peekLast = function () {
        return this.oldest_.value_;
    };
    /**
     * @return {string} Last key.
     */
    LRUCache.prototype.peekLastKey = function () {
        return this.oldest_.key_;
    };
    /**
     * Get the key of the newest item in the cache.  Throws if the cache is empty.
     * @return {string} The newest key.
     */
    LRUCache.prototype.peekFirstKey = function () {
        return this.newest_.key_;
    };
    /**
     * @return {T} value Value.
     */
    LRUCache.prototype.pop = function () {
        var entry = this.oldest_;
        delete this.entries_[entry.key_];
        if (entry.newer) {
            entry.newer.older = null;
        }
        this.oldest_ = /** @type {Entry} */ (entry.newer);
        if (!this.oldest_) {
            this.newest_ = null;
        }
        --this.count_;
        return entry.value_;
    };
    /**
     * @param {string} key Key.
     * @param {T} value Value.
     */
    LRUCache.prototype.replace = function (key, value) {
        this.get(key); // update `newest_`
        this.entries_[key].value_ = value;
    };
    /**
     * @param {string} key Key.
     * @param {T} value Value.
     */
    LRUCache.prototype.set = function (key, value) {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(!(key in this.entries_), 16); // Tried to set a value for a key that is used already
        var entry = {
            key_: key,
            newer: null,
            older: this.newest_,
            value_: value
        };
        if (!this.newest_) {
            this.oldest_ = entry;
        }
        else {
            this.newest_.newer = entry;
        }
        this.newest_ = entry;
        this.entries_[key] = entry;
        ++this.count_;
    };
    /**
     * Set a maximum number of entries for the cache.
     * @param {number} size Cache size.
     * @api
     */
    LRUCache.prototype.setSize = function (size) {
        this.highWaterMark = size;
    };
    return LRUCache;
}());
/* harmony default export */ __webpack_exports__["default"] = (LRUCache);
//# sourceMappingURL=LRUCache.js.map

/***/ }),

/***/ "./node_modules/ol/structs/PriorityQueue.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/structs/PriorityQueue.js ***!
  \**************************************************/
/*! exports provided: DROP, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DROP", function() { return DROP; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/**
 * @module ol/structs/PriorityQueue
 */


/**
 * @type {number}
 */
var DROP = Infinity;
/**
 * @classdesc
 * Priority queue.
 *
 * The implementation is inspired from the Closure Library's Heap class and
 * Python's heapq module.
 *
 * See http://closure-library.googlecode.com/svn/docs/closure_goog_structs_heap.js.source.html
 * and http://hg.python.org/cpython/file/2.7/Lib/heapq.py.
 *
 * @template T
 */
var PriorityQueue = /** @class */ (function () {
    /**
     * @param {function(T): number} priorityFunction Priority function.
     * @param {function(T): string} keyFunction Key function.
     */
    function PriorityQueue(priorityFunction, keyFunction) {
        /**
         * @type {function(T): number}
         * @private
         */
        this.priorityFunction_ = priorityFunction;
        /**
         * @type {function(T): string}
         * @private
         */
        this.keyFunction_ = keyFunction;
        /**
         * @type {Array<T>}
         * @private
         */
        this.elements_ = [];
        /**
         * @type {Array<number>}
         * @private
         */
        this.priorities_ = [];
        /**
         * @type {!Object<string, boolean>}
         * @private
         */
        this.queuedElements_ = {};
    }
    /**
     * FIXME empty description for jsdoc
     */
    PriorityQueue.prototype.clear = function () {
        this.elements_.length = 0;
        this.priorities_.length = 0;
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_1__["clear"])(this.queuedElements_);
    };
    /**
     * Remove and return the highest-priority element. O(log N).
     * @return {T} Element.
     */
    PriorityQueue.prototype.dequeue = function () {
        var elements = this.elements_;
        var priorities = this.priorities_;
        var element = elements[0];
        if (elements.length == 1) {
            elements.length = 0;
            priorities.length = 0;
        }
        else {
            elements[0] = elements.pop();
            priorities[0] = priorities.pop();
            this.siftUp_(0);
        }
        var elementKey = this.keyFunction_(element);
        delete this.queuedElements_[elementKey];
        return element;
    };
    /**
     * Enqueue an element. O(log N).
     * @param {T} element Element.
     * @return {boolean} The element was added to the queue.
     */
    PriorityQueue.prototype.enqueue = function (element) {
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(!(this.keyFunction_(element) in this.queuedElements_), 31); // Tried to enqueue an `element` that was already added to the queue
        var priority = this.priorityFunction_(element);
        if (priority != DROP) {
            this.elements_.push(element);
            this.priorities_.push(priority);
            this.queuedElements_[this.keyFunction_(element)] = true;
            this.siftDown_(0, this.elements_.length - 1);
            return true;
        }
        return false;
    };
    /**
     * @return {number} Count.
     */
    PriorityQueue.prototype.getCount = function () {
        return this.elements_.length;
    };
    /**
     * Gets the index of the left child of the node at the given index.
     * @param {number} index The index of the node to get the left child for.
     * @return {number} The index of the left child.
     * @private
     */
    PriorityQueue.prototype.getLeftChildIndex_ = function (index) {
        return index * 2 + 1;
    };
    /**
     * Gets the index of the right child of the node at the given index.
     * @param {number} index The index of the node to get the right child for.
     * @return {number} The index of the right child.
     * @private
     */
    PriorityQueue.prototype.getRightChildIndex_ = function (index) {
        return index * 2 + 2;
    };
    /**
     * Gets the index of the parent of the node at the given index.
     * @param {number} index The index of the node to get the parent for.
     * @return {number} The index of the parent.
     * @private
     */
    PriorityQueue.prototype.getParentIndex_ = function (index) {
        return (index - 1) >> 1;
    };
    /**
     * Make this a heap. O(N).
     * @private
     */
    PriorityQueue.prototype.heapify_ = function () {
        var i;
        for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {
            this.siftUp_(i);
        }
    };
    /**
     * @return {boolean} Is empty.
     */
    PriorityQueue.prototype.isEmpty = function () {
        return this.elements_.length === 0;
    };
    /**
     * @param {string} key Key.
     * @return {boolean} Is key queued.
     */
    PriorityQueue.prototype.isKeyQueued = function (key) {
        return key in this.queuedElements_;
    };
    /**
     * @param {T} element Element.
     * @return {boolean} Is queued.
     */
    PriorityQueue.prototype.isQueued = function (element) {
        return this.isKeyQueued(this.keyFunction_(element));
    };
    /**
     * @param {number} index The index of the node to move down.
     * @private
     */
    PriorityQueue.prototype.siftUp_ = function (index) {
        var elements = this.elements_;
        var priorities = this.priorities_;
        var count = elements.length;
        var element = elements[index];
        var priority = priorities[index];
        var startIndex = index;
        while (index < (count >> 1)) {
            var lIndex = this.getLeftChildIndex_(index);
            var rIndex = this.getRightChildIndex_(index);
            var smallerChildIndex = rIndex < count &&
                priorities[rIndex] < priorities[lIndex] ?
                rIndex : lIndex;
            elements[index] = elements[smallerChildIndex];
            priorities[index] = priorities[smallerChildIndex];
            index = smallerChildIndex;
        }
        elements[index] = element;
        priorities[index] = priority;
        this.siftDown_(startIndex, index);
    };
    /**
     * @param {number} startIndex The index of the root.
     * @param {number} index The index of the node to move up.
     * @private
     */
    PriorityQueue.prototype.siftDown_ = function (startIndex, index) {
        var elements = this.elements_;
        var priorities = this.priorities_;
        var element = elements[index];
        var priority = priorities[index];
        while (index > startIndex) {
            var parentIndex = this.getParentIndex_(index);
            if (priorities[parentIndex] > priority) {
                elements[index] = elements[parentIndex];
                priorities[index] = priorities[parentIndex];
                index = parentIndex;
            }
            else {
                break;
            }
        }
        elements[index] = element;
        priorities[index] = priority;
    };
    /**
     * FIXME empty description for jsdoc
     */
    PriorityQueue.prototype.reprioritize = function () {
        var priorityFunction = this.priorityFunction_;
        var elements = this.elements_;
        var priorities = this.priorities_;
        var index = 0;
        var n = elements.length;
        var element, i, priority;
        for (i = 0; i < n; ++i) {
            element = elements[i];
            priority = priorityFunction(element);
            if (priority == DROP) {
                delete this.queuedElements_[this.keyFunction_(element)];
            }
            else {
                priorities[index] = priority;
                elements[index++] = element;
            }
        }
        elements.length = index;
        priorities.length = index;
        this.heapify_();
    };
    return PriorityQueue;
}());
/* harmony default export */ __webpack_exports__["default"] = (PriorityQueue);
//# sourceMappingURL=PriorityQueue.js.map

/***/ }),

/***/ "./node_modules/ol/structs/RBush.js":
/*!******************************************!*\
  !*** ./node_modules/ol/structs/RBush.js ***!
  \******************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var rbush_rbush_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rbush/rbush.js */ "./node_modules/rbush/rbush.js");
/* harmony import */ var rbush_rbush_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(rbush_rbush_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/**
 * @module ol/structs/RBush
 */




/**
 * @typedef {Object} Entry
 * @property {number} minX
 * @property {number} minY
 * @property {number} maxX
 * @property {number} maxY
 * @property {Object} [value]
 */
/**
 * @classdesc
 * Wrapper around the RBush by Vladimir Agafonkin.
 * See https://github.com/mourner/rbush.
 *
 * @template T
 */
var RBush = /** @class */ (function () {
    /**
     * @param {number=} opt_maxEntries Max entries.
     */
    function RBush(opt_maxEntries) {
        /**
         * @private
         */
        this.rbush_ = new rbush_rbush_js__WEBPACK_IMPORTED_MODULE_1___default.a(opt_maxEntries);
        /**
         * A mapping between the objects added to this rbush wrapper
         * and the objects that are actually added to the internal rbush.
         * @private
         * @type {Object<string, Entry>}
         */
        this.items_ = {};
    }
    /**
     * Insert a value into the RBush.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {T} value Value.
     */
    RBush.prototype.insert = function (extent, value) {
        /** @type {Entry} */
        var item = {
            minX: extent[0],
            minY: extent[1],
            maxX: extent[2],
            maxY: extent[3],
            value: value
        };
        this.rbush_.insert(item);
        this.items_[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(value)] = item;
    };
    /**
     * Bulk-insert values into the RBush.
     * @param {Array<import("../extent.js").Extent>} extents Extents.
     * @param {Array<T>} values Values.
     */
    RBush.prototype.load = function (extents, values) {
        var items = new Array(values.length);
        for (var i = 0, l = values.length; i < l; i++) {
            var extent = extents[i];
            var value = values[i];
            /** @type {Entry} */
            var item = {
                minX: extent[0],
                minY: extent[1],
                maxX: extent[2],
                maxY: extent[3],
                value: value
            };
            items[i] = item;
            this.items_[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(value)] = item;
        }
        this.rbush_.load(items);
    };
    /**
     * Remove a value from the RBush.
     * @param {T} value Value.
     * @return {boolean} Removed.
     */
    RBush.prototype.remove = function (value) {
        var uid = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(value);
        // get the object in which the value was wrapped when adding to the
        // internal rbush. then use that object to do the removal.
        var item = this.items_[uid];
        delete this.items_[uid];
        return this.rbush_.remove(item) !== null;
    };
    /**
     * Update the extent of a value in the RBush.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {T} value Value.
     */
    RBush.prototype.update = function (extent, value) {
        var item = this.items_[Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(value)];
        var bbox = [item.minX, item.minY, item.maxX, item.maxY];
        if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["equals"])(bbox, extent)) {
            this.remove(value);
            this.insert(extent, value);
        }
    };
    /**
     * Return all values in the RBush.
     * @return {Array<T>} All.
     */
    RBush.prototype.getAll = function () {
        var items = this.rbush_.all();
        return items.map(function (item) {
            return item.value;
        });
    };
    /**
     * Return all values in the given extent.
     * @param {import("../extent.js").Extent} extent Extent.
     * @return {Array<T>} All in extent.
     */
    RBush.prototype.getInExtent = function (extent) {
        /** @type {Entry} */
        var bbox = {
            minX: extent[0],
            minY: extent[1],
            maxX: extent[2],
            maxY: extent[3]
        };
        var items = this.rbush_.search(bbox);
        return items.map(function (item) {
            return item.value;
        });
    };
    /**
     * Calls a callback function with each value in the tree.
     * If the callback returns a truthy value, this value is returned without
     * checking the rest of the tree.
     * @param {function(T): *} callback Callback.
     * @return {*} Callback return value.
     */
    RBush.prototype.forEach = function (callback) {
        return this.forEach_(this.getAll(), callback);
    };
    /**
     * Calls a callback function with each value in the provided extent.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {function(T): *} callback Callback.
     * @return {*} Callback return value.
     */
    RBush.prototype.forEachInExtent = function (extent, callback) {
        return this.forEach_(this.getInExtent(extent), callback);
    };
    /**
     * @param {Array<T>} values Values.
     * @param {function(T): *} callback Callback.
     * @private
     * @return {*} Callback return value.
     */
    RBush.prototype.forEach_ = function (values, callback) {
        var result;
        for (var i = 0, l = values.length; i < l; i++) {
            result = callback(values[i]);
            if (result) {
                return result;
            }
        }
        return result;
    };
    /**
     * @return {boolean} Is empty.
     */
    RBush.prototype.isEmpty = function () {
        return Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__["isEmpty"])(this.items_);
    };
    /**
     * Remove all values from the RBush.
     */
    RBush.prototype.clear = function () {
        this.rbush_.clear();
        this.items_ = {};
    };
    /**
     * @param {import("../extent.js").Extent=} opt_extent Extent.
     * @return {import("../extent.js").Extent} Extent.
     */
    RBush.prototype.getExtent = function (opt_extent) {
        var data = this.rbush_.toJSON();
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["createOrUpdate"])(data.minX, data.minY, data.maxX, data.maxY, opt_extent);
    };
    /**
     * @param {RBush} rbush R-Tree.
     */
    RBush.prototype.concat = function (rbush) {
        this.rbush_.load(rbush.rbush_.all());
        for (var i in rbush.items_) {
            this.items_[i] = rbush.items_[i];
        }
    };
    return RBush;
}());
/* harmony default export */ __webpack_exports__["default"] = (RBush);
//# sourceMappingURL=RBush.js.map

/***/ }),

/***/ "./node_modules/ol/style.js":
/*!**********************************!*\
  !*** ./node_modules/ol/style.js ***!
  \**********************************/
/*! exports provided: Circle, Fill, Icon, IconImage, Image, RegularShape, Stroke, Style, Text */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _style_Circle_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./style/Circle.js */ "./node_modules/ol/style/Circle.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Circle", function() { return _style_Circle_js__WEBPACK_IMPORTED_MODULE_0__["default"]; });

/* harmony import */ var _style_Fill_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style/Fill.js */ "./node_modules/ol/style/Fill.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Fill", function() { return _style_Fill_js__WEBPACK_IMPORTED_MODULE_1__["default"]; });

/* harmony import */ var _style_Icon_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style/Icon.js */ "./node_modules/ol/style/Icon.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Icon", function() { return _style_Icon_js__WEBPACK_IMPORTED_MODULE_2__["default"]; });

/* harmony import */ var _style_IconImage_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style/IconImage.js */ "./node_modules/ol/style/IconImage.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IconImage", function() { return _style_IconImage_js__WEBPACK_IMPORTED_MODULE_3__["default"]; });

/* harmony import */ var _style_Image_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./style/Image.js */ "./node_modules/ol/style/Image.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Image", function() { return _style_Image_js__WEBPACK_IMPORTED_MODULE_4__["default"]; });

/* harmony import */ var _style_RegularShape_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./style/RegularShape.js */ "./node_modules/ol/style/RegularShape.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RegularShape", function() { return _style_RegularShape_js__WEBPACK_IMPORTED_MODULE_5__["default"]; });

/* harmony import */ var _style_Stroke_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./style/Stroke.js */ "./node_modules/ol/style/Stroke.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Stroke", function() { return _style_Stroke_js__WEBPACK_IMPORTED_MODULE_6__["default"]; });

/* harmony import */ var _style_Style_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./style/Style.js */ "./node_modules/ol/style/Style.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Style", function() { return _style_Style_js__WEBPACK_IMPORTED_MODULE_7__["default"]; });

/* harmony import */ var _style_Text_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./style/Text.js */ "./node_modules/ol/style/Text.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Text", function() { return _style_Text_js__WEBPACK_IMPORTED_MODULE_8__["default"]; });

/**
 * @module ol/style
 */









//# sourceMappingURL=style.js.map

/***/ }),

/***/ "./node_modules/ol/style/Circle.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/style/Circle.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _RegularShape_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./RegularShape.js */ "./node_modules/ol/style/RegularShape.js");
/**
 * @module ol/style/Circle
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();

/**
 * @typedef {Object} Options
 * @property {import("./Fill.js").default} [fill] Fill style.
 * @property {number} radius Circle radius.
 * @property {import("./Stroke.js").default} [stroke] Stroke style.
 * @property {Array<number>} [displacement=[0,0]] displacement
 */
/**
 * @classdesc
 * Set circle style for vector features.
 * @api
 */
var CircleStyle = /** @class */ (function (_super) {
    __extends(CircleStyle, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function CircleStyle(opt_options) {
        var _this = this;
        var options = opt_options ? opt_options : {};
        _this = _super.call(this, {
            points: Infinity,
            fill: options.fill,
            radius: options.radius,
            stroke: options.stroke,
            displacement: options.displacement !== undefined ? options.displacement : [0, 0]
        }) || this;
        return _this;
    }
    /**
    * Clones the style.
    * @return {CircleStyle} The cloned style.
    * @override
    * @api
    */
    CircleStyle.prototype.clone = function () {
        var style = new CircleStyle({
            fill: this.getFill() ? this.getFill().clone() : undefined,
            stroke: this.getStroke() ? this.getStroke().clone() : undefined,
            radius: this.getRadius(),
            displacement: this.getDisplacement().slice()
        });
        style.setOpacity(this.getOpacity());
        style.setScale(this.getScale());
        return style;
    };
    /**
     * Set the circle radius.
     *
     * @param {number} radius Circle radius.
     * @api
     */
    CircleStyle.prototype.setRadius = function (radius) {
        this.radius_ = radius;
        this.render();
    };
    return CircleStyle;
}(_RegularShape_js__WEBPACK_IMPORTED_MODULE_0__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (CircleStyle);
//# sourceMappingURL=Circle.js.map

/***/ }),

/***/ "./node_modules/ol/style/Fill.js":
/*!***************************************!*\
  !*** ./node_modules/ol/style/Fill.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/style/Fill
 */
/**
 * @typedef {Object} Options
 * @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color=null] A color, gradient or pattern.
 * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.
 * Default null; if null, the Canvas/renderer default black will be used.
 */
/**
 * @classdesc
 * Set fill style for vector features.
 * @api
 */
var Fill = /** @class */ (function () {
    /**
     * @param {Options=} opt_options Options.
     */
    function Fill(opt_options) {
        var options = opt_options || {};
        /**
         * @private
         * @type {import("../color.js").Color|import("../colorlike.js").ColorLike}
         */
        this.color_ = options.color !== undefined ? options.color : null;
    }
    /**
     * Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.
     * @return {Fill} The cloned style.
     * @api
     */
    Fill.prototype.clone = function () {
        var color = this.getColor();
        return new Fill({
            color: Array.isArray(color) ? color.slice() : color || undefined
        });
    };
    /**
     * Get the fill color.
     * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
     * @api
     */
    Fill.prototype.getColor = function () {
        return this.color_;
    };
    /**
     * Set the color.
     *
     * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
     * @api
     */
    Fill.prototype.setColor = function (color) {
        this.color_ = color;
    };
    return Fill;
}());
/* harmony default export */ __webpack_exports__["default"] = (Fill);
//# sourceMappingURL=Fill.js.map

/***/ }),

/***/ "./node_modules/ol/style/Icon.js":
/*!***************************************!*\
  !*** ./node_modules/ol/style/Icon.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../color.js */ "./node_modules/ol/color.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./IconAnchorUnits.js */ "./node_modules/ol/style/IconAnchorUnits.js");
/* harmony import */ var _IconImage_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./IconImage.js */ "./node_modules/ol/style/IconImage.js");
/* harmony import */ var _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./IconOrigin.js */ "./node_modules/ol/style/IconOrigin.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/style/Image.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/style/Icon
 */









/**
 * @typedef {Object} Options
 * @property {Array<number>} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center.
 * @property {import("./IconOrigin.js").default} [anchorOrigin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,
 * `top-left` or `top-right`.
 * @property {import("./IconAnchorUnits.js").default} [anchorXUnits='fraction'] Units in which the anchor x value is
 * specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates
 * the x value in pixels.
 * @property {import("./IconAnchorUnits.js").default} [anchorYUnits='fraction'] Units in which the anchor y value is
 * specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates
 * the y value in pixels.
 * @property {import("../color.js").Color|string} [color] Color to tint the icon. If not specified,
 * the icon will be left as is.
 * @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a
 * `crossOrigin` value if you want to access pixel data with the Canvas renderer.
 * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
 * @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
 * provided image must already be loaded. And in that case, it is required
 * to provide the size of the image, with the `imgSize` option.
 * @property {Array<number>} [offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
 * sub-rectangle to use from the original icon image.
 * @property {Array<number>} [displacement=[0,0]] Displacement the icon
 * @property {import("./IconOrigin.js").default} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
 * `top-left` or `top-right`.
 * @property {number} [opacity=1] Opacity of the icon.
 * @property {number} [scale=1] Scale.
 * @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view.
 * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
 * @property {import("../size.js").Size} [size] Icon size in pixel. Can be used together with `offset` to define the
 * sub-rectangle to use from the origin (sprite) icon image.
 * @property {import("../size.js").Size} [imgSize] Image size in pixels. Only required if `img` is set and `src` is not, and
 * for SVG images in Internet Explorer 11. The provided `imgSize` needs to match the actual size of the image.
 * @property {string} [src] Image source URI.
 */
/**
 * @classdesc
 * Set icon style for vector features.
 * @api
 */
var Icon = /** @class */ (function (_super) {
    __extends(Icon, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function Icon(opt_options) {
        var _this = this;
        var options = opt_options || {};
        /**
         * @type {number}
         */
        var opacity = options.opacity !== undefined ? options.opacity : 1;
        /**
         * @type {number}
         */
        var rotation = options.rotation !== undefined ? options.rotation : 0;
        /**
         * @type {number}
         */
        var scale = options.scale !== undefined ? options.scale : 1;
        /**
         * @type {boolean}
         */
        var rotateWithView = options.rotateWithView !== undefined ?
            options.rotateWithView : false;
        _this = _super.call(this, {
            opacity: opacity,
            rotation: rotation,
            scale: scale,
            displacement: options.displacement !== undefined ? options.displacement : [0, 0],
            rotateWithView: rotateWithView
        }) || this;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5];
        /**
         * @private
         * @type {Array<number>}
         */
        _this.normalizedAnchor_ = null;
        /**
         * @private
         * @type {import("./IconOrigin.js").default}
         */
        _this.anchorOrigin_ = options.anchorOrigin !== undefined ?
            options.anchorOrigin : _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].TOP_LEFT;
        /**
         * @private
         * @type {import("./IconAnchorUnits.js").default}
         */
        _this.anchorXUnits_ = options.anchorXUnits !== undefined ?
            options.anchorXUnits : _IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_5__["default"].FRACTION;
        /**
         * @private
         * @type {import("./IconAnchorUnits.js").default}
         */
        _this.anchorYUnits_ = options.anchorYUnits !== undefined ?
            options.anchorYUnits : _IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_5__["default"].FRACTION;
        /**
         * @private
         * @type {?string}
         */
        _this.crossOrigin_ =
            options.crossOrigin !== undefined ? options.crossOrigin : null;
        /**
         * @type {HTMLImageElement|HTMLCanvasElement}
         */
        var image = options.img !== undefined ? options.img : null;
        /**
         * @type {import("../size.js").Size}
         */
        var imgSize = options.imgSize !== undefined ? options.imgSize : null;
        /**
         * @type {string|undefined}
         */
        var src = options.src;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(!(src !== undefined && image), 4); // `image` and `src` cannot be provided at the same time
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(!image || (image && imgSize), 5); // `imgSize` must be set when `image` is provided
        if ((src === undefined || src.length === 0) && image) {
            src = /** @type {HTMLImageElement} */ (image).src || Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(image);
        }
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_2__["assert"])(src !== undefined && src.length > 0, 6); // A defined and non-empty `src` or `image` must be provided
        /**
         * @type {import("../ImageState.js").default}
         */
        var imageState = options.src !== undefined ?
            _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].IDLE : _ImageState_js__WEBPACK_IMPORTED_MODULE_1__["default"].LOADED;
        /**
         * @private
         * @type {import("../color.js").Color}
         */
        _this.color_ = options.color !== undefined ? Object(_color_js__WEBPACK_IMPORTED_MODULE_3__["asArray"])(options.color) : null;
        /**
         * @private
         * @type {import("./IconImage.js").default}
         */
        _this.iconImage_ = Object(_IconImage_js__WEBPACK_IMPORTED_MODULE_6__["get"])(image, /** @type {string} */ (src), imgSize, _this.crossOrigin_, imageState, _this.color_);
        /**
         * @private
         * @type {Array<number>}
         */
        _this.offset_ = options.offset !== undefined ? options.offset : [0, 0];
        /**
         * @private
         * @type {import("./IconOrigin.js").default}
         */
        _this.offsetOrigin_ = options.offsetOrigin !== undefined ?
            options.offsetOrigin : _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].TOP_LEFT;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.origin_ = null;
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        _this.size_ = options.size !== undefined ? options.size : null;
        return _this;
    }
    /**
     * Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
     * @return {Icon} The cloned style.
     * @api
     */
    Icon.prototype.clone = function () {
        return new Icon({
            anchor: this.anchor_.slice(),
            anchorOrigin: this.anchorOrigin_,
            anchorXUnits: this.anchorXUnits_,
            anchorYUnits: this.anchorYUnits_,
            crossOrigin: this.crossOrigin_,
            color: (this.color_ && this.color_.slice) ? this.color_.slice() : this.color_ || undefined,
            src: this.getSrc(),
            offset: this.offset_.slice(),
            offsetOrigin: this.offsetOrigin_,
            size: this.size_ !== null ? this.size_.slice() : undefined,
            opacity: this.getOpacity(),
            scale: this.getScale(),
            rotation: this.getRotation(),
            rotateWithView: this.getRotateWithView()
        });
    };
    /**
     * @inheritDoc
     * @api
     */
    Icon.prototype.getAnchor = function () {
        if (this.normalizedAnchor_) {
            return this.normalizedAnchor_;
        }
        var anchor = this.anchor_;
        var size = this.getSize();
        if (this.anchorXUnits_ == _IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_5__["default"].FRACTION ||
            this.anchorYUnits_ == _IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_5__["default"].FRACTION) {
            if (!size) {
                return null;
            }
            anchor = this.anchor_.slice();
            if (this.anchorXUnits_ == _IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_5__["default"].FRACTION) {
                anchor[0] *= size[0];
            }
            if (this.anchorYUnits_ == _IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_5__["default"].FRACTION) {
                anchor[1] *= size[1];
            }
        }
        if (this.anchorOrigin_ != _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].TOP_LEFT) {
            if (!size) {
                return null;
            }
            if (anchor === this.anchor_) {
                anchor = this.anchor_.slice();
            }
            if (this.anchorOrigin_ == _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].TOP_RIGHT ||
                this.anchorOrigin_ == _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].BOTTOM_RIGHT) {
                anchor[0] = -anchor[0] + size[0];
            }
            if (this.anchorOrigin_ == _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].BOTTOM_LEFT ||
                this.anchorOrigin_ == _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].BOTTOM_RIGHT) {
                anchor[1] = -anchor[1] + size[1];
            }
        }
        this.normalizedAnchor_ = anchor;
        return this.normalizedAnchor_;
    };
    /**
     * Set the anchor point. The anchor determines the center point for the
     * symbolizer.
     *
     * @param {Array<number>} anchor Anchor.
     * @api
     */
    Icon.prototype.setAnchor = function (anchor) {
        this.anchor_ = anchor;
        this.normalizedAnchor_ = null;
    };
    /**
     * Get the icon color.
     * @return {import("../color.js").Color} Color.
     * @api
     */
    Icon.prototype.getColor = function () {
        return this.color_;
    };
    /**
     * Get the image icon.
     * @param {number} pixelRatio Pixel ratio.
     * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
     * @override
     * @api
     */
    Icon.prototype.getImage = function (pixelRatio) {
        return this.iconImage_.getImage(pixelRatio);
    };
    /**
     * @override
     */
    Icon.prototype.getImageSize = function () {
        return this.iconImage_.getSize();
    };
    /**
     * @override
     */
    Icon.prototype.getHitDetectionImageSize = function () {
        return this.getImageSize();
    };
    /**
     * @override
     */
    Icon.prototype.getImageState = function () {
        return this.iconImage_.getImageState();
    };
    /**
     * @override
     */
    Icon.prototype.getHitDetectionImage = function (pixelRatio) {
        return this.iconImage_.getHitDetectionImage(pixelRatio);
    };
    /**
     * @inheritDoc
     * @api
     */
    Icon.prototype.getOrigin = function () {
        if (this.origin_) {
            return this.origin_;
        }
        var offset = this.offset_;
        var displacement = this.getDisplacement();
        if (this.offsetOrigin_ != _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].TOP_LEFT) {
            var size = this.getSize();
            var iconImageSize = this.iconImage_.getSize();
            if (!size || !iconImageSize) {
                return null;
            }
            offset = offset.slice();
            if (this.offsetOrigin_ == _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].TOP_RIGHT ||
                this.offsetOrigin_ == _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].BOTTOM_RIGHT) {
                offset[0] = iconImageSize[0] - size[0] - offset[0];
            }
            if (this.offsetOrigin_ == _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].BOTTOM_LEFT ||
                this.offsetOrigin_ == _IconOrigin_js__WEBPACK_IMPORTED_MODULE_7__["default"].BOTTOM_RIGHT) {
                offset[1] = iconImageSize[1] - size[1] - offset[1];
            }
        }
        offset[0] += displacement[0];
        offset[1] += displacement[1];
        this.origin_ = offset;
        return this.origin_;
    };
    /**
     * Get the image URL.
     * @return {string|undefined} Image src.
     * @api
     */
    Icon.prototype.getSrc = function () {
        return this.iconImage_.getSrc();
    };
    /**
     * @inheritDoc
     * @api
     */
    Icon.prototype.getSize = function () {
        return !this.size_ ? this.iconImage_.getSize() : this.size_;
    };
    /**
     * @override
     */
    Icon.prototype.listenImageChange = function (listener) {
        this.iconImage_.addEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CHANGE, listener);
    };
    /**
     * Load not yet loaded URI.
     * When rendering a feature with an icon style, the vector renderer will
     * automatically call this method. However, you might want to call this
     * method yourself for preloading or other purposes.
     * @override
     * @api
     */
    Icon.prototype.load = function () {
        this.iconImage_.load();
    };
    /**
     * @override
     */
    Icon.prototype.unlistenImageChange = function (listener) {
        this.iconImage_.removeEventListener(_events_EventType_js__WEBPACK_IMPORTED_MODULE_4__["default"].CHANGE, listener);
    };
    return Icon;
}(_Image_js__WEBPACK_IMPORTED_MODULE_8__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (Icon);
//# sourceMappingURL=Icon.js.map

/***/ }),

/***/ "./node_modules/ol/style/IconAnchorUnits.js":
/*!**************************************************!*\
  !*** ./node_modules/ol/style/IconAnchorUnits.js ***!
  \**************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/style/IconAnchorUnits
 */
/**
 * Icon anchor units. One of 'fraction', 'pixels'.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Anchor is a fraction
     * @api
     */
    FRACTION: 'fraction',
    /**
     * Anchor is in pixels
     * @api
     */
    PIXELS: 'pixels'
});
//# sourceMappingURL=IconAnchorUnits.js.map

/***/ }),

/***/ "./node_modules/ol/style/IconImage.js":
/*!********************************************!*\
  !*** ./node_modules/ol/style/IconImage.js ***!
  \********************************************/
/*! exports provided: get, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; });
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _events_Target_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../events/Target.js */ "./node_modules/ol/events/Target.js");
/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../events/EventType.js */ "./node_modules/ol/events/EventType.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _IconImageCache_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./IconImageCache.js */ "./node_modules/ol/style/IconImageCache.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Image.js */ "./node_modules/ol/Image.js");
/**
 * @module ol/style/IconImage
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();






var IconImage = /** @class */ (function (_super) {
    __extends(IconImage, _super);
    /**
     * @param {HTMLImageElement|HTMLCanvasElement} image Image.
     * @param {string|undefined} src Src.
     * @param {import("../size.js").Size} size Size.
     * @param {?string} crossOrigin Cross origin.
     * @param {import("../ImageState.js").default} imageState Image state.
     * @param {import("../color.js").Color} color Color.
     */
    function IconImage(image, src, size, crossOrigin, imageState, color) {
        var _this = _super.call(this) || this;
        /**
         * @private
         * @type {HTMLImageElement|HTMLCanvasElement}
         */
        _this.hitDetectionImage_ = null;
        /**
         * @private
         * @type {HTMLImageElement|HTMLCanvasElement}
         */
        _this.image_ = !image ? new Image() : image;
        if (crossOrigin !== null) {
            /** @type {HTMLImageElement} */ (_this.image_).crossOrigin = crossOrigin;
        }
        /**
         * @private
         * @type {HTMLCanvasElement}
         */
        _this.canvas_ = color ? document.createElement('canvas') : null;
        /**
         * @private
         * @type {import("../color.js").Color}
         */
        _this.color_ = color;
        /**
         * @private
         * @type {?function():void}
         */
        _this.unlisten_ = null;
        /**
         * @private
         * @type {import("../ImageState.js").default}
         */
        _this.imageState_ = imageState;
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        _this.size_ = size;
        /**
         * @private
         * @type {string|undefined}
         */
        _this.src_ = src;
        /**
         * @private
         * @type {boolean|undefined}
         */
        _this.tainted_;
        return _this;
    }
    /**
     * @private
     * @param {CanvasRenderingContext2D=} context A context with the image already drawn into.
     * @return {boolean} The image canvas is tainted.
     */
    IconImage.prototype.isTainted_ = function (context) {
        if (this.tainted_ === undefined && this.imageState_ === _ImageState_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOADED) {
            if (!context) {
                context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_0__["createCanvasContext2D"])(1, 1);
                context.drawImage(this.image_, 0, 0);
            }
            try {
                context.getImageData(0, 0, 1, 1);
                this.tainted_ = false;
            }
            catch (e) {
                this.tainted_ = true;
            }
        }
        return this.tainted_ === true;
    };
    /**
     * @private
     */
    IconImage.prototype.dispatchChangeEvent_ = function () {
        this.dispatchEvent(_events_EventType_js__WEBPACK_IMPORTED_MODULE_2__["default"].CHANGE);
    };
    /**
     * @private
     */
    IconImage.prototype.handleImageError_ = function () {
        this.imageState_ = _ImageState_js__WEBPACK_IMPORTED_MODULE_3__["default"].ERROR;
        this.unlistenImage_();
        this.dispatchChangeEvent_();
    };
    /**
     * @private
     */
    IconImage.prototype.handleImageLoad_ = function () {
        this.imageState_ = _ImageState_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOADED;
        if (this.size_) {
            this.image_.width = this.size_[0];
            this.image_.height = this.size_[1];
        }
        this.size_ = [this.image_.width, this.image_.height];
        this.unlistenImage_();
        this.replaceColor_();
        this.dispatchChangeEvent_();
    };
    /**
     * @param {number} pixelRatio Pixel ratio.
     * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
     */
    IconImage.prototype.getImage = function (pixelRatio) {
        return this.canvas_ ? this.canvas_ : this.image_;
    };
    /**
     * @return {import("../ImageState.js").default} Image state.
     */
    IconImage.prototype.getImageState = function () {
        return this.imageState_;
    };
    /**
     * @param {number} pixelRatio Pixel ratio.
     * @return {HTMLImageElement|HTMLCanvasElement} Image element.
     */
    IconImage.prototype.getHitDetectionImage = function (pixelRatio) {
        if (!this.hitDetectionImage_) {
            if (this.isTainted_()) {
                var width = this.size_[0];
                var height = this.size_[1];
                var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_0__["createCanvasContext2D"])(width, height);
                context.fillRect(0, 0, width, height);
                this.hitDetectionImage_ = context.canvas;
            }
            else {
                this.hitDetectionImage_ = this.image_;
            }
        }
        return this.hitDetectionImage_;
    };
    /**
     * @return {import("../size.js").Size} Image size.
     */
    IconImage.prototype.getSize = function () {
        return this.size_;
    };
    /**
     * @return {string|undefined} Image src.
     */
    IconImage.prototype.getSrc = function () {
        return this.src_;
    };
    /**
     * Load not yet loaded URI.
     */
    IconImage.prototype.load = function () {
        if (this.imageState_ == _ImageState_js__WEBPACK_IMPORTED_MODULE_3__["default"].IDLE) {
            this.imageState_ = _ImageState_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOADING;
            try {
                /** @type {HTMLImageElement} */ (this.image_).src = this.src_;
            }
            catch (e) {
                this.handleImageError_();
            }
            this.unlisten_ = Object(_Image_js__WEBPACK_IMPORTED_MODULE_5__["listenImage"])(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this));
        }
    };
    /**
     * @private
     */
    IconImage.prototype.replaceColor_ = function () {
        if (!this.color_) {
            return;
        }
        this.canvas_.width = this.image_.width;
        this.canvas_.height = this.image_.height;
        var ctx = this.canvas_.getContext('2d');
        ctx.drawImage(this.image_, 0, 0);
        if (this.isTainted_(ctx)) {
            // If reading from the canvas throws a SecurityError the same effect can be
            // achieved with globalCompositeOperation.
            // This could be used as the default, but it is not fully supported by all
            // browsers. E. g. Internet Explorer 11 does not support the multiply
            // operation and the resulting image shape will be completelly filled with
            // the provided color.
            // So this is only used as a fallback. It is still better than having no icon
            // at all.
            var c = this.color_;
            ctx.globalCompositeOperation = 'multiply';
            ctx.fillStyle = 'rgb(' + c[0] + ',' + c[1] + ',' + c[2] + ')';
            ctx.fillRect(0, 0, this.image_.width, this.image_.height);
            ctx.globalCompositeOperation = 'destination-in';
            ctx.drawImage(this.image_, 0, 0);
            return;
        }
        var imgData = ctx.getImageData(0, 0, this.image_.width, this.image_.height);
        var data = imgData.data;
        var r = this.color_[0] / 255.0;
        var g = this.color_[1] / 255.0;
        var b = this.color_[2] / 255.0;
        for (var i = 0, ii = data.length; i < ii; i += 4) {
            data[i] *= r;
            data[i + 1] *= g;
            data[i + 2] *= b;
        }
        ctx.putImageData(imgData, 0, 0);
    };
    /**
     * Discards event handlers which listen for load completion or errors.
     *
     * @private
     */
    IconImage.prototype.unlistenImage_ = function () {
        if (this.unlisten_) {
            this.unlisten_();
            this.unlisten_ = null;
        }
    };
    return IconImage;
}(_events_Target_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * @param {HTMLImageElement|HTMLCanvasElement} image Image.
 * @param {string} src Src.
 * @param {import("../size.js").Size} size Size.
 * @param {?string} crossOrigin Cross origin.
 * @param {import("../ImageState.js").default} imageState Image state.
 * @param {import("../color.js").Color} color Color.
 * @return {IconImage} Icon image.
 */
function get(image, src, size, crossOrigin, imageState, color) {
    var iconImage = _IconImageCache_js__WEBPACK_IMPORTED_MODULE_4__["shared"].get(src, crossOrigin, color);
    if (!iconImage) {
        iconImage = new IconImage(image, src, size, crossOrigin, imageState, color);
        _IconImageCache_js__WEBPACK_IMPORTED_MODULE_4__["shared"].set(src, crossOrigin, color, iconImage);
    }
    return iconImage;
}
/* harmony default export */ __webpack_exports__["default"] = (IconImage);
//# sourceMappingURL=IconImage.js.map

/***/ }),

/***/ "./node_modules/ol/style/IconImageCache.js":
/*!*************************************************!*\
  !*** ./node_modules/ol/style/IconImageCache.js ***!
  \*************************************************/
/*! exports provided: default, shared */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shared", function() { return shared; });
/* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../color.js */ "./node_modules/ol/color.js");
/**
 * @module ol/style/IconImageCache
 */

/**
 * @classdesc
 * Singleton class. Available through {@link module:ol/style/IconImageCache~shared}.
 */
var IconImageCache = /** @class */ (function () {
    function IconImageCache() {
        /**
        * @type {!Object<string, import("./IconImage.js").default>}
        * @private
        */
        this.cache_ = {};
        /**
        * @type {number}
        * @private
        */
        this.cacheSize_ = 0;
        /**
        * @type {number}
        * @private
        */
        this.maxCacheSize_ = 32;
    }
    /**
    * FIXME empty description for jsdoc
    */
    IconImageCache.prototype.clear = function () {
        this.cache_ = {};
        this.cacheSize_ = 0;
    };
    /**
     * @return {boolean} Can expire cache.
     */
    IconImageCache.prototype.canExpireCache = function () {
        return this.cacheSize_ > this.maxCacheSize_;
    };
    /**
    * FIXME empty description for jsdoc
    */
    IconImageCache.prototype.expire = function () {
        if (this.canExpireCache()) {
            var i = 0;
            for (var key in this.cache_) {
                var iconImage = this.cache_[key];
                if ((i++ & 3) === 0 && !iconImage.hasListener()) {
                    delete this.cache_[key];
                    --this.cacheSize_;
                }
            }
        }
    };
    /**
    * @param {string} src Src.
    * @param {?string} crossOrigin Cross origin.
    * @param {import("../color.js").Color} color Color.
    * @return {import("./IconImage.js").default} Icon image.
    */
    IconImageCache.prototype.get = function (src, crossOrigin, color) {
        var key = getKey(src, crossOrigin, color);
        return key in this.cache_ ? this.cache_[key] : null;
    };
    /**
    * @param {string} src Src.
    * @param {?string} crossOrigin Cross origin.
    * @param {import("../color.js").Color} color Color.
    * @param {import("./IconImage.js").default} iconImage Icon image.
    */
    IconImageCache.prototype.set = function (src, crossOrigin, color, iconImage) {
        var key = getKey(src, crossOrigin, color);
        this.cache_[key] = iconImage;
        ++this.cacheSize_;
    };
    /**
    * Set the cache size of the icon cache. Default is `32`. Change this value when
    * your map uses more than 32 different icon images and you are not caching icon
    * styles on the application level.
    * @param {number} maxCacheSize Cache max size.
    * @api
    */
    IconImageCache.prototype.setSize = function (maxCacheSize) {
        this.maxCacheSize_ = maxCacheSize;
        this.expire();
    };
    return IconImageCache;
}());
/**
 * @param {string} src Src.
 * @param {?string} crossOrigin Cross origin.
 * @param {import("../color.js").Color} color Color.
 * @return {string} Cache key.
 */
function getKey(src, crossOrigin, color) {
    var colorString = color ? Object(_color_js__WEBPACK_IMPORTED_MODULE_0__["asString"])(color) : 'null';
    return crossOrigin + ':' + src + ':' + colorString;
}
/* harmony default export */ __webpack_exports__["default"] = (IconImageCache);
/**
 * The {@link module:ol/style/IconImageCache~IconImageCache} for
 * {@link module:ol/style/Icon~Icon} images.
 * @api
 */
var shared = new IconImageCache();
//# sourceMappingURL=IconImageCache.js.map

/***/ }),

/***/ "./node_modules/ol/style/IconOrigin.js":
/*!*********************************************!*\
  !*** ./node_modules/ol/style/IconOrigin.js ***!
  \*********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/style/IconOrigin
 */
/**
 * Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    /**
     * Origin is at bottom left
     * @api
     */
    BOTTOM_LEFT: 'bottom-left',
    /**
     * Origin is at bottom right
     * @api
     */
    BOTTOM_RIGHT: 'bottom-right',
    /**
     * Origin is at top left
     * @api
     */
    TOP_LEFT: 'top-left',
    /**
     * Origin is at top right
     * @api
     */
    TOP_RIGHT: 'top-right'
});
//# sourceMappingURL=IconOrigin.js.map

/***/ }),

/***/ "./node_modules/ol/style/Image.js":
/*!****************************************!*\
  !*** ./node_modules/ol/style/Image.js ***!
  \****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/**
 * @module ol/style/Image
 */

/**
 * @typedef {Object} Options
 * @property {number} opacity
 * @property {boolean} rotateWithView
 * @property {number} rotation
 * @property {number} scale
 * @property {Array<number>} displacement
 */
/**
 * @classdesc
 * A base class used for creating subclasses and not instantiated in
 * apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and
 * {@link module:ol/style/RegularShape~RegularShape}.
 * @abstract
 * @api
 */
var ImageStyle = /** @class */ (function () {
    /**
     * @param {Options} options Options.
     */
    function ImageStyle(options) {
        /**
         * @private
         * @type {number}
         */
        this.opacity_ = options.opacity;
        /**
         * @private
         * @type {boolean}
         */
        this.rotateWithView_ = options.rotateWithView;
        /**
         * @private
         * @type {number}
         */
        this.rotation_ = options.rotation;
        /**
         * @private
         * @type {number}
         */
        this.scale_ = options.scale;
        /**
         * @private
         * @type {Array<number>}
         */
        this.displacement_ = options.displacement;
    }
    /**
     * Clones the style.
     * @return {ImageStyle} The cloned style.
     * @api
     */
    ImageStyle.prototype.clone = function () {
        return new ImageStyle({
            opacity: this.getOpacity(),
            scale: this.getScale(),
            rotation: this.getRotation(),
            rotateWithView: this.getRotateWithView(),
            displacement: this.getDisplacement().slice()
        });
    };
    /**
     * Get the symbolizer opacity.
     * @return {number} Opacity.
     * @api
     */
    ImageStyle.prototype.getOpacity = function () {
        return this.opacity_;
    };
    /**
     * Determine whether the symbolizer rotates with the map.
     * @return {boolean} Rotate with map.
     * @api
     */
    ImageStyle.prototype.getRotateWithView = function () {
        return this.rotateWithView_;
    };
    /**
     * Get the symoblizer rotation.
     * @return {number} Rotation.
     * @api
     */
    ImageStyle.prototype.getRotation = function () {
        return this.rotation_;
    };
    /**
     * Get the symbolizer scale.
     * @return {number} Scale.
     * @api
     */
    ImageStyle.prototype.getScale = function () {
        return this.scale_;
    };
    /**
     * Get the displacement of the shape
     * @return {Array<number>} Shape's center displacement
     * @api
     */
    ImageStyle.prototype.getDisplacement = function () {
        return this.displacement_;
    };
    /**
     * Get the anchor point in pixels. The anchor determines the center point for the
     * symbolizer.
     * @abstract
     * @return {Array<number>} Anchor.
     */
    ImageStyle.prototype.getAnchor = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Get the image element for the symbolizer.
     * @abstract
     * @param {number} pixelRatio Pixel ratio.
     * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
     */
    ImageStyle.prototype.getImage = function (pixelRatio) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @abstract
     * @param {number} pixelRatio Pixel ratio.
     * @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
     */
    ImageStyle.prototype.getHitDetectionImage = function (pixelRatio) {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @abstract
     * @return {import("../ImageState.js").default} Image state.
     */
    ImageStyle.prototype.getImageState = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @abstract
     * @return {import("../size.js").Size} Image size.
     */
    ImageStyle.prototype.getImageSize = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @abstract
     * @return {import("../size.js").Size} Size of the hit-detection image.
     */
    ImageStyle.prototype.getHitDetectionImageSize = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Get the origin of the symbolizer.
     * @abstract
     * @return {Array<number>} Origin.
     */
    ImageStyle.prototype.getOrigin = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Get the size of the symbolizer (in pixels).
     * @abstract
     * @return {import("../size.js").Size} Size.
     */
    ImageStyle.prototype.getSize = function () {
        return Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Set the opacity.
     *
     * @param {number} opacity Opacity.
     * @api
     */
    ImageStyle.prototype.setOpacity = function (opacity) {
        this.opacity_ = opacity;
    };
    /**
     * Set whether to rotate the style with the view.
     *
     * @param {boolean} rotateWithView Rotate with map.
     * @api
     */
    ImageStyle.prototype.setRotateWithView = function (rotateWithView) {
        this.rotateWithView_ = rotateWithView;
    };
    /**
     * Set the rotation.
     *
     * @param {number} rotation Rotation.
     * @api
     */
    ImageStyle.prototype.setRotation = function (rotation) {
        this.rotation_ = rotation;
    };
    /**
     * Set the scale.
     *
     * @param {number} scale Scale.
     * @api
     */
    ImageStyle.prototype.setScale = function (scale) {
        this.scale_ = scale;
    };
    /**
     * @abstract
     * @param {function(import("../events/Event.js").default): void} listener Listener function.
     * @template T
     */
    ImageStyle.prototype.listenImageChange = function (listener) {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * Load not yet loaded URI.
     * @abstract
     */
    ImageStyle.prototype.load = function () {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    /**
     * @abstract
     * @param {function(import("../events/Event.js").default): void} listener Listener function.
     * @template T
     */
    ImageStyle.prototype.unlistenImageChange = function (listener) {
        Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["abstract"])();
    };
    return ImageStyle;
}());
/* harmony default export */ __webpack_exports__["default"] = (ImageStyle);
//# sourceMappingURL=Image.js.map

/***/ }),

/***/ "./node_modules/ol/style/RegularShape.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/style/RegularShape.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../color.js */ "./node_modules/ol/color.js");
/* harmony import */ var _colorlike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../colorlike.js */ "./node_modules/ol/colorlike.js");
/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dom.js */ "./node_modules/ol/dom.js");
/* harmony import */ var _ImageState_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ImageState.js */ "./node_modules/ol/ImageState.js");
/* harmony import */ var _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../render/canvas.js */ "./node_modules/ol/render/canvas.js");
/* harmony import */ var _Image_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Image.js */ "./node_modules/ol/style/Image.js");
/**
 * @module ol/style/RegularShape
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();






/**
 * Specify radius for regular polygons, or radius1 and radius2 for stars.
 * @typedef {Object} Options
 * @property {import("./Fill.js").default} [fill] Fill style.
 * @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points
 * is the number of sides.
 * @property {number} [radius] Radius of a regular polygon.
 * @property {number} [radius1] Outer radius of a star.
 * @property {number} [radius2] Inner radius of a star.
 * @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
 * @property {Array<number>} [displacement=[0,0]] Displacement of the shape
 * @property {import("./Stroke.js").default} [stroke] Stroke style.
 * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
 * @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view.
 */
/**
 * @typedef {Object} RenderOptions
 * @property {import("../colorlike.js").ColorLike} [strokeStyle]
 * @property {number} strokeWidth
 * @property {number} size
 * @property {CanvasLineCap} lineCap
 * @property {Array<number>} lineDash
 * @property {number} lineDashOffset
 * @property {CanvasLineJoin} lineJoin
 * @property {number} miterLimit
 */
/**
 * @classdesc
 * Set regular shape style for vector features. The resulting shape will be
 * a regular polygon when `radius` is provided, or a star when `radius1` and
 * `radius2` are provided.
 * @api
 */
var RegularShape = /** @class */ (function (_super) {
    __extends(RegularShape, _super);
    /**
     * @param {Options} options Options.
     */
    function RegularShape(options) {
        var _this = this;
        /**
         * @type {boolean}
         */
        var rotateWithView = options.rotateWithView !== undefined ?
            options.rotateWithView : false;
        _this = _super.call(this, {
            opacity: 1,
            rotateWithView: rotateWithView,
            rotation: options.rotation !== undefined ? options.rotation : 0,
            scale: 1,
            displacement: options.displacement !== undefined ? options.displacement : [0, 0]
        }) || this;
        /**
         * @private
         * @type {HTMLCanvasElement}
         */
        _this.canvas_ = null;
        /**
         * @private
         * @type {HTMLCanvasElement}
         */
        _this.hitDetectionCanvas_ = null;
        /**
         * @private
         * @type {import("./Fill.js").default}
         */
        _this.fill_ = options.fill !== undefined ? options.fill : null;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.origin_ = [0, 0];
        /**
         * @private
         * @type {number}
         */
        _this.points_ = options.points;
        /**
         * @protected
         * @type {number}
         */
        _this.radius_ = options.radius !== undefined ? options.radius : options.radius1;
        /**
         * @private
         * @type {number|undefined}
         */
        _this.radius2_ = options.radius2;
        /**
         * @private
         * @type {number}
         */
        _this.angle_ = options.angle !== undefined ? options.angle : 0;
        /**
         * @private
         * @type {import("./Stroke.js").default}
         */
        _this.stroke_ = options.stroke !== undefined ? options.stroke : null;
        /**
         * @private
         * @type {Array<number>}
         */
        _this.anchor_ = null;
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        _this.size_ = null;
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        _this.imageSize_ = null;
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        _this.hitDetectionImageSize_ = null;
        _this.render();
        return _this;
    }
    /**
     * Clones the style.
     * @return {RegularShape} The cloned style.
     * @api
     */
    RegularShape.prototype.clone = function () {
        var style = new RegularShape({
            fill: this.getFill() ? this.getFill().clone() : undefined,
            points: this.getPoints(),
            radius: this.getRadius(),
            radius2: this.getRadius2(),
            angle: this.getAngle(),
            stroke: this.getStroke() ? this.getStroke().clone() : undefined,
            rotation: this.getRotation(),
            rotateWithView: this.getRotateWithView(),
            displacement: this.getDisplacement().slice()
        });
        style.setOpacity(this.getOpacity());
        style.setScale(this.getScale());
        return style;
    };
    /**
     * @inheritDoc
     * @api
     */
    RegularShape.prototype.getAnchor = function () {
        return this.anchor_;
    };
    /**
     * Get the angle used in generating the shape.
     * @return {number} Shape's rotation in radians.
     * @api
     */
    RegularShape.prototype.getAngle = function () {
        return this.angle_;
    };
    /**
     * Get the fill style for the shape.
     * @return {import("./Fill.js").default} Fill style.
     * @api
     */
    RegularShape.prototype.getFill = function () {
        return this.fill_;
    };
    /**
     * @inheritDoc
     */
    RegularShape.prototype.getHitDetectionImage = function (pixelRatio) {
        return this.hitDetectionCanvas_;
    };
    /**
     * @inheritDoc
     * @api
     */
    RegularShape.prototype.getImage = function (pixelRatio) {
        return this.canvas_;
    };
    /**
     * @inheritDoc
     */
    RegularShape.prototype.getImageSize = function () {
        return this.imageSize_;
    };
    /**
     * @inheritDoc
     */
    RegularShape.prototype.getHitDetectionImageSize = function () {
        return this.hitDetectionImageSize_;
    };
    /**
     * @inheritDoc
     */
    RegularShape.prototype.getImageState = function () {
        return _ImageState_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOADED;
    };
    /**
     * @inheritDoc
     * @api
     */
    RegularShape.prototype.getOrigin = function () {
        return this.origin_;
    };
    /**
     * Get the number of points for generating the shape.
     * @return {number} Number of points for stars and regular polygons.
     * @api
     */
    RegularShape.prototype.getPoints = function () {
        return this.points_;
    };
    /**
     * Get the (primary) radius for the shape.
     * @return {number} Radius.
     * @api
     */
    RegularShape.prototype.getRadius = function () {
        return this.radius_;
    };
    /**
     * Get the secondary radius for the shape.
     * @return {number|undefined} Radius2.
     * @api
     */
    RegularShape.prototype.getRadius2 = function () {
        return this.radius2_;
    };
    /**
     * @inheritDoc
     * @api
     */
    RegularShape.prototype.getSize = function () {
        return this.size_;
    };
    /**
     * Get the stroke style for the shape.
     * @return {import("./Stroke.js").default} Stroke style.
     * @api
     */
    RegularShape.prototype.getStroke = function () {
        return this.stroke_;
    };
    /**
     * @inheritDoc
     */
    RegularShape.prototype.listenImageChange = function (listener) { };
    /**
     * @inheritDoc
     */
    RegularShape.prototype.load = function () { };
    /**
     * @inheritDoc
     */
    RegularShape.prototype.unlistenImageChange = function (listener) { };
    /**
     * @protected
     */
    RegularShape.prototype.render = function () {
        var lineCap = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultLineCap"];
        var lineJoin = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultLineJoin"];
        var miterLimit = 0;
        var lineDash = null;
        var lineDashOffset = 0;
        var strokeStyle;
        var strokeWidth = 0;
        if (this.stroke_) {
            strokeStyle = this.stroke_.getColor();
            if (strokeStyle === null) {
                strokeStyle = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultStrokeStyle"];
            }
            strokeStyle = Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(strokeStyle);
            strokeWidth = this.stroke_.getWidth();
            if (strokeWidth === undefined) {
                strokeWidth = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultLineWidth"];
            }
            lineDash = this.stroke_.getLineDash();
            lineDashOffset = this.stroke_.getLineDashOffset();
            lineJoin = this.stroke_.getLineJoin();
            if (lineJoin === undefined) {
                lineJoin = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultLineJoin"];
            }
            lineCap = this.stroke_.getLineCap();
            if (lineCap === undefined) {
                lineCap = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultLineCap"];
            }
            miterLimit = this.stroke_.getMiterLimit();
            if (miterLimit === undefined) {
                miterLimit = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultMiterLimit"];
            }
        }
        var size = 2 * (this.radius_ + strokeWidth) + 1;
        var renderOptions = {
            strokeStyle: strokeStyle,
            strokeWidth: strokeWidth,
            size: size,
            lineCap: lineCap,
            lineDash: lineDash,
            lineDashOffset: lineDashOffset,
            lineJoin: lineJoin,
            miterLimit: miterLimit
        };
        var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(size, size);
        this.canvas_ = context.canvas;
        // canvas.width and height are rounded to the closest integer
        size = this.canvas_.width;
        var imageSize = size;
        var displacement = this.getDisplacement();
        this.draw_(renderOptions, context, 0, 0);
        this.createHitDetectionCanvas_(renderOptions);
        this.anchor_ = [size / 2 - displacement[0], size / 2 + displacement[1]];
        this.size_ = [size, size];
        this.imageSize_ = [imageSize, imageSize];
    };
    /**
     * @private
     * @param {RenderOptions} renderOptions Render options.
     * @param {CanvasRenderingContext2D} context The rendering context.
     * @param {number} x The origin for the symbol (x).
     * @param {number} y The origin for the symbol (y).
     */
    RegularShape.prototype.draw_ = function (renderOptions, context, x, y) {
        var i, angle0, radiusC;
        // reset transform
        context.setTransform(1, 0, 0, 1, 0, 0);
        // then move to (x, y)
        context.translate(x, y);
        context.beginPath();
        var points = this.points_;
        if (points === Infinity) {
            context.arc(renderOptions.size / 2, renderOptions.size / 2, this.radius_, 0, 2 * Math.PI, true);
        }
        else {
            var radius2 = (this.radius2_ !== undefined) ? this.radius2_
                : this.radius_;
            if (radius2 !== this.radius_) {
                points = 2 * points;
            }
            for (i = 0; i <= points; i++) {
                angle0 = i * 2 * Math.PI / points - Math.PI / 2 + this.angle_;
                radiusC = i % 2 === 0 ? this.radius_ : radius2;
                context.lineTo(renderOptions.size / 2 + radiusC * Math.cos(angle0), renderOptions.size / 2 + radiusC * Math.sin(angle0));
            }
        }
        if (this.fill_) {
            var color = this.fill_.getColor();
            if (color === null) {
                color = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultFillStyle"];
            }
            context.fillStyle = Object(_colorlike_js__WEBPACK_IMPORTED_MODULE_1__["asColorLike"])(color);
            context.fill();
        }
        if (this.stroke_) {
            context.strokeStyle = renderOptions.strokeStyle;
            context.lineWidth = renderOptions.strokeWidth;
            if (context.setLineDash && renderOptions.lineDash) {
                context.setLineDash(renderOptions.lineDash);
                context.lineDashOffset = renderOptions.lineDashOffset;
            }
            context.lineCap = renderOptions.lineCap;
            context.lineJoin = renderOptions.lineJoin;
            context.miterLimit = renderOptions.miterLimit;
            context.stroke();
        }
        context.closePath();
    };
    /**
     * @private
     * @param {RenderOptions} renderOptions Render options.
     */
    RegularShape.prototype.createHitDetectionCanvas_ = function (renderOptions) {
        this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size];
        this.hitDetectionCanvas_ = this.canvas_;
        if (this.fill_) {
            var color = this.fill_.getColor();
            // determine if fill is transparent (or pattern or gradient)
            var opacity = 0;
            if (typeof color === 'string') {
                color = Object(_color_js__WEBPACK_IMPORTED_MODULE_0__["asArray"])(color);
            }
            if (color === null) {
                opacity = 1;
            }
            else if (Array.isArray(color)) {
                opacity = color.length === 4 ? color[3] : 1;
            }
            if (opacity === 0) {
                // if a transparent fill style is set, create an extra hit-detection image
                // with a default fill style
                var context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_2__["createCanvasContext2D"])(renderOptions.size, renderOptions.size);
                this.hitDetectionCanvas_ = context.canvas;
                this.drawHitDetectionCanvas_(renderOptions, context, 0, 0);
            }
        }
    };
    /**
     * @private
     * @param {RenderOptions} renderOptions Render options.
     * @param {CanvasRenderingContext2D} context The context.
     * @param {number} x The origin for the symbol (x).
     * @param {number} y The origin for the symbol (y).
     */
    RegularShape.prototype.drawHitDetectionCanvas_ = function (renderOptions, context, x, y) {
        // reset transform
        context.setTransform(1, 0, 0, 1, 0, 0);
        // then move to (x, y)
        context.translate(x, y);
        context.beginPath();
        var points = this.points_;
        if (points === Infinity) {
            context.arc(renderOptions.size / 2, renderOptions.size / 2, this.radius_, 0, 2 * Math.PI, true);
        }
        else {
            var radius2 = (this.radius2_ !== undefined) ? this.radius2_
                : this.radius_;
            if (radius2 !== this.radius_) {
                points = 2 * points;
            }
            var i = void 0, radiusC = void 0, angle0 = void 0;
            for (i = 0; i <= points; i++) {
                angle0 = i * 2 * Math.PI / points - Math.PI / 2 + this.angle_;
                radiusC = i % 2 === 0 ? this.radius_ : radius2;
                context.lineTo(renderOptions.size / 2 + radiusC * Math.cos(angle0), renderOptions.size / 2 + radiusC * Math.sin(angle0));
            }
        }
        context.fillStyle = _render_canvas_js__WEBPACK_IMPORTED_MODULE_4__["defaultFillStyle"];
        context.fill();
        if (this.stroke_) {
            context.strokeStyle = renderOptions.strokeStyle;
            context.lineWidth = renderOptions.strokeWidth;
            if (renderOptions.lineDash) {
                context.setLineDash(renderOptions.lineDash);
                context.lineDashOffset = renderOptions.lineDashOffset;
            }
            context.stroke();
        }
        context.closePath();
    };
    return RegularShape;
}(_Image_js__WEBPACK_IMPORTED_MODULE_5__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (RegularShape);
//# sourceMappingURL=RegularShape.js.map

/***/ }),

/***/ "./node_modules/ol/style/Stroke.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/style/Stroke.js ***!
  \*****************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/style/Stroke
 */
/**
 * @typedef {Object} Options
 * @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color] A color, gradient or pattern.
 * See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.
 * Default null; if null, the Canvas/renderer default black will be used.
 * @property {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`.
 * @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`.
 * @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash).
 * Please note that Internet Explorer 10 and lower do not support the `setLineDash` method on
 * the `CanvasRenderingContext2D` and therefore this option will have no visual effect in these browsers.
 * @property {number} [lineDashOffset=0] Line dash offset.
 * @property {number} [miterLimit=10] Miter limit.
 * @property {number} [width] Width.
 */
/**
 * @classdesc
 * Set stroke style for vector features.
 * Note that the defaults given are the Canvas defaults, which will be used if
 * option is not defined. The `get` functions return whatever was entered in
 * the options; they will not return the default.
 * @api
 */
var Stroke = /** @class */ (function () {
    /**
     * @param {Options=} opt_options Options.
     */
    function Stroke(opt_options) {
        var options = opt_options || {};
        /**
         * @private
         * @type {import("../color.js").Color|import("../colorlike.js").ColorLike}
         */
        this.color_ = options.color !== undefined ? options.color : null;
        /**
         * @private
         * @type {CanvasLineCap|undefined}
         */
        this.lineCap_ = options.lineCap;
        /**
         * @private
         * @type {Array<number>}
         */
        this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null;
        /**
         * @private
         * @type {number|undefined}
         */
        this.lineDashOffset_ = options.lineDashOffset;
        /**
         * @private
         * @type {CanvasLineJoin|undefined}
         */
        this.lineJoin_ = options.lineJoin;
        /**
         * @private
         * @type {number|undefined}
         */
        this.miterLimit_ = options.miterLimit;
        /**
         * @private
         * @type {number|undefined}
         */
        this.width_ = options.width;
    }
    /**
     * Clones the style.
     * @return {Stroke} The cloned style.
     * @api
     */
    Stroke.prototype.clone = function () {
        var color = this.getColor();
        return new Stroke({
            color: Array.isArray(color) ? color.slice() : color || undefined,
            lineCap: this.getLineCap(),
            lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined,
            lineDashOffset: this.getLineDashOffset(),
            lineJoin: this.getLineJoin(),
            miterLimit: this.getMiterLimit(),
            width: this.getWidth()
        });
    };
    /**
     * Get the stroke color.
     * @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
     * @api
     */
    Stroke.prototype.getColor = function () {
        return this.color_;
    };
    /**
     * Get the line cap type for the stroke.
     * @return {CanvasLineCap|undefined} Line cap.
     * @api
     */
    Stroke.prototype.getLineCap = function () {
        return this.lineCap_;
    };
    /**
     * Get the line dash style for the stroke.
     * @return {Array<number>} Line dash.
     * @api
     */
    Stroke.prototype.getLineDash = function () {
        return this.lineDash_;
    };
    /**
     * Get the line dash offset for the stroke.
     * @return {number|undefined} Line dash offset.
     * @api
     */
    Stroke.prototype.getLineDashOffset = function () {
        return this.lineDashOffset_;
    };
    /**
     * Get the line join type for the stroke.
     * @return {CanvasLineJoin|undefined} Line join.
     * @api
     */
    Stroke.prototype.getLineJoin = function () {
        return this.lineJoin_;
    };
    /**
     * Get the miter limit for the stroke.
     * @return {number|undefined} Miter limit.
     * @api
     */
    Stroke.prototype.getMiterLimit = function () {
        return this.miterLimit_;
    };
    /**
     * Get the stroke width.
     * @return {number|undefined} Width.
     * @api
     */
    Stroke.prototype.getWidth = function () {
        return this.width_;
    };
    /**
     * Set the color.
     *
     * @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
     * @api
     */
    Stroke.prototype.setColor = function (color) {
        this.color_ = color;
    };
    /**
     * Set the line cap.
     *
     * @param {CanvasLineCap|undefined} lineCap Line cap.
     * @api
     */
    Stroke.prototype.setLineCap = function (lineCap) {
        this.lineCap_ = lineCap;
    };
    /**
     * Set the line dash.
     *
     * Please note that Internet Explorer 10 and lower [do not support][mdn] the
     * `setLineDash` method on the `CanvasRenderingContext2D` and therefore this
     * property will have no visual effect in these browsers.
     *
     * [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility
     *
     * @param {Array<number>} lineDash Line dash.
     * @api
     */
    Stroke.prototype.setLineDash = function (lineDash) {
        this.lineDash_ = lineDash;
    };
    /**
     * Set the line dash offset.
     *
     * @param {number|undefined} lineDashOffset Line dash offset.
     * @api
     */
    Stroke.prototype.setLineDashOffset = function (lineDashOffset) {
        this.lineDashOffset_ = lineDashOffset;
    };
    /**
     * Set the line join.
     *
     * @param {CanvasLineJoin|undefined} lineJoin Line join.
     * @api
     */
    Stroke.prototype.setLineJoin = function (lineJoin) {
        this.lineJoin_ = lineJoin;
    };
    /**
     * Set the miter limit.
     *
     * @param {number|undefined} miterLimit Miter limit.
     * @api
     */
    Stroke.prototype.setMiterLimit = function (miterLimit) {
        this.miterLimit_ = miterLimit;
    };
    /**
     * Set the width.
     *
     * @param {number|undefined} width Width.
     * @api
     */
    Stroke.prototype.setWidth = function (width) {
        this.width_ = width;
    };
    return Stroke;
}());
/* harmony default export */ __webpack_exports__["default"] = (Stroke);
//# sourceMappingURL=Stroke.js.map

/***/ }),

/***/ "./node_modules/ol/style/Style.js":
/*!****************************************!*\
  !*** ./node_modules/ol/style/Style.js ***!
  \****************************************/
/*! exports provided: toFunction, createDefaultStyle, createEditingStyle, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toFunction", function() { return toFunction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createDefaultStyle", function() { return createDefaultStyle; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createEditingStyle", function() { return createEditingStyle; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../geom/GeometryType.js */ "./node_modules/ol/geom/GeometryType.js");
/* harmony import */ var _Circle_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Circle.js */ "./node_modules/ol/style/Circle.js");
/* harmony import */ var _Fill_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Fill.js */ "./node_modules/ol/style/Fill.js");
/* harmony import */ var _Stroke_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Stroke.js */ "./node_modules/ol/style/Stroke.js");
/**
 * @module ol/style/Style
 */





/**
 * A function that takes an {@link module:ol/Feature} and a `{number}`
 * representing the view's resolution. The function should return a
 * {@link module:ol/style/Style} or an array of them. This way e.g. a
 * vector layer can be styled. If the function returns `undefined`, the
 * feature will not be rendered.
 *
 * @typedef {function(import("../Feature.js").FeatureLike, number):(Style|Array<Style>|void)} StyleFunction
 */
/**
 * A {@link Style}, an array of {@link Style}, or a {@link StyleFunction}.
 * @typedef {Style|Array<Style>|StyleFunction} StyleLike
 */
/**
 * A function that takes an {@link module:ol/Feature} as argument and returns an
 * {@link module:ol/geom/Geometry} that will be rendered and styled for the feature.
 *
 * @typedef {function(import("../Feature.js").FeatureLike):
 *     (import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined)} GeometryFunction
 */
/**
 * Custom renderer function. Takes two arguments:
 *
 * 1. The pixel coordinates of the geometry in GeoJSON notation.
 * 2. The {@link module:ol/render~State} of the layer renderer.
 *
 * @typedef {function((import("../coordinate.js").Coordinate|Array<import("../coordinate.js").Coordinate>|Array<Array<import("../coordinate.js").Coordinate>>),import("../render.js").State): void}
 * RenderFunction
 */
/**
 * @typedef {Object} Options
 * @property {string|import("../geom/Geometry.js").default|GeometryFunction} [geometry] Feature property or geometry
 * or function returning a geometry to render for this style.
 * @property {import("./Fill.js").default} [fill] Fill style.
 * @property {import("./Image.js").default} [image] Image style.
 * @property {RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be
 * ignored, and the provided function will be called with each render frame for each geometry.
 * @property {import("./Stroke.js").default} [stroke] Stroke style.
 * @property {import("./Text.js").default} [text] Text style.
 * @property {number} [zIndex] Z index.
 */
/**
 * @classdesc
 * Container for vector feature rendering styles. Any changes made to the style
 * or its children through `set*()` methods will not take effect until the
 * feature or layer that uses the style is re-rendered.
 *
 * ## Feature styles
 *
 * If no style is defined, the following default style is used:
 * ```js
 *  import {Fill, Stroke, Circle, Style} from 'ol/style';
 *
 *  var fill = new Fill({
 *    color: 'rgba(255,255,255,0.4)'
 *  });
 *  var stroke = new Stroke({
 *    color: '#3399CC',
 *    width: 1.25
 *  });
 *  var styles = [
 *    new Style({
 *      image: new Circle({
 *        fill: fill,
 *        stroke: stroke,
 *        radius: 5
 *      }),
 *      fill: fill,
 *      stroke: stroke
 *    })
 *  ];
 * ```
 *
 * A separate editing style has the following defaults:
 * ```js
 *  import {Fill, Stroke, Circle, Style} from 'ol/style';
 *  import GeometryType from 'ol/geom/GeometryType';
 *
 *  var white = [255, 255, 255, 1];
 *  var blue = [0, 153, 255, 1];
 *  var width = 3;
 *  styles[GeometryType.POLYGON] = [
 *    new Style({
 *      fill: new Fill({
 *        color: [255, 255, 255, 0.5]
 *      })
 *    })
 *  ];
 *  styles[GeometryType.MULTI_POLYGON] =
 *      styles[GeometryType.POLYGON];
 *  styles[GeometryType.LINE_STRING] = [
 *    new Style({
 *      stroke: new Stroke({
 *        color: white,
 *        width: width + 2
 *      })
 *    }),
 *    new Style({
 *      stroke: new Stroke({
 *        color: blue,
 *        width: width
 *      })
 *    })
 *  ];
 *  styles[GeometryType.MULTI_LINE_STRING] =
 *      styles[GeometryType.LINE_STRING];
 *  styles[GeometryType.POINT] = [
 *    new Style({
 *      image: new Circle({
 *        radius: width * 2,
 *        fill: new Fill({
 *          color: blue
 *        }),
 *        stroke: new Stroke({
 *          color: white,
 *          width: width / 2
 *        })
 *      }),
 *      zIndex: Infinity
 *    })
 *  ];
 *  styles[GeometryType.MULTI_POINT] =
 *      styles[GeometryType.POINT];
 *  styles[GeometryType.GEOMETRY_COLLECTION] =
 *      styles[GeometryType.POLYGON].concat(
 *          styles[GeometryType.LINE_STRING],
 *          styles[GeometryType.POINT]
 *      );
 * ```
 *
 * @api
 */
var Style = /** @class */ (function () {
    /**
     * @param {Options=} opt_options Style options.
     */
    function Style(opt_options) {
        var options = opt_options || {};
        /**
         * @private
         * @type {string|import("../geom/Geometry.js").default|GeometryFunction}
         */
        this.geometry_ = null;
        /**
         * @private
         * @type {!GeometryFunction}
         */
        this.geometryFunction_ = defaultGeometryFunction;
        if (options.geometry !== undefined) {
            this.setGeometry(options.geometry);
        }
        /**
         * @private
         * @type {import("./Fill.js").default}
         */
        this.fill_ = options.fill !== undefined ? options.fill : null;
        /**
           * @private
           * @type {import("./Image.js").default}
           */
        this.image_ = options.image !== undefined ? options.image : null;
        /**
         * @private
         * @type {RenderFunction|null}
         */
        this.renderer_ = options.renderer !== undefined ? options.renderer : null;
        /**
         * @private
         * @type {import("./Stroke.js").default}
         */
        this.stroke_ = options.stroke !== undefined ? options.stroke : null;
        /**
         * @private
         * @type {import("./Text.js").default}
         */
        this.text_ = options.text !== undefined ? options.text : null;
        /**
         * @private
         * @type {number|undefined}
         */
        this.zIndex_ = options.zIndex;
    }
    /**
     * Clones the style.
     * @return {Style} The cloned style.
     * @api
     */
    Style.prototype.clone = function () {
        var geometry = this.getGeometry();
        if (geometry && typeof geometry === 'object') {
            geometry = /** @type {import("../geom/Geometry.js").default} */ (geometry).clone();
        }
        return new Style({
            geometry: geometry,
            fill: this.getFill() ? this.getFill().clone() : undefined,
            image: this.getImage() ? this.getImage().clone() : undefined,
            stroke: this.getStroke() ? this.getStroke().clone() : undefined,
            text: this.getText() ? this.getText().clone() : undefined,
            zIndex: this.getZIndex()
        });
    };
    /**
     * Get the custom renderer function that was configured with
     * {@link #setRenderer} or the `renderer` constructor option.
     * @return {RenderFunction|null} Custom renderer function.
     * @api
     */
    Style.prototype.getRenderer = function () {
        return this.renderer_;
    };
    /**
     * Sets a custom renderer function for this style. When set, `fill`, `stroke`
     * and `image` options of the style will be ignored.
     * @param {RenderFunction|null} renderer Custom renderer function.
     * @api
     */
    Style.prototype.setRenderer = function (renderer) {
        this.renderer_ = renderer;
    };
    /**
     * Get the geometry to be rendered.
     * @return {string|import("../geom/Geometry.js").default|GeometryFunction}
     * Feature property or geometry or function that returns the geometry that will
     * be rendered with this style.
     * @api
     */
    Style.prototype.getGeometry = function () {
        return this.geometry_;
    };
    /**
     * Get the function used to generate a geometry for rendering.
     * @return {!GeometryFunction} Function that is called with a feature
     * and returns the geometry to render instead of the feature's geometry.
     * @api
     */
    Style.prototype.getGeometryFunction = function () {
        return this.geometryFunction_;
    };
    /**
     * Get the fill style.
     * @return {import("./Fill.js").default} Fill style.
     * @api
     */
    Style.prototype.getFill = function () {
        return this.fill_;
    };
    /**
     * Set the fill style.
     * @param {import("./Fill.js").default} fill Fill style.
     * @api
     */
    Style.prototype.setFill = function (fill) {
        this.fill_ = fill;
    };
    /**
     * Get the image style.
     * @return {import("./Image.js").default} Image style.
     * @api
     */
    Style.prototype.getImage = function () {
        return this.image_;
    };
    /**
     * Set the image style.
     * @param {import("./Image.js").default} image Image style.
     * @api
     */
    Style.prototype.setImage = function (image) {
        this.image_ = image;
    };
    /**
     * Get the stroke style.
     * @return {import("./Stroke.js").default} Stroke style.
     * @api
     */
    Style.prototype.getStroke = function () {
        return this.stroke_;
    };
    /**
     * Set the stroke style.
     * @param {import("./Stroke.js").default} stroke Stroke style.
     * @api
     */
    Style.prototype.setStroke = function (stroke) {
        this.stroke_ = stroke;
    };
    /**
     * Get the text style.
     * @return {import("./Text.js").default} Text style.
     * @api
     */
    Style.prototype.getText = function () {
        return this.text_;
    };
    /**
     * Set the text style.
     * @param {import("./Text.js").default} text Text style.
     * @api
     */
    Style.prototype.setText = function (text) {
        this.text_ = text;
    };
    /**
     * Get the z-index for the style.
     * @return {number|undefined} ZIndex.
     * @api
     */
    Style.prototype.getZIndex = function () {
        return this.zIndex_;
    };
    /**
     * Set a geometry that is rendered instead of the feature's geometry.
     *
     * @param {string|import("../geom/Geometry.js").default|GeometryFunction} geometry
     *     Feature property or geometry or function returning a geometry to render
     *     for this style.
     * @api
     */
    Style.prototype.setGeometry = function (geometry) {
        if (typeof geometry === 'function') {
            this.geometryFunction_ = geometry;
        }
        else if (typeof geometry === 'string') {
            this.geometryFunction_ = function (feature) {
                return (
                /** @type {import("../geom/Geometry.js").default} */ (feature.get(geometry)));
            };
        }
        else if (!geometry) {
            this.geometryFunction_ = defaultGeometryFunction;
        }
        else if (geometry !== undefined) {
            this.geometryFunction_ = function () {
                return (
                /** @type {import("../geom/Geometry.js").default} */ (geometry));
            };
        }
        this.geometry_ = geometry;
    };
    /**
     * Set the z-index.
     *
     * @param {number|undefined} zIndex ZIndex.
     * @api
     */
    Style.prototype.setZIndex = function (zIndex) {
        this.zIndex_ = zIndex;
    };
    return Style;
}());
/**
 * Convert the provided object into a style function.  Functions passed through
 * unchanged.  Arrays of Style or single style objects wrapped in a
 * new style function.
 * @param {StyleFunction|Array<Style>|Style} obj
 *     A style function, a single style, or an array of styles.
 * @return {StyleFunction} A style function.
 */
function toFunction(obj) {
    var styleFunction;
    if (typeof obj === 'function') {
        styleFunction = obj;
    }
    else {
        /**
         * @type {Array<Style>}
         */
        var styles_1;
        if (Array.isArray(obj)) {
            styles_1 = obj;
        }
        else {
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(typeof /** @type {?} */ (obj).getZIndex === 'function', 41); // Expected an `Style` or an array of `Style`
            var style = /** @type {Style} */ (obj);
            styles_1 = [style];
        }
        styleFunction = function () {
            return styles_1;
        };
    }
    return styleFunction;
}
/**
 * @type {Array<Style>}
 */
var defaultStyles = null;
/**
 * @param {import("../Feature.js").FeatureLike} feature Feature.
 * @param {number} resolution Resolution.
 * @return {Array<Style>} Style.
 */
function createDefaultStyle(feature, resolution) {
    // We don't use an immediately-invoked function
    // and a closure so we don't get an error at script evaluation time in
    // browsers that do not support Canvas. (import("./Circle.js").CircleStyle does
    // canvas.getContext('2d') at construction time, which will cause an.error
    // in such browsers.)
    if (!defaultStyles) {
        var fill = new _Fill_js__WEBPACK_IMPORTED_MODULE_3__["default"]({
            color: 'rgba(255,255,255,0.4)'
        });
        var stroke = new _Stroke_js__WEBPACK_IMPORTED_MODULE_4__["default"]({
            color: '#3399CC',
            width: 1.25
        });
        defaultStyles = [
            new Style({
                image: new _Circle_js__WEBPACK_IMPORTED_MODULE_2__["default"]({
                    fill: fill,
                    stroke: stroke,
                    radius: 5
                }),
                fill: fill,
                stroke: stroke
            })
        ];
    }
    return defaultStyles;
}
/**
 * Default styles for editing features.
 * @return {Object<import("../geom/GeometryType.js").default, Array<Style>>} Styles
 */
function createEditingStyle() {
    /** @type {Object<import("../geom/GeometryType.js").default, Array<Style>>} */
    var styles = {};
    var white = [255, 255, 255, 1];
    var blue = [0, 153, 255, 1];
    var width = 3;
    styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POLYGON] = [
        new Style({
            fill: new _Fill_js__WEBPACK_IMPORTED_MODULE_3__["default"]({
                color: [255, 255, 255, 0.5]
            })
        })
    ];
    styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_POLYGON] =
        styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POLYGON];
    styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].LINE_STRING] = [
        new Style({
            stroke: new _Stroke_js__WEBPACK_IMPORTED_MODULE_4__["default"]({
                color: white,
                width: width + 2
            })
        }),
        new Style({
            stroke: new _Stroke_js__WEBPACK_IMPORTED_MODULE_4__["default"]({
                color: blue,
                width: width
            })
        })
    ];
    styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_LINE_STRING] =
        styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].LINE_STRING];
    styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].CIRCLE] =
        styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POLYGON].concat(styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].LINE_STRING]);
    styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINT] = [
        new Style({
            image: new _Circle_js__WEBPACK_IMPORTED_MODULE_2__["default"]({
                radius: width * 2,
                fill: new _Fill_js__WEBPACK_IMPORTED_MODULE_3__["default"]({
                    color: blue
                }),
                stroke: new _Stroke_js__WEBPACK_IMPORTED_MODULE_4__["default"]({
                    color: white,
                    width: width / 2
                })
            }),
            zIndex: Infinity
        })
    ];
    styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].MULTI_POINT] =
        styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINT];
    styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].GEOMETRY_COLLECTION] =
        styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POLYGON].concat(styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].LINE_STRING], styles[_geom_GeometryType_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINT]);
    return styles;
}
/**
 * Function that is called with a feature and returns its default geometry.
 * @param {import("../Feature.js").FeatureLike} feature Feature to get the geometry for.
 * @return {import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined} Geometry to render.
 */
function defaultGeometryFunction(feature) {
    return feature.getGeometry();
}
/* harmony default export */ __webpack_exports__["default"] = (Style);
//# sourceMappingURL=Style.js.map

/***/ }),

/***/ "./node_modules/ol/style/Text.js":
/*!***************************************!*\
  !*** ./node_modules/ol/style/Text.js ***!
  \***************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Fill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Fill.js */ "./node_modules/ol/style/Fill.js");
/* harmony import */ var _TextPlacement_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextPlacement.js */ "./node_modules/ol/style/TextPlacement.js");
/**
 * @module ol/style/Text
 */


/**
 * The default fill color to use if no fill was set at construction time; a
 * blackish `#333`.
 *
 * @const {string}
 */
var DEFAULT_FILL_COLOR = '#333';
/**
 * @typedef {Object} Options
 * @property {string} [font] Font style as CSS 'font' value, see:
 * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif'
 * @property {number} [maxAngle=Math.PI/4] When `placement` is set to `'line'`, allow a maximum angle between adjacent characters.
 * The expected value is in radians, and the default is 45° (`Math.PI / 4`).
 * @property {number} [offsetX=0] Horizontal text offset in pixels. A positive will shift the text right.
 * @property {number} [offsetY=0] Vertical text offset in pixels. A positive will shift the text down.
 * @property {boolean} [overflow=false] For polygon labels or when `placement` is set to `'line'`, allow text to exceed
 * the width of the polygon at the label position or the length of the path that it follows.
 * @property {import("./TextPlacement.js").default|string} [placement='point'] Text placement.
 * @property {number} [scale] Scale.
 * @property {boolean} [rotateWithView=false] Whether to rotate the text with the view.
 * @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
 * @property {string} [text] Text content.
 * @property {string} [textAlign] Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'.
 * Default is 'center' for `placement: 'point'`. For `placement: 'line'`, the default is to let the renderer choose a
 * placement where `maxAngle` is not exceeded.
 * @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
 * 'hanging', 'ideographic'.
 * @property {import("./Fill.js").default} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333).
 * @property {import("./Stroke.js").default} [stroke] Stroke style.
 * @property {import("./Fill.js").default} [backgroundFill] Fill style for the text background when `placement` is
 * `'point'`. Default is no fill.
 * @property {import("./Stroke.js").default} [backgroundStroke] Stroke style for the text background  when `placement`
 * is `'point'`. Default is no stroke.
 * @property {Array<number>} [padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of
 * values in the array is `[top, right, bottom, left]`.
 */
/**
 * @classdesc
 * Set text style for vector features.
 * @api
 */
var Text = /** @class */ (function () {
    /**
     * @param {Options=} opt_options Options.
     */
    function Text(opt_options) {
        var options = opt_options || {};
        /**
         * @private
         * @type {string|undefined}
         */
        this.font_ = options.font;
        /**
         * @private
         * @type {number|undefined}
         */
        this.rotation_ = options.rotation;
        /**
         * @private
         * @type {boolean|undefined}
         */
        this.rotateWithView_ = options.rotateWithView;
        /**
         * @private
         * @type {number|undefined}
         */
        this.scale_ = options.scale;
        /**
         * @private
         * @type {string|undefined}
         */
        this.text_ = options.text;
        /**
         * @private
         * @type {string|undefined}
         */
        this.textAlign_ = options.textAlign;
        /**
         * @private
         * @type {string|undefined}
         */
        this.textBaseline_ = options.textBaseline;
        /**
         * @private
         * @type {import("./Fill.js").default}
         */
        this.fill_ = options.fill !== undefined ? options.fill :
            new _Fill_js__WEBPACK_IMPORTED_MODULE_0__["default"]({ color: DEFAULT_FILL_COLOR });
        /**
         * @private
         * @type {number}
         */
        this.maxAngle_ = options.maxAngle !== undefined ? options.maxAngle : Math.PI / 4;
        /**
         * @private
         * @type {import("./TextPlacement.js").default|string}
         */
        this.placement_ = options.placement !== undefined ? options.placement : _TextPlacement_js__WEBPACK_IMPORTED_MODULE_1__["default"].POINT;
        /**
         * @private
         * @type {boolean}
         */
        this.overflow_ = !!options.overflow;
        /**
         * @private
         * @type {import("./Stroke.js").default}
         */
        this.stroke_ = options.stroke !== undefined ? options.stroke : null;
        /**
         * @private
         * @type {number}
         */
        this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0;
        /**
         * @private
         * @type {number}
         */
        this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0;
        /**
         * @private
         * @type {import("./Fill.js").default}
         */
        this.backgroundFill_ = options.backgroundFill ? options.backgroundFill : null;
        /**
         * @private
         * @type {import("./Stroke.js").default}
         */
        this.backgroundStroke_ = options.backgroundStroke ? options.backgroundStroke : null;
        /**
         * @private
         * @type {Array<number>}
         */
        this.padding_ = options.padding === undefined ? null : options.padding;
    }
    /**
     * Clones the style.
     * @return {Text} The cloned style.
     * @api
     */
    Text.prototype.clone = function () {
        return new Text({
            font: this.getFont(),
            placement: this.getPlacement(),
            maxAngle: this.getMaxAngle(),
            overflow: this.getOverflow(),
            rotation: this.getRotation(),
            rotateWithView: this.getRotateWithView(),
            scale: this.getScale(),
            text: this.getText(),
            textAlign: this.getTextAlign(),
            textBaseline: this.getTextBaseline(),
            fill: this.getFill() ? this.getFill().clone() : undefined,
            stroke: this.getStroke() ? this.getStroke().clone() : undefined,
            offsetX: this.getOffsetX(),
            offsetY: this.getOffsetY(),
            backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : undefined,
            backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : undefined,
            padding: this.getPadding()
        });
    };
    /**
     * Get the `overflow` configuration.
     * @return {boolean} Let text overflow the length of the path they follow.
     * @api
     */
    Text.prototype.getOverflow = function () {
        return this.overflow_;
    };
    /**
     * Get the font name.
     * @return {string|undefined} Font.
     * @api
     */
    Text.prototype.getFont = function () {
        return this.font_;
    };
    /**
     * Get the maximum angle between adjacent characters.
     * @return {number} Angle in radians.
     * @api
     */
    Text.prototype.getMaxAngle = function () {
        return this.maxAngle_;
    };
    /**
     * Get the label placement.
     * @return {import("./TextPlacement.js").default|string} Text placement.
     * @api
     */
    Text.prototype.getPlacement = function () {
        return this.placement_;
    };
    /**
     * Get the x-offset for the text.
     * @return {number} Horizontal text offset.
     * @api
     */
    Text.prototype.getOffsetX = function () {
        return this.offsetX_;
    };
    /**
     * Get the y-offset for the text.
     * @return {number} Vertical text offset.
     * @api
     */
    Text.prototype.getOffsetY = function () {
        return this.offsetY_;
    };
    /**
     * Get the fill style for the text.
     * @return {import("./Fill.js").default} Fill style.
     * @api
     */
    Text.prototype.getFill = function () {
        return this.fill_;
    };
    /**
     * Determine whether the text rotates with the map.
     * @return {boolean|undefined} Rotate with map.
     * @api
     */
    Text.prototype.getRotateWithView = function () {
        return this.rotateWithView_;
    };
    /**
     * Get the text rotation.
     * @return {number|undefined} Rotation.
     * @api
     */
    Text.prototype.getRotation = function () {
        return this.rotation_;
    };
    /**
     * Get the text scale.
     * @return {number|undefined} Scale.
     * @api
     */
    Text.prototype.getScale = function () {
        return this.scale_;
    };
    /**
     * Get the stroke style for the text.
     * @return {import("./Stroke.js").default} Stroke style.
     * @api
     */
    Text.prototype.getStroke = function () {
        return this.stroke_;
    };
    /**
     * Get the text to be rendered.
     * @return {string|undefined} Text.
     * @api
     */
    Text.prototype.getText = function () {
        return this.text_;
    };
    /**
     * Get the text alignment.
     * @return {string|undefined} Text align.
     * @api
     */
    Text.prototype.getTextAlign = function () {
        return this.textAlign_;
    };
    /**
     * Get the text baseline.
     * @return {string|undefined} Text baseline.
     * @api
     */
    Text.prototype.getTextBaseline = function () {
        return this.textBaseline_;
    };
    /**
     * Get the background fill style for the text.
     * @return {import("./Fill.js").default} Fill style.
     * @api
     */
    Text.prototype.getBackgroundFill = function () {
        return this.backgroundFill_;
    };
    /**
     * Get the background stroke style for the text.
     * @return {import("./Stroke.js").default} Stroke style.
     * @api
     */
    Text.prototype.getBackgroundStroke = function () {
        return this.backgroundStroke_;
    };
    /**
     * Get the padding for the text.
     * @return {Array<number>} Padding.
     * @api
     */
    Text.prototype.getPadding = function () {
        return this.padding_;
    };
    /**
     * Set the `overflow` property.
     *
     * @param {boolean} overflow Let text overflow the path that it follows.
     * @api
     */
    Text.prototype.setOverflow = function (overflow) {
        this.overflow_ = overflow;
    };
    /**
     * Set the font.
     *
     * @param {string|undefined} font Font.
     * @api
     */
    Text.prototype.setFont = function (font) {
        this.font_ = font;
    };
    /**
     * Set the maximum angle between adjacent characters.
     *
     * @param {number} maxAngle Angle in radians.
     * @api
     */
    Text.prototype.setMaxAngle = function (maxAngle) {
        this.maxAngle_ = maxAngle;
    };
    /**
     * Set the x offset.
     *
     * @param {number} offsetX Horizontal text offset.
     * @api
     */
    Text.prototype.setOffsetX = function (offsetX) {
        this.offsetX_ = offsetX;
    };
    /**
     * Set the y offset.
     *
     * @param {number} offsetY Vertical text offset.
     * @api
     */
    Text.prototype.setOffsetY = function (offsetY) {
        this.offsetY_ = offsetY;
    };
    /**
     * Set the text placement.
     *
     * @param {import("./TextPlacement.js").default|string} placement Placement.
     * @api
     */
    Text.prototype.setPlacement = function (placement) {
        this.placement_ = placement;
    };
    /**
     * Set whether to rotate the text with the view.
     *
     * @param {boolean} rotateWithView Rotate with map.
     * @api
     */
    Text.prototype.setRotateWithView = function (rotateWithView) {
        this.rotateWithView_ = rotateWithView;
    };
    /**
     * Set the fill.
     *
     * @param {import("./Fill.js").default} fill Fill style.
     * @api
     */
    Text.prototype.setFill = function (fill) {
        this.fill_ = fill;
    };
    /**
     * Set the rotation.
     *
     * @param {number|undefined} rotation Rotation.
     * @api
     */
    Text.prototype.setRotation = function (rotation) {
        this.rotation_ = rotation;
    };
    /**
     * Set the scale.
     *
     * @param {number|undefined} scale Scale.
     * @api
     */
    Text.prototype.setScale = function (scale) {
        this.scale_ = scale;
    };
    /**
     * Set the stroke.
     *
     * @param {import("./Stroke.js").default} stroke Stroke style.
     * @api
     */
    Text.prototype.setStroke = function (stroke) {
        this.stroke_ = stroke;
    };
    /**
     * Set the text.
     *
     * @param {string|undefined} text Text.
     * @api
     */
    Text.prototype.setText = function (text) {
        this.text_ = text;
    };
    /**
     * Set the text alignment.
     *
     * @param {string|undefined} textAlign Text align.
     * @api
     */
    Text.prototype.setTextAlign = function (textAlign) {
        this.textAlign_ = textAlign;
    };
    /**
     * Set the text baseline.
     *
     * @param {string|undefined} textBaseline Text baseline.
     * @api
     */
    Text.prototype.setTextBaseline = function (textBaseline) {
        this.textBaseline_ = textBaseline;
    };
    /**
     * Set the background fill.
     *
     * @param {import("./Fill.js").default} fill Fill style.
     * @api
     */
    Text.prototype.setBackgroundFill = function (fill) {
        this.backgroundFill_ = fill;
    };
    /**
     * Set the background stroke.
     *
     * @param {import("./Stroke.js").default} stroke Stroke style.
     * @api
     */
    Text.prototype.setBackgroundStroke = function (stroke) {
        this.backgroundStroke_ = stroke;
    };
    /**
     * Set the padding (`[top, right, bottom, left]`).
     *
     * @param {!Array<number>} padding Padding.
     * @api
     */
    Text.prototype.setPadding = function (padding) {
        this.padding_ = padding;
    };
    return Text;
}());
/* harmony default export */ __webpack_exports__["default"] = (Text);
//# sourceMappingURL=Text.js.map

/***/ }),

/***/ "./node_modules/ol/style/TextPlacement.js":
/*!************************************************!*\
  !*** ./node_modules/ol/style/TextPlacement.js ***!
  \************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/style/TextPlacement
 */
/**
 * Text placement. One of `'point'`, `'line'`. Default is `'point'`. Note that
 * `'line'` requires the underlying geometry to be a {@link module:ol/geom/LineString~LineString},
 * {@link module:ol/geom/Polygon~Polygon}, {@link module:ol/geom/MultiLineString~MultiLineString} or
 * {@link module:ol/geom/MultiPolygon~MultiPolygon}.
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    POINT: 'point',
    LINE: 'line'
});
//# sourceMappingURL=TextPlacement.js.map

/***/ }),

/***/ "./node_modules/ol/style/expressions.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/style/expressions.js ***!
  \**********************************************/
/*! exports provided: ValueTypes, Operators, getValueType, isTypeUnique, numberToGlsl, arrayToGlsl, colorToGlsl, getStringNumberEquivalent, stringToGlsl, expressionToGlsl */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValueTypes", function() { return ValueTypes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Operators", function() { return Operators; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getValueType", function() { return getValueType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isTypeUnique", function() { return isTypeUnique; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numberToGlsl", function() { return numberToGlsl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arrayToGlsl", function() { return arrayToGlsl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorToGlsl", function() { return colorToGlsl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStringNumberEquivalent", function() { return getStringNumberEquivalent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stringToGlsl", function() { return stringToGlsl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expressionToGlsl", function() { return expressionToGlsl; });
/* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../color.js */ "./node_modules/ol/color.js");
/**
 * Operators and utilities used for style expressions
 * @module ol/style/expressions
 */

/**
 * Base type used for literal style parameters; can be a number literal or the output of an operator,
 * which in turns takes {@link ExpressionValue} arguments.
 *
 * The following operators can be used:
 *
 * * Reading operators:
 *   * `['get', 'attributeName']` fetches a feature attribute (it will be prefixed by `a_` in the shader)
 *     Note: those will be taken from the attributes provided to the renderer
 *   * `['var', 'varName']` fetches a value from the style variables, or 0 if undefined
 *   * `['time']` returns the time in seconds since the creation of the layer
 *   * `['zoom']` returns the current zoom level
 *   * `['resolution']` returns the current resolution
 *
 * * Math operators:
 *   * `['*', value1, value2]` multiplies `value1` by `value2`
 *   * `['/', value1, value2]` divides `value1` by `value2`
 *   * `['+', value1, value2]` adds `value1` and `value2`
 *   * `['-', value1, value2]` subtracts `value2` from `value1`
 *   * `['clamp', value, low, high]` clamps `value` between `low` and `high`
 *   * `['%', value1, value2]` returns the result of `value1 % value2` (modulo)
 *   * `['^', value1, value2]` returns the value of `value1` raised to the `value2` power
 *
 * * Transform operators:
 *   * `['case', condition1, output1, ...conditionN, outputN, fallback]` selects the first output whose corresponding
 *     condition evaluates to `true`. If no match is found, returns the `fallback` value.
 *     All conditions should be `boolean`, output and fallback can be any kind.
 *   * `['match', input, match1, output1, ...matchN, outputN, fallback]` compares the `input` value against all
 *     provided `matchX` values, returning the output associated with the first valid match. If no match is found,
 *     returns the `fallback` value.
 *     `input` and `matchX` values must all be of the same type, and can be `number` or `string`. `outputX` and
 *     `fallback` values must be of the same type, and can be of any kind.
 *   * `['interpolate', interpolation, input, stop1, output1, ...stopN, outputN]` returns a value by interpolating between
 *     pairs of inputs and outputs; `interpolation` can either be `['linear']` or `['exponential', base]` where `base` is
 *     the rate of increase from stop A to stop B (i.e. power to which the interpolation ratio is raised); a value
 *     of 1 is equivalent to `['linear']`.
 *     `input` and `stopX` values must all be of type `number`. `outputX` values can be `number` or `color` values.
 *     Note: `input` will be clamped between `stop1` and `stopN`, meaning that all output values will be comprised
 *     between `output1` and `outputN`.
 *
 * * Logical operators:
 *   * `['<', value1, value2]` returns `true` if `value1` is strictly lower than `value2`, or `false` otherwise.
 *   * `['<=', value1, value2]` returns `true` if `value1` is lower than or equals `value2`, or `false` otherwise.
 *   * `['>', value1, value2]` returns `true` if `value1` is strictly greater than `value2`, or `false` otherwise.
 *   * `['>=', value1, value2]` returns `true` if `value1` is greater than or equals `value2`, or `false` otherwise.
 *   * `['==', value1, value2]` returns `true` if `value1` equals `value2`, or `false` otherwise.
 *   * `['!=', value1, value2]` returns `true` if `value1` does not equal `value2`, or `false` otherwise.
 *   * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.
 *   * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
 *     (inclusively), or `false` otherwise.
 *
 * * Conversion operators:
 *   * `['array', value1, ...valueN]` creates a numerical array from `number` values; please note that the amount of
 *     values can currently only be 2, 3 or 4.
 *   * `['color', red, green, blue, alpha]` creates a `color` value from `number` values; the `alpha` parameter is
 *     optional; if not specified, it will be set to 1.
 *     Note: `red`, `green` and `blue` components must be values between 0 and 255; `alpha` between 0 and 1.
 *
 * Values can either be literals or another operator, as they will be evaluated recursively.
 * Literal values can be of the following types:
 * * `boolean`
 * * `number`
 * * `string`
 * * {@link module:ol/color~Color}
 *
 * @typedef {Array<*>|import("../color.js").Color|string|number|boolean} ExpressionValue
 */
/**
 * Possible inferred types from a given value or expression.
 * Note: these are binary flags.
 * @enum {number}
 */
var ValueTypes = {
    NUMBER: 1,
    STRING: 2,
    COLOR: 4,
    BOOLEAN: 8,
    NUMBER_ARRAY: 16,
    ANY: 31,
    NONE: 0
};
/**
 * An operator declaration must contain two methods: `getReturnType` which returns a type based on
 * the operator arguments, and `toGlsl` which returns a GLSL-compatible string.
 * Note: both methods can process arguments recursively.
 * @typedef {Object} Operator
 * @property {function(Array<ExpressionValue>): ValueTypes|number} getReturnType Returns one or several types
 * @property {function(ParsingContext, Array<ExpressionValue>, ValueTypes=): string} toGlsl Returns a GLSL-compatible string
 * Note: takes in an optional type hint as 3rd parameter
 */
/**
 * Operator declarations
 * @type {Object<string, Operator>}
 */
var Operators = {};
/**
 * Returns the possible types for a given value (each type being a binary flag)
 * To test a value use e.g. `getValueType(v) & ValueTypes.BOOLEAN`
 * @param {ExpressionValue} value Value
 * @returns {ValueTypes|number} Type or types inferred from the value
 */
function getValueType(value) {
    if (typeof value === 'number') {
        return ValueTypes.NUMBER;
    }
    if (typeof value === 'boolean') {
        return ValueTypes.BOOLEAN;
    }
    if (typeof value === 'string') {
        if (Object(_color_js__WEBPACK_IMPORTED_MODULE_0__["isStringColor"])(value)) {
            return ValueTypes.COLOR | ValueTypes.STRING;
        }
        return ValueTypes.STRING;
    }
    if (!Array.isArray(value)) {
        throw new Error("Unhandled value type: " + JSON.stringify(value));
    }
    var valueArr = /** @type {Array<*>} */ (value);
    var onlyNumbers = valueArr.every(function (v) {
        return typeof v === 'number';
    });
    if (onlyNumbers) {
        if (valueArr.length === 3 || valueArr.length === 4) {
            return ValueTypes.COLOR | ValueTypes.NUMBER_ARRAY;
        }
        return ValueTypes.NUMBER_ARRAY;
    }
    if (typeof valueArr[0] !== 'string') {
        throw new Error("Expected an expression operator but received: " + JSON.stringify(valueArr));
    }
    var operator = Operators[valueArr[0]];
    if (operator === undefined) {
        throw new Error("Unrecognized expression operator: " + JSON.stringify(valueArr));
    }
    return operator.getReturnType(valueArr.slice(1));
}
/**
 * Checks if only one value type is enabled in the input number.
 * @param {ValueTypes|number} valueType Number containing value type binary flags
 * @return {boolean} True if only one type flag is enabled, false if zero or multiple
 */
function isTypeUnique(valueType) {
    return Math.log2(valueType) % 1 === 0;
}
/**
 * Context available during the parsing of an expression.
 * @typedef {Object} ParsingContext
 * @property {boolean} [inFragmentShader] If false, means the expression output should be made for a vertex shader
 * @property {Array<string>} variables List of variables used in the expression; contains **unprefixed names**
 * @property {Array<string>} attributes List of attributes used in the expression; contains **unprefixed names**
 * @property {Object<string, number>} stringLiteralsMap This object maps all encountered string values to a number
 */
/**
 * Will return the number as a float with a dot separator, which is required by GLSL.
 * @param {number} v Numerical value.
 * @returns {string} The value as string.
 */
function numberToGlsl(v) {
    var s = v.toString();
    return s.indexOf('.') === -1 ? s + '.0' : s;
}
/**
 * Will return the number array as a float with a dot separator, concatenated with ', '.
 * @param {Array<number>} array Numerical values array.
 * @returns {string} The array as a vector, e. g.: `vec3(1.0, 2.0, 3.0)`.
 */
function arrayToGlsl(array) {
    if (array.length < 2 || array.length > 4) {
        throw new Error('`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.');
    }
    return "vec" + array.length + "(" + array.map(numberToGlsl).join(', ') + ")";
}
/**
 * Will normalize and converts to string a `vec4` color array compatible with GLSL.
 * @param {string|import("../color.js").Color} color Color either in string format or [r, g, b, a] array format,
 * with RGB components in the 0..255 range and the alpha component in the 0..1 range.
 * Note that the final array will always have 4 components.
 * @returns {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.
 */
function colorToGlsl(color) {
    var array = Object(_color_js__WEBPACK_IMPORTED_MODULE_0__["asArray"])(color).slice();
    if (array.length < 4) {
        array.push(1);
    }
    return arrayToGlsl(array.map(function (c, i) {
        return i < 3 ? c / 255 : c;
    }));
}
/**
 * Returns a stable equivalent number for the string literal.
 * @param {ParsingContext} context Parsing context
 * @param {string} string String literal value
 * @returns {number} Number equivalent
 */
function getStringNumberEquivalent(context, string) {
    if (context.stringLiteralsMap[string] === undefined) {
        context.stringLiteralsMap[string] = Object.keys(context.stringLiteralsMap).length;
    }
    return context.stringLiteralsMap[string];
}
/**
 * Returns a stable equivalent number for the string literal, for use in shaders. This number is then
 * converted to be a GLSL-compatible string.
 * @param {ParsingContext} context Parsing context
 * @param {string} string String literal value
 * @returns {string} GLSL-compatible string containing a number
 */
function stringToGlsl(context, string) {
    return numberToGlsl(getStringNumberEquivalent(context, string));
}
/**
 * Recursively parses a style expression and outputs a GLSL-compatible string. Takes in a parsing context that
 * will be read and modified during the parsing operation.
 * @param {ParsingContext} context Parsing context
 * @param {ExpressionValue} value Value
 * @param {ValueTypes|number} [typeHint] Hint for the expected final type (can be several types combined)
 * @returns {string} GLSL-compatible output
 */
function expressionToGlsl(context, value, typeHint) {
    // operator
    if (Array.isArray(value) && typeof value[0] === 'string') {
        var operator = Operators[value[0]];
        if (operator === undefined) {
            throw new Error("Unrecognized expression operator: " + JSON.stringify(value));
        }
        return operator.toGlsl(context, value.slice(1), typeHint);
    }
    else if ((getValueType(value) & ValueTypes.NUMBER) > 0) {
        return numberToGlsl(/** @type {number} */ (value));
    }
    else if ((getValueType(value) & ValueTypes.BOOLEAN) > 0) {
        return value.toString();
    }
    else if (((getValueType(value) & ValueTypes.STRING) > 0) &&
        (typeHint === undefined || typeHint == ValueTypes.STRING)) {
        return stringToGlsl(context, value.toString());
    }
    else if (((getValueType(value) & ValueTypes.COLOR) > 0) &&
        (typeHint === undefined || typeHint == ValueTypes.COLOR)) {
        return colorToGlsl(/** @type {number[]|string} */ (value));
    }
    else if ((getValueType(value) & ValueTypes.NUMBER_ARRAY) > 0) {
        return arrayToGlsl(/** @type {number[]} */ (value));
    }
}
function assertNumber(value) {
    if (!(getValueType(value) & ValueTypes.NUMBER)) {
        throw new Error("A numeric value was expected, got " + JSON.stringify(value) + " instead");
    }
}
function assertNumbers(values) {
    for (var i = 0; i < values.length; i++) {
        assertNumber(values[i]);
    }
}
function assertString(value) {
    if (!(getValueType(value) & ValueTypes.STRING)) {
        throw new Error("A string value was expected, got " + JSON.stringify(value) + " instead");
    }
}
function assertBoolean(value) {
    if (!(getValueType(value) & ValueTypes.BOOLEAN)) {
        throw new Error("A boolean value was expected, got " + JSON.stringify(value) + " instead");
    }
}
function assertArgsCount(args, count) {
    if (args.length !== count) {
        throw new Error("Exactly " + count + " arguments were expected, got " + args.length + " instead");
    }
}
function assertArgsMinCount(args, count) {
    if (args.length < count) {
        throw new Error("At least " + count + " arguments were expected, got " + args.length + " instead");
    }
}
function assertArgsMaxCount(args, count) {
    if (args.length > count) {
        throw new Error("At most " + count + " arguments were expected, got " + args.length + " instead");
    }
}
function assertArgsEven(args) {
    if (args.length % 2 !== 0) {
        throw new Error("An even amount of arguments was expected, got " + args + " instead");
    }
}
function assertArgsOdd(args) {
    if (args.length % 2 === 0) {
        throw new Error("An even amount of arguments was expected, got " + args + " instead");
    }
}
function assertUniqueInferredType(args, types) {
    if (!isTypeUnique(types)) {
        throw new Error("Could not infer only one type from the following expression: " + JSON.stringify(args));
    }
}
Operators['get'] = {
    getReturnType: function (args) {
        return ValueTypes.ANY;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 1);
        assertString(args[0]);
        var value = args[0].toString();
        if (context.attributes.indexOf(value) === -1) {
            context.attributes.push(value);
        }
        var prefix = context.inFragmentShader ? 'v_' : 'a_';
        return prefix + value;
    }
};
Operators['var'] = {
    getReturnType: function (args) {
        return ValueTypes.ANY;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 1);
        assertString(args[0]);
        var value = args[0].toString();
        if (context.variables.indexOf(value) === -1) {
            context.variables.push(value);
        }
        return "u_" + value;
    }
};
Operators['time'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 0);
        return 'u_time';
    }
};
Operators['zoom'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 0);
        return 'u_zoom';
    }
};
Operators['resolution'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 0);
        return 'u_resolution';
    }
};
Operators['*'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "(" + expressionToGlsl(context, args[0]) + " * " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['/'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "(" + expressionToGlsl(context, args[0]) + " / " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['+'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "(" + expressionToGlsl(context, args[0]) + " + " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['-'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "(" + expressionToGlsl(context, args[0]) + " - " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['clamp'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 3);
        assertNumbers(args);
        var min = expressionToGlsl(context, args[1]);
        var max = expressionToGlsl(context, args[2]);
        return "clamp(" + expressionToGlsl(context, args[0]) + ", " + min + ", " + max + ")";
    }
};
Operators['%'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "mod(" + expressionToGlsl(context, args[0]) + ", " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['^'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "pow(" + expressionToGlsl(context, args[0]) + ", " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['>'] = {
    getReturnType: function (args) {
        return ValueTypes.BOOLEAN;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "(" + expressionToGlsl(context, args[0]) + " > " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['>='] = {
    getReturnType: function (args) {
        return ValueTypes.BOOLEAN;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "(" + expressionToGlsl(context, args[0]) + " >= " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['<'] = {
    getReturnType: function (args) {
        return ValueTypes.BOOLEAN;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "(" + expressionToGlsl(context, args[0]) + " < " + expressionToGlsl(context, args[1]) + ")";
    }
};
Operators['<='] = {
    getReturnType: function (args) {
        return ValueTypes.BOOLEAN;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 2);
        assertNumbers(args);
        return "(" + expressionToGlsl(context, args[0]) + " <= " + expressionToGlsl(context, args[1]) + ")";
    }
};
function getEqualOperator(operator) {
    return {
        getReturnType: function (args) {
            return ValueTypes.BOOLEAN;
        },
        toGlsl: function (context, args) {
            assertArgsCount(args, 2);
            // find common type
            var type = ValueTypes.ANY;
            for (var i = 0; i < args.length; i++) {
                type = type & getValueType(args[i]);
            }
            if (type === 0) {
                throw new Error("All arguments should be of compatible type, got " + JSON.stringify(args) + " instead");
            }
            return "(" + expressionToGlsl(context, args[0], type) + " " + operator + " " + expressionToGlsl(context, args[1], type) + ")";
        }
    };
}
Operators['=='] = getEqualOperator('==');
Operators['!='] = getEqualOperator('!=');
Operators['!'] = {
    getReturnType: function (args) {
        return ValueTypes.BOOLEAN;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 1);
        assertBoolean(args[0]);
        return "(!" + expressionToGlsl(context, args[0]) + ")";
    }
};
Operators['between'] = {
    getReturnType: function (args) {
        return ValueTypes.BOOLEAN;
    },
    toGlsl: function (context, args) {
        assertArgsCount(args, 3);
        assertNumbers(args);
        var min = expressionToGlsl(context, args[1]);
        var max = expressionToGlsl(context, args[2]);
        var value = expressionToGlsl(context, args[0]);
        return "(" + value + " >= " + min + " && " + value + " <= " + max + ")";
    }
};
Operators['array'] = {
    getReturnType: function (args) {
        return ValueTypes.NUMBER_ARRAY;
    },
    toGlsl: function (context, args) {
        assertArgsMinCount(args, 2);
        assertArgsMaxCount(args, 4);
        assertNumbers(args);
        var parsedArgs = args.map(function (val) {
            return expressionToGlsl(context, val, ValueTypes.NUMBER);
        });
        return "vec" + args.length + "(" + parsedArgs.join(', ') + ")";
    }
};
Operators['color'] = {
    getReturnType: function (args) {
        return ValueTypes.COLOR;
    },
    toGlsl: function (context, args) {
        assertArgsMinCount(args, 3);
        assertArgsMaxCount(args, 4);
        assertNumbers(args);
        var array = /** @type {number[]} */ (args);
        if (args.length === 3) {
            array.push(1);
        }
        var parsedArgs = args.map(function (val, i) {
            return expressionToGlsl(context, val, ValueTypes.NUMBER) + (i < 3 ? ' / 255.0' : '');
        });
        return "vec" + args.length + "(" + parsedArgs.join(', ') + ")";
    }
};
Operators['interpolate'] = {
    getReturnType: function (args) {
        var type = ValueTypes.COLOR | ValueTypes.NUMBER;
        for (var i = 3; i < args.length; i += 2) {
            type = type & getValueType(args[i]);
        }
        return type;
    },
    toGlsl: function (context, args, opt_typeHint) {
        assertArgsEven(args);
        assertArgsMinCount(args, 6);
        // validate interpolation type
        var type = args[0];
        var interpolation;
        switch (type[0]) {
            case 'linear':
                interpolation = 1;
                break;
            case 'exponential':
                interpolation = type[1];
                break;
            default: interpolation = null;
        }
        if (!interpolation) {
            throw new Error("Invalid interpolation type for \"interpolate\" operator, received: " + JSON.stringify(type));
        }
        // compute input/output types
        var typeHint = opt_typeHint !== undefined ? opt_typeHint : ValueTypes.ANY;
        var outputType = Operators['interpolate'].getReturnType(args) & typeHint;
        assertUniqueInferredType(args, outputType);
        var input = expressionToGlsl(context, args[1]);
        var result = null;
        for (var i = 2; i < args.length - 2; i += 2) {
            var stop1 = expressionToGlsl(context, args[i]);
            var output1 = expressionToGlsl(context, args[i + 1], outputType);
            var stop2 = expressionToGlsl(context, args[i + 2]);
            var output2 = expressionToGlsl(context, args[i + 3], outputType);
            result = "mix(" + (result || output1) + ", " + output2 + ", pow(clamp((" + input + " - " + stop1 + ") / (" + stop2 + " - " + stop1 + "), 0.0, 1.0), " + numberToGlsl(interpolation) + "))";
        }
        return result;
    }
};
Operators['match'] = {
    getReturnType: function (args) {
        var type = ValueTypes.ANY;
        for (var i = 2; i < args.length; i += 2) {
            type = type & getValueType(args[i]);
        }
        type = type & getValueType(args[args.length - 1]);
        return type;
    },
    toGlsl: function (context, args, opt_typeHint) {
        assertArgsEven(args);
        assertArgsMinCount(args, 4);
        var typeHint = opt_typeHint !== undefined ? opt_typeHint : ValueTypes.ANY;
        var outputType = Operators['match'].getReturnType(args) & typeHint;
        assertUniqueInferredType(args, outputType);
        var input = expressionToGlsl(context, args[0]);
        var fallback = expressionToGlsl(context, args[args.length - 1], outputType);
        var result = null;
        for (var i = args.length - 3; i >= 1; i -= 2) {
            var match = expressionToGlsl(context, args[i]);
            var output = expressionToGlsl(context, args[i + 1], outputType);
            result = "(" + input + " == " + match + " ? " + output + " : " + (result || fallback) + ")";
        }
        return result;
    }
};
Operators['case'] = {
    getReturnType: function (args) {
        var type = ValueTypes.ANY;
        for (var i = 1; i < args.length; i += 2) {
            type = type & getValueType(args[i]);
        }
        type = type & getValueType(args[args.length - 1]);
        return type;
    },
    toGlsl: function (context, args, opt_typeHint) {
        assertArgsOdd(args);
        assertArgsMinCount(args, 3);
        var typeHint = opt_typeHint !== undefined ? opt_typeHint : ValueTypes.ANY;
        var outputType = Operators['case'].getReturnType(args) & typeHint;
        assertUniqueInferredType(args, outputType);
        for (var i = 0; i < args.length - 1; i += 2) {
            assertBoolean(args[i]);
        }
        var fallback = expressionToGlsl(context, args[args.length - 1], outputType);
        var result = null;
        for (var i = args.length - 3; i >= 0; i -= 2) {
            var condition = expressionToGlsl(context, args[i]);
            var output = expressionToGlsl(context, args[i + 1], outputType);
            result = "(" + condition + " ? " + output + " : " + (result || fallback) + ")";
        }
        return result;
    }
};
//# sourceMappingURL=expressions.js.map

/***/ }),

/***/ "./node_modules/ol/tilecoord.js":
/*!**************************************!*\
  !*** ./node_modules/ol/tilecoord.js ***!
  \**************************************/
/*! exports provided: createOrUpdate, getKeyZXY, getKey, fromKey, hash, withinExtentAndZ */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOrUpdate", function() { return createOrUpdate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getKeyZXY", function() { return getKeyZXY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getKey", function() { return getKey; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromKey", function() { return fromKey; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hash", function() { return hash; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withinExtentAndZ", function() { return withinExtentAndZ; });
/**
 * @module ol/tilecoord
 */
/**
 * An array of three numbers representing the location of a tile in a tile
 * grid. The order is `z` (zoom level), `x` (column), and `y` (row).
 * @typedef {Array<number>} TileCoord
 * @api
 */
/**
 * @param {number} z Z.
 * @param {number} x X.
 * @param {number} y Y.
 * @param {TileCoord=} opt_tileCoord Tile coordinate.
 * @return {TileCoord} Tile coordinate.
 */
function createOrUpdate(z, x, y, opt_tileCoord) {
    if (opt_tileCoord !== undefined) {
        opt_tileCoord[0] = z;
        opt_tileCoord[1] = x;
        opt_tileCoord[2] = y;
        return opt_tileCoord;
    }
    else {
        return [z, x, y];
    }
}
/**
 * @param {number} z Z.
 * @param {number} x X.
 * @param {number} y Y.
 * @return {string} Key.
 */
function getKeyZXY(z, x, y) {
    return z + '/' + x + '/' + y;
}
/**
 * Get the key for a tile coord.
 * @param {TileCoord} tileCoord The tile coord.
 * @return {string} Key.
 */
function getKey(tileCoord) {
    return getKeyZXY(tileCoord[0], tileCoord[1], tileCoord[2]);
}
/**
 * Get a tile coord given a key.
 * @param {string} key The tile coord key.
 * @return {TileCoord} The tile coord.
 */
function fromKey(key) {
    return key.split('/').map(Number);
}
/**
 * @param {TileCoord} tileCoord Tile coord.
 * @return {number} Hash.
 */
function hash(tileCoord) {
    return (tileCoord[1] << tileCoord[0]) + tileCoord[2];
}
/**
 * @param {TileCoord} tileCoord Tile coordinate.
 * @param {!import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
 * @return {boolean} Tile coordinate is within extent and zoom level range.
 */
function withinExtentAndZ(tileCoord, tileGrid) {
    var z = tileCoord[0];
    var x = tileCoord[1];
    var y = tileCoord[2];
    if (tileGrid.getMinZoom() > z || z > tileGrid.getMaxZoom()) {
        return false;
    }
    var extent = tileGrid.getExtent();
    var tileRange;
    if (!extent) {
        tileRange = tileGrid.getFullTileRange(z);
    }
    else {
        tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);
    }
    if (!tileRange) {
        return true;
    }
    else {
        return tileRange.containsXY(x, y);
    }
}
//# sourceMappingURL=tilecoord.js.map

/***/ }),

/***/ "./node_modules/ol/tilegrid.js":
/*!*************************************!*\
  !*** ./node_modules/ol/tilegrid.js ***!
  \*************************************/
/*! exports provided: getForProjection, wrapX, createForExtent, createXYZ, createForProjection, extentFromProjection */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getForProjection", function() { return getForProjection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapX", function() { return wrapX; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createForExtent", function() { return createForExtent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createXYZ", function() { return createXYZ; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createForProjection", function() { return createForProjection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extentFromProjection", function() { return extentFromProjection; });
/* harmony import */ var _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tilegrid/common.js */ "./node_modules/ol/tilegrid/common.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _extent_Corner_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./extent/Corner.js */ "./node_modules/ol/extent/Corner.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _proj_Units_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./proj/Units.js */ "./node_modules/ol/proj/Units.js");
/* harmony import */ var _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./tilegrid/TileGrid.js */ "./node_modules/ol/tilegrid/TileGrid.js");
/**
 * @module ol/tilegrid
 */







/**
 * @param {import("./proj/Projection.js").default} projection Projection.
 * @return {!TileGrid} Default tile grid for the
 * passed projection.
 */
function getForProjection(projection) {
    var tileGrid = projection.getDefaultTileGrid();
    if (!tileGrid) {
        tileGrid = createForProjection(projection);
        projection.setDefaultTileGrid(tileGrid);
    }
    return tileGrid;
}
/**
 * @param {TileGrid} tileGrid Tile grid.
 * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
 * @param {import("./proj/Projection.js").default} projection Projection.
 * @return {import("./tilecoord.js").TileCoord} Tile coordinate.
 */
function wrapX(tileGrid, tileCoord, projection) {
    var z = tileCoord[0];
    var center = tileGrid.getTileCoordCenter(tileCoord);
    var projectionExtent = extentFromProjection(projection);
    if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["containsCoordinate"])(projectionExtent, center)) {
        var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(projectionExtent);
        var worldsAway = Math.ceil((projectionExtent[0] - center[0]) / worldWidth);
        center[0] += worldWidth * worldsAway;
        return tileGrid.getTileCoordForCoordAndZ(center, z);
    }
    else {
        return tileCoord;
    }
}
/**
 * @param {import("./extent.js").Extent} extent Extent.
 * @param {number=} opt_maxZoom Maximum zoom level (default is
 *     DEFAULT_MAX_ZOOM).
 * @param {number|import("./size.js").Size=} opt_tileSize Tile size (default uses
 *     DEFAULT_TILE_SIZE).
 * @param {Corner=} opt_corner Extent corner (default is `'top-left'`).
 * @return {!TileGrid} TileGrid instance.
 */
function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {
    var corner = opt_corner !== undefined ? opt_corner : _extent_Corner_js__WEBPACK_IMPORTED_MODULE_3__["default"].TOP_LEFT;
    var resolutions = resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize);
    return new _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_6__["default"]({
        extent: extent,
        origin: Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getCorner"])(extent, corner),
        resolutions: resolutions,
        tileSize: opt_tileSize
    });
}
/**
 * @typedef {Object} XYZOptions
 * @property {import("./extent.js").Extent} [extent] Extent for the tile grid. The origin for an XYZ tile grid is the
 * top-left corner of the extent. If `maxResolution` is not provided the zero level of the grid is defined by the resolution
 * at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used.
 * @property {number} [maxResolution] Resolution at level zero.
 * @property {number} [maxZoom] Maximum zoom. The default is `42`. This determines the number of levels
 * in the grid set. For example, a `maxZoom` of 21 means there are 22 levels in the grid set.
 * @property {number} [minZoom=0] Minimum zoom.
 * @property {number|import("./size.js").Size} [tileSize=[256, 256]] Tile size in pixels.
 */
/**
 * Creates a tile grid with a standard XYZ tiling scheme.
 * @param {XYZOptions=} opt_options Tile grid options.
 * @return {!TileGrid} Tile grid instance.
 * @api
 */
function createXYZ(opt_options) {
    var xyzOptions = opt_options || {};
    var extent = xyzOptions.extent || Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["get"])('EPSG:3857').getExtent();
    var gridOptions = {
        extent: extent,
        minZoom: xyzOptions.minZoom,
        tileSize: xyzOptions.tileSize,
        resolutions: resolutionsFromExtent(extent, xyzOptions.maxZoom, xyzOptions.tileSize, xyzOptions.maxResolution)
    };
    return new _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_6__["default"](gridOptions);
}
/**
 * Create a resolutions array from an extent.  A zoom factor of 2 is assumed.
 * @param {import("./extent.js").Extent} extent Extent.
 * @param {number=} opt_maxZoom Maximum zoom level (default is
 *     DEFAULT_MAX_ZOOM).
 * @param {number|import("./size.js").Size=} opt_tileSize Tile size (default uses
 *     DEFAULT_TILE_SIZE).
 * @param {number=} opt_maxResolution Resolution at level zero.
 * @return {!Array<number>} Resolutions array.
 */
function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize, opt_maxResolution) {
    var maxZoom = opt_maxZoom !== undefined ?
        opt_maxZoom : _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_MAX_ZOOM"];
    var height = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getHeight"])(extent);
    var width = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["getWidth"])(extent);
    var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_1__["toSize"])(opt_tileSize !== undefined ?
        opt_tileSize : _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_TILE_SIZE"]);
    var maxResolution = opt_maxResolution > 0 ? opt_maxResolution :
        Math.max(width / tileSize[0], height / tileSize[1]);
    var length = maxZoom + 1;
    var resolutions = new Array(length);
    for (var z = 0; z < length; ++z) {
        resolutions[z] = maxResolution / Math.pow(2, z);
    }
    return resolutions;
}
/**
 * @param {import("./proj.js").ProjectionLike} projection Projection.
 * @param {number=} opt_maxZoom Maximum zoom level (default is
 *     DEFAULT_MAX_ZOOM).
 * @param {number|import("./size.js").Size=} opt_tileSize Tile size (default uses
 *     DEFAULT_TILE_SIZE).
 * @param {Corner=} opt_corner Extent corner (default is `'top-left'`).
 * @return {!TileGrid} TileGrid instance.
 */
function createForProjection(projection, opt_maxZoom, opt_tileSize, opt_corner) {
    var extent = extentFromProjection(projection);
    return createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner);
}
/**
 * Generate a tile grid extent from a projection.  If the projection has an
 * extent, it is used.  If not, a global extent is assumed.
 * @param {import("./proj.js").ProjectionLike} projection Projection.
 * @return {import("./extent.js").Extent} Extent.
 */
function extentFromProjection(projection) {
    projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_4__["get"])(projection);
    var extent = projection.getExtent();
    if (!extent) {
        var half = 180 * _proj_js__WEBPACK_IMPORTED_MODULE_4__["METERS_PER_UNIT"][_proj_Units_js__WEBPACK_IMPORTED_MODULE_5__["default"].DEGREES] / projection.getMetersPerUnit();
        extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_2__["createOrUpdate"])(-half, -half, half, half);
    }
    return extent;
}
//# sourceMappingURL=tilegrid.js.map

/***/ }),

/***/ "./node_modules/ol/tilegrid/TileGrid.js":
/*!**********************************************!*\
  !*** ./node_modules/ol/tilegrid/TileGrid.js ***!
  \**********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _common_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common.js */ "./node_modules/ol/tilegrid/common.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _TileRange_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../TileRange.js */ "./node_modules/ol/TileRange.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../size.js */ "./node_modules/ol/size.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../tilecoord.js */ "./node_modules/ol/tilecoord.js");
/**
 * @module ol/tilegrid/TileGrid
 */








/**
 * @private
 * @type {import("../tilecoord.js").TileCoord}
 */
var tmpTileCoord = [0, 0, 0];
/**
 * @typedef {Object} Options
 * @property {import("../extent.js").Extent} [extent] Extent for the tile grid. No tiles outside this
 * extent will be requested by {@link module:ol/source/Tile} sources. When no `origin` or
 * `origins` are configured, the `origin` will be set to the top-left corner of the extent.
 * @property {number} [minZoom=0] Minimum zoom.
 * @property {import("../coordinate.js").Coordinate} [origin] The tile grid origin, i.e. where the `x`
 * and `y` axes meet (`[z, 0, 0]`). Tile coordinates increase left to right and downwards. If not
 * specified, `extent` or `origins` must be provided.
 * @property {Array<import("../coordinate.js").Coordinate>} [origins] Tile grid origins, i.e. where
 * the `x` and `y` axes meet (`[z, 0, 0]`), for each zoom level. If given, the array length
 * should match the length of the `resolutions` array, i.e. each resolution can have a different
 * origin. Tile coordinates increase left to right and downwards. If not specified, `extent` or
 * `origin` must be provided.
 * @property {!Array<number>} resolutions Resolutions. The array index of each resolution needs
 * to match the zoom level. This means that even if a `minZoom` is configured, the resolutions
 * array will have a length of `maxZoom + 1`.
 * @property {Array<import("../size.js").Size>} [sizes] Number of tile rows and columns
 * of the grid for each zoom level. If specified the values
 * define each zoom level's extent together with the `origin` or `origins`.
 * A grid `extent` can be configured in addition, and will further limit the extent
 * for which tile requests are made by sources. If the bottom-left corner of
 * an extent is used as `origin` or `origins`, then the `y` value must be
 * negative because OpenLayers tile coordinates use the top left as the origin.
 * @property {number|import("../size.js").Size} [tileSize] Tile size.
 * Default is `[256, 256]`.
 * @property {Array<import("../size.js").Size>} [tileSizes] Tile sizes. If given, the array length
 * should match the length of the `resolutions` array, i.e. each resolution can have a different
 * tile size.
 */
/**
 * @classdesc
 * Base class for setting the grid pattern for sources accessing tiled-image
 * servers.
 * @api
 */
var TileGrid = /** @class */ (function () {
    /**
     * @param {Options} options Tile grid options.
     */
    function TileGrid(options) {
        /**
         * @protected
         * @type {number}
         */
        this.minZoom = options.minZoom !== undefined ? options.minZoom : 0;
        /**
         * @private
         * @type {!Array<number>}
         */
        this.resolutions_ = options.resolutions;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(Object(_array_js__WEBPACK_IMPORTED_MODULE_3__["isSorted"])(this.resolutions_, function (a, b) {
            return b - a;
        }, true), 17); // `resolutions` must be sorted in descending order
        // check if we've got a consistent zoom factor and origin
        var zoomFactor;
        if (!options.origins) {
            for (var i = 0, ii = this.resolutions_.length - 1; i < ii; ++i) {
                if (!zoomFactor) {
                    zoomFactor = this.resolutions_[i] / this.resolutions_[i + 1];
                }
                else {
                    if (this.resolutions_[i] / this.resolutions_[i + 1] !== zoomFactor) {
                        zoomFactor = undefined;
                        break;
                    }
                }
            }
        }
        /**
         * @private
         * @type {number|undefined}
         */
        this.zoomFactor_ = zoomFactor;
        /**
         * @protected
         * @type {number}
         */
        this.maxZoom = this.resolutions_.length - 1;
        /**
         * @private
         * @type {import("../coordinate.js").Coordinate}
         */
        this.origin_ = options.origin !== undefined ? options.origin : null;
        /**
         * @private
         * @type {Array<import("../coordinate.js").Coordinate>}
         */
        this.origins_ = null;
        if (options.origins !== undefined) {
            this.origins_ = options.origins;
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(this.origins_.length == this.resolutions_.length, 20); // Number of `origins` and `resolutions` must be equal
        }
        var extent = options.extent;
        if (extent !== undefined &&
            !this.origin_ && !this.origins_) {
            this.origin_ = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["getTopLeft"])(extent);
        }
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])((!this.origin_ && this.origins_) || (this.origin_ && !this.origins_), 18); // Either `origin` or `origins` must be configured, never both
        /**
         * @private
         * @type {Array<number|import("../size.js").Size>}
         */
        this.tileSizes_ = null;
        if (options.tileSizes !== undefined) {
            this.tileSizes_ = options.tileSizes;
            Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(this.tileSizes_.length == this.resolutions_.length, 19); // Number of `tileSizes` and `resolutions` must be equal
        }
        /**
         * @private
         * @type {number|import("../size.js").Size}
         */
        this.tileSize_ = options.tileSize !== undefined ?
            options.tileSize :
            !this.tileSizes_ ? _common_js__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_TILE_SIZE"] : null;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])((!this.tileSize_ && this.tileSizes_) ||
            (this.tileSize_ && !this.tileSizes_), 22); // Either `tileSize` or `tileSizes` must be configured, never both
        /**
         * @private
         * @type {import("../extent.js").Extent}
         */
        this.extent_ = extent !== undefined ? extent : null;
        /**
         * @private
         * @type {Array<import("../TileRange.js").default>}
         */
        this.fullTileRanges_ = null;
        /**
         * @private
         * @type {import("../size.js").Size}
         */
        this.tmpSize_ = [0, 0];
        if (options.sizes !== undefined) {
            this.fullTileRanges_ = options.sizes.map(function (size, z) {
                var tileRange = new _TileRange_js__WEBPACK_IMPORTED_MODULE_2__["default"](Math.min(0, size[0]), Math.max(size[0] - 1, -1), Math.min(0, size[1]), Math.max(size[1] - 1, -1));
                return tileRange;
            }, this);
        }
        else if (extent) {
            this.calculateTileRanges_(extent);
        }
    }
    /**
     * Call a function with each tile coordinate for a given extent and zoom level.
     *
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} zoom Integer zoom level.
     * @param {function(import("../tilecoord.js").TileCoord): void} callback Function called with each tile coordinate.
     * @api
     */
    TileGrid.prototype.forEachTileCoord = function (extent, zoom, callback) {
        var tileRange = this.getTileRangeForExtentAndZ(extent, zoom);
        for (var i = tileRange.minX, ii = tileRange.maxX; i <= ii; ++i) {
            for (var j = tileRange.minY, jj = tileRange.maxY; j <= jj; ++j) {
                callback([zoom, i, j]);
            }
        }
    };
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {function(number, import("../TileRange.js").default): boolean} callback Callback.
     * @param {import("../TileRange.js").default=} opt_tileRange Temporary import("../TileRange.js").default object.
     * @param {import("../extent.js").Extent=} opt_extent Temporary import("../extent.js").Extent object.
     * @return {boolean} Callback succeeded.
     */
    TileGrid.prototype.forEachTileCoordParentTileRange = function (tileCoord, callback, opt_tileRange, opt_extent) {
        var tileRange, x, y;
        var tileCoordExtent = null;
        var z = tileCoord[0] - 1;
        if (this.zoomFactor_ === 2) {
            x = tileCoord[1];
            y = tileCoord[2];
        }
        else {
            tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent);
        }
        while (z >= this.minZoom) {
            if (this.zoomFactor_ === 2) {
                x = Math.floor(x / 2);
                y = Math.floor(y / 2);
                tileRange = Object(_TileRange_js__WEBPACK_IMPORTED_MODULE_2__["createOrUpdate"])(x, x, y, y, opt_tileRange);
            }
            else {
                tileRange = this.getTileRangeForExtentAndZ(tileCoordExtent, z, opt_tileRange);
            }
            if (callback(z, tileRange)) {
                return true;
            }
            --z;
        }
        return false;
    };
    /**
     * Get the extent for this tile grid, if it was configured.
     * @return {import("../extent.js").Extent} Extent.
     * @api
     */
    TileGrid.prototype.getExtent = function () {
        return this.extent_;
    };
    /**
     * Get the maximum zoom level for the grid.
     * @return {number} Max zoom.
     * @api
     */
    TileGrid.prototype.getMaxZoom = function () {
        return this.maxZoom;
    };
    /**
     * Get the minimum zoom level for the grid.
     * @return {number} Min zoom.
     * @api
     */
    TileGrid.prototype.getMinZoom = function () {
        return this.minZoom;
    };
    /**
     * Get the origin for the grid at the given zoom level.
     * @param {number} z Integer zoom level.
     * @return {import("../coordinate.js").Coordinate} Origin.
     * @api
     */
    TileGrid.prototype.getOrigin = function (z) {
        if (this.origin_) {
            return this.origin_;
        }
        else {
            return this.origins_[z];
        }
    };
    /**
     * Get the resolution for the given zoom level.
     * @param {number} z Integer zoom level.
     * @return {number} Resolution.
     * @api
     */
    TileGrid.prototype.getResolution = function (z) {
        return this.resolutions_[z];
    };
    /**
     * Get the list of resolutions for the tile grid.
     * @return {Array<number>} Resolutions.
     * @api
     */
    TileGrid.prototype.getResolutions = function () {
        return this.resolutions_;
    };
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {import("../TileRange.js").default=} opt_tileRange Temporary import("../TileRange.js").default object.
     * @param {import("../extent.js").Extent=} opt_extent Temporary import("../extent.js").Extent object.
     * @return {import("../TileRange.js").default} Tile range.
     */
    TileGrid.prototype.getTileCoordChildTileRange = function (tileCoord, opt_tileRange, opt_extent) {
        if (tileCoord[0] < this.maxZoom) {
            if (this.zoomFactor_ === 2) {
                var minX = tileCoord[1] * 2;
                var minY = tileCoord[2] * 2;
                return Object(_TileRange_js__WEBPACK_IMPORTED_MODULE_2__["createOrUpdate"])(minX, minX + 1, minY, minY + 1, opt_tileRange);
            }
            var tileCoordExtent = this.getTileCoordExtent(tileCoord, opt_extent);
            return this.getTileRangeForExtentAndZ(tileCoordExtent, tileCoord[0] + 1, opt_tileRange);
        }
        return null;
    };
    /**
     * Get the extent for a tile range.
     * @param {number} z Integer zoom level.
     * @param {import("../TileRange.js").default} tileRange Tile range.
     * @param {import("../extent.js").Extent=} opt_extent Temporary import("../extent.js").Extent object.
     * @return {import("../extent.js").Extent} Extent.
     */
    TileGrid.prototype.getTileRangeExtent = function (z, tileRange, opt_extent) {
        var origin = this.getOrigin(z);
        var resolution = this.getResolution(z);
        var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_6__["toSize"])(this.getTileSize(z), this.tmpSize_);
        var minX = origin[0] + tileRange.minX * tileSize[0] * resolution;
        var maxX = origin[0] + (tileRange.maxX + 1) * tileSize[0] * resolution;
        var minY = origin[1] + tileRange.minY * tileSize[1] * resolution;
        var maxY = origin[1] + (tileRange.maxY + 1) * tileSize[1] * resolution;
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["createOrUpdate"])(minX, minY, maxX, maxY, opt_extent);
    };
    /**
     * Get a tile range for the given extent and integer zoom level.
     * @param {import("../extent.js").Extent} extent Extent.
     * @param {number} z Integer zoom level.
     * @param {import("../TileRange.js").default=} opt_tileRange Temporary tile range object.
     * @return {import("../TileRange.js").default} Tile range.
     */
    TileGrid.prototype.getTileRangeForExtentAndZ = function (extent, z, opt_tileRange) {
        var tileCoord = tmpTileCoord;
        this.getTileCoordForXYAndZ_(extent[0], extent[3], z, false, tileCoord);
        var minX = tileCoord[1];
        var minY = tileCoord[2];
        this.getTileCoordForXYAndZ_(extent[2], extent[1], z, true, tileCoord);
        return Object(_TileRange_js__WEBPACK_IMPORTED_MODULE_2__["createOrUpdate"])(minX, tileCoord[1], minY, tileCoord[2], opt_tileRange);
    };
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @return {import("../coordinate.js").Coordinate} Tile center.
     */
    TileGrid.prototype.getTileCoordCenter = function (tileCoord) {
        var origin = this.getOrigin(tileCoord[0]);
        var resolution = this.getResolution(tileCoord[0]);
        var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_6__["toSize"])(this.getTileSize(tileCoord[0]), this.tmpSize_);
        return [
            origin[0] + (tileCoord[1] + 0.5) * tileSize[0] * resolution,
            origin[1] - (tileCoord[2] + 0.5) * tileSize[1] * resolution
        ];
    };
    /**
     * Get the extent of a tile coordinate.
     *
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @param {import("../extent.js").Extent=} opt_extent Temporary extent object.
     * @return {import("../extent.js").Extent} Extent.
     * @api
     */
    TileGrid.prototype.getTileCoordExtent = function (tileCoord, opt_extent) {
        var origin = this.getOrigin(tileCoord[0]);
        var resolution = this.getResolution(tileCoord[0]);
        var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_6__["toSize"])(this.getTileSize(tileCoord[0]), this.tmpSize_);
        var minX = origin[0] + tileCoord[1] * tileSize[0] * resolution;
        var minY = origin[1] - (tileCoord[2] + 1) * tileSize[1] * resolution;
        var maxX = minX + tileSize[0] * resolution;
        var maxY = minY + tileSize[1] * resolution;
        return Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__["createOrUpdate"])(minX, minY, maxX, maxY, opt_extent);
    };
    /**
     * Get the tile coordinate for the given map coordinate and resolution.  This
     * method considers that coordinates that intersect tile boundaries should be
     * assigned the higher tile coordinate.
     *
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {number} resolution Resolution.
     * @param {import("../tilecoord.js").TileCoord=} opt_tileCoord Destination import("../tilecoord.js").TileCoord object.
     * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
     * @api
     */
    TileGrid.prototype.getTileCoordForCoordAndResolution = function (coordinate, resolution, opt_tileCoord) {
        return this.getTileCoordForXYAndResolution_(coordinate[0], coordinate[1], resolution, false, opt_tileCoord);
    };
    /**
     * Note that this method should not be called for resolutions that correspond
     * to an integer zoom level.  Instead call the `getTileCoordForXYAndZ_` method.
     * @param {number} x X.
     * @param {number} y Y.
     * @param {number} resolution Resolution (for a non-integer zoom level).
     * @param {boolean} reverseIntersectionPolicy Instead of letting edge
     *     intersections go to the higher tile coordinate, let edge intersections
     *     go to the lower tile coordinate.
     * @param {import("../tilecoord.js").TileCoord=} opt_tileCoord Temporary import("../tilecoord.js").TileCoord object.
     * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
     * @private
     */
    TileGrid.prototype.getTileCoordForXYAndResolution_ = function (x, y, resolution, reverseIntersectionPolicy, opt_tileCoord) {
        var z = this.getZForResolution(resolution);
        var scale = resolution / this.getResolution(z);
        var origin = this.getOrigin(z);
        var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_6__["toSize"])(this.getTileSize(z), this.tmpSize_);
        var adjustX = reverseIntersectionPolicy ? 0.5 : 0;
        var adjustY = reverseIntersectionPolicy ? 0.5 : 0;
        var xFromOrigin = Math.floor((x - origin[0]) / resolution + adjustX);
        var yFromOrigin = Math.floor((origin[1] - y) / resolution + adjustY);
        var tileCoordX = scale * xFromOrigin / tileSize[0];
        var tileCoordY = scale * yFromOrigin / tileSize[1];
        if (reverseIntersectionPolicy) {
            tileCoordX = Math.ceil(tileCoordX) - 1;
            tileCoordY = Math.ceil(tileCoordY) - 1;
        }
        else {
            tileCoordX = Math.floor(tileCoordX);
            tileCoordY = Math.floor(tileCoordY);
        }
        return Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_7__["createOrUpdate"])(z, tileCoordX, tileCoordY, opt_tileCoord);
    };
    /**
     * Although there is repetition between this method and `getTileCoordForXYAndResolution_`,
     * they should have separate implementations.  This method is for integer zoom
     * levels.  The other method should only be called for resolutions corresponding
     * to non-integer zoom levels.
     * @param {number} x Map x coordinate.
     * @param {number} y Map y coordinate.
     * @param {number} z Integer zoom level.
     * @param {boolean} reverseIntersectionPolicy Instead of letting edge
     *     intersections go to the higher tile coordinate, let edge intersections
     *     go to the lower tile coordinate.
     * @param {import("../tilecoord.js").TileCoord=} opt_tileCoord Temporary import("../tilecoord.js").TileCoord object.
     * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
     * @private
     */
    TileGrid.prototype.getTileCoordForXYAndZ_ = function (x, y, z, reverseIntersectionPolicy, opt_tileCoord) {
        var origin = this.getOrigin(z);
        var resolution = this.getResolution(z);
        var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_6__["toSize"])(this.getTileSize(z), this.tmpSize_);
        var adjustX = reverseIntersectionPolicy ? 0.5 : 0;
        var adjustY = reverseIntersectionPolicy ? 0.5 : 0;
        var xFromOrigin = Math.floor((x - origin[0]) / resolution + adjustX);
        var yFromOrigin = Math.floor((origin[1] - y) / resolution + adjustY);
        var tileCoordX = xFromOrigin / tileSize[0];
        var tileCoordY = yFromOrigin / tileSize[1];
        if (reverseIntersectionPolicy) {
            tileCoordX = Math.ceil(tileCoordX) - 1;
            tileCoordY = Math.ceil(tileCoordY) - 1;
        }
        else {
            tileCoordX = Math.floor(tileCoordX);
            tileCoordY = Math.floor(tileCoordY);
        }
        return Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_7__["createOrUpdate"])(z, tileCoordX, tileCoordY, opt_tileCoord);
    };
    /**
     * Get a tile coordinate given a map coordinate and zoom level.
     * @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
     * @param {number} z Zoom level.
     * @param {import("../tilecoord.js").TileCoord=} opt_tileCoord Destination import("../tilecoord.js").TileCoord object.
     * @return {import("../tilecoord.js").TileCoord} Tile coordinate.
     * @api
     */
    TileGrid.prototype.getTileCoordForCoordAndZ = function (coordinate, z, opt_tileCoord) {
        return this.getTileCoordForXYAndZ_(coordinate[0], coordinate[1], z, false, opt_tileCoord);
    };
    /**
     * @param {import("../tilecoord.js").TileCoord} tileCoord Tile coordinate.
     * @return {number} Tile resolution.
     */
    TileGrid.prototype.getTileCoordResolution = function (tileCoord) {
        return this.resolutions_[tileCoord[0]];
    };
    /**
     * Get the tile size for a zoom level. The type of the return value matches the
     * `tileSize` or `tileSizes` that the tile grid was configured with. To always
     * get an `import("../size.js").Size`, run the result through `import("../size.js").Size.toSize()`.
     * @param {number} z Z.
     * @return {number|import("../size.js").Size} Tile size.
     * @api
     */
    TileGrid.prototype.getTileSize = function (z) {
        if (this.tileSize_) {
            return this.tileSize_;
        }
        else {
            return this.tileSizes_[z];
        }
    };
    /**
     * @param {number} z Zoom level.
     * @return {import("../TileRange.js").default} Extent tile range for the specified zoom level.
     */
    TileGrid.prototype.getFullTileRange = function (z) {
        if (!this.fullTileRanges_) {
            return null;
        }
        else {
            return this.fullTileRanges_[z];
        }
    };
    /**
     * @param {number} resolution Resolution.
     * @param {number=} opt_direction If 0, the nearest resolution will be used.
     *     If 1, the nearest lower resolution will be used. If -1, the nearest
     *     higher resolution will be used. Default is 0.
     * @return {number} Z.
     * @api
     */
    TileGrid.prototype.getZForResolution = function (resolution, opt_direction) {
        var z = Object(_array_js__WEBPACK_IMPORTED_MODULE_3__["linearFindNearest"])(this.resolutions_, resolution, opt_direction || 0);
        return Object(_math_js__WEBPACK_IMPORTED_MODULE_5__["clamp"])(z, this.minZoom, this.maxZoom);
    };
    /**
     * @param {!import("../extent.js").Extent} extent Extent for this tile grid.
     * @private
     */
    TileGrid.prototype.calculateTileRanges_ = function (extent) {
        var length = this.resolutions_.length;
        var fullTileRanges = new Array(length);
        for (var z = this.minZoom; z < length; ++z) {
            fullTileRanges[z] = this.getTileRangeForExtentAndZ(extent, z);
        }
        this.fullTileRanges_ = fullTileRanges;
    };
    return TileGrid;
}());
/* harmony default export */ __webpack_exports__["default"] = (TileGrid);
//# sourceMappingURL=TileGrid.js.map

/***/ }),

/***/ "./node_modules/ol/tilegrid/WMTS.js":
/*!******************************************!*\
  !*** ./node_modules/ol/tilegrid/WMTS.js ***!
  \******************************************/
/*! exports provided: default, createFromCapabilitiesMatrixSet */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFromCapabilitiesMatrixSet", function() { return createFromCapabilitiesMatrixSet; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var _TileGrid_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TileGrid.js */ "./node_modules/ol/tilegrid/TileGrid.js");
/**
 * @module ol/tilegrid/WMTS
 */
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();



/**
 * @typedef {Object} Options
 * @property {import("../extent.js").Extent} [extent] Extent for the tile grid. No tiles
 * outside this extent will be requested by {@link module:ol/source/Tile} sources.
 * When no `origin` or `origins` are configured, the `origin` will be set to the
 * top-left corner of the extent.
 * @property {import("../coordinate.js").Coordinate} [origin] The tile grid origin, i.e.
 * where the `x` and `y` axes meet (`[z, 0, 0]`). Tile coordinates increase left
 * to right and downwards. If not specified, `extent` or `origins` must be provided.
 * @property {Array<import("../coordinate.js").Coordinate>} [origins] Tile grid origins,
 * i.e. where the `x` and `y` axes meet (`[z, 0, 0]`), for each zoom level. If
 * given, the array length should match the length of the `resolutions` array, i.e.
 * each resolution can have a different origin. Tile coordinates increase left to
 * right and downwards. If not specified, `extent` or `origin` must be provided.
 * @property {!Array<number>} resolutions Resolutions. The array index of each
 * resolution needs to match the zoom level. This means that even if a `minZoom`
 * is configured, the resolutions array will have a length of `maxZoom + 1`
 * @property {!Array<string>} matrixIds matrix IDs. The length of this array needs
 * to match the length of the `resolutions` array.
 * @property {Array<import("../size.js").Size>} [sizes] Number of tile rows and columns
 * of the grid for each zoom level. The values here are the `TileMatrixWidth` and
 * `TileMatrixHeight` advertised in the GetCapabilities response of the WMTS, and
 * define each zoom level's extent together with the `origin` or `origins`.
 * A grid `extent` can be configured in addition, and will further limit the extent for
 * which tile requests are made by sources. If the bottom-left corner of
 * an extent is used as `origin` or `origins`, then the `y` value must be
 * negative because OpenLayers tile coordinates use the top left as the origin.
 * @property {number|import("../size.js").Size} [tileSize] Tile size.
 * @property {Array<import("../size.js").Size>} [tileSizes] Tile sizes. The length of
 * this array needs to match the length of the `resolutions` array.
 */
/**
 * @classdesc
 * Set the grid pattern for sources accessing WMTS tiled-image servers.
 * @api
 */
var WMTSTileGrid = /** @class */ (function (_super) {
    __extends(WMTSTileGrid, _super);
    /**
     * @param {Options} options WMTS options.
     */
    function WMTSTileGrid(options) {
        var _this = _super.call(this, {
            extent: options.extent,
            origin: options.origin,
            origins: options.origins,
            resolutions: options.resolutions,
            tileSize: options.tileSize,
            tileSizes: options.tileSizes,
            sizes: options.sizes
        }) || this;
        /**
         * @private
         * @type {!Array<string>}
         */
        _this.matrixIds_ = options.matrixIds;
        return _this;
    }
    /**
     * @param {number} z Z.
     * @return {string} MatrixId..
     */
    WMTSTileGrid.prototype.getMatrixId = function (z) {
        return this.matrixIds_[z];
    };
    /**
     * Get the list of matrix identifiers.
     * @return {Array<string>} MatrixIds.
     * @api
     */
    WMTSTileGrid.prototype.getMatrixIds = function () {
        return this.matrixIds_;
    };
    return WMTSTileGrid;
}(_TileGrid_js__WEBPACK_IMPORTED_MODULE_2__["default"]));
/* harmony default export */ __webpack_exports__["default"] = (WMTSTileGrid);
/**
 * Create a tile grid from a WMTS capabilities matrix set and an
 * optional TileMatrixSetLimits.
 * @param {Object} matrixSet An object representing a matrixSet in the
 *     capabilities document.
 * @param {import("../extent.js").Extent=} opt_extent An optional extent to restrict the tile
 *     ranges the server provides.
 * @param {Array<Object>=} opt_matrixLimits An optional object representing
 *     the available matrices for tileGrid.
 * @return {WMTSTileGrid} WMTS tileGrid instance.
 * @api
 */
function createFromCapabilitiesMatrixSet(matrixSet, opt_extent, opt_matrixLimits) {
    /** @type {!Array<number>} */
    var resolutions = [];
    /** @type {!Array<string>} */
    var matrixIds = [];
    /** @type {!Array<import("../coordinate.js").Coordinate>} */
    var origins = [];
    /** @type {!Array<import("../size.js").Size>} */
    var tileSizes = [];
    /** @type {!Array<import("../size.js").Size>} */
    var sizes = [];
    var matrixLimits = opt_matrixLimits !== undefined ? opt_matrixLimits : [];
    var supportedCRSPropName = 'SupportedCRS';
    var matrixIdsPropName = 'TileMatrix';
    var identifierPropName = 'Identifier';
    var scaleDenominatorPropName = 'ScaleDenominator';
    var topLeftCornerPropName = 'TopLeftCorner';
    var tileWidthPropName = 'TileWidth';
    var tileHeightPropName = 'TileHeight';
    var code = matrixSet[supportedCRSPropName];
    var projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["get"])(code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')) ||
        Object(_proj_js__WEBPACK_IMPORTED_MODULE_1__["get"])(code);
    var metersPerUnit = projection.getMetersPerUnit();
    // swap origin x and y coordinates if axis orientation is lat/long
    var switchOriginXY = projection.getAxisOrientation().substr(0, 2) == 'ne';
    matrixSet[matrixIdsPropName].sort(function (a, b) {
        return b[scaleDenominatorPropName] - a[scaleDenominatorPropName];
    });
    matrixSet[matrixIdsPropName].forEach(function (elt) {
        var matrixAvailable;
        // use of matrixLimits to filter TileMatrices from GetCapabilities
        // TileMatrixSet from unavailable matrix levels.
        if (matrixLimits.length > 0) {
            matrixAvailable = Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["find"])(matrixLimits, function (elt_ml) {
                if (elt[identifierPropName] == elt_ml[matrixIdsPropName]) {
                    return true;
                }
                // Fallback for tileMatrix identifiers that don't get prefixed
                // by their tileMatrixSet identifiers.
                if (elt[identifierPropName].indexOf(':') === -1) {
                    return matrixSet[identifierPropName] + ':' + elt[identifierPropName] === elt_ml[matrixIdsPropName];
                }
                return false;
            });
        }
        else {
            matrixAvailable = true;
        }
        if (matrixAvailable) {
            matrixIds.push(elt[identifierPropName]);
            var resolution = elt[scaleDenominatorPropName] * 0.28E-3 / metersPerUnit;
            var tileWidth = elt[tileWidthPropName];
            var tileHeight = elt[tileHeightPropName];
            if (switchOriginXY) {
                origins.push([elt[topLeftCornerPropName][1],
                    elt[topLeftCornerPropName][0]]);
            }
            else {
                origins.push(elt[topLeftCornerPropName]);
            }
            resolutions.push(resolution);
            tileSizes.push(tileWidth == tileHeight ?
                tileWidth : [tileWidth, tileHeight]);
            sizes.push([elt['MatrixWidth'], elt['MatrixHeight']]);
        }
    });
    return new WMTSTileGrid({
        extent: opt_extent,
        origins: origins,
        resolutions: resolutions,
        matrixIds: matrixIds,
        tileSizes: tileSizes,
        sizes: sizes
    });
}
//# sourceMappingURL=WMTS.js.map

/***/ }),

/***/ "./node_modules/ol/tilegrid/common.js":
/*!********************************************!*\
  !*** ./node_modules/ol/tilegrid/common.js ***!
  \********************************************/
/*! exports provided: DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_MAX_ZOOM", function() { return DEFAULT_MAX_ZOOM; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_TILE_SIZE", function() { return DEFAULT_TILE_SIZE; });
/**
 * @module ol/tilegrid/common
 */
/**
 * Default maximum zoom for default tile grids.
 * @type {number}
 */
var DEFAULT_MAX_ZOOM = 42;
/**
 * Default tile size.
 * @type {number}
 */
var DEFAULT_TILE_SIZE = 256;
//# sourceMappingURL=common.js.map

/***/ }),

/***/ "./node_modules/ol/tileurlfunction.js":
/*!********************************************!*\
  !*** ./node_modules/ol/tileurlfunction.js ***!
  \********************************************/
/*! exports provided: createFromTemplate, createFromTemplates, createFromTileUrlFunctions, nullTileUrlFunction, expandUrl */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFromTemplate", function() { return createFromTemplate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFromTemplates", function() { return createFromTemplates; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFromTileUrlFunctions", function() { return createFromTileUrlFunctions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nullTileUrlFunction", function() { return nullTileUrlFunction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expandUrl", function() { return expandUrl; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asserts.js */ "./node_modules/ol/asserts.js");
/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math.js */ "./node_modules/ol/math.js");
/* harmony import */ var _tilecoord_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tilecoord.js */ "./node_modules/ol/tilecoord.js");
/**
 * @module ol/tileurlfunction
 */



/**
 * @param {string} template Template.
 * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
 * @return {import("./Tile.js").UrlFunction} Tile URL function.
 */
function createFromTemplate(template, tileGrid) {
    var zRegEx = /\{z\}/g;
    var xRegEx = /\{x\}/g;
    var yRegEx = /\{y\}/g;
    var dashYRegEx = /\{-y\}/g;
    return (
    /**
     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("./proj/Projection.js").default} projection Projection.
     * @return {string|undefined} Tile URL.
     */
    function (tileCoord, pixelRatio, projection) {
        if (!tileCoord) {
            return undefined;
        }
        else {
            return template.replace(zRegEx, tileCoord[0].toString())
                .replace(xRegEx, tileCoord[1].toString())
                .replace(yRegEx, tileCoord[2].toString())
                .replace(dashYRegEx, function () {
                var z = tileCoord[0];
                var range = tileGrid.getFullTileRange(z);
                Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(range, 55); // The {-y} placeholder requires a tile grid with extent
                var y = range.getHeight() - tileCoord[2] - 1;
                return y.toString();
            });
        }
    });
}
/**
 * @param {Array<string>} templates Templates.
 * @param {import("./tilegrid/TileGrid.js").default} tileGrid Tile grid.
 * @return {import("./Tile.js").UrlFunction} Tile URL function.
 */
function createFromTemplates(templates, tileGrid) {
    var len = templates.length;
    var tileUrlFunctions = new Array(len);
    for (var i = 0; i < len; ++i) {
        tileUrlFunctions[i] = createFromTemplate(templates[i], tileGrid);
    }
    return createFromTileUrlFunctions(tileUrlFunctions);
}
/**
 * @param {Array<import("./Tile.js").UrlFunction>} tileUrlFunctions Tile URL Functions.
 * @return {import("./Tile.js").UrlFunction} Tile URL function.
 */
function createFromTileUrlFunctions(tileUrlFunctions) {
    if (tileUrlFunctions.length === 1) {
        return tileUrlFunctions[0];
    }
    return (
    /**
     * @param {import("./tilecoord.js").TileCoord} tileCoord Tile Coordinate.
     * @param {number} pixelRatio Pixel ratio.
     * @param {import("./proj/Projection.js").default} projection Projection.
     * @return {string|undefined} Tile URL.
     */
    function (tileCoord, pixelRatio, projection) {
        if (!tileCoord) {
            return undefined;
        }
        else {
            var h = Object(_tilecoord_js__WEBPACK_IMPORTED_MODULE_2__["hash"])(tileCoord);
            var index = Object(_math_js__WEBPACK_IMPORTED_MODULE_1__["modulo"])(h, tileUrlFunctions.length);
            return tileUrlFunctions[index](tileCoord, pixelRatio, projection);
        }
    });
}
/**
 * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate.
 * @param {number} pixelRatio Pixel ratio.
 * @param {import("./proj/Projection.js").default} projection Projection.
 * @return {string|undefined} Tile URL.
 */
function nullTileUrlFunction(tileCoord, pixelRatio, projection) {
    return undefined;
}
/**
 * @param {string} url URL.
 * @return {Array<string>} Array of urls.
 */
function expandUrl(url) {
    var urls = [];
    var match = /\{([a-z])-([a-z])\}/.exec(url);
    if (match) {
        // char range
        var startCharCode = match[1].charCodeAt(0);
        var stopCharCode = match[2].charCodeAt(0);
        var charCode = void 0;
        for (charCode = startCharCode; charCode <= stopCharCode; ++charCode) {
            urls.push(url.replace(match[0], String.fromCharCode(charCode)));
        }
        return urls;
    }
    match = /\{(\d+)-(\d+)\}/.exec(url);
    if (match) {
        // number range
        var stop_1 = parseInt(match[2], 10);
        for (var i = parseInt(match[1], 10); i <= stop_1; i++) {
            urls.push(url.replace(match[0], i.toString()));
        }
        return urls;
    }
    urls.push(url);
    return urls;
}
//# sourceMappingURL=tileurlfunction.js.map

/***/ }),

/***/ "./node_modules/ol/transform.js":
/*!**************************************!*\
  !*** ./node_modules/ol/transform.js ***!
  \**************************************/
/*! exports provided: create, reset, multiply, set, setFromArray, apply, rotate, scale, makeScale, translate, compose, composeCssTransform, invert, makeInverse, determinant, toString */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reset", function() { return reset; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multiply", function() { return multiply; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set", function() { return set; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setFromArray", function() { return setFromArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "apply", function() { return apply; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rotate", function() { return rotate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scale", function() { return scale; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeScale", function() { return makeScale; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "translate", function() { return translate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return compose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "composeCssTransform", function() { return composeCssTransform; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return invert; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeInverse", function() { return makeInverse; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "determinant", function() { return determinant; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toString", function() { return toString; });
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asserts.js */ "./node_modules/ol/asserts.js");
/**
 * @module ol/transform
 */

/**
 * An array representing an affine 2d transformation for use with
 * {@link module:ol/transform} functions. The array has 6 elements.
 * @typedef {!Array<number>} Transform
 * @api
 */
/**
 * Collection of affine 2d transformation functions. The functions work on an
 * array of 6 elements. The element order is compatible with the [SVGMatrix
 * interface](https://developer.mozilla.org/en-US/docs/Web/API/SVGMatrix) and is
 * a subset (elements a to f) of a 3×3 matrix:
 * ```
 * [ a c e ]
 * [ b d f ]
 * [ 0 0 1 ]
 * ```
 */
/**
 * @private
 * @type {Transform}
 */
var tmp_ = new Array(6);
/**
 * Create an identity transform.
 * @return {!Transform} Identity transform.
 */
function create() {
    return [1, 0, 0, 1, 0, 0];
}
/**
 * Resets the given transform to an identity transform.
 * @param {!Transform} transform Transform.
 * @return {!Transform} Transform.
 */
function reset(transform) {
    return set(transform, 1, 0, 0, 1, 0, 0);
}
/**
 * Multiply the underlying matrices of two transforms and return the result in
 * the first transform.
 * @param {!Transform} transform1 Transform parameters of matrix 1.
 * @param {!Transform} transform2 Transform parameters of matrix 2.
 * @return {!Transform} transform1 multiplied with transform2.
 */
function multiply(transform1, transform2) {
    var a1 = transform1[0];
    var b1 = transform1[1];
    var c1 = transform1[2];
    var d1 = transform1[3];
    var e1 = transform1[4];
    var f1 = transform1[5];
    var a2 = transform2[0];
    var b2 = transform2[1];
    var c2 = transform2[2];
    var d2 = transform2[3];
    var e2 = transform2[4];
    var f2 = transform2[5];
    transform1[0] = a1 * a2 + c1 * b2;
    transform1[1] = b1 * a2 + d1 * b2;
    transform1[2] = a1 * c2 + c1 * d2;
    transform1[3] = b1 * c2 + d1 * d2;
    transform1[4] = a1 * e2 + c1 * f2 + e1;
    transform1[5] = b1 * e2 + d1 * f2 + f1;
    return transform1;
}
/**
 * Set the transform components a-f on a given transform.
 * @param {!Transform} transform Transform.
 * @param {number} a The a component of the transform.
 * @param {number} b The b component of the transform.
 * @param {number} c The c component of the transform.
 * @param {number} d The d component of the transform.
 * @param {number} e The e component of the transform.
 * @param {number} f The f component of the transform.
 * @return {!Transform} Matrix with transform applied.
 */
function set(transform, a, b, c, d, e, f) {
    transform[0] = a;
    transform[1] = b;
    transform[2] = c;
    transform[3] = d;
    transform[4] = e;
    transform[5] = f;
    return transform;
}
/**
 * Set transform on one matrix from another matrix.
 * @param {!Transform} transform1 Matrix to set transform to.
 * @param {!Transform} transform2 Matrix to set transform from.
 * @return {!Transform} transform1 with transform from transform2 applied.
 */
function setFromArray(transform1, transform2) {
    transform1[0] = transform2[0];
    transform1[1] = transform2[1];
    transform1[2] = transform2[2];
    transform1[3] = transform2[3];
    transform1[4] = transform2[4];
    transform1[5] = transform2[5];
    return transform1;
}
/**
 * Transforms the given coordinate with the given transform returning the
 * resulting, transformed coordinate. The coordinate will be modified in-place.
 *
 * @param {Transform} transform The transformation.
 * @param {import("./coordinate.js").Coordinate|import("./pixel.js").Pixel} coordinate The coordinate to transform.
 * @return {import("./coordinate.js").Coordinate|import("./pixel.js").Pixel} return coordinate so that operations can be
 *     chained together.
 */
function apply(transform, coordinate) {
    var x = coordinate[0];
    var y = coordinate[1];
    coordinate[0] = transform[0] * x + transform[2] * y + transform[4];
    coordinate[1] = transform[1] * x + transform[3] * y + transform[5];
    return coordinate;
}
/**
 * Applies rotation to the given transform.
 * @param {!Transform} transform Transform.
 * @param {number} angle Angle in radians.
 * @return {!Transform} The rotated transform.
 */
function rotate(transform, angle) {
    var cos = Math.cos(angle);
    var sin = Math.sin(angle);
    return multiply(transform, set(tmp_, cos, sin, -sin, cos, 0, 0));
}
/**
 * Applies scale to a given transform.
 * @param {!Transform} transform Transform.
 * @param {number} x Scale factor x.
 * @param {number} y Scale factor y.
 * @return {!Transform} The scaled transform.
 */
function scale(transform, x, y) {
    return multiply(transform, set(tmp_, x, 0, 0, y, 0, 0));
}
/**
 * Creates a scale transform.
 * @param {!Transform} target Transform to overwrite.
 * @param {number} x Scale factor x.
 * @param {number} y Scale factor y.
 * @return {!Transform} The scale transform.
 */
function makeScale(target, x, y) {
    return set(target, x, 0, 0, y, 0, 0);
}
/**
 * Applies translation to the given transform.
 * @param {!Transform} transform Transform.
 * @param {number} dx Translation x.
 * @param {number} dy Translation y.
 * @return {!Transform} The translated transform.
 */
function translate(transform, dx, dy) {
    return multiply(transform, set(tmp_, 1, 0, 0, 1, dx, dy));
}
/**
 * Creates a composite transform given an initial translation, scale, rotation, and
 * final translation (in that order only, not commutative).
 * @param {!Transform} transform The transform (will be modified in place).
 * @param {number} dx1 Initial translation x.
 * @param {number} dy1 Initial translation y.
 * @param {number} sx Scale factor x.
 * @param {number} sy Scale factor y.
 * @param {number} angle Rotation (in counter-clockwise radians).
 * @param {number} dx2 Final translation x.
 * @param {number} dy2 Final translation y.
 * @return {!Transform} The composite transform.
 */
function compose(transform, dx1, dy1, sx, sy, angle, dx2, dy2) {
    var sin = Math.sin(angle);
    var cos = Math.cos(angle);
    transform[0] = sx * cos;
    transform[1] = sy * sin;
    transform[2] = -sx * sin;
    transform[3] = sy * cos;
    transform[4] = dx2 * sx * cos - dy2 * sx * sin + dx1;
    transform[5] = dx2 * sy * sin + dy2 * sy * cos + dy1;
    return transform;
}
/**
 * Creates a composite transform given an initial translation, scale, rotation, and
 * final translation (in that order only, not commutative). The resulting transform
 * string can be applied as `transform` porperty of an HTMLElement's style.
 * @param {number} dx1 Initial translation x.
 * @param {number} dy1 Initial translation y.
 * @param {number} sx Scale factor x.
 * @param {number} sy Scale factor y.
 * @param {number} angle Rotation (in counter-clockwise radians).
 * @param {number} dx2 Final translation x.
 * @param {number} dy2 Final translation y.
 * @return {string} The composite css transform.
 * @api
 */
function composeCssTransform(dx1, dy1, sx, sy, angle, dx2, dy2) {
    return toString(compose(create(), dx1, dy1, sx, sy, angle, dx2, dy2));
}
/**
 * Invert the given transform.
 * @param {!Transform} source The source transform to invert.
 * @return {!Transform} The inverted (source) transform.
 */
function invert(source) {
    return makeInverse(source, source);
}
/**
 * Invert the given transform.
 * @param {!Transform} target Transform to be set as the inverse of
 *     the source transform.
 * @param {!Transform} source The source transform to invert.
 * @return {!Transform} The inverted (target) transform.
 */
function makeInverse(target, source) {
    var det = determinant(source);
    Object(_asserts_js__WEBPACK_IMPORTED_MODULE_0__["assert"])(det !== 0, 32); // Transformation matrix cannot be inverted
    var a = source[0];
    var b = source[1];
    var c = source[2];
    var d = source[3];
    var e = source[4];
    var f = source[5];
    target[0] = d / det;
    target[1] = -b / det;
    target[2] = -c / det;
    target[3] = a / det;
    target[4] = (c * f - d * e) / det;
    target[5] = -(a * f - b * e) / det;
    return target;
}
/**
 * Returns the determinant of the given matrix.
 * @param {!Transform} mat Matrix.
 * @return {number} Determinant.
 */
function determinant(mat) {
    return mat[0] * mat[3] - mat[1] * mat[2];
}
/**
 * A string version of the transform.  This can be used
 * for CSS transforms.
 * @param {!Transform} mat Matrix.
 * @return {string} The transform as a string.
 */
function toString(mat) {
    return 'matrix(' + mat.join(', ') + ')';
}
//# sourceMappingURL=transform.js.map

/***/ }),

/***/ "./node_modules/ol/uri.js":
/*!********************************!*\
  !*** ./node_modules/ol/uri.js ***!
  \********************************/
/*! exports provided: appendParams */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "appendParams", function() { return appendParams; });
/**
 * @module ol/uri
 */
/**
 * Appends query parameters to a URI.
 *
 * @param {string} uri The original URI, which may already have query data.
 * @param {!Object} params An object where keys are URI-encoded parameter keys,
 *     and the values are arbitrary types or arrays.
 * @return {string} The new URI.
 */
function appendParams(uri, params) {
    var keyParams = [];
    // Skip any null or undefined parameter values
    Object.keys(params).forEach(function (k) {
        if (params[k] !== null && params[k] !== undefined) {
            keyParams.push(k + '=' + encodeURIComponent(params[k]));
        }
    });
    var qs = keyParams.join('&');
    // remove any trailing ? or &
    uri = uri.replace(/[?&]$/, '');
    // append ? or & depending on whether uri has existing parameters
    uri = uri.indexOf('?') === -1 ? uri + '?' : uri + '&';
    return uri + qs;
}
//# sourceMappingURL=uri.js.map

/***/ }),

/***/ "./node_modules/ol/util.js":
/*!*********************************!*\
  !*** ./node_modules/ol/util.js ***!
  \*********************************/
/*! exports provided: abstract, getUid, VERSION */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "abstract", function() { return abstract; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUid", function() { return getUid; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
/**
 * @module ol/util
 */
/**
 * @return {?} Any return.
 */
function abstract() {
    return /** @type {?} */ ((function () {
        throw new Error('Unimplemented abstract method.');
    })());
}
/**
 * Counter for getUid.
 * @type {number}
 * @private
 */
var uidCounter_ = 0;
/**
 * Gets a unique ID for an object. This mutates the object so that further calls
 * with the same object as a parameter returns the same value. Unique IDs are generated
 * as a strictly increasing sequence. Adapted from goog.getUid.
 *
 * @param {Object} obj The object to get the unique ID for.
 * @return {string} The unique ID for the object.
 * @api
 */
function getUid(obj) {
    return obj.ol_uid || (obj.ol_uid = String(++uidCounter_));
}
/**
 * OpenLayers version.
 * @type {string}
 */
var VERSION = '6.3.1';
//# sourceMappingURL=util.js.map

/***/ }),

/***/ "./node_modules/ol/vec/mat4.js":
/*!*************************************!*\
  !*** ./node_modules/ol/vec/mat4.js ***!
  \*************************************/
/*! exports provided: create, fromTransform */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromTransform", function() { return fromTransform; });
/**
 * @module ol/vec/mat4
 */
/**
 * @return {Array<number>} "4x4 matrix representing a 3D identity transform."
 */
function create() {
    return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
}
/**
 * @param {Array<number>} mat4 Flattened 4x4 matrix receiving the result.
 * @param {import("../transform.js").Transform} transform Transformation matrix.
 * @return {Array<number>} "2D transformation matrix as flattened 4x4 matrix."
 */
function fromTransform(mat4, transform) {
    mat4[0] = transform[0];
    mat4[1] = transform[1];
    mat4[4] = transform[2];
    mat4[5] = transform[3];
    mat4[12] = transform[4];
    mat4[13] = transform[5];
    return mat4;
}
//# sourceMappingURL=mat4.js.map

/***/ }),

/***/ "./node_modules/ol/webgl.js":
/*!**********************************!*\
  !*** ./node_modules/ol/webgl.js ***!
  \**********************************/
/*! exports provided: ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER, STREAM_DRAW, STATIC_DRAW, DYNAMIC_DRAW, UNSIGNED_BYTE, UNSIGNED_SHORT, UNSIGNED_INT, FLOAT, getContext, getSupportedExtensions */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARRAY_BUFFER", function() { return ARRAY_BUFFER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ELEMENT_ARRAY_BUFFER", function() { return ELEMENT_ARRAY_BUFFER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STREAM_DRAW", function() { return STREAM_DRAW; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STATIC_DRAW", function() { return STATIC_DRAW; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DYNAMIC_DRAW", function() { return DYNAMIC_DRAW; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSIGNED_BYTE", function() { return UNSIGNED_BYTE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSIGNED_SHORT", function() { return UNSIGNED_SHORT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UNSIGNED_INT", function() { return UNSIGNED_INT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FLOAT", function() { return FLOAT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getContext", function() { return getContext; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSupportedExtensions", function() { return getSupportedExtensions; });
/**
 * @module ol/webgl
 */
/**
 * Constants taken from goog.webgl
 */
/**
 * Used by {@link module:ol/webgl/Helper~WebGLHelper} for buffers containing vertices data, such as
 * position, color, texture coordinate, etc. These vertices are then referenced by an index buffer
 * to be drawn on screen (see {@link module:ol/webgl.ELEMENT_ARRAY_BUFFER}).
 * @const
 * @type {number}
 * @api
 */
var ARRAY_BUFFER = 0x8892;
/**
 * Used by {@link module:ol/webgl/Helper~WebGLHelper} for buffers containing indices data.
 * Index buffers are essentially lists of references to vertices defined in a vertex buffer
 * (see {@link module:ol/webgl.ARRAY_BUFFER}), and define the primitives (triangles) to be drawn.
 * @const
 * @type {number}
 * @api
 */
var ELEMENT_ARRAY_BUFFER = 0x8893;
/**
 * Used by {link module:ol/webgl/Buffer~WebGLArrayBuffer}.
 * @const
 * @type {number}
 * @api
 */
var STREAM_DRAW = 0x88E0;
/**
 * Used by {link module:ol/webgl/Buffer~WebGLArrayBuffer}.
 * @const
 * @type {number}
 * @api
 */
var STATIC_DRAW = 0x88E4;
/**
 * Used by {link module:ol/webgl/Buffer~WebGLArrayBuffer}.
 * @const
 * @type {number}
 * @api
 */
var DYNAMIC_DRAW = 0x88E8;
/**
 * @const
 * @type {number}
 */
var UNSIGNED_BYTE = 0x1401;
/**
 * @const
 * @type {number}
 */
var UNSIGNED_SHORT = 0x1403;
/**
 * @const
 * @type {number}
 */
var UNSIGNED_INT = 0x1405;
/**
 * @const
 * @type {number}
 */
var FLOAT = 0x1406;
/** end of goog.webgl constants
 */
/**
 * @const
 * @type {Array<string>}
 */
var CONTEXT_IDS = [
    'experimental-webgl',
    'webgl',
    'webkit-3d',
    'moz-webgl'
];
/**
 * @param {HTMLCanvasElement} canvas Canvas.
 * @param {Object=} opt_attributes Attributes.
 * @return {WebGLRenderingContext} WebGL rendering context.
 */
function getContext(canvas, opt_attributes) {
    var ii = CONTEXT_IDS.length;
    for (var i = 0; i < ii; ++i) {
        try {
            var context = canvas.getContext(CONTEXT_IDS[i], opt_attributes);
            if (context) {
                return /** @type {!WebGLRenderingContext} */ (context);
            }
        }
        catch (e) {
            // pass
        }
    }
    return null;
}
/**
 * @type {Array<string>}
 */
var supportedExtensions;
/**
 * @return {Array<string>} List of supported WebGL extensions.
 */
function getSupportedExtensions() {
    if (!supportedExtensions) {
        var canvas = document.createElement('canvas');
        var gl = getContext(canvas);
        if (gl) {
            supportedExtensions = gl.getSupportedExtensions();
        }
    }
    return supportedExtensions;
}
//# sourceMappingURL=webgl.js.map

/***/ }),

/***/ "./node_modules/ol/webgl/Buffer.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/webgl/Buffer.js ***!
  \*****************************************/
/*! exports provided: BufferUsage, getArrayClassForType, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BufferUsage", function() { return BufferUsage; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getArrayClassForType", function() { return getArrayClassForType; });
/* harmony import */ var _webgl_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../webgl.js */ "./node_modules/ol/webgl.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
/**
 * @module ol/webgl/Buffer
 */



/**
 * Used to describe the intended usage for the data: `STATIC_DRAW`, `STREAM_DRAW`
 * or `DYNAMIC_DRAW`.
 * @enum {number}
 */
var BufferUsage = {
    STATIC_DRAW: _webgl_js__WEBPACK_IMPORTED_MODULE_0__["STATIC_DRAW"],
    STREAM_DRAW: _webgl_js__WEBPACK_IMPORTED_MODULE_0__["STREAM_DRAW"],
    DYNAMIC_DRAW: _webgl_js__WEBPACK_IMPORTED_MODULE_0__["DYNAMIC_DRAW"]
};
/**
 * @classdesc
 * Object used to store an array of data as well as usage information for that data.
 * Stores typed arrays internally, either Float32Array or Uint16/32Array depending on
 * the buffer type (ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER) and available extensions.
 *
 * To populate the array, you can either use:
 * * A size using `#ofSize(buffer)`
 * * An `ArrayBuffer` object using `#fromArrayBuffer(buffer)`
 * * A plain array using `#fromArray(array)`
 *
 * Note:
 * See the documentation of [WebGLRenderingContext.bufferData](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData)
 * for more info on buffer usage.
 * @api
 */
var WebGLArrayBuffer = /** @class */ (function () {
    /**
     * @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.
     * @param {number=} opt_usage Intended usage, either `STATIC_DRAW`, `STREAM_DRAW` or `DYNAMIC_DRAW`.
     * Default is `DYNAMIC_DRAW`.
     */
    function WebGLArrayBuffer(type, opt_usage) {
        /**
         * @private
         * @type {Float32Array|Uint32Array}
         */
        this.array = null;
        /**
         * @private
         * @type {number}
         */
        this.type = type;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__["assert"])(type === _webgl_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_BUFFER"] || type === _webgl_js__WEBPACK_IMPORTED_MODULE_0__["ELEMENT_ARRAY_BUFFER"], 62);
        /**
         * @private
         * @type {number}
         */
        this.usage = opt_usage !== undefined ? opt_usage : BufferUsage.STATIC_DRAW;
    }
    /**
     * Populates the buffer with an array of the given size (all values will be zeroes).
     * @param {number} size Array size
     */
    WebGLArrayBuffer.prototype.ofSize = function (size) {
        this.array = new (getArrayClassForType(this.type))(size);
    };
    /**
     * Populates the buffer with an array of the given size (all values will be zeroes).
     * @param {Array<number>} array Numerical array
     */
    WebGLArrayBuffer.prototype.fromArray = function (array) {
        this.array = (getArrayClassForType(this.type)).from(array);
    };
    /**
     * Populates the buffer with a raw binary array buffer.
     * @param {ArrayBuffer} buffer Raw binary buffer to populate the array with. Note that this buffer must have been
     * initialized for the same typed array class.
     */
    WebGLArrayBuffer.prototype.fromArrayBuffer = function (buffer) {
        this.array = new (getArrayClassForType(this.type))(buffer);
    };
    /**
     * @return {number} Buffer type.
     */
    WebGLArrayBuffer.prototype.getType = function () {
        return this.type;
    };
    /**
     * Will return null if the buffer was not initialized
     * @return {Float32Array|Uint32Array} Array.
     */
    WebGLArrayBuffer.prototype.getArray = function () {
        return this.array;
    };
    /**
     * @return {number} Usage.
     */
    WebGLArrayBuffer.prototype.getUsage = function () {
        return this.usage;
    };
    /**
     * Will return 0 if the buffer is not initialized
     * @return {number} Array size
     */
    WebGLArrayBuffer.prototype.getSize = function () {
        return this.array ? this.array.length : 0;
    };
    return WebGLArrayBuffer;
}());
/**
 * Returns a typed array constructor based on the given buffer type
 * @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.
 * @returns {Float32ArrayConstructor|Uint32ArrayConstructor} The typed array class to use for this buffer.
 */
function getArrayClassForType(type) {
    switch (type) {
        case _webgl_js__WEBPACK_IMPORTED_MODULE_0__["ARRAY_BUFFER"]:
            return Float32Array;
        case _webgl_js__WEBPACK_IMPORTED_MODULE_0__["ELEMENT_ARRAY_BUFFER"]:
            return Uint32Array;
        default:
            return Float32Array;
    }
}
/* harmony default export */ __webpack_exports__["default"] = (WebGLArrayBuffer);
//# sourceMappingURL=Buffer.js.map

/***/ }),

/***/ "./node_modules/ol/webgl/ContextEventType.js":
/*!***************************************************!*\
  !*** ./node_modules/ol/webgl/ContextEventType.js ***!
  \***************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/webgl/ContextEventType
 */
/**
 * @enum {string}
 */
/* harmony default export */ __webpack_exports__["default"] = ({
    LOST: 'webglcontextlost',
    RESTORED: 'webglcontextrestored'
});
//# sourceMappingURL=ContextEventType.js.map

/***/ }),

/***/ "./node_modules/ol/webgl/Helper.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/webgl/Helper.js ***!
  \*****************************************/
/*! exports provided: ShaderType, DefaultUniform, AttributeType, computeAttributesStride, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ShaderType", function() { return ShaderType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultUniform", function() { return DefaultUniform; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AttributeType", function() { return AttributeType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeAttributesStride", function() { return computeAttributesStride; });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util.js */ "./node_modules/ol/util.js");
/* harmony import */ var _Disposable_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Disposable.js */ "./node_modules/ol/Disposable.js");
/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../obj.js */ "./node_modules/ol/obj.js");
/* harmony import */ var _webgl_ContextEventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../webgl/ContextEventType.js */ "./node_modules/ol/webgl/ContextEventType.js");
/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../transform.js */ "./node_modules/ol/transform.js");
/* harmony import */ var _vec_mat4_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../vec/mat4.js */ "./node_modules/ol/vec/mat4.js");
/* harmony import */ var _PostProcessingPass_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./PostProcessingPass.js */ "./node_modules/ol/webgl/PostProcessingPass.js");
/* harmony import */ var _webgl_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../webgl.js */ "./node_modules/ol/webgl.js");
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../asserts.js */ "./node_modules/ol/asserts.js");
var __extends = (undefined && undefined.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @module ol/webgl/Helper
 */










/**
 * @typedef {Object} BufferCacheEntry
 * @property {import("./Buffer.js").default} buffer
 * @property {WebGLBuffer} webGlBuffer
 */
/**
 * Shader types, either `FRAGMENT_SHADER` or `VERTEX_SHADER`.
 * @enum {number}
 */
var ShaderType = {
    FRAGMENT_SHADER: 0x8B30,
    VERTEX_SHADER: 0x8B31
};
/**
 * Uniform names used in the default shaders: `PROJECTION_MATRIX`, `OFFSET_SCALE_MATRIX`.
 * and `OFFSET_ROTATION_MATRIX`.
 * @enum {string}
 */
var DefaultUniform = {
    PROJECTION_MATRIX: 'u_projectionMatrix',
    OFFSET_SCALE_MATRIX: 'u_offsetScaleMatrix',
    OFFSET_ROTATION_MATRIX: 'u_offsetRotateMatrix',
    TIME: 'u_time',
    ZOOM: 'u_zoom',
    RESOLUTION: 'u_resolution'
};
/**
 * Attribute types, either `UNSIGNED_BYTE`, `UNSIGNED_SHORT`, `UNSIGNED_INT` or `FLOAT`
 * Note: an attribute stored in a `Float32Array` should be of type `FLOAT`.
 * @enum {number}
 */
var AttributeType = {
    UNSIGNED_BYTE: _webgl_js__WEBPACK_IMPORTED_MODULE_7__["UNSIGNED_BYTE"],
    UNSIGNED_SHORT: _webgl_js__WEBPACK_IMPORTED_MODULE_7__["UNSIGNED_SHORT"],
    UNSIGNED_INT: _webgl_js__WEBPACK_IMPORTED_MODULE_7__["UNSIGNED_INT"],
    FLOAT: _webgl_js__WEBPACK_IMPORTED_MODULE_7__["FLOAT"]
};
/**
 * Description of an attribute in a buffer
 * @typedef {Object} AttributeDescription
 * @property {string} name Attribute name to use in shaders
 * @property {number} size Number of components per attributes
 * @property {AttributeType} [type] Attribute type, i.e. number of bytes used to store the value. This is
 * determined by the class of typed array which the buffer uses (eg. `Float32Array` for a `FLOAT` attribute).
 * Default is `FLOAT`.
 */
/**
 * @typedef {number|Array<number>|HTMLCanvasElement|HTMLImageElement|ImageData|import("../transform").Transform} UniformLiteralValue
 */
/**
 * Uniform value can be a number, array of numbers (2 to 4), canvas element or a callback returning
 * one of the previous types.
 * @typedef {UniformLiteralValue|function(import("../PluggableMap.js").FrameState):UniformLiteralValue} UniformValue
 */
/**
 * @typedef {Object} PostProcessesOptions
 * @property {number} [scaleRatio] Scale ratio; if < 1, the post process will render to a texture smaller than
 * the main canvas which will then be sampled up (useful for saving resource on blur steps).
 * @property {string} [vertexShader] Vertex shader source
 * @property {string} [fragmentShader] Fragment shader source
 * @property {Object.<string,UniformValue>} [uniforms] Uniform definitions for the post process step
 */
/**
 * @typedef {Object} Options
 * @property {Object.<string,UniformValue>} [uniforms] Uniform definitions; property names must match the uniform
 * names in the provided or default shaders.
 * @property {Array<PostProcessesOptions>} [postProcesses] Post-processes definitions
 */
/**
 * @typedef {Object} UniformInternalDescription
 * @property {string} name Name
 * @property {UniformValue=} value Value
 * @property {WebGLTexture} [texture] Texture
 * @private
 */
/**
 * @classdesc
 * This class is intended to provide low-level functions related to WebGL rendering, so that accessing
 * directly the WebGL API should not be required anymore.
 *
 * Several operations are handled by the `WebGLHelper` class:
 *
 * ### Define custom shaders and uniforms
 *
 *   *Shaders* are low-level programs executed on the GPU and written in GLSL. There are two types of shaders:
 *
 *   Vertex shaders are used to manipulate the position and attribute of *vertices* of rendered primitives (ie. corners of a square).
 *   Outputs are:
 *
 *   * `gl_Position`: position of the vertex in screen space
 *
 *   * Varyings usually prefixed with `v_` are passed on to the fragment shader
 *
 *   Fragment shaders are used to control the actual color of the pixels drawn on screen. Their only output is `gl_FragColor`.
 *
 *   Both shaders can take *uniforms* or *attributes* as input. Attributes are explained later. Uniforms are common, read-only values that
 *   can be changed at every frame and can be of type float, arrays of float or images.
 *
 *   Shaders must be compiled and assembled into a program like so:
 *   ```js
 *   // here we simply create two shaders and assemble them in a program which is then used
 *   // for subsequent rendering calls
 *   const vertexShader = new WebGLVertex(VERTEX_SHADER);
 *   const fragmentShader = new WebGLFragment(FRAGMENT_SHADER);
 *   const program = this.context.getProgram(fragmentShader, vertexShader);
 *   helper.useProgram(this.program);
 *   ```
 *
 *   Uniforms are defined using the `uniforms` option and can either be explicit values or callbacks taking the frame state as argument.
 *   You can also change their value along the way like so:
 *   ```js
 *   helper.setUniformFloatValue('u_value', valueAsNumber);
 *   ```
 *
 * ### Defining post processing passes
 *
 *   *Post processing* describes the act of rendering primitives to a texture, and then rendering this texture to the final canvas
 *   while applying special effects in screen space.
 *   Typical uses are: blurring, color manipulation, depth of field, filtering...
 *
 *   The `WebGLHelper` class offers the possibility to define post processes at creation time using the `postProcesses` option.
 *   A post process step accepts the following options:
 *
 *   * `fragmentShader` and `vertexShader`: text literals in GLSL language that will be compiled and used in the post processing step.
 *   * `uniforms`: uniforms can be defined for the post processing steps just like for the main render.
 *   * `scaleRatio`: allows using an intermediate texture smaller or higher than the final canvas in the post processing step.
 *     This is typically used in blur steps to reduce the performance overhead by using an already downsampled texture as input.
 *
 *   The {@link module:ol/webgl/PostProcessingPass~WebGLPostProcessingPass} class is used internally, refer to its documentation for more info.
 *
 * ### Binding WebGL buffers and flushing data into them
 *
 *   Data that must be passed to the GPU has to be transferred using {@link module:ol/webgl/Buffer~WebGLArrayBuffer} objects.
 *   A buffer has to be created only once, but must be bound every time the buffer content will be used for rendering.
 *   This is done using {@link bindBuffer}.
 *   When the buffer's array content has changed, the new data has to be flushed to the GPU memory; this is done using
 *   {@link flushBufferData}. Note: this operation is expensive and should be done as infrequently as possible.
 *
 *   When binding an array buffer, a `target` parameter must be given: it should be either {@link module:ol/webgl.ARRAY_BUFFER}
 *   (if the buffer contains vertices data) or {@link module:ol/webgl.ELEMENT_ARRAY_BUFFER} (if the buffer contains indices data).
 *
 *   Examples below:
 *   ```js
 *   // at initialization phase
 *   const verticesBuffer = new WebGLArrayBuffer([], DYNAMIC_DRAW);
 *   const indicesBuffer = new WebGLArrayBuffer([], DYNAMIC_DRAW);
 *
 *   // when array values have changed
 *   helper.flushBufferData(ARRAY_BUFFER, this.verticesBuffer);
 *   helper.flushBufferData(ELEMENT_ARRAY_BUFFER, this.indicesBuffer);
 *
 *   // at rendering phase
 *   helper.bindBuffer(ARRAY_BUFFER, this.verticesBuffer);
 *   helper.bindBuffer(ELEMENT_ARRAY_BUFFER, this.indicesBuffer);
 *   ```
 *
 * ### Specifying attributes
 *
 *   The GPU only receives the data as arrays of numbers. These numbers must be handled differently depending on what it describes (position, texture coordinate...).
 *   Attributes are used to specify these uses. Use {@link enableAttributeArray_} and either
 *   the default attribute names in {@link module:ol/webgl/Helper.DefaultAttrib} or custom ones.
 *
 *   Please note that you will have to specify the type and offset of the attributes in the data array. You can refer to the documentation of [WebGLRenderingContext.vertexAttribPointer](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer) for more explanation.
 *   ```js
 *   // here we indicate that the data array has the following structure:
 *   // [posX, posY, offsetX, offsetY, texCoordU, texCoordV, posX, posY, ...]
 *   helper.enableAttributes([
 *     {
 *        name: 'a_position',
 *        size: 2
 *     },
 *     {
 *       name: 'a_offset',
 *       size: 2
 *     },
 *     {
 *       name: 'a_texCoord',
 *       size: 2
 *     }
 *   ])
 *   ```
 *
 * ### Rendering primitives
 *
 *   Once all the steps above have been achieved, rendering primitives to the screen is done using {@link prepareDraw}, {@link drawElements} and {@link finalizeDraw}.
 *   ```js
 *   // frame preparation step
 *   helper.prepareDraw(frameState);
 *
 *   // call this for every data array that has to be rendered on screen
 *   helper.drawElements(0, this.indicesBuffer.getArray().length);
 *
 *   // finalize the rendering by applying post processes
 *   helper.finalizeDraw(frameState);
 *   ```
 *
 * For an example usage of this class, refer to {@link module:ol/renderer/webgl/PointsLayer~WebGLPointsLayerRenderer}.
 *
 *
 * @api
 */
var WebGLHelper = /** @class */ (function (_super) {
    __extends(WebGLHelper, _super);
    /**
     * @param {Options=} opt_options Options.
     */
    function WebGLHelper(opt_options) {
        var _this = _super.call(this) || this;
        var options = opt_options || {};
        /** @private */
        _this.boundHandleWebGLContextLost_ = _this.handleWebGLContextLost.bind(_this);
        /** @private */
        _this.boundHandleWebGLContextRestored_ = _this.handleWebGLContextRestored.bind(_this);
        /**
         * @private
         * @type {HTMLCanvasElement}
         */
        _this.canvas_ = document.createElement('canvas');
        _this.canvas_.style.position = 'absolute';
        _this.canvas_.style.left = '0';
        /**
         * @private
         * @type {WebGLRenderingContext}
         */
        _this.gl_ = Object(_webgl_js__WEBPACK_IMPORTED_MODULE_7__["getContext"])(_this.canvas_);
        var gl = _this.getGL();
        /**
         * @private
         * @type {!Object<string, BufferCacheEntry>}
         */
        _this.bufferCache_ = {};
        /**
         * @private
         * @type {WebGLProgram}
         */
        _this.currentProgram_ = null;
        Object(_asserts_js__WEBPACK_IMPORTED_MODULE_9__["assert"])(Object(_array_js__WEBPACK_IMPORTED_MODULE_8__["includes"])(Object(_webgl_js__WEBPACK_IMPORTED_MODULE_7__["getSupportedExtensions"])(), 'OES_element_index_uint'), 63);
        gl.getExtension('OES_element_index_uint');
        _this.canvas_.addEventListener(_webgl_ContextEventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOST, _this.boundHandleWebGLContextLost_);
        _this.canvas_.addEventListener(_webgl_ContextEventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].RESTORED, _this.boundHandleWebGLContextRestored_);
        /**
         * @private
         * @type {import("../transform.js").Transform}
         */
        _this.offsetRotateMatrix_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_4__["create"])();
        /**
         * @private
         * @type {import("../transform.js").Transform}
         */
        _this.offsetScaleMatrix_ = Object(_transform_js__WEBPACK_IMPORTED_MODULE_4__["create"])();
        /**
         * @private
         * @type {Array<number>}
         */
        _this.tmpMat4_ = Object(_vec_mat4_js__WEBPACK_IMPORTED_MODULE_5__["create"])();
        /**
         * @private
         * @type {Object.<string, WebGLUniformLocation>}
         */
        _this.uniformLocations_ = {};
        /**
         * @private
         * @type {Object.<string, number>}
         */
        _this.attribLocations_ = {};
        /**
         * Holds info about custom uniforms used in the post processing pass.
         * If the uniform is a texture, the WebGL Texture object will be stored here.
         * @type {Array<UniformInternalDescription>}
         * @private
         */
        _this.uniforms_ = [];
        if (options.uniforms) {
            for (var name_1 in options.uniforms) {
                _this.uniforms_.push({
                    name: name_1,
                    value: options.uniforms[name_1]
                });
            }
        }
        /**
         * An array of PostProcessingPass objects is kept in this variable, built from the steps provided in the
         * options. If no post process was given, a default one is used (so as not to have to make an exception to
         * the frame buffer logic).
         * @type {Array<WebGLPostProcessingPass>}
         * @private
         */
        _this.postProcessPasses_ = options.postProcesses ? options.postProcesses.map(function (options) {
            return new _PostProcessingPass_js__WEBPACK_IMPORTED_MODULE_6__["default"]({
                webGlContext: gl,
                scaleRatio: options.scaleRatio,
                vertexShader: options.vertexShader,
                fragmentShader: options.fragmentShader,
                uniforms: options.uniforms
            });
        }) : [new _PostProcessingPass_js__WEBPACK_IMPORTED_MODULE_6__["default"]({ webGlContext: gl })];
        /**
         * @type {string|null}
         * @private
         */
        _this.shaderCompileErrors_ = null;
        /**
         * @type {number}
         * @private
         */
        _this.startTime_ = Date.now();
        return _this;
    }
    /**
     * Just bind the buffer if it's in the cache. Otherwise create
     * the WebGL buffer, bind it, populate it, and add an entry to
     * the cache.
     * @param {import("./Buffer").default} buffer Buffer.
     * @api
     */
    WebGLHelper.prototype.bindBuffer = function (buffer) {
        var gl = this.getGL();
        var bufferKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(buffer);
        var bufferCache = this.bufferCache_[bufferKey];
        if (!bufferCache) {
            var webGlBuffer = gl.createBuffer();
            bufferCache = {
                buffer: buffer,
                webGlBuffer: webGlBuffer
            };
            this.bufferCache_[bufferKey] = bufferCache;
        }
        gl.bindBuffer(buffer.getType(), bufferCache.webGlBuffer);
    };
    /**
     * Update the data contained in the buffer array; this is required for the
     * new data to be rendered
     * @param {import("./Buffer").default} buffer Buffer.
     * @api
     */
    WebGLHelper.prototype.flushBufferData = function (buffer) {
        var gl = this.getGL();
        this.bindBuffer(buffer);
        gl.bufferData(buffer.getType(), buffer.getArray(), buffer.getUsage());
    };
    /**
     * @param {import("./Buffer.js").default} buf Buffer.
     */
    WebGLHelper.prototype.deleteBuffer = function (buf) {
        var gl = this.getGL();
        var bufferKey = Object(_util_js__WEBPACK_IMPORTED_MODULE_0__["getUid"])(buf);
        var bufferCacheEntry = this.bufferCache_[bufferKey];
        if (!gl.isContextLost()) {
            gl.deleteBuffer(bufferCacheEntry.buffer);
        }
        delete this.bufferCache_[bufferKey];
    };
    /**
     * @inheritDoc
     */
    WebGLHelper.prototype.disposeInternal = function () {
        this.canvas_.removeEventListener(_webgl_ContextEventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].LOST, this.boundHandleWebGLContextLost_);
        this.canvas_.removeEventListener(_webgl_ContextEventType_js__WEBPACK_IMPORTED_MODULE_3__["default"].RESTORED, this.boundHandleWebGLContextRestored_);
    };
    /**
     * Clear the buffer & set the viewport to draw.
     * Post process passes will be initialized here, the first one being bound as a render target for
     * subsequent draw calls.
     * @param {import("../PluggableMap.js").FrameState} frameState current frame state
     * @api
     */
    WebGLHelper.prototype.prepareDraw = function (frameState) {
        var gl = this.getGL();
        var canvas = this.getCanvas();
        var size = frameState.size;
        var pixelRatio = frameState.pixelRatio;
        canvas.width = size[0] * pixelRatio;
        canvas.height = size[1] * pixelRatio;
        canvas.style.width = size[0] + 'px';
        canvas.style.height = size[1] + 'px';
        gl.useProgram(this.currentProgram_);
        // loop backwards in post processes list
        for (var i = this.postProcessPasses_.length - 1; i >= 0; i--) {
            this.postProcessPasses_[i].init(frameState);
        }
        gl.bindTexture(gl.TEXTURE_2D, null);
        gl.clearColor(0.0, 0.0, 0.0, 0.0);
        gl.clear(gl.COLOR_BUFFER_BIT);
        gl.enable(gl.BLEND);
        gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
        gl.useProgram(this.currentProgram_);
        this.applyFrameState(frameState);
        this.applyUniforms(frameState);
    };
    /**
     * Clear the render target & bind it for future draw operations.
     * This is similar to `prepareDraw`, only post processes will not be applied.
     * Note: the whole viewport will be drawn to the render target, regardless of its size.
     * @param {import("../PluggableMap.js").FrameState} frameState current frame state
     * @param {import("./RenderTarget.js").default} renderTarget Render target to draw to
     * @param {boolean} [opt_disableAlphaBlend] If true, no alpha blending will happen.
     */
    WebGLHelper.prototype.prepareDrawToRenderTarget = function (frameState, renderTarget, opt_disableAlphaBlend) {
        var gl = this.getGL();
        var size = renderTarget.getSize();
        gl.bindFramebuffer(gl.FRAMEBUFFER, renderTarget.getFramebuffer());
        gl.viewport(0, 0, size[0], size[1]);
        gl.bindTexture(gl.TEXTURE_2D, renderTarget.getTexture());
        gl.clearColor(0.0, 0.0, 0.0, 0.0);
        gl.clear(gl.COLOR_BUFFER_BIT);
        gl.enable(gl.BLEND);
        gl.blendFunc(gl.ONE, opt_disableAlphaBlend ? gl.ZERO : gl.ONE_MINUS_SRC_ALPHA);
        gl.useProgram(this.currentProgram_);
        this.applyFrameState(frameState);
        this.applyUniforms(frameState);
    };
    /**
     * Execute a draw call based on the currently bound program, texture, buffers, attributes.
     * @param {number} start Start index.
     * @param {number} end End index.
     * @api
     */
    WebGLHelper.prototype.drawElements = function (start, end) {
        var gl = this.getGL();
        var elementType = gl.UNSIGNED_INT;
        var elementSize = 4;
        var numItems = end - start;
        var offsetInBytes = start * elementSize;
        gl.drawElements(gl.TRIANGLES, numItems, elementType, offsetInBytes);
    };
    /**
     * Apply the successive post process passes which will eventually render to the actual canvas.
     * @param {import("../PluggableMap.js").FrameState} frameState current frame state
     * @api
     */
    WebGLHelper.prototype.finalizeDraw = function (frameState) {
        // apply post processes using the next one as target
        for (var i = 0; i < this.postProcessPasses_.length; i++) {
            this.postProcessPasses_[i].apply(frameState, this.postProcessPasses_[i + 1] || null);
        }
    };
    /**
     * @return {HTMLCanvasElement} Canvas.
     * @api
     */
    WebGLHelper.prototype.getCanvas = function () {
        return this.canvas_;
    };
    /**
     * Get the WebGL rendering context
     * @return {WebGLRenderingContext} The rendering context.
     * @api
     */
    WebGLHelper.prototype.getGL = function () {
        return this.gl_;
    };
    /**
     * Sets the default matrix uniforms for a given frame state. This is called internally in `prepareDraw`.
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @private
     */
    WebGLHelper.prototype.applyFrameState = function (frameState) {
        var size = frameState.size;
        var rotation = frameState.viewState.rotation;
        var offsetScaleMatrix = Object(_transform_js__WEBPACK_IMPORTED_MODULE_4__["reset"])(this.offsetScaleMatrix_);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_4__["scale"])(offsetScaleMatrix, 2 / size[0], 2 / size[1]);
        var offsetRotateMatrix = Object(_transform_js__WEBPACK_IMPORTED_MODULE_4__["reset"])(this.offsetRotateMatrix_);
        if (rotation !== 0) {
            Object(_transform_js__WEBPACK_IMPORTED_MODULE_4__["rotate"])(offsetRotateMatrix, -rotation);
        }
        this.setUniformMatrixValue(DefaultUniform.OFFSET_SCALE_MATRIX, Object(_vec_mat4_js__WEBPACK_IMPORTED_MODULE_5__["fromTransform"])(this.tmpMat4_, offsetScaleMatrix));
        this.setUniformMatrixValue(DefaultUniform.OFFSET_ROTATION_MATRIX, Object(_vec_mat4_js__WEBPACK_IMPORTED_MODULE_5__["fromTransform"])(this.tmpMat4_, offsetRotateMatrix));
        this.setUniformFloatValue(DefaultUniform.TIME, (Date.now() - this.startTime_) * 0.001);
        this.setUniformFloatValue(DefaultUniform.ZOOM, frameState.viewState.zoom);
        this.setUniformFloatValue(DefaultUniform.RESOLUTION, frameState.viewState.resolution);
    };
    /**
     * Sets the custom uniforms based on what was given in the constructor. This is called internally in `prepareDraw`.
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @private
     */
    WebGLHelper.prototype.applyUniforms = function (frameState) {
        var gl = this.getGL();
        var value;
        var textureSlot = 0;
        this.uniforms_.forEach(function (uniform) {
            value = typeof uniform.value === 'function' ? uniform.value(frameState) : uniform.value;
            // apply value based on type
            if (value instanceof HTMLCanvasElement || value instanceof HTMLImageElement || value instanceof ImageData) {
                // create a texture & put data
                if (!uniform.texture) {
                    uniform.prevValue = undefined;
                    uniform.texture = gl.createTexture();
                }
                gl.activeTexture(gl["TEXTURE" + textureSlot]);
                gl.bindTexture(gl.TEXTURE_2D, uniform.texture);
                gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
                gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
                gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
                var imageReady = !(value instanceof HTMLImageElement) || /** @type {HTMLImageElement} */ (value).complete;
                if (imageReady && uniform.prevValue !== value) {
                    uniform.prevValue = value;
                    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, value);
                }
                // fill texture slots by increasing index
                gl.uniform1i(this.getUniformLocation(uniform.name), textureSlot++);
            }
            else if (Array.isArray(value) && value.length === 6) {
                this.setUniformMatrixValue(uniform.name, Object(_vec_mat4_js__WEBPACK_IMPORTED_MODULE_5__["fromTransform"])(this.tmpMat4_, value));
            }
            else if (Array.isArray(value) && value.length <= 4) {
                switch (value.length) {
                    case 2:
                        gl.uniform2f(this.getUniformLocation(uniform.name), value[0], value[1]);
                        return;
                    case 3:
                        gl.uniform3f(this.getUniformLocation(uniform.name), value[0], value[1], value[2]);
                        return;
                    case 4:
                        gl.uniform4f(this.getUniformLocation(uniform.name), value[0], value[1], value[2], value[3]);
                        return;
                    default:
                        return;
                }
            }
            else if (typeof value === 'number') {
                gl.uniform1f(this.getUniformLocation(uniform.name), value);
            }
        }.bind(this));
    };
    /**
     * Use a program.  If the program is already in use, this will return `false`.
     * @param {WebGLProgram} program Program.
     * @return {boolean} Changed.
     * @api
     */
    WebGLHelper.prototype.useProgram = function (program) {
        if (program == this.currentProgram_) {
            return false;
        }
        else {
            var gl = this.getGL();
            gl.useProgram(program);
            this.currentProgram_ = program;
            this.uniformLocations_ = {};
            this.attribLocations_ = {};
            return true;
        }
    };
    /**
     * Will attempt to compile a vertex or fragment shader based on source
     * On error, the shader will be returned but
     * `gl.getShaderParameter(shader, gl.COMPILE_STATUS)` will return `true`
     * Use `gl.getShaderInfoLog(shader)` to have details
     * @param {string} source Shader source
     * @param {ShaderType} type VERTEX_SHADER or FRAGMENT_SHADER
     * @return {WebGLShader} Shader object
     */
    WebGLHelper.prototype.compileShader = function (source, type) {
        var gl = this.getGL();
        var shader = gl.createShader(type);
        gl.shaderSource(shader, source);
        gl.compileShader(shader);
        return shader;
    };
    /**
     * Create a program for a vertex and fragment shader. The shaders compilation may have failed:
     * use `WebGLHelper.getShaderCompileErrors()`to have details if any.
     * @param {string} fragmentShaderSource Fragment shader source.
     * @param {string} vertexShaderSource Vertex shader source.
     * @return {WebGLProgram} Program
     * @api
     */
    WebGLHelper.prototype.getProgram = function (fragmentShaderSource, vertexShaderSource) {
        var gl = this.getGL();
        var fragmentShader = this.compileShader(fragmentShaderSource, gl.FRAGMENT_SHADER);
        var vertexShader = this.compileShader(vertexShaderSource, gl.VERTEX_SHADER);
        this.shaderCompileErrors_ = null;
        if (gl.getShaderInfoLog(fragmentShader)) {
            this.shaderCompileErrors_ =
                "Fragment shader compilation failed:\n" + gl.getShaderInfoLog(fragmentShader);
        }
        if (gl.getShaderInfoLog(vertexShader)) {
            this.shaderCompileErrors_ = (this.shaderCompileErrors_ || '') +
                ("Vertex shader compilation failed:\n" + gl.getShaderInfoLog(vertexShader));
        }
        var program = gl.createProgram();
        gl.attachShader(program, fragmentShader);
        gl.attachShader(program, vertexShader);
        gl.linkProgram(program);
        return program;
    };
    /**
     * Will return the last shader compilation errors. If no error happened, will return null;
     * @return {string|null} Errors description, or null if last compilation was successful
     * @api
     */
    WebGLHelper.prototype.getShaderCompileErrors = function () {
        return this.shaderCompileErrors_;
    };
    /**
     * Will get the location from the shader or the cache
     * @param {string} name Uniform name
     * @return {WebGLUniformLocation} uniformLocation
     * @api
     */
    WebGLHelper.prototype.getUniformLocation = function (name) {
        if (this.uniformLocations_[name] === undefined) {
            this.uniformLocations_[name] = this.getGL().getUniformLocation(this.currentProgram_, name);
        }
        return this.uniformLocations_[name];
    };
    /**
     * Will get the location from the shader or the cache
     * @param {string} name Attribute name
     * @return {number} attribLocation
     * @api
     */
    WebGLHelper.prototype.getAttributeLocation = function (name) {
        if (this.attribLocations_[name] === undefined) {
            this.attribLocations_[name] = this.getGL().getAttribLocation(this.currentProgram_, name);
        }
        return this.attribLocations_[name];
    };
    /**
     * Modifies the given transform to apply the rotation/translation/scaling of the given frame state.
     * The resulting transform can be used to convert world space coordinates to view coordinates.
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @param {import("../transform").Transform} transform Transform to update.
     * @return {import("../transform").Transform} The updated transform object.
     * @api
     */
    WebGLHelper.prototype.makeProjectionTransform = function (frameState, transform) {
        var size = frameState.size;
        var rotation = frameState.viewState.rotation;
        var resolution = frameState.viewState.resolution;
        var center = frameState.viewState.center;
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_4__["reset"])(transform);
        Object(_transform_js__WEBPACK_IMPORTED_MODULE_4__["compose"])(transform, 0, 0, 2 / (resolution * size[0]), 2 / (resolution * size[1]), -rotation, -center[0], -center[1]);
        return transform;
    };
    /**
     * Give a value for a standard float uniform
     * @param {string} uniform Uniform name
     * @param {number} value Value
     * @api
     */
    WebGLHelper.prototype.setUniformFloatValue = function (uniform, value) {
        this.getGL().uniform1f(this.getUniformLocation(uniform), value);
    };
    /**
     * Give a value for a standard matrix4 uniform
     * @param {string} uniform Uniform name
     * @param {Array<number>} value Matrix value
     * @api
     */
    WebGLHelper.prototype.setUniformMatrixValue = function (uniform, value) {
        this.getGL().uniformMatrix4fv(this.getUniformLocation(uniform), false, value);
    };
    /**
     * Will set the currently bound buffer to an attribute of the shader program. Used by `#enableAttributes`
     * internally.
     * @param {string} attribName Attribute name
     * @param {number} size Number of components per attributes
     * @param {number} type UNSIGNED_INT, UNSIGNED_BYTE, UNSIGNED_SHORT or FLOAT
     * @param {number} stride Stride in bytes (0 means attribs are packed)
     * @param {number} offset Offset in bytes
     * @private
     */
    WebGLHelper.prototype.enableAttributeArray_ = function (attribName, size, type, stride, offset) {
        var location = this.getAttributeLocation(attribName);
        // the attribute has not been found in the shaders; do not enable it
        if (location < 0) {
            return;
        }
        this.getGL().enableVertexAttribArray(location);
        this.getGL().vertexAttribPointer(location, size, type, false, stride, offset);
    };
    /**
     * Will enable the following attributes to be read from the currently bound buffer,
     * i.e. tell the GPU where to read the different attributes in the buffer. An error in the
     * size/type/order of attributes will most likely break the rendering and throw a WebGL exception.
     * @param {Array<AttributeDescription>} attributes Ordered list of attributes to read from the buffer
     * @api
     */
    WebGLHelper.prototype.enableAttributes = function (attributes) {
        var stride = computeAttributesStride(attributes);
        var offset = 0;
        for (var i = 0; i < attributes.length; i++) {
            var attr = attributes[i];
            this.enableAttributeArray_(attr.name, attr.size, attr.type || _webgl_js__WEBPACK_IMPORTED_MODULE_7__["FLOAT"], stride, offset);
            offset += attr.size * getByteSizeFromType(attr.type);
        }
    };
    /**
     * WebGL context was lost
     * @private
     */
    WebGLHelper.prototype.handleWebGLContextLost = function () {
        Object(_obj_js__WEBPACK_IMPORTED_MODULE_2__["clear"])(this.bufferCache_);
        this.currentProgram_ = null;
    };
    /**
     * WebGL context was restored
     * @private
     */
    WebGLHelper.prototype.handleWebGLContextRestored = function () {
    };
    /**
     * Will create or reuse a given webgl texture and apply the given size. If no image data
     * specified, the texture will be empty, otherwise image data will be used and the `size`
     * parameter will be ignored.
     * Note: wrap parameters are set to clamp to edge, min filter is set to linear.
     * @param {Array<number>} size Expected size of the texture
     * @param {ImageData|HTMLImageElement|HTMLCanvasElement} [opt_data] Image data/object to bind to the texture
     * @param {WebGLTexture} [opt_texture] Existing texture to reuse
     * @return {WebGLTexture} The generated texture
     * @api
     */
    WebGLHelper.prototype.createTexture = function (size, opt_data, opt_texture) {
        var gl = this.getGL();
        var texture = opt_texture || gl.createTexture();
        // set params & size
        var level = 0;
        var internalFormat = gl.RGBA;
        var border = 0;
        var format = gl.RGBA;
        var type = gl.UNSIGNED_BYTE;
        gl.bindTexture(gl.TEXTURE_2D, texture);
        if (opt_data) {
            gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, format, type, opt_data);
        }
        else {
            gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, size[0], size[1], border, format, type, null);
        }
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
        return texture;
    };
    return WebGLHelper;
}(_Disposable_js__WEBPACK_IMPORTED_MODULE_1__["default"]));
/**
 * Compute a stride in bytes based on a list of attributes
 * @param {Array<AttributeDescription>} attributes Ordered list of attributes
 * @returns {number} Stride, ie amount of values for each vertex in the vertex buffer
 * @api
 */
function computeAttributesStride(attributes) {
    var stride = 0;
    for (var i = 0; i < attributes.length; i++) {
        var attr = attributes[i];
        stride += attr.size * getByteSizeFromType(attr.type);
    }
    return stride;
}
/**
 * Computes the size in byte of an attribute type.
 * @param {AttributeType} type Attribute type
 * @returns {number} The size in bytes
 */
function getByteSizeFromType(type) {
    switch (type) {
        case AttributeType.UNSIGNED_BYTE: return Uint8Array.BYTES_PER_ELEMENT;
        case AttributeType.UNSIGNED_SHORT: return Uint16Array.BYTES_PER_ELEMENT;
        case AttributeType.UNSIGNED_INT: return Uint32Array.BYTES_PER_ELEMENT;
        case AttributeType.FLOAT:
        default: return Float32Array.BYTES_PER_ELEMENT;
    }
}
/* harmony default export */ __webpack_exports__["default"] = (WebGLHelper);
//# sourceMappingURL=Helper.js.map

/***/ }),

/***/ "./node_modules/ol/webgl/PostProcessingPass.js":
/*!*****************************************************!*\
  !*** ./node_modules/ol/webgl/PostProcessingPass.js ***!
  \*****************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/**
 * @module ol/webgl/PostProcessingPass
 */
var DEFAULT_VERTEX_SHADER = "\n  precision mediump float;\n  \n  attribute vec2 a_position;\n  varying vec2 v_texCoord;\n  varying vec2 v_screenCoord;\n  \n  uniform vec2 u_screenSize;\n   \n  void main() {\n    v_texCoord = a_position * 0.5 + 0.5;\n    v_screenCoord = v_texCoord * u_screenSize;\n    gl_Position = vec4(a_position, 0.0, 1.0);\n  }\n";
var DEFAULT_FRAGMENT_SHADER = "\n  precision mediump float;\n   \n  uniform sampler2D u_image;\n   \n  varying vec2 v_texCoord;\n   \n  void main() {\n    gl_FragColor = texture2D(u_image, v_texCoord);\n  }\n";
/**
 * @typedef {Object} Options
 * @property {WebGLRenderingContext} webGlContext WebGL context; mandatory.
 * @property {number} [scaleRatio] Scale ratio; if < 1, the post process will render to a texture smaller than
 * the main canvas that will then be sampled up (useful for saving resource on blur steps).
 * @property {string} [vertexShader] Vertex shader source
 * @property {string} [fragmentShader] Fragment shader source
 * @property {Object.<string,import("./Helper").UniformValue>} [uniforms] Uniform definitions for the post process step
 */
/**
 * @typedef {Object} UniformInternalDescription
 * @property {import("./Helper").UniformValue} value Value
 * @property {number} location Location
 * @property {WebGLTexture} [texture] Texture
 * @private
 */
/**
 * @classdesc
 * This class is used to define Post Processing passes with custom shaders and uniforms.
 * This is used internally by {@link module:ol/webgl/Helper~WebGLHelper}.
 *
 * Please note that the final output on the DOM canvas is expected to have premultiplied alpha, which means that
 * a pixel which is 100% red with an opacity of 50% must have a color of (r=0.5, g=0, b=0, a=0.5).
 * Failing to provide pixel colors with premultiplied alpha will result in render anomalies.
 *
 * The default post-processing pass does *not* multiply color values with alpha value, it expects color values to be
 * premultiplied.
 *
 * Default shaders are shown hereafter:
 *
 * * Vertex shader:
 *
 *   ```
 *   precision mediump float;
 *
 *   attribute vec2 a_position;
 *   varying vec2 v_texCoord;
 *   varying vec2 v_screenCoord;
 *
 *   uniform vec2 u_screenSize;
 *
 *   void main() {
 *     v_texCoord = a_position * 0.5 + 0.5;
 *     v_screenCoord = v_texCoord * u_screenSize;
 *     gl_Position = vec4(a_position, 0.0, 1.0);
 *   }
 *   ```
 *
 * * Fragment shader:
 *
 *   ```
 *   precision mediump float;
 *
 *   uniform sampler2D u_image;
 *
 *   varying vec2 v_texCoord;
 *
 *   void main() {
 *     gl_FragColor = texture2D(u_image, v_texCoord);
 *   }
 *   ```
 *
 * @api
 */
var WebGLPostProcessingPass = /** @class */ (function () {
    /**
     * @param {Options} options Options.
     */
    function WebGLPostProcessingPass(options) {
        this.gl_ = options.webGlContext;
        var gl = this.gl_;
        this.scaleRatio_ = options.scaleRatio || 1;
        this.renderTargetTexture_ = gl.createTexture();
        this.renderTargetTextureSize_ = null;
        this.frameBuffer_ = gl.createFramebuffer();
        // compile the program for the frame buffer
        // TODO: make compilation errors show up
        var vertexShader = gl.createShader(gl.VERTEX_SHADER);
        gl.shaderSource(vertexShader, options.vertexShader || DEFAULT_VERTEX_SHADER);
        gl.compileShader(vertexShader);
        var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
        gl.shaderSource(fragmentShader, options.fragmentShader || DEFAULT_FRAGMENT_SHADER);
        gl.compileShader(fragmentShader);
        this.renderTargetProgram_ = gl.createProgram();
        gl.attachShader(this.renderTargetProgram_, vertexShader);
        gl.attachShader(this.renderTargetProgram_, fragmentShader);
        gl.linkProgram(this.renderTargetProgram_);
        // bind the vertices buffer for the frame buffer
        this.renderTargetVerticesBuffer_ = gl.createBuffer();
        var verticesArray = [
            -1, -1,
            1, -1,
            -1, 1,
            1, -1,
            1, 1,
            -1, 1
        ];
        gl.bindBuffer(gl.ARRAY_BUFFER, this.renderTargetVerticesBuffer_);
        gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(verticesArray), gl.STATIC_DRAW);
        this.renderTargetAttribLocation_ = gl.getAttribLocation(this.renderTargetProgram_, 'a_position');
        this.renderTargetUniformLocation_ = gl.getUniformLocation(this.renderTargetProgram_, 'u_screenSize');
        this.renderTargetTextureLocation_ = gl.getUniformLocation(this.renderTargetProgram_, 'u_image');
        /**
         * Holds info about custom uniforms used in the post processing pass
         * @type {Array<UniformInternalDescription>}
         * @private
         */
        this.uniforms_ = [];
        options.uniforms && Object.keys(options.uniforms).forEach(function (name) {
            this.uniforms_.push({
                value: options.uniforms[name],
                location: gl.getUniformLocation(this.renderTargetProgram_, name)
            });
        }.bind(this));
    }
    /**
     * Get the WebGL rendering context
     * @return {WebGLRenderingContext} The rendering context.
     * @api
     */
    WebGLPostProcessingPass.prototype.getGL = function () {
        return this.gl_;
    };
    /**
     * Initialize the render target texture of the post process, make sure it is at the
     * right size and bind it as a render target for the next draw calls.
     * The last step to be initialized will be the one where the primitives are rendered.
     * @param {import("../PluggableMap.js").FrameState} frameState current frame state
     * @api
     */
    WebGLPostProcessingPass.prototype.init = function (frameState) {
        var gl = this.getGL();
        var textureSize = [
            gl.drawingBufferWidth * this.scaleRatio_,
            gl.drawingBufferHeight * this.scaleRatio_
        ];
        // rendering goes to my buffer
        gl.bindFramebuffer(gl.FRAMEBUFFER, this.getFrameBuffer());
        gl.viewport(0, 0, textureSize[0], textureSize[1]);
        // if size has changed: adjust canvas & render target texture
        if (!this.renderTargetTextureSize_ ||
            this.renderTargetTextureSize_[0] !== textureSize[0] || this.renderTargetTextureSize_[1] !== textureSize[1]) {
            this.renderTargetTextureSize_ = textureSize;
            // create a new texture
            var level = 0;
            var internalFormat = gl.RGBA;
            var border = 0;
            var format = gl.RGBA;
            var type = gl.UNSIGNED_BYTE;
            var data = null;
            gl.bindTexture(gl.TEXTURE_2D, this.renderTargetTexture_);
            gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, textureSize[0], textureSize[1], border, format, type, data);
            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
            // bind the texture to the framebuffer
            gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.renderTargetTexture_, 0);
        }
    };
    /**
     * Render to the next postprocessing pass (or to the canvas if final pass).
     * @param {import("../PluggableMap.js").FrameState} frameState current frame state
     * @param {WebGLPostProcessingPass} [nextPass] Next pass, optional
     * @api
     */
    WebGLPostProcessingPass.prototype.apply = function (frameState, nextPass) {
        var gl = this.getGL();
        var size = frameState.size;
        gl.bindFramebuffer(gl.FRAMEBUFFER, nextPass ? nextPass.getFrameBuffer() : null);
        gl.activeTexture(gl.TEXTURE0);
        gl.bindTexture(gl.TEXTURE_2D, this.renderTargetTexture_);
        // render the frame buffer to the canvas
        gl.clearColor(0.0, 0.0, 0.0, 0.0);
        gl.clear(gl.COLOR_BUFFER_BIT);
        gl.enable(gl.BLEND);
        gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
        gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
        gl.bindBuffer(gl.ARRAY_BUFFER, this.renderTargetVerticesBuffer_);
        gl.useProgram(this.renderTargetProgram_);
        gl.enableVertexAttribArray(this.renderTargetAttribLocation_);
        gl.vertexAttribPointer(this.renderTargetAttribLocation_, 2, gl.FLOAT, false, 0, 0);
        gl.uniform2f(this.renderTargetUniformLocation_, size[0], size[1]);
        gl.uniform1i(this.renderTargetTextureLocation_, 0);
        this.applyUniforms(frameState);
        gl.drawArrays(gl.TRIANGLES, 0, 6);
    };
    /**
     * @returns {WebGLFramebuffer} Frame buffer
     * @api
     */
    WebGLPostProcessingPass.prototype.getFrameBuffer = function () {
        return this.frameBuffer_;
    };
    /**
     * Sets the custom uniforms based on what was given in the constructor.
     * @param {import("../PluggableMap.js").FrameState} frameState Frame state.
     * @private
     */
    WebGLPostProcessingPass.prototype.applyUniforms = function (frameState) {
        var gl = this.getGL();
        var value;
        var textureSlot = 1;
        this.uniforms_.forEach(function (uniform) {
            value = typeof uniform.value === 'function' ? uniform.value(frameState) : uniform.value;
            // apply value based on type
            if (value instanceof HTMLCanvasElement || value instanceof ImageData) {
                // create a texture & put data
                if (!uniform.texture) {
                    uniform.texture = gl.createTexture();
                }
                gl.activeTexture(gl["TEXTURE" + textureSlot]);
                gl.bindTexture(gl.TEXTURE_2D, uniform.texture);
                gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
                gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
                gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
                if (value instanceof ImageData) {
                    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, value.width, value.height, 0, gl.UNSIGNED_BYTE, new Uint8Array(value.data));
                }
                else {
                    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, value);
                }
                // fill texture slots
                gl.uniform1i(uniform.location, textureSlot++);
            }
            else if (Array.isArray(value)) {
                switch (value.length) {
                    case 2:
                        gl.uniform2f(uniform.location, value[0], value[1]);
                        return;
                    case 3:
                        gl.uniform3f(uniform.location, value[0], value[1], value[2]);
                        return;
                    case 4:
                        gl.uniform4f(uniform.location, value[0], value[1], value[2], value[3]);
                        return;
                    default: return;
                }
            }
            else if (typeof value === 'number') {
                gl.uniform1f(uniform.location, value);
            }
        });
    };
    return WebGLPostProcessingPass;
}());
/* harmony default export */ __webpack_exports__["default"] = (WebGLPostProcessingPass);
//# sourceMappingURL=PostProcessingPass.js.map

/***/ }),

/***/ "./node_modules/ol/webgl/RenderTarget.js":
/*!***********************************************!*\
  !*** ./node_modules/ol/webgl/RenderTarget.js ***!
  \***********************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../array.js */ "./node_modules/ol/array.js");
/**
 * A wrapper class to simplify rendering to a texture instead of the final canvas
 * @module ol/webgl/RenderTarget
 */

// for pixel color reading
var tmpArray4 = new Uint8Array(4);
/**
 * @classdesc
 * This class is a wrapper around the association of both a `WebGLTexture` and a `WebGLFramebuffer` instances,
 * simplifying initialization and binding for rendering.
 * @api
 */
var WebGLRenderTarget = /** @class */ (function () {
    /**
     * @param {import("./Helper.js").default} helper WebGL helper; mandatory.
     * @param {Array<number>} [opt_size] Expected size of the render target texture; note: this can be changed later on.
     */
    function WebGLRenderTarget(helper, opt_size) {
        /**
         * @private
         * @type {import("./Helper.js").default}
         */
        this.helper_ = helper;
        var gl = helper.getGL();
        /**
         * @private
         * @type {WebGLTexture}
         */
        this.texture_ = gl.createTexture();
        /**
         * @private
         * @type {WebGLFramebuffer}
         */
        this.framebuffer_ = gl.createFramebuffer();
        /**
         * @type {Array<number>}
         * @private
         */
        this.size_ = opt_size || [1, 1];
        /**
         * @type {Uint8Array}
         * @private
         */
        this.data_ = new Uint8Array(0);
        /**
         * @type {boolean}
         * @private
         */
        this.dataCacheDirty_ = true;
        this.updateSize_();
    }
    /**
     * Changes the size of the render target texture. Note: will do nothing if the size
     * is already the same.
     * @param {Array<number>} size Expected size of the render target texture
     * @api
     */
    WebGLRenderTarget.prototype.setSize = function (size) {
        if (Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["equals"])(size, this.size_)) {
            return;
        }
        this.size_[0] = size[0];
        this.size_[1] = size[1];
        this.updateSize_();
    };
    /**
     * Returns the size of the render target texture
     * @return {Array<number>} Size of the render target texture
     * @api
     */
    WebGLRenderTarget.prototype.getSize = function () {
        return this.size_;
    };
    /**
     * This will cause following calls to `#readAll` or `#readPixel` to download the content of the
     * render target into memory, which is an expensive operation.
     * This content will be kept in cache but should be cleared after each new render.
     * @api
     */
    WebGLRenderTarget.prototype.clearCachedData = function () {
        this.dataCacheDirty_ = true;
    };
    /**
     * Returns the full content of the frame buffer as a series of r, g, b, a components
     * in the 0-255 range (unsigned byte).
     * @return {Uint8Array} Integer array of color values
     * @api
     */
    WebGLRenderTarget.prototype.readAll = function () {
        if (this.dataCacheDirty_) {
            var size = this.size_;
            var gl = this.helper_.getGL();
            gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer_);
            gl.readPixels(0, 0, size[0], size[1], gl.RGBA, gl.UNSIGNED_BYTE, this.data_);
            this.dataCacheDirty_ = false;
        }
        return this.data_;
    };
    /**
     * Reads one pixel of the frame buffer as an array of r, g, b, a components
     * in the 0-255 range (unsigned byte).
     * If x and/or y are outside of existing data, an array filled with 0 is returned.
     * @param {number} x Pixel coordinate
     * @param {number} y Pixel coordinate
     * @returns {Uint8Array} Integer array with one color value (4 components)
     * @api
     */
    WebGLRenderTarget.prototype.readPixel = function (x, y) {
        if (x < 0 || y < 0 || x > this.size_[0] || y >= this.size_[1]) {
            tmpArray4[0] = 0;
            tmpArray4[1] = 0;
            tmpArray4[2] = 0;
            tmpArray4[3] = 0;
            return tmpArray4;
        }
        this.readAll();
        var index = Math.floor(x) + (this.size_[1] - Math.floor(y) - 1) * this.size_[0];
        tmpArray4[0] = this.data_[index * 4];
        tmpArray4[1] = this.data_[index * 4 + 1];
        tmpArray4[2] = this.data_[index * 4 + 2];
        tmpArray4[3] = this.data_[index * 4 + 3];
        return tmpArray4;
    };
    /**
     * @return {WebGLTexture} Texture to render to
     */
    WebGLRenderTarget.prototype.getTexture = function () {
        return this.texture_;
    };
    /**
     * @return {WebGLFramebuffer} Frame buffer of the render target
     */
    WebGLRenderTarget.prototype.getFramebuffer = function () {
        return this.framebuffer_;
    };
    /**
     * @private
     */
    WebGLRenderTarget.prototype.updateSize_ = function () {
        var size = this.size_;
        var gl = this.helper_.getGL();
        this.texture_ = this.helper_.createTexture(size, null, this.texture_);
        gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer_);
        gl.viewport(0, 0, size[0], size[1]);
        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.texture_, 0);
        this.data_ = new Uint8Array(size[0] * size[1] * 4);
    };
    return WebGLRenderTarget;
}());
/* harmony default export */ __webpack_exports__["default"] = (WebGLRenderTarget);
//# sourceMappingURL=RenderTarget.js.map

/***/ }),

/***/ "./node_modules/ol/worker/webgl.js":
/*!*****************************************!*\
  !*** ./node_modules/ol/worker/webgl.js ***!
  \*****************************************/
/*! exports provided: create */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; });
var source = "var e=\"function\"==typeof Object.assign?Object.assign:function(e,n){if(null==e)throw new TypeError(\"Cannot convert undefined or null to object\");for(var t=Object(e),r=1,o=arguments.length;r<o;++r){var i=arguments[r];if(null!=i)for(var f in i)i.hasOwnProperty(f)&&(t[f]=i[f])}return t},n=\"GENERATE_BUFFERS\",t=[],r={vertexPosition:0,indexPosition:0};function o(e,n,t,r,o){e[n+0]=t,e[n+1]=r,e[n+2]=o}function i(e,n,i,f,s,u){var a=3+s,l=e[n+0],v=e[n+1],c=t;c.length=s;for(var g=0;g<c.length;g++)c[g]=e[n+2+g];var b=u?u.vertexPosition:0,h=u?u.indexPosition:0,d=b/a;return o(i,b,l,v,0),c.length&&i.set(c,b+3),o(i,b+=a,l,v,1),c.length&&i.set(c,b+3),o(i,b+=a,l,v,2),c.length&&i.set(c,b+3),o(i,b+=a,l,v,3),c.length&&i.set(c,b+3),b+=a,f[h++]=d,f[h++]=d+1,f[h++]=d+3,f[h++]=d+1,f[h++]=d+2,f[h++]=d+3,r.vertexPosition=b,r.indexPosition=h,r}var f=self;f.onmessage=function(t){var r=t.data;if(r.type===n){for(var o=r.customAttributesCount,s=2+o,u=new Float32Array(r.renderInstructions),a=u.length/s,l=4*a*(o+3),v=new Uint32Array(6*a),c=new Float32Array(l),g=null,b=0;b<u.length;b+=s)g=i(u,b,c,v,o,g);var h=e({vertexBuffer:c.buffer,indexBuffer:v.buffer,renderInstructions:u.buffer},r);f.postMessage(h,[c.buffer,v.buffer,u.buffer])}};";
var blob = new Blob([source], { type: 'application/javascript' });
var url = URL.createObjectURL(blob);
function create() {
    return new Worker(url);
}
//# sourceMappingURL=webgl.js.map

/***/ }),

/***/ "./node_modules/ol/xml.js":
/*!********************************!*\
  !*** ./node_modules/ol/xml.js ***!
  \********************************/
/*! exports provided: XML_SCHEMA_INSTANCE_URI, createElementNS, getAllTextContent, getAllTextContent_, isDocument, getAttributeNS, parse, makeArrayExtender, makeArrayPusher, makeReplacer, makeObjectPropertyPusher, makeObjectPropertySetter, makeChildAppender, makeArraySerializer, makeSimpleNodeFactory, OBJECT_PROPERTY_NODE_FACTORY, makeSequence, makeStructureNS, parseNode, pushParseAndPop, serialize, pushSerializeAndPop, registerXMLSerializer, getXMLSerializer, registerDocument, getDocument */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "XML_SCHEMA_INSTANCE_URI", function() { return XML_SCHEMA_INSTANCE_URI; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createElementNS", function() { return createElementNS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAllTextContent", function() { return getAllTextContent; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAllTextContent_", function() { return getAllTextContent_; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDocument", function() { return isDocument; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAttributeNS", function() { return getAttributeNS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeArrayExtender", function() { return makeArrayExtender; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeArrayPusher", function() { return makeArrayPusher; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeReplacer", function() { return makeReplacer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeObjectPropertyPusher", function() { return makeObjectPropertyPusher; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeObjectPropertySetter", function() { return makeObjectPropertySetter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeChildAppender", function() { return makeChildAppender; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeArraySerializer", function() { return makeArraySerializer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSimpleNodeFactory", function() { return makeSimpleNodeFactory; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OBJECT_PROPERTY_NODE_FACTORY", function() { return OBJECT_PROPERTY_NODE_FACTORY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSequence", function() { return makeSequence; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeStructureNS", function() { return makeStructureNS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseNode", function() { return parseNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pushParseAndPop", function() { return pushParseAndPop; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serialize", function() { return serialize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pushSerializeAndPop", function() { return pushSerializeAndPop; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerXMLSerializer", function() { return registerXMLSerializer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getXMLSerializer", function() { return getXMLSerializer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerDocument", function() { return registerDocument; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDocument", function() { return getDocument; });
/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./array.js */ "./node_modules/ol/array.js");
/**
 * @module ol/xml
 */

/**
 * When using {@link module:ol/xml~makeChildAppender} or
 * {@link module:ol/xml~makeSimpleNodeFactory}, the top `objectStack` item needs
 * to have this structure.
 * @typedef {Object} NodeStackItem
 * @property {Node} node
 */
/**
 * @typedef {function(Element, Array<*>): void} Parser
 */
/**
 * @typedef {function(Element, *, Array<*>): void} Serializer
 */
/**
 * @type {string}
 */
var XML_SCHEMA_INSTANCE_URI = 'http://www.w3.org/2001/XMLSchema-instance';
/**
 * @param {string} namespaceURI Namespace URI.
 * @param {string} qualifiedName Qualified name.
 * @return {Element} Node.
 */
function createElementNS(namespaceURI, qualifiedName) {
    return getDocument().createElementNS(namespaceURI, qualifiedName);
}
/**
 * Recursively grab all text content of child nodes into a single string.
 * @param {Node} node Node.
 * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line
 * breaks.
 * @return {string} All text content.
 * @api
 */
function getAllTextContent(node, normalizeWhitespace) {
    return getAllTextContent_(node, normalizeWhitespace, []).join('');
}
/**
 * Recursively grab all text content of child nodes into a single string.
 * @param {Node} node Node.
 * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line
 * breaks.
 * @param {Array<string>} accumulator Accumulator.
 * @private
 * @return {Array<string>} Accumulator.
 */
function getAllTextContent_(node, normalizeWhitespace, accumulator) {
    if (node.nodeType == Node.CDATA_SECTION_NODE ||
        node.nodeType == Node.TEXT_NODE) {
        if (normalizeWhitespace) {
            accumulator.push(String(node.nodeValue).replace(/(\r\n|\r|\n)/g, ''));
        }
        else {
            accumulator.push(node.nodeValue);
        }
    }
    else {
        var n = void 0;
        for (n = node.firstChild; n; n = n.nextSibling) {
            getAllTextContent_(n, normalizeWhitespace, accumulator);
        }
    }
    return accumulator;
}
/**
 * @param {Object} object Object.
 * @return {boolean} Is a document.
 */
function isDocument(object) {
    return 'documentElement' in object;
}
/**
 * @param {Element} node Node.
 * @param {?string} namespaceURI Namespace URI.
 * @param {string} name Attribute name.
 * @return {string} Value
 */
function getAttributeNS(node, namespaceURI, name) {
    return node.getAttributeNS(namespaceURI, name) || '';
}
/**
 * Parse an XML string to an XML Document.
 * @param {string} xml XML.
 * @return {Document} Document.
 * @api
 */
function parse(xml) {
    return new DOMParser().parseFromString(xml, 'application/xml');
}
/**
 * Make an array extender function for extending the array at the top of the
 * object stack.
 * @param {function(this: T, Node, Array<*>): (Array<*>|undefined)} valueReader Value reader.
 * @param {T=} opt_this The object to use as `this` in `valueReader`.
 * @return {Parser} Parser.
 * @template T
 */
function makeArrayExtender(valueReader, opt_this) {
    return (
    /**
     * @param {Node} node Node.
     * @param {Array<*>} objectStack Object stack.
     */
    function (node, objectStack) {
        var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
        if (value !== undefined) {
            var array = /** @type {Array<*>} */ (objectStack[objectStack.length - 1]);
            Object(_array_js__WEBPACK_IMPORTED_MODULE_0__["extend"])(array, value);
        }
    });
}
/**
 * Make an array pusher function for pushing to the array at the top of the
 * object stack.
 * @param {function(this: T, Element, Array<*>): *} valueReader Value reader.
 * @param {T=} opt_this The object to use as `this` in `valueReader`.
 * @return {Parser} Parser.
 * @template T
 */
function makeArrayPusher(valueReader, opt_this) {
    return (
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     */
    function (node, objectStack) {
        var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
        if (value !== undefined) {
            var array = /** @type {Array<*>} */ (objectStack[objectStack.length - 1]);
            array.push(value);
        }
    });
}
/**
 * Make an object stack replacer function for replacing the object at the
 * top of the stack.
 * @param {function(this: T, Node, Array<*>): *} valueReader Value reader.
 * @param {T=} opt_this The object to use as `this` in `valueReader`.
 * @return {Parser} Parser.
 * @template T
 */
function makeReplacer(valueReader, opt_this) {
    return (
    /**
     * @param {Node} node Node.
     * @param {Array<*>} objectStack Object stack.
     */
    function (node, objectStack) {
        var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
        if (value !== undefined) {
            objectStack[objectStack.length - 1] = value;
        }
    });
}
/**
 * Make an object property pusher function for adding a property to the
 * object at the top of the stack.
 * @param {function(this: T, Element, Array<*>): *} valueReader Value reader.
 * @param {string=} opt_property Property.
 * @param {T=} opt_this The object to use as `this` in `valueReader`.
 * @return {Parser} Parser.
 * @template T
 */
function makeObjectPropertyPusher(valueReader, opt_property, opt_this) {
    return (
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     */
    function (node, objectStack) {
        var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
        if (value !== undefined) {
            var object = /** @type {!Object} */ (objectStack[objectStack.length - 1]);
            var property = opt_property !== undefined ? opt_property : node.localName;
            var array = void 0;
            if (property in object) {
                array = object[property];
            }
            else {
                array = [];
                object[property] = array;
            }
            array.push(value);
        }
    });
}
/**
 * Make an object property setter function.
 * @param {function(this: T, Element, Array<*>): *} valueReader Value reader.
 * @param {string=} opt_property Property.
 * @param {T=} opt_this The object to use as `this` in `valueReader`.
 * @return {Parser} Parser.
 * @template T
 */
function makeObjectPropertySetter(valueReader, opt_property, opt_this) {
    return (
    /**
     * @param {Element} node Node.
     * @param {Array<*>} objectStack Object stack.
     */
    function (node, objectStack) {
        var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack);
        if (value !== undefined) {
            var object = /** @type {!Object} */ (objectStack[objectStack.length - 1]);
            var property = opt_property !== undefined ? opt_property : node.localName;
            object[property] = value;
        }
    });
}
/**
 * Create a serializer that appends nodes written by its `nodeWriter` to its
 * designated parent. The parent is the `node` of the
 * {@link module:ol/xml~NodeStackItem} at the top of the `objectStack`.
 * @param {function(this: T, Node, V, Array<*>): void} nodeWriter Node writer.
 * @param {T=} opt_this The object to use as `this` in `nodeWriter`.
 * @return {Serializer} Serializer.
 * @template T, V
 */
function makeChildAppender(nodeWriter, opt_this) {
    return function (node, value, objectStack) {
        nodeWriter.call(opt_this !== undefined ? opt_this : this, node, value, objectStack);
        var parent = /** @type {NodeStackItem} */ (objectStack[objectStack.length - 1]);
        var parentNode = parent.node;
        parentNode.appendChild(node);
    };
}
/**
 * Create a serializer that calls the provided `nodeWriter` from
 * {@link module:ol/xml~serialize}. This can be used by the parent writer to have the
 * 'nodeWriter' called with an array of values when the `nodeWriter` was
 * designed to serialize a single item. An example would be a LineString
 * geometry writer, which could be reused for writing MultiLineString
 * geometries.
 * @param {function(this: T, Element, V, Array<*>): void} nodeWriter Node writer.
 * @param {T=} opt_this The object to use as `this` in `nodeWriter`.
 * @return {Serializer} Serializer.
 * @template T, V
 */
function makeArraySerializer(nodeWriter, opt_this) {
    var serializersNS, nodeFactory;
    return function (node, value, objectStack) {
        if (serializersNS === undefined) {
            serializersNS = {};
            var serializers = {};
            serializers[node.localName] = nodeWriter;
            serializersNS[node.namespaceURI] = serializers;
            nodeFactory = makeSimpleNodeFactory(node.localName);
        }
        serialize(serializersNS, nodeFactory, value, objectStack);
    };
}
/**
 * Create a node factory which can use the `opt_keys` passed to
 * {@link module:ol/xml~serialize} or {@link module:ol/xml~pushSerializeAndPop} as node names,
 * or a fixed node name. The namespace of the created nodes can either be fixed,
 * or the parent namespace will be used.
 * @param {string=} opt_nodeName Fixed node name which will be used for all
 *     created nodes. If not provided, the 3rd argument to the resulting node
 *     factory needs to be provided and will be the nodeName.
 * @param {string=} opt_namespaceURI Fixed namespace URI which will be used for
 *     all created nodes. If not provided, the namespace of the parent node will
 *     be used.
 * @return {function(*, Array<*>, string=): (Node|undefined)} Node factory.
 */
function makeSimpleNodeFactory(opt_nodeName, opt_namespaceURI) {
    var fixedNodeName = opt_nodeName;
    return (
    /**
     * @param {*} value Value.
     * @param {Array<*>} objectStack Object stack.
     * @param {string=} opt_nodeName Node name.
     * @return {Node} Node.
     */
    function (value, objectStack, opt_nodeName) {
        var context = /** @type {NodeStackItem} */ (objectStack[objectStack.length - 1]);
        var node = context.node;
        var nodeName = fixedNodeName;
        if (nodeName === undefined) {
            nodeName = opt_nodeName;
        }
        var namespaceURI = opt_namespaceURI !== undefined ? opt_namespaceURI : node.namespaceURI;
        return createElementNS(namespaceURI, /** @type {string} */ (nodeName));
    });
}
/**
 * A node factory that creates a node using the parent's `namespaceURI` and the
 * `nodeName` passed by {@link module:ol/xml~serialize} or
 * {@link module:ol/xml~pushSerializeAndPop} to the node factory.
 * @const
 * @type {function(*, Array<*>, string=): (Node|undefined)}
 */
var OBJECT_PROPERTY_NODE_FACTORY = makeSimpleNodeFactory();
/**
 * Create an array of `values` to be used with {@link module:ol/xml~serialize} or
 * {@link module:ol/xml~pushSerializeAndPop}, where `orderedKeys` has to be provided as
 * `opt_key` argument.
 * @param {Object<string, *>} object Key-value pairs for the sequence. Keys can
 *     be a subset of the `orderedKeys`.
 * @param {Array<string>} orderedKeys Keys in the order of the sequence.
 * @return {Array<*>} Values in the order of the sequence. The resulting array
 *     has the same length as the `orderedKeys` array. Values that are not
 *     present in `object` will be `undefined` in the resulting array.
 */
function makeSequence(object, orderedKeys) {
    var length = orderedKeys.length;
    var sequence = new Array(length);
    for (var i = 0; i < length; ++i) {
        sequence[i] = object[orderedKeys[i]];
    }
    return sequence;
}
/**
 * Create a namespaced structure, using the same values for each namespace.
 * This can be used as a starting point for versioned parsers, when only a few
 * values are version specific.
 * @param {Array<string>} namespaceURIs Namespace URIs.
 * @param {T} structure Structure.
 * @param {Object<string, T>=} opt_structureNS Namespaced structure to add to.
 * @return {Object<string, T>} Namespaced structure.
 * @template T
 */
function makeStructureNS(namespaceURIs, structure, opt_structureNS) {
    /**
     * @type {Object<string, T>}
     */
    var structureNS = opt_structureNS !== undefined ? opt_structureNS : {};
    var i, ii;
    for (i = 0, ii = namespaceURIs.length; i < ii; ++i) {
        structureNS[namespaceURIs[i]] = structure;
    }
    return structureNS;
}
/**
 * Parse a node using the parsers and object stack.
 * @param {Object<string, Object<string, Parser>>} parsersNS
 *     Parsers by namespace.
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @param {*=} opt_this The object to use as `this`.
 */
function parseNode(parsersNS, node, objectStack, opt_this) {
    var n;
    for (n = node.firstElementChild; n; n = n.nextElementSibling) {
        var parsers = parsersNS[n.namespaceURI];
        if (parsers !== undefined) {
            var parser = parsers[n.localName];
            if (parser !== undefined) {
                parser.call(opt_this, n, objectStack);
            }
        }
    }
}
/**
 * Push an object on top of the stack, parse and return the popped object.
 * @param {T} object Object.
 * @param {Object<string, Object<string, Parser>>} parsersNS
 *     Parsers by namespace.
 * @param {Element} node Node.
 * @param {Array<*>} objectStack Object stack.
 * @param {*=} opt_this The object to use as `this`.
 * @return {T} Object.
 * @template T
 */
function pushParseAndPop(object, parsersNS, node, objectStack, opt_this) {
    objectStack.push(object);
    parseNode(parsersNS, node, objectStack, opt_this);
    return /** @type {T} */ (objectStack.pop());
}
/**
 * Walk through an array of `values` and call a serializer for each value.
 * @param {Object<string, Object<string, Serializer>>} serializersNS
 *     Namespaced serializers.
 * @param {function(this: T, *, Array<*>, (string|undefined)): (Node|undefined)} nodeFactory
 *     Node factory. The `nodeFactory` creates the node whose namespace and name
 *     will be used to choose a node writer from `serializersNS`. This
 *     separation allows us to decide what kind of node to create, depending on
 *     the value we want to serialize. An example for this would be different
 *     geometry writers based on the geometry type.
 * @param {Array<*>} values Values to serialize. An example would be an array
 *     of {@link module:ol/Feature~Feature} instances.
 * @param {Array<*>} objectStack Node stack.
 * @param {Array<string>=} opt_keys Keys of the `values`. Will be passed to the
 *     `nodeFactory`. This is used for serializing object literals where the
 *     node name relates to the property key. The array length of `opt_keys` has
 *     to match the length of `values`. For serializing a sequence, `opt_keys`
 *     determines the order of the sequence.
 * @param {T=} opt_this The object to use as `this` for the node factory and
 *     serializers.
 * @template T
 */
function serialize(serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) {
    var length = (opt_keys !== undefined ? opt_keys : values).length;
    var value, node;
    for (var i = 0; i < length; ++i) {
        value = values[i];
        if (value !== undefined) {
            node = nodeFactory.call(opt_this !== undefined ? opt_this : this, value, objectStack, opt_keys !== undefined ? opt_keys[i] : undefined);
            if (node !== undefined) {
                serializersNS[node.namespaceURI][node.localName]
                    .call(opt_this, node, value, objectStack);
            }
        }
    }
}
/**
 * @param {O} object Object.
 * @param {Object<string, Object<string, Serializer>>} serializersNS
 *     Namespaced serializers.
 * @param {function(this: T, *, Array<*>, (string|undefined)): (Node|undefined)} nodeFactory
 *     Node factory. The `nodeFactory` creates the node whose namespace and name
 *     will be used to choose a node writer from `serializersNS`. This
 *     separation allows us to decide what kind of node to create, depending on
 *     the value we want to serialize. An example for this would be different
 *     geometry writers based on the geometry type.
 * @param {Array<*>} values Values to serialize. An example would be an array
 *     of {@link module:ol/Feature~Feature} instances.
 * @param {Array<*>} objectStack Node stack.
 * @param {Array<string>=} opt_keys Keys of the `values`. Will be passed to the
 *     `nodeFactory`. This is used for serializing object literals where the
 *     node name relates to the property key. The array length of `opt_keys` has
 *     to match the length of `values`. For serializing a sequence, `opt_keys`
 *     determines the order of the sequence.
 * @param {T=} opt_this The object to use as `this` for the node factory and
 *     serializers.
 * @return {O|undefined} Object.
 * @template O, T
 */
function pushSerializeAndPop(object, serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) {
    objectStack.push(object);
    serialize(serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this);
    return /** @type {O|undefined} */ (objectStack.pop());
}
var xmlSerializer_ = undefined;
/**
 * Register a XMLSerializer. Can be used  to inject a XMLSerializer
 * where there is no globally available implementation.
 *
 * @param {XMLSerializer} xmlSerializer A XMLSerializer.
 * @api
 */
function registerXMLSerializer(xmlSerializer) {
    xmlSerializer_ = xmlSerializer;
}
/**
 * @return {XMLSerializer} The XMLSerializer.
 */
function getXMLSerializer() {
    if (xmlSerializer_ === undefined && typeof XMLSerializer !== 'undefined') {
        xmlSerializer_ = new XMLSerializer();
    }
    return xmlSerializer_;
}
var document_ = undefined;
/**
 * Register a Document to use when creating nodes for XML serializations. Can be used
 * to inject a Document where there is no globally available implementation.
 *
 * @param {Document} document A Document.
 * @api
 */
function registerDocument(document) {
    document_ = document;
}
/**
 * Get a document that should be used when creating nodes for XML serializations.
 * @return {Document} The document.
 */
function getDocument() {
    if (document_ === undefined && typeof document !== 'undefined') {
        document_ = document.implementation.createDocument('', '', null);
    }
    return document_;
}
//# sourceMappingURL=xml.js.map

/***/ }),

/***/ "./node_modules/pbf/index.js":
/*!***********************************!*\
  !*** ./node_modules/pbf/index.js ***!
  \***********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = Pbf;

var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js");

function Pbf(buf) {
    this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
    this.pos = 0;
    this.type = 0;
    this.length = this.buf.length;
}

Pbf.Varint  = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum
Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64
Pbf.Bytes   = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields
Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32

var SHIFT_LEFT_32 = (1 << 16) * (1 << 16),
    SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;

// Threshold chosen based on both benchmarking and knowledge about browser string
// data structures (which currently switch structure types at 12 bytes or more)
var TEXT_DECODER_MIN_LENGTH = 12;
var utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');

Pbf.prototype = {

    destroy: function() {
        this.buf = null;
    },

    // === READING =================================================================

    readFields: function(readField, result, end) {
        end = end || this.length;

        while (this.pos < end) {
            var val = this.readVarint(),
                tag = val >> 3,
                startPos = this.pos;

            this.type = val & 0x7;
            readField(tag, result, this);

            if (this.pos === startPos) this.skip(val);
        }
        return result;
    },

    readMessage: function(readField, result) {
        return this.readFields(readField, result, this.readVarint() + this.pos);
    },

    readFixed32: function() {
        var val = readUInt32(this.buf, this.pos);
        this.pos += 4;
        return val;
    },

    readSFixed32: function() {
        var val = readInt32(this.buf, this.pos);
        this.pos += 4;
        return val;
    },

    // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)

    readFixed64: function() {
        var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
        this.pos += 8;
        return val;
    },

    readSFixed64: function() {
        var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
        this.pos += 8;
        return val;
    },

    readFloat: function() {
        var val = ieee754.read(this.buf, this.pos, true, 23, 4);
        this.pos += 4;
        return val;
    },

    readDouble: function() {
        var val = ieee754.read(this.buf, this.pos, true, 52, 8);
        this.pos += 8;
        return val;
    },

    readVarint: function(isSigned) {
        var buf = this.buf,
            val, b;

        b = buf[this.pos++]; val  =  b & 0x7f;        if (b < 0x80) return val;
        b = buf[this.pos++]; val |= (b & 0x7f) << 7;  if (b < 0x80) return val;
        b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;
        b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;
        b = buf[this.pos];   val |= (b & 0x0f) << 28;

        return readVarintRemainder(val, isSigned, this);
    },

    readVarint64: function() { // for compatibility with v2.0.1
        return this.readVarint(true);
    },

    readSVarint: function() {
        var num = this.readVarint();
        return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding
    },

    readBoolean: function() {
        return Boolean(this.readVarint());
    },

    readString: function() {
        var end = this.readVarint() + this.pos;
        var pos = this.pos;
        this.pos = end;

        if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
            // longer strings are fast with the built-in browser TextDecoder API
            return readUtf8TextDecoder(this.buf, pos, end);
        }
        // short strings are fast with our custom implementation
        return readUtf8(this.buf, pos, end);
    },

    readBytes: function() {
        var end = this.readVarint() + this.pos,
            buffer = this.buf.subarray(this.pos, end);
        this.pos = end;
        return buffer;
    },

    // verbose for performance reasons; doesn't affect gzipped size

    readPackedVarint: function(arr, isSigned) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readVarint(isSigned));
        return arr;
    },
    readPackedSVarint: function(arr) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readSVarint());
        return arr;
    },
    readPackedBoolean: function(arr) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readBoolean());
        return arr;
    },
    readPackedFloat: function(arr) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readFloat());
        return arr;
    },
    readPackedDouble: function(arr) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readDouble());
        return arr;
    },
    readPackedFixed32: function(arr) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readFixed32());
        return arr;
    },
    readPackedSFixed32: function(arr) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readSFixed32());
        return arr;
    },
    readPackedFixed64: function(arr) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readFixed64());
        return arr;
    },
    readPackedSFixed64: function(arr) {
        if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());
        var end = readPackedEnd(this);
        arr = arr || [];
        while (this.pos < end) arr.push(this.readSFixed64());
        return arr;
    },

    skip: function(val) {
        var type = val & 0x7;
        if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}
        else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;
        else if (type === Pbf.Fixed32) this.pos += 4;
        else if (type === Pbf.Fixed64) this.pos += 8;
        else throw new Error('Unimplemented type: ' + type);
    },

    // === WRITING =================================================================

    writeTag: function(tag, type) {
        this.writeVarint((tag << 3) | type);
    },

    realloc: function(min) {
        var length = this.length || 16;

        while (length < this.pos + min) length *= 2;

        if (length !== this.length) {
            var buf = new Uint8Array(length);
            buf.set(this.buf);
            this.buf = buf;
            this.length = length;
        }
    },

    finish: function() {
        this.length = this.pos;
        this.pos = 0;
        return this.buf.subarray(0, this.length);
    },

    writeFixed32: function(val) {
        this.realloc(4);
        writeInt32(this.buf, val, this.pos);
        this.pos += 4;
    },

    writeSFixed32: function(val) {
        this.realloc(4);
        writeInt32(this.buf, val, this.pos);
        this.pos += 4;
    },

    writeFixed64: function(val) {
        this.realloc(8);
        writeInt32(this.buf, val & -1, this.pos);
        writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
        this.pos += 8;
    },

    writeSFixed64: function(val) {
        this.realloc(8);
        writeInt32(this.buf, val & -1, this.pos);
        writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
        this.pos += 8;
    },

    writeVarint: function(val) {
        val = +val || 0;

        if (val > 0xfffffff || val < 0) {
            writeBigVarint(val, this);
            return;
        }

        this.realloc(4);

        this.buf[this.pos++] =           val & 0x7f  | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
        this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
        this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
        this.buf[this.pos++] =   (val >>> 7) & 0x7f;
    },

    writeSVarint: function(val) {
        this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
    },

    writeBoolean: function(val) {
        this.writeVarint(Boolean(val));
    },

    writeString: function(str) {
        str = String(str);
        this.realloc(str.length * 4);

        this.pos++; // reserve 1 byte for short string length

        var startPos = this.pos;
        // write the string directly to the buffer and see how much was written
        this.pos = writeUtf8(this.buf, str, this.pos);
        var len = this.pos - startPos;

        if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);

        // finally, write the message length in the reserved place and restore the position
        this.pos = startPos - 1;
        this.writeVarint(len);
        this.pos += len;
    },

    writeFloat: function(val) {
        this.realloc(4);
        ieee754.write(this.buf, val, this.pos, true, 23, 4);
        this.pos += 4;
    },

    writeDouble: function(val) {
        this.realloc(8);
        ieee754.write(this.buf, val, this.pos, true, 52, 8);
        this.pos += 8;
    },

    writeBytes: function(buffer) {
        var len = buffer.length;
        this.writeVarint(len);
        this.realloc(len);
        for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];
    },

    writeRawMessage: function(fn, obj) {
        this.pos++; // reserve 1 byte for short message length

        // write the message directly to the buffer and see how much was written
        var startPos = this.pos;
        fn(obj, this);
        var len = this.pos - startPos;

        if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);

        // finally, write the message length in the reserved place and restore the position
        this.pos = startPos - 1;
        this.writeVarint(len);
        this.pos += len;
    },

    writeMessage: function(tag, fn, obj) {
        this.writeTag(tag, Pbf.Bytes);
        this.writeRawMessage(fn, obj);
    },

    writePackedVarint:   function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr);   },
    writePackedSVarint:  function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr);  },
    writePackedBoolean:  function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr);  },
    writePackedFloat:    function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr);    },
    writePackedDouble:   function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr);   },
    writePackedFixed32:  function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr);  },
    writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },
    writePackedFixed64:  function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr);  },
    writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },

    writeBytesField: function(tag, buffer) {
        this.writeTag(tag, Pbf.Bytes);
        this.writeBytes(buffer);
    },
    writeFixed32Field: function(tag, val) {
        this.writeTag(tag, Pbf.Fixed32);
        this.writeFixed32(val);
    },
    writeSFixed32Field: function(tag, val) {
        this.writeTag(tag, Pbf.Fixed32);
        this.writeSFixed32(val);
    },
    writeFixed64Field: function(tag, val) {
        this.writeTag(tag, Pbf.Fixed64);
        this.writeFixed64(val);
    },
    writeSFixed64Field: function(tag, val) {
        this.writeTag(tag, Pbf.Fixed64);
        this.writeSFixed64(val);
    },
    writeVarintField: function(tag, val) {
        this.writeTag(tag, Pbf.Varint);
        this.writeVarint(val);
    },
    writeSVarintField: function(tag, val) {
        this.writeTag(tag, Pbf.Varint);
        this.writeSVarint(val);
    },
    writeStringField: function(tag, str) {
        this.writeTag(tag, Pbf.Bytes);
        this.writeString(str);
    },
    writeFloatField: function(tag, val) {
        this.writeTag(tag, Pbf.Fixed32);
        this.writeFloat(val);
    },
    writeDoubleField: function(tag, val) {
        this.writeTag(tag, Pbf.Fixed64);
        this.writeDouble(val);
    },
    writeBooleanField: function(tag, val) {
        this.writeVarintField(tag, Boolean(val));
    }
};

function readVarintRemainder(l, s, p) {
    var buf = p.buf,
        h, b;

    b = buf[p.pos++]; h  = (b & 0x70) >> 4;  if (b < 0x80) return toNum(l, h, s);
    b = buf[p.pos++]; h |= (b & 0x7f) << 3;  if (b < 0x80) return toNum(l, h, s);
    b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);
    b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);
    b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);
    b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);

    throw new Error('Expected varint not more than 10 bytes');
}

function readPackedEnd(pbf) {
    return pbf.type === Pbf.Bytes ?
        pbf.readVarint() + pbf.pos : pbf.pos + 1;
}

function toNum(low, high, isSigned) {
    if (isSigned) {
        return high * 0x100000000 + (low >>> 0);
    }

    return ((high >>> 0) * 0x100000000) + (low >>> 0);
}

function writeBigVarint(val, pbf) {
    var low, high;

    if (val >= 0) {
        low  = (val % 0x100000000) | 0;
        high = (val / 0x100000000) | 0;
    } else {
        low  = ~(-val % 0x100000000);
        high = ~(-val / 0x100000000);

        if (low ^ 0xffffffff) {
            low = (low + 1) | 0;
        } else {
            low = 0;
            high = (high + 1) | 0;
        }
    }

    if (val >= 0x10000000000000000 || val < -0x10000000000000000) {
        throw new Error('Given varint doesn\'t fit into 10 bytes');
    }

    pbf.realloc(10);

    writeBigVarintLow(low, high, pbf);
    writeBigVarintHigh(high, pbf);
}

function writeBigVarintLow(low, high, pbf) {
    pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
    pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
    pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
    pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
    pbf.buf[pbf.pos]   = low & 0x7f;
}

function writeBigVarintHigh(high, pbf) {
    var lsb = (high & 0x07) << 4;

    pbf.buf[pbf.pos++] |= lsb         | ((high >>>= 3) ? 0x80 : 0); if (!high) return;
    pbf.buf[pbf.pos++]  = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
    pbf.buf[pbf.pos++]  = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
    pbf.buf[pbf.pos++]  = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
    pbf.buf[pbf.pos++]  = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
    pbf.buf[pbf.pos++]  = high & 0x7f;
}

function makeRoomForExtraLength(startPos, len, pbf) {
    var extraLen =
        len <= 0x3fff ? 1 :
        len <= 0x1fffff ? 2 :
        len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));

    // if 1 byte isn't enough for encoding message length, shift the data to the right
    pbf.realloc(extraLen);
    for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];
}

function writePackedVarint(arr, pbf)   { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]);   }
function writePackedSVarint(arr, pbf)  { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]);  }
function writePackedFloat(arr, pbf)    { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]);    }
function writePackedDouble(arr, pbf)   { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]);   }
function writePackedBoolean(arr, pbf)  { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]);  }
function writePackedFixed32(arr, pbf)  { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]);  }
function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }
function writePackedFixed64(arr, pbf)  { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]);  }
function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }

// Buffer code below from https://github.com/feross/buffer, MIT-licensed

function readUInt32(buf, pos) {
    return ((buf[pos]) |
        (buf[pos + 1] << 8) |
        (buf[pos + 2] << 16)) +
        (buf[pos + 3] * 0x1000000);
}

function writeInt32(buf, val, pos) {
    buf[pos] = val;
    buf[pos + 1] = (val >>> 8);
    buf[pos + 2] = (val >>> 16);
    buf[pos + 3] = (val >>> 24);
}

function readInt32(buf, pos) {
    return ((buf[pos]) |
        (buf[pos + 1] << 8) |
        (buf[pos + 2] << 16)) +
        (buf[pos + 3] << 24);
}

function readUtf8(buf, pos, end) {
    var str = '';
    var i = pos;

    while (i < end) {
        var b0 = buf[i];
        var c = null; // codepoint
        var bytesPerSequence =
            b0 > 0xEF ? 4 :
            b0 > 0xDF ? 3 :
            b0 > 0xBF ? 2 : 1;

        if (i + bytesPerSequence > end) break;

        var b1, b2, b3;

        if (bytesPerSequence === 1) {
            if (b0 < 0x80) {
                c = b0;
            }
        } else if (bytesPerSequence === 2) {
            b1 = buf[i + 1];
            if ((b1 & 0xC0) === 0x80) {
                c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);
                if (c <= 0x7F) {
                    c = null;
                }
            }
        } else if (bytesPerSequence === 3) {
            b1 = buf[i + 1];
            b2 = buf[i + 2];
            if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {
                c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);
                if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {
                    c = null;
                }
            }
        } else if (bytesPerSequence === 4) {
            b1 = buf[i + 1];
            b2 = buf[i + 2];
            b3 = buf[i + 3];
            if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
                c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);
                if (c <= 0xFFFF || c >= 0x110000) {
                    c = null;
                }
            }
        }

        if (c === null) {
            c = 0xFFFD;
            bytesPerSequence = 1;

        } else if (c > 0xFFFF) {
            c -= 0x10000;
            str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);
            c = 0xDC00 | c & 0x3FF;
        }

        str += String.fromCharCode(c);
        i += bytesPerSequence;
    }

    return str;
}

function readUtf8TextDecoder(buf, pos, end) {
    return utf8TextDecoder.decode(buf.subarray(pos, end));
}

function writeUtf8(buf, str, pos) {
    for (var i = 0, c, lead; i < str.length; i++) {
        c = str.charCodeAt(i); // code point

        if (c > 0xD7FF && c < 0xE000) {
            if (lead) {
                if (c < 0xDC00) {
                    buf[pos++] = 0xEF;
                    buf[pos++] = 0xBF;
                    buf[pos++] = 0xBD;
                    lead = c;
                    continue;
                } else {
                    c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;
                    lead = null;
                }
            } else {
                if (c > 0xDBFF || (i + 1 === str.length)) {
                    buf[pos++] = 0xEF;
                    buf[pos++] = 0xBF;
                    buf[pos++] = 0xBD;
                } else {
                    lead = c;
                }
                continue;
            }
        } else if (lead) {
            buf[pos++] = 0xEF;
            buf[pos++] = 0xBF;
            buf[pos++] = 0xBD;
            lead = null;
        }

        if (c < 0x80) {
            buf[pos++] = c;
        } else {
            if (c < 0x800) {
                buf[pos++] = c >> 0x6 | 0xC0;
            } else {
                if (c < 0x10000) {
                    buf[pos++] = c >> 0xC | 0xE0;
                } else {
                    buf[pos++] = c >> 0x12 | 0xF0;
                    buf[pos++] = c >> 0xC & 0x3F | 0x80;
                }
                buf[pos++] = c >> 0x6 & 0x3F | 0x80;
            }
            buf[pos++] = c & 0x3F | 0x80;
        }
    }
    return pos;
}


/***/ }),

/***/ "./node_modules/pixelworks/lib/index.js":
/*!**********************************************!*\
  !*** ./node_modules/pixelworks/lib/index.js ***!
  \**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

var Processor = __webpack_require__(/*! ./processor */ "./node_modules/pixelworks/lib/processor.js");

exports.Processor = Processor;


/***/ }),

/***/ "./node_modules/pixelworks/lib/processor.js":
/*!**************************************************!*\
  !*** ./node_modules/pixelworks/lib/processor.js ***!
  \**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

var newImageData = __webpack_require__(/*! ./util */ "./node_modules/pixelworks/lib/util.js").newImageData;

/**
 * Create a function for running operations.  This function is serialized for
 * use in a worker.
 * @param {function(Array, Object):*} operation The operation.
 * @return {function(Object):ArrayBuffer} A function that takes an object with
 * buffers, meta, imageOps, width, and height properties and returns an array
 * buffer.
 */
function createMinion(operation) {
  var workerHasImageData = true;
  try {
    new ImageData(10, 10);
  } catch (_) {
    workerHasImageData = false;
  }

  function newWorkerImageData(data, width, height) {
    if (workerHasImageData) {
      return new ImageData(data, width, height);
    } else {
      return {data: data, width: width, height: height};
    }
  }

  return function(data) {
    // bracket notation for minification support
    var buffers = data['buffers'];
    var meta = data['meta'];
    var imageOps = data['imageOps'];
    var width = data['width'];
    var height = data['height'];

    var numBuffers = buffers.length;
    var numBytes = buffers[0].byteLength;
    var output, b;

    if (imageOps) {
      var images = new Array(numBuffers);
      for (b = 0; b < numBuffers; ++b) {
        images[b] = newWorkerImageData(
            new Uint8ClampedArray(buffers[b]), width, height);
      }
      output = operation(images, meta).data;
    } else {
      output = new Uint8ClampedArray(numBytes);
      var arrays = new Array(numBuffers);
      var pixels = new Array(numBuffers);
      for (b = 0; b < numBuffers; ++b) {
        arrays[b] = new Uint8ClampedArray(buffers[b]);
        pixels[b] = [0, 0, 0, 0];
      }
      for (var i = 0; i < numBytes; i += 4) {
        for (var j = 0; j < numBuffers; ++j) {
          var array = arrays[j];
          pixels[j][0] = array[i];
          pixels[j][1] = array[i + 1];
          pixels[j][2] = array[i + 2];
          pixels[j][3] = array[i + 3];
        }
        var pixel = operation(pixels, meta);
        output[i] = pixel[0];
        output[i + 1] = pixel[1];
        output[i + 2] = pixel[2];
        output[i + 3] = pixel[3];
      }
    }
    return output.buffer;
  };
}

/**
 * Create a worker for running operations.
 * @param {Object} config Configuration.
 * @param {function(MessageEvent)} onMessage Called with a message event.
 * @return {Worker} The worker.
 */
function createWorker(config, onMessage) {
  var lib = Object.keys(config.lib || {}).map(function(name) {
    return 'var ' + name + ' = ' + config.lib[name].toString() + ';';
  });

  var lines = lib.concat([
    'var __minion__ = (' + createMinion.toString() + ')(', config.operation.toString(), ');',
    'self.addEventListener("message", function(event) {',
    '  var buffer = __minion__(event.data);',
    '  self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);',
    '});'
  ]);

  var blob = new Blob(lines, {type: 'text/javascript'});
  var source = URL.createObjectURL(blob);
  var worker = new Worker(source);
  worker.addEventListener('message', onMessage);
  return worker;
}

/**
 * Create a faux worker for running operations.
 * @param {Object} config Configuration.
 * @param {function(MessageEvent)} onMessage Called with a message event.
 * @return {Object} The faux worker.
 */
function createFauxWorker(config, onMessage) {
  var minion = createMinion(config.operation);
  return {
    postMessage: function(data) {
      setTimeout(function() {
        onMessage({'data': {'buffer': minion(data), 'meta': data['meta']}});
      }, 0);
    }
  };
}

/**
 * A processor runs pixel or image operations in workers.
 * @param {Object} config Configuration.
 */
function Processor(config) {
  this._imageOps = !!config.imageOps;
  var threads;
  if (config.threads === 0) {
    threads = 0;
  } else if (this._imageOps) {
    threads = 1;
  } else {
    threads = config.threads || 1;
  }
  var workers = [];
  if (threads) {
    for (var i = 0; i < threads; ++i) {
      workers[i] = createWorker(config, this._onWorkerMessage.bind(this, i));
    }
  } else {
    workers[0] = createFauxWorker(config, this._onWorkerMessage.bind(this, 0));
  }
  this._workers = workers;
  this._queue = [];
  this._maxQueueLength = config.queue || Infinity;
  this._running = 0;
  this._dataLookup = {};
  this._job = null;
}

/**
 * Run operation on input data.
 * @param {Array.<Array|ImageData>} inputs Array of pixels or image data
 *     (depending on the operation type).
 * @param {Object} meta A user data object.  This is passed to all operations
 *     and must be serializable.
 * @param {function(Error, ImageData, Object)} callback Called when work
 *     completes.  The first argument is any error.  The second is the ImageData
 *     generated by operations.  The third is the user data object.
 */
Processor.prototype.process = function(inputs, meta, callback) {
  this._enqueue({
    inputs: inputs,
    meta: meta,
    callback: callback
  });
  this._dispatch();
};

/**
 * Stop responding to any completed work and destroy the processor.
 */
Processor.prototype.destroy = function() {
  for (var key in this) {
    this[key] = null;
  }
  this._destroyed = true;
};

/**
 * Add a job to the queue.
 * @param {Object} job The job.
 */
Processor.prototype._enqueue = function(job) {
  this._queue.push(job);
  while (this._queue.length > this._maxQueueLength) {
    this._queue.shift().callback(null, null);
  }
};

/**
 * Dispatch a job.
 */
Processor.prototype._dispatch = function() {
  if (this._running === 0 && this._queue.length > 0) {
    var job = this._job = this._queue.shift();
    var width = job.inputs[0].width;
    var height = job.inputs[0].height;
    var buffers = job.inputs.map(function(input) {
      return input.data.buffer;
    });
    var threads = this._workers.length;
    this._running = threads;
    if (threads === 1) {
      this._workers[0].postMessage({
        'buffers': buffers,
        'meta': job.meta,
        'imageOps': this._imageOps,
        'width': width,
        'height': height
      }, buffers);
    } else {
      var length = job.inputs[0].data.length;
      var segmentLength = 4 * Math.ceil(length / 4 / threads);
      for (var i = 0; i < threads; ++i) {
        var offset = i * segmentLength;
        var slices = [];
        for (var j = 0, jj = buffers.length; j < jj; ++j) {
          slices.push(buffers[i].slice(offset, offset + segmentLength));
        }
        this._workers[i].postMessage({
          'buffers': slices,
          'meta': job.meta,
          'imageOps': this._imageOps,
          'width': width,
          'height': height
        }, slices);
      }
    }
  }
};

/**
 * Handle messages from the worker.
 * @param {number} index The worker index.
 * @param {MessageEvent} event The message event.
 */
Processor.prototype._onWorkerMessage = function(index, event) {
  if (this._destroyed) {
    return;
  }
  this._dataLookup[index] = event.data;
  --this._running;
  if (this._running === 0) {
    this._resolveJob();
  }
};

/**
 * Resolve a job.  If there are no more worker threads, the processor callback
 * will be called.
 */
Processor.prototype._resolveJob = function() {
  var job = this._job;
  var threads = this._workers.length;
  var data, meta;
  if (threads === 1) {
    data = new Uint8ClampedArray(this._dataLookup[0]['buffer']);
    meta = this._dataLookup[0]['meta'];
  } else {
    var length = job.inputs[0].data.length;
    data = new Uint8ClampedArray(length);
    meta = new Array(length);
    var segmentLength = 4 * Math.ceil(length / 4 / threads);
    for (var i = 0; i < threads; ++i) {
      var buffer = this._dataLookup[i]['buffer'];
      var offset = i * segmentLength;
      data.set(new Uint8ClampedArray(buffer), offset);
      meta[i] = this._dataLookup[i]['meta'];
    }
  }
  this._job = null;
  this._dataLookup = {};
  job.callback(null,
      newImageData(data, job.inputs[0].width, job.inputs[0].height), meta);
  this._dispatch();
};

module.exports = Processor;


/***/ }),

/***/ "./node_modules/pixelworks/lib/util.js":
/*!*********************************************!*\
  !*** ./node_modules/pixelworks/lib/util.js ***!
  \*********************************************/
/*! no static exports found */
/***/ (function(module, exports) {

var hasImageData = true;
try {
  new ImageData(10, 10);
} catch (_) {
  hasImageData = false;
}

var context = document.createElement('canvas').getContext('2d');

function newImageData(data, width, height) {
  if (hasImageData) {
    return new ImageData(data, width, height);
  } else {
    var imageData = context.createImageData(width, height);
    imageData.data.set(data);
    return imageData;
  }
}

exports.newImageData = newImageData;


/***/ }),

/***/ "./node_modules/rbush/rbush.js":
/*!*************************************!*\
  !*** ./node_modules/rbush/rbush.js ***!
  \*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

(function (global, factory) {
 true ? module.exports = factory() :
undefined;
}(this, function () { 'use strict';

function quickselect(arr, k, left, right, compare) {
    quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);
}

function quickselectStep(arr, k, left, right, compare) {

    while (right > left) {
        if (right - left > 600) {
            var n = right - left + 1;
            var m = k - left + 1;
            var z = Math.log(n);
            var s = 0.5 * Math.exp(2 * z / 3);
            var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
            var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
            var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
            quickselectStep(arr, k, newLeft, newRight, compare);
        }

        var t = arr[k];
        var i = left;
        var j = right;

        swap(arr, left, k);
        if (compare(arr[right], t) > 0) { swap(arr, left, right); }

        while (i < j) {
            swap(arr, i, j);
            i++;
            j--;
            while (compare(arr[i], t) < 0) { i++; }
            while (compare(arr[j], t) > 0) { j--; }
        }

        if (compare(arr[left], t) === 0) { swap(arr, left, j); }
        else {
            j++;
            swap(arr, j, right);
        }

        if (j <= k) { left = j + 1; }
        if (k <= j) { right = j - 1; }
    }
}

function swap(arr, i, j) {
    var tmp = arr[i];
    arr[i] = arr[j];
    arr[j] = tmp;
}

function defaultCompare(a, b) {
    return a < b ? -1 : a > b ? 1 : 0;
}

var RBush = function RBush(maxEntries) {
    if ( maxEntries === void 0 ) maxEntries = 9;

    // max entries in a node is 9 by default; min node fill is 40% for best performance
    this._maxEntries = Math.max(4, maxEntries);
    this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
    this.clear();
};

RBush.prototype.all = function all () {
    return this._all(this.data, []);
};

RBush.prototype.search = function search (bbox) {
    var node = this.data;
    var result = [];

    if (!intersects(bbox, node)) { return result; }

    var toBBox = this.toBBox;
    var nodesToSearch = [];

    while (node) {
        for (var i = 0; i < node.children.length; i++) {
            var child = node.children[i];
            var childBBox = node.leaf ? toBBox(child) : child;

            if (intersects(bbox, childBBox)) {
                if (node.leaf) { result.push(child); }
                else if (contains(bbox, childBBox)) { this._all(child, result); }
                else { nodesToSearch.push(child); }
            }
        }
        node = nodesToSearch.pop();
    }

    return result;
};

RBush.prototype.collides = function collides (bbox) {
    var node = this.data;

    if (!intersects(bbox, node)) { return false; }

    var nodesToSearch = [];
    while (node) {
        for (var i = 0; i < node.children.length; i++) {
            var child = node.children[i];
            var childBBox = node.leaf ? this.toBBox(child) : child;

            if (intersects(bbox, childBBox)) {
                if (node.leaf || contains(bbox, childBBox)) { return true; }
                nodesToSearch.push(child);
            }
        }
        node = nodesToSearch.pop();
    }

    return false;
};

RBush.prototype.load = function load (data) {
    if (!(data && data.length)) { return this; }

    if (data.length < this._minEntries) {
        for (var i = 0; i < data.length; i++) {
            this.insert(data[i]);
        }
        return this;
    }

    // recursively build the tree with the given data from scratch using OMT algorithm
    var node = this._build(data.slice(), 0, data.length - 1, 0);

    if (!this.data.children.length) {
        // save as is if tree is empty
        this.data = node;

    } else if (this.data.height === node.height) {
        // split root if trees have the same height
        this._splitRoot(this.data, node);

    } else {
        if (this.data.height < node.height) {
            // swap trees if inserted one is bigger
            var tmpNode = this.data;
            this.data = node;
            node = tmpNode;
        }

        // insert the small tree into the large tree at appropriate level
        this._insert(node, this.data.height - node.height - 1, true);
    }

    return this;
};

RBush.prototype.insert = function insert (item) {
    if (item) { this._insert(item, this.data.height - 1); }
    return this;
};

RBush.prototype.clear = function clear () {
    this.data = createNode([]);
    return this;
};

RBush.prototype.remove = function remove (item, equalsFn) {
    if (!item) { return this; }

    var node = this.data;
    var bbox = this.toBBox(item);
    var path = [];
    var indexes = [];
    var i, parent, goingUp;

    // depth-first iterative tree traversal
    while (node || path.length) {

        if (!node) { // go up
            node = path.pop();
            parent = path[path.length - 1];
            i = indexes.pop();
            goingUp = true;
        }

        if (node.leaf) { // check current node
            var index = findItem(item, node.children, equalsFn);

            if (index !== -1) {
                // item found, remove the item and condense tree upwards
                node.children.splice(index, 1);
                path.push(node);
                this._condense(path);
                return this;
            }
        }

        if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
            path.push(node);
            indexes.push(i);
            i = 0;
            parent = node;
            node = node.children[0];

        } else if (parent) { // go right
            i++;
            node = parent.children[i];
            goingUp = false;

        } else { node = null; } // nothing found
    }

    return this;
};

RBush.prototype.toBBox = function toBBox (item) { return item; };

RBush.prototype.compareMinX = function compareMinX (a, b) { return a.minX - b.minX; };
RBush.prototype.compareMinY = function compareMinY (a, b) { return a.minY - b.minY; };

RBush.prototype.toJSON = function toJSON () { return this.data; };

RBush.prototype.fromJSON = function fromJSON (data) {
    this.data = data;
    return this;
};

RBush.prototype._all = function _all (node, result) {
    var nodesToSearch = [];
    while (node) {
        if (node.leaf) { result.push.apply(result, node.children); }
        else { nodesToSearch.push.apply(nodesToSearch, node.children); }

        node = nodesToSearch.pop();
    }
    return result;
};

RBush.prototype._build = function _build (items, left, right, height) {

    var N = right - left + 1;
    var M = this._maxEntries;
    var node;

    if (N <= M) {
        // reached leaf level; return leaf
        node = createNode(items.slice(left, right + 1));
        calcBBox(node, this.toBBox);
        return node;
    }

    if (!height) {
        // target height of the bulk-loaded tree
        height = Math.ceil(Math.log(N) / Math.log(M));

        // target number of root entries to maximize storage utilization
        M = Math.ceil(N / Math.pow(M, height - 1));
    }

    node = createNode([]);
    node.leaf = false;
    node.height = height;

    // split the items into M mostly square tiles

    var N2 = Math.ceil(N / M);
    var N1 = N2 * Math.ceil(Math.sqrt(M));

    multiSelect(items, left, right, N1, this.compareMinX);

    for (var i = left; i <= right; i += N1) {

        var right2 = Math.min(i + N1 - 1, right);

        multiSelect(items, i, right2, N2, this.compareMinY);

        for (var j = i; j <= right2; j += N2) {

            var right3 = Math.min(j + N2 - 1, right2);

            // pack each entry recursively
            node.children.push(this._build(items, j, right3, height - 1));
        }
    }

    calcBBox(node, this.toBBox);

    return node;
};

RBush.prototype._chooseSubtree = function _chooseSubtree (bbox, node, level, path) {
    while (true) {
        path.push(node);

        if (node.leaf || path.length - 1 === level) { break; }

        var minArea = Infinity;
        var minEnlargement = Infinity;
        var targetNode = (void 0);

        for (var i = 0; i < node.children.length; i++) {
            var child = node.children[i];
            var area = bboxArea(child);
            var enlargement = enlargedArea(bbox, child) - area;

            // choose entry with the least area enlargement
            if (enlargement < minEnlargement) {
                minEnlargement = enlargement;
                minArea = area < minArea ? area : minArea;
                targetNode = child;

            } else if (enlargement === minEnlargement) {
                // otherwise choose one with the smallest area
                if (area < minArea) {
                    minArea = area;
                    targetNode = child;
                }
            }
        }

        node = targetNode || node.children[0];
    }

    return node;
};

RBush.prototype._insert = function _insert (item, level, isNode) {
    var bbox = isNode ? item : this.toBBox(item);
    var insertPath = [];

    // find the best node for accommodating the item, saving all nodes along the path too
    var node = this._chooseSubtree(bbox, this.data, level, insertPath);

    // put the item into the node
    node.children.push(item);
    extend(node, bbox);

    // split on node overflow; propagate upwards if necessary
    while (level >= 0) {
        if (insertPath[level].children.length > this._maxEntries) {
            this._split(insertPath, level);
            level--;
        } else { break; }
    }

    // adjust bboxes along the insertion path
    this._adjustParentBBoxes(bbox, insertPath, level);
};

// split overflowed node into two
RBush.prototype._split = function _split (insertPath, level) {
    var node = insertPath[level];
    var M = node.children.length;
    var m = this._minEntries;

    this._chooseSplitAxis(node, m, M);

    var splitIndex = this._chooseSplitIndex(node, m, M);

    var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
    newNode.height = node.height;
    newNode.leaf = node.leaf;

    calcBBox(node, this.toBBox);
    calcBBox(newNode, this.toBBox);

    if (level) { insertPath[level - 1].children.push(newNode); }
    else { this._splitRoot(node, newNode); }
};

RBush.prototype._splitRoot = function _splitRoot (node, newNode) {
    // split root node
    this.data = createNode([node, newNode]);
    this.data.height = node.height + 1;
    this.data.leaf = false;
    calcBBox(this.data, this.toBBox);
};

RBush.prototype._chooseSplitIndex = function _chooseSplitIndex (node, m, M) {
    var index;
    var minOverlap = Infinity;
    var minArea = Infinity;

    for (var i = m; i <= M - m; i++) {
        var bbox1 = distBBox(node, 0, i, this.toBBox);
        var bbox2 = distBBox(node, i, M, this.toBBox);

        var overlap = intersectionArea(bbox1, bbox2);
        var area = bboxArea(bbox1) + bboxArea(bbox2);

        // choose distribution with minimum overlap
        if (overlap < minOverlap) {
            minOverlap = overlap;
            index = i;

            minArea = area < minArea ? area : minArea;

        } else if (overlap === minOverlap) {
            // otherwise choose distribution with minimum area
            if (area < minArea) {
                minArea = area;
                index = i;
            }
        }
    }

    return index || M - m;
};

// sorts node children by the best axis for split
RBush.prototype._chooseSplitAxis = function _chooseSplitAxis (node, m, M) {
    var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
    var compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
    var xMargin = this._allDistMargin(node, m, M, compareMinX);
    var yMargin = this._allDistMargin(node, m, M, compareMinY);

    // if total distributions margin value is minimal for x, sort by minX,
    // otherwise it's already sorted by minY
    if (xMargin < yMargin) { node.children.sort(compareMinX); }
};

// total margin of all possible split distributions where each node is at least m full
RBush.prototype._allDistMargin = function _allDistMargin (node, m, M, compare) {
    node.children.sort(compare);

    var toBBox = this.toBBox;
    var leftBBox = distBBox(node, 0, m, toBBox);
    var rightBBox = distBBox(node, M - m, M, toBBox);
    var margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);

    for (var i = m; i < M - m; i++) {
        var child = node.children[i];
        extend(leftBBox, node.leaf ? toBBox(child) : child);
        margin += bboxMargin(leftBBox);
    }

    for (var i$1 = M - m - 1; i$1 >= m; i$1--) {
        var child$1 = node.children[i$1];
        extend(rightBBox, node.leaf ? toBBox(child$1) : child$1);
        margin += bboxMargin(rightBBox);
    }

    return margin;
};

RBush.prototype._adjustParentBBoxes = function _adjustParentBBoxes (bbox, path, level) {
    // adjust bboxes along the given tree path
    for (var i = level; i >= 0; i--) {
        extend(path[i], bbox);
    }
};

RBush.prototype._condense = function _condense (path) {
    // go through the path, removing empty nodes and updating bboxes
    for (var i = path.length - 1, siblings = (void 0); i >= 0; i--) {
        if (path[i].children.length === 0) {
            if (i > 0) {
                siblings = path[i - 1].children;
                siblings.splice(siblings.indexOf(path[i]), 1);

            } else { this.clear(); }

        } else { calcBBox(path[i], this.toBBox); }
    }
};

function findItem(item, items, equalsFn) {
    if (!equalsFn) { return items.indexOf(item); }

    for (var i = 0; i < items.length; i++) {
        if (equalsFn(item, items[i])) { return i; }
    }
    return -1;
}

// calculate node's bbox from bboxes of its children
function calcBBox(node, toBBox) {
    distBBox(node, 0, node.children.length, toBBox, node);
}

// min bounding rectangle of node children from k to p-1
function distBBox(node, k, p, toBBox, destNode) {
    if (!destNode) { destNode = createNode(null); }
    destNode.minX = Infinity;
    destNode.minY = Infinity;
    destNode.maxX = -Infinity;
    destNode.maxY = -Infinity;

    for (var i = k; i < p; i++) {
        var child = node.children[i];
        extend(destNode, node.leaf ? toBBox(child) : child);
    }

    return destNode;
}

function extend(a, b) {
    a.minX = Math.min(a.minX, b.minX);
    a.minY = Math.min(a.minY, b.minY);
    a.maxX = Math.max(a.maxX, b.maxX);
    a.maxY = Math.max(a.maxY, b.maxY);
    return a;
}

function compareNodeMinX(a, b) { return a.minX - b.minX; }
function compareNodeMinY(a, b) { return a.minY - b.minY; }

function bboxArea(a)   { return (a.maxX - a.minX) * (a.maxY - a.minY); }
function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }

function enlargedArea(a, b) {
    return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
           (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
}

function intersectionArea(a, b) {
    var minX = Math.max(a.minX, b.minX);
    var minY = Math.max(a.minY, b.minY);
    var maxX = Math.min(a.maxX, b.maxX);
    var maxY = Math.min(a.maxY, b.maxY);

    return Math.max(0, maxX - minX) *
           Math.max(0, maxY - minY);
}

function contains(a, b) {
    return a.minX <= b.minX &&
           a.minY <= b.minY &&
           b.maxX <= a.maxX &&
           b.maxY <= a.maxY;
}

function intersects(a, b) {
    return b.minX <= a.maxX &&
           b.minY <= a.maxY &&
           b.maxX >= a.minX &&
           b.maxY >= a.minY;
}

function createNode(children) {
    return {
        children: children,
        height: 1,
        leaf: true,
        minX: Infinity,
        minY: Infinity,
        maxX: -Infinity,
        maxY: -Infinity
    };
}

// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
// combines selection algorithm with binary divide & conquer approach

function multiSelect(arr, left, right, n, compare) {
    var stack = [left, right];

    while (stack.length) {
        right = stack.pop();
        left = stack.pop();

        if (right - left <= n) { continue; }

        var mid = left + Math.ceil((right - left) / n / 2) * n;
        quickselect(arr, mid, left, right, compare);

        stack.push(left, mid, mid, right);
    }
}

return RBush;

}));


/***/ }),

/***/ "./src/entry.js":
/*!**********************!*\
  !*** ./src/entry.js ***!
  \**********************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var ol_AssertionError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ol/AssertionError.js */ "./node_modules/ol/AssertionError.js");
/* harmony import */ var ol_Collection_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ol/Collection.js */ "./node_modules/ol/Collection.js");
/* harmony import */ var ol_Disposable_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ol/Disposable.js */ "./node_modules/ol/Disposable.js");
/* harmony import */ var ol_Feature_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ol/Feature.js */ "./node_modules/ol/Feature.js");
/* harmony import */ var ol_Geolocation_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ol/Geolocation.js */ "./node_modules/ol/Geolocation.js");
/* harmony import */ var ol_layer_Graticule_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ol/layer/Graticule.js */ "./node_modules/ol/layer/Graticule.js");
/* harmony import */ var ol_Image_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ol/Image.js */ "./node_modules/ol/Image.js");
/* harmony import */ var ol_ImageBase_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ol/ImageBase.js */ "./node_modules/ol/ImageBase.js");
/* harmony import */ var ol_ImageCanvas_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ol/ImageCanvas.js */ "./node_modules/ol/ImageCanvas.js");
/* harmony import */ var ol_ImageTile_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ol/ImageTile.js */ "./node_modules/ol/ImageTile.js");
/* harmony import */ var ol_Kinetic_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ol/Kinetic.js */ "./node_modules/ol/Kinetic.js");
/* harmony import */ var ol_Map_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ol/Map.js */ "./node_modules/ol/Map.js");
/* harmony import */ var ol_MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ol/MapBrowserEvent.js */ "./node_modules/ol/MapBrowserEvent.js");
/* harmony import */ var ol_MapBrowserEventHandler_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ol/MapBrowserEventHandler.js */ "./node_modules/ol/MapBrowserEventHandler.js");
/* harmony import */ var ol_MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ol/MapBrowserPointerEvent.js */ "./node_modules/ol/MapBrowserPointerEvent.js");
/* harmony import */ var ol_MapEvent_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ol/MapEvent.js */ "./node_modules/ol/MapEvent.js");
/* harmony import */ var ol_Object_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ol/Object.js */ "./node_modules/ol/Object.js");
/* harmony import */ var ol_Observable_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ol/Observable.js */ "./node_modules/ol/Observable.js");
/* harmony import */ var ol_Overlay_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ol/Overlay.js */ "./node_modules/ol/Overlay.js");
/* harmony import */ var ol_PluggableMap_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ol/PluggableMap.js */ "./node_modules/ol/PluggableMap.js");
/* harmony import */ var ol_Tile_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ol/Tile.js */ "./node_modules/ol/Tile.js");
/* harmony import */ var ol_TileCache_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ol/TileCache.js */ "./node_modules/ol/TileCache.js");
/* harmony import */ var ol_TileQueue_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ol/TileQueue.js */ "./node_modules/ol/TileQueue.js");
/* harmony import */ var ol_TileRange_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ol/TileRange.js */ "./node_modules/ol/TileRange.js");
/* harmony import */ var ol_VectorRenderTile_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ol/VectorRenderTile.js */ "./node_modules/ol/VectorRenderTile.js");
/* harmony import */ var ol_VectorTile_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ol/VectorTile.js */ "./node_modules/ol/VectorTile.js");
/* harmony import */ var ol_View_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ol/View.js */ "./node_modules/ol/View.js");
/* harmony import */ var ol_util_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ol/util.js */ "./node_modules/ol/util.js");
/* harmony import */ var ol_coordinate_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ol/coordinate.js */ "./node_modules/ol/coordinate.js");
/* harmony import */ var ol_control_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ol/control.js */ "./node_modules/ol/control.js");
/* harmony import */ var ol_extent_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ol/extent.js */ "./node_modules/ol/extent.js");
/* harmony import */ var ol_events_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ol/events.js */ "./node_modules/ol/events.js");
/* harmony import */ var ol_events_Event_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ol/events/Event.js */ "./node_modules/ol/events/Event.js");
/* harmony import */ var ol_events_condition_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ol/events/condition.js */ "./node_modules/ol/events/condition.js");
/* harmony import */ var ol_geom_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ol/geom.js */ "./node_modules/ol/geom.js");
/* harmony import */ var ol_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ol/geom/Polygon.js */ "./node_modules/ol/geom/Polygon.js");
/* harmony import */ var ol_loadingstrategy__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ol/loadingstrategy */ "./node_modules/ol/loadingstrategy.js");
/* harmony import */ var ol_format_js__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ol/format.js */ "./node_modules/ol/format.js");
/* harmony import */ var ol_interaction_js__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ol/interaction.js */ "./node_modules/ol/interaction.js");
/* harmony import */ var ol_interaction_Draw_js__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ol/interaction/Draw.js */ "./node_modules/ol/interaction/Draw.js");
/* harmony import */ var ol_layer_js__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ol/layer.js */ "./node_modules/ol/layer.js");
/* harmony import */ var ol_proj_js__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ol/proj.js */ "./node_modules/ol/proj.js");
/* harmony import */ var ol_proj_proj4_js__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ol/proj/proj4.js */ "./node_modules/ol/proj/proj4.js");
/* harmony import */ var ol_proj_Units_js__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ol/proj/Units.js */ "./node_modules/ol/proj/Units.js");
/* harmony import */ var ol_source_js__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ol/source.js */ "./node_modules/ol/source.js");
/* harmony import */ var ol_sphere_js__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ol/sphere.js */ "./node_modules/ol/sphere.js");
/* harmony import */ var ol_style_js__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ol/style.js */ "./node_modules/ol/style.js");
/* harmony import */ var ol_style_Style_js__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ol/style/Style.js */ "./node_modules/ol/style/Style.js");
/* harmony import */ var ol_style_expressions_js__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ol/style/expressions.js */ "./node_modules/ol/style/expressions.js");
/* harmony import */ var ol_style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ol/style/IconAnchorUnits.js */ "./node_modules/ol/style/IconAnchorUnits.js");
/* harmony import */ var ol_style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ol/style/IconOrigin.js */ "./node_modules/ol/style/IconOrigin.js");
/* harmony import */ var ol_style_TextPlacement_js__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ol/style/TextPlacement.js */ "./node_modules/ol/style/TextPlacement.js");
/* harmony import */ var ol_tilegrid_WMTS_js__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ol/tilegrid/WMTS.js */ "./node_modules/ol/tilegrid/WMTS.js");
// Import (parts of) Openlayers 6 and reexport them in a ~nested namespace structure similar to Openlayers 4





























// @todo: imported VERSION is always "latest". Substitute with a proper version number













// namespace "format": cherry-pick classes; skip, particularly, broken MVT format (imports don't work)



















var nsInteraction = {};
Object.assign(nsInteraction, ol_interaction_js__WEBPACK_IMPORTED_MODULE_38__);
nsInteraction.Draw.createBox = ol_interaction_Draw_js__WEBPACK_IMPORTED_MODULE_39__["createBox"];

var nsProj = {};
Object.assign(nsProj, ol_proj_js__WEBPACK_IMPORTED_MODULE_41__, {
    proj4: ol_proj_proj4_js__WEBPACK_IMPORTED_MODULE_42__,
    Units: ol_proj_Units_js__WEBPACK_IMPORTED_MODULE_43__["default"]
});

var nsStyle = {};
Object.assign(nsStyle, ol_style_js__WEBPACK_IMPORTED_MODULE_46__, {
    expressions: ol_style_expressions_js__WEBPACK_IMPORTED_MODULE_48__,
    IconAnchorUnits: ol_style_IconAnchorUnits_js__WEBPACK_IMPORTED_MODULE_49__["default"],
    IconOrigin: ol_style_IconOrigin_js__WEBPACK_IMPORTED_MODULE_50__["default"],
    TextPlacement: ol_style_TextPlacement_js__WEBPACK_IMPORTED_MODULE_51__["default"]
});
Object.assign(nsStyle.Style, {
    createDefaultStyle: ol_style_Style_js__WEBPACK_IMPORTED_MODULE_47__["createDefaultStyle"],
    createEditingStyle: ol_style_Style_js__WEBPACK_IMPORTED_MODULE_47__["createEditingStyle"]
});

var ol = {
    // top-level classes
    AssertionError: ol_AssertionError_js__WEBPACK_IMPORTED_MODULE_0__["default"],
    Collection: ol_Collection_js__WEBPACK_IMPORTED_MODULE_1__["default"],
    Disposable: ol_Disposable_js__WEBPACK_IMPORTED_MODULE_2__["default"],
    Feature: ol_Feature_js__WEBPACK_IMPORTED_MODULE_3__["default"],
    Geolocation: ol_Geolocation_js__WEBPACK_IMPORTED_MODULE_4__["default"],
    Graticule: ol_layer_Graticule_js__WEBPACK_IMPORTED_MODULE_5__["default"],
    Image: ol_Image_js__WEBPACK_IMPORTED_MODULE_6__["default"],
    ImageBase: ol_ImageBase_js__WEBPACK_IMPORTED_MODULE_7__["default"],
    ImageCanvas: ol_ImageCanvas_js__WEBPACK_IMPORTED_MODULE_8__["default"],
    ImageTile: ol_ImageTile_js__WEBPACK_IMPORTED_MODULE_9__["default"],
    Kinetic: ol_Kinetic_js__WEBPACK_IMPORTED_MODULE_10__["default"],
    Map: ol_Map_js__WEBPACK_IMPORTED_MODULE_11__["default"],
    MapBrowserEvent: ol_MapBrowserEvent_js__WEBPACK_IMPORTED_MODULE_12__["default"],
    MapBrowserEventHandler: ol_MapBrowserEventHandler_js__WEBPACK_IMPORTED_MODULE_13__["default"],
    MapBrowserPointerEvent: ol_MapBrowserPointerEvent_js__WEBPACK_IMPORTED_MODULE_14__["default"],
    MapEvent: ol_MapEvent_js__WEBPACK_IMPORTED_MODULE_15__["default"],
    Object: ol_Object_js__WEBPACK_IMPORTED_MODULE_16__["default"],
    Observable: ol_Observable_js__WEBPACK_IMPORTED_MODULE_17__["default"],
    Overlay: ol_Overlay_js__WEBPACK_IMPORTED_MODULE_18__["default"],
    PluggableMap: ol_PluggableMap_js__WEBPACK_IMPORTED_MODULE_19__["default"],
    Tile: ol_Tile_js__WEBPACK_IMPORTED_MODULE_20__["default"],
    TileCache: ol_TileCache_js__WEBPACK_IMPORTED_MODULE_21__["default"],
    TileQueue: ol_TileQueue_js__WEBPACK_IMPORTED_MODULE_22__["default"],
    TileRange: ol_TileRange_js__WEBPACK_IMPORTED_MODULE_23__["default"],
    VectorRenderTile: ol_VectorRenderTile_js__WEBPACK_IMPORTED_MODULE_24__["default"],
    VectorTile: ol_VectorTile_js__WEBPACK_IMPORTED_MODULE_25__["default"],
    View: ol_View_js__WEBPACK_IMPORTED_MODULE_26__["default"],
    // globals (from util)
    getUid: ol_util_js__WEBPACK_IMPORTED_MODULE_27__["getUid"],
    VERSION: ol_util_js__WEBPACK_IMPORTED_MODULE_27__["VERSION"],
    // sub-namespaces
    coordinate: ol_coordinate_js__WEBPACK_IMPORTED_MODULE_28__,
    control: ol_control_js__WEBPACK_IMPORTED_MODULE_29__,
    events: Object.assign({}, ol_events_js__WEBPACK_IMPORTED_MODULE_31__, {
        Event: Object.assign({}, ol_events_Event_js__WEBPACK_IMPORTED_MODULE_32__, {
            BaseEvent: ol_events_Event_js__WEBPACK_IMPORTED_MODULE_32__["default"],
            stopPropagation: ol_events_Event_js__WEBPACK_IMPORTED_MODULE_32__["stopPropagation"],
            preventDefault: ol_events_Event_js__WEBPACK_IMPORTED_MODULE_32__["preventDefault"]
        }),
        condition: ol_events_condition_js__WEBPACK_IMPORTED_MODULE_33__
    }),
    extent: ol_extent_js__WEBPACK_IMPORTED_MODULE_30__,
    format: {
        GeoJSON: ol_format_js__WEBPACK_IMPORTED_MODULE_37__["GeoJSON"],
        GML: ol_format_js__WEBPACK_IMPORTED_MODULE_37__["GML"],
        KML: ol_format_js__WEBPACK_IMPORTED_MODULE_37__["KML"],
        WFS: ol_format_js__WEBPACK_IMPORTED_MODULE_37__["WFS"],
        WKT: ol_format_js__WEBPACK_IMPORTED_MODULE_37__["WKT"]
    },
    geom: Object.assign({}, ol_geom_js__WEBPACK_IMPORTED_MODULE_34__, {
        Polygon: ol_geom_Polygon_js__WEBPACK_IMPORTED_MODULE_35__
    }),
    interaction: nsInteraction,
    layer: ol_layer_js__WEBPACK_IMPORTED_MODULE_40__,
    proj: nsProj,
    source: ol_source_js__WEBPACK_IMPORTED_MODULE_44__,
    sphere: ol_sphere_js__WEBPACK_IMPORTED_MODULE_45__,
    style: nsStyle,
    tilegrid: {
        WMTS: ol_tilegrid_WMTS_js__WEBPACK_IMPORTED_MODULE_52__["default"]
    },
    loadingstrategy: ol_loadingstrategy__WEBPACK_IMPORTED_MODULE_36__
};
// dirty solution?
if (window.ol) {
    window.console.error('"ol" already exists');
} else {
    window.ol = ol;
}

/* harmony default export */ __webpack_exports__["default"] = (ol);

/***/ }),

/***/ 0:
/*!****************************!*\
  !*** multi ./src/entry.js ***!
  \****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(/*! ./src/entry.js */"./src/entry.js");


/***/ })

/******/ });
//# sourceMappingURL=ol-debug.js.map
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=3)}([function(t,e,r){t.exports=function(){"use strict";function t(t,n,i,o,a){!function t(r,n,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,u=n-i+1,l=Math.log(s),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(s-h)/s)*(u-s/2<0?-1:1),p=Math.max(i,Math.floor(n-u*h/s+c)),f=Math.min(o,Math.floor(n+(s-u)*h/s+c));t(r,n,p,f,a)}var d=r[n],_=i,g=o;for(e(r,i,n),a(r[o],d)>0&&e(r,i,o);_<g;){for(e(r,_,g),_++,g--;a(r[_],d)<0;)_++;for(;a(r[g],d)>0;)g--}0===a(r[i],d)?e(r,i,g):(g++,e(r,g,o)),g<=n&&(i=g+1),n<=g&&(o=g-1)}}(t,n,i||0,o||t.length-1,a||r)}function e(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function r(t,e){return t<e?-1:t>e?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n<e.length;n++)if(r(t,e[n]))return n;return-1}function o(t,e){a(t,0,t.children.length,e,t)}function a(t,e,r,n,i){i||(i=d(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<r;o++){var a=t.children[o];s(i,t.leaf?n(a):a)}return i}function s(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function u(t,e){return t.minX-e.minX}function l(t,e){return t.minY-e.minY}function h(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function c(t){return t.maxX-t.minX+(t.maxY-t.minY)}function p(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function f(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(e,r,n,i,o){for(var a=[r,n];a.length;)if(!((n=a.pop())-(r=a.pop())<=i)){var s=r+Math.ceil((n-r)/i/2)*i;t(e,s,r,n,o),a.push(r,s,s,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,r=[];if(!f(t,e))return r;for(var n=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],s=e.leaf?n(a):a;f(t,s)&&(e.leaf?r.push(a):p(t,s)?this._all(a,r):i.push(a))}e=i.pop()}return r},n.prototype.collides=function(t){var e=this.data;if(!f(t,e))return!1;for(var r=[];e;){for(var n=0;n<e.children.length;n++){var i=e.children[n],o=e.leaf?this.toBBox(i):i;if(f(t,o)){if(e.leaf||p(t,o))return!0;r.push(i)}}e=r.pop()}return!1},n.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var n=this.data;this.data=r,r=n}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},n.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},n.prototype.clear=function(){return this.data=d([]),this},n.prototype.remove=function(t,e){if(!t)return this;for(var r,n,o,a=this.data,s=this.toBBox(t),u=[],l=[];a||u.length;){if(a||(a=u.pop(),n=u[u.length-1],r=l.pop(),o=!0),a.leaf){var h=i(t,a.children,e);if(-1!==h)return a.children.splice(h,1),u.push(a),this._condense(u),this}o||a.leaf||!p(a,s)?n?(r++,a=n.children[r],o=!1):a=null:(u.push(a),l.push(r),r=0,n=a,a=a.children[0])}return this},n.prototype.toBBox=function(t){return t},n.prototype.compareMinX=function(t,e){return t.minX-e.minX},n.prototype.compareMinY=function(t,e){return t.minY-e.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(t){return this.data=t,this},n.prototype._all=function(t,e){for(var r=[];t;)t.leaf?e.push.apply(e,t.children):r.push.apply(r,t.children),t=r.pop();return e},n.prototype._build=function(t,e,r,n){var i,a=r-e+1,s=this._maxEntries;if(a<=s)return o(i=d(t.slice(e,r+1)),this.toBBox),i;n||(n=Math.ceil(Math.log(a)/Math.log(s)),s=Math.ceil(a/Math.pow(s,n-1))),(i=d([])).leaf=!1,i.height=n;var u=Math.ceil(a/s),l=u*Math.ceil(Math.sqrt(s));_(t,e,r,l,this.compareMinX);for(var h=e;h<=r;h+=l){var c=Math.min(h+l-1,r);_(t,h,c,u,this.compareMinY);for(var p=h;p<=c;p+=u){var f=Math.min(p+u-1,c);i.children.push(this._build(t,p,f,n-1))}}return o(i,this.toBBox),i},n.prototype._chooseSubtree=function(t,e,r,n){for(;n.push(e),!e.leaf&&n.length-1!==r;){for(var i=1/0,o=1/0,a=void 0,s=0;s<e.children.length;s++){var u=e.children[s],l=h(u),c=(p=t,f=u,(Math.max(f.maxX,p.maxX)-Math.min(f.minX,p.minX))*(Math.max(f.maxY,p.maxY)-Math.min(f.minY,p.minY))-l);c<o?(o=c,i=l<i?l:i,a=u):c===o&&l<i&&(i=l,a=u)}e=a||e.children[0]}var p,f;return e},n.prototype._insert=function(t,e,r){var n=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(n,this.data,e,i);for(o.children.push(t),s(o,n);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(n,i,e)},n.prototype._split=function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var a=this._chooseSplitIndex(r,i,n),s=d(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,o(r,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(r,s)},n.prototype._splitRoot=function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,r){for(var n,i,o,s,u,l,c,p=1/0,f=1/0,d=e;d<=r-e;d++){var _=a(t,0,d,this.toBBox),g=a(t,d,r,this.toBBox),y=(i=_,o=g,s=void 0,u=void 0,l=void 0,c=void 0,s=Math.max(i.minX,o.minX),u=Math.max(i.minY,o.minY),l=Math.min(i.maxX,o.maxX),c=Math.min(i.maxY,o.maxY),Math.max(0,l-s)*Math.max(0,c-u)),v=h(_)+h(g);y<p?(p=y,n=d,f=v<f?v:f):y===p&&v<f&&(f=v,n=d)}return n||r-e},n.prototype._chooseSplitAxis=function(t,e,r){var n=t.leaf?this.compareMinX:u,i=t.leaf?this.compareMinY:l;this._allDistMargin(t,e,r,n)<this._allDistMargin(t,e,r,i)&&t.children.sort(n)},n.prototype._allDistMargin=function(t,e,r,n){t.children.sort(n);for(var i=this.toBBox,o=a(t,0,e,i),u=a(t,r-e,r,i),l=c(o)+c(u),h=e;h<r-e;h++){var p=t.children[h];s(o,t.leaf?i(p):p),l+=c(o)}for(var f=r-e-1;f>=e;f--){var d=t.children[f];s(u,t.leaf?i(d):d),l+=c(u)}return l},n.prototype._adjustParentBBoxes=function(t,e,r){for(var n=r;n>=0;n--)s(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,r=void 0;e>=0;e--)0===t[e].children.length?e>0?(r=t[e-1].children).splice(r.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},n}()},function(t,e){var r=null,n=null;function i(t,e,r){t.addEventListener(e,(function(t){var i=new MouseEvent(r,t);i.pointerId=1,i.isPrimary=!0,i.pointerType="mouse",i.width=1,i.height=1,i.tiltX=0,i.tiltY=0,"buttons"in t&&0!==t.buttons?i.pressure=.5:i.pressure=0;var o=t.target;null!==n&&(o=n,"mouseup"===e&&(n=null)),o.dispatchEvent(i),i.defaultPrevented&&t.preventDefault()}))}function o(t,e,n){t.addEventListener(e,(function(t){for(var i=t.changedTouches,o=i.length,a=0;a<o;a++){var s=new CustomEvent(n,{bubbles:!0,cancelable:!0});s.ctrlKey=t.ctrlKey,s.shiftKey=t.shiftKey,s.altKey=t.altKey,s.metaKey=t.metaKey;var u=i.item(a);s.clientX=u.clientX,s.clientY=u.clientY,s.screenX=u.screenX,s.screenY=u.screenY,s.pageX=u.pageX,s.pageY=u.pageY;var l=u.target.getBoundingClientRect();s.offsetX=u.clientX-l.left,s.offsetY=u.clientY-l.top,s.pointerId=1+u.identifier,s.button=0,s.buttons=1,s.movementX=0,s.movementY=0,s.region=null,s.relatedTarget=null,s.x=s.clientX,s.y=s.clientY,s.pointerType="touch",s.width=1,s.height=1,s.tiltX=0,s.tiltY=0,s.pressure=1,"touchstart"===e&&null===r&&(r=u.identifier),s.isPrimary=u.identifier===r,"touchend"===e&&s.isPrimary&&(r=null),t.target.dispatchEvent(s),s.defaultPrevented&&t.preventDefault()}}))}"PointerEvent"in window||(Element.prototype.setPointerCapture=Element.prototype.setCapture,Element.prototype.releasePointerCapture=Element.prototype.releaseCapture,"TouchEvent"in window||(i(document,"mousedown","pointerdown"),i(document,"mousemove","pointermove"),i(document,"mouseup","pointerup")),o(document,"touchstart","pointerdown"),o(document,"touchmove","pointermove"),o(document,"touchend","pointerup"))},function(t,e,r){var n=r(4);e.Processor=n},function(t,e,r){t.exports=r(6)},function(t,e,r){var n=r(5).newImageData;function i(t){var e=!0;try{new ImageData(10,10)}catch(t){e=!1}function r(t,r,n){return e?new ImageData(t,r,n):{data:t,width:r,height:n}}return function(e){var n,i,o=e.buffers,a=e.meta,s=e.imageOps,u=e.width,l=e.height,h=o.length,c=o[0].byteLength;if(s){var p=new Array(h);for(i=0;i<h;++i)p[i]=r(new Uint8ClampedArray(o[i]),u,l);n=t(p,a).data}else{n=new Uint8ClampedArray(c);var f=new Array(h),d=new Array(h);for(i=0;i<h;++i)f[i]=new Uint8ClampedArray(o[i]),d[i]=[0,0,0,0];for(var _=0;_<c;_+=4){for(var g=0;g<h;++g){var y=f[g];d[g][0]=y[_],d[g][1]=y[_+1],d[g][2]=y[_+2],d[g][3]=y[_+3]}var v=t(d,a);n[_]=v[0],n[_+1]=v[1],n[_+2]=v[2],n[_+3]=v[3]}}return n.buffer}}function o(t,e){var r=Object.keys(t.lib||{}).map((function(e){return"var "+e+" = "+t.lib[e].toString()+";"})).concat(["var __minion__ = ("+i.toString()+")(",t.operation.toString(),");",'self.addEventListener("message", function(event) {',"  var buffer = __minion__(event.data);","  self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),n=new Blob(r,{type:"text/javascript"}),o=URL.createObjectURL(n),a=new Worker(o);return a.addEventListener("message",e),a}function a(t){var e;this._imageOps=!!t.imageOps;var r=[];if(e=0===t.threads?0:this._imageOps?1:t.threads||1)for(var n=0;n<e;++n)r[n]=o(t,this._onWorkerMessage.bind(this,n));else r[0]=function(t,e){var r=i(t.operation);return{postMessage:function(t){setTimeout((function(){e({data:{buffer:r(t),meta:t.meta}})}),0)}}}(t,this._onWorkerMessage.bind(this,0));this._workers=r,this._queue=[],this._maxQueueLength=t.queue||1/0,this._running=0,this._dataLookup={},this._job=null}a.prototype.process=function(t,e,r){this._enqueue({inputs:t,meta:e,callback:r}),this._dispatch()},a.prototype.destroy=function(){for(var t in this)this[t]=null;this._destroyed=!0},a.prototype._enqueue=function(t){for(this._queue.push(t);this._queue.length>this._maxQueueLength;)this._queue.shift().callback(null,null)},a.prototype._dispatch=function(){if(0===this._running&&this._queue.length>0){var t=this._job=this._queue.shift(),e=t.inputs[0].width,r=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),i=this._workers.length;if(this._running=i,1===i)this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:r},n);else for(var o=t.inputs[0].data.length,a=4*Math.ceil(o/4/i),s=0;s<i;++s){for(var u=s*a,l=[],h=0,c=n.length;h<c;++h)l.push(n[s].slice(u,u+a));this._workers[s].postMessage({buffers:l,meta:t.meta,imageOps:this._imageOps,width:e,height:r},l)}}},a.prototype._onWorkerMessage=function(t,e){this._destroyed||(this._dataLookup[t]=e.data,--this._running,0===this._running&&this._resolveJob())},a.prototype._resolveJob=function(){var t,e,r=this._job,i=this._workers.length;if(1===i)t=new Uint8ClampedArray(this._dataLookup[0].buffer),e=this._dataLookup[0].meta;else{var o=r.inputs[0].data.length;t=new Uint8ClampedArray(o),e=new Array(o);for(var a=4*Math.ceil(o/4/i),s=0;s<i;++s){var u=this._dataLookup[s].buffer,l=s*a;t.set(new Uint8ClampedArray(u),l),e[s]=this._dataLookup[s].meta}}this._job=null,this._dataLookup={},r.callback(null,n(t,r.inputs[0].width,r.inputs[0].height),e),this._dispatch()},t.exports=a},function(t,e){var r=!0;try{new ImageData(10,10)}catch(t){r=!1}var n=document.createElement("canvas").getContext("2d");e.newImageData=function(t,e,i){if(r)return new ImageData(t,e,i);var o=n.createImageData(e,i);return o.data.set(t),o}},function(t,e,r){"use strict";r.r(e);var n={};r.r(n),r.d(n,"listen",(function(){return M})),r.d(n,"listenOnce",(function(){return A})),r.d(n,"unlistenByKey",(function(){return N}));var i={};r.r(i),r.d(i,"stopPropagation",(function(){return W})),r.d(i,"preventDefault",(function(){return Z})),r.d(i,"default",(function(){return K}));var o={};r.r(o),r.d(o,"boundingExtent",(function(){return Gt})),r.d(o,"buffer",(function(){return jt})),r.d(o,"clone",(function(){return Dt})),r.d(o,"closestSquaredDistanceXY",(function(){return kt})),r.d(o,"containsCoordinate",(function(){return Ut})),r.d(o,"containsExtent",(function(){return zt})),r.d(o,"containsXY",(function(){return Bt})),r.d(o,"coordinateRelationship",(function(){return Yt})),r.d(o,"createEmpty",(function(){return Xt})),r.d(o,"createOrUpdate",(function(){return Vt})),r.d(o,"createOrUpdateEmpty",(function(){return Wt})),r.d(o,"createOrUpdateFromCoordinate",(function(){return Zt})),r.d(o,"createOrUpdateFromCoordinates",(function(){return Kt})),r.d(o,"createOrUpdateFromFlatCoordinates",(function(){return qt})),r.d(o,"createOrUpdateFromRings",(function(){return Ht})),r.d(o,"equals",(function(){return Jt})),r.d(o,"approximatelyEquals",(function(){return Qt})),r.d(o,"extend",(function(){return $t})),r.d(o,"extendCoordinate",(function(){return te})),r.d(o,"extendCoordinates",(function(){return ee})),r.d(o,"extendFlatCoordinates",(function(){return re})),r.d(o,"extendRings",(function(){return ne})),r.d(o,"extendXY",(function(){return ie})),r.d(o,"forEachCorner",(function(){return oe})),r.d(o,"getArea",(function(){return ae})),r.d(o,"getBottomLeft",(function(){return se})),r.d(o,"getBottomRight",(function(){return ue})),r.d(o,"getCenter",(function(){return le})),r.d(o,"getCorner",(function(){return he})),r.d(o,"getEnlargedArea",(function(){return ce})),r.d(o,"getForViewAndSize",(function(){return pe})),r.d(o,"getHeight",(function(){return fe})),r.d(o,"getIntersectionArea",(function(){return de})),r.d(o,"getIntersection",(function(){return _e})),r.d(o,"getMargin",(function(){return ge})),r.d(o,"getSize",(function(){return ye})),r.d(o,"getTopLeft",(function(){return ve})),r.d(o,"getTopRight",(function(){return me})),r.d(o,"getWidth",(function(){return xe})),r.d(o,"intersects",(function(){return Ee})),r.d(o,"isEmpty",(function(){return Se})),r.d(o,"returnOrUpdate",(function(){return we})),r.d(o,"scaleFromCenter",(function(){return Te})),r.d(o,"intersectsSegment",(function(){return Ce})),r.d(o,"applyTransform",(function(){return Re})),r.d(o,"wrapX",(function(){return be}));var a={};r.r(a),r.d(a,"DEFAULT_RADIUS",(function(){return Xe})),r.d(a,"getDistance",(function(){return Ve})),r.d(a,"getLength",(function(){return Ze})),r.d(a,"getArea",(function(){return qe})),r.d(a,"offset",(function(){return He}));var s={};r.r(s),r.d(s,"METERS_PER_UNIT",(function(){return Qe})),r.d(s,"Projection",(function(){return tr})),r.d(s,"cloneTransform",(function(){return vr})),r.d(s,"identityTransform",(function(){return mr})),r.d(s,"addProjection",(function(){return xr})),r.d(s,"addProjections",(function(){return Er})),r.d(s,"get",(function(){return Sr})),r.d(s,"getPointResolution",(function(){return wr})),r.d(s,"addEquivalentProjections",(function(){return Tr})),r.d(s,"addEquivalentTransforms",(function(){return Cr})),r.d(s,"clearAllProjections",(function(){return Rr})),r.d(s,"createProjection",(function(){return br})),r.d(s,"createTransformFromCoordinateTransform",(function(){return Pr})),r.d(s,"addCoordinateTransforms",(function(){return Or})),r.d(s,"fromLonLat",(function(){return Ir})),r.d(s,"toLonLat",(function(){return Lr})),r.d(s,"equivalent",(function(){return Fr})),r.d(s,"getTransformFromProjections",(function(){return Mr})),r.d(s,"getTransform",(function(){return Ar})),r.d(s,"transform",(function(){return Nr})),r.d(s,"transformExtent",(function(){return Gr})),r.d(s,"transformWithProjections",(function(){return jr})),r.d(s,"setUserProjection",(function(){return kr})),r.d(s,"clearUserProjection",(function(){return Ur})),r.d(s,"getUserProjection",(function(){return zr})),r.d(s,"useGeographic",(function(){return Br})),r.d(s,"toUserCoordinate",(function(){return Yr})),r.d(s,"fromUserCoordinate",(function(){return Xr})),r.d(s,"toUserExtent",(function(){return Vr})),r.d(s,"fromUserExtent",(function(){return Wr})),r.d(s,"addCommon",(function(){return Zr}));var u={};r.r(u),r.d(u,"default",(function(){return Wn})),r.d(u,"circular",(function(){return Zn})),r.d(u,"fromExtent",(function(){return Kn})),r.d(u,"fromCircle",(function(){return qn})),r.d(u,"makeRegular",(function(){return Hn}));var l={};r.r(l),r.d(l,"add",(function(){return qo})),r.d(l,"closestOnCircle",(function(){return Ho})),r.d(l,"closestOnSegment",(function(){return Jo})),r.d(l,"createStringXY",(function(){return Qo})),r.d(l,"degreesToStringHDMS",(function(){return $o})),r.d(l,"format",(function(){return ta})),r.d(l,"equals",(function(){return ea})),r.d(l,"rotate",(function(){return ra})),r.d(l,"scale",(function(){return na})),r.d(l,"squaredDistance",(function(){return ia})),r.d(l,"distance",(function(){return oa})),r.d(l,"squaredDistanceToSegment",(function(){return aa})),r.d(l,"toStringHDMS",(function(){return sa})),r.d(l,"toStringXY",(function(){return ua})),r.d(l,"wrapX",(function(){return la}));var h={};r.r(h),r.d(h,"all",(function(){return Ws})),r.d(h,"bbox",(function(){return Zs})),r.d(h,"tile",(function(){return Ks}));var c={};r.r(c),r.d(c,"Attribution",(function(){return wl})),r.d(c,"Control",(function(){return xl})),r.d(c,"FullScreen",(function(){return Gl})),r.d(c,"MousePosition",(function(){return kl})),r.d(c,"OverviewMap",(function(){return hh})),r.d(c,"Rotate",(function(){return Rl})),r.d(c,"ScaleLine",(function(){return mh})),r.d(c,"Zoom",(function(){return Pl})),r.d(c,"ZoomSlider",(function(){return Th})),r.d(c,"ZoomToExtent",(function(){return Rh})),r.d(c,"defaults",(function(){return bh}));var p={};r.r(p),r.d(p,"altKeyOnly",(function(){return Nh})),r.d(p,"altShiftKeysOnly",(function(){return Gh})),r.d(p,"focus",(function(){return jh})),r.d(p,"always",(function(){return Dh})),r.d(p,"click",(function(){return kh})),r.d(p,"mouseActionButton",(function(){return Uh})),r.d(p,"never",(function(){return zh})),r.d(p,"pointerMove",(function(){return Bh})),r.d(p,"singleClick",(function(){return Yh})),r.d(p,"doubleClick",(function(){return Xh})),r.d(p,"noModifierKeys",(function(){return Vh})),r.d(p,"platformModifierKeyOnly",(function(){return Wh})),r.d(p,"shiftKeyOnly",(function(){return Zh})),r.d(p,"targetNotEditable",(function(){return Kh})),r.d(p,"mouseOnly",(function(){return qh})),r.d(p,"touchOnly",(function(){return Hh})),r.d(p,"penOnly",(function(){return Jh})),r.d(p,"primaryAction",(function(){return Qh}));var f={};r.r(f),r.d(f,"DoubleClickZoom",(function(){return Ah})),r.d(f,"DragAndDrop",(function(){return zc})),r.d(f,"DragBox",(function(){return dc})),r.d(f,"DragPan",(function(){return ic})),r.d(f,"DragRotate",(function(){return ac})),r.d(f,"DragRotateAndZoom",(function(){return Yc})),r.d(f,"DragZoom",(function(){return yc})),r.d(f,"Draw",(function(){return up})),r.d(f,"Extent",(function(){return _p})),r.d(f,"Interaction",(function(){return Lh})),r.d(f,"KeyboardPan",(function(){return Tc})),r.d(f,"KeyboardZoom",(function(){return bc})),r.d(f,"Modify",(function(){return Cp})),r.d(f,"MouseWheelZoom",(function(){return Lc})),r.d(f,"PinchRotate",(function(){return Mc})),r.d(f,"PinchZoom",(function(){return Nc})),r.d(f,"Pointer",(function(){return ec})),r.d(f,"Select",(function(){return Lp})),r.d(f,"Snap",(function(){return Np})),r.d(f,"Translate",(function(){return zp})),r.d(f,"defaults",(function(){return Bp}));var d={};r.r(d),r.d(d,"Circle",(function(){return Wc})),r.d(d,"Geometry",(function(){return an})),r.d(d,"GeometryCollection",(function(){return hf})),r.d(d,"LineString",(function(){return Ds})),r.d(d,"MultiLineString",(function(){return Kc})),r.d(d,"MultiPoint",(function(){return Hc})),r.d(d,"MultiPolygon",(function(){return Qc})),r.d(d,"Point",(function(){return Ln})),r.d(d,"Polygon",(function(){return Wn})),r.d(d,"LinearRing",(function(){return On}));var _={};r.r(_),r.d(_,"Group",(function(){return fl})),r.d(_,"Heatmap",(function(){return fv})),r.d(_,"Image",(function(){return mv})),r.d(_,"Layer",(function(){return Fi})),r.d(_,"Tile",(function(){return Pv})),r.d(_,"Vector",(function(){return Ms})),r.d(_,"VectorImage",(function(){return Fv})),r.d(_,"VectorTile",(function(){return zv}));var g={};r.r(g),r.d(g,"register",(function(){return Bv}));var y={};r.r(y),r.d(y,"BingMaps",(function(){return Em})),r.d(y,"CartoDB",(function(){return Cm})),r.d(y,"Cluster",(function(){return bm})),r.d(y,"IIIF",(function(){return Ym})),r.d(y,"Image",(function(){return Qm})),r.d(y,"ImageArcGISRest",(function(){return ex})),r.d(y,"ImageCanvas",(function(){return nx})),r.d(y,"ImageMapGuide",(function(){return ox})),r.d(y,"ImageStatic",(function(){return sx})),r.d(y,"ImageWMS",(function(){return dx})),r.d(y,"OSM",(function(){return yx})),r.d(y,"Raster",(function(){return Ox})),r.d(y,"Source",(function(){return Js})),r.d(y,"Stamen",(function(){return Ax})),r.d(y,"Tile",(function(){return cm})),r.d(y,"TileArcGISRest",(function(){return jx})),r.d(y,"TileDebug",(function(){return Ux})),r.d(y,"TileImage",(function(){return mm})),r.d(y,"TileJSON",(function(){return Bx})),r.d(y,"TileWMS",(function(){return Vx})),r.d(y,"UrlTile",(function(){return gm})),r.d(y,"UTFGrid",(function(){return Kx})),r.d(y,"Vector",(function(){return ou})),r.d(y,"VectorTile",(function(){return Hx})),r.d(y,"WMTS",(function(){return nE})),r.d(y,"XYZ",(function(){return wm})),r.d(y,"Zoomify",(function(){return Fm}));var v={};r.r(v),r.d(v,"Circle",(function(){return Mo})),r.d(v,"Fill",(function(){return Ao})),r.d(v,"Icon",(function(){return bs})),r.d(v,"IconImage",(function(){return Ts})),r.d(v,"Image",(function(){return Oo})),r.d(v,"RegularShape",(function(){return Lo})),r.d(v,"Stroke",(function(){return No})),r.d(v,"Style",(function(){return zo})),r.d(v,"Text",(function(){return As}));var m={};function x(){return function(){throw new Error("Unimplemented abstract method.")}()}r.r(m),r.d(m,"ValueTypes",(function(){return oE})),r.d(m,"Operators",(function(){return aE})),r.d(m,"getValueType",(function(){return sE})),r.d(m,"isTypeUnique",(function(){return uE})),r.d(m,"numberToGlsl",(function(){return lE})),r.d(m,"arrayToGlsl",(function(){return hE})),r.d(m,"colorToGlsl",(function(){return cE})),r.d(m,"getStringNumberEquivalent",(function(){return pE})),r.d(m,"stringToGlsl",(function(){return fE})),r.d(m,"expressionToGlsl",(function(){return dE}));var E=0;function S(t){return t.ol_uid||(t.ol_uid=String(++E))}var w,T=(w=function(t,e){return(w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),C=function(t){function e(e){var r=this,n="Assertion failed. See https://openlayers.org/en/"+("v"+"6.3.1".split("-")[0])+"/doc/errors/#"+e+" for details.";return(r=t.call(this,n)||this).code=e,r.name="AssertionError",r.message=n,r}return T(e,t),e}(Error),R="add",b="remove",P="propertychange",O="function"==typeof Object.assign?Object.assign:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),n=1,i=arguments.length;n<i;++n){var o=arguments[n];if(null!=o)for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a])}return r};function I(t){for(var e in t)delete t[e]}var L="function"==typeof Object.values?Object.values:function(t){var e=[];for(var r in t)e.push(t[r]);return e};function F(t){var e;for(e in t)return!1;return!e}function M(t,e,r,n,i){if(n&&n!==t&&(r=r.bind(n)),i){var o=r;r=function(){t.removeEventListener(e,r),o.apply(this,arguments)}}var a={target:t,type:e,listener:r};return t.addEventListener(e,r),a}function A(t,e,r,n){return M(t,e,r,n,!0)}function N(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),I(t))}var G=function(){function t(){this.disposed_=!1}return t.prototype.dispose=function(){this.disposed_||(this.disposed_=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function j(t,e){return t>e?1:t<e?-1:0}function D(t,e){return t.indexOf(e)>=0}function k(t,e,r){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var i=void 0;if(r>0){for(i=1;i<n;++i)if(t[i]<e)return i-1}else if(r<0){for(i=1;i<n;++i)if(t[i]<=e)return i}else for(i=1;i<n;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return n-1}function U(t,e,r){for(;e<r;){var n=t[e];t[e]=t[r],t[r]=n,++e,--r}}function z(t,e){for(var r=Array.isArray(e)?e:[e],n=r.length,i=0;i<n;i++)t[t.length]=r[i]}function B(t,e){var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Y(){return!0}function X(){return!1}function V(){}function W(t){t.stopPropagation()}function Z(t){t.preventDefault()}var K=function(){function t(t){this.propagationStopped,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.propagationStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),q=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),H=function(t){function e(e){var r=t.call(this)||this;return r.eventTarget_=e,r.pendingRemovals_={},r.dispatching_={},r.listeners_={},r}return q(e,t),e.prototype.addEventListener=function(t,e){if(t&&e){var r=this.listeners_[t];r||(r=[],this.listeners_[t]=r),-1===r.indexOf(e)&&r.push(e)}},e.prototype.dispatchEvent=function(t){var e="string"==typeof t?new K(t):t,r=e.type;e.target||(e.target=this.eventTarget_||this);var n,i=this.listeners_[r];if(i){r in this.dispatching_||(this.dispatching_[r]=0,this.pendingRemovals_[r]=0),++this.dispatching_[r];for(var o=0,a=i.length;o<a;++o)if(!1===(n="handleEvent"in i[o]?i[o].handleEvent(e):i[o].call(this,e))||e.propagationStopped){n=!1;break}if(--this.dispatching_[r],0===this.dispatching_[r]){var s=this.pendingRemovals_[r];for(delete this.pendingRemovals_[r];s--;)this.removeEventListener(r,V);delete this.dispatching_[r]}return n}},e.prototype.disposeInternal=function(){I(this.listeners_)},e.prototype.getListeners=function(t){return this.listeners_[t]},e.prototype.hasListener=function(t){return t?t in this.listeners_:Object.keys(this.listeners_).length>0},e.prototype.removeEventListener=function(t,e){var r=this.listeners_[t];if(r){var n=r.indexOf(e);-1!==n&&(t in this.pendingRemovals_?(r[n]=V,++this.pendingRemovals_[t]):(r.splice(n,1),0===r.length&&delete this.listeners_[t]))}},e}(G),J="change",Q="error",$="contextmenu",tt="click",et="dblclick",rt="dragenter",nt="dragover",it="drop",ot="keydown",at="keypress",st="load",ut="resize",lt="touchmove",ht="wheel",ct=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var pt=function(t){function e(){var e=t.call(this)||this;return e.revision_=0,e}return ct(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(J)},e.prototype.getRevision=function(){return this.revision_},e.prototype.on=function(t,e){if(Array.isArray(t)){for(var r=t.length,n=new Array(r),i=0;i<r;++i)n[i]=M(this,t[i],e);return n}return M(this,t,e)},e.prototype.once=function(t,e){if(Array.isArray(t)){for(var r=t.length,n=new Array(r),i=0;i<r;++i)n[i]=A(this,t[i],e);return n}return A(this,t,e)},e.prototype.un=function(t,e){if(Array.isArray(t))for(var r=0,n=t.length;r<n;++r)this.removeEventListener(t[r],e);else this.removeEventListener(t,e)},e}(H),ft=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dt=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.key=r,i.oldValue=n,i}return ft(e,t),e}(K),_t=function(t){function e(e){var r=t.call(this)||this;return S(r),r.values_={},void 0!==e&&r.setProperties(e),r}return ft(e,t),e.prototype.get=function(t){var e;return this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e},e.prototype.getKeys=function(){return Object.keys(this.values_)},e.prototype.getProperties=function(){return O({},this.values_)},e.prototype.notify=function(t,e){var r;r=yt(t),this.dispatchEvent(new dt(r,t,e)),r=P,this.dispatchEvent(new dt(r,t,e))},e.prototype.set=function(t,e,r){if(r)this.values_[t]=e;else{var n=this.values_[t];this.values_[t]=e,n!==e&&this.notify(t,n)}},e.prototype.setProperties=function(t,e){for(var r in t)this.set(r,t[r],e)},e.prototype.unset=function(t,e){if(t in this.values_){var r=this.values_[t];delete this.values_[t],e||this.notify(t,r)}},e}(pt),gt={};function yt(t){return gt.hasOwnProperty(t)?gt[t]:gt[t]="change:"+t}var vt=_t,mt=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xt="length",Et=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.element=r,i.index=n,i}return mt(e,t),e}(K),St=function(t){function e(e,r){var n=t.call(this)||this,i=r||{};if(n.unique_=!!i.unique,n.array_=e||[],n.unique_)for(var o=0,a=n.array_.length;o<a;++o)n.assertUnique_(n.array_[o],o);return n.updateLength_(),n}return mt(e,t),e.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},e.prototype.extend=function(t){for(var e=0,r=t.length;e<r;++e)this.push(t[e]);return this},e.prototype.forEach=function(t){for(var e=this.array_,r=0,n=e.length;r<n;++r)t(e[r],r,e)},e.prototype.getArray=function(){return this.array_},e.prototype.item=function(t){return this.array_[t]},e.prototype.getLength=function(){return this.get(xt)},e.prototype.insertAt=function(t,e){this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Et(R,e,t))},e.prototype.pop=function(){return this.removeAt(this.getLength()-1)},e.prototype.push=function(t){this.unique_&&this.assertUnique_(t);var e=this.getLength();return this.insertAt(e,t),this.getLength()},e.prototype.remove=function(t){for(var e=this.array_,r=0,n=e.length;r<n;++r)if(e[r]===t)return this.removeAt(r)},e.prototype.removeAt=function(t){var e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Et(b,e,t)),e},e.prototype.setAt=function(t,e){var r=this.getLength();if(t<r){this.unique_&&this.assertUnique_(e,t);var n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Et(b,n,t)),this.dispatchEvent(new Et(R,e,t))}else{for(var i=r;i<t;++i)this.insertAt(i,void 0);this.insertAt(t,e)}},e.prototype.updateLength_=function(){this.set(xt,this.array_.length)},e.prototype.assertUnique_=function(t,e){for(var r=0,n=this.array_.length;r<n;++r)if(this.array_[r]===t&&r!==e)throw new C(58)},e}(vt);function wt(t,e){if(!t)throw new C(e)}var Tt=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Ct=function(t){function e(e){var r=t.call(this)||this;if(r.id_=void 0,r.geometryName_="geometry",r.style_=null,r.styleFunction_=void 0,r.geometryChangeKey_=null,r.addEventListener(yt(r.geometryName_),r.handleGeometryChanged_),e)if("function"==typeof e.getSimplifiedGeometry){var n=e;r.setGeometry(n)}else{var i=e;r.setProperties(i)}return r}return Tt(e,t),e.prototype.clone=function(){var t=new e(this.getProperties());t.setGeometryName(this.getGeometryName());var r=this.getGeometry();r&&t.setGeometry(r.clone());var n=this.getStyle();return n&&t.setStyle(n),t},e.prototype.getGeometry=function(){return this.get(this.geometryName_)},e.prototype.getId=function(){return this.id_},e.prototype.getGeometryName=function(){return this.geometryName_},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.handleGeometryChange_=function(){this.changed()},e.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(N(this.geometryChangeKey_),this.geometryChangeKey_=null);var t=this.getGeometry();t&&(this.geometryChangeKey_=M(t,J,this.handleGeometryChange_,this)),this.changed()},e.prototype.setGeometry=function(t){this.set(this.geometryName_,t)},e.prototype.setStyle=function(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;var e;Array.isArray(t)?e=t:(wt("function"==typeof t.getZIndex,41),e=[t]);return function(){return e}}(t):void 0,this.changed()},e.prototype.setId=function(t){this.id_=t,this.changed()},e.prototype.setGeometryName=function(t){this.removeEventListener(yt(this.geometryName_),this.handleGeometryChanged_),this.geometryName_=t,this.addEventListener(yt(this.geometryName_),this.handleGeometryChanged_),this.handleGeometryChanged_()},e}(vt),Rt="bottom-left",bt="bottom-right",Pt="top-left",Ot="top-right",It=0,Lt=1,Ft=2,Mt=4,At=8,Nt=16;function Gt(t){for(var e=Xt(),r=0,n=t.length;r<n;++r)te(e,t[r]);return e}function jt(t,e,r){return r?(r[0]=t[0]-e,r[1]=t[1]-e,r[2]=t[2]+e,r[3]=t[3]+e,r):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function Dt(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function kt(t,e,r){var n,i;return(n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0)*n+(i=r<t[1]?t[1]-r:t[3]<r?r-t[3]:0)*i}function Ut(t,e){return Bt(t,e[0],e[1])}function zt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Bt(t,e,r){return t[0]<=e&&e<=t[2]&&t[1]<=r&&r<=t[3]}function Yt(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=e[0],s=e[1],u=It;return a<r?u|=Nt:a>i&&(u|=Mt),s<n?u|=At:s>o&&(u|=Ft),u===It&&(u=Lt),u}function Xt(){return[1/0,1/0,-1/0,-1/0]}function Vt(t,e,r,n,i){return i?(i[0]=t,i[1]=e,i[2]=r,i[3]=n,i):[t,e,r,n]}function Wt(t){return Vt(1/0,1/0,-1/0,-1/0,t)}function Zt(t,e){var r=t[0],n=t[1];return Vt(r,n,r,n,e)}function Kt(t,e){return ee(Wt(e),t)}function qt(t,e,r,n,i){return re(Wt(i),t,e,r,n)}function Ht(t,e){return ne(Wt(e),t)}function Jt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Qt(t,e,r){return Math.abs(t[0]-e[0])<r&&Math.abs(t[2]-e[2])<r&&Math.abs(t[1]-e[1])<r&&Math.abs(t[3]-e[3])<r}function $t(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function te(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function ee(t,e){for(var r=0,n=e.length;r<n;++r)te(t,e[r]);return t}function re(t,e,r,n,i){for(;r<n;r+=i)ie(t,e[r],e[r+1]);return t}function ne(t,e){for(var r=0,n=e.length;r<n;++r)ee(t,e[r]);return t}function ie(t,e,r){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],r),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],r)}function oe(t,e){var r;return(r=e(se(t)))||(r=e(ue(t)))||(r=e(me(t)))?r:(r=e(ve(t)))||!1}function ae(t){var e=0;return Se(t)||(e=xe(t)*fe(t)),e}function se(t){return[t[0],t[1]]}function ue(t){return[t[2],t[1]]}function le(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function he(t,e){var r;return e===Rt?r=se(t):e===bt?r=ue(t):e===Pt?r=ve(t):e===Ot?r=me(t):wt(!1,13),r}function ce(t,e){var r=Math.min(t[0],e[0]),n=Math.min(t[1],e[1]);return(Math.max(t[2],e[2])-r)*(Math.max(t[3],e[3])-n)}function pe(t,e,r,n,i){var o=e*n[0]/2,a=e*n[1]/2,s=Math.cos(r),u=Math.sin(r),l=o*s,h=o*u,c=a*s,p=a*u,f=t[0],d=t[1],_=f-l+p,g=f-l-p,y=f+l-p,v=f+l+p,m=d-h-c,x=d-h+c,E=d+h+c,S=d+h-c;return Vt(Math.min(_,g,y,v),Math.min(m,x,E,S),Math.max(_,g,y,v),Math.max(m,x,E,S),i)}function fe(t){return t[3]-t[1]}function de(t,e){return ae(_e(t,e))}function _e(t,e,r){var n=r||[1/0,1/0,-1/0,-1/0];return Ee(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):Wt(n),n}function ge(t){return xe(t)+fe(t)}function ye(t){return[t[2]-t[0],t[3]-t[1]]}function ve(t){return[t[0],t[3]]}function me(t){return[t[2],t[3]]}function xe(t){return t[2]-t[0]}function Ee(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Se(t){return t[2]<t[0]||t[3]<t[1]}function we(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}function Te(t,e){var r=(t[2]-t[0])/2*(e-1),n=(t[3]-t[1])/2*(e-1);t[0]-=r,t[2]+=r,t[1]-=n,t[3]+=n}function Ce(t,e,r){var n=!1,i=Yt(t,e),o=Yt(t,r);if(i===Lt||o===Lt)n=!0;else{var a=t[0],s=t[1],u=t[2],l=t[3],h=e[0],c=e[1],p=r[0],f=r[1],d=(f-c)/(p-h),_=void 0,g=void 0;o&Ft&&!(i&Ft)&&(n=(_=p-(f-l)/d)>=a&&_<=u),n||!(o&Mt)||i&Mt||(n=(g=f-(p-u)*d)>=s&&g<=l),n||!(o&At)||i&At||(n=(_=p-(f-s)/d)>=a&&_<=u),n||!(o&Nt)||i&Nt||(n=(g=f-(p-a)*d)>=s&&g<=l)}return n}function Re(t,e,r,n){var i=[];if(n>1)for(var o=t[2]-t[0],a=t[3]-t[1],s=0;s<n;++s)i.push(t[0]+o*s/n,t[1],t[2],t[1]+a*s/n,t[2]-o*s/n,t[3],t[0],t[3]-a*s/n);else i=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(i,i,2);for(var u=[],l=[],h=(s=0,i.length);s<h;s+=2)u.push(i[s]),l.push(i[s+1]);return function(t,e,r){return Vt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),r)}(u,l,r)}function be(t,e){var r=e.getExtent(),n=le(t);if(e.canWrapX()&&(n[0]<r[0]||n[0]>=r[2])){var i=xe(r),o=Math.floor((n[0]-r[0])/i)*i;t[0]-=o,t[2]-=o}return t}var Pe="XY",Oe="XYZ",Ie="XYM",Le="XYZM",Fe={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"};function Me(t,e,r,n,i,o){for(var a=o||[],s=0,u=e;u<r;u+=n){var l=t[u],h=t[u+1];a[s++]=i[0]*l+i[2]*h+i[4],a[s++]=i[1]*l+i[3]*h+i[5]}return o&&a.length!=s&&(a.length=s),a}function Ae(t,e,r,n,i,o,a){for(var s=a||[],u=Math.cos(i),l=Math.sin(i),h=o[0],c=o[1],p=0,f=e;f<r;f+=n){var d=t[f]-h,_=t[f+1]-c;s[p++]=h+d*u-_*l,s[p++]=c+d*l+_*u;for(var g=f+2;g<f+n;++g)s[p++]=t[g]}return a&&s.length!=p&&(s.length=p),s}function Ne(t,e,r,n,i,o,a){for(var s=a||[],u=0,l=e;l<r;l+=n){s[u++]=t[l]+i,s[u++]=t[l+1]+o;for(var h=l+2;h<l+n;++h)s[u++]=t[h]}return a&&s.length!=u&&(s.length=u),s}function Ge(t,e,r){return Math.min(Math.max(t,e),r)}var je="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2};function De(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var u=((t-r)*a+(e-n)*s)/(a*a+s*s);u>1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return ke(t,e,r,n)}function ke(t,e,r,n){var i=r-t,o=n-e;return i*i+o*o}function Ue(t){return 180*t/Math.PI}function ze(t){return t*Math.PI/180}function Be(t,e){var r=t%e;return r*e<0?r+e:r}function Ye(t,e,r){return t+r*(e-t)}var Xe=6371008.8;function Ve(t,e,r){var n=r||Xe,i=ze(t[1]),o=ze(e[1]),a=(o-i)/2,s=ze(e[0]-t[0])/2,u=Math.sin(a)*Math.sin(a)+Math.sin(s)*Math.sin(s)*Math.cos(i)*Math.cos(o);return 2*n*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))}function We(t,e){for(var r=0,n=0,i=t.length;n<i-1;++n)r+=Ve(t[n],t[n+1],e);return r}function Ze(t,e){var r=e||{},n=r.radius||Xe,i=r.projection||"EPSG:3857",o=t.getType();o!==Fe.GEOMETRY_COLLECTION&&(t=t.clone().transform(i,"EPSG:4326"));var a,s,u,l,h,c,p=0;switch(o){case Fe.POINT:case Fe.MULTI_POINT:break;case Fe.LINE_STRING:case Fe.LINEAR_RING:p=We(a=t.getCoordinates(),n);break;case Fe.MULTI_LINE_STRING:case Fe.POLYGON:for(u=0,l=(a=t.getCoordinates()).length;u<l;++u)p+=We(a[u],n);break;case Fe.MULTI_POLYGON:for(u=0,l=(a=t.getCoordinates()).length;u<l;++u)for(h=0,c=(s=a[u]).length;h<c;++h)p+=We(s[h],n);break;case Fe.GEOMETRY_COLLECTION:var f=t.getGeometries();for(u=0,l=f.length;u<l;++u)p+=Ze(f[u],e);break;default:throw new Error("Unsupported geometry type: "+o)}return p}function Ke(t,e){for(var r=0,n=t.length,i=t[n-1][0],o=t[n-1][1],a=0;a<n;a++){var s=t[a][0],u=t[a][1];r+=ze(s-i)*(2+Math.sin(ze(o))+Math.sin(ze(u))),i=s,o=u}return r*e*e/2}function qe(t,e){var r=e||{},n=r.radius||Xe,i=r.projection||"EPSG:3857",o=t.getType();o!==Fe.GEOMETRY_COLLECTION&&(t=t.clone().transform(i,"EPSG:4326"));var a,s,u,l,h,c,p=0;switch(o){case Fe.POINT:case Fe.MULTI_POINT:case Fe.LINE_STRING:case Fe.MULTI_LINE_STRING:case Fe.LINEAR_RING:break;case Fe.POLYGON:for(a=t.getCoordinates(),p=Math.abs(Ke(a[0],n)),u=1,l=a.length;u<l;++u)p-=Math.abs(Ke(a[u],n));break;case Fe.MULTI_POLYGON:for(u=0,l=(a=t.getCoordinates()).length;u<l;++u)for(s=a[u],p+=Math.abs(Ke(s[0],n)),h=1,c=s.length;h<c;++h)p-=Math.abs(Ke(s[h],n));break;case Fe.GEOMETRY_COLLECTION:var f=t.getGeometries();for(u=0,l=f.length;u<l;++u)p+=qe(f[u],e);break;default:throw new Error("Unsupported geometry type: "+o)}return p}function He(t,e,r,n){var i=n||Xe,o=ze(t[1]),a=ze(t[0]),s=e/i,u=Math.asin(Math.sin(o)*Math.cos(s)+Math.cos(o)*Math.sin(s)*Math.cos(r));return[Ue(a+Math.atan2(Math.sin(r)*Math.sin(s)*Math.cos(o),Math.cos(s)-Math.sin(o)*Math.sin(u))),Ue(u)]}var Je={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},Qe={};Qe[Je.DEGREES]=2*Math.PI*6370997/360,Qe[Je.FEET]=.3048,Qe[Je.METERS]=1,Qe[Je.USFEET]=1200/3937;var $e=Je,tr=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||Qe[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}(),er=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rr=6378137*Math.PI,nr=[-rr,-rr,rr,rr],ir=[-180,-85,180,85],or=function(t){function e(e){return t.call(this,{code:e,units:$e.METERS,extent:nr,global:!0,worldExtent:ir,getPointResolution:function(t,e){return t/je(e[1]/6378137)}})||this}return er(e,t),e}(tr),ar=[new or("EPSG:3857"),new or("EPSG:102100"),new or("EPSG:102113"),new or("EPSG:900913"),new or("urn:ogc:def:crs:EPSG:6.18:3:3857"),new or("urn:ogc:def:crs:EPSG::3857"),new or("http://www.opengis.net/gml/srs/epsg.xml#3857")];function sr(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=rr,s=0;s<n;s+=i){o[s]=a*t[s]/180;var u=6378137*Math.log(Math.tan(Math.PI*(+t[s+1]+90)/360));u>a?u=a:u<-a&&(u=-a),o[s+1]=u}return o}function ur(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;a<n;a+=i)o[a]=180*t[a]/rr,o[a+1]=360*Math.atan(Math.exp(t[a+1]/6378137))/Math.PI-90;return o}var lr=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),hr=[-180,-90,180,90],cr=6378137*Math.PI/180,pr=function(t){function e(e,r){return t.call(this,{code:e,units:$e.DEGREES,extent:hr,axisOrientation:r,global:!0,metersPerUnit:cr,worldExtent:hr})||this}return lr(e,t),e}(tr),fr=[new pr("CRS:84"),new pr("EPSG:4326","neu"),new pr("urn:ogc:def:crs:EPSG::4326","neu"),new pr("urn:ogc:def:crs:EPSG:6.6:4326","neu"),new pr("urn:ogc:def:crs:OGC:1.3:CRS84"),new pr("urn:ogc:def:crs:OGC:2:84"),new pr("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new pr("urn:x-ogc:def:crs:EPSG:4326","neu")],dr={};function _r(t,e,r){var n=t.getCode(),i=e.getCode();n in dr||(dr[n]={}),dr[n][i]=r}function gr(t,e){var r;return t in dr&&e in dr[t]&&(r=dr[t][e]),r}var yr={};function vr(t,e,r){var n;if(void 0!==e){for(var i=0,o=t.length;i<o;++i)e[i]=t[i];n=e}else n=t.slice();return n}function mr(t,e,r){if(void 0!==e&&t!==e){for(var n=0,i=t.length;n<i;++n)e[n]=t[n];t=e}return t}function xr(t){!function(t,e){yr[t]=e}(t.getCode(),t),_r(t,t,vr)}function Er(t){t.forEach(xr)}function Sr(t){return"string"==typeof t?yr[t]||null:t||null}function wr(t,e,r,n){var i,o=(t=Sr(t)).getPointResolutionFunc();if(o)i=o(e,r),n&&n!==t.getUnits()&&(a=t.getMetersPerUnit())&&(i=i*a/Qe[n]);else if(t.getUnits()==$e.DEGREES&&!n||n==$e.DEGREES)i=e;else{var a,s=Mr(t,Sr("EPSG:4326")),u=[r[0]-e/2,r[1],r[0]+e/2,r[1],r[0],r[1]-e/2,r[0],r[1]+e/2];i=(Ve((u=s(u,u,2)).slice(0,2),u.slice(2,4))+Ve(u.slice(4,6),u.slice(6,8)))/2,void 0!==(a=n?Qe[n]:t.getMetersPerUnit())&&(i/=a)}return i}function Tr(t){Er(t),t.forEach((function(e){t.forEach((function(t){e!==t&&_r(e,t,vr)}))}))}function Cr(t,e,r,n){t.forEach((function(t){e.forEach((function(e){_r(t,e,r),_r(e,t,n)}))}))}function Rr(){yr={},dr={}}function br(t,e){return t?"string"==typeof t?Sr(t):t:Sr(e)}function Pr(t){return function(e,r,n){for(var i=e.length,o=void 0!==n?n:2,a=void 0!==r?r:new Array(i),s=0;s<i;s+=o){var u=t([e[s],e[s+1]]);a[s]=u[0],a[s+1]=u[1];for(var l=o-1;l>=2;--l)a[s+l]=e[s+l]}return a}}function Or(t,e,r,n){var i=Sr(t),o=Sr(e);_r(i,o,Pr(r)),_r(o,i,Pr(n))}function Ir(t,e){return Nr(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function Lr(t,e){var r=Nr(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=r[0];return(n<-180||n>180)&&(r[0]=Be(n+180,360)-180),r}function Fr(t,e){if(t===e)return!0;var r=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||Mr(t,e)===vr)&&r}function Mr(t,e){var r=gr(t.getCode(),e.getCode());return r||(r=mr),r}function Ar(t,e){return Mr(Sr(t),Sr(e))}function Nr(t,e,r){return Ar(e,r)(t,void 0,t.length)}function Gr(t,e,r,n){return Re(t,Ar(e,r),void 0,n)}function jr(t,e,r){return Mr(e,r)(t)}var Dr=null;function kr(t){Dr=Sr(t)}function Ur(){Dr=null}function zr(){return Dr}function Br(){kr("EPSG:4326")}function Yr(t,e){return Dr?Nr(t,e,Dr):t}function Xr(t,e){return Dr?Nr(t,Dr,e):t}function Vr(t,e){return Dr?Gr(t,e,Dr):t}function Wr(t,e){return Dr?Gr(t,Dr,e):t}function Zr(){Tr(ar),Tr(fr),Cr(fr,ar,sr,ur)}Zr();var Kr=new Array(6);function qr(t){return Jr(t,1,0,0,1,0,0)}function Hr(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=e[0],l=e[1],h=e[2],c=e[3],p=e[4],f=e[5];return t[0]=r*u+i*l,t[1]=n*u+o*l,t[2]=r*h+i*c,t[3]=n*h+o*c,t[4]=r*p+i*f+a,t[5]=n*p+o*f+s,t}function Jr(t,e,r,n,i,o,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t}function Qr(t,e){var r=e[0],n=e[1];return e[0]=t[0]*r+t[2]*n+t[4],e[1]=t[1]*r+t[3]*n+t[5],e}function $r(t,e,r){return Hr(t,Jr(Kr,e,0,0,r,0,0))}function tn(t,e,r,n,i,o,a,s){var u=Math.sin(o),l=Math.cos(o);return t[0]=n*l,t[1]=i*u,t[2]=-n*u,t[3]=i*l,t[4]=a*n*l-s*n*u+e,t[5]=a*i*u+s*i*l+r,t}function en(t,e){var r,n=(r=e)[0]*r[3]-r[1]*r[2];wt(0!==n,32);var i=e[0],o=e[1],a=e[2],s=e[3],u=e[4],l=e[5];return t[0]=s/n,t[1]=-o/n,t[2]=-a/n,t[3]=i/n,t[4]=(a*l-s*u)/n,t[5]=-(i*l-o*u)/n,t}function rn(t){return"matrix("+t.join(", ")+")"}var nn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),on=[1,0,0,1,0,0],an=function(t){function e(){var e,r,n,i,o,a=t.call(this)||this;return a.extent_=[1/0,1/0,-1/0,-1/0],a.extentRevision_=-1,a.simplifiedGeometryMaxMinSquaredTolerance=0,a.simplifiedGeometryRevision=0,a.simplifyTransformedInternal=(e=function(t,e,r){if(!r)return this.getSimplifiedGeometry(e);var n=this.clone();return n.applyTransform(r),n.getSimplifiedGeometry(e)},o=!1,function(){var t=Array.prototype.slice.call(arguments);return o&&this===i&&B(t,n)||(o=!0,i=this,n=t,r=e.apply(this,arguments)),r}),a}return nn(e,t),e.prototype.simplifyTransformed=function(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)},e.prototype.clone=function(){return x()},e.prototype.closestPointXY=function(t,e,r,n){return x()},e.prototype.containsXY=function(t,e){var r=this.getClosestPoint([t,e]);return r[0]===t&&r[1]===e},e.prototype.getClosestPoint=function(t,e){var r=e||[NaN,NaN];return this.closestPointXY(t[0],t[1],r,1/0),r},e.prototype.intersectsCoordinate=function(t){return this.containsXY(t[0],t[1])},e.prototype.computeExtent=function(t){return x()},e.prototype.getExtent=function(t){return this.extentRevision_!=this.getRevision()&&(this.extent_=this.computeExtent(this.extent_),this.extentRevision_=this.getRevision()),we(this.extent_,t)},e.prototype.rotate=function(t,e){x()},e.prototype.scale=function(t,e,r){x()},e.prototype.simplify=function(t){return this.getSimplifiedGeometry(t*t)},e.prototype.getSimplifiedGeometry=function(t){return x()},e.prototype.getType=function(){return x()},e.prototype.applyTransform=function(t){x()},e.prototype.intersectsExtent=function(t){return x()},e.prototype.translate=function(t,e){x()},e.prototype.transform=function(t,e){var r=Sr(t),n=r.getUnits()==$e.TILE_PIXELS?function(t,n,i){var o=r.getExtent(),a=r.getWorldExtent(),s=fe(a)/fe(o);return tn(on,a[0],a[3],s,-s,0,0,0),Me(t,0,t.length,i,on,n),Ar(r,e)(t,n,i)}:Ar(r,e);return this.applyTransform(n),this},e}(vt),sn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function un(t){var e;return t==Pe?e=2:t==Oe||t==Ie?e=3:t==Le&&(e=4),e}var ln=function(t){function e(){var e=t.call(this)||this;return e.layout=Pe,e.stride=2,e.flatCoordinates=null,e}return sn(e,t),e.prototype.computeExtent=function(t){return qt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},e.prototype.getCoordinates=function(){return x()},e.prototype.getFirstCoordinate=function(){return this.flatCoordinates.slice(0,this.stride)},e.prototype.getFlatCoordinates=function(){return this.flatCoordinates},e.prototype.getLastCoordinate=function(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)},e.prototype.getLayout=function(){return this.layout},e.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;var e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)},e.prototype.getSimplifiedGeometryInternal=function(t){return this},e.prototype.getStride=function(){return this.stride},e.prototype.setFlatCoordinates=function(t,e){this.stride=un(t),this.layout=t,this.flatCoordinates=e},e.prototype.setCoordinates=function(t,e){x()},e.prototype.setLayout=function(t,e,r){var n;if(t)n=un(t);else{for(var i=0;i<r;++i){if(0===e.length)return this.layout=Pe,void(this.stride=2);e=e[0]}t=function(t){var e;2==t?e=Pe:3==t?e=Oe:4==t&&(e=Le);return e}(n=e.length)}this.layout=t,this.stride=n},e.prototype.applyTransform=function(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())},e.prototype.rotate=function(t,e){var r=this.getFlatCoordinates();if(r){var n=this.getStride();Ae(r,0,r.length,n,t,e,r),this.changed()}},e.prototype.scale=function(t,e,r){var n=e;void 0===n&&(n=t);var i=r;i||(i=le(this.getExtent()));var o=this.getFlatCoordinates();if(o){var a=this.getStride();!function(t,e,r,n,i,o,a,s){for(var u=s||[],l=a[0],h=a[1],c=0,p=e;p<r;p+=n){var f=t[p]-l,d=t[p+1]-h;u[c++]=l+i*f,u[c++]=h+o*d;for(var _=p+2;_<p+n;++_)u[c++]=t[_]}s&&u.length!=c&&(u.length=c)}(o,0,o.length,a,t,n,i,o),this.changed()}},e.prototype.translate=function(t,e){var r=this.getFlatCoordinates();if(r){var n=this.getStride();Ne(r,0,r.length,n,t,e,r),this.changed()}},e}(an);function hn(t,e,r,n){for(var i=0,o=t[r-n],a=t[r-n+1];e<r;e+=n){var s=t[e],u=t[e+1];i+=a*s-o*u,o=s,a=u}return i/2}function cn(t,e,r,n){for(var i=0,o=0,a=r.length;o<a;++o){var s=r[o];i+=hn(t,e,s,n),e=s}return i}function pn(t,e,r,n,i,o,a){var s,u=t[e],l=t[e+1],h=t[r]-u,c=t[r+1]-l;if(0===h&&0===c)s=e;else{var p=((i-u)*h+(o-l)*c)/(h*h+c*c);if(p>1)s=r;else{if(p>0){for(var f=0;f<n;++f)a[f]=Ye(t[e+f],t[r+f],p);return void(a.length=n)}s=e}}for(f=0;f<n;++f)a[f]=t[s+f];a.length=n}function fn(t,e,r,n,i){var o=t[e],a=t[e+1];for(e+=n;e<r;e+=n){var s=t[e],u=t[e+1],l=ke(o,a,s,u);l>i&&(i=l),o=s,a=u}return i}function dn(t,e,r,n,i){for(var o=0,a=r.length;o<a;++o){var s=r[o];i=fn(t,e,s,n,i),e=s}return i}function _n(t,e,r,n,i,o,a,s,u,l,h){if(e==r)return l;var c,p;if(0===i){if((p=ke(a,s,t[e],t[e+1]))<l){for(c=0;c<n;++c)u[c]=t[e+c];return u.length=n,p}return l}for(var f=h||[NaN,NaN],d=e+n;d<r;)if(pn(t,d-n,d,n,a,s,f),(p=ke(a,s,f[0],f[1]))<l){for(l=p,c=0;c<n;++c)u[c]=f[c];u.length=n,d+=n}else d+=n*Math.max((Math.sqrt(p)-Math.sqrt(l))/i|0,1);if(o&&(pn(t,r-n,e,n,a,s,f),(p=ke(a,s,f[0],f[1]))<l)){for(l=p,c=0;c<n;++c)u[c]=f[c];u.length=n}return l}function gn(t,e,r,n,i,o,a,s,u,l,h){for(var c=h||[NaN,NaN],p=0,f=r.length;p<f;++p){var d=r[p];l=_n(t,e,d,n,i,o,a,s,u,l,c),e=d}return l}function yn(t,e,r,n){for(var i=0,o=r.length;i<o;++i)t[e++]=r[i];return e}function vn(t,e,r,n){for(var i=0,o=r.length;i<o;++i)for(var a=r[i],s=0;s<n;++s)t[e++]=a[s];return e}function mn(t,e,r,n,i){for(var o=i||[],a=0,s=0,u=r.length;s<u;++s){var l=vn(t,e,r[s],n);o[a++]=l,e=l}return o.length=a,o}function xn(t,e,r,n,i){for(var o=void 0!==i?i:[],a=0,s=e;s<r;s+=n)o[a++]=t.slice(s,s+n);return o.length=a,o}function En(t,e,r,n,i){for(var o=void 0!==i?i:[],a=0,s=0,u=r.length;s<u;++s){var l=r[s];o[a++]=xn(t,e,l,n,o[a]),e=l}return o.length=a,o}function Sn(t,e,r,n,i){for(var o=void 0!==i?i:[],a=0,s=0,u=r.length;s<u;++s){var l=r[s];o[a++]=En(t,e,l,n,o[a]),e=l[l.length-1]}return o.length=a,o}function wn(t,e,r,n,i,o,a){var s=(r-e)/n;if(s<3){for(;e<r;e+=n)o[a++]=t[e],o[a++]=t[e+1];return a}var u=new Array(s);u[0]=1,u[s-1]=1;for(var l=[e,r-n],h=0;l.length>0;){for(var c=l.pop(),p=l.pop(),f=0,d=t[p],_=t[p+1],g=t[c],y=t[c+1],v=p+n;v<c;v+=n){var m=De(t[v],t[v+1],d,_,g,y);m>f&&(h=v,f=m)}f>i&&(u[(h-e)/n]=1,p+n<h&&l.push(p,h),h+n<c&&l.push(h,c))}for(v=0;v<s;++v)u[v]&&(o[a++]=t[e+v*n],o[a++]=t[e+v*n+1]);return a}function Tn(t,e,r,n,i,o,a,s){for(var u=0,l=r.length;u<l;++u){var h=r[u];a=wn(t,e,h,n,i,o,a),s.push(a),e=h}return a}function Cn(t,e){return e*Math.round(t/e)}function Rn(t,e,r,n,i,o,a){if(e==r)return a;var s,u,l=Cn(t[e],i),h=Cn(t[e+1],i);e+=n,o[a++]=l,o[a++]=h;do{if(s=Cn(t[e],i),u=Cn(t[e+1],i),(e+=n)==r)return o[a++]=s,o[a++]=u,a}while(s==l&&u==h);for(;e<r;){var c=Cn(t[e],i),p=Cn(t[e+1],i);if(e+=n,c!=s||p!=u){var f=s-l,d=u-h,_=c-l,g=p-h;f*g==d*_&&(f<0&&_<f||f==_||f>0&&_>f)&&(d<0&&g<d||d==g||d>0&&g>d)?(s=c,u=p):(o[a++]=s,o[a++]=u,l=s,h=u,s=c,u=p)}}return o[a++]=s,o[a++]=u,a}function bn(t,e,r,n,i,o,a,s){for(var u=0,l=r.length;u<l;++u){var h=r[u];a=Rn(t,e,h,n,i,o,a),s.push(a),e=h}return a}var Pn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),On=function(t){function e(e,r){var n=t.call(this)||this;return n.maxDelta_=-1,n.maxDeltaRevision_=-1,void 0===r||Array.isArray(e[0])?n.setCoordinates(e,r):n.setFlatCoordinates(r,e),n}return Pn(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout)},e.prototype.closestPointXY=function(t,e,r,n){return n<kt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(fn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),_n(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,r,n))},e.prototype.getArea=function(){return hn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},e.prototype.getCoordinates=function(){return xn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},e.prototype.getSimplifiedGeometryInternal=function(t){var r=[];return r.length=wn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,0),new e(r,Pe)},e.prototype.getType=function(){return Fe.LINEAR_RING},e.prototype.intersectsExtent=function(t){return!1},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vn(this.flatCoordinates,0,t,this.stride),this.changed()},e}(ln),In=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ln=function(t){function e(e,r){var n=t.call(this)||this;return n.setCoordinates(e,r),n}return In(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout)},e.prototype.closestPointXY=function(t,e,r,n){var i=this.flatCoordinates,o=ke(t,e,i[0],i[1]);if(o<n){for(var a=this.stride,s=0;s<a;++s)r[s]=i[s];return r.length=a,o}return n},e.prototype.getCoordinates=function(){return this.flatCoordinates?this.flatCoordinates.slice():[]},e.prototype.computeExtent=function(t){return Zt(this.flatCoordinates,t)},e.prototype.getType=function(){return Fe.POINT},e.prototype.intersectsExtent=function(t){return Bt(t,this.flatCoordinates[0],this.flatCoordinates[1])},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=yn(this.flatCoordinates,0,t,this.stride),this.changed()},e}(ln);function Fn(t,e,r,n,i){return!oe(i,(function(i){return!Mn(t,e,r,n,i[0],i[1])}))}function Mn(t,e,r,n,i,o){for(var a=0,s=t[r-n],u=t[r-n+1];e<r;e+=n){var l=t[e],h=t[e+1];u<=o?h>o&&(l-s)*(o-u)-(i-s)*(h-u)>0&&a++:h<=o&&(l-s)*(o-u)-(i-s)*(h-u)<0&&a--,s=l,u=h}return 0!==a}function An(t,e,r,n,i,o){if(0===r.length)return!1;if(!Mn(t,e,r[0],n,i,o))return!1;for(var a=1,s=r.length;a<s;++a)if(Mn(t,r[a-1],r[a],n,i,o))return!1;return!0}function Nn(t,e,r,n,i,o,a){for(var s,u,l,h,c,p,f,d=i[o+1],_=[],g=0,y=r.length;g<y;++g){var v=r[g];for(h=t[v-n],p=t[v-n+1],s=e;s<v;s+=n)c=t[s],f=t[s+1],(d<=p&&f<=d||p<=d&&d<=f)&&(l=(d-p)/(f-p)*(c-h)+h,_.push(l)),h=c,p=f}var m=NaN,x=-1/0;for(_.sort(j),h=_[0],s=1,u=_.length;s<u;++s){c=_[s];var E=Math.abs(c-h);E>x&&An(t,e,r,n,l=(h+c)/2,d)&&(m=l,x=E),h=c}return isNaN(m)&&(m=i[o]),a?(a.push(m,d,x),a):[m,d,x]}function Gn(t,e,r,n,i){for(var o,a=[t[e],t[e+1]],s=[];e+n<r;e+=n){if(s[0]=t[e+n],s[1]=t[e+n+1],o=i(a,s))return o;a[0]=s[0],a[1]=s[1]}return!1}function jn(t,e,r,n,i){var o=re([1/0,1/0,-1/0,-1/0],t,e,r,n);return!!Ee(i,o)&&(!!zt(i,o)||(o[0]>=i[0]&&o[2]<=i[2]||(o[1]>=i[1]&&o[3]<=i[3]||Gn(t,e,r,n,(function(t,e){return Ce(i,t,e)})))))}function Dn(t,e,r,n,i){if(!function(t,e,r,n,i){return!!jn(t,e,r,n,i)||(!!Mn(t,e,r,n,i[0],i[1])||(!!Mn(t,e,r,n,i[0],i[3])||(!!Mn(t,e,r,n,i[2],i[1])||!!Mn(t,e,r,n,i[2],i[3]))))}(t,e,r[0],n,i))return!1;if(1===r.length)return!0;for(var o=1,a=r.length;o<a;++o)if(Fn(t,r[o-1],r[o],n,i)&&!jn(t,r[o-1],r[o],n,i))return!1;return!0}function kn(t,e,r,n){for(;e<r-n;){for(var i=0;i<n;++i){var o=t[e+i];t[e+i]=t[r-n+i],t[r-n+i]=o}e+=n,r-=n}}function Un(t,e,r,n){for(var i=0,o=t[r-n],a=t[r-n+1];e<r;e+=n){var s=t[e],u=t[e+1];i+=(s-o)*(u+a),o=s,a=u}return i>0}function zn(t,e,r,n,i){for(var o=void 0!==i&&i,a=0,s=r.length;a<s;++a){var u=r[a],l=Un(t,e,u,n);if(0===a){if(o&&l||!o&&!l)return!1}else if(o&&!l||!o&&l)return!1;e=u}return!0}function Bn(t,e,r,n,i){for(var o=void 0!==i&&i,a=0,s=r.length;a<s;++a){var u=r[a],l=Un(t,e,u,n);(0===a?o&&l||!o&&!l:o&&!l||!o&&l)&&kn(t,e,u,n),e=u}return e}function Yn(t,e,r,n,i){for(var o=0,a=r.length;o<a;++o)e=Bn(t,e,r[o],n,i);return e}var Xn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vn=function(t){function e(e,r,n){var i=t.call(this)||this;return i.ends_=[],i.flatInteriorPointRevision_=-1,i.flatInteriorPoint_=null,i.maxDelta_=-1,i.maxDeltaRevision_=-1,i.orientedRevision_=-1,i.orientedFlatCoordinates_=null,void 0!==r&&n?(i.setFlatCoordinates(r,e),i.ends_=n):i.setCoordinates(e,r),i}return Xn(e,t),e.prototype.appendLinearRing=function(t){this.flatCoordinates?z(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice())},e.prototype.closestPointXY=function(t,e,r,n){return n<kt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(dn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),gn(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,r,n))},e.prototype.containsXY=function(t,e){return An(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)},e.prototype.getArea=function(){return cn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)},e.prototype.getCoordinates=function(t){var e;return void 0!==t?Bn(e=this.getOrientedFlatCoordinates().slice(),0,this.ends_,this.stride,t):e=this.flatCoordinates,En(e,0,this.ends_,this.stride)},e.prototype.getEnds=function(){return this.ends_},e.prototype.getFlatInteriorPoint=function(){if(this.flatInteriorPointRevision_!=this.getRevision()){var t=le(this.getExtent());this.flatInteriorPoint_=Nn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_},e.prototype.getInteriorPoint=function(){return new Ln(this.getFlatInteriorPoint(),Ie)},e.prototype.getLinearRingCount=function(){return this.ends_.length},e.prototype.getLinearRing=function(t){return t<0||this.ends_.length<=t?null:new On(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)},e.prototype.getLinearRings=function(){for(var t=this.layout,e=this.flatCoordinates,r=this.ends_,n=[],i=0,o=0,a=r.length;o<a;++o){var s=r[o],u=new On(e.slice(i,s),t);n.push(u),i=s}return n},e.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var t=this.flatCoordinates;zn(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Bn(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},e.prototype.getSimplifiedGeometryInternal=function(t){var r=[],n=[];return r.length=bn(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),r,0,n),new e(r,Pe,n)},e.prototype.getType=function(){return Fe.POLYGON},e.prototype.intersectsExtent=function(t){return Dn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=mn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===r.length?0:r[r.length-1],this.changed()},e}(ln),Wn=Vn;function Zn(t,e,r,n){for(var i=r||32,o=[],a=0;a<i;++a)z(o,He(t,e,2*Math.PI*a/i,n));return o.push(o[0],o[1]),new Vn(o,Pe,[o.length])}function Kn(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=[e,r,e,i,n,i,n,r,e,r];return new Vn(o,Pe,[o.length])}function qn(t,e,r){for(var n=e||32,i=t.getStride(),o=t.getLayout(),a=t.getCenter(),s=i*(n+1),u=new Array(s),l=0;l<s;l+=i){u[l]=0,u[l+1]=0;for(var h=2;h<i;h++)u[l+h]=a[h]}var c=[u.length],p=new Vn(u,o,c);return Hn(p,a,t.getRadius(),r),p}function Hn(t,e,r,n){for(var i=t.getFlatCoordinates(),o=t.getStride(),a=i.length/o-1,s=n||0,u=0;u<=a;++u){var l=u*o,h=s+2*Be(u,a)*Math.PI/a;i[l]=e[0]+r*Math.cos(h),i[l+1]=e[1]+r*Math.sin(h)}t.changed()}var Jn=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qn="accuracy",$n="accuracyGeometry",ti="altitude",ei="altitudeAccuracy",ri="heading",ni="position",ii="projection",oi="speed",ai="tracking",si="trackingOptions",ui=function(t){function e(e){var r=t.call(this,Q)||this;return r.code=e.code,r.message=e.message,r}return Jn(e,t),e}(K),li=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.position_=null,r.transform_=mr,r.watchId_=void 0,r.addEventListener(yt(ii),r.handleProjectionChanged_),r.addEventListener(yt(ai),r.handleTrackingChanged_),void 0!==n.projection&&r.setProjection(n.projection),void 0!==n.trackingOptions&&r.setTrackingOptions(n.trackingOptions),r.setTracking(void 0!==n.tracking&&n.tracking),r}return Jn(e,t),e.prototype.disposeInternal=function(){this.setTracking(!1),t.prototype.disposeInternal.call(this)},e.prototype.handleProjectionChanged_=function(){var t=this.getProjection();t&&(this.transform_=Mr(Sr("EPSG:4326"),t),this.position_&&this.set(ni,this.transform_(this.position_)))},e.prototype.handleTrackingChanged_=function(){if("geolocation"in navigator){var t=this.getTracking();t&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):t||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}},e.prototype.positionChange_=function(t){var e=t.coords;this.set(Qn,e.accuracy),this.set(ti,null===e.altitude?void 0:e.altitude),this.set(ei,null===e.altitudeAccuracy?void 0:e.altitudeAccuracy),this.set(ri,null===e.heading?void 0:ze(e.heading)),this.position_?(this.position_[0]=e.longitude,this.position_[1]=e.latitude):this.position_=[e.longitude,e.latitude];var r=this.transform_(this.position_);this.set(ni,r),this.set(oi,null===e.speed?void 0:e.speed);var n=Zn(this.position_,e.accuracy);n.applyTransform(this.transform_),this.set($n,n),this.changed()},e.prototype.positionError_=function(t){this.setTracking(!1),this.dispatchEvent(new ui(t))},e.prototype.getAccuracy=function(){return this.get(Qn)},e.prototype.getAccuracyGeometry=function(){return this.get($n)||null},e.prototype.getAltitude=function(){return this.get(ti)},e.prototype.getAltitudeAccuracy=function(){return this.get(ei)},e.prototype.getHeading=function(){return this.get(ri)},e.prototype.getPosition=function(){return this.get(ni)},e.prototype.getProjection=function(){return this.get(ii)},e.prototype.getSpeed=function(){return this.get(oi)},e.prototype.getTracking=function(){return this.get(ai)},e.prototype.getTrackingOptions=function(){return this.get(si)},e.prototype.setProjection=function(t){this.set(ii,Sr(t))},e.prototype.setTracking=function(t){this.set(ai,t)},e.prototype.setTrackingOptions=function(t){this.set(si,t)},e}(vt),hi="opacity",ci="visible",pi="extent",fi="zIndex",di="maxResolution",_i="minResolution",gi="maxZoom",yi="minZoom",vi="source",mi=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xi=function(t){function e(e){var r=t.call(this)||this,n=O({},e);return n[hi]=void 0!==e.opacity?e.opacity:1,wt("number"==typeof n[hi],64),n[ci]=void 0===e.visible||e.visible,n[fi]=e.zIndex,n[di]=void 0!==e.maxResolution?e.maxResolution:1/0,n[_i]=void 0!==e.minResolution?e.minResolution:0,n[yi]=void 0!==e.minZoom?e.minZoom:-1/0,n[gi]=void 0!==e.maxZoom?e.maxZoom:1/0,r.className_=void 0!==n.className?e.className:"ol-layer",delete n.className,r.setProperties(n),r.state_=null,r}return mi(e,t),e.prototype.getClassName=function(){return this.className_},e.prototype.getLayerState=function(t){var e=this.state_||{layer:this,managed:void 0===t||t},r=this.getZIndex();return e.opacity=Ge(Math.round(100*this.getOpacity())/100,0,1),e.sourceState=this.getSourceState(),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==r?r:!1===e.managed?1/0:0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e},e.prototype.getLayersArray=function(t){return x()},e.prototype.getLayerStatesArray=function(t){return x()},e.prototype.getExtent=function(){return this.get(pi)},e.prototype.getMaxResolution=function(){return this.get(di)},e.prototype.getMinResolution=function(){return this.get(_i)},e.prototype.getMinZoom=function(){return this.get(yi)},e.prototype.getMaxZoom=function(){return this.get(gi)},e.prototype.getOpacity=function(){return this.get(hi)},e.prototype.getSourceState=function(){return x()},e.prototype.getVisible=function(){return this.get(ci)},e.prototype.getZIndex=function(){return this.get(fi)},e.prototype.setExtent=function(t){this.set(pi,t)},e.prototype.setMaxResolution=function(t){this.set(di,t)},e.prototype.setMinResolution=function(t){this.set(_i,t)},e.prototype.setMaxZoom=function(t){this.set(gi,t)},e.prototype.setMinZoom=function(t){this.set(yi,t)},e.prototype.setOpacity=function(t){wt("number"==typeof t,64),this.set(hi,t)},e.prototype.setVisible=function(t){this.set(ci,t)},e.prototype.setZIndex=function(t){this.set(fi,t)},e.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),t.prototype.disposeInternal.call(this)},e}(vt),Ei="prerender",Si="postrender",wi="precompose",Ti="postcompose",Ci="rendercomplete",Ri="undefined",bi="loading",Pi="ready",Oi="error",Ii=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Li(t,e){if(!t.visible)return!1;var r=e.resolution;if(r<t.minResolution||r>=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Fi=function(t){function e(e){var r=this,n=O({},e);delete n.source,(r=t.call(this,n)||this).mapPrecomposeKey_=null,r.mapRenderKey_=null,r.sourceChangeKey_=null,r.renderer_=null,e.render&&(r.render=e.render),e.map&&r.setMap(e.map),r.addEventListener(yt(vi),r.handleSourcePropertyChange_);var i=e.source?e.source:null;return r.setSource(i),r}return Ii(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(vi)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():Ri},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(N(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=M(t,J,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_.getFeatures(t)},e.prototype.render=function(t,e){var r=this.getRenderer();if(r.prepareFrame(t))return r.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(N(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(N(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=M(t,wi,(function(t){var e=t.frameState.layerStatesArray,r=this.getLayerState(!1);wt(!e.some((function(t){return t.layer===r.layer})),67),e.push(r)}),this),this.mapRenderKey_=M(this,J,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(vi,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.setSource(null),t.prototype.disposeInternal.call(this)},e}(xi),Mi=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Ai=/^([a-z]*)$|^hsla?\(.*\)$/i;function Ni(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var r=getComputedStyle(e).color;return document.body.removeChild(e),r}return""}var Gi,ji,Di=(Gi={},ji=0,function(t){var e;if(Gi.hasOwnProperty(t))e=Gi[t];else{if(ji>=1024){var r=0;for(var n in Gi)0==(3&r++)&&(delete Gi[n],--ji)}e=function(t){var e,r,n,i,o;if(Ai.exec(t)&&(t=Ni(t)),Mi.exec(t)){var a=t.length-1,s=void 0;s=a<=4?1:2;var u=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),r=parseInt(t.substr(1+1*s,s),16),n=parseInt(t.substr(1+2*s,s),16),i=u?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,r=(r<<4)+r,n=(n<<4)+n,u&&(i=(i<<4)+i)),o=[e,r,n,i/255]}else 0==t.indexOf("rgba(")?Ui(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),Ui(o)):wt(!1,14);return o}(t),Gi[t]=e,++ji}return e});function ki(t){return Array.isArray(t)?t:Di(t)}function Ui(t){return t[0]=Ge(t[0]+.5|0,0,255),t[1]=Ge(t[1]+.5|0,0,255),t[2]=Ge(t[2]+.5|0,0,255),t[3]=Ge(t[3],0,1),t}function zi(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var r=t[1];r!=(0|r)&&(r=r+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+r+","+n+","+(void 0===t[3]?1:t[3])+")"}function Bi(t){return Array.isArray(t)?zi(t):t}var Yi="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",Xi=-1!==Yi.indexOf("firefox"),Vi=(-1!==Yi.indexOf("safari")&&Yi.indexOf("chrom"),-1!==Yi.indexOf("webkit")&&-1==Yi.indexOf("edge")),Wi=-1!==Yi.indexOf("macintosh"),Zi="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,Ki="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,qi="undefined"!=typeof Image&&Image.prototype.decode,Hi=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}();function Ji(t,e,r){var n=r&&r.length?r.shift():Ki?new OffscreenCanvas(t||300,e||300):document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n.getContext("2d")}function Qi(t){var e=t.offsetWidth,r=getComputedStyle(t);return e+=parseInt(r.marginLeft,10)+parseInt(r.marginRight,10)}function $i(t){var e=t.offsetHeight,r=getComputedStyle(t);return e+=parseInt(r.marginTop,10)+parseInt(r.marginBottom,10)}function to(t,e){var r=e.parentNode;r&&r.replaceChild(t,e)}function eo(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function ro(t){for(;t.lastChild;)t.removeChild(t.lastChild)}var no=0,io=1,oo=2,ao=3,so=4,uo=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),lo=["style","variant","weight","size","lineHeight","family"],ho=function(t){var e=t.match(uo);if(!e)return null;for(var r={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},n=0,i=lo.length;n<i;++n){var o=e[n+1];void 0!==o&&(r[lo[n]]=o)}return r.families=r.family.split(/,\s?/),r},co=[],po=[0,0,0,0],fo=new vt;(new H).setSize=function(){console.warn("labelCache is deprecated.")};var _o,go,yo,vo=null,mo={},xo=function(){var t,e,r=["monospace","serif"],n=r.length,i="wmytzilWMYTZIL@#/&?$%10";function o(t,o,a){for(var s=!0,u=0;u<n;++u){var l=r[u];if(e=wo(t+" "+o+" 32px "+l,i),a!=l){var h=wo(t+" "+o+" 32px "+a+","+l,i);s=s&&h!=e}}return!!s}function a(){for(var e=!0,r=fo.getKeys(),n=0,i=r.length;n<i;++n){var a=r[n];fo.get(a)<100&&(o.apply(this,a.split("\n"))?(I(mo),vo=null,_o=void 0,fo.set(a,100)):(fo.set(a,fo.get(a)+1,!0),e=!1))}e&&(clearInterval(t),t=void 0)}return function(e){var r=ho(e);if(r)for(var n=r.families,i=0,s=n.length;i<s;++i){var u=n[i],l=r.style+"\n"+r.weight+"\n"+u;void 0===fo.get(l)&&(fo.set(l,100,!0),o(r.style,r.weight,u)||(fo.set(l,0,!0),void 0===t&&(t=setInterval(a,32))))}}}(),Eo=(yo=mo,function(t){var e=yo[t];if(null==e)if(Ki){var r=ho(t),n=So(t,"Žg"),i=isNaN(Number(r.lineHeight))?1.2:Number(r.lineHeight);mo[t]=i*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else go||((go=document.createElement("div")).innerHTML="M",go.style.margin="0 !important",go.style.padding="0 !important",go.style.position="absolute !important",go.style.left="-99999px !important"),go.style.font=t,document.body.appendChild(go),e=go.offsetHeight,yo[t]=e,document.body.removeChild(go);return e});function So(t,e){return vo||(vo=Ji(1,1)),t!=_o&&(vo.font=t,_o=vo.font),vo.measureText(e)}function wo(t,e){return So(t,e).width}function To(t,e,r){if(e in r)return r[e];var n=wo(t,e);return r[e]=n,n}function Co(t,e,r,n){0!==e&&(t.translate(r,n),t.rotate(e),t.translate(-r,-n))}function Ro(t,e,r,n,i,o,a,s,u,l,h){t.save(),1!==r&&(t.globalAlpha*=r),e&&t.setTransform.apply(t,e),n.contextInstructions?(t.translate(u,l),t.scale(h,h),function(t,e){for(var r=t.contextInstructions,n=0,i=r.length;n<i;n+=2)Array.isArray(r[n+1])?e[r[n]].apply(e,r[n+1]):e[r[n]]=r[n+1]}(n,t)):t.drawImage(n,i,o,a,s,u,l,a*h,s*h),t.restore()}var bo=null;function Po(t){return Ki?rn(t):(bo||(bo=Ji(1,1).canvas),bo.style.transform=rn(t),bo.style.transform)}var Oo=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.displacement_=t.displacement}return t.prototype.clone=function(){return new t({opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return x()},t.prototype.getImage=function(t){return x()},t.prototype.getHitDetectionImage=function(t){return x()},t.prototype.getImageState=function(){return x()},t.prototype.getImageSize=function(){return x()},t.prototype.getHitDetectionImageSize=function(){return x()},t.prototype.getOrigin=function(){return x()},t.prototype.getSize=function(){return x()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t},t.prototype.listenImageChange=function(t){x()},t.prototype.load=function(){x()},t.prototype.unlistenImageChange=function(t){x()},t}(),Io=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lo=function(t){function e(e){var r=this,n=void 0!==e.rotateWithView&&e.rotateWithView;return(r=t.call(this,{opacity:1,rotateWithView:n,rotation:void 0!==e.rotation?e.rotation:0,scale:1,displacement:void 0!==e.displacement?e.displacement:[0,0]})||this).canvas_=null,r.hitDetectionCanvas_=null,r.fill_=void 0!==e.fill?e.fill:null,r.origin_=[0,0],r.points_=e.points,r.radius_=void 0!==e.radius?e.radius:e.radius1,r.radius2_=e.radius2,r.angle_=void 0!==e.angle?e.angle:0,r.stroke_=void 0!==e.stroke?e.stroke:null,r.anchor_=null,r.size_=null,r.imageSize_=null,r.hitDetectionImageSize_=null,r.render(),r}return Io(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(t){return this.hitDetectionCanvas_},e.prototype.getImage=function(t){return this.canvas_},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return oo},e.prototype.getOrigin=function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t){},e.prototype.render=function(){var t,e="round",r="round",n=0,i=null,o=0,a=0;this.stroke_&&(null===(t=this.stroke_.getColor())&&(t="#000"),t=Bi(t),void 0===(a=this.stroke_.getWidth())&&(a=1),i=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset(),void 0===(r=this.stroke_.getLineJoin())&&(r="round"),void 0===(e=this.stroke_.getLineCap())&&(e="round"),void 0===(n=this.stroke_.getMiterLimit())&&(n=10));var s=2*(this.radius_+a)+1,u={strokeStyle:t,strokeWidth:a,size:s,lineCap:e,lineDash:i,lineDashOffset:o,lineJoin:r,miterLimit:n},l=Ji(s,s);this.canvas_=l.canvas;var h=s=this.canvas_.width,c=this.getDisplacement();this.draw_(u,l,0,0),this.createHitDetectionCanvas_(u),this.anchor_=[s/2-c[0],s/2+c[1]],this.size_=[s,s],this.imageSize_=[h,h]},e.prototype.draw_=function(t,e,r,n){var i,o,a;e.setTransform(1,0,0,1,0,0),e.translate(r,n),e.beginPath();var s=this.points_;if(s===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var u=void 0!==this.radius2_?this.radius2_:this.radius_;for(u!==this.radius_&&(s*=2),i=0;i<=s;i++)o=2*i*Math.PI/s-Math.PI/2+this.angle_,a=i%2==0?this.radius_:u,e.lineTo(t.size/2+a*Math.cos(o),t.size/2+a*Math.sin(o))}if(this.fill_){var l=this.fill_.getColor();null===l&&(l="#000"),e.fillStyle=Bi(l),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,e.setLineDash&&t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke()),e.closePath()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionImageSize_=[t.size,t.size],this.hitDetectionCanvas_=this.canvas_,this.fill_){var e=this.fill_.getColor(),r=0;if("string"==typeof e&&(e=ki(e)),null===e?r=1:Array.isArray(e)&&(r=4===e.length?e[3]:1),0===r){var n=Ji(t.size,t.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(t,n,0,0)}}},e.prototype.drawHitDetectionCanvas_=function(t,e,r,n){e.setTransform(1,0,0,1,0,0),e.translate(r,n),e.beginPath();var i=this.points_;if(i===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var o=void 0!==this.radius2_?this.radius2_:this.radius_;o!==this.radius_&&(i*=2);var a=void 0,s=void 0,u=void 0;for(a=0;a<=i;a++)u=2*a*Math.PI/i-Math.PI/2+this.angle_,s=a%2==0?this.radius_:o,e.lineTo(t.size/2+s*Math.cos(u),t.size/2+s*Math.sin(u))}e.fillStyle="#000",e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e}(Oo),Fo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mo=function(t){function e(e){var r=e||{};return t.call(this,{points:1/0,fill:r.fill,radius:r.radius,stroke:r.stroke,displacement:void 0!==r.displacement?r.displacement:[0,0]})||this}return Fo(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),displacement:this.getDisplacement().slice()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.setRadius=function(t){this.radius_=t,this.render()},e}(Lo),Ao=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0})},t.prototype.getColor=function(){return this.color_},t.prototype.setColor=function(t){this.color_=t},t}(),No=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},t.prototype.getColor=function(){return this.color_},t.prototype.getLineCap=function(){return this.lineCap_},t.prototype.getLineDash=function(){return this.lineDash_},t.prototype.getLineDashOffset=function(){return this.lineDashOffset_},t.prototype.getLineJoin=function(){return this.lineJoin_},t.prototype.getMiterLimit=function(){return this.miterLimit_},t.prototype.getWidth=function(){return this.width_},t.prototype.setColor=function(t){this.color_=t},t.prototype.setLineCap=function(t){this.lineCap_=t},t.prototype.setLineDash=function(t){this.lineDash_=t},t.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t},t.prototype.setLineJoin=function(t){this.lineJoin_=t},t.prototype.setMiterLimit=function(t){this.miterLimit_=t},t.prototype.setWidth=function(t){this.width_=t},t}(),Go=function(){function t(t){var e=t||{};this.geometry_=null,this.geometryFunction_=Uo,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}return t.prototype.clone=function(){var e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},t.prototype.getRenderer=function(){return this.renderer_},t.prototype.setRenderer=function(t){this.renderer_=t},t.prototype.getGeometry=function(){return this.geometry_},t.prototype.getGeometryFunction=function(){return this.geometryFunction_},t.prototype.getFill=function(){return this.fill_},t.prototype.setFill=function(t){this.fill_=t},t.prototype.getImage=function(){return this.image_},t.prototype.setImage=function(t){this.image_=t},t.prototype.getStroke=function(){return this.stroke_},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.getText=function(){return this.text_},t.prototype.setText=function(t){this.text_=t},t.prototype.getZIndex=function(){return this.zIndex_},t.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Uo,this.geometry_=t},t.prototype.setZIndex=function(t){this.zIndex_=t},t}();var jo=null;function Do(t,e){if(!jo){var r=new Ao({color:"rgba(255,255,255,0.4)"}),n=new No({color:"#3399CC",width:1.25});jo=[new Go({image:new Mo({fill:r,stroke:n,radius:5}),fill:r,stroke:n})]}return jo}function ko(){var t={},e=[255,255,255,1],r=[0,153,255,1];return t[Fe.POLYGON]=[new Go({fill:new Ao({color:[255,255,255,.5]})})],t[Fe.MULTI_POLYGON]=t[Fe.POLYGON],t[Fe.LINE_STRING]=[new Go({stroke:new No({color:e,width:5})}),new Go({stroke:new No({color:r,width:3})})],t[Fe.MULTI_LINE_STRING]=t[Fe.LINE_STRING],t[Fe.CIRCLE]=t[Fe.POLYGON].concat(t[Fe.LINE_STRING]),t[Fe.POINT]=[new Go({image:new Mo({radius:6,fill:new Ao({color:r}),stroke:new No({color:e,width:1.5})}),zIndex:1/0})],t[Fe.MULTI_POINT]=t[Fe.POINT],t[Fe.GEOMETRY_COLLECTION]=t[Fe.POLYGON].concat(t[Fe.LINE_STRING],t[Fe.POINT]),t}function Uo(t){return t.getGeometry()}var zo=Go,Bo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yo="renderOrder",Xo=function(t){function e(e){var r=this,n=e||{},i=O({},n);return delete i.style,delete i.renderBuffer,delete i.updateWhileAnimating,delete i.updateWhileInteracting,(r=t.call(this,i)||this).declutter_=void 0!==n.declutter&&n.declutter,r.renderBuffer_=void 0!==n.renderBuffer?n.renderBuffer:100,r.style_=null,r.styleFunction_=void 0,r.setStyle(n.style),r.updateWhileAnimating_=void 0!==n.updateWhileAnimating&&n.updateWhileAnimating,r.updateWhileInteracting_=void 0!==n.updateWhileInteracting&&n.updateWhileInteracting,r}return Bo(e,t),e.prototype.getDeclutter=function(){return this.declutter_},e.prototype.getFeatures=function(e){return t.prototype.getFeatures.call(this,e)},e.prototype.getRenderBuffer=function(){return this.renderBuffer_},e.prototype.getRenderOrder=function(){return this.get(Yo)},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},e.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},e.prototype.setRenderOrder=function(t){this.set(Yo,t)},e.prototype.setStyle=function(t){this.style_=void 0!==t?t:Do,this.styleFunction_=null===t?void 0:function(t){var e;if("function"==typeof t)e=t;else{var r;if(Array.isArray(t))r=t;else wt("function"==typeof t.getZIndex,41),r=[t];e=function(){return r}}return e}(this.style_),this.changed()},e}(Fi),Vo=0,Wo=1;function Zo(t,e,r){var n=void 0!==r?t.toFixed(r):""+t,i=n.indexOf(".");return(i=-1===i?n.length:i)>e?n:new Array(1+e-i).join("0")+n}function Ko(t,e){for(var r=(""+t).split("."),n=(""+e).split("."),i=0;i<Math.max(r.length,n.length);i++){var o=parseInt(r[i]||"0",10),a=parseInt(n[i]||"0",10);if(o>a)return 1;if(a>o)return-1}return 0}function qo(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Ho(t,e){var r=e.getRadius(),n=e.getCenter(),i=n[0],o=n[1],a=t[0]-i,s=t[1]-o;0===a&&0===s&&(a=1);var u=Math.sqrt(a*a+s*s);return[i+r*a/u,o+r*s/u]}function Jo(t,e){var r,n,i=t[0],o=t[1],a=e[0],s=e[1],u=a[0],l=a[1],h=s[0],c=s[1],p=h-u,f=c-l,d=0===p&&0===f?0:(p*(i-u)+f*(o-l))/(p*p+f*f||0);return d<=0?(r=u,n=l):d>=1?(r=h,n=c):(r=u+d*p,n=l+d*f),[r,n]}function Qo(t){return function(e){return ua(e,t)}}function $o(t,e,r){var n=Be(e+180,360)-180,i=Math.abs(3600*n),o=r||0,a=Math.pow(10,o),s=Math.floor(i/3600),u=Math.floor((i-3600*s)/60),l=i-3600*s-60*u;return(l=Math.ceil(l*a)/a)>=60&&(l=0,u+=1),u>=60&&(u=0,s+=1),s+"° "+Zo(u,2)+"′ "+Zo(l,2,o)+"″"+(0==n?"":" "+t.charAt(n<0?1:0))}function ta(t,e,r){return t?e.replace("{x}",t[0].toFixed(r)).replace("{y}",t[1].toFixed(r)):""}function ea(t,e){for(var r=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){r=!1;break}return r}function ra(t,e){var r=Math.cos(e),n=Math.sin(e),i=t[0]*r-t[1]*n,o=t[1]*r+t[0]*n;return t[0]=i,t[1]=o,t}function na(t,e){return t[0]*=e,t[1]*=e,t}function ia(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function oa(t,e){return Math.sqrt(ia(t,e))}function aa(t,e){return ia(t,Jo(t,e))}function sa(t,e){return t?$o("NS",t[1],e)+" "+$o("EW",t[0],e):""}function ua(t,e){return ta(t,"{x}, {y}",e)}function la(t,e){var r=e.getExtent();if(e.canWrapX()&&(t[0]<r[0]||t[0]>=r[2])){var n=xe(r),i=Math.floor((t[0]-r[0])/n);t[0]-=i*n}return t}var ha=function(){function t(){}return t.prototype.drawCustom=function(t,e,r){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}(),ca={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},pa=[ca.FILL],fa=[ca.STROKE],da=[ca.BEGIN_PATH],_a=[ca.CLOSE_PATH],ga=ca,ya=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),va=function(t){function e(e,r,n,i){var o=t.call(this)||this;return o.tolerance=e,o.maxExtent=r,o.pixelRatio=i,o.maxLineWidth=0,o.resolution=n,o.beginGeometryInstruction1_=null,o.beginGeometryInstruction2_=null,o.bufferedMaxExtent_=null,o.instructions=[],o.coordinates=[],o.tmpCoordinate_=[],o.hitDetectionInstructions=[],o.state={},o}return ya(e,t),e.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))},e.prototype.appendFlatCoordinates=function(t,e,r,n,i,o){var a=this.coordinates.length,s=this.getBufferedMaxExtent();o&&(e+=n);var u,l,h,c=t[e],p=t[e+1],f=this.tmpCoordinate_,d=!0;for(u=e+n;u<r;u+=n)f[0]=t[u],f[1]=t[u+1],(h=Yt(s,f))!==l?(d&&(this.coordinates[a++]=c,this.coordinates[a++]=p),this.coordinates[a++]=f[0],this.coordinates[a++]=f[1],d=!1):h===Lt?(this.coordinates[a++]=f[0],this.coordinates[a++]=f[1],d=!1):d=!0,c=f[0],p=f[1],l=h;return(i&&d||u===e+n)&&(this.coordinates[a++]=c,this.coordinates[a++]=p),a},e.prototype.drawCustomCoordinates_=function(t,e,r,n,i){for(var o=0,a=r.length;o<a;++o){var s=r[o],u=this.appendFlatCoordinates(t,e,s,n,!1,!1);i.push(u),e=s}return e},e.prototype.drawCustom=function(t,e,r){this.beginGeometry(t,e);var n,i,o,a,s,u=t.getType(),l=t.getStride(),h=this.coordinates.length;if(u==Fe.MULTI_POLYGON){n=(t=t).getOrientedFlatCoordinates(),a=[];var c=t.getEndss();s=0;for(var p=0,f=c.length;p<f;++p){var d=[];s=this.drawCustomCoordinates_(n,s,c[p],l,d),a.push(d)}this.instructions.push([ga.CUSTOM,h,a,t,r,Sn])}else u==Fe.POLYGON||u==Fe.MULTI_LINE_STRING?(o=[],n=u==Fe.POLYGON?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),s=this.drawCustomCoordinates_(n,0,t.getEnds(),l,o),this.instructions.push([ga.CUSTOM,h,o,t,r,En])):u==Fe.LINE_STRING||u==Fe.MULTI_POINT?(n=t.getFlatCoordinates(),i=this.appendFlatCoordinates(n,0,n.length,l,!1,!1),this.instructions.push([ga.CUSTOM,h,i,t,r,xn])):u==Fe.POINT&&(n=t.getFlatCoordinates(),this.coordinates.push(n[0],n[1]),i=this.coordinates.length,this.instructions.push([ga.CUSTOM,h,i,t,r]));this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){var r=t.getExtent();this.beginGeometryInstruction1_=[ga.BEGIN_GEOMETRY,e,0,r],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[ga.BEGIN_GEOMETRY,e,0,r],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var r,n,i=e.length,o=-1;for(t=0;t<i;++t)(n=(r=e[t])[0])==ga.END_GEOMETRY?o=t:n==ga.BEGIN_GEOMETRY&&(r[2]=t,U(this.hitDetectionInstructions,o,t),o=-1)},e.prototype.setFillStrokeStyle=function(t,e){var r=this.state;if(t){var n=t.getColor();r.fillStyle=Bi(n||"#000")}else r.fillStyle=void 0;if(e){var i=e.getColor();r.strokeStyle=Bi(i||"#000");var o=e.getLineCap();r.lineCap=void 0!==o?o:"round";var a=e.getLineDash();r.lineDash=a?a.slice():co;var s=e.getLineDashOffset();r.lineDashOffset=s||0;var u=e.getLineJoin();r.lineJoin=void 0!==u?u:"round";var l=e.getWidth();r.lineWidth=void 0!==l?l:1;var h=e.getMiterLimit();r.miterLimit=void 0!==h?h:10,r.lineWidth>this.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,r=[ga.SET_FILL_STYLE,e];return"string"!=typeof e&&r.push(!0),r},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[ga.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t)),t.currentFillStyle=r)},e.prototype.updateStrokeStyle=function(t,e){var r=t.strokeStyle,n=t.lineCap,i=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,s=t.lineWidth,u=t.miterLimit;(t.currentStrokeStyle!=r||t.currentLineCap!=n||i!=t.currentLineDash&&!B(t.currentLineDash,i)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=s||t.currentMiterLimit!=u)&&(void 0!==r&&e.call(this,t),t.currentStrokeStyle=r,t.currentLineCap=n,t.currentLineDash=i,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=s,t.currentMiterLimit=u)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[ga.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Dt(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;jt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(ha),ma=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xa=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.declutterGroups_=null,o.hitDetectionImage_=null,o.image_=null,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o}return ma(e,t),e.prototype.drawCoordinates_=function(t,e,r,n){return this.appendFlatCoordinates(t,e,r,n,!1,!1)},e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.drawCoordinates_(r,0,r.length,n);this.instructions.push([ga.DRAW_IMAGE,i,o,this.image_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.width_]),this.hitDetectionInstructions.push([ga.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.drawCoordinates_(r,0,r.length,n);this.instructions.push([ga.DRAW_IMAGE,i,o,this.image_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_*this.pixelRatio,this.width_]),this.hitDetectionInstructions.push([ga.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var r=t.getAnchor(),n=t.getSize(),i=t.getHitDetectionImage(1),o=t.getImage(1),a=t.getOrigin();this.anchorX_=r[0],this.anchorY_=r[1],this.declutterGroups_=e,this.hitDetectionImage_=i,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=a[0],this.originY_=a[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScale(),this.width_=n[0]},e}(va),Ea=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Sa=function(t){function e(e,r,n,i){return t.call(this,e,r,n,i)||this}return Ea(e,t),e.prototype.drawFlatCoordinates_=function(t,e,r,n){var i=this.coordinates.length,o=this.appendFlatCoordinates(t,e,r,n,!1,!1),a=[ga.MOVE_TO_LINE_TO,i,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),r},e.prototype.drawLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([ga.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],da);var o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(fa),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([ga.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],da);for(var o=t.getEnds(),a=t.getFlatCoordinates(),s=t.getStride(),u=0,l=0,h=o.length;l<h;++l)u=this.drawFlatCoordinates_(a,u,o[l],s);this.hitDetectionInstructions.push(fa),this.endGeometry(e)}},e.prototype.finish=function(){var e=this.state;return null!=e.lastStroke&&e.lastStroke!=this.coordinates.length&&this.instructions.push(fa),this.reverseHitDetectionInstructions(),this.state=null,t.prototype.finish.call(this)},e.prototype.applyStroke=function(e){null!=e.lastStroke&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(fa),e.lastStroke=this.coordinates.length),e.lastStroke=0,t.prototype.applyStroke.call(this,e),this.instructions.push(da)},e}(va),wa=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ta=function(t){function e(e,r,n,i){return t.call(this,e,r,n,i)||this}return wa(e,t),e.prototype.drawFlatCoordinatess_=function(t,e,r,n){var i=this.state,o=void 0!==i.fillStyle,a=void 0!==i.strokeStyle,s=r.length;this.instructions.push(da),this.hitDetectionInstructions.push(da);for(var u=0;u<s;++u){var l=r[u],h=this.coordinates.length,c=this.appendFlatCoordinates(t,e,l,n,!0,!a),p=[ga.MOVE_TO_LINE_TO,h,c];this.instructions.push(p),this.hitDetectionInstructions.push(p),a&&(this.instructions.push(_a),this.hitDetectionInstructions.push(_a)),e=l}return o&&(this.instructions.push(pa),this.hitDetectionInstructions.push(pa)),a&&(this.instructions.push(fa),this.hitDetectionInstructions.push(fa)),e},e.prototype.drawCircle=function(t,e){var r=this.state,n=r.fillStyle,i=r.strokeStyle;if(void 0!==n||void 0!==i){this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([ga.SET_FILL_STYLE,"#000"]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([ga.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var o=t.getFlatCoordinates(),a=t.getStride(),s=this.coordinates.length;this.appendFlatCoordinates(o,0,o.length,a,!1,!1);var u=[ga.CIRCLE,s];this.instructions.push(da,u),this.hitDetectionInstructions.push(da,u),void 0!==r.fillStyle&&(this.instructions.push(pa),this.hitDetectionInstructions.push(pa)),void 0!==r.strokeStyle&&(this.instructions.push(fa),this.hitDetectionInstructions.push(fa)),this.endGeometry(e)}},e.prototype.drawPolygon=function(t,e){var r=this.state,n=r.fillStyle,i=r.strokeStyle;if(void 0!==n||void 0!==i){this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([ga.SET_FILL_STYLE,"#000"]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([ga.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);var o=t.getEnds(),a=t.getOrientedFlatCoordinates(),s=t.getStride();this.drawFlatCoordinatess_(a,0,o,s),this.endGeometry(e)}},e.prototype.drawMultiPolygon=function(t,e){var r=this.state,n=r.fillStyle,i=r.strokeStyle;if(void 0!==n||void 0!==i){this.setFillStrokeStyles_(),this.beginGeometry(t,e),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([ga.SET_FILL_STYLE,"#000"]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([ga.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset]);for(var o=t.getEndss(),a=t.getOrientedFlatCoordinates(),s=t.getStride(),u=0,l=0,h=o.length;l<h;++l)u=this.drawFlatCoordinatess_(a,u,o[l],s);this.endGeometry(e)}},e.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var e=this.tolerance;if(0!==e)for(var r=this.coordinates,n=0,i=r.length;n<i;++n)r[n]=Cn(r[n],e);return t.prototype.finish.call(this)},e.prototype.setFillStrokeStyles_=function(){var t=this.state;void 0!==t.fillStyle&&this.updateFillStyle(t,this.createFill),void 0!==t.strokeStyle&&this.updateStrokeStyle(t,this.applyStroke)},e}(va);function Ca(t,e,r,n,i){var o,a,s,u,l,h,c,p,f,d=r,_=r,g=0,y=0,v=r;for(o=r;o<n;o+=i){var m=e[o],x=e[o+1];void 0!==u&&(p=m-u,f=x-l,s=Math.sqrt(p*p+f*f),void 0!==h&&(y+=a,Math.acos((h*p+c*f)/(a*s))>t&&(y>g&&(g=y,d=v,_=o),y=0,v=o-i)),a=s,h=p,c=f),u=m,l=x}return(y+=s)>g?[v,o]:[d,_]}var Ra={POINT:"point",LINE:"line"},ba=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pa={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Oa={Circle:Ta,Default:va,Image:xa,LineString:Sa,Polygon:Ta,Text:function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.declutterGroups_,o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o}return ba(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var r=this.textFillState_,n=this.textStrokeState_,i=this.textState_;if(""!==this.text_&&i&&(r||n)){var o,a,s=this.coordinates.length,u=t.getType(),l=null,h=2,c=2;if(i.placement===Ra.LINE){if(!Ee(this.getBufferedMaxExtent(),t.getExtent()))return;var p=void 0;if(l=t.getFlatCoordinates(),c=t.getStride(),u==Fe.LINE_STRING)p=[l.length];else if(u==Fe.MULTI_LINE_STRING)p=t.getEnds();else if(u==Fe.POLYGON)p=t.getEnds().slice(0,1);else if(u==Fe.MULTI_POLYGON){var f=t.getEndss();for(p=[],o=0,a=f.length;o<a;++o)p.push(f[o][0])}this.beginGeometry(t,e);for(var d=i.textAlign,_=0,g=void 0,y=0,v=p.length;y<v;++y){if(null==d){var m=Ca(i.maxAngle,l,_,p[y],c);_=m[0],g=m[1]}else g=p[y];for(o=_;o<g;o+=c)this.coordinates.push(l[o],l[o+1]);h=this.coordinates.length,_=p[y];var x=this.declutterGroups_?0===y?this.declutterGroups_[0]:[].concat(this.declutterGroups_[0]):null;this.drawChars_(s,h,x),s=h}this.endGeometry(e)}else{var E=null;switch(i.overflow||(E=[]),u){case Fe.POINT:case Fe.MULTI_POINT:h=(l=t.getFlatCoordinates()).length;break;case Fe.LINE_STRING:l=t.getFlatMidpoint();break;case Fe.CIRCLE:l=t.getCenter();break;case Fe.MULTI_LINE_STRING:h=(l=t.getFlatMidpoints()).length;break;case Fe.POLYGON:l=t.getFlatInteriorPoint(),i.overflow||E.push(l[2]/this.resolution),c=3;break;case Fe.MULTI_POLYGON:var S=t.getFlatInteriorPoints();for(l=[],o=0,a=S.length;o<a;o+=3)i.overflow||E.push(S[o+2]/this.resolution),l.push(S[o],S[o+1]);if(0==(h=l.length))return}h=this.appendFlatCoordinates(l,0,h,c,!1,!1),this.saveTextStates_(),(i.backgroundFill||i.backgroundStroke)&&(this.setFillStrokeStyle(i.backgroundFill,i.backgroundStroke),i.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),i.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);var w=this.pixelRatio;this.instructions.push([ga.DRAW_IMAGE,s,h,null,NaN,NaN,this.declutterGroups_,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,1,NaN,i.padding==po?po:i.padding.map((function(t){return t*w})),!!i.backgroundFill,!!i.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,E]),this.hitDetectionInstructions.push([ga.DRAW_IMAGE,s,h,null,NaN,NaN,this.declutterGroups_,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,1/this.pixelRatio,NaN,i.padding,!!i.backgroundFill,!!i.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,E]),this.endGeometry(e)}}},e.prototype.saveTextStates_=function(){var t=this.textStrokeState_,e=this.textState_,r=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));var i=this.textKey_;i in this.textStates||(this.textStates[i]={font:e.font,textAlign:e.textAlign||"center",textBaseline:e.textBaseline||"middle",scale:e.scale});var o=this.fillKey_;r&&(o in this.fillStates||(this.fillStates[o]={fillStyle:r.fillStyle}))},e.prototype.drawChars_=function(t,e,r){var n=this.textStrokeState_,i=this.textState_,o=this.strokeKey_,a=this.textKey_,s=this.fillKey_;this.saveTextStates_();var u=this.pixelRatio,l=Pa[i.textBaseline],h=this.textOffsetY_*u,c=this.text_,p=i.scale,f=n?n.lineWidth*p/2:0;this.instructions.push([ga.DRAW_CHARS,t,e,l,r,i.overflow,s,i.maxAngle,u,h,o,f*u,c,a,1]),this.hitDetectionInstructions.push([ga.DRAW_CHARS,t,e,l,r,i.overflow,s,i.maxAngle,1,h,o,f,c,a,1/u])},e.prototype.setTextStyle=function(t,e){var r,n,i;if(t){this.declutterGroups_=e;var o=t.getFill();o?((n=this.textFillState_)||(n={},this.textFillState_=n),n.fillStyle=Bi(o.getColor()||"#000")):(n=null,this.textFillState_=n);var a=t.getStroke();if(a){(i=this.textStrokeState_)||(i={},this.textStrokeState_=i);var s=a.getLineDash(),u=a.getLineDashOffset(),l=a.getWidth(),h=a.getMiterLimit();i.lineCap=a.getLineCap()||"round",i.lineDash=s?s.slice():co,i.lineDashOffset=void 0===u?0:u,i.lineJoin=a.getLineJoin()||"round",i.lineWidth=void 0===l?1:l,i.miterLimit=void 0===h?10:h,i.strokeStyle=Bi(a.getColor()||"#000")}else i=null,this.textStrokeState_=i;r=this.textState_;var c=t.getFont()||"10px sans-serif";xo(c);var p=t.getScale();r.overflow=t.getOverflow(),r.font=c,r.maxAngle=t.getMaxAngle(),r.placement=t.getPlacement(),r.textAlign=t.getTextAlign(),r.textBaseline=t.getTextBaseline()||"middle",r.backgroundFill=t.getBackgroundFill(),r.backgroundStroke=t.getBackgroundStroke(),r.padding=t.getPadding()||po,r.scale=void 0===p?1:p;var f=t.getOffsetX(),d=t.getOffsetY(),_=t.getRotateWithView(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===f?0:f,this.textOffsetY_=void 0===d?0:d,this.textRotateWithView_=void 0!==_&&_,this.textRotation_=void 0===g?0:g,this.strokeKey_=i?("string"==typeof i.strokeStyle?i.strokeStyle:S(i.strokeStyle))+i.lineCap+i.lineDashOffset+"|"+i.lineWidth+i.lineJoin+i.miterLimit+"["+i.lineDash.join()+"]":"",this.textKey_=r.font+r.scale+(r.textAlign||"?")+(r.textBaseline||"?"),this.fillKey_=n?"string"==typeof n.fillStyle?n.fillStyle:"|"+S(n.fillStyle):""}else this.text_=""},e}(va)},Ia=function(){function t(t,e,r,n,i){this.declutter_=i,this.declutterGroups_=null,this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=r,this.buildersByZIndex_={}}return t.prototype.addDeclutter=function(t){var e=null;return this.declutter_&&(t?(e=this.declutterGroups_)[0][4]++:(e=[[1/0,1/0,-1/0,-1/0]],this.declutterGroups_=e,e[0].push(1))),e},t.prototype.finish=function(){var t={};for(var e in this.buildersByZIndex_){t[e]=t[e]||{};var r=this.buildersByZIndex_[e];for(var n in r){var i=r[n].finish();t[e][n]=i}}return t},t.prototype.getBuilder=function(t,e){var r=void 0!==t?t.toString():"0",n=this.buildersByZIndex_[r];void 0===n&&(n={},this.buildersByZIndex_[r]=n);var i=n[e];void 0===i&&(i=new(0,Oa[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=i);return i},t}(),La="Circle",Fa="Default",Ma="Image",Aa="LineString",Na="Polygon",Ga="Text";function ja(t,e,r,n){for(var i=t[e],o=t[e+1],a=0,s=e+n;s<r;s+=n){var u=t[s],l=t[s+1];a+=Math.sqrt((u-i)*(u-i)+(l-o)*(l-o)),i=u,o=l}return a}function Da(t,e,r,n,i,o,a,s,u,l,h){for(var c,p,f=[],d=t[e]>t[r-n],_=i.length,g=t[e],y=t[e+1],v=t[e+=n],m=t[e+1],x=0,E=Math.sqrt(Math.pow(v-g,2)+Math.pow(m-y,2)),S=!1,w=0;w<_;++w){for(var T=i[c=d?_-w-1:w],C=s*u(l,T,h),R=o+C/2;e<r-n&&x+E<R;)g=v,y=m,v=t[e+=n],m=t[e+1],x+=E,E=Math.sqrt(Math.pow(v-g,2)+Math.pow(m-y,2));var b=R-x,P=Math.atan2(m-y,v-g);if(d&&(P+=P>0?-Math.PI:Math.PI),void 0!==p){var O=P-p;if(S=S||0!==O,O+=O>Math.PI?-2*Math.PI:O<-Math.PI?2*Math.PI:0,Math.abs(O)>a)return null}p=P;var I=b/E,L=Ye(g,v,I),F=Ye(y,m,I);f[c]=[L,F,C/2,P,T],o+=C}return S?f:[[f[0][0],f[0][1],f[0][2],f[0][3],i]]}var ka=r(0),Ua=r.n(ka),za=[1/0,1/0,-1/0,-1/0],Ba=[1,0,0,1,0,0],Ya=[],Xa=[],Va=[],Wa=[],Za=function(){function t(t,e,r,n){this.overlaps=r,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.declutterItems=[],this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}return t.prototype.createLabel=function(t,e,r,n){var i=t+e+r+n;if(this.labels_[i])return this.labels_[i];var o=n?this.strokeStates[n]:null,a=r?this.fillStates[r]:null,s=this.textStates[e],u=this.pixelRatio,l=s.scale*u,h=Pa[s.textAlign||"center"],c=n&&o.lineWidth?o.lineWidth:0,p=t.split("\n"),f=p.length,d=[],_=function(t,e,r){for(var n=e.length,i=0,o=0;o<n;++o){var a=wo(t,e[o]);i=Math.max(i,a),r.push(a)}return i}(s.font,p,d),g=Eo(s.font),y=g*f,v=_+c,m=[],x={width:Math.ceil((v+2)*l),height:Math.ceil((y+c)*l),contextInstructions:m};(1!=l&&m.push("scale",[l,l]),m.push("font",s.font),n)&&(m.push("strokeStyle",o.strokeStyle),m.push("lineWidth",c),m.push("lineCap",o.lineCap),m.push("lineJoin",o.lineJoin),m.push("miterLimit",o.miterLimit),(Ki?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D).prototype.setLineDash&&(m.push("setLineDash",[o.lineDash]),m.push("lineDashOffset",o.lineDashOffset)));r&&m.push("fillStyle",a.fillStyle),m.push("textBaseline","middle"),m.push("textAlign","center");var E,S=.5-h,w=h*v+S*c;if(n)for(E=0;E<f;++E)m.push("strokeText",[p[E],w+S*d[E],.5*(c+g)+E*g]);if(r)for(E=0;E<f;++E)m.push("fillText",[p[E],w+S*d[E],.5*(c+g)+E*g]);return this.labels_[i]=x,x},t.prototype.replayTextBackground_=function(t,e,r,n,i,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,r),t.lineTo.apply(t,n),t.lineTo.apply(t,i),t.lineTo.apply(t,e),o&&(this.alignFill_=o[2],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())},t.prototype.replayImageOrLabel_=function(t,e,r,n,i,o,a,s,u,l,h,c,p,f,d,_,g,y){var v=g||y;e-=i*=p,r-=o*=p;var m=d+l>n.width?n.width-l:d,x=s+h>n.height?n.height-h:s,E=_[3]+m*p+_[1],S=_[0]+x*p+_[2],w=e-_[3],T=r-_[0];(v||0!==c)&&(Ya[0]=w,Wa[0]=w,Ya[1]=T,Xa[1]=T,Xa[0]=w+E,Va[0]=Xa[0],Va[1]=T+S,Wa[1]=Va[1]);var C=null;if(0!==c){var R=e+i,b=r+o;C=tn(Ba,R,b,1,1,c,-R,-b),Qr(Ba,Ya),Qr(Ba,Xa),Qr(Ba,Va),Qr(Ba,Wa),Vt(Math.min(Ya[0],Xa[0],Va[0],Wa[0]),Math.min(Ya[1],Xa[1],Va[1],Wa[1]),Math.max(Ya[0],Xa[0],Va[0],Wa[0]),Math.max(Ya[1],Xa[1],Va[1],Wa[1]),za)}else Vt(w,T,w+E,T+S,za);var P=t.canvas,O=y?y[2]*p/2:0,I=za[0]-O<=P.width&&za[2]+O>=0&&za[1]-O<=P.height&&za[3]+O>=0;if(f&&(e=Math.round(e),r=Math.round(r)),a){if(!I&&1==a[4])return;$t(a,za);var L=I?[t,C?C.slice(0):null,u,n,l,h,m,x,e,r,p]:null;L&&(v&&L.push(g,y,Ya.slice(0),Xa.slice(0),Va.slice(0),Wa.slice(0)),a.push(L))}else I&&(v&&this.replayTextBackground_(t,Ya,Xa,Va,Wa,g,y),Ro(t,C,u,n,l,h,m,x,e,r,p))},t.prototype.fill_=function(t){if(this.alignFill_){var e=Qr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(e[0]%r,e[1]%r),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.renderDeclutter=function(t,e,r,n){if(t&&t.length>5){var i=t[4];if(1==i||i==t.length-5){var o={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};if(n||(n=new Ua.a(9)),!n.collides(o)){n.insert(o);for(var a=5,s=t.length;a<s;++a){var u=t[a],l=u[0],h=l.globalAlpha;h!==r&&(l.globalAlpha=r),u.length>11&&this.replayTextBackground_(u[0],u[13],u[14],u[15],u[16],u[11],u[12]),Ro.apply(void 0,u),h!==r&&(l.globalAlpha=h)}}t.length=5,Wt(t)}}return n},t.prototype.drawLabelWithPointPlacement_=function(t,e,r,n){var i=this.textStates[e],o=this.createLabel(t,e,n,r),a=this.strokeStates[r],s=this.pixelRatio,u=Pa[i.textAlign||"center"],l=Pa[i.textBaseline||"middle"],h=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:u*(o.width/s-2*i.scale)+2*(.5-u)*h,anchorY:l*o.height/s+2*(.5-l)*h}},t.prototype.execute_=function(t,e,r,n,i,o){var a,s,u;this.declutterItems.length=0,this.pixelCoordinates_&&B(e,this.renderedTransform_)?a=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),a=Me(this.coordinates,0,this.coordinates.length,2,e,this.pixelCoordinates_),s=this.renderedTransform_,u=e,s[0]=u[0],s[1]=u[1],s[2]=u[2],s[3]=u[3],s[4]=u[4],s[5]=u[5]);for(var l,h,c,p,f,d,_,g,y,v,m,x,E,S,w,T,C,R=0,b=r.length,P=0,O=0,I=0,L=null,F=null,M=this.coordinateCache_,A=this.viewRotation_,N=Math.round(1e12*Math.atan2(-e[1],e[0]))/1e12,G={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},j=this.instructions!=r||this.overlaps?0:200;R<b;){var D=r[R];switch(D[0]){case ga.BEGIN_GEOMETRY:(w=D[1]).getGeometry()?void 0===o||Ee(o,D[3])?++R:R=D[2]+1:R=D[2];break;case ga.BEGIN_PATH:O>j&&(this.fill_(t),O=0),I>j&&(t.stroke(),I=0),O||I||(t.beginPath(),p=NaN,f=NaN),++R;break;case ga.CIRCLE:var k=a[P=D[1]],U=a[P+1],z=a[P+2]-k,Y=a[P+3]-U,X=Math.sqrt(z*z+Y*Y);t.moveTo(k+X,U),t.arc(k,U,X,0,2*Math.PI,!0),++R;break;case ga.CLOSE_PATH:t.closePath(),++R;break;case ga.CUSTOM:P=D[1],l=D[2];var V=D[3],W=D[4],Z=6==D.length?D[5]:void 0;G.geometry=V,G.feature=w,R in M||(M[R]=[]);var K=M[R];Z?Z(a,P,l,2,K):(K[0]=a[P],K[1]=a[P+1],K.length=2),W(K,G),++R;break;case ga.DRAW_IMAGE:P=D[1],l=D[2],v=D[3],h=D[4],c=D[5],y=i?null:D[6];var q=D[7],H=D[8],J=D[9],Q=D[10],$=D[11],tt=D[12],et=D[13],rt=D[14];if(!v&&D.length>=19){m=D[18],x=D[19],E=D[20],S=D[21];var nt=this.drawLabelWithPointPlacement_(m,x,E,S);v=nt.label,D[3]=v;var it=D[22];h=(nt.anchorX-it)*this.pixelRatio,D[4]=h;var ot=D[23];c=(nt.anchorY-ot)*this.pixelRatio,D[5]=c,q=v.height,D[7]=q,rt=v.width,D[14]=rt}var at=void 0;D.length>24&&(at=D[24]);var st=void 0,ut=void 0,lt=void 0;D.length>16?(st=D[15],ut=D[16],lt=D[17]):(st=po,ut=!1,lt=!1),$&&N?tt+=A:$||N||(tt-=A);for(var ht=0,ct=0;P<l;P+=2)if(!(at&&at[ht++]<rt/this.pixelRatio)){if(y){var pt=Math.floor(ct);y.length<pt+1&&((g=[1/0,1/0,-1/0,-1/0]).push(y[0][4]),y.push(g)),g=y[pt]}this.replayImageOrLabel_(t,a[P],a[P+1],v,h,c,g,q,H,J,Q,tt,et,n,rt,st,ut?L:null,lt?F:null),g&&(ct===Math.floor(ct)&&this.declutterItems.push(this,g,w),ct+=1/g[4])}++R;break;case ga.DRAW_CHARS:var ft=D[1],dt=D[2],_t=D[3];g=i?null:D[4];var gt=D[5];S=D[6];var yt=D[7],vt=D[8],mt=D[9];E=D[10];var xt=D[11];m=D[12],x=D[13];var Et=D[14],St=this.textStates[x],wt=St.font,Tt=St.scale*vt,Ct=void 0;wt in this.widths_?Ct=this.widths_[wt]:(Ct={},this.widths_[wt]=Ct);var Rt=ja(a,ft,dt,2),bt=Tt*To(wt,m,Ct);if(gt||bt<=Rt){var Pt=this.textStates[x].textAlign,Ot=Da(a,ft,dt,2,m,(Rt-bt)*Pa[Pt],yt,Tt,To,wt,Ct);if(Ot){var It=void 0,Lt=void 0,Ft=void 0,Mt=void 0,At=void 0;if(E)for(It=0,Lt=Ot.length;It<Lt;++It)Ft=(At=Ot[It])[4],Mt=this.createLabel(Ft,x,"",E),h=At[2]+xt,c=_t*Mt.height+2*(.5-_t)*xt-mt,this.replayImageOrLabel_(t,At[0],At[1],Mt,h,c,g,Mt.height,1,0,0,At[3],Et,!1,Mt.width,po,null,null);if(S)for(It=0,Lt=Ot.length;It<Lt;++It)Ft=(At=Ot[It])[4],Mt=this.createLabel(Ft,x,S,""),h=At[2],c=_t*Mt.height-mt,this.replayImageOrLabel_(t,At[0],At[1],Mt,h,c,g,Mt.height,1,0,0,At[3],Et,!1,Mt.width,po,null,null)}}this.declutterItems.push(this,g,w),++R;break;case ga.END_GEOMETRY:if(void 0!==i){var Nt=i(w=D[1]);if(Nt)return Nt}++R;break;case ga.FILL:j?O++:this.fill_(t),++R;break;case ga.MOVE_TO_LINE_TO:for(P=D[1],l=D[2],T=a[P],_=(C=a[P+1])+.5|0,(d=T+.5|0)===p&&_===f||(t.moveTo(T,C),p=d,f=_),P+=2;P<l;P+=2)d=(T=a[P])+.5|0,_=(C=a[P+1])+.5|0,P!=l-2&&d===p&&_===f||(t.lineTo(T,C),p=d,f=_);++R;break;case ga.SET_FILL_STYLE:L=D,this.alignFill_=D[2],O&&(this.fill_(t),O=0,I&&(t.stroke(),I=0)),t.fillStyle=D[1],++R;break;case ga.SET_STROKE_STYLE:F=D,I&&(t.stroke(),I=0),this.setStrokeStyle_(t,D),++R;break;case ga.STROKE:j?I++:t.stroke(),++R;break;default:++R}}O&&this.fill_(t),I&&t.stroke()},t.prototype.execute=function(t,e,r,n){this.viewRotation_=r,this.execute_(t,e,this.instructions,n,void 0,void 0)},t.prototype.executeHitDetection=function(t,e,r,n,i){return this.viewRotation_=r,this.execute_(t,e,this.hitDetectionInstructions,!0,n,i)},t}(),Ka=[Na,La,Aa,Ma,Ga,Fa],qa=function(){function t(t,e,r,n,i,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=r,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=[1,0,0,1,0,0],this.createExecutors_(i)}return t.prototype.clip=function(t,e){var r=this.getClipCoords(e);t.beginPath(),t.moveTo(r[0],r[1]),t.lineTo(r[2],r[3]),t.lineTo(r[4],r[5]),t.lineTo(r[6],r[7]),t.clip()},t.prototype.createExecutors_=function(t){for(var e in t){var r=this.executorsByZIndex_[e];void 0===r&&(r={},this.executorsByZIndex_[e]=r);var n=t[e];for(var i in n){var o=n[i];r[i]=new Za(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}},t.prototype.hasExecutors=function(t){for(var e in this.executorsByZIndex_)for(var r=this.executorsByZIndex_[e],n=0,i=t.length;n<i;++n)if(t[n]in r)return!0;return!1},t.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i,o){var a=2*(n=Math.round(n))+1,s=tn(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-r,-t[0],-t[1]);this.hitDetectionContext_||(this.hitDetectionContext_=Ji(a,a));var u,l=this.hitDetectionContext_;l.canvas.width!==a||l.canvas.height!==a?(l.canvas.width=a,l.canvas.height=a):l.clearRect(0,0,a,a),void 0!==this.renderBuffer_&&(te(u=[1/0,1/0,-1/0,-1/0],t),jt(u,e*(this.renderBuffer_+n),u));var h,c=function(t){if(void 0!==Ha[t])return Ha[t];for(var e=2*t+1,r=new Array(e),n=0;n<e;n++)r[n]=new Array(e);var i=t,o=0,a=0;for(;i>=o;)Ja(r,t+i,t+o),Ja(r,t+o,t+i),Ja(r,t-o,t+i),Ja(r,t-i,t+o),Ja(r,t-i,t-o),Ja(r,t-o,t-i),Ja(r,t+o,t-i),Ja(r,t+i,t-o),o++,2*((a+=1+2*o)-i)+1>0&&(a+=1-2*(i-=1));return Ha[t]=r,r}(n);function p(t){for(var e=l.getImageData(0,0,a,a).data,r=0;r<a;r++)for(var n=0;n<a;n++)if(c[r][n]&&e[4*(n*a+r)+3]>0){var s=void 0;return(!o||h!=Ma&&h!=Ga||-1!==o.indexOf(t))&&(s=i(t)),s||void l.clearRect(0,0,a,a)}}var f,d,_,g,y,v=Object.keys(this.executorsByZIndex_).map(Number);for(v.sort(j),f=v.length-1;f>=0;--f){var m=v[f].toString();for(_=this.executorsByZIndex_[m],d=Ka.length-1;d>=0;--d)if(void 0!==(g=_[h=Ka[d]])&&(y=g.executeHitDetection(l,s,r,p,u)))return y}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var r=e[0],n=e[1],i=e[2],o=e[3],a=[r,n,r,o,i,o,i,n];return Me(a,0,8,2,t,a),a},t.prototype.isEmpty=function(){return F(this.executorsByZIndex_)},t.prototype.execute=function(t,e,r,n,i,o){var a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(j),this.maxExtent_&&(t.save(),this.clip(t,e));var s,u,l,h,c,p,f=i||Ka;for(s=0,u=a.length;s<u;++s){var d=a[s].toString();for(c=this.executorsByZIndex_[d],l=0,h=f.length;l<h;++l){var _=f[l];if(void 0!==(p=c[_]))if(!o||_!=Ma&&_!=Ga)p.execute(t,e,r,n);else{var g=o[d];g?g.push(p,e.slice(0)):o[d]=[p,e.slice(0)]}}}this.maxExtent_&&t.restore()},t}(),Ha={0:[[!0]]};function Ja(t,e,r){var n,i=Math.floor(t.length/2);if(e>=i)for(n=i;n<e;n++)t[n][r]=!0;else if(e<i)for(n=e+1;n<i;n++)t[n][r]=!0}function Qa(t,e,r,n,i,o){for(var a=Object.keys(t).map(Number).sort(j),s=0,u=a.length;s<u;++s)for(var l=t[a[s].toString()],h=void 0,c=0,p=l.length;c<p;){var f=l[c++];f!==h&&(h=f,o.push({items:f.declutterItems,opacity:n}));var d=l[c++];f.execute(e,d,r,i)}}var $a=qa,ts=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),es=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.inversePixelTransform=r,o.frameState=n,o.context=i,o}return ts(e,t),e}(K),rs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ns=function(t){function e(e){var r=t.call(this)||this;return r.boundHandleImageChange_=r.handleImageChange_.bind(r),r.layer_=e,r}return rs(e,t),e.prototype.getFeatures=function(t){return x()},e.prototype.prepareFrame=function(t){return x()},e.prototype.renderFrame=function(t,e){return x()},e.prototype.loadedTileCallback=function(t,e,r){t[e]||(t[e]={}),t[e][r.tileCoord.toString()]=r},e.prototype.createLoadedTileFinder=function(t,e,r){return function(n,i){var o=this.loadedTileCallback.bind(this,r,n);return t.forEachLoadedTile(e,n,i,o)}.bind(this)},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){},e.prototype.getDataAtPixel=function(t,e,r){return x()},e.prototype.getLayer=function(){return this.layer_},e.prototype.handleFontsChanged=function(){},e.prototype.handleImageChange_=function(t){t.target.getState()===oo&&this.renderIfReadyAndVisible()},e.prototype.loadImage=function(t){var e=t.getState();return e!=oo&&e!=ao&&t.addEventListener(J,this.boundHandleImageChange_),e==no&&(t.load(),e=t.getState()),e==oo},e.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();t.getVisible()&&t.getSourceState()==Pi&&t.changed()},e}(pt),is=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),os=function(t){function e(e){var r=t.call(this,e)||this;return r.container=null,r.renderedResolution,r.tempTransform_=[1,0,0,1,0,0],r.pixelTransform=[1,0,0,1,0,0],r.inversePixelTransform=[1,0,0,1,0,0],r.context=null,r.containerReused=!1,r}return is(e,t),e.prototype.useContainer=function(t,e,r){var n,i,o=this.getLayer().getClassName();t&&""===t.style.opacity&&t.className===o&&((s=t.firstElementChild)instanceof HTMLCanvasElement&&(i=s.getContext("2d")));if(i&&i.canvas.style.transform===e?(this.container=t,this.context=i,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){(n=document.createElement("div")).className=o;var a=n.style;a.position="absolute",a.width="100%",a.height="100%";var s=(i=Ji()).canvas;n.appendChild(s),(a=s.style).position="absolute",a.left="0",a.transformOrigin="top left",this.container=n,this.context=i}},e.prototype.clip=function(t,e,r){var n=e.pixelRatio,i=e.size[0]*n/2,o=e.size[1]*n/2,a=e.viewState.rotation,s=ve(r),u=me(r),l=ue(r),h=se(r);Qr(e.coordinateToPixelTransform,s),Qr(e.coordinateToPixelTransform,u),Qr(e.coordinateToPixelTransform,l),Qr(e.coordinateToPixelTransform,h),t.save(),Co(t,-a,i,o),t.beginPath(),t.moveTo(s[0]*n,s[1]*n),t.lineTo(u[0]*n,u[1]*n),t.lineTo(l[0]*n,l[1]*n),t.lineTo(h[0]*n,h[1]*n),t.clip(),Co(t,a,i,o)},e.prototype.clipUnrotated=function(t,e,r){var n=ve(r),i=me(r),o=ue(r),a=se(r);Qr(e.coordinateToPixelTransform,n),Qr(e.coordinateToPixelTransform,i),Qr(e.coordinateToPixelTransform,o),Qr(e.coordinateToPixelTransform,a);var s=this.inversePixelTransform;Qr(s,n),Qr(s,i),Qr(s,o),Qr(s,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(i[0]),Math.round(i[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()},e.prototype.dispatchRenderEvent_=function(t,e,r){var n=this.getLayer();if(n.hasListener(t)){var i=new es(t,this.inversePixelTransform,r,e);n.dispatchEvent(i)}},e.prototype.preRender=function(t,e){this.dispatchRenderEvent_(Ei,t,e)},e.prototype.postRender=function(t,e){this.dispatchRenderEvent_(Si,t,e)},e.prototype.getRenderTransform=function(t,e,r,n,i,o,a){var s=i/2,u=o/2,l=n/e,h=-l,c=-t[0]+a,p=-t[1];return tn(this.tempTransform_,s,u,l,h,-r,c,p)},e.prototype.getDataAtPixel=function(t,e,r){var n,i=Qr(this.inversePixelTransform,t.slice()),o=this.context;try{n=o.getImageData(Math.round(i[0]),Math.round(i[1]),1,1).data}catch(t){return"SecurityError"===t.name?new Uint8Array:n}return 0===n[3]?null:n},e}(ns),as={Point:function(t,e,r,n){var i=r.getImage();if(i){if(i.getImageState()!=oo)return;var o=t.getBuilder(r.getZIndex(),Ma);o.setImageStyle(i,t.addDeclutter(!1)),o.drawPoint(e,n)}var a=r.getText();if(a){var s=t.getBuilder(r.getZIndex(),Ga);s.setTextStyle(a,t.addDeclutter(!!i)),s.drawText(e,n)}},LineString:function(t,e,r,n){var i=r.getStroke();if(i){var o=t.getBuilder(r.getZIndex(),Aa);o.setFillStrokeStyle(null,i),o.drawLineString(e,n)}var a=r.getText();if(a){var s=t.getBuilder(r.getZIndex(),Ga);s.setTextStyle(a,t.addDeclutter(!1)),s.drawText(e,n)}},Polygon:function(t,e,r,n){var i=r.getFill(),o=r.getStroke();if(i||o){var a=t.getBuilder(r.getZIndex(),Na);a.setFillStrokeStyle(i,o),a.drawPolygon(e,n)}var s=r.getText();if(s){var u=t.getBuilder(r.getZIndex(),Ga);u.setTextStyle(s,t.addDeclutter(!1)),u.drawText(e,n)}},MultiPoint:function(t,e,r,n){var i=r.getImage();if(i){if(i.getImageState()!=oo)return;var o=t.getBuilder(r.getZIndex(),Ma);o.setImageStyle(i,t.addDeclutter(!1)),o.drawMultiPoint(e,n)}var a=r.getText();if(a){var s=t.getBuilder(r.getZIndex(),Ga);s.setTextStyle(a,t.addDeclutter(!!i)),s.drawText(e,n)}},MultiLineString:function(t,e,r,n){var i=r.getStroke();if(i){var o=t.getBuilder(r.getZIndex(),Aa);o.setFillStrokeStyle(null,i),o.drawMultiLineString(e,n)}var a=r.getText();if(a){var s=t.getBuilder(r.getZIndex(),Ga);s.setTextStyle(a,t.addDeclutter(!1)),s.drawText(e,n)}},MultiPolygon:function(t,e,r,n){var i=r.getFill(),o=r.getStroke();if(o||i){var a=t.getBuilder(r.getZIndex(),Na);a.setFillStrokeStyle(i,o),a.drawMultiPolygon(e,n)}var s=r.getText();if(s){var u=t.getBuilder(r.getZIndex(),Ga);u.setTextStyle(s,t.addDeclutter(!1)),u.drawText(e,n)}},GeometryCollection:function(t,e,r,n){var i,o,a=e.getGeometriesArray();for(i=0,o=a.length;i<o;++i){(0,as[a[i].getType()])(t,a[i],r,n)}},Circle:function(t,e,r,n){var i=r.getFill(),o=r.getStroke();if(i||o){var a=t.getBuilder(r.getZIndex(),La);a.setFillStrokeStyle(i,o),a.drawCircle(e,n)}var s=r.getText();if(s){var u=t.getBuilder(r.getZIndex(),Ga);u.setTextStyle(s,t.addDeclutter(!1)),u.drawText(e,n)}}};function ss(t,e){return parseInt(S(t),10)-parseInt(S(e),10)}function us(t,e){var r=ls(t,e);return r*r}function ls(t,e){return.5*t/e}function hs(t,e,r,n,i,o){var a=!1,s=r.getImage();if(s){var u=s.getImageState();u==oo||u==ao?s.unlistenImageChange(i):(u==no&&s.load(),u=s.getImageState(),s.listenImageChange(i),a=!0)}return function(t,e,r,n,i){var o=r.getGeometryFunction()(e);if(!o)return;var a=o.simplifyTransformed(n,i);if(r.getRenderer())!function t(e,r,n,i){if(r.getType()==Fe.GEOMETRY_COLLECTION){for(var o=r.getGeometries(),a=0,s=o.length;a<s;++a)t(e,o[a],n,i);return}e.getBuilder(n.getZIndex(),Fa).drawCustom(r,i,n.getRenderer())}(t,a,r,e);else{(0,as[a.getType()])(t,a,r,e)}}(t,e,r,n,o),a}var cs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ps=function(t){function e(e,r,n,i,o,a,s){var u=t.call(this)||this;return u.context_=e,u.pixelRatio_=r,u.extent_=n,u.transform_=i,u.viewRotation_=o,u.squaredTolerance_=a,u.userTransform_=s,u.contextFillState_=null,u.contextStrokeState_=null,u.contextTextState_=null,u.fillState_=null,u.strokeState_=null,u.image_=null,u.imageAnchorX_=0,u.imageAnchorY_=0,u.imageHeight_=0,u.imageOpacity_=0,u.imageOriginX_=0,u.imageOriginY_=0,u.imageRotateWithView_=!1,u.imageRotation_=0,u.imageScale_=0,u.imageWidth_=0,u.text_="",u.textOffsetX_=0,u.textOffsetY_=0,u.textRotateWithView_=!1,u.textRotation_=0,u.textScale_=0,u.textFillState_=null,u.textStrokeState_=null,u.textState_=null,u.pixelCoordinates_=[],u.tmpLocalTransform_=[1,0,0,1,0,0],u}return cs(e,t),e.prototype.drawImages_=function(t,e,r,n){if(this.image_){var i=Me(t,e,r,2,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,s=o.globalAlpha;1!=this.imageOpacity_&&(o.globalAlpha=s*this.imageOpacity_);var u=this.imageRotation_;this.imageRotateWithView_&&(u+=this.viewRotation_);for(var l=0,h=i.length;l<h;l+=2){var c=i[l]-this.imageAnchorX_,p=i[l+1]-this.imageAnchorY_;if(0!==u||1!=this.imageScale_){var f=c+this.imageAnchorX_,d=p+this.imageAnchorY_;tn(a,f,d,this.imageScale_,this.imageScale_,u,-f,-d),o.setTransform.apply(o,a)}o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,c,p,this.imageWidth_,this.imageHeight_)}0===u&&1==this.imageScale_||o.setTransform(1,0,0,1,0,0),1!=this.imageOpacity_&&(o.globalAlpha=s)}},e.prototype.drawText_=function(t,e,r,n){if(this.textState_&&""!==this.text_){this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);var i=Me(t,e,r,n,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.textRotateWithView_&&(a+=this.viewRotation_);e<r;e+=n){var s=i[e]+this.textOffsetX_,u=i[e+1]+this.textOffsetY_;if(0!==a||1!=this.textScale_){var l=tn(this.tmpLocalTransform_,s,u,this.textScale_,this.textScale_,a,-s,-u);o.setTransform.apply(o,l)}this.textStrokeState_&&o.strokeText(this.text_,s,u),this.textFillState_&&o.fillText(this.text_,s,u)}0===a&&1==this.textScale_||o.setTransform(1,0,0,1,0,0)}},e.prototype.moveToLineTo_=function(t,e,r,n,i){var o=this.context_,a=Me(t,e,r,n,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);var s=a.length;i&&(s-=2);for(var u=2;u<s;u+=2)o.lineTo(a[u],a[u+1]);return i&&o.closePath(),r},e.prototype.drawRings_=function(t,e,r,n){for(var i=0,o=r.length;i<o;++i)e=this.moveToLineTo_(t,e,r[i],n,!0);return e},e.prototype.drawCircle=function(t){if(Ee(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var e=function(t,e,r){var n=t.getFlatCoordinates();if(n){var i=t.getStride();return Me(n,0,n.length,i,e,r)}return null}(t,this.transform_,this.pixelCoordinates_),r=e[2]-e[0],n=e[3]-e[1],i=Math.sqrt(r*r+n*n),o=this.context_;o.beginPath(),o.arc(e[0],e[1],i,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}},e.prototype.setStyle=function(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())},e.prototype.setTransform=function(t){this.transform_=t},e.prototype.drawGeometry=function(t){switch(t.getType()){case Fe.POINT:this.drawPoint(t);break;case Fe.LINE_STRING:this.drawLineString(t);break;case Fe.POLYGON:this.drawPolygon(t);break;case Fe.MULTI_POINT:this.drawMultiPoint(t);break;case Fe.MULTI_LINE_STRING:this.drawMultiLineString(t);break;case Fe.MULTI_POLYGON:this.drawMultiPolygon(t);break;case Fe.GEOMETRY_COLLECTION:this.drawGeometryCollection(t);break;case Fe.CIRCLE:this.drawCircle(t)}},e.prototype.drawFeature=function(t,e){var r=e.getGeometryFunction()(t);r&&Ee(this.extent_,r.getExtent())&&(this.setStyle(e),this.drawGeometry(r))},e.prototype.drawGeometryCollection=function(t){for(var e=t.getGeometriesArray(),r=0,n=e.length;r<n;++r)this.drawGeometry(e[r])},e.prototype.drawPoint=function(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var e=t.getFlatCoordinates(),r=t.getStride();this.image_&&this.drawImages_(e,0,e.length,r),""!==this.text_&&this.drawText_(e,0,e.length,r)},e.prototype.drawMultiPoint=function(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var e=t.getFlatCoordinates(),r=t.getStride();this.image_&&this.drawImages_(e,0,e.length,r),""!==this.text_&&this.drawText_(e,0,e.length,r)},e.prototype.drawLineString=function(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ee(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var e=this.context_,r=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(r,0,r.length,t.getStride(),!1),e.stroke()}if(""!==this.text_){var n=t.getFlatMidpoint();this.drawText_(n,0,2,2)}}},e.prototype.drawMultiLineString=function(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var e=t.getExtent();if(Ee(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,n=t.getFlatCoordinates(),i=0,o=t.getEnds(),a=t.getStride();r.beginPath();for(var s=0,u=o.length;s<u;++s)i=this.moveToLineTo_(n,i,o[s],a,!1);r.stroke()}if(""!==this.text_){var l=t.getFlatMidpoints();this.drawText_(l,0,l.length,2)}}},e.prototype.drawPolygon=function(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ee(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){var r=t.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},e.prototype.drawMultiPolygon=function(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Ee(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var e=this.context_,r=t.getOrientedFlatCoordinates(),n=0,i=t.getEndss(),o=t.getStride();e.beginPath();for(var a=0,s=i.length;a<s;++a){var u=i[a];n=this.drawRings_(r,n,u,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){var l=t.getFlatInteriorPoints();this.drawText_(l,0,l.length,2)}}},e.prototype.setContextFillState_=function(t){var e=this.context_,r=this.contextFillState_;r?r.fillStyle!=t.fillStyle&&(r.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})},e.prototype.setContextStrokeState_=function(t){var e=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=t.lineCap&&(r.lineCap=t.lineCap,e.lineCap=t.lineCap),e.setLineDash&&(B(r.lineDash,t.lineDash)||e.setLineDash(r.lineDash=t.lineDash),r.lineDashOffset!=t.lineDashOffset&&(r.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset)),r.lineJoin!=t.lineJoin&&(r.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),r.lineWidth!=t.lineWidth&&(r.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),r.miterLimit!=t.miterLimit&&(r.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),r.strokeStyle!=t.strokeStyle&&(r.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})},e.prototype.setContextTextState_=function(t){var e=this.context_,r=this.contextTextState_,n=t.textAlign?t.textAlign:"center";r?(r.font!=t.font&&(r.font=t.font,e.font=t.font),r.textAlign!=n&&(r.textAlign=n,e.textAlign=n),r.textBaseline!=t.textBaseline&&(r.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})},e.prototype.setFillStrokeStyle=function(t,e){if(t){var r=t.getColor();this.fillState_={fillStyle:Bi(r||"#000")}}else this.fillState_=null;if(e){var n=e.getColor(),i=e.getLineCap(),o=e.getLineDash(),a=e.getLineDashOffset(),s=e.getLineJoin(),u=e.getWidth(),l=e.getMiterLimit();this.strokeState_={lineCap:void 0!==i?i:"round",lineDash:o||co,lineDashOffset:a||0,lineJoin:void 0!==s?s:"round",lineWidth:this.pixelRatio_*(void 0!==u?u:1),miterLimit:void 0!==l?l:10,strokeStyle:Bi(n||"#000")}}else this.strokeState_=null},e.prototype.setImageStyle=function(t){if(t){var e=t.getAnchor(),r=t.getImage(1),n=t.getOrigin(),i=t.getSize();this.imageAnchorX_=e[0],this.imageAnchorY_=e[1],this.imageHeight_=i[1],this.image_=r,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=n[0],this.imageOriginY_=n[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation(),this.imageScale_=t.getScale()*this.pixelRatio_,this.imageWidth_=i[0]}else this.image_=null},e.prototype.setTextStyle=function(t){if(t){var e=t.getFill();if(e){var r=e.getColor();this.textFillState_={fillStyle:Bi(r||"#000")}}else this.textFillState_=null;var n=t.getStroke();if(n){var i=n.getColor(),o=n.getLineCap(),a=n.getLineDash(),s=n.getLineDashOffset(),u=n.getLineJoin(),l=n.getWidth(),h=n.getMiterLimit();this.textStrokeState_={lineCap:void 0!==o?o:"round",lineDash:a||co,lineDashOffset:s||0,lineJoin:void 0!==u?u:"round",lineWidth:void 0!==l?l:1,miterLimit:void 0!==h?h:10,strokeStyle:Bi(i||"#000")}}else this.textStrokeState_=null;var c=t.getFont(),p=t.getOffsetX(),f=t.getOffsetY(),d=t.getRotateWithView(),_=t.getRotation(),g=t.getScale(),y=t.getText(),v=t.getTextAlign(),m=t.getTextBaseline();this.textState_={font:void 0!==c?c:"10px sans-serif",textAlign:void 0!==v?v:"center",textBaseline:void 0!==m?m:"middle"},this.text_=void 0!==y?y:"",this.textOffsetX_=void 0!==p?this.pixelRatio_*p:0,this.textOffsetY_=void 0!==f?this.pixelRatio_*f:0,this.textRotateWithView_=void 0!==d&&d,this.textRotation_=void 0!==_?_:0,this.textScale_=this.pixelRatio_*(void 0!==g?g:1)}else this.text_=""},e}(ha),fs={FRACTION:"fraction",PIXELS:"pixels"},ds=function(){function t(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return t.prototype.clear=function(){this.cache_={},this.cacheSize_=0},t.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var r=this.cache_[e];0!=(3&t++)||r.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,r){var n=_s(t,e,r);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,r,n){var i=_s(t,e,r);this.cache_[i]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}();function _s(t,e,r){return e+":"+t+":"+(r?function(t){return"string"==typeof t?t:zi(t)}(r):"null")}var gs=new ds,ys=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vs=function(t){function e(e,r,n,i){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=n,o.resolution=r,o.state=i,o}return ys(e,t),e.prototype.changed=function(){this.dispatchEvent(J)},e.prototype.getExtent=function(){return this.extent},e.prototype.getImage=function(){return x()},e.prototype.getPixelRatio=function(){return this.pixelRatio_},e.prototype.getResolution=function(){return this.resolution},e.prototype.getState=function(){return this.state},e.prototype.load=function(){x()},e}(H),ms=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function xs(t,e,r){var n=t;if(n.src&&qi){var i=n.decode(),o=!0;return i.then((function(){o&&e()})).catch((function(t){o&&("EncodingError"===t.name&&"Invalid image type."===t.message?e():r())})),function(){o=!1}}var a=[A(n,st,e),A(n,Q,r)];return function(){a.forEach(N)}}var Es=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,n,no)||this;return s.src_=i,s.image_=new Image,null!==o&&(s.image_.crossOrigin=o),s.unlisten_=null,s.state=no,s.imageLoadFunction_=a,s}return ms(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=ao,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=fe(this.extent)/this.image_.height),this.state=oo,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=no&&this.state!=ao||(this.state=io,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=xs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(vs),Ss=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ws=function(t){function e(e,r,n,i,o,a){var s=t.call(this)||this;return s.hitDetectionImage_=null,s.image_=e||new Image,null!==i&&(s.image_.crossOrigin=i),s.canvas_=a?document.createElement("canvas"):null,s.color_=a,s.unlisten_=null,s.imageState_=o,s.size_=n,s.src_=r,s.tainted_,s}return Ss(e,t),e.prototype.isTainted_=function(t){if(void 0===this.tainted_&&this.imageState_===oo){t||(t=Ji(1,1)).drawImage(this.image_,0,0);try{t.getImageData(0,0,1,1),this.tainted_=!1}catch(t){this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(J)},e.prototype.handleImageError_=function(){this.imageState_=ao,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=oo,this.size_&&(this.image_.width=this.size_[0],this.image_.height=this.size_[1]),this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.replaceColor_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.canvas_?this.canvas_:this.image_},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(t){if(!this.hitDetectionImage_)if(this.isTainted_()){var e=this.size_[0],r=this.size_[1],n=Ji(e,r);n.fillRect(0,0,e,r),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==no){this.imageState_=io;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=xs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(){if(this.color_){this.canvas_.width=this.image_.width,this.canvas_.height=this.image_.height;var t=this.canvas_.getContext("2d");if(t.drawImage(this.image_,0,0),this.isTainted_(t)){var e=this.color_;return t.globalCompositeOperation="multiply",t.fillStyle="rgb("+e[0]+","+e[1]+","+e[2]+")",t.fillRect(0,0,this.image_.width,this.image_.height),t.globalCompositeOperation="destination-in",void t.drawImage(this.image_,0,0)}for(var r=t.getImageData(0,0,this.image_.width,this.image_.height),n=r.data,i=this.color_[0]/255,o=this.color_[1]/255,a=this.color_[2]/255,s=0,u=n.length;s<u;s+=4)n[s]*=i,n[s+1]*=o,n[s+2]*=a;t.putImageData(r,0,0)}},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(H);var Ts=ws,Cs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"},Rs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bs=function(t){function e(e){var r=this,n=e||{},i=void 0!==n.opacity?n.opacity:1,o=void 0!==n.rotation?n.rotation:0,a=void 0!==n.scale?n.scale:1,s=void 0!==n.rotateWithView&&n.rotateWithView;(r=t.call(this,{opacity:i,rotation:o,scale:a,displacement:void 0!==n.displacement?n.displacement:[0,0],rotateWithView:s})||this).anchor_=void 0!==n.anchor?n.anchor:[.5,.5],r.normalizedAnchor_=null,r.anchorOrigin_=void 0!==n.anchorOrigin?n.anchorOrigin:Cs.TOP_LEFT,r.anchorXUnits_=void 0!==n.anchorXUnits?n.anchorXUnits:fs.FRACTION,r.anchorYUnits_=void 0!==n.anchorYUnits?n.anchorYUnits:fs.FRACTION,r.crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null;var u=void 0!==n.img?n.img:null,l=void 0!==n.imgSize?n.imgSize:null,h=n.src;wt(!(void 0!==h&&u),4),wt(!u||u&&l,5),void 0!==h&&0!==h.length||!u||(h=u.src||S(u)),wt(void 0!==h&&h.length>0,6);var c=void 0!==n.src?no:oo;return r.color_=void 0!==n.color?ki(n.color):null,r.iconImage_=function(t,e,r,n,i,o){var a=gs.get(e,n,o);return a||(a=new ws(t,e,r,n,i,o),gs.set(e,n,o,a)),a}(u,h,l,r.crossOrigin_,c,r.color_),r.offset_=void 0!==n.offset?n.offset:[0,0],r.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:Cs.TOP_LEFT,r.origin_=null,r.size_=void 0!==n.size?n.size:null,r}return Rs(e,t),e.prototype.clone=function(){return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:this.getScale(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==fs.FRACTION||this.anchorYUnits_==fs.FRACTION){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==fs.FRACTION&&(t[0]*=e[0]),this.anchorYUnits_==fs.FRACTION&&(t[1]*=e[1])}if(this.anchorOrigin_!=Cs.TOP_LEFT){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=Cs.TOP_RIGHT&&this.anchorOrigin_!=Cs.BOTTOM_RIGHT||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Cs.BOTTOM_LEFT&&this.anchorOrigin_!=Cs.BOTTOM_RIGHT||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(t){return this.iconImage_.getHitDetectionImage(t)},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_,e=this.getDisplacement();if(this.offsetOrigin_!=Cs.TOP_LEFT){var r=this.getSize(),n=this.iconImage_.getSize();if(!r||!n)return null;t=t.slice(),this.offsetOrigin_!=Cs.TOP_RIGHT&&this.offsetOrigin_!=Cs.BOTTOM_RIGHT||(t[0]=n[0]-r[0]-t[0]),this.offsetOrigin_!=Cs.BOTTOM_LEFT&&this.offsetOrigin_!=Cs.BOTTOM_RIGHT||(t[1]=n[1]-r[1]-t[1])}return t[0]+=e[0],t[1]+=e[1],this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(J,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(J,t)},e}(Oo);function Ps(t,e,r,n,i,o,a){var s=Ji(t[0]/2,t[1]/2);s.imageSmoothingEnabled=!1;for(var u=s.canvas,l=new ps(s,.5,i,null,a),h=r.length,c=Math.floor(16777215/h),p={},f=1;f<=h;++f){var d=r[f-1],_=d.getStyleFunction()||n;if(n){var g=_(d,o);if(g){Array.isArray(g)||(g=[g]);for(var y="#"+("000000"+(f*c).toString(16)).slice(-6),v=0,m=g.length;v<m;++v){var x=g[v],E=x.clone(),S=E.getFill();S&&S.setColor(y);var w=E.getStroke();w&&w.setColor(y),E.setText(void 0);var T=x.getImage();if(T){var C=T.getImageSize();if(!C)continue;var R=document.createElement("canvas");R.width=C[0],R.height=C[1];var b=R.getContext("2d",{alpha:!1});b.fillStyle=y;var P=b.canvas;b.fillRect(0,0,P.width,P.height),Ji(C?C[0]:P.width,C?C[1]:P.height).drawImage(P,0,0),E.setImage(new bs({img:P,imgSize:C,anchor:T.getAnchor(),anchorXUnits:fs.PIXELS,anchorYUnits:fs.PIXELS,offset:T.getOrigin(),size:T.getSize(),opacity:T.getOpacity(),scale:T.getScale(),rotation:T.getRotation(),rotateWithView:T.getRotateWithView()}))}var O=Number(E.getZIndex());(M=p[O])||(M={},p[O]=M,M[Fe.POLYGON]=[],M[Fe.CIRCLE]=[],M[Fe.LINE_STRING]=[],M[Fe.POINT]=[]);var I=E.getGeometryFunction()(d);I&&Ee(i,I.getExtent())&&M[I.getType().replace("Multi","")].push(I,E)}}}}for(var L=Object.keys(p).map(Number).sort(j),F=(f=0,L.length);f<F;++f){var M=p[L[f]];for(var A in M){var N=M[A];for(v=0,m=N.length;v<m;v+=2){l.setStyle(N[v+1]);for(var G=0,D=e.length;G<D;++G)l.setTransform(e[G]),l.drawGeometry(N[v])}}}return document.body.appendChild(s.canvas),s.getImageData(0,0,u.width,u.height)}function Os(t,e,r){var n=[];if(r){var i=4*(Math.round(t[0]/2)+Math.round(t[1]/2)*r.width),o=r.data[i],a=r.data[i+1],s=r.data[i+2]+256*(a+256*o),u=Math.floor(16777215/e.length);s&&s%u==0&&n.push(e[s/u-1])}return n}var Is=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ls=function(t){function e(e){var r=t.call(this,e)||this;return r.boundHandleStyleImageChange_=r.handleStyleImageChange_.bind(r),r.animatingOrInteracting_,r.dirty_=!1,r.hitDetectionImageData_=null,r.renderedFeatures_=null,r.renderedRevision_=-1,r.renderedResolution_=NaN,r.renderedExtent_=[1/0,1/0,-1/0,-1/0],r.renderedRotation_,r.renderedCenter_=null,r.renderedProjection_=null,r.renderedRenderOrder_=null,r.replayGroup_=null,r.replayGroupChanged=!0,r}return Is(e,t),e.prototype.useContainer=function(e,r,n){n<1&&(e=null),t.prototype.useContainer.call(this,e,r,n)},e.prototype.renderFrame=function(t,e){var r=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];!function(t,e,r){Jr(t,e,0,0,r,0,0)}(this.pixelTransform,1/r,1/r),en(this.inversePixelTransform,this.pixelTransform);var i=rn(this.pixelTransform);this.useContainer(e,i,n.opacity);var o=this.context,a=o.canvas,s=this.replayGroup_;if(!s||s.isEmpty())return!this.containerReused&&a.width>0&&(a.width=0),this.container;var u=Math.round(t.size[0]*r),l=Math.round(t.size[1]*r);a.width!=u||a.height!=l?(a.width=u,a.height=l,a.style.transform!==i&&(a.style.transform=i)):this.containerReused||o.clearRect(0,0,u,l),this.preRender(o,t);var h=t.extent,c=t.viewState,p=c.center,f=c.resolution,d=c.projection,_=c.rotation,g=d.getExtent(),y=this.getLayer().getSource(),v=!1;if(n.extent){var m=Wr(n.extent,d);(v=!zt(m,t.extent)&&Ee(m,t.extent))&&this.clip(o,t,m)}var x=t.viewHints,E=!(x[Vo]||x[Wo]),S=this.getRenderTransform(p,f,_,r,u,l,0),w=this.getLayer().getDeclutter()?{}:null;if(s.execute(o,S,_,E,void 0,w),y.getWrapX()&&d.canWrapX()&&!zt(g,h)){for(var T=h[0],C=xe(g),R=0,b=void 0;T<g[0];){b=C*--R;var P=this.getRenderTransform(p,f,_,r,u,l,b);s.execute(o,P,_,E,void 0,w),T+=C}for(R=0,T=h[2];T>g[2];){b=C*++R;var O=this.getRenderTransform(p,f,_,r,u,l,b);s.execute(o,O,_,E,void 0,w),T-=C}}if(w){var I=t.viewHints;Qa(w,o,_,1,!(I[Vo]||I[Wo]),t.declutterItems)}v&&o.restore(),this.postRender(o,t);var L=n.opacity,F=this.container;return L!==parseFloat(F.style.opacity)&&(F.style.opacity=1===L?"":L),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e,r){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var n=[this.context.canvas.width,this.context.canvas.height];Qr(this.pixelTransform,n);var i=this.renderedCenter_,o=this.renderedResolution_,a=this.renderedRotation_,s=this.renderedProjection_,u=this.renderedExtent_,l=this.getLayer(),h=[],c=n[0]/2,p=n[1]/2;h.push(this.getRenderTransform(i,o,a,.5,c,p,0).slice());var f=l.getSource(),d=s.getExtent();if(f.getWrapX()&&s.canWrapX()&&!zt(d,u)){for(var _=u[0],g=xe(d),y=0,v=void 0;_<d[0];)v=g*--y,h.push(this.getRenderTransform(i,o,a,.5,c,p,v).slice()),_+=g;for(y=0,_=u[2];_>d[2];)v=g*++y,h.push(this.getRenderTransform(i,o,a,.5,c,p,v).slice()),_-=g}this.hitDetectionImageData_=Ps(n,h,this.renderedFeatures_,l.getStyleFunction(),u,o,a)}e(Os(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){if(this.replayGroup_){var o=e.viewState.resolution,a=e.viewState.rotation,s=this.getLayer(),u={};return this.replayGroup_.forEachFeatureAtCoordinate(t,o,a,r,(function(t){var e=S(t);if(!(e in u))return u[e]=!0,n(t,s)}),s.getDeclutter()?i:null)}},e.prototype.handleFontsChanged=function(){var t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.prepareFrame=function(t){var e=this.getLayer(),r=e.getSource();if(!r)return!1;var n=t.viewHints[Vo],i=t.viewHints[Wo],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(!this.dirty_&&!o&&n||!a&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var s=t.extent,u=t.viewState,l=u.projection,h=u.resolution,c=t.pixelRatio,p=e.getRevision(),f=e.getRenderBuffer(),d=e.getRenderOrder();void 0===d&&(d=ss);var _=u.center.slice(),g=jt(s,f*h),y=[g.slice()],v=l.getExtent();if(r.getWrapX()&&l.canWrapX()&&!zt(v,t.extent)){var m=xe(v),x=Math.max(xe(g)/2,m);g[0]=v[0]-x,g[2]=v[2]+x,la(_,l);var E=be(y[0],l);E[0]<v[0]&&E[2]<v[2]?y.push([E[0]+m,E[1],E[2]+m,E[3]]):E[0]>v[0]&&E[2]>v[2]&&y.push([E[0]-m,E[1],E[2]-m,E[3]])}if(!this.dirty_&&this.renderedResolution_==h&&this.renderedRevision_==p&&this.renderedRenderOrder_==d&&zt(this.renderedExtent_,g))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var S,w=new Ia(ls(h,c),g,h,c,e.getDeclutter()),T=zr();if(T){for(var C=0,R=y.length;C<R;++C)r.loadFeatures(Vr(y[C],l),h,T);S=Mr(T,l)}else for(C=0,R=y.length;C<R;++C)r.loadFeatures(y[C],h,l);var b=us(h,c),P=function(t){var r,n=t.getStyleFunction()||e.getStyleFunction();if(n&&(r=n(t,h)),r){var i=this.renderFeature(t,b,r,w,S);this.dirty_=this.dirty_||i}}.bind(this),O=Vr(g,l),I=r.getFeaturesInExtent(O);d&&I.sort(d);for(C=0,R=I.length;C<R;++C)P(I[C]);this.renderedFeatures_=I;var L=w.finish(),F=new $a(g,h,c,r.getOverlaps(),L,e.getRenderBuffer());return this.renderedResolution_=h,this.renderedRevision_=p,this.renderedRenderOrder_=d,this.renderedExtent_=g,this.renderedRotation_=u.rotation,this.renderedCenter_=_,this.renderedProjection_=l,this.replayGroup_=F,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},e.prototype.renderFeature=function(t,e,r,n,i){if(!r)return!1;var o=!1;if(Array.isArray(r))for(var a=0,s=r.length;a<s;++a)o=hs(n,t,r[a],e,this.boundHandleStyleImageChange_,i)||o;else o=hs(n,t,r,e,this.boundHandleStyleImageChange_,i);return o},e}(os),Fs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ms=function(t){function e(e){return t.call(this,e)||this}return Fs(e,t),e.prototype.createRenderer=function(){return new Ls(this)},e}(Xo),As=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new Ao({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:Ra.POINT,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:this.getScale(),text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}();function Ns(t,e,r,n,i,o){var a=NaN,s=NaN,u=(r-e)/n;if(1===u)a=t[e],s=t[e+1];else if(2==u)a=(1-i)*t[e]+i*t[e+n],s=(1-i)*t[e+1]+i*t[e+n+1];else if(0!==u){for(var l=t[e],h=t[e+1],c=0,p=[0],f=e+n;f<r;f+=n){var d=t[f],_=t[f+1];c+=Math.sqrt((d-l)*(d-l)+(_-h)*(_-h)),p.push(c),l=d,h=_}var g=i*c,y=function(t,e,r){for(var n,i,o=r||j,a=0,s=t.length,u=!1;a<s;)(i=+o(t[n=a+(s-a>>1)],e))<0?a=n+1:(s=n,u=!i);return u?a:~a}(p,g);if(y<0){var v=(g-p[-y-2])/(p[-y-1]-p[-y-2]),m=e+(-y-2)*n;a=Ye(t[m],t[m+n],v),s=Ye(t[m+1],t[m+n+1],v)}else a=t[e+y*n],s=t[e+y*n+1]}return o?(o[0]=a,o[1]=s,o):[a,s]}function Gs(t,e,r,n,i,o){if(r==e)return null;var a;if(i<t[e+n-1])return o?((a=t.slice(e,e+n))[n-1]=i,a):null;if(t[r-1]<i)return o?((a=t.slice(r-n,r))[n-1]=i,a):null;if(i==t[e+n-1])return t.slice(e,e+n);for(var s=e/n,u=r/n;s<u;){var l=s+u>>1;i<t[(l+1)*n-1]?u=l:s=l+1}var h=t[s*n-1];if(i==h)return t.slice((s-1)*n,(s-1)*n+n);var c=(i-h)/(t[(s+1)*n-1]-h);a=[];for(var p=0;p<n-1;++p)a.push(Ye(t[(s-1)*n+p],t[s*n+p],c));return a.push(i),a}var js=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ds=function(t){function e(e,r){var n=t.call(this)||this;return n.flatMidpoint_=null,n.flatMidpointRevision_=-1,n.maxDelta_=-1,n.maxDeltaRevision_=-1,void 0===r||Array.isArray(e[0])?n.setCoordinates(e,r):n.setFlatCoordinates(r,e),n}return js(e,t),e.prototype.appendCoordinate=function(t){this.flatCoordinates?z(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()},e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout)},e.prototype.closestPointXY=function(t,e,r,n){return n<kt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(fn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),_n(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,r,n))},e.prototype.forEachSegment=function(t){return Gn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},e.prototype.getCoordinateAtM=function(t,e){if(this.layout!=Ie&&this.layout!=Le)return null;var r=void 0!==e&&e;return Gs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r)},e.prototype.getCoordinates=function(){return xn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},e.prototype.getCoordinateAt=function(t,e){return Ns(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e)},e.prototype.getLength=function(){return ja(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},e.prototype.getFlatMidpoint=function(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_},e.prototype.getSimplifiedGeometryInternal=function(t){var r=[];return r.length=wn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,r,0),new e(r,Pe)},e.prototype.getType=function(){return Fe.LINE_STRING},e.prototype.intersectsExtent=function(t){return jn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vn(this.flatCoordinates,0,t,this.stride),this.changed()},e}(ln),ks="arraybuffer",Us="json",zs="text",Bs="xml",Ys=!1;function Xs(t,e,r,n){return function(i,o,a){var s=new XMLHttpRequest;s.open("GET","function"==typeof t?t(i,o,a):t,!0),e.getType()==ks&&(s.responseType="arraybuffer"),s.withCredentials=Ys,s.onload=function(t){if(!s.status||s.status>=200&&s.status<300){var o=e.getType(),u=void 0;o==Us||o==zs?u=s.responseText:o==Bs?(u=s.responseXML)||(u=(new DOMParser).parseFromString(s.responseText,"application/xml")):o==ks&&(u=s.response),u?r.call(this,e.readFeatures(u,{extent:i,featureProjection:a}),e.readProjection(u)):n.call(this)}else n.call(this)}.bind(this),s.onerror=function(){n.call(this)}.bind(this),s.send()}}function Vs(t,e){return Xs(t,e,(function(t,e){"function"==typeof this.addFeatures&&this.addFeatures(t)}),V)}function Ws(t,e){return[[-1/0,-1/0,1/0,1/0]]}function Zs(t,e){return[t]}function Ks(t){return function(e,r){var n=t.getZForResolution(r),i=t.getTileRangeForExtentAndZ(e,n),o=[],a=[n,0,0];for(a[1]=i.minX;a[1]<=i.maxX;++a[1])for(a[2]=i.minY;a[2]<=i.maxY;++a[2])o.push(t.getTileCoordExtent(a));return o}}var qs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Hs(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var Js=function(t){function e(e){var r=t.call(this)||this;return r.projection_=Sr(e.projection),r.attributions_=Hs(e.attributions),r.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,r.loading=!1,r.state_=void 0!==e.state?e.state:Pi,r.wrapX_=void 0!==e.wrapX&&e.wrapX,r}return qs(e,t),e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolutions=function(){return x()},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=Hs(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(vt),Qs="addfeature",$s="changefeature",tu="clear",eu="removefeature",ru=function(){function t(t){this.rbush_=new Ua.a(t),this.items_={}}return t.prototype.insert=function(t,e){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(r),this.items_[S(e)]=r},t.prototype.load=function(t,e){for(var r=new Array(e.length),n=0,i=e.length;n<i;n++){var o=t[n],a=e[n],s={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};r[n]=s,this.items_[S(a)]=s}this.rbush_.load(r)},t.prototype.remove=function(t){var e=S(t),r=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(r)},t.prototype.update=function(t,e){var r=this.items_[S(e)];Jt([r.minX,r.minY,r.maxX,r.maxY],t)||(this.remove(e),this.insert(t,e))},t.prototype.getAll=function(){return this.rbush_.all().map((function(t){return t.value}))},t.prototype.getInExtent=function(t){var e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map((function(t){return t.value}))},t.prototype.forEach=function(t){return this.forEach_(this.getAll(),t)},t.prototype.forEachInExtent=function(t,e){return this.forEach_(this.getInExtent(t),e)},t.prototype.forEach_=function(t,e){for(var r,n=0,i=t.length;n<i;n++)if(r=e(t[n]))return r;return r},t.prototype.isEmpty=function(){return F(this.items_)},t.prototype.clear=function(){this.rbush_.clear(),this.items_={}},t.prototype.getExtent=function(t){var e=this.rbush_.toJSON();return Vt(e.minX,e.minY,e.maxX,e.maxY,t)},t.prototype.concat=function(t){for(var e in this.rbush_.load(t.rbush_.all()),t.items_)this.items_[e]=t.items_[e]},t}(),nu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),iu=function(t){function e(e,r){var n=t.call(this,e)||this;return n.feature=r,n}return nu(e,t),e}(K),ou=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{attributions:n.attributions,projection:void 0,state:Pi,wrapX:void 0===n.wrapX||n.wrapX})||this).loader_=V,r.format_=n.format,r.overlaps_=void 0===n.overlaps||n.overlaps,r.url_=n.url,void 0!==n.loader?r.loader_=n.loader:void 0!==r.url_&&(wt(r.format_,7),r.loader_=Vs(r.url_,r.format_)),r.strategy_=void 0!==n.strategy?n.strategy:Ws;var i,o,a=void 0===n.useSpatialIndex||n.useSpatialIndex;return r.featuresRtree_=a?new ru:null,r.loadedExtentsRtree_=new ru,r.nullGeometryFeatures_={},r.idIndex_={},r.uidIndex_={},r.featureChangeKeys_={},r.featuresCollection_=null,Array.isArray(n.features)?o=n.features:n.features&&(o=(i=n.features).getArray()),a||void 0!==i||(i=new St(o)),void 0!==o&&r.addFeaturesInternal(o),void 0!==i&&r.bindFeaturesCollection_(i),r}return nu(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=S(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var r=t.getGeometry();if(r){var n=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new iu(Qs,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[M(e,J,this.handleFeatureChange_,this),M(e,P,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var r=!0,n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?r=!1:this.idIndex_[n.toString()]=e),r&&(wt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),r},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],r=[],n=[],i=0,o=t.length;i<o;i++){var a=S(u=t[i]);this.addToIndex_(a,u)&&r.push(u)}i=0;for(var s=r.length;i<s;i++){var u;a=S(u=r[i]);this.setupChangeEvents_(a,u);var l=u.getGeometry();if(l){var h=l.getExtent();e.push(h),n.push(u)}else this.nullGeometryFeatures_[a]=u}this.featuresRtree_&&this.featuresRtree_.load(e,n);i=0;for(var c=r.length;i<c;i++)this.dispatchEvent(new iu(Qs,r[i]))},e.prototype.bindFeaturesCollection_=function(t){var e=!1;this.addEventListener(Qs,(function(r){e||(e=!0,t.push(r.feature),e=!1)})),this.addEventListener(eu,(function(r){e||(e=!0,t.remove(r.feature),e=!1)})),t.addEventListener(R,function(t){e||(e=!0,this.addFeature(t.element),e=!1)}.bind(this)),t.addEventListener(b,function(t){e||(e=!0,this.removeFeature(t.element),e=!1)}.bind(this)),this.featuresCollection_=t},e.prototype.clear=function(t){if(t){for(var e in this.featureChangeKeys_){this.featureChangeKeys_[e].forEach(N)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_)for(var r in this.featuresRtree_.forEach(this.removeFeatureInternal.bind(this)),this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[r]);this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};var n=new iu(tu);this.dispatchEvent(n),this.changed()},e.prototype.forEachFeature=function(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)},e.prototype.forEachFeatureAtCoordinateDirect=function(t,e){var r=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(r,(function(r){return r.getGeometry().intersectsCoordinate(t)?e(r):void 0}))},e.prototype.forEachFeatureInExtent=function(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)},e.prototype.forEachFeatureIntersectingExtent=function(t,e){return this.forEachFeatureInExtent(t,(function(r){if(r.getGeometry().intersectsExtent(t)){var n=e(r);if(n)return n}}))},e.prototype.getFeaturesCollection=function(){return this.featuresCollection_},e.prototype.getFeatures=function(){var t;return this.featuresCollection_?t=this.featuresCollection_.getArray():this.featuresRtree_&&(t=this.featuresRtree_.getAll(),F(this.nullGeometryFeatures_)||z(t,L(this.nullGeometryFeatures_))),t},e.prototype.getFeaturesAtCoordinate=function(t){var e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e},e.prototype.getFeaturesInExtent=function(t){return this.featuresRtree_?this.featuresRtree_.getInExtent(t):this.featuresCollection_?this.featuresCollection_.getArray():[]},e.prototype.getClosestFeatureToCoordinate=function(t,e){var r=t[0],n=t[1],i=null,o=[NaN,NaN],a=1/0,s=[-1/0,-1/0,1/0,1/0],u=e||Y;return this.featuresRtree_.forEachInExtent(s,(function(t){if(u(t)){var e=t.getGeometry(),l=a;if((a=e.closestPointXY(r,n,o,a))<l){i=t;var h=Math.sqrt(a);s[0]=r-h,s[1]=n-h,s[2]=r+h,s[3]=n+h}}})),i},e.prototype.getExtent=function(t){return this.featuresRtree_.getExtent(t)},e.prototype.getFeatureById=function(t){var e=this.idIndex_[t.toString()];return void 0!==e?e:null},e.prototype.getFeatureByUid=function(t){var e=this.uidIndex_[t];return void 0!==e?e:null},e.prototype.getFormat=function(){return this.format_},e.prototype.getOverlaps=function(){return this.overlaps_},e.prototype.getUrl=function(){return this.url_},e.prototype.handleFeatureChange_=function(t){var e=t.target,r=S(e),n=e.getGeometry();if(n){var i=n.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(i,e)):this.featuresRtree_&&this.featuresRtree_.update(i,e)}else r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[r]=e);var o=e.getId();if(void 0!==o){var a=o.toString();this.idIndex_[a]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[a]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[r]=e;this.changed(),this.dispatchEvent(new iu($s,e))},e.prototype.hasFeature=function(t){var e=t.getId();return void 0!==e?e in this.idIndex_:S(t)in this.uidIndex_},e.prototype.isEmpty=function(){return this.featuresRtree_.isEmpty()&&F(this.nullGeometryFeatures_)},e.prototype.loadFeatures=function(t,e,r){var n=this.loadedExtentsRtree_,i=this.strategy_(t,e);this.loading=!1;for(var o=function(t,o){var s=i[t];n.forEachInExtent(s,(function(t){return zt(t.extent,s)}))||(a.loader_.call(a,s,e,r),n.insert(s,{extent:s.slice()}),a.loading=a.loader_!==V)},a=this,s=0,u=i.length;s<u;++s)o(s)},e.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),t.prototype.refresh.call(this)},e.prototype.removeLoadedExtent=function(t){var e,r=this.loadedExtentsRtree_;r.forEachInExtent(t,(function(r){if(Jt(r.extent,t))return e=r,!0})),e&&r.remove(e)},e.prototype.removeFeature=function(t){var e=S(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t),this.changed()},e.prototype.removeFeatureInternal=function(t){var e=S(t);this.featureChangeKeys_[e].forEach(N),delete this.featureChangeKeys_[e];var r=t.getId();void 0!==r&&delete this.idIndex_[r.toString()],delete this.uidIndex_[e],this.dispatchEvent(new iu(eu,t))},e.prototype.removeFromIdIndex_=function(t){var e=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===t){delete this.idIndex_[r],e=!0;break}return e},e.prototype.setLoader=function(t){this.loader_=t},e.prototype.setUrl=function(t){wt(this.format_,7),this.setLoader(Vs(t,this.format_))},e}(Js);function au(t,e,r){for(var n,i,o,a,s,u,l=[],h=t(0),c=t(1),p=e(h),f=e(c),d=[c,h],_=[f,p],g=[1,0],y={},v=1e5;--v>0&&g.length>0;)o=g.pop(),h=d.pop(),p=_.pop(),(u=o.toString())in y||(l.push(p[0],p[1]),y[u]=!0),a=g.pop(),c=d.pop(),f=_.pop(),De((i=e(n=t(s=(o+a)/2)))[0],i[1],p[0],p[1],f[0],f[1])<r?(l.push(f[0],f[1]),y[u=a.toString()]=!0):(g.push(a,s,s,o),_.push(f,i,i,p),d.push(c,n,n,h));return l}function su(t,e){e&&e.clear();for(var r=t.declutterItems,n=r.length-1;n>=0;--n)for(var i=r[n],o=i.items,a=0,s=o.length;a<s;a+=3)e=o[a].renderDeclutter(o[a+1],o[a+2],i.opacity,e);return r.length=0,e}var uu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lu=new No({color:"rgba(0,0,0,0.2)"}),hu=[90,45,30,20,10,5,2,1,.5,.2,.1,.05,.01,.005,.002,.001],cu=function(t){function e(e){var r=this,n=e||{},i=O({updateWhileAnimating:!0,updateWhileInteracting:!0,renderBuffer:0},n);return delete i.maxLines,delete i.strokeStyle,delete i.targetSize,delete i.showLabels,delete i.lonLabelFormatter,delete i.latLabelFormatter,delete i.lonLabelPosition,delete i.latLabelPosition,delete i.lonLabelStyle,delete i.latLabelStyle,delete i.intervals,(r=t.call(this,i)||this).projection_=null,r.maxLat_=1/0,r.maxLon_=1/0,r.minLat_=-1/0,r.minLon_=-1/0,r.maxX_=1/0,r.maxY_=1/0,r.minX_=-1/0,r.minY_=-1/0,r.targetSize_=void 0!==n.targetSize?n.targetSize:100,r.maxLines_=void 0!==n.maxLines?n.maxLines:100,r.meridians_=[],r.parallels_=[],r.strokeStyle_=void 0!==n.strokeStyle?n.strokeStyle:lu,r.fromLonLatTransform_=void 0,r.toLonLatTransform_=void 0,r.projectionCenterLonLat_=null,r.bottomLeft_=null,r.bottomRight_=null,r.topLeft_=null,r.topRight_=null,r.meridiansLabels_=null,r.parallelsLabels_=null,n.showLabels&&(r.lonLabelFormatter_=null==n.lonLabelFormatter?$o.bind(r,"EW"):n.lonLabelFormatter,r.latLabelFormatter_=null==n.latLabelFormatter?$o.bind(r,"NS"):n.latLabelFormatter,r.lonLabelPosition_=null==n.lonLabelPosition?0:n.lonLabelPosition,r.latLabelPosition_=null==n.latLabelPosition?1:n.latLabelPosition,r.lonLabelStyleBase_=new zo({text:void 0!==n.lonLabelStyle?n.lonLabelStyle.clone():new As({font:"12px Calibri,sans-serif",textBaseline:"bottom",fill:new Ao({color:"rgba(0,0,0,1)"}),stroke:new No({color:"rgba(255,255,255,1)",width:3})})}),r.lonLabelStyle_=function(t){var e=t.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(e),this.lonLabelStyleBase_}.bind(r),r.latLabelStyleBase_=new zo({text:void 0!==n.latLabelStyle?n.latLabelStyle.clone():new As({font:"12px Calibri,sans-serif",textAlign:"right",fill:new Ao({color:"rgba(0,0,0,1)"}),stroke:new No({color:"rgba(255,255,255,1)",width:3})})}),r.latLabelStyle_=function(t){var e=t.get("graticule_label");return this.latLabelStyleBase_.getText().setText(e),this.latLabelStyleBase_}.bind(r),r.meridiansLabels_=[],r.parallelsLabels_=[],r.addEventListener(Si,r.drawLabels_.bind(r))),r.intervals_=void 0!==n.intervals?n.intervals:hu,r.setSource(new ou({loader:r.loaderFunction.bind(r),strategy:r.strategyFunction.bind(r),features:new St,overlaps:!1,useSpatialIndex:!1,wrapX:n.wrapX})),r.featurePool_=[],r.lineStyle_=new zo({stroke:r.strokeStyle_}),r.loadedExtent_=null,r.renderedExtent_=null,r.setRenderOrder(null),r}return uu(e,t),e.prototype.strategyFunction=function(t,e){var r=t.slice();return this.projection_&&this.getSource().getWrapX()&&be(r,this.projection_),this.loadedExtent_&&(Qt(this.loadedExtent_,r,e)?r=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[r]},e.prototype.loaderFunction=function(t,e,r){this.loadedExtent_=t;var n=this.getSource(),i=_e(this.getExtent()||[-1/0,-1/0,1/0,1/0],t);if(!(this.renderedExtent_&&Jt(this.renderedExtent_,i)||(this.renderedExtent_=i,Se(i)))){var o=le(i),a=e*e/4;(!this.projection_||!Fr(this.projection_,r))&&this.updateProjectionInfo_(r),this.createGraticule_(i,o,e,a);var s,u=this.meridians_.length+this.parallels_.length;for(this.meridiansLabels_&&(u+=this.meridians_.length),this.parallelsLabels_&&(u+=this.parallels_.length);u>this.featurePool_.length;)s=new Ct,this.featurePool_.push(s);var l=n.getFeaturesCollection();l.clear();var h,c,p=0;for(h=0,c=this.meridians_.length;h<c;++h)(s=this.featurePool_[p++]).setGeometry(this.meridians_[h]),s.setStyle(this.lineStyle_),l.push(s);for(h=0,c=this.parallels_.length;h<c;++h)(s=this.featurePool_[p++]).setGeometry(this.parallels_[h]),s.setStyle(this.lineStyle_),l.push(s)}},e.prototype.addMeridian_=function(t,e,r,n,i,o){var a=this.getMeridian_(t,e,r,n,o);if(Ee(a.getExtent(),i)){if(this.meridiansLabels_){var s=this.lonLabelFormatter_(t);o in this.meridiansLabels_?this.meridiansLabels_[o].text=s:this.meridiansLabels_[o]={geom:new Ln([]),text:s}}this.meridians_[o++]=a}return o},e.prototype.addParallel_=function(t,e,r,n,i,o){var a=this.getParallel_(t,e,r,n,o);if(Ee(a.getExtent(),i)){if(this.parallelsLabels_){var s=this.latLabelFormatter_(t);o in this.parallelsLabels_?this.parallelsLabels_[o].text=s:this.parallelsLabels_[o]={geom:new Ln([]),text:s}}this.parallels_[o++]=a}return o},e.prototype.drawLabels_=function(t){var e=t.frameState.viewState.rotation,r=t.frameState.extent,n=le(r),i=r;if(e){var o=xe(r),a=fe(r),s=Math.abs(Math.cos(e)),u=Math.abs(Math.sin(e)),l=(u*a-s*o)/(u*u-s*s),h=(u*o-s*a)/(u*u-s*s);i=[n[0]-l/2,n[1]-h/2,n[0]+l/2,n[1]+h/2]}var c=0,p=0,f=this.latLabelPosition_<.5,d=this.projection_.getExtent(),_=xe(d);this.getSource().getWrapX()&&this.projection_.canWrapX()&&!zt(d,r)&&(c=Math.floor((r[0]-d[0])/_),p=Math.ceil((r[2]-d[2])/_),f=f!==Math.abs(e)>Math.PI/2);for(var g=function(t){var e,r=t.frameState,n=Hr(t.inversePixelTransform.slice(),r.coordinateToPixelTransform),i=us(r.viewState.resolution,r.pixelRatio),o=zr();return o&&(e=Mr(o,r.viewState.projection)),new ps(t.context,r.pixelRatio,r.extent,n,r.viewState.rotation,i,e)}(t),y=c;y<=p;++y){var v=this.meridians_.length+this.parallels_.length,m=void 0,x=void 0,E=void 0,S=void 0;if(this.meridiansLabels_)for(x=0,E=this.meridiansLabels_.length;x<E;++x){var w=this.meridians_[x];if(e||0!==y)(T=w.clone()).translate(y*_,0),T.rotate(-e,n),(S=this.getMeridianPoint_(T,i,x)).rotate(e,n);else S=this.getMeridianPoint_(w,r,x);(m=this.featurePool_[v++]).setGeometry(S),m.set("graticule_label",this.meridiansLabels_[x].text),g.drawFeature(m,this.lonLabelStyle_(m))}if(this.parallelsLabels_&&(y===c&&f||y===p&&!f))for(x=0,E=this.parallels_.length;x<E;++x){var T;w=this.parallels_[x];if(e||0!==y)(T=w.clone()).translate(y*_,0),T.rotate(-e,n),(S=this.getParallelPoint_(T,i,x)).rotate(e,n);else S=this.getParallelPoint_(w,r,x);(m=this.featurePool_[v++]).setGeometry(S),m.set("graticule_label",this.parallelsLabels_[x].text),g.drawFeature(m,this.latLabelStyle_(m))}}},e.prototype.createGraticule_=function(t,e,r,n){var i=this.getInterval_(r);if(-1==i)return this.meridians_.length=0,this.parallels_.length=0,this.meridiansLabels_&&(this.meridiansLabels_.length=0),void(this.parallelsLabels_&&(this.parallelsLabels_.length=0));var o=!1,a=this.projection_.getExtent(),s=xe(a);this.getSource().getWrapX()&&this.projection_.canWrapX()&&!zt(a,t)&&(xe(t)>=s?(t[0]=a[0],t[2]=a[2]):o=!0);var u=[Ge(e[0],this.minX_,this.maxX_),Ge(e[1],this.minY_,this.maxY_)],l=this.toLonLatTransform_(u);isNaN(l[1])&&(l[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);var h,c,p,f,d=Ge(l[0],this.minLon_,this.maxLon_),_=Ge(l[1],this.minLat_,this.maxLat_),g=this.maxLines_,y=t;o||(y=[Ge(t[0],this.minX_,this.maxX_),Ge(t[1],this.minY_,this.maxY_),Ge(t[2],this.minX_,this.maxX_),Ge(t[3],this.minY_,this.maxY_)]);var v=Re(y,this.toLonLatTransform_,void 0,8),m=v[3],x=v[2],E=v[1],S=v[0];if(o||(Ut(y,this.bottomLeft_)&&(S=this.minLon_,E=this.minLat_),Ut(y,this.bottomRight_)&&(x=this.maxLon_,E=this.minLat_),Ut(y,this.topLeft_)&&(S=this.minLon_,m=this.maxLat_),Ut(y,this.topRight_)&&(x=this.maxLon_,m=this.maxLat_),m=Ge(m,_,this.maxLat_),x=Ge(x,d,this.maxLon_),E=Ge(E,this.minLat_,_),S=Ge(S,this.minLon_,d)),f=Ge(d=Math.floor(d/i)*i,this.minLon_,this.maxLon_),c=this.addMeridian_(f,E,m,n,t,0),h=0,o)for(;(f-=i)>=S&&h++<g;)c=this.addMeridian_(f,E,m,n,t,c);else for(;f!=this.minLon_&&h++<g;)f=Math.max(f-i,this.minLon_),c=this.addMeridian_(f,E,m,n,t,c);if(f=Ge(d,this.minLon_,this.maxLon_),h=0,o)for(;(f+=i)<=x&&h++<g;)c=this.addMeridian_(f,E,m,n,t,c);else for(;f!=this.maxLon_&&h++<g;)f=Math.min(f+i,this.maxLon_),c=this.addMeridian_(f,E,m,n,t,c);for(this.meridians_.length=c,this.meridiansLabels_&&(this.meridiansLabels_.length=c),p=Ge(_=Math.floor(_/i)*i,this.minLat_,this.maxLat_),c=this.addParallel_(p,S,x,n,t,0),h=0;p!=this.minLat_&&h++<g;)p=Math.max(p-i,this.minLat_),c=this.addParallel_(p,S,x,n,t,c);for(p=Ge(_,this.minLat_,this.maxLat_),h=0;p!=this.maxLat_&&h++<g;)p=Math.min(p+i,this.maxLat_),c=this.addParallel_(p,S,x,n,t,c);this.parallels_.length=c,this.parallelsLabels_&&(this.parallelsLabels_.length=c)},e.prototype.getInterval_=function(t){for(var e=this.projectionCenterLonLat_[0],r=this.projectionCenterLonLat_[1],n=-1,i=Math.pow(this.targetSize_*t,2),o=[],a=[],s=0,u=this.intervals_.length;s<u;++s){var l=Ge(this.intervals_[s]/2,0,90),h=Ge(r,-90+l,90-l);if(o[0]=e-l,o[1]=h-l,a[0]=e+l,a[1]=h+l,this.fromLonLatTransform_(o,o),this.fromLonLatTransform_(a,a),Math.pow(a[0]-o[0],2)+Math.pow(a[1]-o[1],2)<=i)break;n=this.intervals_[s]}return n},e.prototype.getMeridian_=function(t,e,r,n,i){var o=function(t,e,r,n,i){return au((function(n){return[t,e+(r-e)*n]}),Ar(Sr("EPSG:4326"),n),i)}(t,e,r,this.projection_,n),a=this.meridians_[i];return a?(a.setFlatCoordinates(Pe,o),a.changed()):(a=new Ds(o,Pe),this.meridians_[i]=a),a},e.prototype.getMeridianPoint_=function(t,e,r){var n=t.getFlatCoordinates(),i=1,o=n.length-1;n[i]>n[o]&&(i=o,o=1);var a=Math.max(e[1],n[i]),s=Math.min(e[3],n[o]),u=Ge(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,a,s),l=[n[i-1]+(n[o-1]-n[i-1])*(u-n[i])/(n[o]-n[i]),u],h=this.meridiansLabels_[r].geom;return h.setCoordinates(l),h},e.prototype.getMeridians=function(){return this.meridians_},e.prototype.getParallel_=function(t,e,r,n,i){var o=function(t,e,r,n,i){return au((function(n){return[e+(r-e)*n,t]}),Ar(Sr("EPSG:4326"),n),i)}(t,e,r,this.projection_,n),a=this.parallels_[i];return a?(a.setFlatCoordinates(Pe,o),a.changed()):a=new Ds(o,Pe),a},e.prototype.getParallelPoint_=function(t,e,r){var n=t.getFlatCoordinates(),i=0,o=n.length-2;n[i]>n[o]&&(i=o,o=0);var a=Math.max(e[0],n[i]),s=Math.min(e[2],n[o]),u=Ge(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,a,s),l=[u,n[i+1]+(n[o+1]-n[i+1])*(u-n[i])/(n[o]-n[i])],h=this.parallelsLabels_[r].geom;return h.setCoordinates(l),h},e.prototype.getParallels=function(){return this.parallels_},e.prototype.updateProjectionInfo_=function(t){var e=Sr("EPSG:4326"),r=t.getWorldExtent();this.maxLat_=r[3],this.maxLon_=r[2],this.minLat_=r[1],this.minLon_=r[0];var n=Ar(t,e);if(this.minLon_<this.maxLon_)this.toLonLatTransform_=n;else{var i=this.minLon_+this.maxLon_/2;this.maxLon_+=360,this.toLonLatTransform_=function(t,e,r){for(var o=r||2,a=n(t,e,o),s=0,u=a.length;s<u;s+=o)a[s]<i&&(a[s]+=360);return a}}this.fromLonLatTransform_=Ar(e,t);var o=Re([this.minLon_,this.minLat_,this.maxLon_,this.maxLat_],this.fromLonLatTransform_,void 0,8);this.minX_=o[0],this.maxX_=o[2],this.minY_=o[1],this.maxY_=o[3],this.bottomLeft_=this.fromLonLatTransform_([this.minLon_,this.minLat_]),this.bottomRight_=this.fromLonLatTransform_([this.maxLon_,this.minLat_]),this.topLeft_=this.fromLonLatTransform_([this.minLon_,this.maxLat_]),this.topRight_=this.fromLonLatTransform_([this.maxLon_,this.maxLat_]),this.projectionCenterLonLat_=this.toLonLatTransform_(le(t.getExtent())),isNaN(this.projectionCenterLonLat_[1])&&(this.projectionCenterLonLat_[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t},e}(Ms),pu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),fu=function(t){function e(e,r,n,i,o){var a=this,s=void 0!==o?no:oo;return(a=t.call(this,e,r,n,s)||this).loader_=void 0!==o?o:null,a.canvas_=i,a.error_=null,a}return pu(e,t),e.prototype.getError=function(){return this.error_},e.prototype.handleLoad_=function(t){t?(this.error_=t,this.state=ao):this.state=oo,this.changed()},e.prototype.load=function(){this.state==no&&(this.state=io,this.changed(),this.loader_(this.handleLoad_.bind(this)))},e.prototype.getImage=function(){return this.canvas_},e}(vs),du=0,_u=1,gu=2,yu=3,vu=4;function mu(t){return Math.pow(t,3)}function xu(t){return 1-mu(1-t)}function Eu(t){return 3*t*t-2*t*t*t}function Su(t){return t}var wu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Tu=function(t){function e(e,r,n){var i=t.call(this)||this,o=n||{};return i.tileCoord=e,i.state=r,i.interimTile=null,i.hifi=!0,i.key="",i.transition_=void 0===o.transition?250:o.transition,i.transitionStarts_={},i}return wu(e,t),e.prototype.changed=function(){this.dispatchEvent(J)},e.prototype.release=function(){},e.prototype.getKey=function(){return this.key+"/"+this.tileCoord},e.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(t.getState()==gu)return this.transition_=0,t;t=t.interimTile}while(t);return this},e.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,e=this;do{if(t.getState()==gu){t.interimTile=null;break}t.getState()==_u?e=t:t.getState()==du?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}},e.prototype.getTileCoord=function(){return this.tileCoord},e.prototype.getState=function(){return this.state},e.prototype.setState=function(t){if(this.state!==yu&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){x()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var r=this.transitionStarts_[t];if(r){if(-1===r)return 1}else r=e,this.transitionStarts_[t]=r;var n=e-r+1e3/60;return n>=this.transition_?1:mu(n/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(H),Cu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Ru=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.crossOrigin_=i,s.src_=n,s.image_=new Image,null!==i&&(s.image_.crossOrigin=i),s.unlisten_=null,s.tileLoadFunction_=o,s}return Cu(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.getKey=function(){return this.src_},e.prototype.handleImageError_=function(){var t;this.state=yu,this.unlistenImage_(),this.image_=((t=Ji(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=gu:this.state=vu,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==yu&&(this.state=du,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==du&&(this.state=_u,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=xs(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(Tu),bu=function(){function t(t,e,r){this.decay_=t,this.minVelocity_=e,this.delay_=r,this.points_=[],this.angle_=0,this.initialVelocity_=0}return t.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},t.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},t.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;for(var r=e-3;r>0&&this.points_[r+2]>t;)r-=3;var n=this.points_[e+2]-this.points_[r+2];if(n<1e3/60)return!1;var i=this.points_[e]-this.points_[r],o=this.points_[e+1]-this.points_[r+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),Pu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ou=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.map=r,i.frameState=void 0!==n?n:null,i}return Pu(e,t),e}(K),Iu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lu=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,o)||this;return a.originalEvent=n,a.pixel_=null,a.coordinate_=null,a.dragging=void 0!==i&&i,a}return Iu(e,t),Object.defineProperty(e.prototype,"pixel",{get:function(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_},set:function(t){this.pixel_=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"coordinate",{get:function(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_},set:function(t){this.coordinate_=t},enumerable:!0,configurable:!0}),e.prototype.preventDefault=function(){t.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},e.prototype.stopPropagation=function(){t.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()},e}(Ou),Fu=(r(1),{SINGLECLICK:"singleclick",CLICK:tt,DBLCLICK:et,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"}),Mu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Au=function(t){function e(e,r,n,i,o){var a=t.call(this,e,r,n,i,o)||this;return a.pointerEvent=n,a}return Mu(e,t),e}(Lu),Nu="pointermove",Gu="pointerdown",ju="pointerup",Du="pointerout",ku=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Uu=function(t){function e(e,r){var n=t.call(this,e)||this;n.map_=e,n.clickTimeoutId_,n.dragging_=!1,n.dragListenerKeys_=[],n.moveTolerance_=r?r*Zi:Zi,n.down_=null;var i=n.map_.getViewport();return n.activePointers_=0,n.trackedTouches_={},n.element_=i,n.pointerdownListenerKey_=M(i,Gu,n.handlePointerDown_,n),n.originalPointerMoveEvent_,n.relayedListenerKey_=M(i,Nu,n.relayEvent_,n),n.boundHandleTouchMove_=n.handleTouchMove_.bind(n),n.element_.addEventListener(lt,n.boundHandleTouchMove_,!!Hi&&{passive:!1}),n}return ku(e,t),e.prototype.emulateClick_=function(t){var e=new Au(Fu.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Au(Fu.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=void 0;var e=new Au(Fu.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}.bind(this),250)},e.prototype.updateActivePointers_=function(t){var e=t;e.type==Fu.POINTERUP||e.type==Fu.POINTERCANCEL?delete this.trackedTouches_[e.pointerId]:e.type==Fu.POINTERDOWN&&(this.trackedTouches_[e.pointerId]=!0),this.activePointers_=Object.keys(this.trackedTouches_).length},e.prototype.handlePointerUp_=function(t){this.updateActivePointers_(t);var e=new Au(Fu.POINTERUP,this.map_,t);this.dispatchEvent(e),e.propagationStopped||this.dragging_||!this.isMouseActionButton_(t)||this.emulateClick_(this.down_),0===this.activePointers_&&(this.dragListenerKeys_.forEach(N),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)},e.prototype.isMouseActionButton_=function(t){return 0===t.button},e.prototype.handlePointerDown_=function(t){this.updateActivePointers_(t);var e=new Au(Fu.POINTERDOWN,this.map_,t);this.dispatchEvent(e),this.down_=t,0===this.dragListenerKeys_.length&&this.dragListenerKeys_.push(M(document,Fu.POINTERMOVE,this.handlePointerMove_,this),M(document,Fu.POINTERUP,this.handlePointerUp_,this),M(this.element_,Fu.POINTERCANCEL,this.handlePointerUp_,this))},e.prototype.handlePointerMove_=function(t){if(this.isMoving_(t)){this.dragging_=!0;var e=new Au(Fu.POINTERDRAG,this.map_,t,this.dragging_);this.dispatchEvent(e)}},e.prototype.relayEvent_=function(t){this.originalPointerMoveEvent_=t;var e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Au(t.type,this.map_,t,e))},e.prototype.handleTouchMove_=function(t){this.originalPointerMoveEvent_&&!this.originalPointerMoveEvent_.defaultPrevented||t.preventDefault()},e.prototype.isMoving_=function(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(N(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(lt,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(N(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(N),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(H),zu="postrender",Bu="movestart",Yu="moveend",Xu="layergroup",Vu="size",Wu="target",Zu="view",Ku=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,I(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,r=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(r);return delete this.queuedElements_[n],r},t.prototype.enqueue=function(t){wt(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,r=this.priorities_,n=e.length,i=e[t],o=r[t],a=t;t<n>>1;){var s=this.getLeftChildIndex_(t),u=this.getRightChildIndex_(t),l=u<n&&r[u]<r[s]?u:s;e[t]=e[l],r[t]=r[l],t=l}e[t]=i,r[t]=o,this.siftDown_(a,t)},t.prototype.siftDown_=function(t,e){for(var r=this.elements_,n=this.priorities_,i=r[e],o=n[e];e>t;){var a=this.getParentIndex_(e);if(!(n[a]>o))break;r[e]=r[a],n[e]=n[a],e=a}r[e]=i,n[e]=o},t.prototype.reprioritize=function(){var t,e,r,n=this.priorityFunction_,i=this.elements_,o=this.priorities_,a=0,s=i.length;for(e=0;e<s;++e)(r=n(t=i[e]))==1/0?delete this.queuedElements_[this.keyFunction_(t)]:(o[a]=r,i[a++]=t);i.length=a,o.length=a,this.heapify_()},t}(),qu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hu=function(t){function e(e,r){var n=t.call(this,(function(t){return e.apply(null,t)}),(function(t){return t[0].getKey()}))||this;return n.boundHandleTileChange_=n.handleTileChange.bind(n),n.tileChangeCallback_=r,n.tilesLoading_=0,n.tilesLoadingKeys_={},n}return qu(e,t),e.prototype.enqueue=function(e){var r=t.prototype.enqueue.call(this,e);r&&e[0].addEventListener(J,this.boundHandleTileChange_);return r},e.prototype.getTilesLoading=function(){return this.tilesLoading_},e.prototype.handleTileChange=function(t){var e=t.target,r=e.getState();if(e.hifi&&r===gu||r===yu||r===vu){e.removeEventListener(J,this.boundHandleTileChange_);var n=e.getKey();n in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[n],--this.tilesLoading_),this.tileChangeCallback_()}},e.prototype.loadMoreTiles=function(t,e){for(var r,n,i=0;this.tilesLoading_<t&&i<e&&this.getCount()>0;)n=(r=this.dequeue()[0]).getKey(),r.getState()!==du||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++i,r.load())},e}(Ku);function Ju(t,e,r){return function(n,i,o,a){if(n){var s=e?0:o[0]*i,u=e?0:o[1]*i,l=t[0]+s/2,h=t[2]-s/2,c=t[1]+u/2,p=t[3]-u/2;l>h&&(h=l=(h+l)/2),c>p&&(p=c=(p+c)/2);var f=Ge(n[0],l,h),d=Ge(n[1],c,p),_=30*i;return a&&r&&(f+=-_*Math.log(1+Math.max(0,l-n[0])/_)+_*Math.log(1+Math.max(0,n[0]-h)/_),d+=-_*Math.log(1+Math.max(0,c-n[1])/_)+_*Math.log(1+Math.max(0,n[1]-p)/_)),[f,d]}}}function Qu(t){return t}function $u(t,e,r,n){var i=xe(e)/r[0],o=fe(e)/r[1];return n?Math.min(t,Math.max(i,o)):Math.min(t,Math.min(i,o))}function tl(t,e,r){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,r&&(n=Math.max(n,r),n/=Math.log(1+50*Math.max(0,r/t-1))/50+1),Ge(n,r/2,2*e)}function el(t,e,r,n,i){return function(o,a,s,u){if(void 0!==o){var l=n?$u(t,n,s,i):t;return(void 0===r||r)&&u?tl(o,l,e):Ge(o,e,l)}}}function rl(t){return void 0!==t?0:void 0}function nl(t){return void 0!==t?t:void 0}var il="center",ol="resolution",al="rotation",sl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function ul(t,e){setTimeout((function(){t(e)}),0)}function ll(t){return!(t.sourceCenter&&t.targetCenter&&!ea(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}var hl=function(t){function e(e){var r=t.call(this)||this,n=O({},e);return r.hints_=[0,0],r.animations_=[],r.updateAnimationKey_,r.projection_=br(n.projection,"EPSG:3857"),r.viewportSize_=[100,100],r.targetCenter_=null,r.targetResolution_,r.targetRotation_,r.cancelAnchor_=void 0,n.center&&(n.center=Xr(n.center,r.projection_)),n.extent&&(n.extent=Wr(n.extent,r.projection_)),r.applyOptions_(n),r}return sl(e,t),e.prototype.applyOptions_=function(t){var e=function(t){var e,r,n,i=void 0!==t.minZoom?t.minZoom:0,o=void 0!==t.maxZoom?t.maxZoom:28,a=void 0!==t.zoomFactor?t.zoomFactor:2,s=void 0!==t.multiWorld&&t.multiWorld,u=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,l=void 0!==t.showFullExtent&&t.showFullExtent,h=br(t.projection,"EPSG:3857"),c=h.getExtent(),p=t.constrainOnlyCenter,f=t.extent;s||f||!h.isGlobal()||(p=!1,f=c);if(void 0!==t.resolutions){var d=t.resolutions;r=d[i],n=void 0!==d[o]?d[o]:d[d.length-1],e=t.constrainResolution?function(t,e,r,n){return function(i,o,a,s){if(void 0!==i){var u=t[0],l=t[t.length-1],h=r?$u(u,r,a,n):u;if(s)return void 0===e||e?tl(i,h,l):Ge(i,l,h);var c=Math.min(h,i),p=Math.floor(k(t,c,o));return t[p]>h&&p<t.length-1?t[p+1]:t[p]}}}(d,u,!p&&f,l):el(r,n,u,!p&&f,l)}else{var _=(c?Math.max(xe(c),fe(c)):360*Qe[$e.DEGREES]/h.getMetersPerUnit())/256/Math.pow(2,0),g=_/Math.pow(2,28);void 0!==(r=t.maxResolution)?i=0:r=_/Math.pow(a,i),void 0===(n=t.minResolution)&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?r/Math.pow(a,o):_/Math.pow(a,o):g),o=i+Math.floor(Math.log(r/n)/Math.log(a)),n=r/Math.pow(a,o-i),e=t.constrainResolution?function(t,e,r,n,i,o){return function(a,s,u,l){if(void 0!==a){var h=i?$u(e,i,u,o):e,c=void 0!==r?r:0;if(l)return void 0===n||n?tl(a,h,c):Ge(a,c,h);var p=Math.ceil(Math.log(e/h)/Math.log(t)-1e-9),f=-s*(.5-1e-9)+.5,d=Math.min(h,a),_=Math.floor(Math.log(e/d)/Math.log(t)+f),g=Math.max(p,_);return Ge(e/Math.pow(t,g),c,h)}}}(a,r,n,u,!p&&f,l):el(r,n,u,!p&&f,l)}return{constraint:e,maxResolution:r,minResolution:n,minZoom:i,zoomFactor:a}}(t);this.maxResolution_=e.maxResolution,this.minResolution_=e.minResolution,this.zoomFactor_=e.zoomFactor,this.resolutions_=t.resolutions,this.minZoom_=e.minZoom;var r=function(t){if(void 0!==t.extent){var e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Ju(t.extent,t.constrainOnlyCenter,e)}var r=br(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&r.isGlobal()){var n=r.getExtent().slice();return n[0]=-1/0,n[2]=1/0,Ju(n,!1,!1)}return Qu}(t),n=e.constraint,i=function(t){if(void 0===t.enableRotation||t.enableRotation){var e=t.constrainRotation;return void 0===e||!0===e?(o=i||ze(5),function(t,e){return e?t:void 0!==t?Math.abs(t)<=o?0:t:void 0}):!1===e?nl:"number"==typeof e?(r=e,n=2*Math.PI/r,function(t,e){return e?t:void 0!==t?t=Math.floor(t/n+.5)*n:void 0}):nl}return rl;var r,n;var i,o}(t);this.constraints_={center:r,resolution:n,rotation:i},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom),this.setProperties({}),this.options_=t},e.prototype.getUpdatedOptions_=function(t){var e=O({},this.options_);return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),O({},e,t)},e.prototype.animate=function(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);for(var e=new Array(arguments.length),r=0;r<e.length;++r){var n=arguments[r];n.center&&((n=O({},n)).center=Xr(n.center,this.getProjection())),n.anchor&&((n=O({},n)).anchor=Xr(n.anchor,this.getProjection())),e[r]=n}this.animateInternal.apply(this,e)},e.prototype.animateInternal=function(t){var e,r=arguments.length;if(r>1&&"function"==typeof arguments[r-1]&&(e=arguments[r-1],--r),!this.isDef()){var n=arguments[r-1];return n.center&&this.setCenterInternal(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&ul(e,!0))}for(var i=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,s=this.targetRotation_,u=[],l=0;l<r;++l){var h=arguments[l],c={start:i,complete:!1,anchor:h.anchor,duration:void 0!==h.duration?h.duration:1e3,easing:h.easing||Eu,callback:e};if(h.center&&(c.sourceCenter=o,c.targetCenter=h.center.slice(),o=c.targetCenter),void 0!==h.zoom?(c.sourceResolution=a,c.targetResolution=this.getResolutionForZoom(h.zoom),a=c.targetResolution):h.resolution&&(c.sourceResolution=a,c.targetResolution=h.resolution,a=c.targetResolution),void 0!==h.rotation){c.sourceRotation=s;var p=Be(h.rotation-s+Math.PI,2*Math.PI)-Math.PI;c.targetRotation=s+p,s=c.targetRotation}ll(c)?c.complete=!0:i+=c.duration,u.push(c)}this.animations_.push(u),this.setHint(Vo,1),this.updateAnimations_()},e.prototype.getAnimating=function(){return this.hints_[Vo]>0},e.prototype.getInteracting=function(){return this.hints_[Wo]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(Vo,-this.hints_[Vo]);for(var e=0,r=this.animations_.length;e<r;++e){var n=this.animations_[e];if(n[0].callback&&ul(n[0].callback,!1),!t)for(var i=0,o=n.length;i<o;++i){var a=n[i];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t},e.prototype.updateAnimations_=function(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),this.getAnimating()){for(var t=Date.now(),e=!1,r=this.animations_.length-1;r>=0;--r){for(var n=this.animations_[r],i=!0,o=0,a=n.length;o<a;++o){var s=n[o];if(!s.complete){var u=t-s.start,l=s.duration>0?u/s.duration:1;l>=1?(s.complete=!0,l=1):i=!1;var h=s.easing(l);if(s.sourceCenter){var c=s.sourceCenter[0],p=s.sourceCenter[1],f=c+h*(s.targetCenter[0]-c),d=p+h*(s.targetCenter[1]-p);this.targetCenter_=[f,d]}if(s.sourceResolution&&s.targetResolution){var _=1===h?s.targetResolution:s.sourceResolution+h*(s.targetResolution-s.sourceResolution);if(s.anchor){var g=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(_,0,g,!0);this.targetCenter_=this.calculateCenterZoom(y,s.anchor)}this.targetResolution_=_,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){var v=1===h?Be(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+h*(s.targetRotation-s.sourceRotation);if(s.anchor){var m=this.constraints_.rotation(v,!0);this.targetCenter_=this.calculateCenterRotate(m,s.anchor)}this.targetRotation_=v}if(this.applyTargetState_(!0),e=!0,!s.complete)break}}if(i){this.animations_[r]=null,this.setHint(Vo,-1);var x=n[0].callback;x&&ul(x,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var r,n=this.getCenterInternal();return void 0!==n&&(ra(r=[n[0]-e[0],n[1]-e[1]],t-this.getRotation()),qo(r,e)),r},e.prototype.calculateCenterZoom=function(t,e){var r,n=this.getCenterInternal(),i=this.getResolution();void 0!==n&&void 0!==i&&(r=[e[0]-t*(e[0]-n[0])/i,e[1]-t*(e[1]-n[1])/i]);return r},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var r=e[0],n=e[1];return[Math.abs(r*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(r*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?Yr(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(il)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.options_.constrainResolution},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return Vr(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSize_(),r=this.getCenterInternal();wt(r,1);var n=this.getResolution();wt(void 0!==n,2);var i=this.getRotation();return wt(void 0!==i,3),pe(r,n,i,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(ol)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(Wr(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var r=e||this.getViewportSize_(),n=xe(t)/r[0],i=fe(t)/r[1];return Math.max(n,i)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/Math.log(e);return function(t){return r/Math.pow(e,t*i)}},e.prototype.getRotation=function(){return this.get(al)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/e;return function(t){return Math.log(r/t)/e/i}},e.prototype.getState=function(){var t=this.getCenterInternal(),e=this.getProjection(),r=this.getResolution(),n=this.getRotation();return{center:t.slice(0),projection:void 0!==e?e:null,resolution:r,rotation:n,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,r,n=this.minZoom_||0;if(this.resolutions_){var i=k(this.resolutions_,t,1);n=i,e=this.resolutions_[i],r=i==this.resolutions_.length-1?2:e/this.resolutions_[i+1]}else e=this.maxResolution_,r=this.zoomFactor_;return n+Math.log(e/t)/Math.log(r)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=Ge(Math.floor(t),0,this.resolutions_.length-2),r=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(r,Ge(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var r,n=O({size:this.getViewportSize_()},e||{});if(wt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))wt(!Se(t),25),r=Kn(i=Wr(t,this.getProjection()));else if(t.getType()===Fe.CIRCLE){var i;(r=Kn(i=Wr(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),le(i))}else{var o=zr();r=o?t.clone().transform(o,this.getProjection()):t}this.fitInternal(r,n)},e.prototype.fitInternal=function(t,e){var r=e||{},n=r.size;n||(n=this.getViewportSize_());var i,o=void 0!==r.padding?r.padding:[0,0,0,0],a=void 0!==r.nearest&&r.nearest;i=void 0!==r.minResolution?r.minResolution:void 0!==r.maxZoom?this.getResolutionForZoom(r.maxZoom):0;for(var s=t.getFlatCoordinates(),u=this.getRotation(),l=Math.cos(-u),h=Math.sin(-u),c=1/0,p=1/0,f=-1/0,d=-1/0,_=t.getStride(),g=0,y=s.length;g<y;g+=_){var v=s[g]*l-s[g+1]*h,m=s[g]*h+s[g+1]*l;c=Math.min(c,v),p=Math.min(p,m),f=Math.max(f,v),d=Math.max(d,m)}var x=this.getResolutionForExtentInternal([c,p,f,d],[n[0]-o[1]-o[3],n[1]-o[0]-o[2]]);x=isNaN(x)?i:Math.max(x,i),x=this.getConstrainedResolution(x,a?0:1),h=-h;var E=(c+f)/2,S=(p+d)/2,w=[(E+=(o[1]-o[3])/2*x)*l-(S+=(o[0]-o[2])/2*x)*h,S*l+E*h],T=r.callback?r.callback:V;void 0!==r.duration?this.animateInternal({resolution:x,center:this.getConstrainedCenter(w,x),duration:r.duration,easing:r.easing},T):(this.targetResolution_=x,this.targetCenter_=w,this.applyTargetState_(!1,!0),ul(T,!0))},e.prototype.centerOn=function(t,e,r){this.centerOnInternal(Xr(t,this.getProjection()),e,r)},e.prototype.centerOnInternal=function(t,e,r){var n=this.getRotation(),i=Math.cos(-n),o=Math.sin(-n),a=t[0]*i-t[1]*o,s=t[1]*i+t[0]*o,u=this.getResolution(),l=(a+=(e[0]/2-r[0])*u)*i-(s+=(r[1]-e[1]/2)*u)*(o=-o),h=s*i+a*o;this.setCenterInternal([l,h])},e.prototype.isDef=function(){return!!this.getCenterInternal()&&void 0!==this.getResolution()},e.prototype.adjustCenter=function(t){var e=Yr(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])},e.prototype.adjustCenterInternal=function(t){var e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])},e.prototype.adjustResolution=function(t,e){var r=e&&Xr(e,this.getProjection());this.adjustResolutionInternal(t,r)},e.prototype.adjustResolutionInternal=function(t,e){var r=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*t,0,n,r);e&&(this.targetCenter_=this.calculateCenterZoom(i,e)),this.targetResolution_*=t,this.applyTargetState_()},e.prototype.adjustZoom=function(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)},e.prototype.adjustRotation=function(t,e){e&&(e=Xr(e,this.getProjection())),this.adjustRotationInternal(t,e)},e.prototype.adjustRotationInternal=function(t,e){var r=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,r);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()},e.prototype.setCenter=function(t){this.setCenterInternal(Xr(t,this.getProjection()))},e.prototype.setCenterInternal=function(t){this.targetCenter_=t,this.applyTargetState_()},e.prototype.setHint=function(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]},e.prototype.setResolution=function(t){this.targetResolution_=t,this.applyTargetState_()},e.prototype.setRotation=function(t){this.targetRotation_=t,this.applyTargetState_()},e.prototype.setZoom=function(t){this.setResolution(this.getResolutionForZoom(t))},e.prototype.applyTargetState_=function(t,e){var r=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,r),i=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,0,i,r),a=this.constraints_.center(this.targetCenter_,o,i,r);this.get(al)!==n&&this.set(al,n),this.get(ol)!==o&&this.set(ol,o),this.get(il)&&ea(this.get(il),a)||this.set(il,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0},e.prototype.resolveConstraints=function(t,e,r){var n=void 0!==t?t:200,i=e||0,o=this.constraints_.rotation(this.targetRotation_),a=this.getViewportSize_(o),s=this.constraints_.resolution(this.targetResolution_,i,a),u=this.constraints_.center(this.targetCenter_,s,a);if(0===n&&!this.cancelAnchor_)return this.targetResolution_=s,this.targetRotation_=o,this.targetCenter_=u,void this.applyTargetState_();var l=r||(0===n?this.cancelAnchor_:void 0);this.cancelAnchor_=void 0,this.getResolution()===s&&this.getRotation()===o&&this.getCenterInternal()&&ea(this.getCenterInternal(),u)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:u,resolution:s,duration:n,easing:xu,anchor:l}))},e.prototype.beginInteraction=function(){this.resolveConstraints(0),this.setHint(Wo,1)},e.prototype.endInteraction=function(t,e,r){var n=r&&Xr(r,this.getProjection());this.endInteractionInternal(t,e,n)},e.prototype.endInteractionInternal=function(t,e,r){this.setHint(Wo,-1),this.resolveConstraints(t,e,r)},e.prototype.getConstrainedCenter=function(t,e){var r=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),r)},e.prototype.getConstrainedZoom=function(t,e){var r=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(r,e))},e.prototype.getConstrainedResolution=function(t,e){var r=e||0,n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,r,n)},e}(vt),cl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pl="layers",fl=function(t){function e(e){var r=this,n=e||{},i=O({},n);delete i.layers;var o=n.layers;return(r=t.call(this,i)||this).layersListenerKeys_=[],r.listenerKeys_={},r.addEventListener(yt(pl),r.handleLayersChanged_),o?Array.isArray(o)?o=new St(o.slice(),{unique:!0}):wt("function"==typeof o.getArray,43):o=new St(void 0,{unique:!0}),r.setLayers(o),r}return cl(e,t),e.prototype.handleLayerChange_=function(){this.changed()},e.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(N),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var e in this.layersListenerKeys_.push(M(t,R,this.handleLayersAdd_,this),M(t,b,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[e].forEach(N);I(this.listenerKeys_);for(var r=t.getArray(),n=0,i=r.length;n<i;n++){var o=r[n];this.listenerKeys_[S(o)]=[M(o,P,this.handleLayerChange_,this),M(o,J,this.handleLayerChange_,this)]}this.changed()},e.prototype.handleLayersAdd_=function(t){var e=t.element;this.listenerKeys_[S(e)]=[M(e,P,this.handleLayerChange_,this),M(e,J,this.handleLayerChange_,this)],this.changed()},e.prototype.handleLayersRemove_=function(t){var e=S(t.element);this.listenerKeys_[e].forEach(N),delete this.listenerKeys_[e],this.changed()},e.prototype.getLayers=function(){return this.get(pl)},e.prototype.setLayers=function(t){this.set(pl,t)},e.prototype.getLayersArray=function(t){var e=void 0!==t?t:[];return this.getLayers().forEach((function(t){t.getLayersArray(e)})),e},e.prototype.getLayerStatesArray=function(t){var e=void 0!==t?t:[],r=e.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(e)}));for(var n=this.getLayerState(),i=r,o=e.length;i<o;i++){var a=e[i];a.opacity*=n.opacity,a.visible=a.visible&&n.visible,a.maxResolution=Math.min(a.maxResolution,n.maxResolution),a.minResolution=Math.max(a.minResolution,n.minResolution),a.minZoom=Math.max(a.minZoom,n.minZoom),a.maxZoom=Math.min(a.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==a.extent?a.extent=_e(a.extent,n.extent):a.extent=n.extent)}return e},e.prototype.getSourceState=function(){return Pi},e}(xi);function dl(t,e,r){return void 0===r&&(r=[0,0]),r[0]=t[0]+2*e,r[1]=t[1]+2*e,r}function _l(t,e,r){return void 0===r&&(r=[0,0]),r[0]=t[0]*e+.5|0,r[1]=t[1]*e+.5|0,r}function gl(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var yl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var vl=function(t){function e(e){var r=t.call(this)||this,n=function(t){var e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);var r,n,i,o={},a=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new fl({layers:t.layers});o[Xu]=a,o[Wu]=t.target,o[Zu]=void 0!==t.view?t.view:new hl,void 0!==t.controls&&(Array.isArray(t.controls)?r=new St(t.controls.slice()):(wt("function"==typeof t.controls.getArray,47),r=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?n=new St(t.interactions.slice()):(wt("function"==typeof t.interactions.getArray,48),n=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?i=new St(t.overlays.slice()):(wt("function"==typeof t.overlays.getArray,49),i=t.overlays):i=new St;return{controls:r,interactions:n,keyboardEventTarget:e,overlays:i,values:o}}(e);r.boundHandleBrowserEvent_=r.handleBrowserEvent.bind(r),r.maxTilesLoading_=void 0!==e.maxTilesLoading?e.maxTilesLoading:16,r.pixelRatio_=void 0!==e.pixelRatio?e.pixelRatio:Zi,r.postRenderTimeoutHandle_,r.animationDelayKey_,r.animationDelay_=function(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}.bind(r),r.coordinateToPixelTransform_=[1,0,0,1,0,0],r.pixelToCoordinateTransform_=[1,0,0,1,0,0],r.frameIndex_=0,r.frameState_=null,r.previousExtent_=null,r.viewPropertyListenerKey_=null,r.viewChangeListenerKey_=null,r.layerGroupPropertyListenerKeys_=null,r.viewport_=document.createElement("div"),r.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),r.viewport_.style.position="relative",r.viewport_.style.overflow="hidden",r.viewport_.style.width="100%",r.viewport_.style.height="100%",r.overlayContainer_=document.createElement("div"),r.overlayContainer_.style.position="absolute",r.overlayContainer_.style.zIndex="0",r.overlayContainer_.style.width="100%",r.overlayContainer_.style.height="100%",r.overlayContainer_.className="ol-overlaycontainer",r.viewport_.appendChild(r.overlayContainer_),r.overlayContainerStopEvent_=document.createElement("div"),r.overlayContainerStopEvent_.style.position="absolute",r.overlayContainerStopEvent_.style.zIndex="0",r.overlayContainerStopEvent_.style.width="100%",r.overlayContainerStopEvent_.style.height="100%",r.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",r.viewport_.appendChild(r.overlayContainerStopEvent_),r.mapBrowserEventHandler_=new Uu(r,e.moveTolerance);var i=r.handleMapBrowserEvent.bind(r);for(var o in Fu)r.mapBrowserEventHandler_.addEventListener(Fu[o],i);r.keyboardEventTarget_=n.keyboardEventTarget,r.keyHandlerKeys_=null;var a=r.handleBrowserEvent.bind(r);return r.viewport_.addEventListener($,a,!1),r.viewport_.addEventListener(ht,a,!!Hi&&{passive:!1}),r.controls=n.controls||new St,r.interactions=n.interactions||new St,r.overlays_=n.overlays,r.overlayIdIndex_={},r.renderer_=null,r.handleResize_,r.postRenderFunctions_=[],r.tileQueue_=new Hu(r.getTilePriority.bind(r),r.handleTileChange_.bind(r)),r.addEventListener(yt(Xu),r.handleLayerGroupChanged_),r.addEventListener(yt(Zu),r.handleViewChanged_),r.addEventListener(yt(Vu),r.handleSizeChanged_),r.addEventListener(yt(Wu),r.handleTargetChanged_),r.setProperties(n.values),r.controls.forEach(function(t){t.setMap(this)}.bind(r)),r.controls.addEventListener(R,function(t){t.element.setMap(this)}.bind(r)),r.controls.addEventListener(b,function(t){t.element.setMap(null)}.bind(r)),r.interactions.forEach(function(t){t.setMap(this)}.bind(r)),r.interactions.addEventListener(R,function(t){t.element.setMap(this)}.bind(r)),r.interactions.addEventListener(b,function(t){t.element.setMap(null)}.bind(r)),r.overlays_.forEach(r.addOverlayInternal_.bind(r)),r.overlays_.addEventListener(R,function(t){this.addOverlayInternal_(t.element)}.bind(r)),r.overlays_.addEventListener(b,function(t){var e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}.bind(r)),r}return yl(e,t),e.prototype.createRenderer=function(){throw new Error("Use a map type that has a createRenderer method")},e.prototype.addControl=function(t){this.getControls().push(t)},e.prototype.addInteraction=function(t){this.getInteractions().push(t)},e.prototype.addLayer=function(t){this.getLayerGroup().getLayers().push(t)},e.prototype.addOverlay=function(t){this.getOverlays().push(t)},e.prototype.addOverlayInternal_=function(t){var e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)},e.prototype.disposeInternal=function(){this.mapBrowserEventHandler_.dispose(),this.viewport_.removeEventListener($,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(ht,this.boundHandleBrowserEvent_),void 0!==this.handleResize_&&(removeEventListener(ut,this.handleResize_,!1),this.handleResize_=void 0),this.setTarget(null),t.prototype.disposeInternal.call(this)},e.prototype.forEachFeatureAtPixel=function(t,e,r){if(this.frameState_){var n=this.getCoordinateFromPixelInternal(t),i=void 0!==(r=void 0!==r?r:{}).hitTolerance?r.hitTolerance*this.frameState_.pixelRatio:0,o=void 0!==r.layerFilter?r.layerFilter:Y,a=!1!==r.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,i,a,e,null,o,null)}},e.prototype.getFeaturesAtPixel=function(t,e){var r=[];return this.forEachFeatureAtPixel(t,(function(t){r.push(t)}),e),r},e.prototype.forEachLayerAtPixel=function(t,e,r){if(this.frameState_){var n=r||{},i=void 0!==n.hitTolerance?n.hitTolerance*this.frameState_.pixelRatio:0,o=n.layerFilter||Y;return this.renderer_.forEachLayerAtPixel(t,this.frameState_,i,e,o)}},e.prototype.hasFeatureAtPixel=function(t,e){if(!this.frameState_)return!1;var r=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:Y,i=void 0!==e.hitTolerance?e.hitTolerance*this.frameState_.pixelRatio:0,o=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(r,this.frameState_,i,o,n,null)},e.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))},e.prototype.getEventCoordinateInternal=function(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))},e.prototype.getEventPixel=function(t){var e=this.viewport_.getBoundingClientRect(),r="changedTouches"in t?t.changedTouches[0]:t;return[r.clientX-e.left,r.clientY-e.top]},e.prototype.getTarget=function(){return this.get(Wu)},e.prototype.getTargetElement=function(){var t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null},e.prototype.getCoordinateFromPixel=function(t){return Yr(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())},e.prototype.getCoordinateFromPixelInternal=function(t){var e=this.frameState_;return e?Qr(e.pixelToCoordinateTransform,t.slice()):null},e.prototype.getControls=function(){return this.controls},e.prototype.getOverlays=function(){return this.overlays_},e.prototype.getOverlayById=function(t){var e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null},e.prototype.getInteractions=function(){return this.interactions},e.prototype.getLayerGroup=function(){return this.get(Xu)},e.prototype.getLayers=function(){return this.getLayerGroup().getLayers()},e.prototype.getLoading=function(){for(var t=this.getLayerGroup().getLayerStatesArray(),e=0,r=t.length;e<r;++e){var n=t[e].layer.getSource();if(n&&n.loading)return!0}return!1},e.prototype.getPixelFromCoordinate=function(t){var e=Xr(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)},e.prototype.getPixelFromCoordinateInternal=function(t){var e=this.frameState_;return e?Qr(e.coordinateToPixelTransform,t.slice(0,2)):null},e.prototype.getRenderer=function(){return this.renderer_},e.prototype.getSize=function(){return this.get(Vu)},e.prototype.getView=function(){return this.get(Zu)},e.prototype.getViewport=function(){return this.viewport_},e.prototype.getOverlayContainer=function(){return this.overlayContainer_},e.prototype.getOverlayContainerStopEvent=function(){return this.overlayContainerStopEvent_},e.prototype.getTilePriority=function(t,e,r,n){return function(t,e,r,n,i){if(!t||!(r in t.wantedTiles))return 1/0;if(!t.wantedTiles[r][e.getKey()])return 1/0;var o=t.viewState.center,a=n[0]-o[0],s=n[1]-o[1];return 65536*Math.log(i)+Math.sqrt(a*a+s*s)/i}(this.frameState_,t,e,r,n)},e.prototype.handleBrowserEvent=function(t,e){var r=e||t.type,n=new Lu(r,this,t);this.handleMapBrowserEvent(n)},e.prototype.handleMapBrowserEvent=function(t){if(this.frameState_){var e=t.originalEvent.target;if(t.dragging||!this.overlayContainerStopEvent_.contains(e)&&(document.body.contains(e)||this.viewport_.getRootNode&&this.viewport_.getRootNode().contains(e))){t.frameState=this.frameState_;var r=this.getInteractions().getArray();if(!1!==this.dispatchEvent(t))for(var n=r.length-1;n>=0;n--){var i=r[n];if(i.getActive())if(!i.handleEvent(t))break}}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var r=this.maxTilesLoading_,n=r;if(t){var i=t.viewHints;if(i[Vo]||i[Wo]){var o=!qi&&Date.now()-t.time>8;r=o?0:8,n=o?0:2}}e.getTilesLoading()<r&&(e.reprioritize(),e.loadMoreTiles(r,n))}!t||!this.hasListener(Ci)||t.animate||this.tileQueue_.getTilesLoading()||this.getLoading()||this.renderer_.dispatchRenderEvent(Ci,t);for(var a=this.postRenderFunctions_,s=0,u=a.length;s<u;++s)a[s](this,t);a.length=0},e.prototype.handleSizeChanged_=function(){this.getView()&&this.getView().resolveConstraints(0),this.render()},e.prototype.handleTargetChanged_=function(){var t;if(this.getTarget()&&(t=this.getTargetElement()),this.keyHandlerKeys_){for(var e=0,r=this.keyHandlerKeys_.length;e<r;++e)N(this.keyHandlerKeys_[e]);this.keyHandlerKeys_=null}if(t){t.appendChild(this.viewport_),this.renderer_||(this.renderer_=this.createRenderer());var n=this.keyboardEventTarget_?this.keyboardEventTarget_:t;this.keyHandlerKeys_=[M(n,ot,this.handleBrowserEvent,this),M(n,at,this.handleBrowserEvent,this)],this.handleResize_||(this.handleResize_=this.updateSize.bind(this),window.addEventListener(ut,this.handleResize_,!1))}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0),eo(this.viewport_),void 0!==this.handleResize_&&(removeEventListener(ut,this.handleResize_,!1),this.handleResize_=void 0);this.updateSize()},e.prototype.handleTileChange_=function(){this.render()},e.prototype.handleViewPropertyChanged_=function(){this.render()},e.prototype.handleViewChanged_=function(){this.viewPropertyListenerKey_&&(N(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(N(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);var t=this.getView();t&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=M(t,P,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=M(t,J,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()},e.prototype.handleLayerGroupChanged_=function(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(N),this.layerGroupPropertyListenerKeys_=null);var t=this.getLayerGroup();t&&(this.layerGroupPropertyListenerKeys_=[M(t,P,this.render,this),M(t,J,this.render,this)]),this.render()},e.prototype.isRendered=function(){return!!this.frameState_},e.prototype.renderSync=function(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()},e.prototype.redrawText=function(){for(var t=this.getLayerGroup().getLayerStatesArray(),e=0,r=t.length;e<r;++e){var n=t[e].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}},e.prototype.render=function(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))},e.prototype.removeControl=function(t){return this.getControls().remove(t)},e.prototype.removeInteraction=function(t){return this.getInteractions().remove(t)},e.prototype.removeLayer=function(t){return this.getLayerGroup().getLayers().remove(t)},e.prototype.removeOverlay=function(t){return this.getOverlays().remove(t)},e.prototype.renderFrame_=function(t){var e=this.getSize(),r=this.getView(),n=this.frameState_,i=null;if(void 0!==e&&function(t){return t[0]>0&&t[1]>0}(e)&&r&&r.isDef()){var o=r.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=r.getState();i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterItems:n?n.declutterItems:[],extent:pe(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{}}}if(this.frameState_=i,this.renderer_.renderFrame(i),i){if(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),n)(!this.previousExtent_||!Se(this.previousExtent_)&&!Jt(i.extent,this.previousExtent_))&&(this.dispatchEvent(new Ou(Bu,this,n)),this.previousExtent_=Wt(this.previousExtent_));this.previousExtent_&&!i.viewHints[Vo]&&!i.viewHints[Wo]&&!Jt(i.extent,this.previousExtent_)&&(this.dispatchEvent(new Ou(Yu,this,i)),Dt(i.extent,this.previousExtent_))}this.dispatchEvent(new Ou(zu,this,i)),this.postRenderTimeoutHandle_=setTimeout(this.handlePostRender.bind(this),0)},e.prototype.setLayerGroup=function(t){this.set(Xu,t)},e.prototype.setSize=function(t){this.set(Vu,t)},e.prototype.setTarget=function(t){this.set(Wu,t)},e.prototype.setView=function(t){this.set(Zu,t)},e.prototype.updateSize=function(){var t=this.getTargetElement();if(t){var e=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)])}else this.setSize(void 0);this.updateViewportSize_()},e.prototype.updateViewportSize_=function(){var t=this.getView();if(t){var e=void 0,r=getComputedStyle(this.viewport_);r.width&&r.height&&(e=[parseInt(r.width,10),parseInt(r.height,10)]),t.setViewportSize(e)}},e}(vt),ml=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xl=function(t){function e(e){var r=t.call(this)||this;return r.element=e.element?e.element:null,r.target_=null,r.map_=null,r.listenerKeys=[],r.render_=e.render?e.render:V,e.target&&r.setTarget(e.target),r}return ml(e,t),e.prototype.disposeInternal=function(){eo(this.element),t.prototype.disposeInternal.call(this)},e.prototype.getMap=function(){return this.map_},e.prototype.setMap=function(t){this.map_&&eo(this.element);for(var e=0,r=this.listenerKeys.length;e<r;++e)N(this.listenerKeys[e]);(this.listenerKeys.length=0,this.map_=t,this.map_)&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==V&&this.listenerKeys.push(M(t,zu,this.render,this)),t.render())},e.prototype.render=function(t){this.render_.call(this,t)},e.prototype.setTarget=function(t){this.target_="string"==typeof t?document.getElementById(t):t},e}(vt),El=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Sl(t){this.updateElement_(t.frameState)}var wl=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render||Sl,target:n.target})||this).ulElement_=document.createElement("ul"),r.collapsed_=void 0===n.collapsed||n.collapsed,r.overrideCollapsible_=void 0!==n.collapsible,r.collapsible_=void 0===n.collapsible||n.collapsible,r.collapsible_||(r.collapsed_=!1);var i=void 0!==n.className?n.className:"ol-attribution",o=void 0!==n.tipLabel?n.tipLabel:"Attributions",a=void 0!==n.collapseLabel?n.collapseLabel:"»";"string"==typeof a?(r.collapseLabel_=document.createElement("span"),r.collapseLabel_.textContent=a):r.collapseLabel_=a;var s=void 0!==n.label?n.label:"i";"string"==typeof s?(r.label_=document.createElement("span"),r.label_.textContent=s):r.label_=s;var u=r.collapsible_&&!r.collapsed_?r.collapseLabel_:r.label_,l=document.createElement("button");l.setAttribute("type","button"),l.title=o,l.appendChild(u),l.addEventListener(tt,r.handleClick_.bind(r),!1);var h=i+" ol-unselectable ol-control"+(r.collapsed_&&r.collapsible_?" ol-collapsed":"")+(r.collapsible_?"":" ol-uncollapsible"),c=r.element;return c.className=h,c.appendChild(r.ulElement_),c.appendChild(l),r.renderedAttributions_=[],r.renderedVisible_=!0,r}return El(e,t),e.prototype.collectSourceAttributions_=function(t){for(var e={},r=[],n=t.layerStatesArray,i=0,o=n.length;i<o;++i){var a=n[i];if(Li(a,t.viewState)){var s=a.layer.getSource();if(s){var u=s.getAttributions();if(u){var l=u(t);if(l)if(this.overrideCollapsible_||!1!==s.getAttributionsCollapsible()||this.setCollapsible(!1),Array.isArray(l))for(var h=0,c=l.length;h<c;++h)l[h]in e||(r.push(l[h]),e[l[h]]=!0);else l in e||(r.push(l),e[l]=!0)}}}}return r},e.prototype.updateElement_=function(t){if(t){var e=this.collectSourceAttributions_(t),r=e.length>0;if(this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),!B(e,this.renderedAttributions_)){ro(this.ulElement_);for(var n=0,i=e.length;n<i;++n){var o=document.createElement("li");o.innerHTML=e[n],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?to(this.collapseLabel_,this.label_):to(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e}(xl),Tl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Cl(t){var e=t.frameState;if(e){var r=e.viewState.rotation;if(r!=this.rotation_){var n="rotate("+r+"rad)";if(this.autoHide_){var i=this.element.classList.contains("ol-hidden");i||0!==r?i&&0!==r&&this.element.classList.remove("ol-hidden"):this.element.classList.add("ol-hidden")}this.label_.style.transform=n}this.rotation_=r}}var Rl=function(t){function e(e){var r=this,n=e||{};r=t.call(this,{element:document.createElement("div"),render:n.render||Cl,target:n.target})||this;var i=void 0!==n.className?n.className:"ol-rotate",o=void 0!==n.label?n.label:"⇧";r.label_=null,"string"==typeof o?(r.label_=document.createElement("span"),r.label_.className="ol-compass",r.label_.textContent=o):(r.label_=o,r.label_.classList.add("ol-compass"));var a=n.tipLabel?n.tipLabel:"Reset rotation",s=document.createElement("button");s.className=i+"-reset",s.setAttribute("type","button"),s.title=a,s.appendChild(r.label_),s.addEventListener(tt,r.handleClick_.bind(r),!1);var u=i+" ol-unselectable ol-control",l=r.element;return l.className=u,l.appendChild(s),r.callResetNorth_=n.resetNorth?n.resetNorth:void 0,r.duration_=void 0!==n.duration?n.duration:250,r.autoHide_=void 0===n.autoHide||n.autoHide,r.rotation_=void 0,r.autoHide_&&r.element.classList.add("ol-hidden"),r}return Tl(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()},e.prototype.resetNorth_=function(){var t=this.getMap().getView();if(t){var e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:xu}):t.setRotation(0))}},e}(xl),bl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pl=function(t){function e(e){var r=this,n=e||{};r=t.call(this,{element:document.createElement("div"),target:n.target})||this;var i=void 0!==n.className?n.className:"ol-zoom",o=void 0!==n.delta?n.delta:1,a=void 0!==n.zoomInLabel?n.zoomInLabel:"+",s=void 0!==n.zoomOutLabel?n.zoomOutLabel:"−",u=void 0!==n.zoomInTipLabel?n.zoomInTipLabel:"Zoom in",l=void 0!==n.zoomOutTipLabel?n.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=i+"-in",h.setAttribute("type","button"),h.title=u,h.appendChild("string"==typeof a?document.createTextNode(a):a),h.addEventListener(tt,r.handleClick_.bind(r,o),!1);var c=document.createElement("button");c.className=i+"-out",c.setAttribute("type","button"),c.title=l,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(tt,r.handleClick_.bind(r,-o),!1);var p=i+" ol-unselectable ol-control",f=r.element;return f.className=p,f.appendChild(h),f.appendChild(c),r.duration_=void 0!==n.duration?n.duration:250,r}return bl(e,t),e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var r=e.getZoom();if(void 0!==r){var n=e.getConstrainedZoom(r+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:xu})):e.setZoom(n)}}},e}(xl),Ol=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Il=["fullscreenchange","webkitfullscreenchange","MSFullscreenChange"],Ll="enterfullscreen",Fl="leavefullscreen";function Ml(){var t=document.body;return!!(t.webkitRequestFullscreen||t.msRequestFullscreen&&document.msFullscreenEnabled||t.requestFullscreen&&document.fullscreenEnabled)}function Al(){return!!(document.webkitIsFullScreen||document.msFullscreenElement||document.fullscreenElement)}function Nl(t){t.requestFullscreen?t.requestFullscreen():t.msRequestFullscreen?t.msRequestFullscreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}var Gl=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),target:n.target})||this).cssClassName_=void 0!==n.className?n.className:"ol-full-screen";var i=void 0!==n.label?n.label:"⤢";r.labelNode_="string"==typeof i?document.createTextNode(i):i;var o=void 0!==n.labelActive?n.labelActive:"×";r.labelActiveNode_="string"==typeof o?document.createTextNode(o):o,r.button_=document.createElement("button");var a=n.tipLabel?n.tipLabel:"Toggle full-screen";r.setClassName_(r.button_,Al()),r.button_.setAttribute("type","button"),r.button_.title=a,r.button_.appendChild(r.labelNode_),r.button_.addEventListener(tt,r.handleClick_.bind(r),!1);var s=r.cssClassName_+" ol-unselectable ol-control "+(Ml()?"":"ol-unsupported"),u=r.element;return u.className=s,u.appendChild(r.button_),r.keys_=void 0!==n.keys&&n.keys,r.source_=n.source,r}return Ol(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),this.handleFullScreen_()},e.prototype.handleFullScreen_=function(){if(Ml()){var t=this.getMap();if(t)if(Al())document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen();else{var e=void 0;e=this.source_?"string"==typeof this.source_?document.getElementById(this.source_):this.source_:t.getTargetElement(),this.keys_?function(t){t.webkitRequestFullscreen?t.webkitRequestFullscreen():Nl(t)}(e):Nl(e)}}},e.prototype.handleFullScreenChange_=function(){var t=this.getMap();Al()?(this.setClassName_(this.button_,!0),to(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(Ll)):(this.setClassName_(this.button_,!1),to(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(Fl)),t&&t.updateSize()},e.prototype.setClassName_=function(t,e){var r=this.cssClassName_+"-true",n=this.cssClassName_+"-false",i=e?r:n;t.classList.remove(r),t.classList.remove(n),t.classList.add(i)},e.prototype.setMap=function(e){if(t.prototype.setMap.call(this,e),e)for(var r=0,n=Il.length;r<n;++r)this.listenerKeys.push(M(document,Il[r],this.handleFullScreenChange_,this))},e}(xl),jl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Dl(t){var e=t.frameState;e?this.mapProjection_!=e.viewState.projection&&(this.mapProjection_=e.viewState.projection,this.transform_=null):this.mapProjection_=null}var kl=function(t){function e(e){var r=this,n=e||{},i=document.createElement("div");return i.className=void 0!==n.className?n.className:"ol-mouse-position",(r=t.call(this,{element:i,render:n.render||Dl,target:n.target})||this).addEventListener(yt("projection"),r.handleProjectionChanged_),n.coordinateFormat&&r.setCoordinateFormat(n.coordinateFormat),n.projection&&r.setProjection(n.projection),r.undefinedHTML_=void 0!==n.undefinedHTML?n.undefinedHTML:"&#160;",r.renderOnMouseOut_=!!r.undefinedHTML_,r.renderedHTML_=i.innerHTML,r.mapProjection_=null,r.transform_=null,r}return jl(e,t),e.prototype.handleProjectionChanged_=function(){this.transform_=null},e.prototype.getCoordinateFormat=function(){return this.get("coordinateFormat")},e.prototype.getProjection=function(){return this.get("projection")},e.prototype.handleMouseMove=function(t){var e=this.getMap();this.updateHTML_(e.getEventPixel(t))},e.prototype.handleMouseOut=function(t){this.updateHTML_(null)},e.prototype.setMap=function(e){if(t.prototype.setMap.call(this,e),e){var r=e.getViewport();this.listenerKeys.push(M(r,Nu,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push(M(r,Du,this.handleMouseOut,this))}},e.prototype.setCoordinateFormat=function(t){this.set("coordinateFormat",t)},e.prototype.setProjection=function(t){this.set("projection",Sr(t))},e.prototype.updateHTML_=function(t){var e=this.undefinedHTML_;if(t&&this.mapProjection_){if(!this.transform_){var r=this.getProjection();this.transform_=r?Mr(this.mapProjection_,r):mr}var n=this.getMap().getCoordinateFromPixelInternal(t);if(n){var i=zr();i&&(this.transform_=Mr(this.mapProjection_,i)),this.transform_(n,n);var o=this.getCoordinateFormat();e=o?o(n):n.toString()}}this.renderedHTML_&&e===this.renderedHTML_||(this.element.innerHTML=e,this.renderedHTML_=e)},e}(xl),Ul=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function zl(t,e){gs.expire()}var Bl=function(t){function e(e){var r=t.call(this)||this;return r.map_=e,r.declutterTree_=null,r}return Ul(e,t),e.prototype.dispatchRenderEvent=function(t,e){x()},e.prototype.calculateMatrices2D=function(t){var e=t.viewState,r=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;tn(r,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),en(n,r)},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i,o,a,s){var u,l=e.viewState;function h(t,e,r){return i.call(o,e,t?r:null)}var c=l.projection,p=la(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&n){var d=xe(c.getExtent());f.push([-d,0],[d,0])}var _,g=e.layerStatesArray,y=g.length;this.declutterTree_&&(_=this.declutterTree_.all().map((function(t){return t.value})));for(var v=[],m=0;m<f.length;m++)for(var x=y-1;x>=0;--x){var E=g[x],S=E.layer;if(S.hasRenderer()&&Li(E,l)&&a.call(s,S)){var w=S.getRenderer(),T=S.getSource();if(w&&T){var C=T.getWrapX()?p:t,R=h.bind(null,E.managed);v[0]=C[0]+f[m][0],v[1]=C[1]+f[m][1],u=w.forEachFeatureAtCoordinate(v,e,r,R,_)}if(u)return u}}},e.prototype.forEachLayerAtPixel=function(t,e,r,n,i){return x()},e.prototype.hasFeatureAtCoordinate=function(t,e,r,n,i,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,r,n,Y,this,i,o)},e.prototype.getMap=function(){return this.map_},e.prototype.renderFrame=function(t){this.declutterTree_=su(t,this.declutterTree_)},e.prototype.scheduleExpireIconCache=function(t){gs.canExpireCache()&&t.postRenderFunctions.push(zl)},e}(G),Yl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xl=function(t){function e(e){var r=t.call(this,e)||this;r.fontChangeListenerKey_=M(fo,P,e.redrawText.bind(e)),r.element_=document.createElement("div");var n=r.element_.style;n.position="absolute",n.width="100%",n.height="100%",n.zIndex="0",r.element_.className="ol-unselectable ol-layers";var i=e.getViewport();return i.insertBefore(r.element_,i.firstChild||null),r.children_=[],r.renderedVisible_=!0,r}return Yl(e,t),e.prototype.dispatchRenderEvent=function(t,e){var r=this.getMap();if(r.hasListener(t)){var n=new es(t,void 0,e);r.dispatchEvent(n)}},e.prototype.disposeInternal=function(){N(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),t.prototype.disposeInternal.call(this)},e.prototype.renderFrame=function(e){if(e){this.calculateMatrices2D(e),this.dispatchRenderEvent(wi,e);var r=e.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),n=e.viewState;this.children_.length=0;for(var i=null,o=0,a=r.length;o<a;++o){var s=r[o];if(e.layerIndex=o,Li(s,n)&&(s.sourceState==Pi||s.sourceState==Ri)){var u=s.layer.render(e,i);u&&u!==i&&(this.children_.push(u),i=u)}}t.prototype.renderFrame.call(this,e),function(t,e){for(var r=t.childNodes,n=0;;++n){var i=r[n],o=e[n];if(!i&&!o)break;i!==o&&(i?o?t.insertBefore(o,i):(t.removeChild(i),--n):t.appendChild(o))}}(this.element_,this.children_),this.dispatchRenderEvent(Ti,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},e.prototype.forEachLayerAtPixel=function(t,e,r,n,i){for(var o=e.viewState,a=e.layerStatesArray,s=a.length-1;s>=0;--s){var u=a[s],l=u.layer;if(l.hasRenderer()&&Li(u,o)&&i(l)){var h=l.getRenderer().getDataAtPixel(t,e,r);if(h){var c=n(l,h);if(c)return c}}}},e}(Bl),Vl="bottom-left",Wl="bottom-center",Zl="bottom-right",Kl="center-left",ql="center-center",Hl="center-right",Jl="top-left",Ql="top-center",$l="top-right",th=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),eh="element",rh="map",nh="offset",ih="position",oh="positioning",ah=function(t){function e(e){var r=t.call(this)||this;r.options=e,r.id=e.id,r.insertFirst=void 0===e.insertFirst||e.insertFirst,r.stopEvent=void 0===e.stopEvent||e.stopEvent,r.element=document.createElement("div"),r.element.className=void 0!==e.className?e.className:"ol-overlay-container ol-selectable",r.element.style.position="absolute";var n=e.autoPan;return n&&"object"!=typeof n&&(n={animation:e.autoPanAnimation,margin:e.autoPanMargin}),r.autoPan=n||!1,r.rendered={transform_:"",visible:!0},r.mapPostrenderListenerKey=null,r.addEventListener(yt(eh),r.handleElementChanged),r.addEventListener(yt(rh),r.handleMapChanged),r.addEventListener(yt(nh),r.handleOffsetChanged),r.addEventListener(yt(ih),r.handlePositionChanged),r.addEventListener(yt(oh),r.handlePositioningChanged),void 0!==e.element&&r.setElement(e.element),r.setOffset(void 0!==e.offset?e.offset:[0,0]),r.setPositioning(void 0!==e.positioning?e.positioning:Jl),void 0!==e.position&&r.setPosition(e.position),r}return th(e,t),e.prototype.getElement=function(){return this.get(eh)},e.prototype.getId=function(){return this.id},e.prototype.getMap=function(){return this.get(rh)},e.prototype.getOffset=function(){return this.get(nh)},e.prototype.getPosition=function(){return this.get(ih)},e.prototype.getPositioning=function(){return this.get(oh)},e.prototype.handleElementChanged=function(){ro(this.element);var t=this.getElement();t&&this.element.appendChild(t)},e.prototype.handleMapChanged=function(){this.mapPostrenderListenerKey&&(eo(this.element),N(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);var t=this.getMap();if(t){this.mapPostrenderListenerKey=M(t,zu,this.render,this),this.updatePixelPosition();var e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}},e.prototype.render=function(){this.updatePixelPosition()},e.prototype.handleOffsetChanged=function(){this.updatePixelPosition()},e.prototype.handlePositionChanged=function(){this.updatePixelPosition(),this.performAutoPan()},e.prototype.handlePositioningChanged=function(){this.updatePixelPosition()},e.prototype.setElement=function(t){this.set(eh,t)},e.prototype.setMap=function(t){this.set(rh,t)},e.prototype.setOffset=function(t){this.set(nh,t)},e.prototype.setPosition=function(t){this.set(ih,t)},e.prototype.performAutoPan=function(){this.autoPan&&this.panIntoView(this.autoPan)},e.prototype.panIntoView=function(t){var e=this.getMap();if(e&&e.getTargetElement()&&this.get(ih)){var r=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),i=this.getRect(n,[Qi(n),$i(n)]),o=void 0===t.margin?20:t.margin;if(!zt(r,i)){var a=i[0]-r[0],s=r[2]-i[2],u=i[1]-r[1],l=r[3]-i[3],h=[0,0];if(a<0?h[0]=a-o:s<0&&(h[0]=Math.abs(s)+o),u<0?h[1]=u-o:l<0&&(h[1]=Math.abs(l)+o),0!==h[0]||0!==h[1]){var c=e.getView().getCenterInternal(),p=e.getPixelFromCoordinateInternal(c),f=[p[0]+h[0],p[1]+h[1]],d=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(f),duration:d.duration,easing:d.easing})}}}},e.prototype.getRect=function(t,e){var r=t.getBoundingClientRect(),n=r.left+window.pageXOffset,i=r.top+window.pageYOffset;return[n,i,n+e[0],i+e[1]]},e.prototype.setPositioning=function(t){this.set(oh,t)},e.prototype.setVisible=function(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)},e.prototype.updatePixelPosition=function(){var t=this.getMap(),e=this.getPosition();if(t&&t.isRendered()&&e){var r=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(r,n)}else this.setVisible(!1)},e.prototype.updateRenderedPosition=function(t,e){var r=this.element.style,n=this.getOffset(),i=this.getPositioning();this.setVisible(!0);var o=Math.round(t[0]+n[0])+"px",a=Math.round(t[1]+n[1])+"px",s="0%",u="0%";i==Zl||i==Hl||i==$l?s="-100%":i!=Wl&&i!=ql&&i!=Ql||(s="-50%"),i==Vl||i==Wl||i==Zl?u="-100%":i!=Kl&&i!=ql&&i!=Hl||(u="-50%");var l="translate("+s+", "+u+") translate("+o+", "+a+")";this.rendered.transform_!=l&&(this.rendered.transform_=l,r.transform=l,r.msTransform=l)},e.prototype.getOptions=function(){return this.options},e}(vt),sh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),uh=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return sh(e,t),e.prototype.createRenderer=function(){return new Xl(this)},e}(vl);function lh(t){this.validateExtent_(),this.updateBox_()}var hh=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render||lh,target:n.target})||this).boundHandleRotationChanged_=r.handleRotationChanged_.bind(r),r.collapsed_=void 0===n.collapsed||n.collapsed,r.collapsible_=void 0===n.collapsible||n.collapsible,r.collapsible_||(r.collapsed_=!1),r.rotateWithView_=void 0!==n.rotateWithView&&n.rotateWithView,r.viewExtent_=void 0;var i=void 0!==n.className?n.className:"ol-overviewmap",o=void 0!==n.tipLabel?n.tipLabel:"Overview map",a=void 0!==n.collapseLabel?n.collapseLabel:"«";"string"==typeof a?(r.collapseLabel_=document.createElement("span"),r.collapseLabel_.textContent=a):r.collapseLabel_=a;var s=void 0!==n.label?n.label:"»";"string"==typeof s?(r.label_=document.createElement("span"),r.label_.textContent=s):r.label_=s;var u=r.collapsible_&&!r.collapsed_?r.collapseLabel_:r.label_,l=document.createElement("button");l.setAttribute("type","button"),l.title=o,l.appendChild(u),l.addEventListener(tt,r.handleClick_.bind(r),!1),r.ovmapDiv_=document.createElement("div"),r.ovmapDiv_.className="ol-overviewmap-map",r.view_=n.view,r.ovmap_=new uh({view:n.view});var h=r.ovmap_;n.layers&&n.layers.forEach((function(t){h.addLayer(t)}));var c=document.createElement("div");c.className="ol-overviewmap-box",c.style.boxSizing="border-box",r.boxOverlay_=new ah({position:[0,0],positioning:ql,element:c}),r.ovmap_.addOverlay(r.boxOverlay_);var p=i+" ol-unselectable ol-control"+(r.collapsed_&&r.collapsible_?" ol-collapsed":"")+(r.collapsible_?"":" ol-uncollapsible"),f=r.element;f.className=p,f.appendChild(r.ovmapDiv_),f.appendChild(l);var d=r,_=r.boxOverlay_,g=r.boxOverlay_.getElement(),y=function(t){var e,r={clientX:(e=t).clientX,clientY:e.clientY},n=h.getEventCoordinateInternal(r);_.setPosition(n)},v=function(t){var e=h.getEventCoordinateInternal(t);d.getMap().getView().setCenterInternal(e),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",v)};return g.addEventListener("mousedown",(function(){window.addEventListener("mousemove",y),window.addEventListener("mouseup",v)})),r}return sh(e,t),e.prototype.setMap=function(e){var r=this.getMap();if(e!==r){if(r){var n=r.getView();n&&this.unbindView_(n),this.ovmap_.setTarget(null)}if(t.prototype.setMap.call(this,e),e){this.ovmap_.setTarget(this.ovmapDiv_),this.listenerKeys.push(M(e,P,this.handleMapPropertyChange_,this));var i=e.getView();i&&(this.bindView_(i),i.isDef()&&(this.ovmap_.updateSize(),this.resetExtent_()))}}},e.prototype.handleMapPropertyChange_=function(t){if(t.key===Zu){var e=t.oldValue;e&&this.unbindView_(e);var r=this.getMap().getView();this.bindView_(r)}},e.prototype.bindView_=function(t){if(!this.view_){var e=new hl({projection:t.getProjection()});this.ovmap_.setView(e)}t.addEventListener(yt(al),this.boundHandleRotationChanged_),this.handleRotationChanged_()},e.prototype.unbindView_=function(t){t.removeEventListener(yt(al),this.boundHandleRotationChanged_)},e.prototype.handleRotationChanged_=function(){this.rotateWithView_&&this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())},e.prototype.validateExtent_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var r=t.getSize(),n=t.getView().calculateExtentInternal(r);if(!this.viewExtent_||!Jt(n,this.viewExtent_)){this.viewExtent_=n;var i=e.getSize(),o=e.getView().calculateExtentInternal(i),a=e.getPixelFromCoordinateInternal(ve(n)),s=e.getPixelFromCoordinateInternal(ue(n)),u=Math.abs(a[0]-s[0]),l=Math.abs(a[1]-s[1]),h=i[0],c=i[1];u<.1*h||l<.1*c||u>.75*h||l>.75*c?this.resetExtent_():zt(o,n)||this.recenter_()}}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getSize(),n=t.getView().calculateExtentInternal(r),i=e.getView(),o=Math.log(7.5)/Math.LN2;Te(n,1/(.1*Math.pow(2,o/2))),i.fitInternal(Kn(n))},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getView();e.getView().setCenterInternal(r.getCenterInternal())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var r=t.getSize(),n=t.getView(),i=e.getView(),o=this.rotateWithView_?0:-n.getRotation(),a=this.boxOverlay_,s=this.boxOverlay_.getElement(),u=n.getCenterInternal(),l=n.getResolution(),h=i.getResolution(),c=r[0]*l/h,p=r[1]*l/h;if(a.setPosition(u),s){s.style.width=c+"px",s.style.height=p+"px";var f="rotate("+o+"rad)";s.style.transform=f}}},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?to(this.collapseLabel_,this.label_):to(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),A(t,zu,(function(t){this.updateBox_()}),this)}},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getRotateWithView=function(){return this.rotateWithView_},e.prototype.setRotateWithView=function(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))},e.prototype.getOverviewMap=function(){return this.ovmap_},e}(xl),ch=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ph="degrees",fh="imperial",dh="nautical",_h="metric",gh="us",yh=[1,2,5];function vh(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}var mh=function(t){function e(e){var r=this,n=e||{},i=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(r=t.call(this,{element:document.createElement("div"),render:n.render||vh,target:n.target})||this).innerElement_=document.createElement("div"),r.innerElement_.className=i+"-inner",r.element.className=i+" ol-unselectable",r.element.appendChild(r.innerElement_),r.viewState_=null,r.minWidth_=void 0!==n.minWidth?n.minWidth:64,r.renderedVisible_=!1,r.renderedWidth_=void 0,r.renderedHTML_="",r.addEventListener(yt("units"),r.handleUnitsChanged_),r.setUnits(n.units||_h),r.scaleBar_=n.bar||!1,r.scaleBarSteps_=n.steps||4,r.scaleBarText_=n.text||!1,r}return ch(e,t),e.prototype.getUnits=function(){return this.get("units")},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set("units",t)},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,r=t.projection,n=this.getUnits(),i=n==ph?$e.DEGREES:$e.METERS,o=wr(r,t.resolution,e,i),a=this.minWidth_*o,s="";if(n==ph){var u=Qe[$e.DEGREES];(a*=u)<u/60?(s="″",o*=3600):a<u?(s="′",o*=60):s="°"}else n==fh?a<.9144?(s="in",o/=.0254):a<1609.344?(s="ft",o/=.3048):(s="mi",o/=1609.344):n==dh?(o/=1852,s="nm"):n==_h?a<.001?(s="μm",o*=1e6):a<1?(s="mm",o*=1e3):a<1e3?s="m":(s="km",o/=1e3):n==gh?a<.9144?(s="in",o*=39.37):a<1609.344?(s="ft",o/=.30480061):(s="mi",o/=1609.3472):wt(!1,33);for(var l,h,c,p,f=3*Math.floor(Math.log(this.minWidth_*o)/Math.log(10));;){c=Math.floor(f/3);var d=Math.pow(10,c);if(l=yh[(f%3+3)%3]*d,h=Math.round(l/o),isNaN(h))return this.element.style.display="none",void(this.renderedVisible_=!1);if(h>=this.minWidth_)break;++f}p=this.scaleBar_?this.createScaleBar(h,l,s):l.toFixed(c<0?-c:0)+" "+s,this.renderedHTML_!=p&&(this.innerElement_.innerHTML=p,this.renderedHTML_=p),this.renderedWidth_!=h&&(this.innerElement_.style.width=h+"px",this.renderedWidth_=h),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,r){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),i=[],o=t/this.scaleBarSteps_,a="#ffffff",s=0;s<this.scaleBarSteps_;s++)0===s&&i.push(this.createMarker("absolute",s)),i.push('<div><div class="ol-scale-singlebar" style="width: '+o+"px;background-color: "+a+';"></div>'+this.createMarker("relative",s)+(s%2==0||2===this.scaleBarSteps_?this.createStepText(s,t,!1,e,r):"")+"</div>"),s===this.scaleBarSteps_-1&&i.push(this.createStepText(s+1,t,!0,e,r)),a="#ffffff"===a?"#000000":"#ffffff";return'<div style="display: flex;">'+(this.scaleBarText_?'<div class="ol-scale-text" style="width: '+t+'px;">'+n+"</div>":"")+i.join("")+"</div>"},e.prototype.createMarker=function(t,e){return'<div class="ol-scale-step-marker" style="position: '+t+";top: "+("absolute"===t?3:-10)+'px;"></div>'},e.prototype.createStepText=function(t,e,r,n,i){var o=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+i);return'<div class="ol-scale-step-text" style="margin-left: '+(0===t?-3:e/this.scaleBarSteps_*-1)+"px;text-align: "+(0===t?"left":"center")+"; min-width: "+(0===t?0:e/this.scaleBarSteps_*2)+"px;left: "+(r?e+"px":"unset")+';">'+o+"</div>"},e.prototype.getScaleForResolution=function(){var t=this.getMap().getView().getResolution(),e=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*e*39.37*(25.4/.28)},e}(xl),xh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Eh=0,Sh=1;function wh(t){if(t.frameState){this.sliderInitialized_||this.initSlider_();var e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}}var Th=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render||wh})||this).dragListenerKeys_=[],r.currentResolution_=void 0,r.direction_=Eh,r.dragging_,r.heightLimit_=0,r.widthLimit_=0,r.startX_,r.startY_,r.thumbSize_=null,r.sliderInitialized_=!1,r.duration_=void 0!==n.duration?n.duration:200;var i=void 0!==n.className?n.className:"ol-zoomslider",o=document.createElement("button");o.setAttribute("type","button"),o.className=i+"-thumb ol-unselectable";var a=r.element;return a.className=i+" ol-unselectable ol-control",a.appendChild(o),a.addEventListener(Gu,r.handleDraggerStart_.bind(r),!1),a.addEventListener(Nu,r.handleDraggerDrag_.bind(r),!1),a.addEventListener(ju,r.handleDraggerEnd_.bind(r),!1),a.addEventListener(tt,r.handleContainerClick_.bind(r),!1),o.addEventListener(tt,W,!1),r}return xh(e,t),e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),e&&e.render()},e.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,r=t.offsetHeight,n=t.firstElementChild,i=getComputedStyle(n),o=n.offsetWidth+parseFloat(i.marginRight)+parseFloat(i.marginLeft),a=n.offsetHeight+parseFloat(i.marginTop)+parseFloat(i.marginBottom);this.thumbSize_=[o,a],e>r?(this.direction_=Sh,this.widthLimit_=e-o):(this.direction_=Eh,this.heightLimit_=r-a),this.sliderInitialized_=!0},e.prototype.handleContainerClick_=function(t){var e=this.getMap().getView(),r=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(r),i=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:i,duration:this.duration_,easing:xu})},e.prototype.handleDraggerStart_=function(t){if(!this.dragging_&&t.target===this.element.firstElementChild){var e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){var r=this.handleDraggerDrag_,n=this.handleDraggerEnd_;this.dragListenerKeys_.push(M(document,Nu,r,this),M(document,ju,n,this))}}},e.prototype.handleDraggerDrag_=function(t){if(this.dragging_){var e=t.clientX-this.startX_,r=t.clientY-this.startY_,n=this.getRelativePosition_(e,r);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}},e.prototype.handleDraggerEnd_=function(t){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(N),this.dragListenerKeys_.length=0)},e.prototype.setThumbPosition_=function(t){var e=this.getPositionForResolution_(t),r=this.element.firstElementChild;this.direction_==Sh?r.style.left=this.widthLimit_*e+"px":r.style.top=this.heightLimit_*e+"px"},e.prototype.getRelativePosition_=function(t,e){return Ge(this.direction_===Sh?t/this.widthLimit_:e/this.heightLimit_,0,1)},e.prototype.getResolutionForPosition_=function(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)},e.prototype.getPositionForResolution_=function(t){return Ge(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)},e}(xl),Ch=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Rh=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),target:n.target})||this).extent=n.extent?n.extent:null;var i=void 0!==n.className?n.className:"ol-zoom-extent",o=void 0!==n.label?n.label:"E",a=void 0!==n.tipLabel?n.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=a,s.appendChild("string"==typeof o?document.createTextNode(o):o),s.addEventListener(tt,r.handleClick_.bind(r),!1);var u=i+" ol-unselectable ol-control",l=r.element;return l.className=u,l.appendChild(s),r}return Ch(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),this.handleZoomToExtent()},e.prototype.handleZoomToExtent=function(){var t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(Kn(e))},e}(xl);function bh(t){var e=t||{},r=new St;return(void 0===e.zoom||e.zoom)&&r.push(new Pl(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&r.push(new Rl(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&r.push(new wl(e.attributionOptions)),r}var Ph="active",Oh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ih(t,e,r,n){var i=t.getZoom();if(void 0!==i){var o=t.getConstrainedZoom(i+e),a=t.getResolutionForZoom(o);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:a,anchor:r,duration:void 0!==n?n:250,easing:xu})}}var Lh=function(t){function e(e){var r=t.call(this)||this;return e.handleEvent&&(r.handleEvent=e.handleEvent),r.map_=null,r.setActive(!0),r}return Oh(e,t),e.prototype.getActive=function(){return this.get(Ph)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Ph,t)},e.prototype.setMap=function(t){this.map_=t},e}(vt),Fh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Mh(t){var e=!1;if(t.type==Fu.DBLCLICK){var r=t.originalEvent,n=t.map,i=t.coordinate,o=r.shiftKey?-this.delta_:this.delta_;Ih(n.getView(),o,i,this.duration_),t.preventDefault(),e=!0}return!e}var Ah=function(t){function e(e){var r=t.call(this,{handleEvent:Mh})||this,n=e||{};return r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:250,r}return Fh(e,t),e}(Lh),Nh=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Gh=function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},jh=function(t){return t.target.getTargetElement()===document.activeElement},Dh=Y,kh=function(t){return t.type==Fu.CLICK},Uh=function(t){var e=t.originalEvent;return 0==e.button&&!(Vi&&Wi&&e.ctrlKey)},zh=X,Bh=function(t){return"pointermove"==t.type},Yh=function(t){return t.type==Fu.SINGLECLICK},Xh=function(t){return t.type==Fu.DBLCLICK},Vh=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Wh=function(t){var e=t.originalEvent;return!e.altKey&&(Wi?e.metaKey:e.ctrlKey)&&!e.shiftKey},Zh=function(t){var e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Kh=function(t){var e=t.originalEvent.target.tagName;return"INPUT"!==e&&"SELECT"!==e&&"TEXTAREA"!==e},qh=function(t){var e=t.pointerEvent;return wt(void 0!==e,56),"mouse"==e.pointerType},Hh=function(t){var e=t.pointerEvent;return wt(void 0!==e,56),"touch"===e.pointerType},Jh=function(t){var e=t.pointerEvent;return wt(void 0!==e,56),"pen"===e.pointerType},Qh=function(t){var e=t.pointerEvent;return wt(void 0!==e,56),e.isPrimary&&0===e.button},$h=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function tc(t){for(var e=t.length,r=0,n=0,i=0;i<e;i++)r+=t[i].clientX,n+=t[i].clientY;return[r/e,n/e]}var ec=function(t){function e(e){var r=this,n=e||{};return r=t.call(this,n)||this,n.handleDownEvent&&(r.handleDownEvent=n.handleDownEvent),n.handleDragEvent&&(r.handleDragEvent=n.handleDragEvent),n.handleMoveEvent&&(r.handleMoveEvent=n.handleMoveEvent),n.handleUpEvent&&(r.handleUpEvent=n.handleUpEvent),n.stopDown&&(r.stopDown=n.stopDown),r.handlingDownUpSequence=!1,r.trackedPointers_={},r.targetPointers=[],r}return $h(e,t),e.prototype.getPointerCount=function(){return this.targetPointers.length},e.prototype.handleDownEvent=function(t){return!1},e.prototype.handleDragEvent=function(t){},e.prototype.handleEvent=function(t){if(!t.pointerEvent)return!0;var e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Fu.POINTERDRAG)this.handleDragEvent(t);else if(t.type==Fu.POINTERUP){var r=this.handleUpEvent(t);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(t.type==Fu.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==Fu.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===Fu.POINTERDOWN||e===Fu.POINTERDRAG||e===Fu.POINTERUP}(t)){var e=t.pointerEvent,r=e.pointerId.toString();t.type==Fu.POINTERUP?delete this.trackedPointers_[r]:(t.type==Fu.POINTERDOWN||r in this.trackedPointers_)&&(this.trackedPointers_[r]=e),this.targetPointers=L(this.trackedPointers_)}},e}(Lh),rc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function nc(t){return Vh(t)&&Qh(t)}var ic=function(t){function e(e){var r=t.call(this,{stopDown:X})||this,n=e||{};return r.kinetic_=n.kinetic,r.lastCentroid=null,r.lastPointersCount_,r.panning_=!1,r.condition_=n.condition?n.condition:nc,r.noKinetic_=!1,r}return rc(e,t),e.prototype.conditionInternal_=function(t){var e=!0;return t.map.getTargetElement().hasAttribute("tabindex")&&(e=jh(t)),e&&this.condition_(t)},e.prototype.handleDragEvent=function(t){this.panning_||(this.panning_=!0,this.getMap().getView().beginInteraction());var e=this.targetPointers,r=tc(e);if(e.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){var n=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],i=t.map.getView();na(n,i.getResolution()),ra(n,i.getRotation()),i.adjustCenterInternal(n)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=e.length,t.originalEvent.preventDefault()},e.prototype.handleUpEvent=function(t){var e=t.map,r=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){var n=this.kinetic_.getDistance(),i=this.kinetic_.getAngle(),o=r.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),s=e.getCoordinateFromPixelInternal([a[0]-n*Math.cos(i),a[1]-n*Math.sin(i)]);r.animateInternal({center:r.getConstrainedCenter(s),duration:500,easing:xu})}return this.panning_&&(this.panning_=!1,r.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>0&&this.conditionInternal_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(ec),oc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ac=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{stopDown:X})||this).condition_=n.condition?n.condition:Gh,r.lastAngle_=void 0,r.duration_=void 0!==n.duration?n.duration:250,r}return oc(e,t),e.prototype.handleDragEvent=function(t){if(qh(t)){var e=t.map,r=e.getView();if(r.getConstraints().rotation!==rl){var n=e.getSize(),i=t.pixel,o=Math.atan2(n[1]/2-i[1],i[0]-n[0]/2);if(void 0!==this.lastAngle_){var a=o-this.lastAngle_;r.adjustRotationInternal(-a)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!qh(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!qh(t)&&(!(!Uh(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(ec),sc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),uc=function(t){function e(e){var r=t.call(this)||this;return r.geometry_=null,r.element_=document.createElement("div"),r.element_.style.position="absolute",r.element_.className="ol-box "+e,r.map_=null,r.startPixel_=null,r.endPixel_=null,r}return sc(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,r=this.element_.style;r.left=Math.min(t[0],e[0])+"px",r.top=Math.min(t[1],e[1])+"px",r.width=Math.abs(e[0]-t[0])+"px",r.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Wn([r])},e.prototype.getGeometry=function(){return this.geometry_},e}(G),lc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),hc="boxstart",cc="boxdrag",pc="boxend",fc=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.coordinate=r,i.mapBrowserEvent=n,i}return lc(e,t),e}(K),dc=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.box_=new uc(n.className||"ol-dragbox"),r.minArea_=void 0!==n.minArea?n.minArea:64,r.onBoxEnd_=n.onBoxEnd?n.onBoxEnd:V,r.startPixel_=null,r.condition_=n.condition?n.condition:Uh,r.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:r.defaultBoxEndCondition,r}return lc(e,t),e.prototype.defaultBoxEndCondition=function(t,e,r){var n=r[0]-e[0],i=r[1]-e[1];return n*n+i*i>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new fc(cc,t.coordinate,t))},e.prototype.handleUpEvent=function(t){return this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd_(t),this.dispatchEvent(new fc(pc,t.coordinate,t))),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new fc(hc,t.coordinate,t)),!0)},e}(ec),_c=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function gc(){var t=this.getMap(),e=t.getView(),r=t.getSize(),n=this.getGeometry().getExtent();if(this.out_){var i=e.calculateExtentInternal(r),o=Kt([t.getPixelFromCoordinateInternal(se(n)),t.getPixelFromCoordinateInternal(me(n))]);Te(i,1/e.getResolutionForExtentInternal(o,r)),n=i}var a=e.getConstrainedResolution(e.getResolutionForExtentInternal(n,r)),s=e.getConstrainedCenter(le(n),a);e.animateInternal({resolution:a,center:s,duration:this.duration_,easing:xu})}var yc=function(t){function e(e){var r=this,n=e||{},i=n.condition?n.condition:Zh;return(r=t.call(this,{condition:i,className:n.className||"ol-dragzoom",minArea:n.minArea,onBoxEnd:gc})||this).duration_=void 0!==n.duration?n.duration:200,r.out_=void 0!==n.out&&n.out,r}return _c(e,t),e}(dc),vc=37,mc=38,xc=39,Ec=40,Sc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function wc(t){var e=!1;if(t.type==ot){var r=t.originalEvent.keyCode;if(this.condition_(t)&&(r==Ec||r==vc||r==xc||r==mc)){var n=t.map.getView(),i=n.getResolution()*this.pixelDelta_,o=0,a=0;r==Ec?a=-i:r==vc?o=-i:r==xc?o=i:a=i;var s=[o,a];ra(s,n.getRotation()),function(t,e,r){var n=t.getCenterInternal();if(n){var i=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==r?r:250,easing:Su,center:t.getConstrainedCenter(i)})}}(n,s,this.duration_),t.preventDefault(),e=!0}}return!e}var Tc=function(t){function e(e){var r=t.call(this,{handleEvent:wc})||this,n=e||{};return r.defaultCondition_=function(t){return Vh(t)&&Kh(t)},r.condition_=void 0!==n.condition?n.condition:r.defaultCondition_,r.duration_=void 0!==n.duration?n.duration:100,r.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,r}return Sc(e,t),e}(Lh),Cc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Rc(t){var e=!1;if(t.type==ot||t.type==at){var r=t.originalEvent.charCode;if(this.condition_(t)&&(r=="+".charCodeAt(0)||r=="-".charCodeAt(0))){var n=t.map,i=r=="+".charCodeAt(0)?this.delta_:-this.delta_;Ih(n.getView(),i,void 0,this.duration_),t.preventDefault(),e=!0}}return!e}var bc=function(t){function e(e){var r=t.call(this,{handleEvent:Rc})||this,n=e||{};return r.condition_=n.condition?n.condition:Kh,r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:100,r}return Cc(e,t),e}(Lh),Pc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Oc="trackpad",Ic="wheel",Lc=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).totalDelta_=0,r.lastDelta_=0,r.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,r.duration_=void 0!==n.duration?n.duration:250,r.timeout_=void 0!==n.timeout?n.timeout:80,r.useAnchor_=void 0===n.useAnchor||n.useAnchor,r.condition_=n.condition?n.condition:Dh,r.lastAnchor_=null,r.startTime_=void 0,r.timeoutId_,r.mode_=void 0,r.trackpadEventGap_=400,r.trackpadTimeoutId_,r.deltaPerZoom_=300,r}return Pc(e,t),e.prototype.conditionInternal_=function(t){var e=!0;return t.map.getTargetElement().hasAttribute("tabindex")&&(e=jh(t)),e&&this.condition_(t)},e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.conditionInternal_(t))return!0;if(t.type!==ht)return!0;t.preventDefault();var e,r=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==ht&&(e=n.deltaY,Xi&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Zi),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var i=Date.now();void 0===this.startTime_&&(this.startTime_=i),(!this.mode_||i-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?Oc:Ic);var o=r.getView();if(this.mode_===Oc&&!o.getConstrainResolution())return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=i,!1;this.totalDelta_+=e;var a=Math.max(this.timeout_-(i-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,r),a),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var r=-Ge(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;e.getConstrainResolution()&&(r=r?r>0?1:-1:0),Ih(e,r,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(Lh),Fc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mc=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=X),(r=t.call(this,i)||this).anchor_=null,r.lastAngle_=void 0,r.rotating_=!1,r.rotationDelta_=0,r.threshold_=void 0!==n.threshold?n.threshold:.3,r.duration_=void 0!==n.duration?n.duration:250,r}return Fc(e,t),e.prototype.handleDragEvent=function(t){var e=0,r=this.targetPointers[0],n=this.targetPointers[1],i=Math.atan2(n.clientY-r.clientY,n.clientX-r.clientX);if(void 0!==this.lastAngle_){var o=i-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=i;var a=t.map,s=a.getView();if(s.getConstraints().rotation!==rl){var u=a.getViewport().getBoundingClientRect(),l=tc(this.targetPointers);l[0]-=u.left,l[1]-=u.top,this.anchor_=a.getCoordinateFromPixelInternal(l),this.rotating_&&(a.render(),s.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(ec),Ac=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Nc=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=X),(r=t.call(this,i)||this).anchor_=null,r.duration_=void 0!==n.duration?n.duration:400,r.lastDistance_=void 0,r.lastScaleDelta_=1,r}return Ac(e,t),e.prototype.handleDragEvent=function(t){var e=1,r=this.targetPointers[0],n=this.targetPointers[1],i=r.clientX-n.clientX,o=r.clientY-n.clientY,a=Math.sqrt(i*i+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/a),this.lastDistance_=a;var s=t.map,u=s.getView();1!=e&&(this.lastScaleDelta_=e);var l=s.getViewport().getBoundingClientRect(),h=tc(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=s.getCoordinateFromPixelInternal(h),s.render(),u.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(ec),Gc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jc="addfeatures",Dc=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.features=n,o.file=r,o.projection=i,o}return Gc(e,t),e}(K);function kc(t){for(var e=t.dataTransfer.files,r=0,n=e.length;r<n;++r){var i=e.item(r),o=new FileReader;o.addEventListener(st,this.handleResult_.bind(this,i)),o.readAsText(i)}}function Uc(t){t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}var zc=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{handleEvent:Y})||this).formatConstructors_=n.formatConstructors?n.formatConstructors:[],r.projection_=n.projection?Sr(n.projection):null,r.dropListenKeys_=null,r.source_=n.source||null,r.target=n.target?n.target:null,r}return Gc(e,t),e.prototype.handleResult_=function(t,e){var r=e.target.result,n=this.getMap(),i=this.projection_;i||(i=n.getView().getProjection());for(var o=this.formatConstructors_,a=[],s=0,u=o.length;s<u;++s){var l=new o[s];if((a=this.tryReadFeatures_(l,r,{featureProjection:i}))&&a.length>0)break}this.source_&&(this.source_.clear(),this.source_.addFeatures(a)),this.dispatchEvent(new Dc(jc,t,a,i))},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[M(e,it,kc,this),M(e,rt,Uc,this),M(e,nt,Uc,this),M(e,it,Uc,this)]}},e.prototype.setActive=function(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,r){try{return t.readFeatures(e,r)}catch(t){return null}},e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(N),this.dropListenKeys_=null)},e}(Lh),Bc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yc=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).condition_=n.condition?n.condition:Zh,r.lastAngle_=void 0,r.lastMagnitude_=void 0,r.lastScaleDelta_=0,r.duration_=void 0!==n.duration?n.duration:400,r}return Bc(e,t),e.prototype.handleDragEvent=function(t){if(qh(t)){var e=t.map,r=e.getSize(),n=t.pixel,i=n[0]-r[0]/2,o=r[1]/2-n[1],a=Math.atan2(o,i),s=Math.sqrt(i*i+o*o),u=e.getView();if(void 0!==this.lastAngle_){var l=this.lastAngle_-a;u.adjustRotationInternal(l)}this.lastAngle_=a,void 0!==this.lastMagnitude_&&u.adjustResolutionInternal(this.lastMagnitude_/s),void 0!==this.lastMagnitude_&&(this.lastScaleDelta_=this.lastMagnitude_/s),this.lastMagnitude_=s}},e.prototype.handleUpEvent=function(t){if(!qh(t))return!0;var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!qh(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(ec),Xc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vc=function(t){function e(e,r,n){var i=t.call(this)||this;if(void 0!==n&&void 0===r)i.setFlatCoordinates(n,e);else{var o=r||0;i.setCenterAndRadius(e,o,n)}return i}return Xc(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,r,n){var i=this.flatCoordinates,o=t-i[0],a=e-i[1],s=o*o+a*a;if(s<n){if(0===s)for(var u=0;u<this.stride;++u)r[u]=i[u];else{var l=this.getRadius()/Math.sqrt(s);r[0]=i[0]+l*o,r[1]=i[1]+l*a;for(u=2;u<this.stride;++u)r[u]=i[u]}return r.length=this.stride,s}return n},e.prototype.containsXY=function(t,e){var r=this.flatCoordinates,n=t-r[0],i=e-r[1];return n*n+i*i<=this.getRadiusSquared_()},e.prototype.getCenter=function(){return this.flatCoordinates.slice(0,this.stride)},e.prototype.computeExtent=function(t){var e=this.flatCoordinates,r=e[this.stride]-e[0];return Vt(e[0]-r,e[1]-r,e[0]+r,e[1]+r,t)},e.prototype.getRadius=function(){return Math.sqrt(this.getRadiusSquared_())},e.prototype.getRadiusSquared_=function(){var t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e},e.prototype.getType=function(){return Fe.CIRCLE},e.prototype.intersectsExtent=function(t){if(Ee(t,this.getExtent())){var e=this.getCenter();return t[0]<=e[0]&&t[2]>=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||oe(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,r=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+r;for(var i=1;i<e;++i)n[e+i]=t[i];this.setFlatCoordinates(this.layout,n),this.changed()},e.prototype.setCenterAndRadius=function(t,e,r){this.setLayout(r,t,0),this.flatCoordinates||(this.flatCoordinates=[]);var n=this.flatCoordinates,i=yn(n,0,t,this.stride);n[i++]=n[0]+e;for(var o=1,a=this.stride;o<a;++o)n[i++]=n[o];n.length=i,this.changed()},e.prototype.getCoordinates=function(){return null},e.prototype.setCoordinates=function(t,e){},e.prototype.setRadius=function(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()},e.prototype.rotate=function(t,e){var r=this.getCenter(),n=this.getStride();this.setCenter(Ae(r,0,r.length,n,t,e,r)),this.changed()},e.prototype.translate=function(t,e){var r=this.getCenter(),n=this.getStride();this.setCenter(Ne(r,0,r.length,n,t,e,r)),this.changed()},e}(ln);Vc.prototype.transform;var Wc=Vc,Zc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kc=function(t){function e(e,r,n){var i=t.call(this)||this;if(i.ends_=[],i.maxDelta_=-1,i.maxDeltaRevision_=-1,Array.isArray(e[0]))i.setCoordinates(e,r);else if(void 0!==r&&n)i.setFlatCoordinates(r,e),i.ends_=n;else{for(var o=i.getLayout(),a=e,s=[],u=[],l=0,h=a.length;l<h;++l){var c=a[l];0===l&&(o=c.getLayout()),z(s,c.getFlatCoordinates()),u.push(s.length)}i.setFlatCoordinates(o,s),i.ends_=u}return i}return Zc(e,t),e.prototype.appendLineString=function(t){this.flatCoordinates?z(this.flatCoordinates,t.getFlatCoordinates().slice()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice())},e.prototype.closestPointXY=function(t,e,r,n){return n<kt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(dn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),gn(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,r,n))},e.prototype.getCoordinateAtM=function(t,e,r){if(this.layout!=Ie&&this.layout!=Le||0===this.flatCoordinates.length)return null;var n=void 0!==e&&e,i=void 0!==r&&r;return function(t,e,r,n,i,o,a){if(a)return Gs(t,e,r[r.length-1],n,i,o);var s;if(i<t[n-1])return o?((s=t.slice(0,n))[n-1]=i,s):null;if(t[t.length-1]<i)return o?((s=t.slice(t.length-n))[n-1]=i,s):null;for(var u=0,l=r.length;u<l;++u){var h=r[u];if(e!=h){if(i<t[e+n-1])return null;if(i<=t[h-1])return Gs(t,e,h,n,i,!1);e=h}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,n,i)},e.prototype.getCoordinates=function(){return En(this.flatCoordinates,0,this.ends_,this.stride)},e.prototype.getEnds=function(){return this.ends_},e.prototype.getLineString=function(t){return t<0||this.ends_.length<=t?null:new Ds(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)},e.prototype.getLineStrings=function(){for(var t=this.flatCoordinates,e=this.ends_,r=this.layout,n=[],i=0,o=0,a=e.length;o<a;++o){var s=e[o],u=new Ds(t.slice(i,s),r);n.push(u),i=s}return n},e.prototype.getFlatMidpoints=function(){for(var t=[],e=this.flatCoordinates,r=0,n=this.ends_,i=this.stride,o=0,a=n.length;o<a;++o){var s=n[o];z(t,Ns(e,r,s,i,.5)),r=s}return t},e.prototype.getSimplifiedGeometryInternal=function(t){var r=[],n=[];return r.length=Tn(this.flatCoordinates,0,this.ends_,this.stride,t,r,0,n),new e(r,Pe,n)},e.prototype.getType=function(){return Fe.MULTI_LINE_STRING},e.prototype.intersectsExtent=function(t){return function(t,e,r,n,i){for(var o=0,a=r.length;o<a;++o){if(jn(t,e,r[o],n,i))return!0;e=r[o]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=mn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===r.length?0:r[r.length-1],this.changed()},e}(ln),qc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hc=function(t){function e(e,r){var n=t.call(this)||this;return r&&!Array.isArray(e[0])?n.setFlatCoordinates(r,e):n.setCoordinates(e,r),n}return qc(e,t),e.prototype.appendPoint=function(t){this.flatCoordinates?z(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.changed()},e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),this.layout)},e.prototype.closestPointXY=function(t,e,r,n){if(n<kt(this.getExtent(),t,e))return n;for(var i=this.flatCoordinates,o=this.stride,a=0,s=i.length;a<s;a+=o){var u=ke(t,e,i[a],i[a+1]);if(u<n){n=u;for(var l=0;l<o;++l)r[l]=i[a+l];r.length=o}}return n},e.prototype.getCoordinates=function(){return xn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},e.prototype.getPoint=function(t){var e=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return t<0||e<=t?null:new Ln(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)},e.prototype.getPoints=function(){for(var t=this.flatCoordinates,e=this.layout,r=this.stride,n=[],i=0,o=t.length;i<o;i+=r){var a=new Ln(t.slice(i,i+r),e);n.push(a)}return n},e.prototype.getType=function(){return Fe.MULTI_POINT},e.prototype.intersectsExtent=function(t){for(var e=this.flatCoordinates,r=this.stride,n=0,i=e.length;n<i;n+=r){if(Bt(t,e[n],e[n+1]))return!0}return!1},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vn(this.flatCoordinates,0,t,this.stride),this.changed()},e}(ln);var Jc=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qc=function(t){function e(e,r,n){var i=t.call(this)||this;if(i.endss_=[],i.flatInteriorPointsRevision_=-1,i.flatInteriorPoints_=null,i.maxDelta_=-1,i.maxDeltaRevision_=-1,i.orientedRevision_=-1,i.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){for(var o=i.getLayout(),a=e,s=[],u=[],l=0,h=a.length;l<h;++l){var c=a[l];0===l&&(o=c.getLayout());for(var p=s.length,f=c.getEnds(),d=0,_=f.length;d<_;++d)f[d]+=p;z(s,c.getFlatCoordinates()),u.push(f)}r=o,e=s,n=u}return void 0!==r&&n?(i.setFlatCoordinates(r,e),i.endss_=n):i.setCoordinates(e,r),i}return Jc(e,t),e.prototype.appendPolygon=function(t){var e;if(this.flatCoordinates){var r=this.flatCoordinates.length;z(this.flatCoordinates,t.getFlatCoordinates());for(var n=0,i=(e=t.getEnds().slice()).length;n<i;++n)e[n]+=r}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()},e.prototype.clone=function(){for(var t=this.endss_.length,r=new Array(t),n=0;n<t;++n)r[n]=this.endss_[n].slice();return new e(this.flatCoordinates.slice(),this.layout,r)},e.prototype.closestPointXY=function(t,e,r,n){return n<kt(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,r,n,i){for(var o=0,a=r.length;o<a;++o){var s=r[o];i=dn(t,e,s,n,i),e=s[s.length-1]}return i}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,r,n,i,o,a,s,u,l,h){for(var c=h||[NaN,NaN],p=0,f=r.length;p<f;++p){var d=r[p];l=gn(t,e,d,n,i,o,a,s,u,l,c),e=d[d.length-1]}return l}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,r,n))},e.prototype.containsXY=function(t,e){return function(t,e,r,n,i,o){if(0===r.length)return!1;for(var a=0,s=r.length;a<s;++a){var u=r[a];if(An(t,e,u,n,i,o))return!0;e=u[u.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)},e.prototype.getArea=function(){return function(t,e,r,n){for(var i=0,o=0,a=r.length;o<a;++o){var s=r[o];i+=cn(t,e,s,n),e=s[s.length-1]}return i}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},e.prototype.getCoordinates=function(t){var e;return void 0!==t?Yn(e=this.getOrientedFlatCoordinates().slice(),0,this.endss_,this.stride,t):e=this.flatCoordinates,Sn(e,0,this.endss_,this.stride)},e.prototype.getEndss=function(){return this.endss_},e.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var t=function(t,e,r,n){for(var i=[],o=[1/0,1/0,-1/0,-1/0],a=0,s=r.length;a<s;++a){var u=r[a];o=qt(t,e,u[0],n),i.push((o[0]+o[2])/2,(o[1]+o[3])/2),e=u[u.length-1]}return i}(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=function(t,e,r,n,i){for(var o=[],a=0,s=r.length;a<s;++a){var u=r[a];o=Nn(t,e,u,n,i,2*a,o),e=u[u.length-1]}return o}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},e.prototype.getInteriorPoints=function(){return new Hc(this.getFlatInteriorPoints().slice(),Ie)},e.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var t=this.flatCoordinates;!function(t,e,r,n,i){for(var o=0,a=r.length;o<a;++o){var s=r[o];if(!zn(t,e,s,n,i))return!1;s.length&&(e=s[s.length-1])}return!0}(t,0,this.endss_,this.stride)?(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Yn(this.orientedFlatCoordinates_,0,this.endss_,this.stride)):this.orientedFlatCoordinates_=t,this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},e.prototype.getSimplifiedGeometryInternal=function(t){var r=[],n=[];return r.length=function(t,e,r,n,i,o,a,s){for(var u=0,l=r.length;u<l;++u){var h=r[u],c=[];a=bn(t,e,h,n,i,o,a,c),s.push(c),e=h[h.length-1]}return a}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),r,0,n),new e(r,Pe,n)},e.prototype.getPolygon=function(t){if(t<0||this.endss_.length<=t)return null;var e;if(0===t)e=0;else{var r=this.endss_[t-1];e=r[r.length-1]}var n=this.endss_[t].slice(),i=n[n.length-1];if(0!==e)for(var o=0,a=n.length;o<a;++o)n[o]-=e;return new Wn(this.flatCoordinates.slice(e,i),this.layout,n)},e.prototype.getPolygons=function(){for(var t=this.layout,e=this.flatCoordinates,r=this.endss_,n=[],i=0,o=0,a=r.length;o<a;++o){var s=r[o].slice(),u=s[s.length-1];if(0!==i)for(var l=0,h=s.length;l<h;++l)s[l]-=i;var c=new Wn(e.slice(i,u),t,s);n.push(c),i=u}return n},e.prototype.getType=function(){return Fe.MULTI_POLYGON},e.prototype.intersectsExtent=function(t){return function(t,e,r,n,i){for(var o=0,a=r.length;o<a;++o){var s=r[o];if(Dn(t,e,s,n,i))return!0;e=s[s.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)},e.prototype.setCoordinates=function(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=function(t,e,r,n,i){for(var o=i||[],a=0,s=0,u=r.length;s<u;++s){var l=mn(t,e,r[s],n,o[a]);o[a++]=l,e=l[l.length-1]}return o.length=a,o}(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===r.length)this.flatCoordinates.length=0;else{var n=r[r.length-1];this.flatCoordinates.length=0===n.length?0:n[n.length-1]}this.changed()},e}(ln),$c=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tp="Point",ep="LineString",rp="Polygon",np="Circle",ip="drawstart",op="drawend",ap="drawabort",sp=function(t){function e(e,r){var n=t.call(this,e)||this;return n.feature=r,n}return $c(e,t),e}(K);var up=function(t){function e(e){var r=this,n=e;n.stopDown||(n.stopDown=X),(r=t.call(this,n)||this).shouldHandle_=!1,r.downPx_=null,r.downTimeout_,r.lastDragTime_,r.freehand_=!1,r.source_=e.source?e.source:null,r.features_=e.features?e.features:null,r.snapTolerance_=e.snapTolerance?e.snapTolerance:12,r.type_=e.type,r.mode_=function(t){var e;t===Fe.POINT||t===Fe.MULTI_POINT?e=tp:t===Fe.LINE_STRING||t===Fe.MULTI_LINE_STRING?e=ep:t===Fe.POLYGON||t===Fe.MULTI_POLYGON?e=rp:t===Fe.CIRCLE&&(e=np);return e}(r.type_),r.stopClick_=!!e.stopClick,r.minPoints_=e.minPoints?e.minPoints:r.mode_===rp?3:2,r.maxPoints_=e.maxPoints?e.maxPoints:1/0,r.finishCondition_=e.finishCondition?e.finishCondition:Y;var i,o=e.geometryFunction;if(!o)if(r.type_===Fe.CIRCLE)o=function(t,e,r){var n=e||new Wc([NaN,NaN]),i=Xr(t[0],r),o=ia(i,Xr(t[1],r));n.setCenterAndRadius(i,Math.sqrt(o));var a=zr();return a&&n.transform(r,a),n};else{var a,s=r.mode_;s===tp?a=Ln:s===ep?a=Ds:s===rp&&(a=Wn),o=function(t,e,r){var n=e;return n?s===rp?t[0].length?n.setCoordinates([t[0].concat([t[0][0]])]):n.setCoordinates([]):n.setCoordinates(t):n=new a(t),n}}return r.geometryFunction_=o,r.dragVertexDelay_=void 0!==e.dragVertexDelay?e.dragVertexDelay:500,r.finishCoordinate_=null,r.sketchFeature_=null,r.sketchPoint_=null,r.sketchCoords_=null,r.sketchLine_=null,r.sketchLineCoords_=null,r.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,r.overlay_=new Ms({source:new ou({useSpatialIndex:!1,wrapX:!!e.wrapX&&e.wrapX}),style:e.style?e.style:(i=ko(),function(t,e){return i[t.getGeometry().getType()]}),updateWhileInteracting:!0}),r.geometryName_=e.geometryName,r.condition_=e.condition?e.condition:Vh,r.freehandCondition_,e.freehand?r.freehandCondition_=Dh:r.freehandCondition_=e.freehandCondition?e.freehandCondition:Zh,r.addEventListener(yt(Ph),r.updateState_),r}return $c(e,t),e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),this.updateState_()},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleEvent=function(e){e.originalEvent.type===$&&e.preventDefault(),this.freehand_=this.mode_!==tp&&this.freehandCondition_(e);var r=e.type===Fu.POINTERMOVE,n=!0;!this.freehand_&&this.lastDragTime_&&e.type===Fu.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,r=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===Fu.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===Fu.POINTERDOWN?n=!1:r?(n=e.type===Fu.POINTERMOVE)&&this.freehand_?n=this.handlePointerMove_(e):("mouse"==e.pointerEvent.pointerType||e.type===Fu.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Fu.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Au(Fu.POINTERMOVE,t.map,t.pointerEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var r=this.mode_===np;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||r?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate):(this.startDrawing_(t),this.mode_===tp&&this.finishDrawing()),e=!1):this.freehand_&&this.abortDrawing(),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,r=t.pixel,n=e[0]-r[0],i=e[1]-r[1],o=n*n+i*i;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return!0}return this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t),!0},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var r=!1,n=[this.finishCoordinate_];if(this.mode_===ep)r=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===rp){var i=this.sketchCoords_;r=i[0].length>this.minPoints_,n=[i[0][0],i[0][i[0].length-2]]}if(r)for(var o=t.map,a=0,s=n.length;a<s;a++){var u=n[a],l=o.getPixelFromCoordinate(u),h=t.pixel,c=h[0]-l[0],p=h[1]-l[1],f=this.freehand_?1:this.snapTolerance_;if(e=Math.sqrt(c*c+p*p)<=f){this.finishCoordinate_=u;break}}}return e},e.prototype.createOrUpdateSketchPoint_=function(t){var e=t.coordinate.slice();this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Ct(new Ln(e)),this.updateSketchFeatures_())},e.prototype.startDrawing_=function(t){var e=t.coordinate,r=t.map.getView().getProjection();this.finishCoordinate_=e,this.mode_===tp?this.sketchCoords_=e.slice():this.mode_===rp?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Ct(new Ds(this.sketchLineCoords_)));var n=this.geometryFunction_(this.sketchCoords_,void 0,r);this.sketchFeature_=new Ct,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new sp(ip,this.sketchFeature_))},e.prototype.modifyDrawing_=function(t){var e,r,n,i=t.coordinate,o=this.sketchFeature_.getGeometry(),a=t.map.getView().getProjection();(this.mode_===tp?r=this.sketchCoords_:this.mode_===rp?(r=(e=this.sketchCoords_[0])[e.length-1],this.atFinish_(t)&&(i=this.finishCoordinate_.slice())):r=(e=this.sketchCoords_)[e.length-1],r[0]=i[0],r[1]=i[1],this.geometryFunction_(this.sketchCoords_,o,a),this.sketchPoint_)&&this.sketchPoint_.getGeometry().setCoordinates(i);if(o.getType()==Fe.POLYGON&&this.mode_!==rp){this.sketchLine_||(this.sketchLine_=new Ct);var s=o.getLinearRing(0);(n=this.sketchLine_.getGeometry())?(n.setFlatCoordinates(s.getLayout(),s.getFlatCoordinates()),n.changed()):(n=new Ds(s.getFlatCoordinates(),s.getLayout()),this.sketchLine_.setGeometry(n))}else this.sketchLineCoords_&&(n=this.sketchLine_.getGeometry()).setCoordinates(this.sketchLineCoords_);this.updateSketchFeatures_()},e.prototype.addToDrawing_=function(t){var e,r,n=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();this.mode_===ep?(this.finishCoordinate_=t.slice(),(r=this.sketchCoords_).length>=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),this.geometryFunction_(r,n,i)):this.mode_===rp&&((r=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),e&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,n,i)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();this.mode_===ep?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e,r),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===rp&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,r)),0===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,r=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===ep?(e.pop(),this.geometryFunction_(e,r,n)):this.mode_===rp&&(e[0].pop(),this.geometryFunction_(e,r,n),e=r.getCoordinates()),this.type_===Fe.MULTI_POINT?t.setGeometry(new Hc([e])):this.type_===Fe.MULTI_LINE_STRING?t.setGeometry(new Kc([e])):this.type_===Fe.MULTI_POLYGON&&t.setGeometry(new Qc([e])),this.dispatchEvent(new sp(op,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new sp(ap,t))},e.prototype.appendCoordinates=function(t){var e=this.mode_,r=[];e===ep?r=this.sketchCoords_:e===rp&&(r=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]);for(var n=r.pop(),i=0;i<t.length;i++)this.addToDrawing_(t[i]);this.addToDrawing_(n)},e.prototype.extend=function(t){var e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();var r=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=r.slice(),this.sketchCoords_.push(r.slice()),this.updateSketchFeatures_(),this.dispatchEvent(new sp(ip,this.sketchFeature_))},e.prototype.updateSketchFeatures_=function(){var t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);var e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)},e.prototype.updateState_=function(){var t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing(),this.overlay_.setMap(e?t:null)},e}(ec),lp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),hp="extentchanged",cp=function(t){function e(e){var r=t.call(this,hp)||this;return r.extent=e,r}return lp(e,t),e}(K);function pp(){var t=ko();return function(e,r){return t[Fe.POINT]}}function fp(t){return function(e){return Gt([t,e])}}function dp(t,e){return t[0]==e[0]?function(r){return Gt([t,[r[0],e[1]]])}:t[1]==e[1]?function(r){return Gt([t,[e[0],r[1]]])}:null}var _p=function(t){function e(e){var r,n=this,i=e||{};return(n=t.call(this,i)||this).extent_=null,n.pointerHandler_=null,n.pixelTolerance_=void 0!==i.pixelTolerance?i.pixelTolerance:10,n.snappedToVertex_=!1,n.extentFeature_=null,n.vertexFeature_=null,e||(e={}),n.extentOverlay_=new Ms({source:new ou({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.boxStyle?e.boxStyle:(r=ko(),function(t,e){return r[Fe.POLYGON]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),n.vertexOverlay_=new Ms({source:new ou({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.pointerStyle?e.pointerStyle:pp(),updateWhileAnimating:!0,updateWhileInteracting:!0}),e.extent&&n.setExtent(e.extent),n}return lp(e,t),e.prototype.snapToVertex_=function(t,e){var r=e.getCoordinateFromPixelInternal(t),n=this.getExtentInternal();if(n){var i=function(t){return[[[t[0],t[1]],[t[0],t[3]]],[[t[0],t[3]],[t[2],t[3]]],[[t[2],t[3]],[t[2],t[1]]],[[t[2],t[1]],[t[0],t[1]]]]}(n);i.sort((function(t,e){return aa(r,t)-aa(r,e)}));var o=i[0],a=Jo(r,o),s=e.getPixelFromCoordinateInternal(a);if(oa(t,s)<=this.pixelTolerance_){var u=e.getPixelFromCoordinateInternal(o[0]),l=e.getPixelFromCoordinateInternal(o[1]),h=ia(s,u),c=ia(s,l),p=Math.sqrt(Math.min(h,c));return this.snappedToVertex_=p<=this.pixelTolerance_,this.snappedToVertex_&&(a=h>c?o[1]:o[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,r=t.map,n=this.snapToVertex_(e,r);n||(n=r.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(n)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(Kn(t)):e.setGeometry(void 0):(e=new Ct(t?Kn(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new Ct(new Ln(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.pointerEvent||(e.type!=Fu.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,r=t.map,n=this.getExtentInternal(),i=this.snapToVertex_(e,r),o=function(t){var e=null,r=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?r=n[3]:t[1]==n[3]&&(r=n[1]),null!==e&&null!==r?[e,r]:null};if(i&&n){var a=i[0]==n[0]||i[0]==n[2]?i[0]:null,s=i[1]==n[1]||i[1]==n[3]?i[1]:null;null!==a&&null!==s?this.pointerHandler_=fp(o(i)):null!==a?this.pointerHandler_=dp(o([a,n[1]]),o([a,n[3]])):null!==s&&(this.pointerHandler_=dp(o([n[0],s]),o([n[2],s])))}else i=r.getCoordinateFromPixelInternal(e),this.setExtent([i[0],i[1],i[0],i[1]]),this.pointerHandler_=fp(i);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}return!0},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtentInternal();return e&&0!==ae(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return Vr(this.getExtentInternal(),this.getMap().getView().getProjection())},e.prototype.getExtentInternal=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new cp(this.extent_))},e}(ec),gp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yp=[0,0,0,0],vp=[],mp="modifystart",xp="modifyend",Ep=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.features=r,i.mapBrowserEvent=n,i}return gp(e,t),e}(K);function Sp(t,e){return t.index-e.index}function wp(t,e,r){var n=e.geometry;if(n.getType()===Fe.CIRCLE){var i=n;if(1===e.index){var o=zr();o&&(i=i.clone().transform(o,r));var a=ia(i.getCenter(),Xr(t,r)),s=Math.sqrt(a)-i.getRadius();return s*s}}var u=Xr(t,r);return vp[0]=Xr(e.segment[0],r),vp[1]=Xr(e.segment[1],r),aa(u,vp)}function Tp(t,e,r){var n=e.geometry;if(n.getType()===Fe.CIRCLE&&1===e.index){var i=n,o=zr();return o&&(i=i.clone().transform(o,r)),Yr(i.getClosestPoint(Xr(t,r)),r)}var a=Xr(t,r);return vp[0]=Xr(e.segment[0],r),vp[1]=Xr(e.segment[1],r),Yr(Jo(a,vp),r)}var Cp=function(t){function e(e){var r,n,i=t.call(this,e)||this;if(i.boundHandleFeatureChange_=i.handleFeatureChange_.bind(i),i.condition_=e.condition?e.condition:Qh,i.defaultDeleteCondition_=function(t){return Nh(t)&&Yh(t)},i.deleteCondition_=e.deleteCondition?e.deleteCondition:i.defaultDeleteCondition_,i.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Dh,i.vertexFeature_=null,i.vertexSegments_=null,i.lastPixel_=[0,0],i.ignoreNextSingleClick_=!1,i.modified_=!1,i.rBush_=new ru,i.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,i.snappedToVertex_=!1,i.changingFeature_=!1,i.dragSegments_=[],i.overlay_=new Ms({source:new ou({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:(r=ko(),function(t,e){return r[Fe.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),i.SEGMENT_WRITERS_={Point:i.writePointGeometry_.bind(i),LineString:i.writeLineStringGeometry_.bind(i),LinearRing:i.writeLineStringGeometry_.bind(i),Polygon:i.writePolygonGeometry_.bind(i),MultiPoint:i.writeMultiPointGeometry_.bind(i),MultiLineString:i.writeMultiLineStringGeometry_.bind(i),MultiPolygon:i.writeMultiPolygonGeometry_.bind(i),Circle:i.writeCircleGeometry_.bind(i),GeometryCollection:i.writeGeometryCollectionGeometry_.bind(i)},i.source_=null,e.source?(i.source_=e.source,n=new St(i.source_.getFeatures()),i.source_.addEventListener(Qs,i.handleSourceAdd_.bind(i)),i.source_.addEventListener(eu,i.handleSourceRemove_.bind(i))):n=e.features,!n)throw new Error("The modify interaction requires features or a source");return i.features_=n,i.features_.forEach(i.addFeature_.bind(i)),i.features_.addEventListener(R,i.handleFeatureAdd_.bind(i)),i.features_.addEventListener(b,i.handleFeatureRemove_.bind(i)),i.lastPointerEvent_=null,i}return gp(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var r=this.SEGMENT_WRITERS_[e.getType()];r&&r(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(J,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new Ep(mp,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(J,this.boundHandleFeatureChange_)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,r=[];e.forEach((function(e){t===e.feature&&r.push(e)}));for(var n=r.length-1;n>=0;--n){for(var i=r[n],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===i&&this.dragSegments_.splice(o,1);e.remove(i)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var r=e.getCoordinates(),n={feature:t,geometry:e,segment:[r,r]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n<i;++n){var o=r[n],a={feature:t,geometry:e,depth:[n],index:n,segment:[o,o]};this.rBush_.insert(e.getExtent(),a)}},e.prototype.writeLineStringGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length-1;n<i;++n){var o=r.slice(n,n+2),a={feature:t,geometry:e,index:n,segment:o};this.rBush_.insert(Gt(o),a)}},e.prototype.writeMultiLineStringGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n<i;++n)for(var o=r[n],a=0,s=o.length-1;a<s;++a){var u=o.slice(a,a+2),l={feature:t,geometry:e,depth:[n],index:a,segment:u};this.rBush_.insert(Gt(u),l)}},e.prototype.writePolygonGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n<i;++n)for(var o=r[n],a=0,s=o.length-1;a<s;++a){var u=o.slice(a,a+2),l={feature:t,geometry:e,depth:[n],index:a,segment:u};this.rBush_.insert(Gt(u),l)}},e.prototype.writeMultiPolygonGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n<i;++n)for(var o=r[n],a=0,s=o.length;a<s;++a)for(var u=o[a],l=0,h=u.length-1;l<h;++l){var c=u.slice(l,l+2),p={feature:t,geometry:e,depth:[a,n],index:l,segment:c};this.rBush_.insert(Gt(c),p)}},e.prototype.writeCircleGeometry_=function(t,e){var r=e.getCenter(),n={feature:t,geometry:e,index:0,segment:[r,r]},i={feature:t,geometry:e,index:1,segment:[r,r]},o=[n,i];n.featureSegments=o,i.featureSegments=o,this.rBush_.insert(Zt(r),n);var a=e,s=zr();if(s&&this.getMap()){var u=this.getMap().getView().getProjection();a=qn(a=a.clone().transform(s,u)).transform(u,s)}this.rBush_.insert(a.getExtent(),i)},e.prototype.writeGeometryCollectionGeometry_=function(t,e){for(var r=e.getGeometriesArray(),n=0;n<r.length;++n){var i=r[n];(0,this.SEGMENT_WRITERS_[i.getType()])(t,i)}},e.prototype.createOrUpdateVertexFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new Ct(new Ln(t)),this.vertexFeature_=e,this.overlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.pointerEvent||(this.lastPointerEvent_=e,e.map.getView().getInteracting()||e.type!=Fu.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(r=!(e.type!=Fu.SINGLECLICK||!this.ignoreNextSingleClick_)||this.removePoint()),e.type==Fu.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),t.prototype.handleEvent.call(this,e)&&!r);var r},e.prototype.handleDragEvent=function(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t);for(var e=t.coordinate,r=0,n=this.dragSegments_.length;r<n;++r){for(var i=this.dragSegments_[r],o=i[0],a=o.depth,s=o.geometry,u=void 0,l=o.segment,h=i[1];e.length<s.getStride();)e.push(l[h][e.length]);switch(s.getType()){case Fe.POINT:u=e,l[0]=e,l[1]=e;break;case Fe.MULTI_POINT:(u=s.getCoordinates())[o.index]=e,l[0]=e,l[1]=e;break;case Fe.LINE_STRING:(u=s.getCoordinates())[o.index+h]=e,l[h]=e;break;case Fe.MULTI_LINE_STRING:case Fe.POLYGON:(u=s.getCoordinates())[a[0]][o.index+h]=e,l[h]=e;break;case Fe.MULTI_POLYGON:(u=s.getCoordinates())[a[1]][a[0]][o.index+h]=e,l[h]=e;break;case Fe.CIRCLE:if(l[0]=e,l[1]=e,0===o.index)this.changingFeature_=!0,s.setCenter(e),this.changingFeature_=!1;else{this.changingFeature_=!0;var c=t.map.getView().getProjection(),p=oa(Xr(s.getCenter(),c),Xr(e,c)),f=zr();if(f){var d=s.clone().transform(f,c);d.setRadius(p),p=d.transform(c,f).getRadius()}s.setRadius(p),this.changingFeature_=!1}}u&&this.setGeometryCoordinates_(s,u)}this.createOrUpdateVertexFeature_(e)},e.prototype.handleDownEvent=function(t){if(!this.condition_(t))return!1;var e=t.coordinate;this.handlePointerAtPixel_(t.pixel,t.map,e),this.dragSegments_.length=0,this.modified_=!1;var r=this.vertexFeature_;if(r){var n=t.map.getView().getProjection(),i=[],o=r.getGeometry().getCoordinates(),a=Gt([o]),s=this.rBush_.getInExtent(a),u={};s.sort(Sp);for(var l=0,h=s.length;l<h;++l){var c=s[l],p=c.segment,f=S(c.feature),d=c.depth;if(d&&(f+="-"+d.join("-")),u[f]||(u[f]=new Array(2)),c.geometry.getType()!==Fe.CIRCLE||1!==c.index)if(!ea(p[0],o)||u[f][0])if(!ea(p[1],o)||u[f][1])S(p)in this.vertexSegments_&&!u[f][0]&&!u[f][1]&&this.insertVertexCondition_(t)&&i.push([c,o]);else{if((c.geometry.getType()===Fe.LINE_STRING||c.geometry.getType()===Fe.MULTI_LINE_STRING)&&u[f][0]&&0===u[f][0].index)continue;this.dragSegments_.push([c,1]),u[f][1]=c}else this.dragSegments_.push([c,0]),u[f][0]=c;else ea(Tp(e,c,n),o)&&!u[f][0]&&(this.dragSegments_.push([c,0]),u[f][0]=c)}i.length&&this.willModifyFeatures_(t);for(var _=i.length-1;_>=0;--_)this.insertVertex_.apply(this,i[_])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var r=this.dragSegments_[e][0],n=r.geometry;if(n.getType()===Fe.CIRCLE){var i=n.getCenter(),o=r.featureSegments[0],a=r.featureSegments[1];o.segment[0]=i,o.segment[1]=i,a.segment[0]=i,a.segment[1]=i,this.rBush_.update(Zt(i),o);var s=n,u=zr();if(u){var l=t.map.getView().getProjection();s=qn(s=s.clone().transform(u,l)).transform(l,u)}this.rBush_.update(s.getExtent(),a)}else this.rBush_.update(Gt(r.segment),r)}return this.modified_&&(this.dispatchEvent(new Ep(xp,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,r){var n=r||e.getCoordinateFromPixel(t),i=e.getView().getProjection(),o=Vr(jt(Wr(Zt(n,yp),i),e.getView().getResolution()*this.pixelTolerance_,yp),i),a=this.rBush_.getInExtent(o);if(a.length>0){a.sort((function(t,e){return wp(n,t,i)-wp(n,e,i)}));var s=a[0],u=s.segment,l=Tp(n,s,i),h=e.getPixelFromCoordinate(l),c=oa(t,h);if(c<=this.pixelTolerance_){var p={};if(s.geometry.getType()===Fe.CIRCLE&&1===s.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(l);else{var f=e.getPixelFromCoordinate(u[0]),d=e.getPixelFromCoordinate(u[1]),_=ia(h,f),g=ia(h,d);c=Math.sqrt(Math.min(_,g)),this.snappedToVertex_=c<=this.pixelTolerance_,this.snappedToVertex_&&(l=_>g?u[1]:u[0]),this.createOrUpdateVertexFeature_(l);for(var y=1,v=a.length;y<v;++y){var m=a[y].segment;if(!(ea(u[0],m[0])&&ea(u[1],m[1])||ea(u[0],m[1])&&ea(u[1],m[0])))break;p[S(m)]=!0}}return p[S(u)]=!0,void(this.vertexSegments_=p)}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},e.prototype.insertVertex_=function(t,e){for(var r,n=t.segment,i=t.feature,o=t.geometry,a=t.depth,s=t.index;e.length<o.getStride();)e.push(0);switch(o.getType()){case Fe.MULTI_LINE_STRING:case Fe.POLYGON:(r=o.getCoordinates())[a[0]].splice(s+1,0,e);break;case Fe.MULTI_POLYGON:(r=o.getCoordinates())[a[1]][a[0]].splice(s+1,0,e);break;case Fe.LINE_STRING:(r=o.getCoordinates()).splice(s+1,0,e);break;default:return}this.setGeometryCoordinates_(o,r);var u=this.rBush_;u.remove(t),this.updateSegmentIndices_(o,s,a,1);var l={segment:[n[0],e],feature:i,geometry:o,depth:a,index:s};u.insert(Gt(l.segment),l),this.dragSegments_.push([l,1]);var h={segment:[e,n[1]],feature:i,geometry:o,depth:a,index:s+1};u.insert(Gt(h.segment),h),this.dragSegments_.push([h,0]),this.ignoreNextSingleClick_=!0},e.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Fu.POINTERDRAG){var t=this.lastPointerEvent_;this.willModifyFeatures_(t);var e=this.removeVertex_();return this.dispatchEvent(new Ep(xp,this.features_,t)),this.modified_=!1,e}return!1},e.prototype.removeVertex_=function(){var t,e,r,n,i,o,a,s,u,l,h,c=this.dragSegments_,p={},f=!1;for(i=c.length-1;i>=0;--i)h=S((l=(r=c[i])[0]).feature),l.depth&&(h+="-"+l.depth.join("-")),h in p||(p[h]={}),0===r[1]?(p[h].right=l,p[h].index=l.index):1==r[1]&&(p[h].left=l,p[h].index=l.index+1);for(h in p){switch(u=p[h].right,a=p[h].left,(s=(o=p[h].index)-1)<0&&(s=0),t=e=(n=(l=void 0!==a?a:u).geometry).getCoordinates(),f=!1,n.getType()){case Fe.MULTI_LINE_STRING:e[l.depth[0]].length>2&&(e[l.depth[0]].splice(o,1),f=!0);break;case Fe.LINE_STRING:e.length>2&&(e.splice(o,1),f=!0);break;case Fe.MULTI_POLYGON:t=t[l.depth[1]];case Fe.POLYGON:(t=t[l.depth[0]]).length>4&&(o==t.length-1&&(o=0),t.splice(o,1),f=!0,0===o&&(t.pop(),t.push(t[0]),s=t.length-1))}if(f){this.setGeometryCoordinates_(n,e);var d=[];if(void 0!==a&&(this.rBush_.remove(a),d.push(a.segment[0])),void 0!==u&&(this.rBush_.remove(u),d.push(u.segment[1])),void 0!==a&&void 0!==u){var _={depth:l.depth,feature:l.feature,geometry:l.geometry,index:s,segment:d};this.rBush_.insert(Gt(_.segment),_)}this.updateSegmentIndices_(n,o,l.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),c.length=0}}return f},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,r,n){this.rBush_.forEachInExtent(t.getExtent(),(function(i){i.geometry===t&&(void 0===r||void 0===i.depth||B(i.depth,r))&&i.index>e&&(i.index+=n)}))},e}(ec),Rp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bp="select",Pp=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.selected=r,o.deselected=n,o.mapBrowserEvent=i,o}return Rp(e,t),e}(K),Op={};function Ip(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),r=this.removeCondition_(t),n=this.toggleCondition_(t),i=!e&&!r&&!n,o=t.map,a=this.getFeatures(),s=[],u=[];if(i){I(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return u.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var l=a.getLength()-1;l>=0;--l){var h=a.item(l),c=u.indexOf(h);c>-1?u.splice(c,1):(a.remove(h),s.push(h))}0!==u.length&&a.extend(u)}else{o.forEachFeatureAtPixel(t.pixel,function(t,i){if(this.filter_(t,i))return!e&&!n||D(a.getArray(),t)?(r||n)&&D(a.getArray(),t)&&(s.push(t),this.removeFeatureLayerAssociation_(t)):(u.push(t),this.addFeatureLayerAssociation_(t,i)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var p=s.length-1;p>=0;--p)a.remove(s[p]);a.extend(u)}return(u.length>0||s.length>0)&&this.dispatchEvent(new Pp(bp,u,s,t)),!0}var Lp=function(t){function e(e){var r,n,i=t.call(this,{handleEvent:Ip})||this,o=e||{};if(i.boundAddFeature_=i.addFeature_.bind(i),i.boundRemoveFeature_=i.removeFeature_.bind(i),i.condition_=o.condition?o.condition:Yh,i.addCondition_=o.addCondition?o.addCondition:zh,i.removeCondition_=o.removeCondition?o.removeCondition:zh,i.toggleCondition_=o.toggleCondition?o.toggleCondition:Zh,i.multi_=!!o.multi&&o.multi,i.filter_=o.filter?o.filter:Y,i.hitTolerance_=o.hitTolerance?o.hitTolerance:0,i.style_=void 0!==o.style?o.style:(z((r=ko())[Fe.POLYGON],r[Fe.LINE_STRING]),z(r[Fe.GEOMETRY_COLLECTION],r[Fe.LINE_STRING]),function(t){return t.getGeometry()?r[t.getGeometry().getType()]:null}),i.features_=o.features||new St,o.layers)if("function"==typeof o.layers)n=o.layers;else{var a=o.layers;n=function(t){return D(a,t)}}else n=Y;return i.layerFilter_=n,i.featureLayerAssociation_={},i}return Rp(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[S(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[S(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),t.prototype.setMap.call(this,e),e?(this.features_.addEventListener(R,this.boundAddFeature_),this.features_.addEventListener(b,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(R,this.boundAddFeature_),this.features_.removeEventListener(b,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.applySelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.restorePreviousStyle_(e)},e.prototype.getStyle=function(){return this.style_},e.prototype.applySelectedStyle_=function(t){var e=S(t);e in Op||(Op[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){var r=S(t),n=this.getMap().getInteractions().getArray().filter((function(r){return r instanceof e&&r.getStyle()&&-1!==r.getFeatures().getArray().indexOf(t)}));n.length>0?t.setStyle(n[n.length-1].getStyle()):(t.setStyle(Op[r]),delete Op[r])},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[S(t)]},e}(Lh),Fp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Mp(t){return t.feature?t.feature:t.element?t.element:void 0}var Ap=[],Np=function(t){function e(e){var r=this,n=e||{},i=n;return i.handleDownEvent||(i.handleDownEvent=Y),i.stopDown||(i.stopDown=X),(r=t.call(this,i)||this).source_=n.source?n.source:null,r.vertex_=void 0===n.vertex||n.vertex,r.edge_=void 0===n.edge||n.edge,r.features_=n.features?n.features:null,r.featuresListenerKeys_=[],r.featureChangeListenerKeys_={},r.indexedFeaturesExtents_={},r.pendingFeatures_={},r.pixelTolerance_=void 0!==n.pixelTolerance?n.pixelTolerance:10,r.rBush_=new ru,r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r)},r}return Fp(e,t),e.prototype.addFeature=function(t,e){var r=void 0===e||e,n=S(t),i=t.getGeometry();if(i){var o=this.SEGMENT_WRITERS_[i.getType()];o&&(this.indexedFeaturesExtents_[n]=i.getExtent([1/0,1/0,-1/0,-1/0]),o(t,i))}r&&(this.featureChangeListenerKeys_[n]=M(t,J,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var r=this.snapTo(e.pixel,e.coordinate,e.map);return r.snapped&&(e.coordinate=r.vertex.slice(0,2),e.pixel=r.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=Mp(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=Mp(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var r=S(e);r in this.pendingFeatures_||(this.pendingFeatures_[r]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=L(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var r=void 0===e||e,n=S(t),i=this.indexedFeaturesExtents_[n];if(i){var o=this.rBush_,a=[];o.forEachInExtent(i,(function(e){t===e.feature&&a.push(e)}));for(var s=a.length-1;s>=0;--s)o.remove(a[s])}r&&(N(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])},e.prototype.setMap=function(e){var r=this.getMap(),n=this.featuresListenerKeys_,i=this.getFeatures_();r&&(n.forEach(N),n.length=0,i.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(M(this.features_,R,this.handleFeatureAdd_,this),M(this.features_,b,this.handleFeatureRemove_,this)):this.source_&&n.push(M(this.source_,Qs,this.handleFeatureAdd_,this),M(this.source_,eu,this.handleFeatureRemove_,this)),i.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,r){var n=Gt([r.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),r.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),i=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(i=i.filter((function(t){return t.feature.getGeometry().getType()!==Fe.CIRCLE})));var o=!1,a=null,s=null;if(0===i.length)return{snapped:o,vertex:a,vertexPixel:s};for(var u,l=r.getView().getProjection(),h=Xr(e,l),c=1/0,p=0;p<i.length;++p){var f=i[p];Ap[0]=Xr(f.segment[0],l),Ap[1]=Xr(f.segment[1],l);var d=aa(h,Ap);d<c&&(u=f,c=d)}var _=u.segment;if(this.vertex_&&!this.edge_){var g=r.getPixelFromCoordinate(_[0]),y=r.getPixelFromCoordinate(_[1]),v=ia(t,g),m=ia(t,y);Math.sqrt(Math.min(v,m))<=this.pixelTolerance_&&(o=!0,a=v>m?_[1]:_[0],s=r.getPixelFromCoordinate(a))}else if(this.edge_){var x=u.feature.getGeometry().getType()===Fe.CIRCLE;if(x){var E=u.feature.getGeometry(),S=zr();S&&(E=E.clone().transform(S,l)),a=Yr(Ho(h,E),l)}else Ap[0]=Xr(_[0],l),Ap[1]=Xr(_[1],l),a=Yr(Jo(h,Ap),l);if(oa(t,s=r.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!x)){g=r.getPixelFromCoordinate(_[0]),y=r.getPixelFromCoordinate(_[1]),v=ia(s,g),m=ia(s,y);Math.sqrt(Math.min(v,m))<=this.pixelTolerance_&&(a=v>m?_[1]:_[0],s=r.getPixelFromCoordinate(a))}}return o&&(s=[Math.round(s[0]),Math.round(s[1])]),{snapped:o,vertex:a,vertexPixel:s}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){var r=this.getMap().getView().getProjection(),n=e,i=zr();i&&(n=n.clone().transform(i,r));var o=qn(n);i&&o.transform(r,i);for(var a=o.getCoordinates()[0],s=0,u=a.length-1;s<u;++s){var l=a.slice(s,s+2),h={feature:t,segment:l};this.rBush_.insert(Gt(l),h)}},e.prototype.writeGeometryCollectionGeometry_=function(t,e){for(var r=e.getGeometriesArray(),n=0;n<r.length;++n){var i=this.SEGMENT_WRITERS_[r[n].getType()];i&&i(t,r[n])}},e.prototype.writeLineStringGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length-1;n<i;++n){var o=r.slice(n,n+2),a={feature:t,segment:o};this.rBush_.insert(Gt(o),a)}},e.prototype.writeMultiLineStringGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n<i;++n)for(var o=r[n],a=0,s=o.length-1;a<s;++a){var u=o.slice(a,a+2),l={feature:t,segment:u};this.rBush_.insert(Gt(u),l)}},e.prototype.writeMultiPointGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n<i;++n){var o=r[n],a={feature:t,segment:[o,o]};this.rBush_.insert(e.getExtent(),a)}},e.prototype.writeMultiPolygonGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n<i;++n)for(var o=r[n],a=0,s=o.length;a<s;++a)for(var u=o[a],l=0,h=u.length-1;l<h;++l){var c=u.slice(l,l+2),p={feature:t,segment:c};this.rBush_.insert(Gt(c),p)}},e.prototype.writePointGeometry_=function(t,e){var r=e.getCoordinates(),n={feature:t,segment:[r,r]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writePolygonGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n<i;++n)for(var o=r[n],a=0,s=o.length-1;a<s;++a){var u=o.slice(a,a+2),l={feature:t,segment:u};this.rBush_.insert(Gt(u),l)}},e}(ec),Gp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jp="translatestart",Dp="translating",kp="translateend",Up=function(t){function e(e,r,n,i,o){var a=t.call(this,e)||this;return a.features=r,a.coordinate=n,a.startCoordinate=i,a.mapBrowserEvent=o,a}return Gp(e,t),e}(K),zp=function(t){function e(e){var r,n=this,i=e||{};if((n=t.call(this,i)||this).lastCoordinate_=null,n.startCoordinate_=null,n.features_=void 0!==i.features?i.features:null,i.layers)if("function"==typeof i.layers)r=i.layers;else{var o=i.layers;r=function(t){return D(o,t)}}else r=Y;return n.layerFilter_=r,n.filter_=i.filter?i.filter:Y,n.hitTolerance_=i.hitTolerance?i.hitTolerance:0,n.lastFeature_=null,n.addEventListener(yt(Ph),n.handleActiveChanged_),n}return Gp(e,t),e.prototype.handleDownEvent=function(t){if(this.lastFeature_=this.featuresAtPixel_(t.pixel,t.map),!this.lastCoordinate_&&this.lastFeature_){this.startCoordinate_=t.coordinate,this.lastCoordinate_=t.coordinate,this.handleMoveEvent(t);var e=this.features_||new St([this.lastFeature_]);return this.dispatchEvent(new Up(jp,e,t.coordinate,this.startCoordinate_,t)),!0}return!1},e.prototype.handleUpEvent=function(t){if(this.lastCoordinate_){this.lastCoordinate_=null,this.handleMoveEvent(t);var e=this.features_||new St([this.lastFeature_]);return this.dispatchEvent(new Up(kp,e,t.coordinate,this.startCoordinate_,t)),this.startCoordinate_=null,!0}return!1},e.prototype.handleDragEvent=function(t){if(this.lastCoordinate_){var e=t.coordinate,r=e[0]-this.lastCoordinate_[0],n=e[1]-this.lastCoordinate_[1],i=this.features_||new St([this.lastFeature_]);i.forEach((function(t){var e=t.getGeometry();e.translate(r,n),t.setGeometry(e)})),this.lastCoordinate_=e,this.dispatchEvent(new Up(Dp,i,e,this.startCoordinate_,t))}},e.prototype.handleMoveEvent=function(t){var e=t.map.getViewport();this.featuresAtPixel_(t.pixel,t.map)?(e.classList.remove(this.lastCoordinate_?"ol-grab":"ol-grabbing"),e.classList.add(this.lastCoordinate_?"ol-grabbing":"ol-grab")):e.classList.remove("ol-grab","ol-grabbing")},e.prototype.featuresAtPixel_=function(t,e){return e.forEachFeatureAtPixel(t,function(t,e){if(this.filter_(t,e)&&(!this.features_||D(this.features_.getArray(),t)))return t}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){var r=this.getMap();t.prototype.setMap.call(this,e),this.updateState_(r)},e.prototype.handleActiveChanged_=function(){this.updateState_(null)},e.prototype.updateState_=function(t){var e=this.getMap(),r=this.getActive();e&&r||(e=e||t)&&e.getViewport().classList.remove("ol-grab","ol-grabbing")},e}(ec);function Bp(t){var e=t||{},r=new St,n=new bu(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&r.push(new ac),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&r.push(new Ah({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&r.push(new ic({condition:e.onFocusOnly?jh:void 0,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&r.push(new Mc),(void 0===e.pinchZoom||e.pinchZoom)&&r.push(new Nc({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(r.push(new Tc),r.push(new bc({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&r.push(new Lc({condition:e.onFocusOnly?jh:void 0,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&r.push(new yc({duration:e.zoomDuration})),r}var Yp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xp=function(t){function e(e){return(e=O({},e)).controls||(e.controls=bh()),e.interactions||(e.interactions=Bp()),t.call(this,e)||this}return Yp(e,t),e.prototype.createRenderer=function(){return new Xl(this)},e}(vl),Vp=function(){function t(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t.prototype.canExpireCache=function(){return this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var r=this.entries_[t];return wt(void 0!==r,15),r===this.newest_||(r===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(r.newer.older=r.older,r.older.newer=r.newer),r.newer=null,r.older=this.newest_,this.newest_.newer=r,this.newest_=r),r.value_},t.prototype.remove=function(t){var e=this.entries_[t];return wt(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){wt(!(t in this.entries_),16);var r={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=r:this.oldest_=r,this.newest_=r,this.entries_[t]=r,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function Wp(t,e,r,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=r,n):[t,e,r]}function Zp(t,e,r){return t+"/"+e+"/"+r}function Kp(t){return Zp(t[0],t[1],t[2])}function qp(t){return t.split("/").map(Number)}function Hp(t){return(t[1]<<t[0])+t[2]}var Jp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Qp=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Jp(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=qp(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(Kp(e.tileCoord)),e.release())}.bind(this))}},e}(Vp),$p=function(){function t(t,e,r,n){this.minX=t,this.maxX=e,this.minY=r,this.maxY=n}return t.prototype.contains=function(t){return this.containsXY(t[1],t[2])},t.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},t.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},t.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},t.prototype.extend=function(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function tf(t,e,r,n,i){return void 0!==i?(i.minX=t,i.maxX=e,i.minY=r,i.maxY=n,i):new $p(t,e,r,n)}var ef=$p,rf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nf=[],of=function(t){function e(e,r,n,i){var o=t.call(this,e,r,{transition:0})||this;return o.context_={},o.executorGroups={},o.loadingSourceTiles=0,o.errorSourceTileKeys={},o.hitDetectionImageData={},o.replayState_={},o.sourceTiles=null,o.wantedResolution,o.getSourceTiles=i.bind(void 0,o),o.sourceZ=-1,o.hifi=!1,o.wrappedTileCoord=n,o}return rf(e,t),e.prototype.getContext=function(t){var e=S(t);return e in this.context_||(this.context_[e]=Ji(1,1,nf)),this.context_[e]},e.prototype.hasContext=function(t){return S(t)in this.context_},e.prototype.getImage=function(t){return this.hasContext(t)?this.getContext(t).canvas:null},e.prototype.getReplayState=function(t){var e=S(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedZ:-1,renderedTileZ:-1}),this.replayState_[e]},e.prototype.load=function(){this.getSourceTiles()},e.prototype.release=function(){for(var e in this.context_)nf.push(this.context_[e].canvas);t.prototype.release.call(this)},e}(Tu),af=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sf=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.extent=null,s.format_=i,s.features_=null,s.loader_,s.projection=null,s.resolution,s.tileLoadFunction_=o,s.url_=n,s}return af(e,t),e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.getKey=function(){return this.url_},e.prototype.load=function(){this.state==du&&(this.setState(_u),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))},e.prototype.onLoad=function(t,e){this.setFeatures(t)},e.prototype.onError=function(){this.setState(yu)},e.prototype.setFeatures=function(t){this.features_=t,this.setState(gu)},e.prototype.setLoader=function(t){this.loader_=t},e}(Tu),uf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function lf(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t[r].clone());return e}var hf=function(t){function e(e){var r=t.call(this)||this;return r.geometries_=e||null,r.changeEventsKeys_=[],r.listenGeometriesChange_(),r}return uf(e,t),e.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(N),this.changeEventsKeys_.length=0},e.prototype.listenGeometriesChange_=function(){if(this.geometries_)for(var t=0,e=this.geometries_.length;t<e;++t)this.changeEventsKeys_.push(M(this.geometries_[t],J,this.changed,this))},e.prototype.clone=function(){var t=new e(null);return t.setGeometries(this.geometries_),t},e.prototype.closestPointXY=function(t,e,r,n){if(n<kt(this.getExtent(),t,e))return n;for(var i=this.geometries_,o=0,a=i.length;o<a;++o)n=i[o].closestPointXY(t,e,r,n);return n},e.prototype.containsXY=function(t,e){for(var r=this.geometries_,n=0,i=r.length;n<i;++n)if(r[n].containsXY(t,e))return!0;return!1},e.prototype.computeExtent=function(t){Wt(t);for(var e=this.geometries_,r=0,n=e.length;r<n;++r)$t(t,e[r].getExtent());return t},e.prototype.getGeometries=function(){return lf(this.geometries_)},e.prototype.getGeometriesArray=function(){return this.geometries_},e.prototype.getGeometriesArrayRecursive=function(){for(var t=[],e=this.geometries_,r=0,n=e.length;r<n;++r)e[r].getType()===this.getType()?t=t.concat(e[r].getGeometriesArrayRecursive()):t.push(e[r]);return t},e.prototype.getSimplifiedGeometry=function(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var r=[],n=this.geometries_,i=!1,o=0,a=n.length;o<a;++o){var s=n[o],u=s.getSimplifiedGeometry(t);r.push(u),u!==s&&(i=!0)}if(i){var l=new e(null);return l.setGeometriesArray(r),l}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this},e.prototype.getType=function(){return Fe.GEOMETRY_COLLECTION},e.prototype.intersectsExtent=function(t){for(var e=this.geometries_,r=0,n=e.length;r<n;++r)if(e[r].intersectsExtent(t))return!0;return!1},e.prototype.isEmpty=function(){return 0===this.geometries_.length},e.prototype.rotate=function(t,e){for(var r=this.geometries_,n=0,i=r.length;n<i;++n)r[n].rotate(t,e);this.changed()},e.prototype.scale=function(t,e,r){var n=r;n||(n=le(this.getExtent()));for(var i=this.geometries_,o=0,a=i.length;o<a;++o)i[o].scale(t,e,n);this.changed()},e.prototype.setGeometries=function(t){this.setGeometriesArray(lf(t))},e.prototype.setGeometriesArray=function(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()},e.prototype.applyTransform=function(t){for(var e=this.geometries_,r=0,n=e.length;r<n;++r)e[r].applyTransform(t);this.changed()},e.prototype.translate=function(t,e){for(var r=this.geometries_,n=0,i=r.length;n<i;++n)r[n].translate(t,e);this.changed()},e.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),t.prototype.disposeInternal.call(this)},e}(an),cf=function(){function t(){this.dataProjection=null,this.defaultFeatureProjection=null}return t.prototype.getReadOptions=function(t,e){var r;if(e){var n=e.dataProjection?Sr(e.dataProjection):this.readProjection(t);e.extent&&n&&n.getUnits()===$e.TILE_PIXELS&&(n=Sr(n)).setWorldExtent(e.extent),r={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(r)},t.prototype.adaptOptions=function(t){return O({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},t)},t.prototype.getType=function(){return x()},t.prototype.readFeature=function(t,e){return x()},t.prototype.readFeatures=function(t,e){return x()},t.prototype.readGeometry=function(t,e){return x()},t.prototype.readProjection=function(t){return x()},t.prototype.writeFeature=function(t,e){return x()},t.prototype.writeFeatures=function(t,e){return x()},t.prototype.writeGeometry=function(t,e){return x()},t}();function pf(t,e,r){var n,i=r?Sr(r.featureProjection):null,o=r?Sr(r.dataProjection):null;if(n=i&&o&&!Fr(i,o)?(e?t.clone():t).transform(e?i:o,e?o:i):t,e&&r&&void 0!==r.decimals){var a=Math.pow(10,r.decimals);n===t&&(n=t.clone()),n.applyTransform((function(t){for(var e=0,r=t.length;e<r;++e)t[e]=Math.round(t[e]*a)/a;return t}))}return n}function ff(t,e){var r=e?Sr(e.featureProjection):null,n=e?Sr(e.dataProjection):null;return r&&n&&!Fr(r,n)?Gr(t,n,r):t}var df=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function _f(t){if("string"==typeof t){var e=JSON.parse(t);return e||null}return null!==t?t:null}var gf=function(t){function e(){return t.call(this)||this}return df(e,t),e.prototype.getType=function(){return Us},e.prototype.readFeature=function(t,e){return this.readFeatureFromObject(_f(t),this.getReadOptions(t,e))},e.prototype.readFeatures=function(t,e){return this.readFeaturesFromObject(_f(t),this.getReadOptions(t,e))},e.prototype.readFeatureFromObject=function(t,e){return x()},e.prototype.readFeaturesFromObject=function(t,e){return x()},e.prototype.readGeometry=function(t,e){return this.readGeometryFromObject(_f(t),this.getReadOptions(t,e))},e.prototype.readGeometryFromObject=function(t,e){return x()},e.prototype.readProjection=function(t){return this.readProjectionFromObject(_f(t))},e.prototype.readProjectionFromObject=function(t){return x()},e.prototype.writeFeature=function(t,e){return JSON.stringify(this.writeFeatureObject(t,e))},e.prototype.writeFeatureObject=function(t,e){return x()},e.prototype.writeFeatures=function(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))},e.prototype.writeFeaturesObject=function(t,e){return x()},e.prototype.writeGeometry=function(t,e){return JSON.stringify(this.writeGeometryObject(t,e))},e.prototype.writeGeometryObject=function(t,e){return x()},e}(cf),yf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function vf(t,e){if(!t)return null;var r;switch(t.type){case Fe.POINT:r=function(t){return new Ln(t.coordinates)}(t);break;case Fe.LINE_STRING:r=function(t){return new Ds(t.coordinates)}(t);break;case Fe.POLYGON:r=function(t){return new Wn(t.coordinates)}(t);break;case Fe.MULTI_POINT:r=function(t){return new Hc(t.coordinates)}(t);break;case Fe.MULTI_LINE_STRING:r=function(t){return new Kc(t.coordinates)}(t);break;case Fe.MULTI_POLYGON:r=function(t){return new Qc(t.coordinates)}(t);break;case Fe.GEOMETRY_COLLECTION:r=function(t,e){var r=t.geometries.map((function(t){return vf(t,e)}));return new hf(r)}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return pf(r,!1,e)}function mf(t,e){var r,n=(t=pf(t,!0,e)).getType();switch(n){case Fe.POINT:r=function(t,e){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case Fe.LINE_STRING:r=function(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case Fe.POLYGON:r=function(t,e){var r;e&&(r=e.rightHanded);return{type:"Polygon",coordinates:t.getCoordinates(r)}}(t,e);break;case Fe.MULTI_POINT:r=function(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case Fe.MULTI_LINE_STRING:r=function(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case Fe.MULTI_POLYGON:r=function(t,e){var r;e&&(r=e.rightHanded);return{type:"MultiPolygon",coordinates:t.getCoordinates(r)}}(t,e);break;case Fe.GEOMETRY_COLLECTION:r=function(t,e){return{type:"GeometryCollection",geometries:t.getGeometriesArray().map((function(t){var r=O({},e);return delete r.featureProjection,mf(t,r)}))}}(t,e);break;case Fe.CIRCLE:r={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+n)}return r}var xf=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this)||this).dataProjection=Sr(n.dataProjection?n.dataProjection:"EPSG:4326"),n.featureProjection&&(r.defaultFeatureProjection=Sr(n.featureProjection)),r.geometryName_=n.geometryName,r.extractGeometryName_=n.extractGeometryName,r}return yf(e,t),e.prototype.readFeatureFromObject=function(t,e){var r=null,n=vf((r="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null}).geometry,e),i=new Ct;return this.geometryName_?i.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&i.setGeometryName(r.geometry_name),i.setGeometry(n),"id"in r&&i.setId(r.id),r.properties&&i.setProperties(r.properties,!0),i},e.prototype.readFeaturesFromObject=function(t,e){var r=null;if("FeatureCollection"===t.type){r=[];for(var n=t.features,i=0,o=n.length;i<o;++i)r.push(this.readFeatureFromObject(n[i],e))}else r=[this.readFeatureFromObject(t,e)];return r},e.prototype.readGeometryFromObject=function(t,e){return vf(t,e)},e.prototype.readProjectionFromObject=function(t){var e,r=t.crs;return r?"name"==r.type?e=Sr(r.properties.name):"EPSG"===r.type?e=Sr("EPSG:"+r.properties.code):wt(!1,36):e=this.dataProjection,e},e.prototype.writeFeatureObject=function(t,e){e=this.adaptOptions(e);var r={type:"Feature",geometry:null,properties:null},n=t.getId();void 0!==n&&(r.id=n);var i=t.getGeometry();i&&(r.geometry=mf(i,e));var o=t.getProperties();return delete o[t.getGeometryName()],F(o)||(r.properties=o),r},e.prototype.writeFeaturesObject=function(t,e){e=this.adaptOptions(e);for(var r=[],n=0,i=t.length;n<i;++n)r.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:r}},e.prototype.writeGeometryObject=function(t,e){return mf(t,this.adaptOptions(e))},e}(gf),Ef="http://www.w3.org/2001/XMLSchema-instance";function Sf(t,e){return zf().createElementNS(t,e)}function wf(t,e){return function t(e,r,n){if(e.nodeType==Node.CDATA_SECTION_NODE||e.nodeType==Node.TEXT_NODE)r?n.push(String(e.nodeValue).replace(/(\r\n|\r|\n)/g,"")):n.push(e.nodeValue);else{var i=void 0;for(i=e.firstChild;i;i=i.nextSibling)t(i,r,n)}return n}(t,e,[]).join("")}function Tf(t){return"documentElement"in t}function Cf(t){return(new DOMParser).parseFromString(t,"application/xml")}function Rf(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&z(n[n.length-1],i)}}function bf(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&n[n.length-1].push(i)}}function Pf(t,e){return function(r,n){var i=t.call(void 0!==e?e:this,r,n);void 0!==i&&(n[n.length-1]=i)}}function Of(t,e,r){return function(n,i){var o=t.call(void 0!==r?r:this,n,i);void 0!==o&&(i[i.length-1][void 0!==e?e:n.localName]=o)}}function If(t,e){return function(r,n,i){t.call(void 0!==e?e:this,r,n,i),i[i.length-1].node.appendChild(r)}}function Lf(t,e){var r=t;return function(t,n,i){var o=n[n.length-1].node,a=r;return void 0===a&&(a=i),Sf(void 0!==e?e:o.namespaceURI,a)}}var Ff=Lf();function Mf(t,e){for(var r=e.length,n=new Array(r),i=0;i<r;++i)n[i]=t[e[i]];return n}function Af(t,e,r){var n,i,o=void 0!==r?r:{};for(n=0,i=t.length;n<i;++n)o[t[n]]=e;return o}function Nf(t,e,r,n){var i;for(i=e.firstElementChild;i;i=i.nextElementSibling){var o=t[i.namespaceURI];if(void 0!==o){var a=o[i.localName];void 0!==a&&a.call(n,i,r)}}}function Gf(t,e,r,n,i){return n.push(t),Nf(e,r,n,i),n.pop()}function jf(t,e,r,n,i,o){for(var a,s,u=(void 0!==i?i:r).length,l=0;l<u;++l)void 0!==(a=r[l])&&void 0!==(s=e.call(void 0!==o?o:this,a,n,void 0!==i?i[l]:void 0))&&t[s.namespaceURI][s.localName].call(o,s,a,n)}function Df(t,e,r,n,i,o,a){return i.push(t),jf(e,r,n,i,o,a),i.pop()}var kf=void 0;var Uf=void 0;function zf(){return void 0===Uf&&"undefined"!=typeof document&&(Uf=document.implementation.createDocument("","",null)),Uf}var Bf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yf=function(t){function e(){var e=t.call(this)||this;return e.xmlSerializer_=(void 0===kf&&"undefined"!=typeof XMLSerializer&&(kf=new XMLSerializer),kf),e}return Bf(e,t),e.prototype.getType=function(){return Bs},e.prototype.readFeature=function(t,e){if(t){if("string"==typeof t){var r=Cf(t);return this.readFeatureFromDocument(r,e)}return Tf(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}return null},e.prototype.readFeatureFromDocument=function(t,e){var r=this.readFeaturesFromDocument(t,e);return r.length>0?r[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=Cf(t);return this.readFeaturesFromDocument(r,e)}return Tf(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&z(r,this.readFeaturesFromNode(n,e));return r},e.prototype.readFeaturesFromNode=function(t,e){return x()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=Cf(t);return this.readGeometryFromDocument(r,e)}return Tf(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=Cf(t);return this.readProjectionFromDocument(e)}return Tf(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeGeometryNode=function(t,e){return null},e}(cf),Xf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vf="http://www.opengis.net/gml",Wf=/^[\s\xa0]*$/,Zf=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType=n.featureType,r.featureNS=n.featureNS,r.srsName=n.srsName,r.schemaLocation="",r.FEATURE_COLLECTION_PARSERS={},r.FEATURE_COLLECTION_PARSERS[r.namespace]={featureMember:bf(r.readFeaturesInternal),featureMembers:Pf(r.readFeaturesInternal)},r}return Xf(e,t),e.prototype.readFeaturesInternal=function(t,e){var r=t.localName,n=null;if("FeatureCollection"==r)n=Gf([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==r||"featureMember"==r){var i=e[0],o=i.featureType,a=i.featureNS;if(!o&&t.childNodes){o=[],a={};for(var s=0,u=t.childNodes.length;s<u;++s){var l=t.childNodes[s];if(1===l.nodeType){var h=l.nodeName.split(":").pop();if(-1===o.indexOf(h)){var c="",p=0,f=l.namespaceURI;for(var d in a){if(a[d]===f){c=d;break}++p}c||(a[c="p"+p]=f),o.push(c+":"+h)}}}"featureMember"!=r&&(i.featureType=o,i.featureNS=a)}if("string"==typeof a){var _=a;(a={}).p0=_}var g={},y=Array.isArray(o)?o:[o];for(var v in a){var m={};for(s=0,u=y.length;s<u;++s){(-1===y[s].indexOf(":")?"p0":y[s].split(":")[0])===v&&(m[y[s].split(":").pop()]="featureMembers"==r?bf(this.readFeatureElement,this):Pf(this.readFeatureElement,this))}g[a[v]]=m}n=Gf("featureMember"==r?void 0:[],g,t,e)}return null===n&&(n=[]),n},e.prototype.readGeometryElement=function(t,e){var r=e[0];r.srsName=t.firstElementChild.getAttribute("srsName"),r.srsDimension=t.firstElementChild.getAttribute("srsDimension");var n=Gf(null,this.GEOMETRY_PARSERS,t,e,this);return n?Array.isArray(n)?ff(n,r):pf(n,!1,r):void 0},e.prototype.readFeatureElementInternal=function(t,e,r){for(var n,i={},o=t.firstElementChild;o;o=o.nextElementSibling){var a=void 0,s=o.localName;0===o.childNodes.length||1===o.childNodes.length&&(3===o.firstChild.nodeType||4===o.firstChild.nodeType)?(a=wf(o,!1),Wf.test(a)&&(a=void 0)):(r&&(a=this.readGeometryElement(o,e)),a?"boundedBy"!==s&&(n=s):a=this.readFeatureElementInternal(o,e,!1)),i[s]?(i[s]instanceof Array||(i[s]=[i[s]]),i[s].push(a)):i[s]=a;var u=o.attributes.length;if(u>0){i[s]={_content_:i[s]};for(var l=0;l<u;l++){var h=o.attributes[l].name;i[s][h]=o.attributes[l].value}}}if(r){var c=new Ct(i);n&&c.setGeometryName(n);var p=t.getAttribute("fid")||function(t,e,r){return t.getAttributeNS(e,r)||""}(t,this.namespace,"id");return p&&c.setId(p),c}return i},e.prototype.readFeatureElement=function(t,e){return this.readFeatureElementInternal(t,e,!0)},e.prototype.readPoint=function(t,e){var r=this.readFlatCoordinatesFromNode_(t,e);if(r)return new Ln(r,Oe)},e.prototype.readMultiPoint=function(t,e){var r=Gf([],this.MULTIPOINT_PARSERS_,t,e,this);return r?new Hc(r):void 0},e.prototype.readMultiLineString=function(t,e){var r=Gf([],this.MULTILINESTRING_PARSERS_,t,e,this);if(r)return new Kc(r)},e.prototype.readMultiPolygon=function(t,e){var r=Gf([],this.MULTIPOLYGON_PARSERS_,t,e,this);if(r)return new Qc(r)},e.prototype.pointMemberParser_=function(t,e){Nf(this.POINTMEMBER_PARSERS_,t,e,this)},e.prototype.lineStringMemberParser_=function(t,e){Nf(this.LINESTRINGMEMBER_PARSERS_,t,e,this)},e.prototype.polygonMemberParser_=function(t,e){Nf(this.POLYGONMEMBER_PARSERS_,t,e,this)},e.prototype.readLineString=function(t,e){var r=this.readFlatCoordinatesFromNode_(t,e);return r?new Ds(r,Oe):void 0},e.prototype.readFlatLinearRing_=function(t,e){var r=Gf(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this);return r||void 0},e.prototype.readLinearRing=function(t,e){var r=this.readFlatCoordinatesFromNode_(t,e);if(r)return new On(r,Oe)},e.prototype.readPolygon=function(t,e){var r=Gf([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this);if(r&&r[0]){var n,i=r[0],o=[i.length],a=void 0;for(a=1,n=r.length;a<n;++a)z(i,r[a]),o.push(i.length);return new Wn(i,Oe,o)}},e.prototype.readFlatCoordinatesFromNode_=function(t,e){return Gf(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)},e.prototype.readGeometryFromNode=function(t,e){var r=this.readGeometryElement(t,[this.getReadOptions(t,e||{})]);return r||null},e.prototype.readFeaturesFromNode=function(t,e){var r={featureType:this.featureType,featureNS:this.featureNS};return e&&O(r,this.getReadOptions(t,e)),this.readFeaturesInternal(t,[r])||[]},e.prototype.readProjectionFromNode=function(t){return Sr(this.srsName?this.srsName:t.firstElementChild.getAttribute("srsName"))},e}(Yf);Zf.prototype.namespace=Vf,Zf.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{}},Zf.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{}},Zf.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{}},Zf.prototype.MULTIPOINT_PARSERS_={"http://www.opengis.net/gml":{pointMember:bf(Zf.prototype.pointMemberParser_),pointMembers:bf(Zf.prototype.pointMemberParser_)}},Zf.prototype.MULTILINESTRING_PARSERS_={"http://www.opengis.net/gml":{lineStringMember:bf(Zf.prototype.lineStringMemberParser_),lineStringMembers:bf(Zf.prototype.lineStringMemberParser_)}},Zf.prototype.MULTIPOLYGON_PARSERS_={"http://www.opengis.net/gml":{polygonMember:bf(Zf.prototype.polygonMemberParser_),polygonMembers:bf(Zf.prototype.polygonMemberParser_)}},Zf.prototype.POINTMEMBER_PARSERS_={"http://www.opengis.net/gml":{Point:bf(Zf.prototype.readFlatCoordinatesFromNode_)}},Zf.prototype.LINESTRINGMEMBER_PARSERS_={"http://www.opengis.net/gml":{LineString:bf(Zf.prototype.readLineString)}},Zf.prototype.POLYGONMEMBER_PARSERS_={"http://www.opengis.net/gml":{Polygon:bf(Zf.prototype.readPolygon)}},Zf.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:Pf(Zf.prototype.readFlatLinearRing_)}};var Kf=Zf;function qf(t){var e,r=wf(t,!1);return(e=/^\s*(true|1)|(false|0)\s*$/.exec(r))?void 0!==e[1]||!1:void 0}function Hf(t){var e,r=wf(t,!1);return(e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(r))?parseFloat(e[1]):void 0}function Jf(t){return Qf(wf(t,!1))}function Qf(t){var e=/^\s*(\d+)\s*$/.exec(t);return e?parseInt(e[1],10):void 0}function $f(t){return wf(t,!1).trim()}function td(t,e){rd(t,e?"1":"0")}function ed(t,e){var r=e.toPrecision();t.appendChild(zf().createTextNode(r))}function rd(t,e){t.appendChild(zf().createTextNode(e))}var nd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),id={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"},od=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).surface_=void 0!==n.surface&&n.surface,r.curve_=void 0!==n.curve&&n.curve,r.multiCurve_=void 0===n.multiCurve||n.multiCurve,r.multiSurface_=void 0===n.multiSurface||n.multiSurface,r.schemaLocation=n.schemaLocation?n.schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",r.hasZ=void 0!==n.hasZ&&n.hasZ,r}return nd(e,t),e.prototype.readMultiCurve_=function(t,e){var r=Gf([],this.MULTICURVE_PARSERS_,t,e,this);return r?new Kc(r):void 0},e.prototype.readMultiSurface_=function(t,e){var r=Gf([],this.MULTISURFACE_PARSERS_,t,e,this);if(r)return new Qc(r)},e.prototype.curveMemberParser_=function(t,e){Nf(this.CURVEMEMBER_PARSERS_,t,e,this)},e.prototype.surfaceMemberParser_=function(t,e){Nf(this.SURFACEMEMBER_PARSERS_,t,e,this)},e.prototype.readPatch_=function(t,e){return Gf([null],this.PATCHES_PARSERS_,t,e,this)},e.prototype.readSegment_=function(t,e){return Gf([null],this.SEGMENTS_PARSERS_,t,e,this)},e.prototype.readPolygonPatch_=function(t,e){return Gf([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this)},e.prototype.readLineStringSegment_=function(t,e){return Gf([null],this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)},e.prototype.interiorParser_=function(t,e){var r=Gf(void 0,this.RING_PARSERS,t,e,this);r&&e[e.length-1].push(r)},e.prototype.exteriorParser_=function(t,e){var r=Gf(void 0,this.RING_PARSERS,t,e,this);r&&(e[e.length-1][0]=r)},e.prototype.readSurface_=function(t,e){var r=Gf([null],this.SURFACE_PARSERS_,t,e,this);if(r&&r[0]){var n,i=r[0],o=[i.length],a=void 0;for(a=1,n=r.length;a<n;++a)z(i,r[a]),o.push(i.length);return new Wn(i,Oe,o)}},e.prototype.readCurve_=function(t,e){var r=Gf([null],this.CURVE_PARSERS_,t,e,this);return r?new Ds(r,Oe):void 0},e.prototype.readEnvelope_=function(t,e){var r=Gf([null],this.ENVELOPE_PARSERS_,t,e,this);return Vt(r[1][0],r[1][1],r[2][0],r[2][1])},e.prototype.readFlatPos_=function(t,e){for(var r,n=wf(t,!1),i=/^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,o=[];r=i.exec(n);)o.push(parseFloat(r[1])),n=n.substr(r[0].length);if(""===n){var a=e[0].srsName,s="enu";if(a)s=Sr(a).getAxisOrientation();if("neu"===s){var u,l=void 0;for(l=0,u=o.length;l<u;l+=3){var h=o[l],c=o[l+1];o[l]=c,o[l+1]=h}}var p=o.length;if(2==p&&o.push(0),0!==p)return o}},e.prototype.readFlatPosList_=function(t,e){var r=wf(t,!1).replace(/^\s*|\s*$/g,""),n=e[0],i=n.srsName,o=n.srsDimension,a="enu";i&&(a=Sr(i).getAxisOrientation());var s,u,l,h=r.split(/\s+/),c=2;t.getAttribute("srsDimension")?c=Qf(t.getAttribute("srsDimension")):t.getAttribute("dimension")?c=Qf(t.getAttribute("dimension")):t.parentNode.getAttribute("srsDimension")?c=Qf(t.parentNode.getAttribute("srsDimension")):o&&(c=Qf(o));for(var p=[],f=0,d=h.length;f<d;f+=c)s=parseFloat(h[f]),u=parseFloat(h[f+1]),l=3===c?parseFloat(h[f+2]):0,"en"===a.substr(0,2)?p.push(s,u,l):p.push(u,s,l);return p},e.prototype.writePos_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=i?"3":"2";t.setAttribute("srsDimension",o);var a=n.srsName,s="enu";a&&(s=Sr(a).getAxisOrientation());var u,l=e.getCoordinates();(u="en"===s.substr(0,2)?l[0]+" "+l[1]:l[1]+" "+l[0],i)&&(u+=" "+(l[2]||0));rd(t,u)},e.prototype.getCoords_=function(t,e,r){var n="enu";e&&(n=Sr(e).getAxisOrientation());var i="en"===n.substr(0,2)?t[0]+" "+t[1]:t[1]+" "+t[0];r&&(i+=" "+(t[2]||0));return i},e.prototype.writePosList_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=i?"3":"2";t.setAttribute("srsDimension",o);for(var a,s=n.srsName,u=e.getCoordinates(),l=u.length,h=new Array(l),c=0;c<l;++c)a=u[c],h[c]=this.getCoords_(a,s,i);rd(t,h.join(" "))},e.prototype.writePoint_=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=Sf(t.namespaceURI,"pos");t.appendChild(i),this.writePos_(i,e,r)},e.prototype.writeEnvelope=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=[e[0]+" "+e[1],e[2]+" "+e[3]];Df({node:t},this.ENVELOPE_SERIALIZERS_,Ff,i,r,["lowerCorner","upperCorner"],this)},e.prototype.writeLinearRing_=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=Sf(t.namespaceURI,"posList");t.appendChild(i),this.writePosList_(i,e,r)},e.prototype.RING_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1],i=n.node,o=n.exteriorWritten;return void 0===o&&(n.exteriorWritten=!0),Sf(i.namespaceURI,void 0!==o?"interior":"exterior")},e.prototype.writeSurfaceOrPolygon_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;if("PolygonPatch"!==t.nodeName&&o&&t.setAttribute("srsName",o),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){var a=e.getLinearRings();Df({node:t,hasZ:i,srsName:o},this.RING_SERIALIZERS_,this.RING_NODE_FACTORY_,a,r,void 0,this)}else if("Surface"===t.nodeName){var s=Sf(t.namespaceURI,"patches");t.appendChild(s),this.writeSurfacePatches_(s,e,r)}},e.prototype.writeCurveOrLineString_=function(t,e,r){var n=r[r.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){var i=Sf(t.namespaceURI,"posList");t.appendChild(i),this.writePosList_(i,e,r)}else if("Curve"===t.nodeName){var o=Sf(t.namespaceURI,"segments");t.appendChild(o),this.writeCurveSegments_(o,e,r)}},e.prototype.writeMultiSurfaceOrPolygon_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,a=n.surface;o&&t.setAttribute("srsName",o);var s=e.getPolygons();Df({node:t,hasZ:i,srsName:o,surface:a},this.SURFACEORPOLYGONMEMBER_SERIALIZERS_,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,s,r,void 0,this)},e.prototype.writeMultiPoint_=function(t,e,r){var n=r[r.length-1],i=n.srsName,o=n.hasZ;i&&t.setAttribute("srsName",i);var a=e.getPoints();Df({node:t,hasZ:o,srsName:i},this.POINTMEMBER_SERIALIZERS_,Lf("pointMember"),a,r,void 0,this)},e.prototype.writeMultiCurveOrLineString_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,a=n.curve;o&&t.setAttribute("srsName",o);var s=e.getLineStrings();Df({node:t,hasZ:i,srsName:o,curve:a},this.LINESTRINGORCURVEMEMBER_SERIALIZERS_,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,s,r,void 0,this)},e.prototype.writeRing_=function(t,e,r){var n=Sf(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing_(n,e,r)},e.prototype.writeSurfaceOrPolygonMember_=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeSurfaceOrPolygon_(n,e,r))},e.prototype.writePointMember_=function(t,e,r){var n=Sf(t.namespaceURI,"Point");t.appendChild(n),this.writePoint_(n,e,r)},e.prototype.writeLineStringOrCurveMember_=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeCurveOrLineString_(n,e,r))},e.prototype.writeSurfacePatches_=function(t,e,r){var n=Sf(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon_(n,e,r)},e.prototype.writeCurveSegments_=function(t,e,r){var n=Sf(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString_(n,e,r)},e.prototype.writeGeometryElement=function(t,e,r){var n,i=r[r.length-1],o=O({},i);o.node=t,n=Array.isArray(e)?ff(e,i):pf(e,!0,i),Df(o,this.GEOMETRY_SERIALIZERS_,this.GEOMETRY_NODE_FACTORY_,[n],r,void 0,this)},e.prototype.writeFeatureElement=function(t,e,r){var n=e.getId();n&&t.setAttribute("fid",n);var i=r[r.length-1],o=i.featureNS,a=e.getGeometryName();i.serializers||(i.serializers={},i.serializers[o]={});var s=e.getProperties(),u=[],l=[];for(var h in s){var c=s[h];null!==c&&(u.push(h),l.push(c),h==a||"function"==typeof c.getSimplifiedGeometry?h in i.serializers[o]||(i.serializers[o][h]=If(this.writeGeometryElement,this)):h in i.serializers[o]||(i.serializers[o][h]=If(rd)))}var p=O({},i);p.node=t,Df(p,i.serializers,Lf(void 0,o),l,r,u)},e.prototype.writeFeatureMembers_=function(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,a={};a[o]={},a[o][i]=If(this.writeFeatureElement,this);var s=O({},n);s.node=t,Df(s,a,Lf(i,o),e,r)},e.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1].node;return Sf(this.namespace,id[n.nodeName])},e.prototype.GEOMETRY_NODE_FACTORY_=function(t,e,r){var n,i=e[e.length-1],o=i.multiSurface,a=i.surface,s=i.curve,u=i.multiCurve;return Array.isArray(t)?n="Envelope":"MultiPolygon"===(n=t.getType())&&!0===o?n="MultiSurface":"Polygon"===n&&!0===a?n="Surface":"LineString"===n&&!0===s?n="Curve":"MultiLineString"===n&&!0===u&&(n="MultiCurve"),Sf(this.namespace,n)},e.prototype.writeGeometryNode=function(t,e){e=this.adaptOptions(e);var r=Sf(this.namespace,"geom"),n={node:r,hasZ:this.hasZ,srsName:this.srsName,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_};return e&&O(n,e),this.writeGeometryElement(r,t,[n]),r},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=Sf(this.namespace,"featureMembers");r.setAttributeNS(Ef,"xsi:schemaLocation",this.schemaLocation);var n={srsName:this.srsName,hasZ:this.hasZ,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_,featureNS:this.featureNS,featureType:this.featureType};return e&&O(n,e),this.writeFeatureMembers_(r,t,[n]),r},e}(Kf);od.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{pos:Pf(od.prototype.readFlatPos_),posList:Pf(od.prototype.readFlatPosList_)}},od.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{interior:od.prototype.interiorParser_,exterior:od.prototype.exteriorParser_}},od.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:Pf(Kf.prototype.readPoint),MultiPoint:Pf(Kf.prototype.readMultiPoint),LineString:Pf(Kf.prototype.readLineString),MultiLineString:Pf(Kf.prototype.readMultiLineString),LinearRing:Pf(Kf.prototype.readLinearRing),Polygon:Pf(Kf.prototype.readPolygon),MultiPolygon:Pf(Kf.prototype.readMultiPolygon),Surface:Pf(od.prototype.readSurface_),MultiSurface:Pf(od.prototype.readMultiSurface_),Curve:Pf(od.prototype.readCurve_),MultiCurve:Pf(od.prototype.readMultiCurve_),Envelope:Pf(od.prototype.readEnvelope_)}},od.prototype.MULTICURVE_PARSERS_={"http://www.opengis.net/gml":{curveMember:bf(od.prototype.curveMemberParser_),curveMembers:bf(od.prototype.curveMemberParser_)}},od.prototype.MULTISURFACE_PARSERS_={"http://www.opengis.net/gml":{surfaceMember:bf(od.prototype.surfaceMemberParser_),surfaceMembers:bf(od.prototype.surfaceMemberParser_)}},od.prototype.CURVEMEMBER_PARSERS_={"http://www.opengis.net/gml":{LineString:bf(Kf.prototype.readLineString),Curve:bf(od.prototype.readCurve_)}},od.prototype.SURFACEMEMBER_PARSERS_={"http://www.opengis.net/gml":{Polygon:bf(Kf.prototype.readPolygon),Surface:bf(od.prototype.readSurface_)}},od.prototype.SURFACE_PARSERS_={"http://www.opengis.net/gml":{patches:Pf(od.prototype.readPatch_)}},od.prototype.CURVE_PARSERS_={"http://www.opengis.net/gml":{segments:Pf(od.prototype.readSegment_)}},od.prototype.ENVELOPE_PARSERS_={"http://www.opengis.net/gml":{lowerCorner:bf(od.prototype.readFlatPosList_),upperCorner:bf(od.prototype.readFlatPosList_)}},od.prototype.PATCHES_PARSERS_={"http://www.opengis.net/gml":{PolygonPatch:Pf(od.prototype.readPolygonPatch_)}},od.prototype.SEGMENTS_PARSERS_={"http://www.opengis.net/gml":{LineStringSegment:Pf(od.prototype.readLineStringSegment_)}},od.prototype.writeFeatures,od.prototype.RING_SERIALIZERS_={"http://www.opengis.net/gml":{exterior:If(od.prototype.writeRing_),interior:If(od.prototype.writeRing_)}},od.prototype.ENVELOPE_SERIALIZERS_={"http://www.opengis.net/gml":{lowerCorner:If(rd),upperCorner:If(rd)}},od.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{surfaceMember:If(od.prototype.writeSurfaceOrPolygonMember_),polygonMember:If(od.prototype.writeSurfaceOrPolygonMember_)}},od.prototype.POINTMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{pointMember:If(od.prototype.writePointMember_)}},od.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{lineStringMember:If(od.prototype.writeLineStringOrCurveMember_),curveMember:If(od.prototype.writeLineStringOrCurveMember_)}},od.prototype.GEOMETRY_SERIALIZERS_={"http://www.opengis.net/gml":{Curve:If(od.prototype.writeCurveOrLineString_),MultiCurve:If(od.prototype.writeMultiCurveOrLineString_),Point:If(od.prototype.writePoint_),MultiPoint:If(od.prototype.writeMultiPoint_),LineString:If(od.prototype.writeCurveOrLineString_),MultiLineString:If(od.prototype.writeMultiCurveOrLineString_),LinearRing:If(od.prototype.writeLinearRing_),Polygon:If(od.prototype.writeSurfaceOrPolygon_),MultiPolygon:If(od.prototype.writeMultiSurfaceOrPolygon_),Surface:If(od.prototype.writeSurfaceOrPolygon_),MultiSurface:If(od.prototype.writeMultiSurfaceOrPolygon_),Envelope:If(od.prototype.writeEnvelope)}};var ad=od,sd=ad;sd.prototype.writeFeatures,sd.prototype.writeFeaturesNode;var ud,ld,hd,cd,pd,fd,dd,_d=sd,gd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yd=["http://www.google.com/kml/ext/2.2"],vd=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],md={fraction:fs.FRACTION,pixels:fs.PIXELS,insetPixels:fs.PIXELS},xd=Af(vd,{ExtendedData:f_,Region:d_,MultiGeometry:Of(i_,"geometry"),LineString:Of(e_,"geometry"),LinearRing:Of(r_,"geometry"),Point:Of(o_,"geometry"),Polygon:Of(s_,"geometry"),Style:Of(l_),StyleMap:function(t,e){var r=zd.call(this,t,e);if(!r)return;var n=e[e.length-1];Array.isArray(r)?n.Style=r:"string"==typeof r?n.styleUrl=r:wt(!1,38)},address:Of($f),description:Of($f),name:Of($f),open:Of(qf),phoneNumber:Of($f),styleUrl:Of(Dd),visibility:Of(qf)},Af(yd,{MultiTrack:Of((function(t,e){var r=Gf([],Kd,t,e);if(!r)return;return new Kc(r)}),"geometry"),Track:Of(Hd,"geometry")})),Ed=Af(vd,{ExtendedData:f_,Region:d_,Link:function(t,e){Nf(Sd,t,e)},address:Of($f),description:Of($f),name:Of($f),open:Of(qf),phoneNumber:Of($f),visibility:Of(qf)}),Sd=Af(vd,{href:Of(Dd)}),wd=Af(vd,{LatLonAltBox:function(t,e){var r=Gf({},y_,t,e);if(!r)return;var n=e[e.length-1],i=[parseFloat(r.west),parseFloat(r.south),parseFloat(r.east),parseFloat(r.north)];n.extent=i,n.altitudeMode=r.altitudeMode,n.minAltitude=parseFloat(r.minAltitude),n.maxAltitude=parseFloat(r.maxAltitude)},Lod:function(t,e){var r=Gf({},v_,t,e);if(!r)return;var n=e[e.length-1];n.minLodPixels=parseFloat(r.minLodPixels),n.maxLodPixels=parseFloat(r.maxLodPixels),n.minFadeExtent=parseFloat(r.minFadeExtent),n.maxFadeExtent=parseFloat(r.maxFadeExtent)}}),Td=Af(vd,["Document","Placemark"]),Cd=Af(vd,{Document:If((function(t,e,r){Df({node:t},w_,T_,e,r,void 0,this)})),Placemark:If(K_)}),Rd=null;var bd,Pd=null;var Od,Id=null;var Ld=null;var Fd=null;var Md,Ad=null;var Nd=function(t){function e(e){var r=t.call(this)||this,n=e||{};return Ad||(Rd=new Ao({color:ud=[255,255,255,1]}),Pd=new bs({anchor:ld=[20,2],anchorOrigin:Cs.BOTTOM_LEFT,anchorXUnits:hd=fs.PIXELS,anchorYUnits:cd=fs.PIXELS,crossOrigin:"anonymous",rotation:0,scale:dd=.5,size:pd=[64,64],src:fd="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"}),bd="NO_IMAGE",Id=new No({color:ud,width:1}),Od=new No({color:[51,51,51,1],width:2}),Ld=new As({font:"bold 16px Helvetica",fill:Rd,stroke:Od,scale:.8}),Fd=new zo({fill:Rd,image:Pd,text:Ld,stroke:Id,zIndex:0}),Ad=[Fd]),r.dataProjection=Sr("EPSG:4326"),r.defaultStyle_=n.defaultStyle?n.defaultStyle:Ad,r.extractStyles_=void 0===n.extractStyles||n.extractStyles,r.writeStyles_=void 0===n.writeStyles||n.writeStyles,r.sharedStyles_={},r.showPointNames_=void 0===n.showPointNames||n.showPointNames,r.crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",r}return gd(e,t),e.prototype.readDocumentOrFolder_=function(t,e){var r=Gf([],Af(vd,{Document:Rf(this.readDocumentOrFolder_,this),Folder:Rf(this.readDocumentOrFolder_,this),Placemark:bf(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this);return r||void 0},e.prototype.readPlacemark_=function(t,e){var r=Gf({geometry:null},xd,t,e,this);if(r){var n=new Ct,i=t.getAttribute("id");null!==i&&n.setId(i);var o=e[0],a=r.geometry;if(a&&pf(a,!1,o),n.setGeometry(a),delete r.geometry,this.extractStyles_){var s=function(t,e,r,n,i){return function(o,a){var s=i,u="",l=[];if(s){var h=o.getGeometry();if(h){var c=h.getType();s=c===Fe.GEOMETRY_COLLECTION?(l=h.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===Fe.POINT||e===Fe.MULTI_POINT}))).length>0:c===Fe.POINT||c===Fe.MULTI_POINT}}s&&(u=o.get("name"),(s=s&&!!u)&&u.search(/&[^&]+;/)>-1&&(Md||(Md=document.createElement("textarea")),Md.innerHTML=u,u=Md.value));var p=r;if(t?p=t:e&&(p=function t(e,r,n){return Array.isArray(e)?e:"string"==typeof e?(!(e in n)&&"#"+e in n&&(e="#"+e),t(n[e],r,n)):r}(e,r,n)),s){var f=function(t,e){var r=[0,0],n="start",i=t.getImage();if(i){var o=i.getImageSize();if(null===o&&(o=pd),2==o.length){var a=i.getScale();r[0]=a*o[0]/2,r[1]=-a*o[1]/2,n="left"}}var s=t.getText();s?((s=s.clone()).setFont(s.getFont()||Ld.getFont()),s.setScale(s.getScale()||Ld.getScale()),s.setFill(s.getFill()||Ld.getFill()),s.setStroke(s.getStroke()||Od)):s=Ld.clone();return s.setText(e),s.setOffsetX(r[0]),s.setOffsetY(r[1]),s.setTextAlign(n),new zo({image:i,text:s})}(p[0],u);return l.length>0?(f.setGeometry(new hf(l)),[f,new zo({geometry:p[0].getGeometry(),image:null,fill:p[0].getFill(),stroke:p[0].getStroke(),text:null})].concat(p.slice(1))):f}return p}}(r.Style,r.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(s)}return delete r.Style,n.setProperties(r,!0),n}},e.prototype.readSharedStyle_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=l_.call(this,t,e);if(n){var i=void 0,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readSharedStyleMap_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=zd.call(this,t,e);if(n){var i,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readFeatureFromNode=function(t,e){if(!D(vd,t.namespaceURI))return null;var r=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return r||null},e.prototype.readFeaturesFromNode=function(t,e){if(!D(vd,t.namespaceURI))return[];var r,n=t.localName;if("Document"==n||"Folder"==n)return(r=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==n){var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){r=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var a=this.readFeaturesFromNode(o,e);a&&z(r,a)}return r}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=Cf(t);return this.readNameFromDocument(e)}return Tf(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var r=this.readNameFromNode(e);if(r)return r}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(D(vd,e.namespaceURI)&&"name"==e.localName)return $f(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var r=e.localName;if(D(vd,e.namespaceURI)&&("Document"==r||"Folder"==r||"Placemark"==r||"kml"==r)){var n=this.readNameFromNode(e);if(n)return n}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var r=Cf(t);z(e,this.readNetworkLinksFromDocument(r))}else Tf(t)?z(e,this.readNetworkLinksFromDocument(t)):z(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&z(e,this.readNetworkLinksFromNode(r));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(D(vd,r.namespaceURI)&&"NetworkLink"==r.localName){var n=Gf({},Ed,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!D(vd,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||z(e,this.readNetworkLinksFromNode(r))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var r=Cf(t);z(e,this.readRegionFromDocument(r))}else Tf(t)?z(e,this.readRegionFromDocument(t)):z(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&z(e,this.readRegionFromNode(r));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(D(vd,r.namespaceURI)&&"Region"==r.localName){var n=Gf({},wd,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!D(vd,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||z(e,this.readRegionFromNode(r))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=Sf(vd[4],"kml"),n="http://www.w3.org/2000/xmlns/";r.setAttributeNS(n,"xmlns:gx",yd[0]),r.setAttributeNS(n,"xmlns:xsi",Ef),r.setAttributeNS(Ef,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var i={node:r},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var a=Td[r.namespaceURI],s=Mf(o,a);return Df(i,Cd,Ff,s,[e],a,this),r},e}(Yf);function Gd(t){var e=wf(t,!1),r=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(r){var n=r[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function jd(t){for(var e,r=wf(t,!1),n=[],i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;e=i.exec(r);){var o=parseFloat(e[1]),a=parseFloat(e[2]),s=e[3]?parseFloat(e[3]):0;n.push(o,a,s),r=r.substr(e[0].length)}if(""===r)return n}function Dd(t){var e=wf(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function kd(t){return Hf(t)}var Ud=Af(vd,{Pair:function(t,e){var r=Gf({},__,t,e,this);if(!r)return;var n=r.key;if(n&&"normal"==n){var i=r.styleUrl;i&&(e[e.length-1]=i);var o=r.Style;o&&(e[e.length-1]=o)}}});function zd(t,e){return Gf(void 0,Ud,t,e,this)}var Bd=Af(vd,{Icon:Of((function(t,e){var r=Gf({},Jd,t,e);return r||null})),color:Of(Gd),heading:Of(Hf),hotSpot:Of((function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?Cs.BOTTOM_LEFT:Cs.TOP_LEFT:"insetPixels"!==n?Cs.BOTTOM_RIGHT:Cs.TOP_RIGHT,{x:parseFloat(t.getAttribute("x")),xunits:md[r],y:parseFloat(t.getAttribute("y")),yunits:md[n],origin:e}})),scale:Of(kd)});var Yd=Af(vd,{color:Of(Gd),scale:Of(kd)});var Xd=Af(vd,{color:Of(Gd),width:Of(Hf)});var Vd=Af(vd,{color:Of(Gd),fill:Of(qf),outline:Of(qf)});var Wd=Af(vd,{coordinates:Pf(jd)});function Zd(t,e){return Gf(null,Wd,t,e)}var Kd=Af(yd,{Track:bf(Hd)});var qd=Af(vd,{when:function(t,e){var r=e[e.length-1].whens,n=wf(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},Af(yd,{coord:function(t,e){var r=e[e.length-1].flatCoordinates,n=wf(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(i){var o=parseFloat(i[1]),a=parseFloat(i[2]),s=parseFloat(i[3]);r.push(o,a,s,0)}else r.push(0,0,0,0)}}));function Hd(t,e){var r=Gf({flatCoordinates:[],whens:[]},qd,t,e);if(r){for(var n=r.flatCoordinates,i=r.whens,o=0,a=Math.min(n.length,i.length);o<a;++o)n[4*o+3]=i[o];return new Ds(n,Le)}}var Jd=Af(vd,{href:Of(Dd)},Af(yd,{x:Of(Hf),y:Of(Hf),w:Of(Hf),h:Of(Hf)}));var Qd=Af(vd,{coordinates:Pf(jd)});function $d(t,e){return Gf(null,Qd,t,e)}var t_=Af(vd,{extrude:Of(qf),tessellate:Of(qf),altitudeMode:Of($f)});function e_(t,e){var r=Gf({},t_,t,e),n=$d(t,e);if(n){var i=new Ds(n,Oe);return i.setProperties(r,!0),i}}function r_(t,e){var r=Gf({},t_,t,e),n=$d(t,e);if(n){var i=new Wn(n,Oe,[n.length]);return i.setProperties(r,!0),i}}var n_=Af(vd,{LineString:bf(e_),LinearRing:bf(r_),MultiGeometry:bf(i_),Point:bf(o_),Polygon:bf(s_)});function i_(t,e){var r,n=Gf([],n_,t,e);if(!n)return null;if(0===n.length)return new hf(n);for(var i=!0,o=n[0].getType(),a=1,s=n.length;a<s;++a)if(n[a].getType()!=o){i=!1;break}if(i){var u=void 0,l=void 0;if(o==Fe.POINT){var h=n[0];u=h.getLayout(),l=h.getFlatCoordinates();for(a=1,s=n.length;a<s;++a)z(l,n[a].getFlatCoordinates());h_(r=new Hc(l,u),n)}else o==Fe.LINE_STRING?h_(r=new Kc(n),n):o==Fe.POLYGON?h_(r=new Qc(n),n):o==Fe.GEOMETRY_COLLECTION?r=new hf(n):wt(!1,37)}else r=new hf(n);return r}function o_(t,e){var r=Gf({},t_,t,e),n=$d(t,e);if(n){var i=new Ln(n,Oe);return i.setProperties(r,!0),i}}var a_=Af(vd,{innerBoundaryIs:function(t,e){var r=Gf(void 0,m_,t,e);if(r){e[e.length-1].push(r)}},outerBoundaryIs:function(t,e){var r=Gf(void 0,x_,t,e);if(r){e[e.length-1][0]=r}}});function s_(t,e){var r=Gf({},t_,t,e),n=Gf([null],a_,t,e);if(n&&n[0]){for(var i=n[0],o=[i.length],a=1,s=n.length;a<s;++a)z(i,n[a]),o.push(i.length);var u=new Wn(i,Oe,o);return u.setProperties(r,!0),u}}var u_=Af(vd,{IconStyle:function(t,e){var r=Gf({},Bd,t,e);if(r){var n,i,o,a,s=e[e.length-1],u="Icon"in r?r.Icon:{},l=!("Icon"in r)||Object.keys(u).length>0,h=u.href;h?n=h:l&&(n=fd);var c,p=Cs.BOTTOM_LEFT,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):n===fd?(i=ld,o=hd,a=cd):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(i=[.5,0],o=fs.FRACTION,a=fs.FRACTION);var d,_=u.x,g=u.y;void 0!==_&&void 0!==g&&(c=[_,g]);var y,v=u.w,m=u.h;void 0!==v&&void 0!==m&&(d=[v,m]);var x=r.heading;void 0!==x&&(y=ze(x));var E=r.scale,S=r.color;if(l){n==fd&&(d=pd,void 0===E&&(E=dd));var w=new bs({anchor:i,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:Cs.BOTTOM_LEFT,rotation:y,scale:E,size:d,src:n,color:S});s.imageStyle=w}else s.imageStyle=bd}},LabelStyle:function(t,e){var r=Gf({},Yd,t,e);if(r){var n=e[e.length-1],i=new As({fill:new Ao({color:"color"in r?r.color:ud}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=Gf({},Xd,t,e);if(r){var n=e[e.length-1],i=new No({color:"color"in r?r.color:ud,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=Gf({},Vd,t,e);if(r){var n=e[e.length-1],i=new Ao({color:"color"in r?r.color:ud});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var a=r.outline;void 0!==a&&(n.outline=a)}}});function l_(t,e){var r=Gf({},u_,t,e,this);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:Rd,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=bd&&(n=r.imageStyle):n=Pd;var a="textStyle"in r?r.textStyle:Ld,s="strokeStyle"in r?r.strokeStyle:Id,u=r.outline;return void 0===u||u?[new zo({fill:i,image:n,stroke:s,text:a,zIndex:void 0})]:[new zo({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===Fe.GEOMETRY_COLLECTION?new hf(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==Fe.POLYGON&&e!==Fe.MULTI_POLYGON}))):r!==Fe.POLYGON&&r!==Fe.MULTI_POLYGON?e:void 0},fill:i,image:n,stroke:s,text:a,zIndex:void 0}),new zo({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===Fe.GEOMETRY_COLLECTION?new hf(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===Fe.POLYGON||e===Fe.MULTI_POLYGON}))):r===Fe.POLYGON||r===Fe.MULTI_POLYGON?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function h_(t,e){var r,n,i,o=e.length,a=new Array(e.length),s=new Array(e.length),u=new Array(e.length);r=!1,n=!1,i=!1;for(var l=0;l<o;++l){var h=e[l];a[l]=h.get("extrude"),s[l]=h.get("tessellate"),u[l]=h.get("altitudeMode"),r=r||void 0!==a[l],n=n||void 0!==s[l],i=i||u[l]}r&&t.set("extrude",a),n&&t.set("tessellate",s),i&&t.set("altitudeMode",u)}var c_=Af(vd,{displayName:Of($f),value:Of($f)});var p_=Af(vd,{Data:function(t,e){var r=t.getAttribute("name");Nf(c_,t,e);var n=e[e.length-1];r&&n.displayName?n[r]={value:n.value,displayName:n.displayName,toString:function(){return n.value}}:null!==r?n[r]=n.value:null!==n.displayName&&(n[n.displayName]=n.value),delete n.value},SchemaData:function(t,e){Nf(g_,t,e)}});function f_(t,e){Nf(p_,t,e)}function d_(t,e){Nf(wd,t,e)}var __=Af(vd,{Style:Of(l_),key:Of($f),styleUrl:Of(Dd)});var g_=Af(vd,{SimpleData:function(t,e){var r=t.getAttribute("name");if(null!==r){var n=$f(t);e[e.length-1][r]=n}}});var y_=Af(vd,{altitudeMode:Of($f),minAltitude:Of(Hf),maxAltitude:Of(Hf),north:Of(Hf),south:Of(Hf),east:Of(Hf),west:Of(Hf)});var v_=Af(vd,{minLodPixels:Of(Hf),maxLodPixels:Of(Hf),minFadeExtent:Of(Hf),maxFadeExtent:Of(Hf)});var m_=Af(vd,{LinearRing:Pf(Zd)});var x_=Af(vd,{LinearRing:Pf(Zd)});function E_(t,e){for(var r=ki(e),n=[255*(4==r.length?r[3]:1),r[2],r[1],r[0]],i=0;i<4;++i){var o=Math.floor(n[i]).toString(16);n[i]=1==o.length?"0"+o:o}rd(t,n.join(""))}var S_=Af(vd,{Data:If((function(t,e,r){t.setAttribute("name",e.name);var n={node:t},i=e.value;"object"==typeof i?(null!==i&&i.displayName&&Df(n,S_,Ff,[i.displayName],r,["displayName"]),null!==i&&i.value&&Df(n,S_,Ff,[i.value],r,["value"])):Df(n,S_,Ff,[i],r,["value"])})),value:If((function(t,e){rd(t,e)})),displayName:If((function(t,e){!function(t,e){t.appendChild(zf().createCDATASection(e))}(t,e)}))});var w_=Af(vd,{Placemark:If(K_)}),T_=function(t,e,r){return Sf(e[e.length-1].node.namespaceURI,"Placemark")};var C_=Lf("Data");var R_=Af(vd,["href"],Af(yd,["x","y","w","h"])),b_=Af(vd,{href:If(rd)},Af(yd,{x:If(ed),y:If(ed),w:If(ed),h:If(ed)})),P_=function(t,e,r){return Sf(yd[0],"gx:"+r)};var O_=Af(vd,["scale","heading","Icon","color","hotSpot"]),I_=Af(vd,{Icon:If((function(t,e,r){var n={node:t},i=r[r.length-1].node,o=R_[i.namespaceURI],a=Mf(e,o);Df(n,b_,Ff,a,r,o),a=Mf(e,o=R_[yd[0]]),Df(n,b_,P_,a,r,o)})),color:If(E_),heading:If(ed),hotSpot:If((function(t,e){t.setAttribute("x",String(e.x)),t.setAttribute("y",String(e.y)),t.setAttribute("xunits",e.xunits),t.setAttribute("yunits",e.yunits)})),scale:If(ig)});var L_=Af(vd,["color","scale"]),F_=Af(vd,{color:If(E_),scale:If(ig)});var M_=Af(vd,["color","width"]),A_=Af(vd,{color:If(E_),width:If(ed)});var N_={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry",GeometryCollection:"MultiGeometry"},G_=function(t,e,r){if(t)return Sf(e[e.length-1].node.namespaceURI,N_[t.getType()])},j_=Lf("Point"),D_=Lf("LineString"),k_=Lf("LinearRing"),U_=Lf("Polygon"),z_=Af(vd,{LineString:If(J_),Point:If(J_),Polygon:If(rg),GeometryCollection:If(B_)});function B_(t,e,r){var n,i={node:t},o=e.getType(),a=[];o===Fe.GEOMETRY_COLLECTION?(e.getGeometriesArrayRecursive().forEach((function(t){var e=t.getType();e===Fe.MULTI_POINT?a=a.concat(t.getPoints()):e===Fe.MULTI_LINE_STRING?a=a.concat(t.getLineStrings()):e===Fe.MULTI_POLYGON?a=a.concat(t.getPolygons()):e===Fe.POINT||e===Fe.LINE_STRING||e===Fe.POLYGON?a.push(t):wt(!1,39)})),n=G_):o===Fe.MULTI_POINT?(a=e.getPoints(),n=j_):o===Fe.MULTI_LINE_STRING?(a=e.getLineStrings(),n=D_):o===Fe.MULTI_POLYGON?(a=e.getPolygons(),n=U_):wt(!1,39),Df(i,z_,n,a,r)}var Y_=Af(vd,{LinearRing:If(J_)});function X_(t,e,r){Df({node:t},Y_,k_,[e],r)}var V_=Af(vd,{ExtendedData:If((function(t,e,r){for(var n={node:t},i=e.names,o=e.values,a=i.length,s=0;s<a;s++)Df(n,S_,C_,[{name:i[s],value:o[s]}],r)})),MultiGeometry:If(B_),LineString:If(J_),LinearRing:If(J_),Point:If(J_),Polygon:If(rg),Style:If((function(t,e,r){var n={node:t},i={};if(e.pointStyles.length){var o=e.pointStyles[0].getText();o&&(i.LabelStyle=o);var a=e.pointStyles[0].getImage();a&&"function"==typeof a.getSrc&&(i.IconStyle=a)}if(e.lineStyles.length){(s=e.lineStyles[0].getStroke())&&(i.LineStyle=s)}if(e.polyStyles.length){var s;(s=e.polyStyles[0].getStroke())&&!i.LineStyle&&(i.LineStyle=s),i.PolyStyle=e.polyStyles[0]}var u=r[r.length-1].node,l=og[u.namespaceURI],h=Mf(i,l);Df(n,ag,Ff,h,r,l)})),address:If(rd),description:If(rd),name:If(rd),open:If(td),phoneNumber:If(rd),styleUrl:If(rd),visibility:If(td)}),W_=Af(vd,["name","open","visibility","address","phoneNumber","description","styleUrl","Style"]),Z_=Lf("ExtendedData");function K_(t,e,r){var n={node:t};e.getId()&&t.setAttribute("id",e.getId());var i=e.getProperties(),o={address:1,description:1,name:1,open:1,phoneNumber:1,styleUrl:1,visibility:1};o[e.getGeometryName()]=1;var a=Object.keys(i||{}).sort().filter((function(t){return!o[t]})),s=e.getStyleFunction();if(s){var u=s(e,0);if(u){var l=Array.isArray(u)?u:[u],h=l;if(e.getGeometry()&&(h=l.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return n===Fe.GEOMETRY_COLLECTION?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===Fe.POINT||e===Fe.MULTI_POINT})).length:n===Fe.POINT||n===Fe.MULTI_POINT}}))),this.writeStyles_){var c=l,p=l;e.getGeometry()&&(c=l.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return n===Fe.GEOMETRY_COLLECTION?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===Fe.LINE_STRING||e===Fe.MULTI_LINE_STRING})).length:n===Fe.LINE_STRING||n===Fe.MULTI_LINE_STRING}})),p=l.filter((function(t){var r=t.getGeometryFunction()(e);if(r){var n=r.getType();return n===Fe.GEOMETRY_COLLECTION?r.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===Fe.POLYGON||e===Fe.MULTI_POLYGON})).length:n===Fe.POLYGON||n===Fe.MULTI_POLYGON}}))),i.Style={pointStyles:h,lineStyles:c,polyStyles:p}}if(h.length&&void 0===i.name){var f=h[0].getText();f&&(i.name=f.getText())}}}var d=r[r.length-1].node,_=W_[d.namespaceURI],g=Mf(i,_);if(Df(n,V_,Ff,g,r,_),a.length>0){var y=Mf(i,a);Df(n,V_,Z_,[{names:a,values:y}],r)}var v=r[0],m=e.getGeometry();m&&(m=pf(m,!0,v)),Df(n,V_,G_,[m],r)}var q_=Af(vd,["extrude","tessellate","altitudeMode","coordinates"]),H_=Af(vd,{extrude:If(td),tessellate:If(td),altitudeMode:If(rd),coordinates:If((function(t,e,r){var n,i=r[r.length-1],o=i.layout,a=i.stride;o==Pe||o==Ie?n=2:o==Oe||o==Le?n=3:wt(!1,34);var s=e.length,u="";if(s>0){u+=e[0];for(var l=1;l<n;++l)u+=","+e[l];for(var h=a;h<s;h+=a){u+=" "+e[h];for(l=1;l<n;++l)u+=","+e[h+l]}}rd(t,u)}))});function J_(t,e,r){var n=e.getFlatCoordinates(),i={node:t};i.layout=e.getLayout(),i.stride=e.getStride();var o=e.getProperties();o.coordinates=n;var a=r[r.length-1].node,s=q_[a.namespaceURI],u=Mf(o,s);Df(i,H_,Ff,u,r,s)}var Q_=Af(vd,["color","fill","outline"]),$_=Af(vd,{outerBoundaryIs:If(X_),innerBoundaryIs:If(X_)}),tg=Lf("innerBoundaryIs"),eg=Lf("outerBoundaryIs");function rg(t,e,r){var n=e.getLinearRings(),i=n.shift(),o={node:t};Df(o,$_,tg,n,r),Df(o,$_,eg,[i],r)}var ng=Af(vd,{color:If(E_),fill:If(td),outline:If(td)});function ig(t,e){ed(t,Math.round(1e6*e)/1e6)}var og=Af(vd,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),ag=Af(vd,{IconStyle:If((function(t,e,r){var n={node:t},i={},o=e.getSrc(),a=e.getSize(),s=e.getImageSize(),u={href:o};if(a){u.w=a[0],u.h=a[1];var l=e.getAnchor(),h=e.getOrigin();if(h&&s&&0!==h[0]&&h[1]!==a[1]&&(u.x=h[0],u.y=s[1]-(h[1]+a[1])),l&&(l[0]!==a[0]/2||l[1]!==a[1]/2)){var c={x:l[0],xunits:fs.PIXELS,y:a[1]-l[1],yunits:fs.PIXELS};i.hotSpot=c}}i.Icon=u;var p=e.getScale();1!==p&&(i.scale=p);var f=e.getRotation();0!==f&&(i.heading=f);var d=e.getColor();d&&(i.color=d);var _=r[r.length-1].node,g=O_[_.namespaceURI],y=Mf(i,g);Df(n,I_,Ff,y,r,g)})),LabelStyle:If((function(t,e,r){var n={node:t},i={},o=e.getFill();o&&(i.color=o.getColor());var a=e.getScale();a&&1!==a&&(i.scale=a);var s=r[r.length-1].node,u=L_[s.namespaceURI],l=Mf(i,u);Df(n,F_,Ff,l,r,u)})),LineStyle:If((function(t,e,r){var n={node:t},i={color:e.getColor(),width:Number(e.getWidth())||1},o=r[r.length-1].node,a=M_[o.namespaceURI],s=Mf(i,a);Df(n,A_,Ff,s,r,a)})),PolyStyle:If((function(t,e,r){var n={node:t},i=e.getFill(),o=e.getStroke(),a={color:i?i.getColor():void 0,fill:!!i&&void 0,outline:!!o&&void 0},s=r[r.length-1].node,u=Q_[s.namespaceURI],l=Mf(a,u);Df(n,ng,Ff,l,r,u)}))});var sg=Nd,ug=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lg={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"},hg=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,n)||this).FEATURE_COLLECTION_PARSERS[Vf].featureMember=bf(r.readFeaturesInternal),r.schemaLocation=n.schemaLocation?n.schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd",r}return ug(e,t),e.prototype.readFlatCoordinates_=function(t,e){var r=wf(t,!1).replace(/^\s*|\s*$/g,""),n=e[0].srsName,i="enu";if(n){var o=Sr(n);o&&(i=o.getAxisOrientation())}for(var a=r.trim().split(/\s+/),s=[],u=0,l=a.length;u<l;u++){var h=a[u].split(/,+/),c=parseFloat(h[0]),p=parseFloat(h[1]),f=3===h.length?parseFloat(h[2]):0;"en"===i.substr(0,2)?s.push(c,p,f):s.push(p,c,f)}return s},e.prototype.readBox_=function(t,e){var r=Gf([null],this.BOX_PARSERS_,t,e,this);return Vt(r[1][0],r[1][1],r[1][3],r[1][4])},e.prototype.innerBoundaryIsParser_=function(t,e){var r=Gf(void 0,this.RING_PARSERS,t,e,this);r&&e[e.length-1].push(r)},e.prototype.outerBoundaryIsParser_=function(t,e){var r=Gf(void 0,this.RING_PARSERS,t,e,this);r&&(e[e.length-1][0]=r)},e.prototype.GEOMETRY_NODE_FACTORY_=function(t,e,r){var n,i=e[e.length-1],o=i.multiSurface,a=i.surface,s=i.multiCurve;return Array.isArray(t)?n="Envelope":"MultiPolygon"===(n=t.getType())&&!0===o?n="MultiSurface":"Polygon"===n&&!0===a?n="Surface":"MultiLineString"===n&&!0===s&&(n="MultiCurve"),Sf("http://www.opengis.net/gml",n)},e.prototype.writeFeatureElement=function(t,e,r){var n=e.getId();n&&t.setAttribute("fid",n);var i=r[r.length-1],o=i.featureNS,a=e.getGeometryName();i.serializers||(i.serializers={},i.serializers[o]={});var s=e.getProperties(),u=[],l=[];for(var h in s){var c=s[h];null!==c&&(u.push(h),l.push(c),h==a||"function"==typeof c.getSimplifiedGeometry?h in i.serializers[o]||(i.serializers[o][h]=If(this.writeGeometryElement,this)):h in i.serializers[o]||(i.serializers[o][h]=If(rd)))}var p=O({},i);p.node=t,Df(p,i.serializers,Lf(void 0,o),l,r,u)},e.prototype.writeCurveOrLineString_=function(t,e,r){var n=r[r.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){var i=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(i),this.writeCoordinates_(i,e,r)}else if("Curve"===t.nodeName){var o=Sf(t.namespaceURI,"segments");t.appendChild(o),this.writeCurveSegments_(o,e,r)}},e.prototype.writeLineStringOrCurveMember_=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeCurveOrLineString_(n,e,r))},e.prototype.writeMultiCurveOrLineString_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,a=n.curve;o&&t.setAttribute("srsName",o);var s=e.getLineStrings();Df({node:t,hasZ:i,srsName:o,curve:a},this.LINESTRINGORCURVEMEMBER_SERIALIZERS_,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,s,r,void 0,this)},e.prototype.writeGeometryElement=function(t,e,r){var n,i=r[r.length-1],o=O({},i);o.node=t,n=Array.isArray(e)?ff(e,i):pf(e,!0,i),Df(o,this.GEOMETRY_SERIALIZERS_,this.GEOMETRY_NODE_FACTORY_,[n],r,void 0,this)},e.prototype.createCoordinatesNode_=function(t){var e=Sf(t,"coordinates");return e.setAttribute("decimal","."),e.setAttribute("cs",","),e.setAttribute("ts"," "),e},e.prototype.writeCoordinates_=function(t,e,r){for(var n=r[r.length-1],i=n.hasZ,o=n.srsName,a=e.getCoordinates(),s=a.length,u=new Array(s),l=0;l<s;++l){var h=a[l];u[l]=this.getCoords_(h,o,i)}rd(t,u.join(" "))},e.prototype.writeCurveSegments_=function(t,e,r){var n=Sf(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString_(n,e,r)},e.prototype.writeSurfaceOrPolygon_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;if("PolygonPatch"!==t.nodeName&&o&&t.setAttribute("srsName",o),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){var a=e.getLinearRings();Df({node:t,hasZ:i,srsName:o},this.RING_SERIALIZERS_,this.RING_NODE_FACTORY_,a,r,void 0,this)}else if("Surface"===t.nodeName){var s=Sf(t.namespaceURI,"patches");t.appendChild(s),this.writeSurfacePatches_(s,e,r)}},e.prototype.RING_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1],i=n.node,o=n.exteriorWritten;return void 0===o&&(n.exteriorWritten=!0),Sf(i.namespaceURI,void 0!==o?"innerBoundaryIs":"outerBoundaryIs")},e.prototype.writeSurfacePatches_=function(t,e,r){var n=Sf(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon_(n,e,r)},e.prototype.writeRing_=function(t,e,r){var n=Sf(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing_(n,e,r)},e.prototype.getCoords_=function(t,e,r){var n="enu";e&&(n=Sr(e).getAxisOrientation());var i="en"===n.substr(0,2)?t[0]+","+t[1]:t[1]+","+t[0];r&&(i+=","+(t[2]||0));return i},e.prototype.writePoint_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;o&&t.setAttribute("srsName",o);var a=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(a);var s=e.getCoordinates();rd(a,this.getCoords_(s,o,i))},e.prototype.writeMultiPoint_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName;o&&t.setAttribute("srsName",o);var a=e.getPoints();Df({node:t,hasZ:i,srsName:o},this.POINTMEMBER_SERIALIZERS_,Lf("pointMember"),a,r,void 0,this)},e.prototype.writePointMember_=function(t,e,r){var n=Sf(t.namespaceURI,"Point");t.appendChild(n),this.writePoint_(n,e,r)},e.prototype.writeLinearRing_=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=this.createCoordinatesNode_(t.namespaceURI);t.appendChild(i),this.writeCoordinates_(i,e,r)},e.prototype.writeMultiSurfaceOrPolygon_=function(t,e,r){var n=r[r.length-1],i=n.hasZ,o=n.srsName,a=n.surface;o&&t.setAttribute("srsName",o);var s=e.getPolygons();Df({node:t,hasZ:i,srsName:o,surface:a},this.SURFACEORPOLYGONMEMBER_SERIALIZERS_,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,s,r,void 0,this)},e.prototype.writeSurfaceOrPolygonMember_=function(t,e,r){var n=this.GEOMETRY_NODE_FACTORY_(e,r);n&&(t.appendChild(n),this.writeSurfaceOrPolygon_(n,e,r))},e.prototype.writeEnvelope=function(t,e,r){var n=r[r.length-1].srsName;n&&t.setAttribute("srsName",n);var i=[e[0]+" "+e[1],e[2]+" "+e[3]];Df({node:t},this.ENVELOPE_SERIALIZERS_,Ff,i,r,["lowerCorner","upperCorner"],this)},e.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_=function(t,e,r){var n=e[e.length-1].node;return Sf("http://www.opengis.net/gml",lg[n.nodeName])},e}(Kf);hg.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{coordinates:Pf(hg.prototype.readFlatCoordinates_)}},hg.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{innerBoundaryIs:hg.prototype.innerBoundaryIsParser_,outerBoundaryIs:hg.prototype.outerBoundaryIsParser_}},hg.prototype.BOX_PARSERS_={"http://www.opengis.net/gml":{coordinates:bf(hg.prototype.readFlatCoordinates_)}},hg.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:Pf(Kf.prototype.readPoint),MultiPoint:Pf(Kf.prototype.readMultiPoint),LineString:Pf(Kf.prototype.readLineString),MultiLineString:Pf(Kf.prototype.readMultiLineString),LinearRing:Pf(Kf.prototype.readLinearRing),Polygon:Pf(Kf.prototype.readPolygon),MultiPolygon:Pf(Kf.prototype.readMultiPolygon),Box:Pf(hg.prototype.readBox_)}},hg.prototype.GEOMETRY_SERIALIZERS_={"http://www.opengis.net/gml":{Curve:If(hg.prototype.writeCurveOrLineString_),MultiCurve:If(hg.prototype.writeMultiCurveOrLineString_),Point:If(hg.prototype.writePoint_),MultiPoint:If(hg.prototype.writeMultiPoint_),LineString:If(hg.prototype.writeCurveOrLineString_),MultiLineString:If(hg.prototype.writeMultiCurveOrLineString_),LinearRing:If(hg.prototype.writeLinearRing_),Polygon:If(hg.prototype.writeSurfaceOrPolygon_),MultiPolygon:If(hg.prototype.writeMultiSurfaceOrPolygon_),Surface:If(hg.prototype.writeSurfaceOrPolygon_),MultiSurface:If(hg.prototype.writeMultiSurfaceOrPolygon_),Envelope:If(hg.prototype.writeEnvelope)}},hg.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{lineStringMember:If(hg.prototype.writeLineStringOrCurveMember_),curveMember:If(hg.prototype.writeLineStringOrCurveMember_)}},hg.prototype.RING_SERIALIZERS_={"http://www.opengis.net/gml":{outerBoundaryIs:If(hg.prototype.writeRing_),innerBoundaryIs:If(hg.prototype.writeRing_)}},hg.prototype.POINTMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{pointMember:If(hg.prototype.writePointMember_)}},hg.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_={"http://www.opengis.net/gml":{surfaceMember:If(hg.prototype.writeSurfaceOrPolygonMember_),polygonMember:If(hg.prototype.writeSurfaceOrPolygonMember_)}},hg.prototype.ENVELOPE_SERIALIZERS_={"http://www.opengis.net/gml":{lowerCorner:If(rd),upperCorner:If(rd)}};var cg=hg,pg=function(){function t(t){this.tagName_=t}return t.prototype.getTagName=function(){return this.tagName_},t}(),fg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dg=function(t){function e(e,r){var n=t.call(this,e)||this;return n.conditions=r,wt(n.conditions.length>=2,57),n}return fg(e,t),e}(pg),_g=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gg=function(t){function e(e){return t.call(this,"And",Array.prototype.slice.call(arguments))||this}return _g(e,t),e}(dg),yg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vg=function(t){function e(e,r,n){var i=t.call(this,"BBOX")||this;if(i.geometryName=e,i.extent=r,4!==r.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");return i.srsName=n,i}return yg(e,t),e}(pg),mg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xg=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.geometryName=r||"the_geom",o.geometry=n,o.srsName=i,o}return mg(e,t),e}(pg),Eg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Sg=(function(t){function e(e,r,n){return t.call(this,"Contains",e,r,n)||this}Eg(e,t)}(xg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),wg=function(t){function e(e,r){var n=t.call(this,e)||this;return n.propertyName=r,n}return Sg(e,t),e}(pg),Tg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cg=(function(t){function e(e,r,n){var i=t.call(this,"During",e)||this;return i.begin=r,i.end=n,i}Tg(e,t)}(wg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Rg=function(t){function e(e,r,n,i){var o=t.call(this,e,r)||this;return o.expression=n,o.matchCase=i,o}return Cg(e,t),e}(wg),bg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pg=(function(t){function e(e,r,n){return t.call(this,"PropertyIsEqualTo",e,r,n)||this}bg(e,t)}(Rg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Og=(function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThan",e,r)||this}Pg(e,t)}(Rg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Ig=(function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThanOrEqualTo",e,r)||this}Og(e,t)}(Rg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Lg=(function(t){function e(e,r,n){return t.call(this,"Intersects",e,r,n)||this}Ig(e,t)}(xg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Fg=(function(t){function e(e,r,n){var i=t.call(this,"PropertyIsBetween",e)||this;return i.lowerBoundary=r,i.upperBoundary=n,i}Lg(e,t)}(wg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Mg=(function(t){function e(e,r,n,i,o,a){var s=t.call(this,"PropertyIsLike",e)||this;return s.pattern=r,s.wildCard=void 0!==n?n:"*",s.singleChar=void 0!==i?i:".",s.escapeChar=void 0!==o?o:"!",s.matchCase=a,s}Fg(e,t)}(wg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Ag=(function(t){function e(e){return t.call(this,"PropertyIsNull",e)||this}Mg(e,t)}(wg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Ng=(function(t){function e(e,r){return t.call(this,"PropertyIsLessThan",e,r)||this}Ag(e,t)}(Rg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Gg=(function(t){function e(e,r){return t.call(this,"PropertyIsLessThanOrEqualTo",e,r)||this}Ng(e,t)}(Rg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),jg=(function(t){function e(e){var r=t.call(this,"Not")||this;return r.condition=e,r}Gg(e,t)}(pg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),Dg=(function(t){function e(e,r,n){return t.call(this,"PropertyIsNotEqualTo",e,r,n)||this}jg(e,t)}(Rg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}()),kg=(function(t){function e(e){return t.call(this,"Or",Array.prototype.slice.call(arguments))||this}Dg(e,t)}(dg),function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}());!function(t){function e(e,r,n){return t.call(this,"Within",e,r,n)||this}kg(e,t)}(xg);var Ug=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zg={"http://www.opengis.net/gml":{boundedBy:Of(Kf.prototype.readGeometryElement,"bounds")}},Bg={"http://www.opengis.net/wfs":{totalInserted:Of(Jf),totalUpdated:Of(Jf),totalDeleted:Of(Jf)}},Yg={"http://www.opengis.net/wfs":{TransactionSummary:Of((function(t,e){return Gf({},Bg,t,e)}),"transactionSummary"),InsertResults:Of((function(t,e){return Gf([],Qg,t,e)}),"insertIds")}},Xg={"http://www.opengis.net/wfs":{PropertyName:If(rd)}},Vg={"http://www.opengis.net/wfs":{Insert:If((function(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,a=n.gmlVersion,s=Sf(o,i);t.appendChild(s),2===a?cg.prototype.writeFeatureElement(s,e,r):ad.prototype.writeFeatureElement(s,e,r)})),Update:If((function(t,e,r){var n=r[r.length-1];wt(void 0!==e.getId(),27);var i=n.featureType,o=n.featurePrefix,a=n.featureNS,s=ty(o,i),u=e.getGeometryName();t.setAttribute("typeName",s),t.setAttributeNS(Wg,"xmlns:"+o,a);var l=e.getId();if(void 0!==l){for(var h=e.getKeys(),c=[],p=0,f=h.length;p<f;p++){var d=e.get(h[p]);if(void 0!==d){var _=h[p];d&&"function"==typeof d.getSimplifiedGeometry&&(_=u),c.push({name:_,value:d})}}Df({gmlVersion:n.gmlVersion,node:t,hasZ:n.hasZ,srsName:n.srsName},Vg,Lf("Property"),c,r),$g(t,l,r)}})),Delete:If((function(t,e,r){var n=r[r.length-1];wt(void 0!==e.getId(),26);var i=n.featureType,o=n.featurePrefix,a=n.featureNS,s=ty(o,i);t.setAttribute("typeName",s),t.setAttributeNS(Wg,"xmlns:"+o,a);var u=e.getId();void 0!==u&&$g(t,u,r)})),Property:If((function(t,e,r){var n=Sf(Kg,"Name"),i=r[r.length-1].gmlVersion;if(t.appendChild(n),rd(n,e.name),void 0!==e.value&&null!==e.value){var o=Sf(Kg,"Value");t.appendChild(o),e.value&&"function"==typeof e.value.getSimplifiedGeometry?2===i?cg.prototype.writeGeometryElement(o,e.value,r):ad.prototype.writeGeometryElement(o,e.value,r):rd(o,e.value)}})),Native:If((function(t,e,r){e.vendorId&&t.setAttribute("vendorId",e.vendorId);void 0!==e.safeToIgnore&&t.setAttribute("safeToIgnore",String(e.safeToIgnore));void 0!==e.value&&rd(t,e.value)}))}},Wg="http://www.w3.org/2000/xmlns/",Zg="http://www.opengis.net/ogc",Kg="http://www.opengis.net/wfs",qg={"1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},Hg=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType_=n.featureType,r.featureNS_=n.featureNS,r.gmlFormat_=n.gmlFormat?n.gmlFormat:new ad,r.schemaLocation_=n.schemaLocation?n.schemaLocation:qg["1.1.0"],r}return Ug(e,t),e.prototype.getFeatureType=function(){return this.featureType_},e.prototype.setFeatureType=function(t){this.featureType_=t},e.prototype.readFeaturesFromNode=function(t,e){var r={node:t};O(r,{featureType:this.featureType_,featureNS:this.featureNS_}),O(r,this.getReadOptions(t,e||{}));var n=[r];this.gmlFormat_.FEATURE_COLLECTION_PARSERS[Vf].featureMember=bf(Kf.prototype.readFeaturesInternal);var i=Gf([],this.gmlFormat_.FEATURE_COLLECTION_PARSERS,t,n,this.gmlFormat_);return i||(i=[]),i},e.prototype.readTransactionResponse=function(t){if(t){if("string"==typeof t){var e=Cf(t);return this.readTransactionResponseFromDocument(e)}return Tf(t)?this.readTransactionResponseFromDocument(t):this.readTransactionResponseFromNode(t)}},e.prototype.readFeatureCollectionMetadata=function(t){if(t){if("string"==typeof t){var e=Cf(t);return this.readFeatureCollectionMetadataFromDocument(e)}return Tf(t)?this.readFeatureCollectionMetadataFromDocument(t):this.readFeatureCollectionMetadataFromNode(t)}},e.prototype.readFeatureCollectionMetadataFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(e)},e.prototype.readFeatureCollectionMetadataFromNode=function(t){var e={},r=Qf(t.getAttribute("numberOfFeatures"));return e.numberOfFeatures=r,Gf(e,zg,t,[],this.gmlFormat_)},e.prototype.readTransactionResponseFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(e)},e.prototype.readTransactionResponseFromNode=function(t){return Gf({},Yg,t,[])},e.prototype.writeGetFeature=function(t){var e,r,n,i,o=Sf(Kg,"GetFeature");if(o.setAttribute("service","WFS"),o.setAttribute("version","1.1.0"),t&&(t.handle&&o.setAttribute("handle",t.handle),t.outputFormat&&o.setAttribute("outputFormat",t.outputFormat),void 0!==t.maxFeatures&&o.setAttribute("maxFeatures",String(t.maxFeatures)),t.resultType&&o.setAttribute("resultType",t.resultType),void 0!==t.startIndex&&o.setAttribute("startIndex",String(t.startIndex)),void 0!==t.count&&o.setAttribute("count",String(t.count)),void 0!==t.viewParams&&o.setAttribute("viewParams",t.viewParams),e=t.filter,t.bbox)){wt(t.geometryName,12);var a=(r=t.geometryName,n=t.bbox,i=t.srsName,new vg(r,n,i));e=e?function(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(gg,e))}(e,a):a}o.setAttributeNS(Ef,"xsi:schemaLocation",this.schemaLocation_);var s={node:o};return O(s,{srsName:t.srsName,featureNS:t.featureNS?t.featureNS:this.featureNS_,featurePrefix:t.featurePrefix,geometryName:t.geometryName,filter:e,propertyNames:t.propertyNames?t.propertyNames:[]}),wt(Array.isArray(t.featureTypes),11),function(t,e,r){var n=r[r.length-1],i=O({},n);i.node=t,Df(i,ey,Lf("Query"),e,r)}(o,t.featureTypes,[s]),o},e.prototype.writeTransaction=function(t,e,r,n){var i,o,a=[],s=Sf(Kg,"Transaction"),u=n.version?n.version:"1.1.0",l="1.0.0"===u?2:3;s.setAttribute("service","WFS"),s.setAttribute("version",u),n&&(i=n.gmlOptions?n.gmlOptions:{},n.handle&&s.setAttribute("handle",n.handle));var h=qg[u];s.setAttributeNS(Ef,"xsi:schemaLocation",h);var c=n.featurePrefix?n.featurePrefix:"feature";return t&&(o=O({node:s},{featureNS:n.featureNS,featureType:n.featureType,featurePrefix:c,gmlVersion:l,hasZ:n.hasZ,srsName:n.srsName}),O(o,i),Df(o,Vg,Lf("Insert"),t,a)),e&&(o=O({node:s},{featureNS:n.featureNS,featureType:n.featureType,featurePrefix:c,gmlVersion:l,hasZ:n.hasZ,srsName:n.srsName}),O(o,i),Df(o,Vg,Lf("Update"),e,a)),r&&Df({node:s,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:c,gmlVersion:l,srsName:n.srsName},Vg,Lf("Delete"),r,a),n.nativeElements&&Df({node:s,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:c,gmlVersion:l,srsName:n.srsName},Vg,Lf("Native"),n.nativeElements,a),s},e.prototype.readProjectionFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null},e.prototype.readProjectionFromNode=function(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(var e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){var r=[{}];return this.gmlFormat_.readGeometryElement(e,r),Sr(r.pop().srsName)}return null},e}(Yf);var Jg={"http://www.opengis.net/ogc":{FeatureId:bf((function(t,e){return t.getAttribute("fid")}))}};var Qg={"http://www.opengis.net/wfs":{Feature:function(t,e){Nf(Jg,t,e)}}};function $g(t,e,r){var n=Sf(Zg,"Filter"),i=Sf(Zg,"FeatureId");n.appendChild(i),i.setAttribute("fid",e),t.appendChild(n)}function ty(t,e){var r=(t=t||"feature")+":";return 0===e.indexOf(r)?e:r+e}var ey={"http://www.opengis.net/wfs":{Query:If((function(t,e,r){var n,i=r[r.length-1],o=i.featurePrefix,a=i.featureNS,s=i.propertyNames,u=i.srsName;n=o?ty(o,e):e;t.setAttribute("typeName",n),u&&t.setAttribute("srsName",u);a&&t.setAttributeNS(Wg,"xmlns:"+o,a);var l=O({},i);l.node=t,Df(l,Xg,Lf("PropertyName"),s,r);var h=i.filter;if(h){var c=Sf(Zg,"Filter");t.appendChild(c),ry(c,h,r)}}))},"http://www.opengis.net/ogc":{During:If((function(t,e,r){var n=Sf("http://www.opengis.net/fes","ValueReference");rd(n,e.propertyName),t.appendChild(n);var i=Sf(Vf,"TimePeriod");t.appendChild(i);var o=Sf(Vf,"begin");i.appendChild(o),uy(o,e.begin);var a=Sf(Vf,"end");i.appendChild(a),uy(a,e.end)})),And:If(ny),Or:If(ny),Not:If((function(t,e,r){var n={node:t},i=e.condition;Df(n,ey,Lf(i.getTagName()),[i],r)})),BBOX:If((function(t,e,r){r[r.length-1].srsName=e.srsName,ay(t,e.geometryName),ad.prototype.writeGeometryElement(t,e.extent,r)})),Contains:If((function(t,e,r){r[r.length-1].srsName=e.srsName,ay(t,e.geometryName),ad.prototype.writeGeometryElement(t,e.geometry,r)})),Intersects:If((function(t,e,r){r[r.length-1].srsName=e.srsName,ay(t,e.geometryName),ad.prototype.writeGeometryElement(t,e.geometry,r)})),Within:If((function(t,e,r){r[r.length-1].srsName=e.srsName,ay(t,e.geometryName),ad.prototype.writeGeometryElement(t,e.geometry,r)})),PropertyIsEqualTo:If(iy),PropertyIsNotEqualTo:If(iy),PropertyIsLessThan:If(iy),PropertyIsLessThanOrEqualTo:If(iy),PropertyIsGreaterThan:If(iy),PropertyIsGreaterThanOrEqualTo:If(iy),PropertyIsNull:If((function(t,e,r){ay(t,e.propertyName)})),PropertyIsBetween:If((function(t,e,r){ay(t,e.propertyName);var n=Sf(Zg,"LowerBoundary");t.appendChild(n),sy(n,""+e.lowerBoundary);var i=Sf(Zg,"UpperBoundary");t.appendChild(i),sy(i,""+e.upperBoundary)})),PropertyIsLike:If((function(t,e,r){t.setAttribute("wildCard",e.wildCard),t.setAttribute("singleChar",e.singleChar),t.setAttribute("escapeChar",e.escapeChar),void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString());ay(t,e.propertyName),sy(t,""+e.pattern)}))}};function ry(t,e,r){Df({node:t},ey,Lf(e.getTagName()),[e],r)}function ny(t,e,r){for(var n={node:t},i=e.conditions,o=0,a=i.length;o<a;++o){var s=i[o];Df(n,ey,Lf(s.getTagName()),[s],r)}}function iy(t,e,r){void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),ay(t,e.propertyName),sy(t,""+e.expression)}function oy(t,e,r){var n=Sf(Zg,t);rd(n,r),e.appendChild(n)}function ay(t,e){oy("PropertyName",t,e)}function sy(t,e){oy("Literal",t,e)}function uy(t,e){var r=Sf(Vf,"TimeInstant");t.appendChild(r);var n=Sf(Vf,"timePosition");r.appendChild(n),rd(n,e)}var ly=Hg,hy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function cy(t){return"string"==typeof t?t:""}var py=function(t){function e(){return t.call(this)||this}return hy(e,t),e.prototype.getType=function(){return zs},e.prototype.readFeature=function(t,e){return this.readFeatureFromText(cy(t),this.adaptOptions(e))},e.prototype.readFeatureFromText=function(t,e){return x()},e.prototype.readFeatures=function(t,e){return this.readFeaturesFromText(cy(t),this.adaptOptions(e))},e.prototype.readFeaturesFromText=function(t,e){return x()},e.prototype.readGeometry=function(t,e){return this.readGeometryFromText(cy(t),this.adaptOptions(e))},e.prototype.readGeometryFromText=function(t,e){return x()},e.prototype.readProjection=function(t){return this.readProjectionFromText(cy(t))},e.prototype.readProjectionFromText=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){return this.writeFeatureText(t,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){return x()},e.prototype.writeFeatures=function(t,e){return this.writeFeaturesText(t,this.adaptOptions(e))},e.prototype.writeFeaturesText=function(t,e){return x()},e.prototype.writeGeometry=function(t,e){return this.writeGeometryText(t,this.adaptOptions(e))},e.prototype.writeGeometryText=function(t,e){return x()},e}(cf),fy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dy={POINT:Ln,LINESTRING:Ds,POLYGON:Wn,MULTIPOINT:Hc,MULTILINESTRING:Kc,MULTIPOLYGON:Qc},_y=1,gy=2,yy=3,vy=4,my=5,xy=6,Ey={};for(var Sy in Fe)Ey[Sy]=Fe[Sy].toUpperCase();var wy=function(){function t(t){this.wkt=t,this.index_=-1}return t.prototype.isAlpha_=function(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"},t.prototype.isNumeric_=function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)},t.prototype.isWhiteSpace_=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},t.prototype.nextChar_=function(){return this.wkt.charAt(++this.index_)},t.prototype.nextToken=function(){var t,e=this.nextChar_(),r=this.index_,n=e;if("("==e)t=gy;else if(","==e)t=my;else if(")"==e)t=yy;else if(this.isNumeric_(e)||"-"==e)t=vy,n=this.readNumber_();else if(this.isAlpha_(e))t=_y,n=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=xy}return{position:r,value:n,type:t}},t.prototype.readNumber_=function(){var t,e=this.index_,r=!1,n=!1;do{"."==t?r=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,r)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))},t.prototype.readText_=function(){var t,e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()},t}(),Ty=function(){function t(t){this.lexer_=t,this.token_,this.layout_=Pe}return t.prototype.consume_=function(){this.token_=this.lexer_.nextToken()},t.prototype.isTokenType=function(t){return this.token_.type==t},t.prototype.match=function(t){var e=this.isTokenType(t);return e&&this.consume_(),e},t.prototype.parse=function(){return this.consume_(),this.parseGeometry_()},t.prototype.parseGeometryLayout_=function(){var t=Pe,e=this.token_;if(this.isTokenType(_y)){var r=e.value;"Z"===r?t=Oe:"M"===r?t=Ie:"ZM"===r&&(t=Le),t!==Pe&&this.consume_()}return t},t.prototype.parseGeometryCollectionText_=function(){if(this.match(gy)){var t=[];do{t.push(this.parseGeometry_())}while(this.match(my));if(this.match(yy))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePointText_=function(){if(this.match(gy)){var t=this.parsePoint_();if(this.match(yy))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())},t.prototype.parseLineStringText_=function(){if(this.match(gy)){var t=this.parsePointList_();if(this.match(yy))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePolygonText_=function(){if(this.match(gy)){var t=this.parseLineStringTextList_();if(this.match(yy))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPointText_=function(){if(this.match(gy)){var t=void 0;if(t=this.token_.type==gy?this.parsePointTextList_():this.parsePointList_(),this.match(yy))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiLineStringText_=function(){if(this.match(gy)){var t=this.parseLineStringTextList_();if(this.match(yy))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPolygonText_=function(){if(this.match(gy)){var t=this.parsePolygonTextList_();if(this.match(yy))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePoint_=function(){for(var t=[],e=this.layout_.length,r=0;r<e;++r){var n=this.token_;if(!this.match(vy))break;t.push(n.value)}if(t.length==e)return t;throw new Error(this.formatErrorMessage_())},t.prototype.parsePointList_=function(){for(var t=[this.parsePoint_()];this.match(my);)t.push(this.parsePoint_());return t},t.prototype.parsePointTextList_=function(){for(var t=[this.parsePointText_()];this.match(my);)t.push(this.parsePointText_());return t},t.prototype.parseLineStringTextList_=function(){for(var t=[this.parseLineStringText_()];this.match(my);)t.push(this.parseLineStringText_());return t},t.prototype.parsePolygonTextList_=function(){for(var t=[this.parsePolygonText_()];this.match(my);)t.push(this.parsePolygonText_());return t},t.prototype.isEmptyGeometry_=function(){var t=this.isTokenType(_y)&&"EMPTY"==this.token_.value;return t&&this.consume_(),t},t.prototype.formatErrorMessage_=function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"},t.prototype.parseGeometry_=function(){var t=this.token_;if(this.match(_y)){var e=t.value;if(this.layout_=this.parseGeometryLayout_(),"GEOMETRYCOLLECTION"==e){var r=this.parseGeometryCollectionText_();return new hf(r)}var n=dy[e];if(!n)throw new Error("Invalid geometry type: "+e);var i=void 0;switch(e){case"POINT":i=this.parsePointText_();break;case"LINESTRING":i=this.parseLineStringText_();break;case"POLYGON":i=this.parsePolygonText_();break;case"MULTIPOINT":i=this.parseMultiPointText_();break;case"MULTILINESTRING":i=this.parseMultiLineStringText_();break;case"MULTIPOLYGON":i=this.parseMultiPolygonText_();break;default:throw new Error("Invalid geometry type: "+e)}return i||(i=n===dy.POINT?[NaN,NaN]:[]),new n(i,this.layout_)}throw new Error(this.formatErrorMessage_())},t}(),Cy=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.splitCollection_=void 0!==n.splitCollection&&n.splitCollection,r}return fy(e,t),e.prototype.parse_=function(t){var e=new wy(t);return new Ty(e).parse()},e.prototype.readFeatureFromText=function(t,e){var r=this.readGeometryFromText(t,e);if(r){var n=new Ct;return n.setGeometry(r),n}return null},e.prototype.readFeaturesFromText=function(t,e){for(var r=[],n=this.readGeometryFromText(t,e),i=[],o=0,a=(r=this.splitCollection_&&n.getType()==Fe.GEOMETRY_COLLECTION?n.getGeometriesArray():[n]).length;o<a;++o){var s=new Ct;s.setGeometry(r[o]),i.push(s)}return i},e.prototype.readGeometryFromText=function(t,e){var r=this.parse_(t);return r?pf(r,!1,e):null},e.prototype.writeFeatureText=function(t,e){var r=t.getGeometry();return r?this.writeGeometryText(r,e):""},e.prototype.writeFeaturesText=function(t,e){if(1==t.length)return this.writeFeatureText(t[0],e);for(var r=[],n=0,i=t.length;n<i;++n)r.push(t[n].getGeometry());var o=new hf(r);return this.writeGeometryText(o,e)},e.prototype.writeGeometryText=function(t,e){return Iy(pf(t,!0,e))},e}(py);function Ry(t){var e=t.getCoordinates();return 0===e.length?"":e.join(" ")}function by(t){for(var e=t.getCoordinates(),r=[],n=0,i=e.length;n<i;++n)r.push(e[n].join(" "));return r.join(",")}function Py(t){for(var e=[],r=t.getLinearRings(),n=0,i=r.length;n<i;++n)e.push("("+by(r[n])+")");return e.join(",")}var Oy={Point:Ry,LineString:by,Polygon:Py,MultiPoint:function(t){for(var e=[],r=t.getPoints(),n=0,i=r.length;n<i;++n)e.push("("+Ry(r[n])+")");return e.join(",")},MultiLineString:function(t){for(var e=[],r=t.getLineStrings(),n=0,i=r.length;n<i;++n)e.push("("+by(r[n])+")");return e.join(",")},MultiPolygon:function(t){for(var e=[],r=t.getPolygons(),n=0,i=r.length;n<i;++n)e.push("("+Py(r[n])+")");return e.join(",")},GeometryCollection:function(t){for(var e=[],r=t.getGeometries(),n=0,i=r.length;n<i;++n)e.push(Iy(r[n]));return e.join(",")}};function Iy(t){var e=t.getType(),r=(0,Oy[e])(t);if(e=e.toUpperCase(),"function"==typeof t.getFlatCoordinates){var n=function(t){var e=t.getLayout(),r="";return e!==Oe&&e!==Le||(r+="Z"),e!==Ie&&e!==Le||(r+="M"),r}(t);n.length>0&&(e+=" "+n)}return 0===r.length?e+" EMPTY":e+"("+r+")"}var Ly,Fy=Cy,My=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Ay(t,e){for(var r=My.length,n=0;n<r;++n)try{var i=t.getContext(My[n],e);if(i)return i}catch(t){}return null}var Ny=35044;function Gy(t){switch(t){case 34962:return Float32Array;case 34963:return Uint32Array;default:return Float32Array}}var jy=function(){function t(t,e){this.array=null,this.type=t,wt(34962===t||34963===t,62),this.usage=void 0!==e?e:Ny}return t.prototype.ofSize=function(t){this.array=new(Gy(this.type))(t)},t.prototype.fromArray=function(t){this.array=Gy(this.type).from(t)},t.prototype.fromArrayBuffer=function(t){this.array=new(Gy(this.type))(t)},t.prototype.getType=function(){return this.type},t.prototype.getArray=function(){return this.array},t.prototype.getUsage=function(){return this.usage},t.prototype.getSize=function(){return this.array?this.array.length:0},t}(),Dy="webglcontextlost",ky="webglcontextrestored";function Uy(t,e){return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}var zy=function(){function t(t){this.gl_=t.webGlContext;var e=this.gl_;this.scaleRatio_=t.scaleRatio||1,this.renderTargetTexture_=e.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=e.createFramebuffer();var r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,t.vertexShader||"\n  precision mediump float;\n  \n  attribute vec2 a_position;\n  varying vec2 v_texCoord;\n  varying vec2 v_screenCoord;\n  \n  uniform vec2 u_screenSize;\n   \n  void main() {\n    v_texCoord = a_position * 0.5 + 0.5;\n    v_screenCoord = v_texCoord * u_screenSize;\n    gl_Position = vec4(a_position, 0.0, 1.0);\n  }\n"),e.compileShader(r);var n=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(n,t.fragmentShader||"\n  precision mediump float;\n   \n  uniform sampler2D u_image;\n   \n  varying vec2 v_texCoord;\n   \n  void main() {\n    gl_FragColor = texture2D(u_image, v_texCoord);\n  }\n"),e.compileShader(n),this.renderTargetProgram_=e.createProgram(),e.attachShader(this.renderTargetProgram_,r),e.attachShader(this.renderTargetProgram_,n),e.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,-1,1,1,-1,1]),e.STATIC_DRAW),this.renderTargetAttribLocation_=e.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetTextureLocation_=e.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],t.uniforms&&Object.keys(t.uniforms).forEach(function(r){this.uniforms_.push({value:t.uniforms[r],location:e.getUniformLocation(this.renderTargetProgram_,r)})}.bind(this))}return t.prototype.getGL=function(){return this.gl_},t.prototype.init=function(t){var e=this.getGL(),r=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.viewport(0,0,r[0],r[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==r[0]||this.renderTargetTextureSize_[1]!==r[1]){this.renderTargetTextureSize_=r;var n=e.RGBA,i=e.RGBA,o=e.UNSIGNED_BYTE;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,0,n,r[0],r[1],0,i,o,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0)}},t.prototype.apply=function(t,e){var r=this.getGL(),n=t.size;r.bindFramebuffer(r.FRAMEBUFFER,e?e.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.renderTargetTexture_),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.bindBuffer(r.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),r.useProgram(this.renderTargetProgram_),r.enableVertexAttribArray(this.renderTargetAttribLocation_),r.vertexAttribPointer(this.renderTargetAttribLocation_,2,r.FLOAT,!1,0,0),r.uniform2f(this.renderTargetUniformLocation_,n[0],n[1]),r.uniform1i(this.renderTargetTextureLocation_,0),this.applyUniforms(t),r.drawArrays(r.TRIANGLES,0,6)},t.prototype.getFrameBuffer=function(){return this.frameBuffer_},t.prototype.applyUniforms=function(t){var e,r=this.getGL(),n=1;this.uniforms_.forEach((function(i){if((e="function"==typeof i.value?i.value(t):i.value)instanceof HTMLCanvasElement||e instanceof ImageData)i.texture||(i.texture=r.createTexture()),r.activeTexture(r["TEXTURE"+n]),r.bindTexture(r.TEXTURE_2D,i.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),e instanceof ImageData?r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,e.width,e.height,0,r.UNSIGNED_BYTE,new Uint8Array(e.data)):r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),r.uniform1i(i.location,n++);else if(Array.isArray(e))switch(e.length){case 2:return void r.uniform2f(i.location,e[0],e[1]);case 3:return void r.uniform3f(i.location,e[0],e[1],e[2]);case 4:return void r.uniform4f(i.location,e[0],e[1],e[2],e[3]);default:return}else"number"==typeof e&&r.uniform1f(i.location,e)}))},t}(),By=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yy="u_projectionMatrix",Xy="u_offsetScaleMatrix",Vy="u_offsetRotateMatrix",Wy="u_time",Zy="u_zoom",Ky="u_resolution",qy={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function Hy(t){switch(t){case qy.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case qy.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case qy.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case qy.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}var Jy=function(t){function e(e){var r=t.call(this)||this,n=e||{};r.boundHandleWebGLContextLost_=r.handleWebGLContextLost.bind(r),r.boundHandleWebGLContextRestored_=r.handleWebGLContextRestored.bind(r),r.canvas_=document.createElement("canvas"),r.canvas_.style.position="absolute",r.canvas_.style.left="0",r.gl_=Ay(r.canvas_);var i=r.getGL();if(r.bufferCache_={},r.currentProgram_=null,wt(D(function(){if(!Ly){var t=Ay(document.createElement("canvas"));t&&(Ly=t.getSupportedExtensions())}return Ly}(),"OES_element_index_uint"),63),i.getExtension("OES_element_index_uint"),r.canvas_.addEventListener(Dy,r.boundHandleWebGLContextLost_),r.canvas_.addEventListener(ky,r.boundHandleWebGLContextRestored_),r.offsetRotateMatrix_=[1,0,0,1,0,0],r.offsetScaleMatrix_=[1,0,0,1,0,0],r.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.uniformLocations_={},r.attribLocations_={},r.uniforms_=[],n.uniforms)for(var o in n.uniforms)r.uniforms_.push({name:o,value:n.uniforms[o]});return r.postProcessPasses_=n.postProcesses?n.postProcesses.map((function(t){return new zy({webGlContext:i,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms})})):[new zy({webGlContext:i})],r.shaderCompileErrors_=null,r.startTime_=Date.now(),r}return By(e,t),e.prototype.bindBuffer=function(t){var e=this.getGL(),r=S(t),n=this.bufferCache_[r];n||(n={buffer:t,webGlBuffer:e.createBuffer()},this.bufferCache_[r]=n);e.bindBuffer(t.getType(),n.webGlBuffer)},e.prototype.flushBufferData=function(t){var e=this.getGL();this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())},e.prototype.deleteBuffer=function(t){var e=this.getGL(),r=S(t),n=this.bufferCache_[r];e.isContextLost()||e.deleteBuffer(n.buffer),delete this.bufferCache_[r]},e.prototype.disposeInternal=function(){this.canvas_.removeEventListener(Dy,this.boundHandleWebGLContextLost_),this.canvas_.removeEventListener(ky,this.boundHandleWebGLContextRestored_)},e.prototype.prepareDraw=function(t){var e=this.getGL(),r=this.getCanvas(),n=t.size,i=t.pixelRatio;r.width=n[0]*i,r.height=n[1]*i,r.style.width=n[0]+"px",r.style.height=n[1]+"px",e.useProgram(this.currentProgram_);for(var o=this.postProcessPasses_.length-1;o>=0;o--)this.postProcessPasses_[o].init(t);e.bindTexture(e.TEXTURE_2D,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.prepareDrawToRenderTarget=function(t,e,r){var n=this.getGL(),i=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,i[0],i[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,r?n.ZERO:n.ONE_MINUS_SRC_ALPHA),n.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var r=this.getGL(),n=r.UNSIGNED_INT,i=e-t,o=4*t;r.drawElements(r.TRIANGLES,i,n,o)},e.prototype.finalizeDraw=function(t){for(var e=0;e<this.postProcessPasses_.length;e++)this.postProcessPasses_[e].apply(t,this.postProcessPasses_[e+1]||null)},e.prototype.getCanvas=function(){return this.canvas_},e.prototype.getGL=function(){return this.gl_},e.prototype.applyFrameState=function(t){var e=t.size,r=t.viewState.rotation,n=qr(this.offsetScaleMatrix_);$r(n,2/e[0],2/e[1]);var i,o,a,s,u=qr(this.offsetRotateMatrix_);0!==r&&(i=u,o=-r,a=Math.cos(o),s=Math.sin(o),Hr(i,Jr(Kr,a,s,-s,a,0,0))),this.setUniformMatrixValue(Xy,Uy(this.tmpMat4_,n)),this.setUniformMatrixValue(Vy,Uy(this.tmpMat4_,u)),this.setUniformFloatValue(Wy,.001*(Date.now()-this.startTime_)),this.setUniformFloatValue(Zy,t.viewState.zoom),this.setUniformFloatValue(Ky,t.viewState.resolution)},e.prototype.applyUniforms=function(t){var e,r=this.getGL(),n=0;this.uniforms_.forEach(function(i){if((e="function"==typeof i.value?i.value(t):i.value)instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof ImageData)i.texture||(i.prevValue=void 0,i.texture=r.createTexture()),r.activeTexture(r["TEXTURE"+n]),r.bindTexture(r.TEXTURE_2D,i.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(!(e instanceof HTMLImageElement)||e.complete)&&i.prevValue!==e&&(i.prevValue=e,r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e)),r.uniform1i(this.getUniformLocation(i.name),n++);else if(Array.isArray(e)&&6===e.length)this.setUniformMatrixValue(i.name,Uy(this.tmpMat4_,e));else if(Array.isArray(e)&&e.length<=4)switch(e.length){case 2:return void r.uniform2f(this.getUniformLocation(i.name),e[0],e[1]);case 3:return void r.uniform3f(this.getUniformLocation(i.name),e[0],e[1],e[2]);case 4:return void r.uniform4f(this.getUniformLocation(i.name),e[0],e[1],e[2],e[3]);default:return}else"number"==typeof e&&r.uniform1f(this.getUniformLocation(i.name),e)}.bind(this))},e.prototype.useProgram=function(t){return t!=this.currentProgram_&&(this.getGL().useProgram(t),this.currentProgram_=t,this.uniformLocations_={},this.attribLocations_={},!0)},e.prototype.compileShader=function(t,e){var r=this.getGL(),n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n},e.prototype.getProgram=function(t,e){var r=this.getGL(),n=this.compileShader(t,r.FRAGMENT_SHADER),i=this.compileShader(e,r.VERTEX_SHADER);this.shaderCompileErrors_=null,r.getShaderInfoLog(n)&&(this.shaderCompileErrors_="Fragment shader compilation failed:\n"+r.getShaderInfoLog(n)),r.getShaderInfoLog(i)&&(this.shaderCompileErrors_=(this.shaderCompileErrors_||"")+"Vertex shader compilation failed:\n"+r.getShaderInfoLog(i));var o=r.createProgram();return r.attachShader(o,n),r.attachShader(o,i),r.linkProgram(o),o},e.prototype.getShaderCompileErrors=function(){return this.shaderCompileErrors_},e.prototype.getUniformLocation=function(t){return void 0===this.uniformLocations_[t]&&(this.uniformLocations_[t]=this.getGL().getUniformLocation(this.currentProgram_,t)),this.uniformLocations_[t]},e.prototype.getAttributeLocation=function(t){return void 0===this.attribLocations_[t]&&(this.attribLocations_[t]=this.getGL().getAttribLocation(this.currentProgram_,t)),this.attribLocations_[t]},e.prototype.makeProjectionTransform=function(t,e){var r=t.size,n=t.viewState.rotation,i=t.viewState.resolution,o=t.viewState.center;return qr(e),tn(e,0,0,2/(i*r[0]),2/(i*r[1]),-n,-o[0],-o[1]),e},e.prototype.setUniformFloatValue=function(t,e){this.getGL().uniform1f(this.getUniformLocation(t),e)},e.prototype.setUniformMatrixValue=function(t,e){this.getGL().uniformMatrix4fv(this.getUniformLocation(t),!1,e)},e.prototype.enableAttributeArray_=function(t,e,r,n,i){var o=this.getAttributeLocation(t);o<0||(this.getGL().enableVertexAttribArray(o),this.getGL().vertexAttribPointer(o,e,r,!1,n,i))},e.prototype.enableAttributes=function(t){for(var e=function(t){for(var e=0,r=0;r<t.length;r++){var n=t[r];e+=n.size*Hy(n.type)}return e}(t),r=0,n=0;n<t.length;n++){var i=t[n];this.enableAttributeArray_(i.name,i.size,i.type||5126,e,r),r+=i.size*Hy(i.type)}},e.prototype.handleWebGLContextLost=function(){I(this.bufferCache_),this.currentProgram_=null},e.prototype.handleWebGLContextRestored=function(){},e.prototype.createTexture=function(t,e,r){var n=this.getGL(),i=r||n.createTexture(),o=n.RGBA,a=n.RGBA,s=n.UNSIGNED_BYTE;return n.bindTexture(n.TEXTURE_2D,i),e?n.texImage2D(n.TEXTURE_2D,0,o,a,s,e):n.texImage2D(n.TEXTURE_2D,0,o,t[0],t[1],0,a,s,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),i},e}(G),Qy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$y="GENERATE_BUFFERS",tv=function(t){function e(e,r){var n=t.call(this,e)||this,i=r||{};return n.helper=new Jy({postProcesses:i.postProcesses,uniforms:i.uniforms}),n}return Qy(e,t),e.prototype.disposeInternal=function(){this.helper.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.getShaderCompileErrors=function(){return this.helper.getShaderCompileErrors()},e}(ns);var ev=tv,rv=new Blob(['var e="function"==typeof Object.assign?Object.assign:function(e,n){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,o=arguments.length;r<o;++r){var i=arguments[r];if(null!=i)for(var f in i)i.hasOwnProperty(f)&&(t[f]=i[f])}return t},n="GENERATE_BUFFERS",t=[],r={vertexPosition:0,indexPosition:0};function o(e,n,t,r,o){e[n+0]=t,e[n+1]=r,e[n+2]=o}function i(e,n,i,f,s,u){var a=3+s,l=e[n+0],v=e[n+1],c=t;c.length=s;for(var g=0;g<c.length;g++)c[g]=e[n+2+g];var b=u?u.vertexPosition:0,h=u?u.indexPosition:0,d=b/a;return o(i,b,l,v,0),c.length&&i.set(c,b+3),o(i,b+=a,l,v,1),c.length&&i.set(c,b+3),o(i,b+=a,l,v,2),c.length&&i.set(c,b+3),o(i,b+=a,l,v,3),c.length&&i.set(c,b+3),b+=a,f[h++]=d,f[h++]=d+1,f[h++]=d+3,f[h++]=d+1,f[h++]=d+2,f[h++]=d+3,r.vertexPosition=b,r.indexPosition=h,r}var f=self;f.onmessage=function(t){var r=t.data;if(r.type===n){for(var o=r.customAttributesCount,s=2+o,u=new Float32Array(r.renderInstructions),a=u.length/s,l=4*a*(o+3),v=new Uint32Array(6*a),c=new Float32Array(l),g=null,b=0;b<u.length;b+=s)g=i(u,b,c,v,o,g);var h=e({vertexBuffer:c.buffer,indexBuffer:v.buffer,renderInstructions:u.buffer},r);f.postMessage(h,[c.buffer,v.buffer,u.buffer])}};'],{type:"application/javascript"}),nv=URL.createObjectURL(rv);var iv=new Uint8Array(4),ov=function(){function t(t,e){this.helper_=t;var r=t.getGL();this.texture_=r.createTexture(),this.framebuffer_=r.createFramebuffer(),this.size_=e||[1,1],this.data_=new Uint8Array(0),this.dataCacheDirty_=!0,this.updateSize_()}return t.prototype.setSize=function(t){B(t,this.size_)||(this.size_[0]=t[0],this.size_[1]=t[1],this.updateSize_())},t.prototype.getSize=function(){return this.size_},t.prototype.clearCachedData=function(){this.dataCacheDirty_=!0},t.prototype.readAll=function(){if(this.dataCacheDirty_){var t=this.size_,e=this.helper_.getGL();e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.readPixels(0,0,t[0],t[1],e.RGBA,e.UNSIGNED_BYTE,this.data_),this.dataCacheDirty_=!1}return this.data_},t.prototype.readPixel=function(t,e){if(t<0||e<0||t>this.size_[0]||e>=this.size_[1])return iv[0]=0,iv[1]=0,iv[2]=0,iv[3]=0,iv;this.readAll();var r=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return iv[0]=this.data_[4*r],iv[1]=this.data_[4*r+1],iv[2]=this.data_[4*r+2],iv[3]=this.data_[4*r+3],iv},t.prototype.getTexture=function(){return this.texture_},t.prototype.getFramebuffer=function(){return this.framebuffer_},t.prototype.updateSize_=function(){var t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(t[0]*t[1]*4)},t}(),av=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sv=function(t){function e(e,r){var n=this,i=r.uniforms||{},o=[1,0,0,1,0,0];i[Yy]=o,(n=t.call(this,e,{uniforms:i,postProcesses:r.postProcesses})||this).sourceRevision_=-1,n.verticesBuffer_=new jy(34962,35048),n.hitVerticesBuffer_=new jy(34962,35048),n.indicesBuffer_=new jy(34963,35048),n.program_=n.helper.getProgram(r.fragmentShader,r.vertexShader),n.hitDetectionEnabled_=!(!r.hitFragmentShader||!r.hitVertexShader),n.hitProgram_=n.hitDetectionEnabled_&&n.helper.getProgram(r.hitFragmentShader,r.hitVertexShader);var a=r.attributes?r.attributes.map((function(t){return{name:"a_"+t.name,size:1,type:qy.FLOAT}})):[];n.attributes=[{name:"a_position",size:2,type:qy.FLOAT},{name:"a_index",size:1,type:qy.FLOAT}].concat(a),n.hitDetectionAttributes=[{name:"a_position",size:2,type:qy.FLOAT},{name:"a_index",size:1,type:qy.FLOAT},{name:"a_hitColor",size:4,type:qy.FLOAT},{name:"a_featureUid",size:1,type:qy.FLOAT}].concat(a),n.customAttributes=r.attributes?r.attributes:[],n.previousExtent_=[1/0,1/0,-1/0,-1/0],n.currentTransform_=o,n.renderTransform_=[1,0,0,1,0,0],n.invertRenderTransform_=[1,0,0,1,0,0],n.renderInstructions_=new Float32Array(0),n.hitRenderInstructions_=new Float32Array(0),n.hitRenderTarget_=n.hitDetectionEnabled_&&new ov(n.helper),n.worker_=new Worker(nv),n.worker_.addEventListener("message",function(t){var e=t.data;if(e.type===$y){var r=e.projectionTransform;e.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(e.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=r,en(this.invertRenderTransform_,this.renderTransform_),e.hitDetection?this.hitRenderInstructions_=new Float32Array(t.data.renderInstructions):this.renderInstructions_=new Float32Array(t.data.renderInstructions),this.getLayer().changed()}}.bind(n)),n.featureCache_={},n.featureCount_=0;var s=n.getLayer().getSource();return n.sourceListenKeys_=[M(s,Qs,n.handleSourceFeatureAdded_,n),M(s,$s,n.handleSourceFeatureChanged_,n),M(s,eu,n.handleSourceFeatureDelete_,n),M(s,tu,n.handleSourceFeatureClear_,n)],s.forEachFeature(function(t){this.featureCache_[S(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}.bind(n)),n}return av(e,t),e.prototype.handleSourceFeatureAdded_=function(t){var e=t.feature;this.featureCache_[S(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.featureCount_++},e.prototype.handleSourceFeatureChanged_=function(t){var e=t.feature;this.featureCache_[S(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}},e.prototype.handleSourceFeatureDelete_=function(t){var e=t.feature;delete this.featureCache_[S(e)],this.featureCount_--},e.prototype.handleSourceFeatureClear_=function(){this.featureCache_={},this.featureCount_=0},e.prototype.renderFrame=function(t){var e=this.indicesBuffer_.getSize();this.helper.drawElements(0,e),this.helper.finalizeDraw(t);var r=this.helper.getCanvas(),n=t.layerStatesArray[t.layerIndex].opacity;return n!==parseFloat(r.style.opacity)&&(r.style.opacity=n),this.hitDetectionEnabled_&&(this.renderHitDetection(t),this.hitRenderTarget_.clearCachedData()),r},e.prototype.prepareFrame=function(t){var e=this.getLayer(),r=e.getSource(),n=t.viewState,i=!t.viewHints[Vo]&&!t.viewHints[Wo],o=!Jt(this.previousExtent_,t.extent),a=this.sourceRevision_<r.getRevision();if(a&&(this.sourceRevision_=r.getRevision()),i&&(o||a)){var s=n.projection,u=n.resolution,l=e instanceof Xo?e.getRenderBuffer():0,h=jt(t.extent,l*u);r.loadFeatures(h,u,s),this.rebuildBuffers_(t),this.previousExtent_=t.extent.slice()}return this.helper.makeProjectionTransform(t,this.currentTransform_),Hr(this.currentTransform_,this.invertRenderTransform_),this.helper.useProgram(this.program_),this.helper.prepareDraw(t),this.helper.bindBuffer(this.verticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.attributes),!0},e.prototype.rebuildBuffers_=function(t){var e=[1,0,0,1,0,0];this.helper.makeProjectionTransform(t,e);var r,n,i=(2+this.customAttributes.length)*this.featureCount_;if(this.renderInstructions_&&this.renderInstructions_.length===i||(this.renderInstructions_=new Float32Array(i)),this.hitDetectionEnabled_){var o=(7+this.customAttributes.length)*this.featureCount_;this.hitRenderInstructions_&&this.hitRenderInstructions_.length===o||(this.hitRenderInstructions_=new Float32Array(o))}var a,s,u,l=[],h=[],c=0,p=0;for(var f in this.featureCache_)if((n=(r=this.featureCache_[f]).geometry)&&n.getType()===Fe.POINT){l[0]=n.getFlatCoordinates()[0],l[1]=n.getFlatCoordinates()[1],Qr(e,l),s=p+6,u=void 0,(u=h||[])[0]=Math.floor(s/256/256/256)/255,u[1]=Math.floor(s/256/256)%256/255,u[2]=Math.floor(s/256)%256/255,u[3]=s%256/255,a=u,this.renderInstructions_[c++]=l[0],this.renderInstructions_[c++]=l[1],this.hitDetectionEnabled_&&(this.hitRenderInstructions_[p++]=l[0],this.hitRenderInstructions_[p++]=l[1],this.hitRenderInstructions_[p++]=a[0],this.hitRenderInstructions_[p++]=a[1],this.hitRenderInstructions_[p++]=a[2],this.hitRenderInstructions_[p++]=a[3],this.hitRenderInstructions_[p++]=Number(f));for(var d=void 0,_=0;_<this.customAttributes.length;_++)d=this.customAttributes[_].callback(r.feature,r.properties),this.renderInstructions_[c++]=d,this.hitDetectionEnabled_&&(this.hitRenderInstructions_[p++]=d)}var g={type:$y,renderInstructions:this.renderInstructions_.buffer,customAttributesCount:this.customAttributes.length};if(g.projectionTransform=e,this.worker_.postMessage(g,[this.renderInstructions_.buffer]),this.renderInstructions_=null,this.hitDetectionEnabled_){var y={type:$y,renderInstructions:this.hitRenderInstructions_.buffer,customAttributesCount:5+this.customAttributes.length};y.projectionTransform=e,y.hitDetection=!0,this.worker_.postMessage(y,[this.hitRenderInstructions_.buffer]),this.hitRenderInstructions_=null}},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){if(wt(this.hitDetectionEnabled_,66),this.hitRenderInstructions_){var o=Qr(e.coordinateToPixelTransform,t.slice()),a=this.hitRenderTarget_.readPixel(o[0]/2,o[1]/2),s=function(t){var e=0;return e+=Math.round(256*t[0]*256*256*255),e+=Math.round(256*t[1]*256*255),e+=Math.round(256*t[2]*255),e+=Math.round(255*t[3])}([a[0]/255,a[1]/255,a[2]/255,a[3]/255]),u=this.hitRenderInstructions_[s],l=Math.floor(u).toString(),h=this.getLayer().getSource().getFeatureByUid(l);return h?n(h,this.getLayer()):void 0}},e.prototype.renderHitDetection=function(t){if(this.hitVerticesBuffer_.getSize()){this.hitRenderTarget_.setSize([Math.floor(t.size[0]/2),Math.floor(t.size[1]/2)]),this.helper.useProgram(this.hitProgram_),this.helper.prepareDrawToRenderTarget(t,this.hitRenderTarget_,!0),this.helper.bindBuffer(this.hitVerticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.hitDetectionAttributes);var e=this.indicesBuffer_.getSize();this.helper.drawElements(0,e)}},e.prototype.disposeInternal=function(){this.worker_.terminate(),this.layer_=null,this.sourceListenKeys_.forEach((function(t){N(t)})),this.sourceListenKeys_=null,t.prototype.disposeInternal.call(this)},e}(ev),uv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lv="blur",hv="gradient",cv="radius",pv=["#00f","#0ff","#0f0","#ff0","#f00"];var fv=function(t){function e(e){var r=this,n=e||{},i=O({},n);delete i.gradient,delete i.radius,delete i.blur,delete i.weight,(r=t.call(this,i)||this).gradient_=null,r.addEventListener(yt(hv),r.handleGradientChanged_),r.setGradient(n.gradient?n.gradient:pv),r.setBlur(void 0!==n.blur?n.blur:15),r.setRadius(void 0!==n.radius?n.radius:8);var o=n.weight?n.weight:"weight";return r.weightFunction_="string"==typeof o?function(t){return t.get(o)}:o,r.setRenderOrder(null),r}return uv(e,t),e.prototype.getBlur=function(){return this.get(lv)},e.prototype.getGradient=function(){return this.get(hv)},e.prototype.getRadius=function(){return this.get(cv)},e.prototype.handleGradientChanged_=function(){this.gradient_=function(t){for(var e=Ji(1,256),r=e.createLinearGradient(0,0,1,256),n=1/(t.length-1),i=0,o=t.length;i<o;++i)r.addColorStop(i*n,t[i]);return e.fillStyle=r,e.fillRect(0,0,1,256),e.canvas}(this.getGradient())},e.prototype.setBlur=function(t){this.set(lv,t)},e.prototype.setGradient=function(t){this.set(hv,t)},e.prototype.setRadius=function(t){this.set(cv,t)},e.prototype.createRenderer=function(){return new sv(this,{attributes:[{name:"weight",callback:function(t){var e=this.weightFunction_(t);return void 0!==e?Ge(e,0,1):1}.bind(this)}],vertexShader:"\n        precision mediump float;\n        uniform mat4 u_projectionMatrix;\n        uniform mat4 u_offsetScaleMatrix;\n        uniform float u_size;\n        attribute vec2 a_position;\n        attribute float a_index;\n        attribute float a_weight;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n\n        void main(void) {\n          mat4 offsetMatrix = u_offsetScaleMatrix;\n          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;\n          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;\n          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n          v_texCoord = vec2(u, v);\n          v_weight = a_weight;\n        }",fragmentShader:"\n        precision mediump float;\n        uniform float u_blurSlope;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n\n        void main(void) {\n          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);\n          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;\n          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;\n          float alpha = smoothstep(0.0, 1.0, value) * v_weight;\n          gl_FragColor = vec4(alpha, alpha, alpha, alpha);\n        }",hitVertexShader:"\n        precision mediump float;\n        uniform mat4 u_projectionMatrix;\n        uniform mat4 u_offsetScaleMatrix;\n        uniform float u_size;\n        attribute vec2 a_position;\n        attribute float a_index;\n        attribute float a_weight;\n        attribute vec4 a_hitColor;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n        varying vec4 v_hitColor;\n\n        void main(void) {\n          mat4 offsetMatrix = u_offsetScaleMatrix;\n          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;\n          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;\n          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n          v_texCoord = vec2(u, v);\n          v_hitColor = a_hitColor;\n          v_weight = a_weight;\n        }",hitFragmentShader:"\n        precision mediump float;\n        uniform float u_blurSlope;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n        varying vec4 v_hitColor;\n\n        void main(void) {\n          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);\n          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;\n          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;\n          float alpha = smoothstep(0.0, 1.0, value) * v_weight;\n          if (alpha < 0.05) {\n            discard;\n          }\n\n          gl_FragColor = v_hitColor;\n        }",uniforms:{u_size:function(){return 2*(this.get(cv)+this.get(lv))}.bind(this),u_blurSlope:function(){return this.get(cv)/Math.max(1,this.get(lv))}.bind(this)},postProcesses:[{fragmentShader:"\n            precision mediump float;\n\n            uniform sampler2D u_image;\n            uniform sampler2D u_gradientTexture;\n\n            varying vec2 v_texCoord;\n\n            void main() {\n              vec4 color = texture2D(u_image, v_texCoord);\n              gl_FragColor.a = color.a;\n              gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n              gl_FragColor.rgb *= gl_FragColor.a;\n            }",uniforms:{u_gradientTexture:function(){return this.gradient_}.bind(this)}}]})},e}(Ms),dv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_v=function(t){function e(e){var r=e||{};return t.call(this,r)||this}return dv(e,t),e}(Fi),gv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yv=function(t){function e(e){var r=t.call(this,e)||this;return r.image_=null,r}return gv(e,t),e.prototype.getImage=function(){return this.image_?this.image_.getImage():null},e.prototype.prepareFrame=function(t){var e=t.layerStatesArray[t.layerIndex],r=t.pixelRatio,n=t.viewState,i=n.resolution,o=this.getLayer().getSource(),a=t.viewHints,s=t.extent;if(void 0!==e.extent&&(s=_e(s,Wr(e.extent,n.projection))),!a[Vo]&&!a[Wo]&&!Se(s))if(o){var u=n.projection,l=o.getImage(s,i,r,u);l&&this.loadImage(l)&&(this.image_=l)}else this.image_=null;return!!this.image_},e.prototype.renderFrame=function(t,e){var r=this.image_,n=r.getExtent(),i=r.getResolution(),o=r.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],s=t.pixelRatio,u=t.viewState,l=u.center,h=u.resolution,c=t.size,p=s*i/(h*o),f=Math.round(c[0]*s),d=Math.round(c[1]*s),_=u.rotation;if(_){var g=Math.round(Math.sqrt(f*f+d*d));f=g,d=g}tn(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,_,-f/2,-d/2),en(this.inversePixelTransform,this.pixelTransform);var y=Po(this.pixelTransform);this.useContainer(e,y,a.opacity);var v=this.context,m=v.canvas;m.width!=f||m.height!=d?(m.width=f,m.height=d):this.containerReused||v.clearRect(0,0,f,d);var x=!1;if(a.extent){var E=Wr(a.extent,u.projection);(x=!zt(E,t.extent)&&Ee(E,t.extent))&&this.clipUnrotated(v,t,E)}var S=r.getImage(),w=tn(this.tempTransform_,f/2,d/2,p,p,0,o*(n[0]-l[0])/i,o*(l[1]-n[3])/i);this.renderedResolution=i*s/o;var T=w[4],C=w[5],R=S.width*w[0],b=S.height*w[3];if(this.preRender(v,t),R>=.5&&b>=.5){var P=a.opacity,O=void 0;1!==P&&(O=this.context.globalAlpha,this.context.globalAlpha=P),this.context.drawImage(S,0,0,+S.width,+S.height,Math.round(T),Math.round(C),Math.round(R),Math.round(b)),1!==P&&(this.context.globalAlpha=O)}return this.postRender(v,t),x&&v.restore(),y!==m.style.transform&&(m.style.transform=y),this.container},e}(os),vv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mv=function(t){function e(e){return t.call(this,e)||this}return vv(e,t),e.prototype.createRenderer=function(){return new yv(this)},e}(_v),xv="preload",Ev="useInterimTilesOnError",Sv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wv=function(t){function e(e){var r=this,n=e||{},i=O({},n);return delete i.preload,delete i.useInterimTilesOnError,(r=t.call(this,i)||this).setPreload(void 0!==n.preload?n.preload:0),r.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),r}return Sv(e,t),e.prototype.getPreload=function(){return this.get(xv)},e.prototype.setPreload=function(t){this.set(xv,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(Ev)},e.prototype.setUseInterimTilesOnError=function(t){this.set(Ev,t)},e}(Fi),Tv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cv=function(t){function e(e){var r=t.call(this,e)||this;return r.extentChanged=!0,r.renderedExtent_=null,r.renderedPixelRatio,r.renderedProjection=null,r.renderedRevision,r.renderedTiles=[],r.newTiles_=!1,r.tmpExtent=[1/0,1/0,-1/0,-1/0],r.tmpTileRange_=new ef(0,0,0,0),r}return Tv(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),r=t.getState(),n=e.getUseInterimTilesOnError();return r==gu||r==vu||r==yu&&!n},e.prototype.getTile=function(t,e,r,n){var i=n.pixelRatio,o=n.viewState.projection,a=this.getLayer(),s=a.getSource().getTile(t,e,r,i,o);return s.getState()==yu&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(this.newTiles_=!0):s.setState(gu)),this.isDrawableTile(s)||(s=s.getInterimTile()),s},e.prototype.loadedTileCallback=function(e,r,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,r,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var r=t.layerStatesArray[t.layerIndex],n=t.viewState,i=n.projection,o=n.resolution,a=n.center,s=n.rotation,u=t.pixelRatio,l=this.getLayer(),h=l.getSource(),c=h.getRevision(),p=h.getTileGridForProjection(i),f=p.getZForResolution(o,h.zDirection),d=p.getResolution(f),_=t.extent,g=r.extent&&Wr(r.extent,i);g&&(_=_e(_,Wr(r.extent,i)));var y=h.getTilePixelRatio(u),v=Math.round(t.size[0]*y),m=Math.round(t.size[1]*y);if(s){var x=Math.round(Math.sqrt(v*v+m*m));v=x,m=x}var E=d*v/2/y,w=d*m/2/y,T=[a[0]-E,a[1]-w,a[0]+E,a[1]+w],C=p.getTileRangeForExtentAndZ(_,f),R={};R[f]={};var b=this.createLoadedTileFinder(h,i,R),P=this.tmpExtent,O=this.tmpTileRange_;this.newTiles_=!1;for(var I=C.minX;I<=C.maxX;++I)for(var L=C.minY;L<=C.maxY;++L){var F=this.getTile(f,I,L,t);if(this.isDrawableTile(F)){var M=S(this);if(F.getState()==gu){R[f][F.tileCoord.toString()]=F;var A=F.inTransition(M);this.newTiles_||!A&&-1!==this.renderedTiles.indexOf(F)||(this.newTiles_=!0)}if(1===F.getAlpha(M,t.time))continue}var N=p.getTileCoordChildTileRange(F.tileCoord,O,P),G=!1;N&&(G=b(f+1,N)),G||p.forEachTileCoordParentTileRange(F.tileCoord,b,O,P)}var D=d/o;tn(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/y,1/y,s,-v/2,-m/2);var k=Po(this.pixelTransform);this.useContainer(e,k,r.opacity);var U=this.context,z=U.canvas;en(this.inversePixelTransform,this.pixelTransform),tn(this.tempTransform_,v/2,m/2,D,D,0,-v/2,-m/2),z.width!=v||z.height!=m?(z.width=v,z.height=m):this.containerReused||U.clearRect(0,0,v,m),g&&this.clipUnrotated(U,t,g),this.preRender(U,t),this.renderedTiles.length=0;var B,Y,X,V=Object.keys(R).map(Number);V.sort(j),1!==r.opacity||this.containerReused&&!h.getOpaque(t.viewState.projection)?(B=[],Y=[]):V=V.reverse();for(var W=V.length-1;W>=0;--W){var Z=V[W],K=h.getTilePixelSize(Z,u,i),q=p.getResolution(Z)/d,H=K[0]*q*D,J=K[1]*q*D,Q=p.getTileCoordForCoordAndZ(ve(T),Z),$=p.getTileCoordExtent(Q),tt=Qr(this.tempTransform_,[y*($[0]-T[0])/d,y*(T[3]-$[3])/d]),et=y*h.getGutterForProjection(i),rt=R[Z];for(var nt in rt){var it=(F=rt[nt]).tileCoord,ot=tt[0]-(Q[1]-it[1])*H,at=Math.round(ot+H),st=tt[1]-(Q[2]-it[2])*J,ut=Math.round(st+J),lt=at-(I=Math.round(ot)),ht=ut-(L=Math.round(st)),ct=f===Z;if(!(A=ct&&1!==F.getAlpha(S(this),t.time)))if(B){U.save(),X=[I,L,I+lt,L,I+lt,L+ht,I,L+ht];for(var pt=0,ft=B.length;pt<ft;++pt)if(f!==Z&&Z<Y[pt]){var dt=B[pt];U.beginPath(),U.moveTo(X[0],X[1]),U.lineTo(X[2],X[3]),U.lineTo(X[4],X[5]),U.lineTo(X[6],X[7]),U.moveTo(dt[6],dt[7]),U.lineTo(dt[4],dt[5]),U.lineTo(dt[2],dt[3]),U.lineTo(dt[0],dt[1]),U.clip()}B.push(X),Y.push(Z)}else U.clearRect(I,L,lt,ht);this.drawTileImage(F,t,I,L,lt,ht,et,ct,r.opacity),B&&!A&&U.restore(),this.renderedTiles.push(F),this.updateUsedTiles(t.usedTiles,h,F)}}return this.renderedRevision=c,this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Jt(this.renderedExtent_,T),this.renderedExtent_=T,this.renderedPixelRatio=u,this.renderedProjection=i,this.manageTilePyramid(t,h,p,u,i,_,f,l.getPreload()),this.scheduleExpireCache(t,h),this.postRender(U,t),r.extent&&U.restore(),k!==z.style.transform&&(z.style.transform=k),this.container},e.prototype.drawTileImage=function(t,e,r,n,i,o,a,s,u){var l=this.getTileImage(t);if(l){var h=S(this),c=s?t.getAlpha(h,e.time):1,p=u*c,f=p!==this.context.globalAlpha;f&&(this.context.save(),this.context.globalAlpha=p),this.context.drawImage(l,a,a,l.width-2*a,l.height-2*a,r,n,i,o),f&&this.context.restore(),1!==c?e.animate=!0:s&&t.endTransition(h)}},e.prototype.getImage=function(){var t=this.context;return t?t.canvas:null},e.prototype.getTileImage=function(t){return t.getImage()},e.prototype.scheduleExpireCache=function(t,e){if(e.canExpireCache()){var r=function(t,e,r){var n=S(t);n in r.usedTiles&&t.expireCache(r.viewState.projection,r.usedTiles[n])}.bind(null,e);t.postRenderFunctions.push(r)}},e.prototype.updateUsedTiles=function(t,e,r){var n=S(e);n in t||(t[n]={}),t[n][r.getKey()]=!0},e.prototype.manageTilePyramid=function(t,e,r,n,i,o,a,s,u){var l=S(e);l in t.wantedTiles||(t.wantedTiles[l]={});var h,c,p,f,d,_,g=t.wantedTiles[l],y=t.tileQueue;for(_=r.getMinZoom();_<=a;++_)for(c=r.getTileRangeForExtentAndZ(o,_,c),p=r.getResolution(_),f=c.minX;f<=c.maxX;++f)for(d=c.minY;d<=c.maxY;++d)a-_<=s?((h=e.getTile(_,f,d,n,i)).getState()==du&&(g[h.getKey()]=!0,y.isKeyQueued(h.getKey())||y.enqueue([h,l,r.getTileCoordCenter(h.tileCoord),p])),void 0!==u&&u(h)):e.useTile(_,f,d,i)},e}(os);Cv.prototype.getLayer;var Rv=Cv,bv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pv=function(t){function e(e){return t.call(this,e)||this}return bv(e,t),e.prototype.createRenderer=function(){return new Rv(this)},e}(wv),Ov=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Iv=function(t){function e(e){var r=t.call(this,e)||this;return r.vectorRenderer_=new Ls(e),r.layerImageRatio_=e.getImageRatio(),r.coordinateToVectorPixelTransform_=[1,0,0,1,0,0],r.renderedPixelToCoordinateTransform_=null,r}return Ov(e,t),e.prototype.disposeInternal=function(){this.vectorRenderer_.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.getFeatures=function(t){if(this.vectorRenderer_){var e=Qr(this.coordinateToVectorPixelTransform_,Qr(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}return new Promise((function(t,e){t([])}))},e.prototype.handleFontsChanged=function(){this.vectorRenderer_.handleFontsChanged()},e.prototype.prepareFrame=function(t){var e=t.pixelRatio,r=t.viewState,n=r.resolution,i=t.viewHints,o=this.vectorRenderer_,a=t.extent;1!==this.layerImageRatio_&&Te(a=a.slice(0),this.layerImageRatio_);var s=xe(a)/n,u=fe(a)/n;if(!i[Vo]&&!i[Wo]&&!Se(a)){o.useContainer(null,null,1);var l=o.context,h=O({},t,{declutterItems:[],extent:a,size:[s,u],viewState:O({},t.viewState,{rotation:0})}),c=new fu(a,n,e,l.canvas,(function(t){o.prepareFrame(h)&&o.replayGroupChanged&&(o.renderFrame(h,null),su(h,null),t())}));c.addEventListener(J,function(){c.getState()===oo&&(this.image_=c)}.bind(this)),c.load()}if(this.image_){var p=this.image_,f=p.getResolution()*e/p.getPixelRatio();this.renderedResolution=f,this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.coordinateToVectorPixelTransform_=tn(this.coordinateToVectorPixelTransform_,s/2,u/2,1/f,-1/f,0,-r.center[0],-r.center[1])}return!!this.image_},e.prototype.preRender=function(){},e.prototype.postRender=function(){},e.prototype.forEachFeatureAtCoordinate=function(e,r,n,i,o){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(e,r,n,i,o):t.prototype.forEachFeatureAtCoordinate.call(this,e,r,n,i,o)},e}(yv),Lv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Fv=function(t){function e(e){var r=this,n=e||{},i=O({},n);return delete i.imageRatio,(r=t.call(this,i)||this).imageRatio_=void 0!==n.imageRatio?n.imageRatio:1,r}return Lv(e,t),e.prototype.getImageRatio=function(){return this.imageRatio_},e.prototype.createRenderer=function(){return new Iv(this)},e}(Xo),Mv="image",Av="hybrid",Nv="vector",Gv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jv={image:[Na,La,Aa,Ma,Ga],hybrid:[Na,Aa],vector:[]},Dv={image:[Fa],hybrid:[Ma,Ga,Fa],vector:[Na,La,Aa,Ma,Ga,Fa]},kv=function(t){function e(e){var r=t.call(this,e)||this;return r.boundHandleStyleImageChange_=r.handleStyleImageChange_.bind(r),r.dirty_=!1,r.renderedLayerRevision_,r.renderedPixelToCoordinateTransform_=null,r.renderedRotation_,r.renderTileImageQueue_={},r.tileListenerKeys_={},r.tmpTransform_=[1,0,0,1,0,0],r}return Gv(e,t),e.prototype.prepareTile=function(t,e,r,n){var i,o=S(t),a=t.getState();return(a===gu&&t.hifi||a===yu)&&o in this.tileListenerKeys_&&(N(this.tileListenerKeys_[o]),delete this.tileListenerKeys_[o]),a!==gu&&a!==yu||(this.updateExecutorGroup_(t,e,r),this.tileImageNeedsRender_(t,e,r)&&(i=!0,n&&(this.renderTileImageQueue_[o]=t))),i},e.prototype.getTile=function(e,r,n,i){var o=i.pixelRatio,a=i.viewState,s=a.resolution,u=a.projection,l=this.getLayer(),h=l.getSource().getTile(e,r,n,o,u);if(h.getState()<gu){h.wantedResolution=s;var c=S(h);if(!(c in this.tileListenerKeys_)){var p=M(h,J,this.prepareTile.bind(this,h,o,u,!0));this.tileListenerKeys_[c]=p}}else{var f=i.viewHints;!!(f[Vo]||f[Wo])&&h.wantedResolution||(h.wantedResolution=s),this.prepareTile(h,o,u,!1)&&l.getRenderMode()!==Nv&&this.renderTileImage_(h,i)}return t.prototype.getTile.call(this,e,r,n,i)},e.prototype.isDrawableTile=function(e){var r=this.getLayer();return t.prototype.isDrawableTile.call(this,e)&&r.getRenderMode()===Nv||e.hasContext(r)},e.prototype.getTileImage=function(t){return t.getImage(this.getLayer())},e.prototype.prepareFrame=function(e){var r=this.getLayer().getRevision();return this.renderedLayerRevision_!=r&&(this.renderedTiles.length=0),this.renderedLayerRevision_=r,t.prototype.prepareFrame.call(this,e)},e.prototype.updateExecutorGroup_=function(t,e,r){var n=this.getLayer(),i=n.getRevision(),o=n.getRenderOrder()||null,a=t.wantedResolution,s=t.getReplayState(n);if(s.dirty||s.renderedResolution!==a||s.renderedRevision!=i||s.renderedRenderOrder!=o||s.renderedZ!==t.sourceZ){var u=n.getSource(),l=u.getTileGrid(),h=u.getTileGridForProjection(r).getTileCoordExtent(t.wrappedTileCoord),c=u.getSourceTiles(e,r,t),p=S(n);delete t.hitDetectionImageData[p],t.executorGroups[p]=[];for(var f=function(r,i){var f=c[r];if(f.getState()!=gu)return"continue";var _=f.tileCoord,g=l.getTileCoordExtent(_),y=_e(h,g),v=Jt(g,y)?null:jt(y,n.getRenderBuffer()*a,d.tmpExtent);s.dirty=!1;var m=new Ia(0,y,a,e,n.getDeclutter()),x=us(a,e),E=function(t){var e,r=t.getStyleFunction()||n.getStyleFunction();if(r&&(e=r(t,a)),e){var i=this.renderFeature(t,x,e,m);this.dirty_=this.dirty_||i,s.dirty=s.dirty||i}},S=f.getFeatures();o&&o!==s.renderedRenderOrder&&S.sort(o);for(var w=0,T=S.length;w<T;++w){var C=S[w];v&&!Ee(v,C.getGeometry().getExtent())||E.call(d,C)}var R=m.finish(),b=n.getRenderMode()!==Nv&&n.getDeclutter()&&1===c.length?null:y,P=new $a(b,a,e,u.getOverlaps(),R,n.getRenderBuffer());t.executorGroups[p].push(P)},d=this,_=0,g=c.length;_<g;++_)f(_);s.renderedRevision=i,s.renderedZ=t.sourceZ,s.renderedRenderOrder=o,s.renderedResolution=a}},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){var o=e.viewState.resolution,a=e.viewState.rotation;r=null==r?0:r;var s,u,l,h=this.getLayer(),c=h.getDeclutter(),p=h.getSource().getTileGridForProjection(e.viewState.projection),f={},d=this.renderedTiles,_=function(){var e=d[u],l=Ut(p.getTileCoordExtent(e.wrappedTileCoord),t);if(!c&&!l)return"continue";for(var _=e.executorGroups[S(h)],g=0,y=_.length;g<y;++g){var v=_[g];s=s||v.forEachFeatureAtCoordinate(t,o,a,r,(function(t){if(l||i&&-1!==i.indexOf(t)){var e=t.getId();if(void 0===e&&(e=S(t)),!(e in f))return f[e]=!0,n(t,h)}}),h.getDeclutter()?i:null)}};for(u=0,l=d.length;u<l;++u)_();return s},e.prototype.getFeatures=function(t){return new Promise(function(e,r){for(var n,i=this.getLayer(),o=S(i),a=i.getSource(),s=this.renderedProjection,u=s.getExtent(),l=this.renderedResolution,h=a.getTileGridForProjection(s),c=Qr(this.renderedPixelToCoordinateTransform_,t.slice()),p=h.getTileCoordForCoordAndResolution(c,l),f=0,d=this.renderedTiles.length;f<d;++f)if(p.toString()===this.renderedTiles[f].tileCoord.toString()){if((n=this.renderedTiles[f]).getState()===gu&&n.hifi){var _=h.getTileCoordExtent(n.tileCoord);a.getWrapX()&&s.canWrapX()&&!zt(u,_)&&la(c,s);break}n=void 0}if(!n||n.loadingSourceTiles>0)e([]);else{var g=ve(h.getTileCoordExtent(n.wrappedTileCoord)),y=[(c[0]-g[0])/l,(g[1]-c[1])/l],v=n.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]),m=n.hitDetectionImageData[o];if(!m&&!this.animatingOrInteracting_){var x=gl(h.getTileSize(h.getZForResolution(l))),E=[x[0]/2,x[1]/2],w=this.renderedRotation_;m=Ps(x,[this.getRenderTransform(h.getTileCoordCenter(n.wrappedTileCoord),l,0,.5,E[0],E[1],0)],v,i.getStyleFunction(),h.getTileCoordExtent(n.wrappedTileCoord),n.getReplayState(i).renderedResolution,w),n.hitDetectionImageData[o]=m}e(Os(y,v,m))}}.bind(this))},e.prototype.handleFontsChanged=function(){I(this.renderTileImageQueue_);var t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.renderFrame=function(e,r){var n=e.viewHints,i=!(n[Vo]||n[Wo]);this.renderQueuedTileImages_(i,e),t.prototype.renderFrame.call(this,e,r),this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;var o=this.getLayer(),a=o.getRenderMode();if(a===Mv)return this.container;var s=o.getSource(),u=e.usedTiles[S(s)];for(var l in this.renderTileImageQueue_)u&&l in u||delete this.renderTileImageQueue_[l];for(var h=this.context,c=o.getDeclutter()?{}:null,p=Dv[a],f=e.pixelRatio,d=e.viewState,_=d.center,g=d.resolution,y=d.rotation,v=e.size,m=Math.round(v[0]*f),x=Math.round(v[1]*f),E=this.renderedTiles,w=s.getTileGridForProjection(e.viewState.projection),T=[],C=[],R=E.length-1;R>=0;--R)for(var b=E[R],P=b.tileCoord,O=w.getTileCoordExtent(b.wrappedTileCoord),I=w.getTileCoordExtent(P,this.tmpExtent)[0]-O[0],L=Hr($r(this.inversePixelTransform.slice(),1/f,1/f),this.getRenderTransform(_,g,y,f,m,x,I)),F=b.executorGroups[S(o)],M=!1,A=0,N=F.length;A<N;++A){var G=F[A];if(G.hasExecutors(p)){var j=b.tileCoord[0],D=void 0;if(!c&&!M){D=G.getClipCoords(L),h.save();for(var k=0,U=T.length;k<U;++k){var z=T[k];j<C[k]&&(h.beginPath(),h.moveTo(D[0],D[1]),h.lineTo(D[2],D[3]),h.lineTo(D[4],D[5]),h.lineTo(D[6],D[7]),h.moveTo(z[6],z[7]),h.lineTo(z[4],z[5]),h.lineTo(z[2],z[3]),h.lineTo(z[0],z[1]),h.clip())}}G.execute(h,L,y,i,p,c),c||M||(h.restore(),T.push(D),C.push(j),M=!0)}}c&&Qa(c,h,y,e.layerStatesArray[e.layerIndex].opacity,i,e.declutterItems);return this.container},e.prototype.renderQueuedTileImages_=function(t,e){for(var r in this.renderTileImageQueue_){if(!t&&Date.now()-e.time>8){e.animate=!0;break}var n=this.renderTileImageQueue_[r];delete this.renderTileImageQueue_[r],this.renderTileImage_(n,e)}},e.prototype.renderFeature=function(t,e,r,n){if(!r)return!1;var i=!1;if(Array.isArray(r))for(var o=0,a=r.length;o<a;++o)i=hs(n,t,r[o],e,this.boundHandleStyleImageChange_)||i;else i=hs(n,t,r,e,this.boundHandleStyleImageChange_);return i},e.prototype.tileImageNeedsRender_=function(t,e,r){var n=this.getLayer(),i=t.getReplayState(n),o=n.getRevision(),a=t.sourceZ,s=t.wantedResolution;return i.renderedTileResolution!==s||i.renderedTileRevision!==o||i.renderedTileZ!==a},e.prototype.renderTileImage_=function(t,e){var r=this.getLayer(),n=t.getReplayState(r),i=r.getRevision(),o=t.executorGroups[S(r)];n.renderedTileRevision=i,n.renderedTileZ=t.sourceZ;var a=t.wrappedTileCoord,s=a[0],u=r.getSource(),l=e.pixelRatio,h=e.viewState.projection,c=u.getTileGridForProjection(h),p=c.getResolution(t.tileCoord[0]),f=e.pixelRatio/t.wantedResolution*p,d=c.getResolution(s),_=t.getContext(r);l=Math.max(l,f/l);var g=u.getTilePixelSize(s,l,h);_.canvas.width=g[0],_.canvas.height=g[1];var y=l/f;if(1!==y){var v=qr(this.tmpTransform_);$r(v,y,y),_.setTransform.apply(_,v)}var m=c.getTileCoordExtent(a,this.tmpExtent),x=f/d,E=qr(this.tmpTransform_);$r(E,x,-x),function(t,e,r){Hr(t,Jr(Kr,1,0,0,1,e,r))}(E,-m[0],-m[3]);for(var w=0,T=o.length;w<T;++w){o[w].execute(_,E,0,!0,jv[r.getRenderMode()])}n.renderedTileResolution=t.wantedResolution},e}(Rv),Uv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zv=function(t){function e(e){var r=this,n=e||{},i=O({},n);delete i.preload,delete i.useInterimTilesOnError,r=t.call(this,i)||this;var o=n.renderMode||Av;return wt(null==o||o==Mv||o==Av||o==Nv,28),r.renderMode_=o,r.setPreload(n.preload?n.preload:0),r.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),r}return Uv(e,t),e.prototype.createRenderer=function(){return new kv(this)},e.prototype.getFeatures=function(e){return t.prototype.getFeatures.call(this,e)},e.prototype.getRenderMode=function(){return this.renderMode_},e.prototype.getPreload=function(){return this.get(xv)},e.prototype.getUseInterimTilesOnError=function(){return this.get(Ev)},e.prototype.setPreload=function(t){this.set(xv,t)},e.prototype.setUseInterimTilesOnError=function(t){this.set(Ev,t)},e}(Xo);function Bv(t){var e,r,n=Object.keys(t.defs),i=n.length;for(e=0;e<i;++e){var o=n[e];if(!Sr(o)){var a=t.defs(o);xr(new tr({code:o,axisOrientation:a.axis,metersPerUnit:a.to_meter,units:a.units}))}}for(e=0;e<i;++e){var s=n[e],u=Sr(s);for(r=0;r<i;++r){var l=n[r],h=Sr(l);if(!gr(s,l))if(t.defs[s]===t.defs[l])Tr([u,h]);else{var c=t(s,l);Or(u,h,c.forward,c.inverse)}}}}function Yv(t,e){var r=/\{z\}/g,n=/\{x\}/g,i=/\{y\}/g,o=/\{-y\}/g;return function(a,s,u){return a?t.replace(r,a[0].toString()).replace(n,a[1].toString()).replace(i,a[2].toString()).replace(o,(function(){var t=a[0],r=e.getFullTileRange(t);return wt(r,55),(r.getHeight()-a[2]-1).toString()})):void 0}}function Xv(t,e){for(var r=t.length,n=new Array(r),i=0;i<r;++i)n[i]=Yv(t[i],e);return Vv(n)}function Vv(t){return 1===t.length?t[0]:function(e,r,n){if(e){var i=Be(Hp(e),t.length);return t[i](e,r,n)}}}function Wv(t,e,r){}function Zv(t){var e=[],r=/\{([a-z])-([a-z])\}/.exec(t);if(r){var n=r[1].charCodeAt(0),i=r[2].charCodeAt(0),o=void 0;for(o=n;o<=i;++o)e.push(t.replace(r[0],String.fromCharCode(o)));return e}if(r=/\{(\d+)-(\d+)\}/.exec(t)){for(var a=parseInt(r[2],10),s=parseInt(r[1],10);s<=a;s++)e.push(t.replace(r[0],s.toString()));return e}return e.push(t),e}function Kv(t,e,r,n){var i=document.createElement("script"),o="olc_"+S(e);function a(){delete window[o],i.parentNode.removeChild(i)}i.async=!0,i.src=t+(-1==t.indexOf("?")?"?":"&")+(n||"callback")+"="+o;var s=setTimeout((function(){a(),r&&r()}),1e4);window[o]=function(t){clearTimeout(s),a(),e(t)},document.getElementsByTagName("head")[0].appendChild(i)}function qv(t,e,r,n){var i=Nr(r,e,t),o=wr(e,n,r),a=e.getMetersPerUnit();void 0!==a&&(o*=a);var s=t.getMetersPerUnit();void 0!==s&&(o/=s);var u=t.getExtent();if(!u||Ut(u,i)){var l=wr(t,o,i)/o;isFinite(l)&&l>0&&(o/=l)}return o}function Hv(t,e,r,n){var i=r-t,o=n-e,a=Math.sqrt(i*i+o*o);return[Math.round(r+i/a),Math.round(n+o/a)]}function Jv(t,e,r,n,i,o,a,s,u,l,h){var c=Ji(Math.round(r*t),Math.round(r*e));if(0===u.length)return c.canvas;c.scale(r,r);var p=[1/0,1/0,-1/0,-1/0];u.forEach((function(t,e,r){$t(p,t.extent)}));var f=xe(p),d=fe(p),_=Ji(Math.round(r*f/n),Math.round(r*d/n)),g=r/n;u.forEach((function(t,e,r){var n=t.extent[0]-p[0],i=-(t.extent[3]-p[3]),o=xe(t.extent),a=fe(t.extent);_.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,n*g,i*g,o*g,a*g)}));var y=ve(a);return s.getTriangles().forEach((function(t,e,i){var a=t.source,s=t.target,u=a[0][0],l=a[0][1],h=a[1][0],f=a[1][1],d=a[2][0],g=a[2][1],v=(s[0][0]-y[0])/o,m=-(s[0][1]-y[1])/o,x=(s[1][0]-y[0])/o,E=-(s[1][1]-y[1])/o,S=(s[2][0]-y[0])/o,w=-(s[2][1]-y[1])/o,T=u,C=l;u=0,l=0;var R=function(t){for(var e=t.length,r=0;r<e;r++){for(var n=r,i=Math.abs(t[r][r]),o=r+1;o<e;o++){var a=Math.abs(t[o][r]);a>i&&(i=a,n=o)}if(0===i)return null;var s=t[n];t[n]=t[r],t[r]=s;for(var u=r+1;u<e;u++)for(var l=-t[u][r]/t[r][r],h=r;h<e+1;h++)r==h?t[u][h]=0:t[u][h]+=l*t[r][h]}for(var c=new Array(e),p=e-1;p>=0;p--){c[p]=t[p][e]/t[p][p];for(var f=p-1;f>=0;f--)t[f][e]-=t[f][p]*c[p]}return c}([[h-=T,f-=C,0,0,x-v],[d-=T,g-=C,0,0,S-v],[0,0,h,f,E-m],[0,0,d,g,w-m]]);if(R){c.save(),c.beginPath();var b=(v+x+S)/3,P=(m+E+w)/3,O=Hv(b,P,v,m),I=Hv(b,P,x,E),L=Hv(b,P,S,w);c.moveTo(I[0],I[1]),c.lineTo(O[0],O[1]),c.lineTo(L[0],L[1]),c.clip(),c.transform(R[0],R[2],R[1],R[3],v,m),c.translate(p[0]-T,p[3]-C),c.scale(n/r,-n/r),c.drawImage(_.canvas,0,0),c.restore()}})),h&&(c.save(),c.strokeStyle="black",c.lineWidth=1,s.getTriangles().forEach((function(t,e,r){var n=t.target,i=(n[0][0]-y[0])/o,a=-(n[0][1]-y[1])/o,s=(n[1][0]-y[0])/o,u=-(n[1][1]-y[1])/o,l=(n[2][0]-y[0])/o,h=-(n[2][1]-y[1])/o;c.beginPath(),c.moveTo(s,u),c.lineTo(i,a),c.lineTo(l,h),c.closePath(),c.stroke()})),c.restore()),c.canvas}var Qv=function(){function t(t,e,r,n,i,o){this.sourceProj_=t,this.targetProj_=e;var a={},s=Ar(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return a[e]||(a[e]=s(t)),a[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&xe(n)==xe(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?xe(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?xe(this.targetProj_.getExtent()):null;var u=ve(r),l=me(r),h=ue(r),c=se(r),p=this.transformInv_(u),f=this.transformInv_(l),d=this.transformInv_(h),_=this.transformInv_(c),g=10+(o?Math.max(0,Math.ceil(Math.log2(ae(r)/(o*o*256*256)))):0);if(this.addQuad_(u,l,h,c,p,f,d,_,g),this.wrapsXInSource_){var y=1/0;this.triangles_.forEach((function(t,e,r){y=Math.min(y,t.source[0][0],t.source[1][0],t.source[2][0])})),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-y>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-y>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-y>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-y>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var r=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-r<this.sourceWorldWidth_/2&&(t.source=e)}}.bind(this))}a={}}return t.prototype.addTriangle_=function(t,e,r,n,i,o){this.triangles_.push({source:[n,i,o],target:[t,e,r]})},t.prototype.addQuad_=function(t,e,r,n,i,o,a,s,u){var l=Gt([i,o,a,s]),h=this.sourceWorldWidth_?xe(l)/this.sourceWorldWidth_:null,c=this.sourceWorldWidth_,p=this.sourceProj_.canWrapX()&&h>.5&&h<1,f=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)f=xe(Gt([t,e,r,n]))/this.targetWorldWidth_>.25||f;!p&&this.sourceProj_.isGlobal()&&h&&(f=h>.25||f)}if(f||!this.maxSourceExtent_||Ee(l,this.maxSourceExtent_)){if(!(f||isFinite(i[0])&&isFinite(i[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(s[0])&&isFinite(s[1]))){if(!(u>0))return;f=!0}if(u>0){if(!f){var d=[(t[0]+r[0])/2,(t[1]+r[1])/2],_=this.transformInv_(d),g=void 0;if(p)g=(Be(i[0],c)+Be(a[0],c))/2-Be(_[0],c);else g=(i[0]+a[0])/2-_[0];var y=(i[1]+a[1])/2-_[1];f=g*g+y*y>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-r[0])<=Math.abs(t[1]-r[1])){var v=[(e[0]+r[0])/2,(e[1]+r[1])/2],m=this.transformInv_(v),x=[(n[0]+t[0])/2,(n[1]+t[1])/2],E=this.transformInv_(x);this.addQuad_(t,e,v,x,i,o,m,E,u-1),this.addQuad_(x,v,r,n,E,m,a,s,u-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2],w=this.transformInv_(S),T=[(r[0]+n[0])/2,(r[1]+n[1])/2],C=this.transformInv_(T);this.addQuad_(t,S,T,n,i,w,C,s,u-1),this.addQuad_(S,e,r,T,w,o,a,C,u-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}this.addTriangle_(t,r,n,i,a,s),this.addTriangle_(t,e,r,i,o,a)}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,r,n){var i=e.source;te(t,i[0]),te(t,i[1]),te(t,i[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),$v=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tm=function(t){function e(e,r,n,i,o,a,s,u,l,h,c){var p=t.call(this,o,du)||this;p.renderEdges_=void 0!==c&&c,p.pixelRatio_=s,p.gutter_=u,p.canvas_=null,p.sourceTileGrid_=r,p.targetTileGrid_=i,p.wrappedTileCoord_=a||o,p.sourceTiles_=[],p.sourcesListenerKeys_=null,p.sourceZ_=0;var f=i.getTileCoordExtent(p.wrappedTileCoord_),d=p.targetTileGrid_.getExtent(),_=p.sourceTileGrid_.getExtent(),g=d?_e(f,d):f;if(0===ae(g))return p.state=vu,p;var y=e.getExtent();y&&(_=_?_e(_,y):y);var v=i.getResolution(p.wrappedTileCoord_[0]),m=qv(e,n,le(g),v);if(!isFinite(m)||m<=0)return p.state=vu,p;var x=void 0!==h?h:.5;if(p.triangulation_=new Qv(e,n,g,_,m*x,v),0===p.triangulation_.getTriangles().length)return p.state=vu,p;p.sourceZ_=r.getZForResolution(m);var E=p.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(E[1]=Ge(E[1],_[1],_[3]),E[3]=Ge(E[3],_[1],_[3])):E=_e(E,_)),ae(E)){for(var S=r.getTileRangeForExtentAndZ(E,p.sourceZ_),w=S.minX;w<=S.maxX;w++)for(var T=S.minY;T<=S.maxY;T++){var C=l(p.sourceZ_,w,T,s);C&&p.sourceTiles_.push(C)}0===p.sourceTiles_.length&&(p.state=vu)}else p.state=vu;return p}return $v(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,r,n){e&&e.getState()==gu&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=yu;else{var e=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(e),n="number"==typeof r?r:r[0],i="number"==typeof r?r:r[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Jv(n,i,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,s,this.triangulation_,t,this.gutter_,this.renderEdges_),this.state=gu}this.changed()},e.prototype.load=function(){if(this.state==du){this.state=_u,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,r,n){var i=e.getState();if(i==du||i==_u){t++;var o=M(e,J,(function(r){var n=e.getState();n!=gu&&n!=yu&&n!=vu||(N(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach((function(t,e,r){t.getState()==du&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(N),this.sourcesListenerKeys_=null},e}(Tu),em=[0,0,0],rm=function(){function t(t){var e,r,n,i;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,wt((e=this.resolutions_,r=!0,n=function(t,e){return e-t}||j,e.every((function(t,i){if(0===i)return!0;var o=n(e[i-1],t);return!(o>0||r&&0===o)}))),17),!t.origins)for(var o=0,a=this.resolutions_.length-1;o<a;++o)if(i){if(this.resolutions_[o]/this.resolutions_[o+1]!==i){i=void 0;break}}else i=this.resolutions_[o]/this.resolutions_[o+1];this.zoomFactor_=i,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,wt(this.origins_.length==this.resolutions_.length,20));var s=t.extent;void 0===s||this.origin_||this.origins_||(this.origin_=ve(s)),wt(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,wt(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:256,wt(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=void 0!==s?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((function(t,e){return new ef(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1))}),this):s&&this.calculateTileRanges_(s)}return t.prototype.forEachTileCoord=function(t,e,r){for(var n=this.getTileRangeForExtentAndZ(t,e),i=n.minX,o=n.maxX;i<=o;++i)for(var a=n.minY,s=n.maxY;a<=s;++a)r([e,i,a])},t.prototype.forEachTileCoordParentTileRange=function(t,e,r,n){var i,o,a=null,s=t[0]-1;for(2===this.zoomFactor_?(i=t[1],o=t[2]):a=this.getTileCoordExtent(t,n);s>=this.minZoom;){if(e(s,2===this.zoomFactor_?tf(i=Math.floor(i/2),i,o=Math.floor(o/2),o,r):this.getTileRangeForExtentAndZ(a,s,r)))return!0;--s}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,r){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){var n=2*t[1],i=2*t[2];return tf(n,n+1,i,i+1,e)}var o=this.getTileCoordExtent(t,r);return this.getTileRangeForExtentAndZ(o,t[0]+1,e)}return null},t.prototype.getTileRangeExtent=function(t,e,r){var n=this.getOrigin(t),i=this.getResolution(t),o=gl(this.getTileSize(t),this.tmpSize_),a=n[0]+e.minX*o[0]*i,s=n[0]+(e.maxX+1)*o[0]*i;return Vt(a,n[1]+e.minY*o[1]*i,s,n[1]+(e.maxY+1)*o[1]*i,r)},t.prototype.getTileRangeForExtentAndZ=function(t,e,r){var n=em;this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,n);var i=n[1],o=n[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,n),tf(i,n[1],o,n[2],r)},t.prototype.getTileCoordCenter=function(t){var e=this.getOrigin(t[0]),r=this.getResolution(t[0]),n=gl(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*r,e[1]-(t[2]+.5)*n[1]*r]},t.prototype.getTileCoordExtent=function(t,e){var r=this.getOrigin(t[0]),n=this.getResolution(t[0]),i=gl(this.getTileSize(t[0]),this.tmpSize_),o=r[0]+t[1]*i[0]*n,a=r[1]-(t[2]+1)*i[1]*n;return Vt(o,a,o+i[0]*n,a+i[1]*n,e)},t.prototype.getTileCoordForCoordAndResolution=function(t,e,r){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,r)},t.prototype.getTileCoordForXYAndResolution_=function(t,e,r,n,i){var o=this.getZForResolution(r),a=r/this.getResolution(o),s=this.getOrigin(o),u=gl(this.getTileSize(o),this.tmpSize_),l=n?.5:0,h=n?.5:0,c=Math.floor((t-s[0])/r+l),p=Math.floor((s[1]-e)/r+h),f=a*c/u[0],d=a*p/u[1];return n?(f=Math.ceil(f)-1,d=Math.ceil(d)-1):(f=Math.floor(f),d=Math.floor(d)),Wp(o,f,d,i)},t.prototype.getTileCoordForXYAndZ_=function(t,e,r,n,i){var o=this.getOrigin(r),a=this.getResolution(r),s=gl(this.getTileSize(r),this.tmpSize_),u=n?.5:0,l=n?.5:0,h=Math.floor((t-o[0])/a+u),c=Math.floor((o[1]-e)/a+l),p=h/s[0],f=c/s[1];return n?(p=Math.ceil(p)-1,f=Math.ceil(f)-1):(p=Math.floor(p),f=Math.floor(f)),Wp(r,p,f,i)},t.prototype.getTileCoordForCoordAndZ=function(t,e,r){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,r)},t.prototype.getTileCoordResolution=function(t){return this.resolutions_[t[0]]},t.prototype.getTileSize=function(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]},t.prototype.getFullTileRange=function(t){return this.fullTileRanges_?this.fullTileRanges_[t]:null},t.prototype.getZForResolution=function(t,e){return Ge(k(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)},t.prototype.calculateTileRanges_=function(t){for(var e=this.resolutions_.length,r=new Array(e),n=this.minZoom;n<e;++n)r[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=r},t}();function nm(t){var e=t.getDefaultTileGrid();return e||(e=am(t),t.setDefaultTileGrid(e)),e}function im(t){var e=t||{},r=e.extent||Sr("EPSG:3857").getExtent(),n={extent:r,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:om(r,e.maxZoom,e.tileSize,e.maxResolution)};return new rm(n)}function om(t,e,r,n){for(var i=void 0!==e?e:42,o=fe(t),a=xe(t),s=gl(void 0!==r?r:256),u=n>0?n:Math.max(a/s[0],o/s[1]),l=i+1,h=new Array(l),c=0;c<l;++c)h[c]=u/Math.pow(2,c);return h}function am(t,e,r,n){return function(t,e,r,n){var i=void 0!==n?n:Pt,o=om(t,e,r);return new rm({extent:t,origin:he(t,i),resolutions:o,tileSize:r})}(sm(t),e,r,n)}function sm(t){var e=(t=Sr(t)).getExtent();if(!e){var r=180*Qe[$e.DEGREES]/t.getMetersPerUnit();e=Vt(-r,-r,r,r)}return e}var um=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lm=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX})||this;r.opaque_=void 0!==e.opaque&&e.opaque,r.tilePixelRatio_=void 0!==e.tilePixelRatio?e.tilePixelRatio:1,r.tileGrid=void 0!==e.tileGrid?e.tileGrid:null;var n=[256,256],i=e.tileGrid;i&&gl(i.getTileSize(i.getMinZoom()),n);var o="undefined"!=typeof screen,a=o?screen.availWidth||screen.width:1920,s=o?screen.availHeight||screen.height:1080,u=4*Math.ceil(a/n[0])*Math.ceil(s/n[1]);return r.tileCache=new Qp(Math.max(u,e.cacheSize||0)),r.tmpSize=[0,0],r.key_=e.key||"",r.tileOptions={transition:e.transition},r.zDirection=e.zDirection?e.zDirection:0,r}return um(e,t),e.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);r&&r.expireCache(e)},e.prototype.forEachLoadedTile=function(t,e,r,n){var i=this.getTileCacheForProjection(t);if(!i)return!1;for(var o,a,s,u=!0,l=r.minX;l<=r.maxX;++l)for(var h=r.minY;h<=r.maxY;++h)a=Zp(e,l,h),s=!1,i.containsKey(a)&&(s=(o=i.get(a)).getState()===gu)&&(s=!1!==n(o)),s||(u=!1);return u},e.prototype.getGutterForProjection=function(t){return 0},e.prototype.getKey=function(){return this.key_},e.prototype.setKey=function(t){this.key_!==t&&(this.key_=t,this.changed())},e.prototype.getOpaque=function(t){return this.opaque_},e.prototype.getResolutions=function(){return this.tileGrid.getResolutions()},e.prototype.getTile=function(t,e,r,n,i){return x()},e.prototype.getTileGrid=function(){return this.tileGrid},e.prototype.getTileGridForProjection=function(t){return this.tileGrid?this.tileGrid:nm(t)},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();return e&&!Fr(e,t)?null:this.tileCache},e.prototype.getTilePixelRatio=function(t){return this.tilePixelRatio_},e.prototype.getTilePixelSize=function(t,e,r){var n=this.getTileGridForProjection(r),i=this.getTilePixelRatio(e),o=gl(n.getTileSize(t),this.tmpSize);return 1==i?o:_l(o,i,this.tmpSize)},e.prototype.getTileCoordForTileUrlFunction=function(t,e){var r=void 0!==e?e:this.getProjection(),n=this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(t=function(t,e,r){var n=e[0],i=t.getTileCoordCenter(e),o=sm(r);if(Ut(o,i))return e;var a=xe(o),s=Math.ceil((o[0]-i[0])/a);return i[0]+=a*s,t.getTileCoordForCoordAndZ(i,n)}(n,t,r)),function(t,e){var r=t[0],n=t[1],i=t[2];if(e.getMinZoom()>r||r>e.getMaxZoom())return!1;var o,a=e.getExtent();return!(o=a?e.getTileRangeForExtentAndZ(a,r):e.getFullTileRange(r))||o.containsXY(n,i)}(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.useTile=function(t,e,r,n){},e}(Js),hm=function(t){function e(e,r){var n=t.call(this,e)||this;return n.tile=r,n}return um(e,t),e}(K),cm=lm,pm="tileloadstart",fm="tileloadend",dm="tileloaderror",_m=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gm=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return r.generateTileUrlFunction_=!e.tileUrlFunction,r.tileLoadFunction=e.tileLoadFunction,r.tileUrlFunction=e.tileUrlFunction?e.tileUrlFunction.bind(r):Wv,r.urls=null,e.urls?r.setUrls(e.urls):e.url&&r.setUrl(e.url),r.tileLoadingKeys_={},r}return _m(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,r=t.target,n=S(r),i=r.getState();i==_u?(this.tileLoadingKeys_[n]=!0,e=pm):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==yu?dm:i==gu?fm:void 0),null!=e&&this.dispatchEvent(new hm(e,r))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=Zv(t);this.urls=e,this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(Xv(t,this.tileGrid),e):this.setKey(e)},e.prototype.useTile=function(t,e,r){var n=Zp(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(cm),ym=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function vm(t,e){t.getImage().src=e}var mm=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:vm,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return r.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,r.tileClass=void 0!==e.tileClass?e.tileClass:Ru,r.tileCacheForProjection={},r.tileGridForProjection={},r.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,r.renderReprojectionEdges_=!1,r}return ym(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==r?e:{}),this.tileCacheForProjection){var i=this.tileCacheForProjection[n];i.expireCache(i==r?e:{})}},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Fr(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Fr(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Fr(e,t)){var r=S(t);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=nm(t)),this.tileGridForProjection[r]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Fr(e,t))return this.tileCache;var r=S(t);return r in this.tileCacheForProjection||(this.tileCacheForProjection[r]=new Qp(this.tileCache.highWaterMark)),this.tileCacheForProjection[r]},e.prototype.createTile_=function(t,e,r,n,i,o){var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),u=s?this.tileUrlFunction(s,n,i):void 0,l=new this.tileClass(a,void 0!==u?du:vu,void 0!==u?u:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=o,l.addEventListener(J,this.handleTileChange.bind(this)),l},e.prototype.getTile=function(t,e,r,n,i){var o=this.getProjection();if(o&&i&&!Fr(o,i)){var a=this.getTileCacheForProjection(i),s=[t,e,r],u=void 0,l=Kp(s);a.containsKey(l)&&(u=a.get(l));var h=this.getKey();if(u&&u.key==h)return u;var c=this.getTileGridForProjection(o),p=this.getTileGridForProjection(i),f=this.getTileCoordForTileUrlFunction(s,i),d=new tm(o,c,i,p,s,f,this.getTilePixelRatio(n),this.getGutter(),function(t,e,r,n){return this.getTileInternal(t,e,r,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);return d.key=h,u?(d.interimTile=u,d.refreshInterimChain(),a.replace(l,d)):a.set(l,d),d}return this.getTileInternal(t,e,r,n,o||i)},e.prototype.getTileInternal=function(t,e,r,n,i){var o=null,a=Zp(t,e,r),s=this.getKey();if(this.tileCache.containsKey(a)){if((o=this.tileCache.get(a)).key!=s){var u=o;o=this.createTile_(t,e,r,n,i,s),u.getState()==du?o.interimTile=u.interimTile:o.interimTile=u,o.refreshInterimChain(),this.tileCache.replace(a,o)}}else o=this.createTile_(t,e,r,n,i,s),this.tileCache.set(a,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var r=Sr(t);if(r){var n=S(r);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}},e}(gm),xm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Em=function(t){function e(e){var r=this,n=void 0!==e.hidpi&&e.hidpi;return(r=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",opaque:!0,projection:Sr("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:bi,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:n?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this).hidpi_=n,r.culture_=void 0!==e.culture?e.culture:"en-us",r.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,r.apiKey_=e.key,r.imagerySet_=e.imagerySet,Kv("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+r.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+r.apiKey_+"&c="+r.culture_,r.handleImageryMetadataResponse.bind(r),void 0,"jsonp"),r}return xm(e,t),e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],r=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=sm(this.getProjection()),i=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/i:[e.imageWidth/i,e.imageHeight/i],a=im({extent:n,minZoom:e.zoomMin,maxZoom:r,tileSize:o});this.tileGrid=a;var s=this.culture_,u=this.hidpi_;if(this.tileUrlFunction=Vv(e.imageUrlSubdomains.map((function(t){var r=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,i){if(t){Wp(t[0],t[1],t[2],r);var o=n;return u&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",function(t){var e,r,n=t[0],i=new Array(n),o=1<<n-1;for(e=0;e<n;++e)r=48,t[1]&o&&(r+=1),t[2]&o&&(r+=2),i[e]=String.fromCharCode(r),o>>=1;return i.join("")}(r))}}}))),e.imageryProviders){var l=Mr(Sr("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var r=[],n=t.viewState,i=this.getTileGrid(),o=i.getZForResolution(n.resolution,this.zDirection),a=i.getTileCoordForCoordAndZ(n.center,o)[0];return e.imageryProviders.map((function(e){for(var n=!1,i=e.coverageAreas,o=0,s=i.length;o<s;++o){var u=i[o];if(a>=u.zoomMin&&a<=u.zoomMax){var h=u.bbox;if(Ee(Re([h[1],h[0],h[3],h[2]],l),t.extent)){n=!0;break}}}n&&r.push(e.attribution)})),r.push('<a class="ol-attribution-bing-tos" href="https://www.microsoft.com/maps/product/terms.html" target="_blank">Terms of Use</a>'),r}.bind(this))}this.setState(Pi)}else this.setState(Oi)},e}(mm),Sm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wm=function(t){function e(e){var r=e||{},n=void 0!==r.projection?r.projection:"EPSG:3857",i=void 0!==r.tileGrid?r.tileGrid:im({extent:sm(n),maxResolution:r.maxResolution,maxZoom:r.maxZoom,minZoom:r.minZoom,tileSize:r.tileSize});return t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,crossOrigin:r.crossOrigin,opaque:r.opaque,projection:n,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:r.tileLoadFunction,tilePixelRatio:r.tilePixelRatio,tileUrlFunction:r.tileUrlFunction,url:r.url,urls:r.urls,wrapX:void 0===r.wrapX||r.wrapX,transition:r.transition,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this}return Sm(e,t),e}(mm),Tm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cm=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:void 0!==e.maxZoom?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,wrapX:e.wrapX})||this;return r.account_=e.account,r.mapId_=e.map||"",r.config_=e.config||{},r.templateCache_={},r.initializeMap_(),r}return Tm(e,t),e.prototype.getConfig=function(){return this.config_},e.prototype.updateConfig=function(t){O(this.config_,t),this.initializeMap_()},e.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},e.prototype.initializeMap_=function(){var t=JSON.stringify(this.config_);if(this.templateCache_[t])this.applyTemplate_(this.templateCache_[t]);else{var e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);var r=new XMLHttpRequest;r.addEventListener("load",this.handleInitResponse_.bind(this,t)),r.addEventListener("error",this.handleInitError_.bind(this)),r.open("POST",e),r.setRequestHeader("Content-type","application/json"),r.send(JSON.stringify(this.config_))}},e.prototype.handleInitResponse_=function(t,e){var r=e.target;if(!r.status||r.status>=200&&r.status<300){var n=void 0;try{n=JSON.parse(r.responseText)}catch(t){return void this.setState(Oi)}this.applyTemplate_(n),this.templateCache_[t]=n,this.setState(Pi)}else this.setState(Oi)},e.prototype.handleInitError_=function(t){this.setState(Oi)},e.prototype.applyTemplate_=function(t){var e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)},e}(wm),Rm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bm=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,wrapX:e.wrapX})||this;return r.resolution=void 0,r.distance=void 0!==e.distance?e.distance:20,r.features=[],r.geometryFunction=e.geometryFunction||function(t){var e=t.getGeometry();return wt(e.getType()==Fe.POINT,10),e},r.boundRefresh_=r.refresh.bind(r),r.setSource(e.source||null),r}return Rm(e,t),e.prototype.clear=function(e){this.features.length=0,t.prototype.clear.call(this,e)},e.prototype.getDistance=function(){return this.distance},e.prototype.getSource=function(){return this.source},e.prototype.loadFeatures=function(t,e,r){this.source.loadFeatures(t,e,r),e!==this.resolution&&(this.clear(),this.resolution=e,this.cluster(),this.addFeatures(this.features))},e.prototype.setDistance=function(t){this.distance=t,this.refresh()},e.prototype.setSource=function(t){this.source&&this.source.removeEventListener(J,this.boundRefresh_),this.source=t,t&&t.addEventListener(J,this.boundRefresh_),this.refresh()},e.prototype.refresh=function(){this.clear(),this.cluster(),this.addFeatures(this.features)},e.prototype.cluster=function(){if(void 0!==this.resolution&&this.source)for(var t=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,r=this.source.getFeatures(),n={},i=0,o=r.length;i<o;i++){var a=r[i];if(!(S(a)in n)){var s=this.geometryFunction(a);if(s){Zt(s.getCoordinates(),t),jt(t,e,t);var u=this.source.getFeaturesInExtent(t);u=u.filter((function(t){var e=S(t);return!(e in n)&&(n[e]=!0,!0)})),this.features.push(this.createCluster(u))}}}},e.prototype.createCluster=function(t){for(var e=[0,0],r=t.length-1;r>=0;--r){var n=this.geometryFunction(t[r]);n?qo(e,n.getCoordinates()):t.splice(r,1)}na(e,1/t.length);var i=new Ct(new Ln(e));return i.set("features",t),i},e}(ou),Pm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Om="default",Im="truncated",Lm=function(t){function e(e,r,n,i,o,a,s){var u=t.call(this,r,n,i,o,a,s)||this;return u.zoomifyImage_=null,u.tileSize_=e,u}return Pm(e,t),e.prototype.getImage=function(){if(this.zoomifyImage_)return this.zoomifyImage_;var e=t.prototype.getImage.call(this);if(this.state==gu){var r=this.tileSize_;if(e.width==r[0]&&e.height==r[1])return this.zoomifyImage_=e,e;var n=Ji(r[0],r[1]);return n.drawImage(e,0,0),this.zoomifyImage_=n.canvas,n.canvas}return e},e}(Ru),Fm=function(t){function e(e){var r=this,n=e,i=n.size,o=void 0!==n.tierSizeCalculation?n.tierSizeCalculation:Om,a=n.tilePixelRatio||1,s=i[0],u=i[1],l=[],h=n.tileSize||256,c=h*a;switch(o){case Om:for(;s>c||u>c;)l.push([Math.ceil(s/c),Math.ceil(u/c)]),c+=c;break;case Im:for(var p=s,f=u;p>c||f>c;)l.push([Math.ceil(p/c),Math.ceil(f/c)]),p>>=1,f>>=1;break;default:wt(!1,53)}l.push([1,1]),l.reverse();for(var d=[a],_=[0],g=1,y=l.length;g<y;g++)d.push(a<<g),_.push(l[g-1][0]*l[g-1][1]+_[g-1]);d.reverse();var v=new rm({tileSize:h,extent:n.extent||[0,-u,s,0],resolutions:d}),m=n.url;m&&-1==m.indexOf("{TileGroup}")&&-1==m.indexOf("{tileIndex}")&&(m+="{TileGroup}/{z}-{x}-{y}.jpg");var x=Zv(m),E=h*a;var S=Vv(x.map((function(t){return function(e,r,n){if(e){var i=e[0],o=e[1],a=e[2],s=o+a*l[i][0],u={z:i,x:o,y:a,tileIndex:s,TileGroup:"TileGroup"+((s+_[i])/E|0)};return t.replace(/\{(\w+?)\}/g,(function(t,e){return u[e]}))}}}))),w=Lm.bind(null,gl(h*a));(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,projection:n.projection,tilePixelRatio:a,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileClass:w,tileGrid:v,tileUrlFunction:S,transition:n.transition})||this).zDirection=n.zDirection;var T=S(v.getTileCoordForCoordAndResolution(le(v.getExtent()),d[d.length-1]),1,null),C=new Image;return C.addEventListener("error",function(){E=h,this.changed()}.bind(r)),C.src=T,r}return Pm(e,t),e}(mm),Mm="version1",Am="version2",Nm="version3",Gm={};Gm[Mm]={level0:{supports:[],formats:[],qualities:["native"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["native"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["native","color","grey","bitonal"]}},Gm[Am]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByDistortedWh","sizeByWh"],formats:["jpg","png"],qualities:["default","bitonal"]}},Gm[Nm]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","regionSquare","sizeByW","sizeByH","sizeByWh"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionSquare","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["default"]}},Gm.none={none:{supports:[],formats:[],qualities:[]}};var jm=new RegExp("^https?://library.stanford.edu/iiif/image-api/(1.1/)?compliance.html#level[0-2]$"),Dm=new RegExp("^https?://iiif.io/api/image/2/level[0-2](.json)?$"),km=new RegExp("(^https?://iiif.io/api/image/3/level[0-2](.json)?$)|(^level[0-2]$)");var Um={};Um[Mm]=function(t){var e=t.getComplianceLevelSupportedFeatures();return void 0===e&&(e=Gm[Mm].level0),{url:void 0===t.imageInfo["@id"]?void 0:t.imageInfo["@id"].replace(/\/?(info.json)?$/g,""),supports:e.supports,formats:e.formats.concat([void 0===t.imageInfo.formats?[]:t.imageInfo.formats]),qualities:e.qualities.concat([void 0===t.imageInfo.qualities?[]:t.imageInfo.qualities]),resolutions:t.imageInfo.scale_factors,tileSize:void 0!==t.imageInfo.tile_width?void 0!==t.imageInfo.tile_height?[t.imageInfo.tile_width,t.imageInfo.tile_height]:[t.imageInfo.tile_width,t.imageInfo.tile_width]:null!=t.imageInfo.tile_height?[t.imageInfo.tile_height,t.imageInfo.tile_height]:void 0}},Um[Am]=function(t){var e=t.getComplianceLevelSupportedFeatures(),r=Array.isArray(t.imageInfo.profile)&&t.imageInfo.profile.length>1,n=r&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],i=r&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],o=r&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(info.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:e.supports.concat(n),formats:e.formats.concat(i),qualities:e.qualities.concat(o)}},Um[Nm]=function(t){var e=t.getComplianceLevelSupportedFeatures(),r=void 0===t.imageInfo.extraFormats?e.formats:e.formats.concat(t.imageInfo.extraFormats),n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&r.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:e.supports.concat(t.imageInfo.extraFeatures),formats:r,qualities:void 0===t.imageInfo.extraQualities?e.qualities:e.qualities.concat(t.imageInfo.extraQualities),preferredFormat:n}};!function(){function t(t){this.setImageInfo(t)}t.prototype.setImageInfo=function(t){this.imageInfo="string"==typeof t?JSON.parse(t):t},t.prototype.getImageApiVersion=function(){if(void 0!==this.imageInfo){var t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(var e=0;e<t.length;e++)switch(t[e]){case"http://library.stanford.edu/iiif/image-api/1.1/context.json":case"http://iiif.io/api/image/1/context.json":return Mm;case"http://iiif.io/api/image/2/context.json":return Am;case"http://iiif.io/api/image/3/context.json":return Nm;case"ol-no-context":if(this.getComplianceLevelEntryFromProfile(Mm)&&this.imageInfo.identifier)return Mm}wt(!1,61)}},t.prototype.getComplianceLevelEntryFromProfile=function(t){if(void 0!==this.imageInfo&&void 0!==this.imageInfo.profile)switch(void 0===t&&(t=this.getImageApiVersion()),t){case Mm:if(jm.test(this.imageInfo.profile))return this.imageInfo.profile;break;case Nm:if(km.test(this.imageInfo.profile))return this.imageInfo.profile;break;case Am:if("string"==typeof this.imageInfo.profile&&Dm.test(this.imageInfo.profile))return this.imageInfo.profile;if(Array.isArray(this.imageInfo.profile)&&this.imageInfo.profile.length>0&&"string"==typeof this.imageInfo.profile[0]&&Dm.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}},t.prototype.getComplianceLevelFromProfile=function(t){var e=this.getComplianceLevelEntryFromProfile(t);if(void 0!==e){var r=e.match(/level[0-2](\.json)?$/g);return Array.isArray(r)?r[0].replace(".json",""):void 0}},t.prototype.getComplianceLevelSupportedFeatures=function(){if(void 0!==this.imageInfo){var t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?Gm.none.none:Gm[t][e]}},t.prototype.getTileSourceOptions=function(t){var e=t||{},r=this.getImageApiVersion();if(void 0!==r){var n=void 0===r?void 0:Um[r](this);if(void 0!==n)return{url:n.url,version:r,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}}}}();var zm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Bm(t){return t.toLocaleString("en",{maximumFractionDigits:10})}var Ym=function(t){function e(e){var r=this,n=e||{},i=n.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";var o=n.version||Am,a=n.sizes||[],s=n.size;wt(null!=s&&Array.isArray(s)&&2==s.length&&!isNaN(s[0])&&s[0]>0&&!isNaN(s[1])&&s[1]>0,60);var u,l,h,c=s[0],p=s[1],f=n.tileSize,d=n.tilePixelRatio||1,_=n.format||"jpg",g=n.quality||(n.version==Mm?"native":"default"),y=n.resolutions||[],v=n.supports||[],m=n.extent||[0,-p,c,0],x=null!=a&&Array.isArray(a)&&a.length>0,E=void 0!==f&&("number"==typeof f&&Number.isInteger(f)&&f>0||Array.isArray(f)&&f.length>0),S=null!=v&&Array.isArray(v)&&(v.includes("regionByPx")||v.includes("regionByPct"))&&(v.includes("sizeByWh")||v.includes("sizeByH")||v.includes("sizeByW")||v.includes("sizeByPct"));if(y.sort((function(t,e){return e-t})),E||S)if(null!=f&&("number"==typeof f&&Number.isInteger(f)&&f>0?(u=f,l=f):Array.isArray(f)&&f.length>0&&((1==f.length||null==f[1]&&Number.isInteger(f[0]))&&(u=f[0],l=f[0]),2==f.length&&(Number.isInteger(f[0])&&Number.isInteger(f[1])?(u=f[0],l=f[1]):null==f[0]&&Number.isInteger(f[1])&&(u=f[1],l=f[1])))),void 0!==u&&void 0!==l||(u=256,l=256),0==y.length)for(var w=h=Math.max(Math.ceil(Math.log(c/u)/Math.LN2),Math.ceil(Math.log(p/l)/Math.LN2));w>=0;w--)y.push(Math.pow(2,w));else{var T=Math.max.apply(Math,y);h=Math.round(Math.log(T)/Math.LN2)}else if(u=c,l=p,y=[],x){a.sort((function(t,e){return t[0]-e[0]})),h=-1;var C=[];for(w=0;w<a.length;w++){var R=c/a[w][0];y.length>0&&y[y.length-1]==R?C.push(w):(y.push(R),h++)}if(C.length>0)for(w=0;w<C.length;w++)a.splice(C[w]-w,1)}else y.push(1),a.push([c,p]),h=0;var b=new rm({tileSize:[u,l],extent:m,origin:ve(m),resolutions:y}),P=Lm.bind(null,gl(f||256).map((function(t){return t*d})));return(r=t.call(this,{attributions:n.attributions,attributionsCollapsible:n.attributionsCollapsible,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,state:n.state,tileClass:P,tileGrid:b,tilePixelRatio:n.tilePixelRatio,tileUrlFunction:function(t,e,r){var n,s,f=t[0];if(!(f>h)){var d=t[1],m=t[2],w=y[f];if(!(void 0===d||void 0===m||void 0===w||d<0||Math.ceil(c/w/u)<=d||m<0||Math.ceil(p/w/l)<=m)){if(S||E){var T=d*u*w,C=m*l*w,R=u*w,b=l*w,P=u,O=l;if(T+R>c&&(R=c-T),C+b>p&&(b=p-C),T+u*w>c&&(P=Math.floor((c-T+w-1)/w)),C+l*w>p&&(O=Math.floor((p-C+w-1)/w)),0==T&&R==c&&0==C&&b==p)n="full";else if(!S||v.includes("regionByPx"))n=T+","+C+","+R+","+b;else if(v.includes("regionByPct")){n="pct:"+Bm(T/c*100)+","+Bm(C/p*100)+","+Bm(R/c*100)+","+Bm(b/p*100)}o!=Nm||S&&!v.includes("sizeByWh")?!S||v.includes("sizeByW")?s=P+",":v.includes("sizeByH")?s=","+O:v.includes("sizeByWh")?s=P+","+O:v.includes("sizeByPct")&&(s="pct:"+Bm(100/w)):s=P+","+O}else if(n="full",x){var I=a[f][0],L=a[f][1];s=o==Nm?I==c&&L==p?"max":I+","+L:I==c?"full":I+","}else s=o==Nm?"max":"full";return i+n+"/"+s+"/0/"+g+"."+_}}},transition:n.transition})||this).zDirection=n.zDirection,r}return zm(e,t),e}(mm),Xm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vm=function(t){function e(e,r,n,i,o,a){var s=this,u=e.getExtent(),l=r.getExtent(),h=l?_e(n,l):n,c=qv(e,r,le(h),i),p=new Qv(e,r,h,u,.5*c,i),f=a(p.calculateSourceExtent(),c,o),d=f?no:so,_=f?f.getPixelRatio():1;return(s=t.call(this,n,i,_,d)||this).targetProj_=r,s.maxSourceExtent_=u,s.triangulation_=p,s.targetResolution_=i,s.targetExtent_=n,s.sourceImage_=f,s.sourcePixelRatio_=_,s.canvas_=null,s.sourceListenerKey_=null,s}return Xm(e,t),e.prototype.disposeInternal=function(){this.state==io&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==oo){var e=xe(this.targetExtent_)/this.targetResolution_,r=fe(this.targetExtent_)/this.targetResolution_;this.canvas_=Jv(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==no){this.state=io,this.changed();var t=this.sourceImage_.getState();t==oo||t==ao?this.reproject_():(this.sourceListenerKey_=M(this.sourceImage_,J,(function(t){var e=this.sourceImage_.getState();e!=oo&&e!=ao||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){N(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(vs),Wm=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zm="imageloadstart",Km="imageloadend",qm="imageloaderror",Hm=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return Wm(e,t),e}(K);function Jm(t,e){t.getImage().src=e}var Qm=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state})||this;return r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r}return Wm(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=k(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!Fr(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Fr(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&Jt(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Vm(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this)),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,n){return x()},e.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case io:this.loading=!0,this.dispatchEvent(new Hm(Zm,e));break;case oo:this.loading=!1,this.dispatchEvent(new Hm(Km,e));break;case ao:this.loading=!1,this.dispatchEvent(new Hm(qm,e))}},e}(Js);function $m(t,e){var r=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&r.push(t+"="+encodeURIComponent(e[t]))}));var n=r.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var tx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ex=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Jm,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return tx(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&zt(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};O(o,this.params_);var a=((t=t.slice())[0]+t[2])/2,s=(t[1]+t[3])/2;if(1!=this.ratio_){var u=this.ratio_*xe(t)/2,l=this.ratio_*fe(t)/2;t[0]=a-u,t[1]=s-l,t[2]=a+u,t[3]=s+l}var h=e/r,c=Math.ceil(xe(t)/h),p=Math.ceil(fe(t)/h);t[0]=a-h*c/2,t[2]=a+h*c/2,t[1]=s-h*p/2,t[3]=s+h*p/2,this.imageSize_[0]=c,this.imageSize_[1]=p;var f=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new Es(t,e,r,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(J,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(":").pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var a=this.url_,s=a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return s==a&&wt(!1,50),$m(s,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){O(this.params_,t),this.image_=null,this.changed()},e}(Qm),rx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nx=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return rx(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&zt(i.getExtent(),t))return i;Te(t=t.slice(),this.ratio_);var o=[xe(t)/e*r,fe(t)/e*r],a=this.canvasFunction_.call(this,t,e,r,o,n);return a&&(i=new fu(t,e,r,a)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(Qm),ix=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var ox=function(t){function e(e){var r=t.call(this,{projection:e.projection,resolutions:e.resolutions})||this;return r.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,r.displayDpi_=void 0!==e.displayDpi?e.displayDpi:96,r.params_=e.params||{},r.url_=e.url,r.imageLoadFunction_=void 0!==e.imageLoadFunction?e.imageLoadFunction:Jm,r.hidpi_=void 0===e.hidpi||e.hidpi,r.metersPerUnit_=void 0!==e.metersPerUnit?e.metersPerUnit:1,r.ratio_=void 0!==e.ratio?e.ratio:1,r.useOverlay_=void 0!==e.useOverlay&&e.useOverlay,r.image_=null,r.renderedRevision_=0,r}return ix(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&zt(i.getExtent(),t))return i;1!=this.ratio_&&Te(t=t.slice(),this.ratio_);var o=[xe(t)/e*r,fe(t)/e*r];if(void 0!==this.url_){var a=this.getUrl(this.url_,this.params_,t,o,n);(i=new Es(t,e,r,a,this.crossOrigin_,this.imageLoadFunction_)).addEventListener(J,this.handleImageChange.bind(this))}else i=null;return this.image_=i,this.renderedRevision_=this.getRevision(),i},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.updateParams=function(t){O(this.params_,t),this.changed()},e.prototype.getUrl=function(t,e,r,n,i){var o=function(t,e,r,n){var i=xe(t),o=fe(t),a=e[0],s=e[1],u=.0254/n;return s*i>a*o?i*r/(a*u):o*r/(s*u)}(r,n,this.metersPerUnit_,this.displayDpi_),a=le(r),s={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:o,SETVIEWCENTERX:a[0],SETVIEWCENTERY:a[1]};return O(s,e),$m(t,s)},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e}(Qm),ax=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),sx=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:Jm;return(r=t.call(this,{attributions:e.attributions,projection:Sr(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new Es(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(J,r.handleImageChange.bind(r)),r}return ax(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return Ee(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==oo){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var a=fe(r)/o,s=Math.ceil(xe(r)/a);if(s!=i){var u=Ji(s,o),l=u.canvas;u.drawImage(n,0,0,i,o,0,0,l.width,l.height),this.image_.setImage(l)}}t.prototype.handleImageChange.call(this,e)},e}(Qm),ux="carmentaserver",lx="geoserver",hx="mapserver",cx="qgis",px=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),fx=[101,101],dx=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Jm,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return px(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=Sr(r),o=this.getProjection();o&&o!==i&&(e=qv(o,i,t,e),t=Nr(t,i,o));var a=pe(t,e,0,fx),s={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};O(s,this.params_,n);var u=Math.floor((t[0]-a[0])/e),l=Math.floor((a[3]-t[1])/e);return s[this.v13_?"I":"X"]=u,s[this.v13_?"J":"Y"]=l,this.getRequestUrl_(a,fx,1,o||i,s)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i*39.37*(25.4/.28)}return O(r,e),$m(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=le(t),a=pe(o,i,0,[Math.ceil(xe(t)/i),Math.ceil(fe(t)/i)]),s=pe(o,i,0,[Math.ceil(this.ratio_*xe(t)/i),Math.ceil(this.ratio_*fe(t)/i)]),u=this.image_;if(u&&this.renderedRevision_==this.getRevision()&&u.getResolution()==e&&u.getPixelRatio()==r&&zt(u.getExtent(),a))return u;var l={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};O(l,this.params_),this.imageSize_[0]=Math.round(xe(s)/i),this.imageSize_[1]=Math.round(fe(s)/i);var h=this.getRequestUrl_(s,this.imageSize_,r,n,l);return this.image_=new Es(s,e,r,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(J,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(wt(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case lx:var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case hx:i.MAP_RESOLUTION=90*r;break;case ux:case cx:i.DPI=90*r;break;default:wt(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var a,s=n.getAxisOrientation();return a=this.v13_&&"ne"==s.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=a.join(","),$m(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){O(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=Ko(t,"1.3")>=0},e}(Qm),_x=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gx='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.',yx=function(t){function e(e){var r,n=e||{};r=void 0!==n.attributions?n.attributions:[gx];var i=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",o=void 0!==n.url?n.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:r,cacheSize:n.cacheSize,crossOrigin:i,opaque:void 0===n.opaque||n.opaque,maxZoom:void 0!==n.maxZoom?n.maxZoom:19,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileLoadFunction:n.tileLoadFunction,url:o,wrapX:n.wrapX,attributionsCollapsible:!1})||this}return _x(e,t),e}(wm),vx=r(2),mx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xx="beforeoperations",Ex="afteroperations",Sx="pixel",wx="image",Tx=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.extent=r.extent,i.resolution=r.viewState.resolution/r.pixelRatio,i.data=n,i}return mx(e,t),e}(K),Cx=function(t){function e(e){var r=t.call(this,{projection:null})||this;r.worker_=null,r.operationType_=void 0!==e.operationType?e.operationType:Sx,r.threads_=void 0!==e.threads?e.threads:1,r.layers_=function(t){for(var e=t.length,r=new Array(e),n=0;n<e;++n)r[n]=Px(t[n]);return r}(e.sources);for(var n,i=r.changed.bind(r),o=0,a=r.layers_.length;o<a;++o)r.layers_[o].addEventListener(J,i);return r.tileQueue_=new Hu((function(){return 1}),r.changed.bind(r)),r.requestedFrameState_,r.renderedImageCanvas_=null,r.renderedRevision_,r.frameState_={animate:!1,coordinateToPixelTransform:[1,0,0,1,0,0],extent:null,index:0,layerIndex:0,layerStatesArray:(n=r.layers_,n.map((function(t){return t.getLayerState()}))),pixelRatio:1,pixelToCoordinateTransform:[1,0,0,1,0,0],postRenderFunctions:[],size:[0,0],tileQueue:r.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},declutterItems:[]},r.setAttributions((function(t){for(var r=[],n=0,i=e.sources.length;n<i;++n){var o=e.sources[n],a=(o instanceof Js?o:o.getSource()).getAttributions();if("function"==typeof a){var s=a(t);r.push.apply(r,s)}}return 0!==r.length?r:null})),void 0!==e.operation&&r.setOperation(e.operation,e.lib),r}return mx(e,t),e.prototype.setOperation=function(t,e){this.worker_=new vx.Processor({operation:t,imageOps:this.operationType_===wx,queue:1,lib:e,threads:this.threads_}),this.changed()},e.prototype.updateFrameState_=function(t,e,r){var n=O({},this.frameState_);n.viewState=O({},n.viewState);var i=le(t);n.extent=t.slice(),n.size[0]=Math.round(xe(t)/e),n.size[1]=Math.round(fe(t)/e),n.time=1/0;var o=n.viewState;return o.center=i,o.projection=r,o.resolution=e,n},e.prototype.allSourcesReady_=function(){for(var t=!0,e=0,r=this.layers_.length;e<r;++e)if(this.layers_[e].getSource().getState()!==Pi){t=!1;break}return t},e.prototype.getImage=function(t,e,r,n){if(!this.allSourcesReady_())return null;var i=this.updateFrameState_(t,e,n);if(this.requestedFrameState_=i,this.renderedImageCanvas_){var o=this.renderedImageCanvas_.getResolution(),a=this.renderedImageCanvas_.getExtent();e===o&&Jt(t,a)||(this.renderedImageCanvas_=null)}return this.renderedImageCanvas_&&this.getRevision()===this.renderedRevision_||this.processSources_(),i.tileQueue.loadMoreTiles(16,16),i.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_},e.prototype.processSources_=function(){for(var t=this.requestedFrameState_,e=this.layers_.length,r=new Array(e),n=0;n<e;++n){t.layerIndex=n;var i=bx(this.layers_[n],t);if(!i)return;r[n]=i}var o={};this.dispatchEvent(new Tx(xx,t,o)),this.worker_.process(r,o,this.onWorkerComplete_.bind(this,t))},e.prototype.onWorkerComplete_=function(t,e,r,n){if(!e&&r){var i=t.extent,o=t.viewState.resolution;if(o===this.requestedFrameState_.viewState.resolution&&Jt(i,this.requestedFrameState_.extent)){var a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else a=Ji(Math.round(xe(i)/o),Math.round(fe(i)/o)),this.renderedImageCanvas_=new fu(i,o,1,a.canvas);a.putImageData(r,0,0),this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new Tx(Ex,t,n))}}},e.prototype.getImageInternal=function(){return null},e}(Qm),Rx=null;function bx(t,e){var r=t.getRenderer();if(!r)throw new Error("Unsupported layer type: "+t);if(!r.prepareFrame(e))return null;var n,i=e.size[0],o=e.size[1],a=r.renderFrame(e,null);if(a&&(n=a.firstElementChild),!(n instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+n);if(n.width===i&&n.height===o)return n.getContext("2d").getImageData(0,0,i,o);if(Rx){var s=Rx.canvas;s.width!==i||s.height!==o?Rx=Ji(i,o):Rx.clearRect(0,0,i,o)}else Rx=Ji(i,o);return Rx.drawImage(n,0,0,i,o),Rx.getImageData(0,0,i,o)}function Px(t){var e;return t instanceof Js?t instanceof cm?e=new Pv({source:t}):t instanceof Qm&&(e=new mv({source:t})):e=t,e}var Ox=Cx,Ix=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Lx=['Map tiles by <a href="https://stamen.com/" target="_blank">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY 3.0</a>.',gx],Fx={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},Mx={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}},Ax=function(t){function e(e){var r=e.layer.indexOf("-"),n=-1==r?e.layer:e.layer.slice(0,r),i=Mx[n],o=Fx[e.layer],a=void 0!==e.url?e.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+e.layer+"/{z}/{x}/{y}."+o.extension;return t.call(this,{attributions:Lx,cacheSize:e.cacheSize,crossOrigin:"anonymous",maxZoom:null!=e.maxZoom?e.maxZoom:i.maxZoom,minZoom:null!=e.minZoom?e.minZoom:i.minZoom,opaque:o.opaque,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:a,wrapX:e.wrapX})||this}return Ix(e,t),e}(wm),Nx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Gx(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_||(e=1);var i=n.getTileCoordExtent(t,this.tmpExtent_),o=gl(n.getTileSize(t[0]),this.tmpSize);1!=e&&(o=_l(o,e,this.tmpSize));var a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return O(a,this.params_),this.getRequestUrl_(t,o,i,e,r,a)}}var jx=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,tileUrlFunction:Gx,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).params_=n.params||{},r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.setKey(r.getKeyForParams_()),r}return Nx(e,t),e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){var s,u=i.getCode().split(":").pop();if(o.SIZE=e[0]+","+e[1],o.BBOX=r.join(","),o.BBOXSR=u,o.IMAGESR=u,o.DPI=Math.round(o.DPI?o.DPI*n:90*n),1==a.length)s=a[0];else s=a[Be(Hp(t),a.length)];return $m(s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_?t:1},e.prototype.updateParams=function(t){O(this.params_,t),this.setKey(this.getKeyForParams_())},e}(mm),Dx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kx=function(t){function e(e,r,n){var i=t.call(this,e,gu)||this;return i.tileSize_=r,i.text_=n,i.canvas_=null,i}return Dx(e,t),e.prototype.getImage=function(){if(this.canvas_)return this.canvas_;var t=this.tileSize_,e=Ji(t[0],t[1]);return e.strokeStyle="grey",e.strokeRect(.5,.5,t[0]+.5,t[1]+.5),e.fillStyle="grey",e.strokeStyle="white",e.textAlign="center",e.textBaseline="middle",e.font="24px sans-serif",e.lineWidth=4,e.strokeText(this.text_,t[0]/2,t[1]/2,t[0]),e.fillText(this.text_,t[0]/2,t[1]/2,t[0]),this.canvas_=e.canvas,e.canvas},e.prototype.load=function(){},e}(Tu),Ux=function(t){function e(e){var r=e||{};return t.call(this,{opaque:!1,projection:r.projection,tileGrid:r.tileGrid,wrapX:void 0===r.wrapX||r.wrapX,zDirection:r.zDirection})||this}return Dx(e,t),e.prototype.getTile=function(t,e,r){var n=Zp(t,e,r);if(this.tileCache.containsKey(n))return this.tileCache.get(n);var i=gl(this.tileGrid.getTileSize(t)),o=[t,e,r],a=this.getTileCoordForTileUrlFunction(o),s=void 0;s=a?"z:"+a[0]+" x:"+a[1]+" y:"+a[2]:"none";var u=new kx(o,i,s);return this.tileCache.set(n,u),u},e}(wm),zx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Bx=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,projection:Sr("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:bi,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this;if(r.tileJSON_=null,r.tileSize_=e.tileSize,e.url)if(e.jsonp)Kv(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):wt(!1,51);return r}return zx(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,r=Sr("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=Mr(r,n);e=Re(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=im({extent:sm(n),maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=s,this.tileUrlFunction=Xv(t.tiles,s),void 0!==t.attribution&&!this.getAttributions()){var u=void 0!==e?e:r.getExtent();this.setAttributions((function(e){return Ee(u,e.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState(Pi)},e.prototype.handleTileJSONError=function(){this.setState(Oi)},e}(mm),Yx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Xx(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var i=n.getResolution(t[0]),o=n.getTileCoordExtent(t,this.tmpExtent_),a=gl(n.getTileSize(t[0]),this.tmpSize),s=this.gutter_;0!==s&&(a=dl(a,s,this.tmpSize),o=jt(o,i*s,o)),1!=e&&(a=_l(a,e,this.tmpSize));var u={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return O(u,this.params_),this.getRequestUrl_(t,a,o,e,r,u)}}var Vx=function(t){function e(e){var r=this,n=e||{},i=n.params||{},o=!("TRANSPARENT"in i)||i.TRANSPARENT;return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,opaque:!o,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileClass:n.tileClass,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,tileUrlFunction:Xx,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).gutter_=void 0!==n.gutter?n.gutter:0,r.params_=i,r.v13_=!0,r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.updateV13_(),r.setKey(r.getKeyForParams_()),r}return Yx(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){var i=Sr(r),o=this.getProjection(),a=this.getTileGrid();a||(a=this.getTileGridForProjection(i));var s=a.getZForResolution(e,this.zDirection),u=a.getTileCoordForCoordAndZ(t,s);if(!(a.getResolutions().length<=u[0])){var l=a.getResolution(u[0]),h=a.getTileCoordExtent(u,this.tmpExtent_),c=gl(a.getTileSize(u[0]),this.tmpSize),p=this.gutter_;0!==p&&(c=dl(c,p,this.tmpSize),h=jt(h,l*p,h)),o&&o!==i&&(l=qv(o,i,t,l),h=Gr(h,i,o),t=Nr(t,i,o));var f={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};O(f,this.params_,n);var d=Math.floor((t[0]-h[0])/l),_=Math.floor((h[3]-t[1])/l);return f[this.v13_?"I":"X"]=d,f[this.v13_?"J":"Y"]=_,this.getRequestUrl_(u,c,h,1,o||i,f)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.urls[0]){var r={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i*39.37*(25.4/.28)}return O(r,e),$m(this.urls[0],r)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=i.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=n)switch(this.serverType_){case lx:var s=90*n+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+s:o.FORMAT_OPTIONS="dpi:"+s;break;case hx:o.MAP_RESOLUTION=90*n;break;case ux:case cx:o.DPI=90*n;break;default:wt(!1,52)}var u,l=i.getAxisOrientation(),h=r;if(this.v13_&&"ne"==l.substr(0,2)){var c=void 0;c=r[0],h[0]=r[1],h[1]=c,c=r[2],h[2]=r[3],h[3]=c}if(o.BBOX=h.join(","),1==a.length)u=a[0];else u=a[Be(Hp(t),a.length)];return $m(u,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.updateParams=function(t){O(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=Ko(t,"1.3")>=0},e}(mm),Wx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zx=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r)||this;return s.src_=n,s.extent_=i,s.preemptive_=o,s.grid_=null,s.keys_=null,s.data_=null,s.jsonp_=a,s}return Wx(e,t),e.prototype.getImage=function(){return null},e.prototype.getData=function(t){if(!this.grid_||!this.keys_)return null;var e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),r=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),n=this.grid_[Math.floor((1-r)*this.grid_.length)];if("string"!=typeof n)return null;var i=n.charCodeAt(Math.floor(e*n.length));i>=93&&i--,i>=35&&i--;var o=null;if((i-=32)in this.keys_){var a=this.keys_[i];o=this.data_&&a in this.data_?this.data_[a]:a}return o},e.prototype.forDataAtCoordinate=function(t,e,r){this.state==vu&&!0===r?(this.state=du,A(this,J,(function(r){e(this.getData(t))}),this),this.loadInternal_()):!0===r?setTimeout(function(){e(this.getData(t))}.bind(this),0):e(this.getData(t))},e.prototype.getKey=function(){return this.src_},e.prototype.handleError_=function(){this.state=yu,this.changed()},e.prototype.handleLoad_=function(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=gu,this.changed()},e.prototype.loadInternal_=function(){if(this.state==du)if(this.state=_u,this.jsonp_)Kv(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{var t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}},e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(r)}else this.handleError_()},e.prototype.onXHRError_=function(t){this.handleError_()},e.prototype.load=function(){this.preemptive_?this.loadInternal_():this.setState(vu)},e}(Tu),Kx=function(t){function e(e){var r=t.call(this,{projection:Sr("EPSG:3857"),state:bi})||this;if(r.preemptive_=void 0===e.preemptive||e.preemptive,r.tileUrlFunction_=Wv,r.template_=void 0,r.jsonp_=e.jsonp||!1,e.url)if(r.jsonp_)Kv(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):wt(!1,51);return r}return Wx(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTemplate=function(){return this.template_},e.prototype.forDataAtCoordinateAndResolution=function(t,e,r,n){if(this.tileGrid){var i=this.tileGrid.getZForResolution(e,this.zDirection),o=this.tileGrid.getTileCoordForCoordAndZ(t,i);this.getTile(o[0],o[1],o[2],1,this.getProjection()).forDataAtCoordinate(t,r,n)}else!0===n?setTimeout((function(){r(null)}),0):r(null)},e.prototype.handleTileJSONError=function(){this.setState(Oi)},e.prototype.handleTileJSONResponse=function(t){var e,r=Sr("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=Mr(r,n);e=Re(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=im({extent:sm(n),maxZoom:a,minZoom:o});this.tileGrid=s,this.template_=t.template;var u=t.grids;if(u){if(this.tileUrlFunction_=Xv(u,s),void 0!==t.attribution){var l=void 0!==e?e:r.getExtent();this.setAttributions((function(e){return Ee(l,e.extent)?[t.attribution]:null}))}this.setState(Pi)}else this.setState(Oi)},e.prototype.getTile=function(t,e,r,n,i){var o=Zp(t,e,r);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),u=this.tileUrlFunction_(s,n,i),l=new Zx(a,void 0!==u?du:vu,void 0!==u?u:"",this.tileGrid.getTileCoordExtent(a),this.preemptive_,this.jsonp_);return this.tileCache.set(o,l),l},e.prototype.useTile=function(t,e,r){var n=Zp(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(cm),qx=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Hx=function(t){function e(e){var r=this,n=e.projection||"EPSG:3857",i=e.extent||sm(n),o=e.tileGrid||im({extent:i,maxResolution:e.maxResolution,maxZoom:void 0!==e.maxZoom?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});return(r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,opaque:!1,projection:n,state:e.state,tileGrid:o,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Jx,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:void 0===e.zDirection?1:e.zDirection})||this).format_=e.format?e.format:null,r.loadingTiles_={},r.sourceTileCache=new Qp(r.tileCache.highWaterMark),r.overlaps_=null==e.overlaps||e.overlaps,r.tileClass=e.tileClass?e.tileClass:sf,r.tileGrids_={},r}return qx(e,t),e.prototype.getFeaturesInExtent=function(t){var e=[],r=this.tileCache;if(0===r.getCount())return e;var n=qp(r.peekFirstKey())[0],i=this.tileGrid;return r.forEach((function(r){if(r.tileCoord[0]===n&&r.getState()===gu)for(var o=r.getSourceTiles(),a=0,s=o.length;a<s;++a){var u=o[a],l=u.tileCoord;if(Ee(t,i.getTileCoordExtent(l))){var h=u.getFeatures();if(h)for(var c=0,p=h.length;c<p;++c){var f=h[c],d=f.getGeometry();Ee(t,d.getExtent())&&e.push(f)}}}})),e},e.prototype.getOverlaps=function(){return this.overlaps_},e.prototype.clear=function(){this.tileCache.clear(),this.sourceTileCache.clear()},e.prototype.expireCache=function(e,r){t.prototype.expireCache.call(this,e,r),this.sourceTileCache.expireCache({})},e.prototype.getSourceTiles=function(t,e,r){var n=r.wrappedTileCoord,i=this.getTileGridForProjection(e),o=i.getTileCoordExtent(n),a=n[0],s=i.getResolution(a);jt(o,-s,o);var u=this.tileGrid,l=u.getExtent();l&&_e(o,l,o);var h,c,p,f=u.getZForResolution(s,1),d=u.getMinZoom(),_=r.sourceTiles;if(_&&_.length>0&&_[0].tileCoord[0]===f)h=_,c=!0,p=f;else{h=[],p=f+1;do{--p,c=!0,u.forEachTileCoord(o,p,function(n){var i,o=this.tileUrlFunction(n,t,e);if(void 0!==o)if(this.sourceTileCache.containsKey(o)){var a=(i=this.sourceTileCache.get(o)).getState();if(a===gu||a===yu||a===vu)return void h.push(i)}else p===f&&((i=new this.tileClass(n,du,o,this.format_,this.tileLoadFunction)).extent=u.getTileCoordExtent(n),i.projection=e,i.resolution=u.getResolution(n[0]),this.sourceTileCache.set(o,i),i.addEventListener(J,this.handleTileChange.bind(this)),i.load());c=c&&i&&i.getState()===gu,i&&i.getState()!==vu&&r.getState()===du&&(r.loadingSourceTiles++,i.addEventListener(J,(function t(){var e=i.getState(),n=i.getKey();if(e===gu||e===yu){e===gu?(i.removeEventListener(J,t),r.loadingSourceTiles--,delete r.errorSourceTileKeys[n]):e===yu&&(r.errorSourceTileKeys[n]=!0);var o=Object.keys(r.errorSourceTileKeys).length;r.loadingSourceTiles-o==0&&(r.hifi=0===o,r.sourceZ=f,r.setState(gu))}})))}.bind(this)),c||(h.length=0)}while(!c&&p>d)}return r.getState()===du&&r.setState(_u),c&&(r.hifi=f===p,r.sourceZ=p,r.getState()<gu?r.setState(gu):_&&B(h,_)||(r.sourceTiles=h)),h},e.prototype.getTile=function(t,e,r,n,i){var o,a=Zp(t,e,r),s=this.getKey();if(this.tileCache.containsKey(a)&&(o=this.tileCache.get(a)).key===s)return o;var u=[t,e,r],l=this.getTileCoordForTileUrlFunction(u,i),h=this.getTileGrid().getExtent(),c=this.getTileGridForProjection(i);if(l&&h){var p=c.getTileCoordExtent(l);jt(p,-c.getResolution(t),p),Ee(h,p)||(l=null)}var f=!0;if(null!==l){var d=this.tileGrid,_=c.getResolution(t),g=d.getZForResolution(_,1),y=c.getTileCoordExtent(l);jt(y,-_,y),d.forEachTileCoord(y,g,function(t){f=f&&!this.tileUrlFunction(t,n,i)}.bind(this))}var v=new of(u,f?vu:du,l,this.getSourceTiles.bind(this,n,i));return v.key=s,o?(v.interimTile=o,v.refreshInterimChain(),this.tileCache.replace(a,v)):this.tileCache.set(a,v),v},e.prototype.getTileGridForProjection=function(t){var e=t.getCode(),r=this.tileGrids_[e];if(!r){var n=this.tileGrid;r=am(t,void 0,n?n.getTileSize(n.getMinZoom()):void 0),this.tileGrids_[e]=r}return r},e.prototype.getTilePixelRatio=function(t){return t},e.prototype.getTilePixelSize=function(t,e,r){var n=gl(this.getTileGridForProjection(r).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]},e}(gm);function Jx(t,e){var r=Xs(e,t.getFormat(),t.onLoad.bind(t),t.onError.bind(t));t.setLoader(r)}var Qx="KVP",$x=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tE=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return $x(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(rm),eE=tE;var rE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nE=function(t){function e(e){var r=this,n=void 0!==e.requestEncoding?e.requestEncoding:Qx,i=e.tileGrid,o=e.urls;return void 0===o&&void 0!==e.url&&(o=Zv(e.url)),(r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:Wv,urls:o,wrapX:void 0!==e.wrapX&&e.wrapX,transition:e.transition})||this).version_=void 0!==e.version?e.version:"1.0.0",r.format_=void 0!==e.format?e.format:"image/jpeg",r.dimensions_=void 0!==e.dimensions?e.dimensions:{},r.layer_=e.layer,r.matrixSet_=e.matrixSet,r.style_=e.style,r.requestEncoding_=n,r.setKey(r.getKeyForDimensions_()),o&&o.length>0&&(r.tileUrlFunction=Vv(o.map(iE.bind(r)))),r}return rE(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(Vv(t.map(iE.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){O(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e}(mm);function iE(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==Qx&&O(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==Qx?$m(t,r):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t}));var n=this.tileGrid,i=this.dimensions_;return function(r,o,a){if(r){var s={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};O(s,i);var u=t;return u=e==Qx?$m(u,s):u.replace(/\{(\w+?)\}/g,(function(t,e){return s[e]}))}}}var oE={NUMBER:1,STRING:2,COLOR:4,BOOLEAN:8,NUMBER_ARRAY:16,ANY:31,NONE:0},aE={};function sE(t){if("number"==typeof t)return oE.NUMBER;if("boolean"==typeof t)return oE.BOOLEAN;if("string"==typeof t)return e=t,Ai.test(e)&&(e=Ni(e)),Mi.test(e)||0===e.indexOf("rgba(")||0===e.indexOf("rgb(")?oE.COLOR|oE.STRING:oE.STRING;var e;if(!Array.isArray(t))throw new Error("Unhandled value type: "+JSON.stringify(t));var r=t;if(r.every((function(t){return"number"==typeof t})))return 3===r.length||4===r.length?oE.COLOR|oE.NUMBER_ARRAY:oE.NUMBER_ARRAY;if("string"!=typeof r[0])throw new Error("Expected an expression operator but received: "+JSON.stringify(r));var n=aE[r[0]];if(void 0===n)throw new Error("Unrecognized expression operator: "+JSON.stringify(r));return n.getReturnType(r.slice(1))}function uE(t){return Math.log2(t)%1==0}function lE(t){var e=t.toString();return-1===e.indexOf(".")?e+".0":e}function hE(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return"vec"+t.length+"("+t.map(lE).join(", ")+")"}function cE(t){var e=ki(t).slice();return e.length<4&&e.push(1),hE(e.map((function(t,e){return e<3?t/255:t})))}function pE(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function fE(t,e){return lE(pE(t,e))}function dE(t,e,r){if(Array.isArray(e)&&"string"==typeof e[0]){var n=aE[e[0]];if(void 0===n)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return n.toGlsl(t,e.slice(1),r)}return(sE(e)&oE.NUMBER)>0?lE(e):(sE(e)&oE.BOOLEAN)>0?e.toString():(sE(e)&oE.STRING)>0&&(void 0===r||r==oE.STRING)?fE(t,e.toString()):(sE(e)&oE.COLOR)>0&&(void 0===r||r==oE.COLOR)?cE(e):(sE(e)&oE.NUMBER_ARRAY)>0?hE(e):void 0}function _E(t){if(!(sE(t)&oE.NUMBER))throw new Error("A numeric value was expected, got "+JSON.stringify(t)+" instead")}function gE(t){for(var e=0;e<t.length;e++)_E(t[e])}function yE(t){if(!(sE(t)&oE.STRING))throw new Error("A string value was expected, got "+JSON.stringify(t)+" instead")}function vE(t){if(!(sE(t)&oE.BOOLEAN))throw new Error("A boolean value was expected, got "+JSON.stringify(t)+" instead")}function mE(t,e){if(t.length!==e)throw new Error("Exactly "+e+" arguments were expected, got "+t.length+" instead")}function xE(t,e){if(t.length<e)throw new Error("At least "+e+" arguments were expected, got "+t.length+" instead")}function EE(t,e){if(t.length>e)throw new Error("At most "+e+" arguments were expected, got "+t.length+" instead")}function SE(t){if(t.length%2!=0)throw new Error("An even amount of arguments was expected, got "+t+" instead")}function wE(t,e){if(!uE(e))throw new Error("Could not infer only one type from the following expression: "+JSON.stringify(t))}function TE(t){return{getReturnType:function(t){return oE.BOOLEAN},toGlsl:function(e,r){mE(r,2);for(var n=oE.ANY,i=0;i<r.length;i++)n&=sE(r[i]);if(0===n)throw new Error("All arguments should be of compatible type, got "+JSON.stringify(r)+" instead");return"("+dE(e,r[0],n)+" "+t+" "+dE(e,r[1],n)+")"}}}aE.get={getReturnType:function(t){return oE.ANY},toGlsl:function(t,e){mE(e,1),yE(e[0]);var r=e[0].toString();return-1===t.attributes.indexOf(r)&&t.attributes.push(r),(t.inFragmentShader?"v_":"a_")+r}},aE.var={getReturnType:function(t){return oE.ANY},toGlsl:function(t,e){mE(e,1),yE(e[0]);var r=e[0].toString();return-1===t.variables.indexOf(r)&&t.variables.push(r),"u_"+r}},aE.time={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,0),"u_time"}},aE.zoom={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,0),"u_zoom"}},aE.resolution={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,0),"u_resolution"}},aE["*"]={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,2),gE(e),"("+dE(t,e[0])+" * "+dE(t,e[1])+")"}},aE["/"]={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,2),gE(e),"("+dE(t,e[0])+" / "+dE(t,e[1])+")"}},aE["+"]={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,2),gE(e),"("+dE(t,e[0])+" + "+dE(t,e[1])+")"}},aE["-"]={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,2),gE(e),"("+dE(t,e[0])+" - "+dE(t,e[1])+")"}},aE.clamp={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){mE(e,3),gE(e);var r=dE(t,e[1]),n=dE(t,e[2]);return"clamp("+dE(t,e[0])+", "+r+", "+n+")"}},aE["%"]={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,2),gE(e),"mod("+dE(t,e[0])+", "+dE(t,e[1])+")"}},aE["^"]={getReturnType:function(t){return oE.NUMBER},toGlsl:function(t,e){return mE(e,2),gE(e),"pow("+dE(t,e[0])+", "+dE(t,e[1])+")"}},aE[">"]={getReturnType:function(t){return oE.BOOLEAN},toGlsl:function(t,e){return mE(e,2),gE(e),"("+dE(t,e[0])+" > "+dE(t,e[1])+")"}},aE[">="]={getReturnType:function(t){return oE.BOOLEAN},toGlsl:function(t,e){return mE(e,2),gE(e),"("+dE(t,e[0])+" >= "+dE(t,e[1])+")"}},aE["<"]={getReturnType:function(t){return oE.BOOLEAN},toGlsl:function(t,e){return mE(e,2),gE(e),"("+dE(t,e[0])+" < "+dE(t,e[1])+")"}},aE["<="]={getReturnType:function(t){return oE.BOOLEAN},toGlsl:function(t,e){return mE(e,2),gE(e),"("+dE(t,e[0])+" <= "+dE(t,e[1])+")"}},aE["=="]=TE("=="),aE["!="]=TE("!="),aE["!"]={getReturnType:function(t){return oE.BOOLEAN},toGlsl:function(t,e){return mE(e,1),vE(e[0]),"(!"+dE(t,e[0])+")"}},aE.between={getReturnType:function(t){return oE.BOOLEAN},toGlsl:function(t,e){mE(e,3),gE(e);var r=dE(t,e[1]),n=dE(t,e[2]),i=dE(t,e[0]);return"("+i+" >= "+r+" && "+i+" <= "+n+")"}},aE.array={getReturnType:function(t){return oE.NUMBER_ARRAY},toGlsl:function(t,e){xE(e,2),EE(e,4),gE(e);var r=e.map((function(e){return dE(t,e,oE.NUMBER)}));return"vec"+e.length+"("+r.join(", ")+")"}},aE.color={getReturnType:function(t){return oE.COLOR},toGlsl:function(t,e){xE(e,3),EE(e,4),gE(e);var r=e;3===e.length&&r.push(1);var n=e.map((function(e,r){return dE(t,e,oE.NUMBER)+(r<3?" / 255.0":"")}));return"vec"+e.length+"("+n.join(", ")+")"}},aE.interpolate={getReturnType:function(t){for(var e=oE.COLOR|oE.NUMBER,r=3;r<t.length;r+=2)e&=sE(t[r]);return e},toGlsl:function(t,e,r){SE(e),xE(e,6);var n,i=e[0];switch(i[0]){case"linear":n=1;break;case"exponential":n=i[1];break;default:n=null}if(!n)throw new Error('Invalid interpolation type for "interpolate" operator, received: '+JSON.stringify(i));var o=void 0!==r?r:oE.ANY,a=aE.interpolate.getReturnType(e)&o;wE(e,a);for(var s=dE(t,e[1]),u=null,l=2;l<e.length-2;l+=2){var h=dE(t,e[l]),c=dE(t,e[l+1],a),p=dE(t,e[l+2]);u="mix("+(u||c)+", "+dE(t,e[l+3],a)+", pow(clamp(("+s+" - "+h+") / ("+p+" - "+h+"), 0.0, 1.0), "+lE(n)+"))"}return u}},aE.match={getReturnType:function(t){for(var e=oE.ANY,r=2;r<t.length;r+=2)e&=sE(t[r]);return e&=sE(t[t.length-1])},toGlsl:function(t,e,r){SE(e),xE(e,4);var n=void 0!==r?r:oE.ANY,i=aE.match.getReturnType(e)&n;wE(e,i);for(var o=dE(t,e[0]),a=dE(t,e[e.length-1],i),s=null,u=e.length-3;u>=1;u-=2){s="("+o+" == "+dE(t,e[u])+" ? "+dE(t,e[u+1],i)+" : "+(s||a)+")"}return s}},aE.case={getReturnType:function(t){for(var e=oE.ANY,r=1;r<t.length;r+=2)e&=sE(t[r]);return e&=sE(t[t.length-1])},toGlsl:function(t,e,r){!function(t){if(t.length%2==0)throw new Error("An even amount of arguments was expected, got "+t+" instead")}(e),xE(e,3);var n=void 0!==r?r:oE.ANY,i=aE.case.getReturnType(e)&n;wE(e,i);for(var o=0;o<e.length-1;o+=2)vE(e[o]);var a=dE(t,e[e.length-1],i),s=null;for(o=e.length-3;o>=0;o-=2){s="("+dE(t,e[o])+" ? "+dE(t,e[o+1],i)+" : "+(s||a)+")"}return s}};var CE={};Object.assign(CE,f),CE.Draw.createBox=function(){return function(t,e,r){var n=Gt(t.map((function(t){return Xr(t,r)}))),i=[[se(n),ue(n),me(n),ve(n),se(n)]],o=e;o?o.setCoordinates(i):o=new Wn(i);var a=zr();return a&&o.transform(r,a),o}};var RE={};Object.assign(RE,s,{proj4:g,Units:$e});var bE={};Object.assign(bE,v,{expressions:m,IconAnchorUnits:fs,IconOrigin:Cs,TextPlacement:Ra}),Object.assign(bE.Style,{createDefaultStyle:Do,createEditingStyle:ko});var PE={AssertionError:C,Collection:St,Disposable:G,Feature:Ct,Geolocation:li,Graticule:cu,Image:Es,ImageBase:vs,ImageCanvas:fu,ImageTile:Ru,Kinetic:bu,Map:Xp,MapBrowserEvent:Lu,MapBrowserEventHandler:Uu,MapBrowserPointerEvent:Au,MapEvent:Ou,Object:vt,Observable:pt,Overlay:ah,PluggableMap:vl,Tile:Tu,TileCache:Qp,TileQueue:Hu,TileRange:ef,VectorRenderTile:of,VectorTile:sf,View:hl,getUid:S,VERSION:"6.3.1",coordinate:l,control:c,events:Object.assign({},n,{Event:Object.assign({},i,{BaseEvent:K,stopPropagation:W,preventDefault:Z}),condition:p}),extent:o,format:{GeoJSON:xf,GML:_d,KML:sg,WFS:ly,WKT:Fy},geom:Object.assign({},d,{Polygon:u}),interaction:CE,layer:_,proj:RE,source:y,sphere:a,style:bE,tilegrid:{WMTS:eE},loadingstrategy:h};window.ol?window.console.error('"ol" already exists'):window.ol=PE;e.default=PE}]);
});

define('vis-ui.js', function (require, exports, module) {
/**
 *
 * @author Andriy Oblivantsev <eslider@gmail.com>
 * @copyright 25.08.2015 by WhereGroup GmbH & Co. KG
 * @deprecated know your own data types (objects vs arrays) and bring your own appropriate iterations
 * @todo: remove usages from Digitizer 1.1+
 * @todo: remove in v0.3.x
 */

window.DataUtil = new function() {

    var self = this;

    /**
     * Check and replace values recursive if they should be translated.
     * For checking used "translationReg" variable
     *
     *
     * @param items
     */
    function eachItem_(items, callback) {
        var isArray = items instanceof Array;
        if(isArray) {
            for (var k in items) {
                eachItem_(items[k], callback);
            }
        } else {
            if(typeof items["type"] !== 'undefined') {
                callback(items);
            }
            if(typeof items["children"] !== 'undefined') {
                eachItem_(items["children"], callback);
            }
        }
    }
    this.eachItem = function(items, callback) {
        console.warn("Global vis-ui.js window.DataUtil is deprecated and will be removed in v0.3");
        eachItem_(items, callback);
    };

    /**
     * Check if object has a key
     *
     * @param obj
     * @param key
     * @returns {boolean}
     */
    self.has = function(obj, key) {
        console.warn("Global vis-ui.js window.DataUtil is deprecated and will be removed in v0.3");
        return typeof obj[key] !== 'undefined';
    };

    /**
     * Get value from object by the key or return default given.
     *
     * @param obj
     * @param key
     * @param defaultValue
     * @returns {*}
     */
    self.getVal = function(obj, key, defaultValue) {
        console.warn("Global vis-ui.js window.DataUtil is deprecated and will be removed in v0.3");
        return has(obj, key) ? obj[key] : defaultValue;
    }
};

/**
 * String Helper library
 *
 * Using example:
 *      StringHelper.parseHttpRequest( location.href.split('#')[1] );
 *
 * @author Andriy Oblivantsev <eslider@gmail.com>
 * @copyright 27.01.2015 by WhereGroup GmbH & Co. KG
 * @deprecated all around useless with no known dependants
 * @todo: remove in v0.2.x
 */
window.StringHelper = new function() {

    var self = this;
    var reKeys = /[^\[\]]+/g;
    var reTiles = /[^=\?\&]+/g;

    /**
     * Get matched groups by RegExp
     *
     * @param reg
     * @param text
     * @return {Array}
     */
    self.matchGroups = function(reg, text) {
        var match;
        var result = [];
        while (match = reg.exec(text)) {
            result.push(match[0]);
        }
        return result;
    };

    /**
     * Cast string value to native type
     *
     * @param val
     * @return {*}
     */
    self.castValue = function(val) {
        var r;
        if(val == "false") {
            r = false;
        } else if(val == "true") {
            r = true;
        } else if(!isNaN(val)) {
            r = parseInt(val);
        } else {
            r = val;
        }
        return r;
    };

    /**
     * Parse and return HTTP request as an object
     *
     * @param url
     * @return {{}}
     */
    self.parseHttpRequest = function(uri) {
        var matches = uri ? self.matchGroups(reTiles, uri) : {};
        var len = matches.length;
        var result = {};
        var key, keyLength, subResult, keys, value, z, i;

        for (i = 0; i < len; i += 2) {
            keys = self.matchGroups(reKeys, matches[i]);
            value = self.castValue(matches[i + 1]);
            subResult = result;
            keyLength = keys.length;
            for (z = 0; z < keyLength; z++) {
                key = keys[z];
                if(z == keyLength - 1) {
                    subResult[key] = value;
                } else if(!subResult.hasOwnProperty(key)) {
                    subResult[key] = {};
                }
                subResult = subResult[key];
            }
        }
        return result;
    };
};

/**
 *
 * @author Andriy Oblivantsev <eslider@gmail.com>
 */
/**
 * Form helper plugin for jQuery
 *
 * @author Andriy Oblivantsev <eslider@gmail.com>
 * @copyright 02.02.2015 by WhereGroup GmbH & Co. KG
 *
 */
window.VisUi = window.VisUi || {};
window.VisUi.validateInput = function(input) {
    var $input = $(input);
    if ($input.attr('type') === 'radio') {
        // Individual radio buttons cannot be invalid and cannot be validated
        return;
    }
    var isValid = $input.is(':valid') || $input.get(0).type === 'hidden';
    var validationCallback = input.data('warn');
    if (isValid && validationCallback) {
        var value = $input.val();
        if (value === '') {
            isValid = validationCallback(null);
        } else {
            isValid = validationCallback(value);
        }
    }
    // NOTE: hidden inputs must be explicitly excluded from jQuery validation
    //       see https://stackoverflow.com/questions/51534473/jquery-validate-not-working-on-hidden-input
    var isValid = (!validationCallback || validationCallback(value)) && $input.is(':valid') || $input.get(0).type === 'hidden';
    var $formGroup = input.closest('.form-group');
    $formGroup.toggleClass('has-error', !isValid);
    $formGroup.toggleClass('has-success', isValid);
    var $messageContainer = $('.invalid-feedback', $formGroup);
    var invalidMessage = $input.attr('data-visui-validation-message');
    if (!isValid && invalidMessage && $input.is(":visible") && $input.attr('type') !== 'checkbox') {
        if (!$messageContainer.length) {
            $messageContainer = $(document.createElement('div')).addClass('help-block invalid-feedback');
            $formGroup.append($messageContainer);
        }
        $messageContainer.text(invalidMessage || '');
    }
    $messageContainer.toggle(!isValid);
    if (!isValid) {
        // Re-validate once on change, to make error message disappear
        $input.one('change', function() {
            VisUi.validateInput(input);
        });
    }
    // .has-warning is set initially to required inputs but its styling conflicts with .has-error / .has-success.
    // After validation, we always either .has-error or .has-success, so .has-warning needs to go
    $formGroup.removeClass('has-warning');
    return isValid;
};

$.fn.formData = (function() {
    function setValues(form, values) {
        $('.-visui-text-callback', form).each(function() {
            var textElement = $(this);
            var callback = textElement.data('visui-text-callback');
            /** @todo: why .html? .text would be safer */
            textElement.html(callback.call(null, values));
        });
        $(':input[name]', form).each(function() {
            var input = $(this);
            var value = values[this.name];

            if(values.hasOwnProperty(this.name)) {

                switch (this.type) {
                    case 'select-multiple':
                        if (value && !$.isArray(value)) {
                            var separator = input.attr('data-visui-multiselect-separator') || ',';
                            input.val(value.split(separator));
                        } else {
                            input.val(value);
                        }
                        break;
                    case 'checkbox':
                        input.prop('checked', value !== null && value);
                        break;
                    case 'radio':
                        if (value === null) {
                            input.prop('checked', false);
                        } else if (input.val() == value) {
                            input.prop("checked", true);
                        }
                        break;
                    case 'hidden':
                        input.val(value);
                        input.trigger('change');
                        break;

                    case 'text':
                        if(input.hasClass('hasDatepicker')) {
                            if(value === '' || value === 0 || value === '0') {
                                value = null;
                            }

                            input.datepicker("setDate", value);
                            input.datepicker("refresh");
                        } else {
                            input.val(value);
                        }
                        break;
                    default:
                        input.val(value);
                        break;
                }
                // Use scoped events to visually update select2 / colorpicker, if initialized
                // @todo: ... why exactly do we avoid triggering regular 'change', except for 'hidden'-type inputs?
                input.trigger('change.select2');
                /** magical 'filled' event, purpose unknown. Emit warnings on event data property access */
                var filledEventData = {};
                Object.defineProperties(filledEventData, {
                    data: {
                        get: function() {
                            console.warn("Stop subscribing to custom 'filled' event. Explicitly call your code after repopulating a form.");
                            return values;
                        }
                    },
                    value: {
                        get: function() {
                            console.warn("Stop subscribing to custom 'filled' event. Explicitly call your code after repopulating a form.");
                            return value;
                        }
                    }
                });

                input.trigger('filled', filledEventData);
                input.trigger('change.colorpicker');
            }
        });
        return form;
    }
    function getValues(form) {
        var values = {};
        var firstInput;
        $(':input[name]', form).each(function() {
            var input = $(this);
            var value;

            // Ignore unchecked radios to avoid replacing previous checked radio value with the same name attribute
            // NOTE: vis-ui itself makes it possible to generate radio button groups where no radio button is checked
            //       For these cases, we cannot skip all unchecked radios. We have to evaluate at least one, to generate
            //       an empty value.
            if (this.type === 'radio' && values[this.name] && !this.checked) {
                return;
            }

            switch (this.type) {
                case 'checkbox':
                case 'radio':
                    value = input.is(':checked') && input.val();
                    break;
                default:
                    value = input.val();
                    break;
            }

            if (value === "" || (this.type === 'radio' && !this.checked)) {
                value = null;
            }
            var isValid = VisUi.validateInput(input);
            if (!isValid && !firstInput) {
                var $tabElement = input.closest('.ui-tabs');
                var tabIndex = $tabElement.length && input.closest('.ui-tabs-panel').index('.ui-tabs-panel');
                if ($tabElement) {
                    $tabElement.tabs({active: tabIndex});
                }
                firstInput = input;
                input.focus();
            }

            values[this.name] = value;
        });
        return values;
    }
    function handleArgs(values) {
        if (values) {
            return setValues($(this), values);
        } else {
            return getValues($(this));
        }
    }
    return handleArgs;
})();

$.fn.disableForm = function() {
    var form = this;
    var inputs = $(" :input", form);
    form.attr('readonly', true);
    form.css('cursor', 'wait');
    $.each(inputs, function(idx, el) {
        var $el = $(el);
        if($el.is(':checkbox') || $el.is(':radio') || $el.is('select')) {
            $el.attr('disabled', 'disabled');
        } else {
            $el.attr('readonly', 'true');
        }
    })
};

$.fn.enableForm = function() {
    var form = this;
    var inputs = $(" :input", form);
    form.css('cursor', '');
    $.each(inputs, function(idx, el) {
        var $el = $(el);
        if($el.is(':checkbox') || $el.is(':radio') || $el.is('select')) {
            $el.removeAttr('disabled', 'disabled');
        } else {
            $el.removeAttr('readonly', 'true');
        }
    })
};



/**
 * Confirm dialog
 *
 * Example:
 *     confirmDialog({html: "Remove?", title: "Please confirm!", onSuccess:function(){
                  return false;
       }});
 * @param options
 * @returns {*}
 */
window.confirmDialog = function(options) {
    var dialog = $("<div class='confirm-dialog'>" + (options.hasOwnProperty('html') ? options.html : "") + "</div>").popupDialog({
        title:       options.hasOwnProperty('title') ? options.title : "",
        maximizable: false,
        dblclick:    false,
        minimizable: false,
        resizable:   false,
        collapsable: false,
        modal:       true,
        buttons:     [{
            text:  "OK",
            click: function(e) {
                if(!options.hasOwnProperty('onSuccess') || options.onSuccess(e) !== false) {
                    dialog.popupDialog('close');
                }
                return false;
            }
        }, {
            text:    "Cancel",
            'class': 'critical',
            click:   function(e) {
                if(!options.hasOwnProperty('onCancel') || options.onCancel(e) !== false) {
                    dialog.popupDialog('close');
                }
                return false;
            }
        }]
    });
    return dialog;
};
(function($) {
    /**
     * Mapbender result table element.
     * Uses DataTables API
     *
     * @see http://datatables.net/reference/api/
     *
     * @example $('<div/>').resultTable( lengthChange: false,
     searching:    false,
     info:         false,
     columns:      [{data: 'id', title: 'ID'}, {data: 'label', title: 'Title'}],
     data:         [{id: 1, label: 'example'}]
     * @todo: Get this over into a separate repository (WITH a working stylesheet) or into Mapbender (current location of required stylesheet)
     *        it makes no sense to have markup generation and css class modifiers here, separate from the stylesheets that make it work
     */
    $.widget("vis-ui-js.resultTable", {

        _table:     null,
        _dataTable: null,
        _selection: null,

        /**
         * Constructor.
         *
         * @private
         */
        _create: function() {
            var widget = this;
            var el = $(widget.element);
            var table = widget._table = $('<table class="table table-striped table-hover"></table>');
            var options = widget.options;
            var isSelectable = _.has(options, 'selectable') && options.selectable;
            var hasBottomNavigation = _.has(options, 'bottomNavigation') && _.isArray(options.bottomNavigation);
            var hasRowButtons = options.hasOwnProperty('buttons');
            var dataTableContainer;

            el.append(table);
            el.addClass('mapbender-element-result-table');

            if(isSelectable) {
                widget._addSelection();
            }

            if(hasRowButtons) {
                widget._addButtons(options.buttons);
            }
            var dataTable = widget._dataTable = table.DataTable($.extend({
                "oLanguage": {
                    sEmptyTable: "0 / 0",
                    sInfo:      "_START_ / _END_ (_TOTAL_)",
                    "oPaginate": {
                        "sSearch":   "Filter:",
                        "sNext":     "Weiter",
                        "sPrevious": "Zurück"
                    }
                }
            },options));

            dataTableContainer = table.closest('.dataTables_wrapper');
            dataTableContainer.find('.dataTables_paginate a').addClass('button');

            if(isSelectable) {

                var selectionManager = widget.getSelection();

                dataTable.on('page', function() {

                    $.each(dataTable.$('tr'), function() {
                        var tr = this;
                        var rowData = widget.getDataByRow(tr);
                        var foundData = null;

                        $.each(selectionManager.list,function(){
                            var selectedData = this;
                            if(rowData == selectedData){
                                foundData = selectedData;
                                return false;
                            }
                        });

                        var $tr = $(tr);
                        var checkbox = $('td.selection input[type=checkbox]', $tr);

                        if(foundData) {
                            checkbox.prop('checked', true);
                            $tr.addClass('warning');
                        }else{
                            checkbox.prop('checked', false);
                            $tr.removeClass('warning');
                        }
                    });
                });

                selectionManager.on('add', function(data) {
                    var tr = widget.getRowByData(data);
                    if(!tr){
                        return;
                    }
                    var checkbox = $('td.selection input[type=checkbox]', tr);
                    checkbox.prop('checked', true);
                    tr.addClass('warning');
                }).on('remove', function(data) {
                    var tr = widget.getRowByData(data);
                    if(!tr){
                        return;
                    }
                    $('td.selection input[type=checkbox]', tr).prop('checked', false);
                    tr.removeClass('warning');
                });

                $(table).delegate("tbody>tr[role='row']", 'click', function(e) {
                    var tr = $(this);
                    var isSelected = !tr.hasClass('warning');
                    var data = dataTable.row(this).data();

                    if(isSelected) {
                        selectionManager.add(data);
                    } else {
                        selectionManager.remove(data);
                    }
                });
            }

            if(hasRowButtons) {
                $.each(options.buttons, function(idx, button) {
                    if(!button.hasOwnProperty('onClick') && !button.hasOwnProperty('click'))
                        return;

                    $(table).delegate("tbody>tr[role='row'] button." + button.className, 'click', function(e) {
                        var $button = $(this);
                        var data = dataTable.row($button.closest('tr')[0]).data();
                        e.stopPropagation();
                        if(button.click && typeof button.click == "function"){
                            $button.data("item", data);
                            $.proxy(button.click, $button)(e);
                        }else{
                            button.onClick(data, $button, e);
                        }
                    });
                });
            }

            if(hasBottomNavigation) {
                this.addBottomNavigation(options.bottomNavigation);
            }
        },

        genNavigation: function(elements) {
            var html = $('<div class="button-navigation"/>');
            $.each(elements, function(idx, element) {

                var type = 'button';
                if(_.has(element,'type')){
                    type = element.type;
                }else if(_.has(element,'html')){
                    type = 'html';
                }

                switch(type){
                    case 'html':
                        html.append(element.html);
                        break;
                    case 'button':
                        var button = $('<button/>');
                        button.attr({
                            'class': 'button',
                            title: element.title || null
                        });
                        button.text(element.text || undefined);
                        button.addClass(element.cssClass || null);
                        if(_.has(element,'className')){
                            button.addClass("icon-"+element.className);     // why?
                            button.addClass( element.className);
                        }

                        html.append(button);
                        break;
                }
            });
            return html;
        },

        /**
         * Get DataTables API
         * @see http://datatables.net/reference/api/
         */
        getApi: function() {
            return this._dataTable;
        },
        
        /**
         * Get widget itself
         * 
         * @returns widget
         */
        getWidget: function(){
            return this;
        },

        /**
         * Get selection manager
         */
        getSelection: function() {
            var widget = this;
            if(!widget._selection) {
                widget._selection = $.extend(true, new function() {
                    var me = this;
                    var list = me.list = [];
                    this.table = widget._table;

                    /**
                     * Add selection
                     *
                     * @param data
                     */
                    me.add = function(data) {
                        if(_.indexOf(list,data) != -1){
                            return this;
                        }
                        list.push(data);
                        me.dispatch('add', data);
                        me.dispatch('change', list);
                        return this;
                    };

                    /**
                     * Remove selection
                     * @param data
                     * @return {boolean}
                     */
                    me.remove = function(data) {
                        if(_.indexOf(list, data) == -1) {
                            return this;
                        }
                        list.splice(_.indexOf(list, data), 1);
                        me.dispatch('remove', data);
                        me.dispatch('change', list);
                        return this;
                    };
                }, widget._eventDispatcher);
            }
            return widget._selection;
        },

        /**
         * Set option listener
         *
         * @param key
         * @param value
         * @private
         */
        _setOption: function(key, value) {
            switch (key) {
                case "data":
                    this.setData(value);
            }
        },

        /**
         * Set table data
         *
         * @param data
         */
        setData: function(data) {
            var options = $.extend(this.options, {aaData: data});
            this.options.data = data;
            this._dataTable.destroy();
            this._dataTable = $(this._table).DataTable(options);
        },

        _addSelection: function() {
            var options = this.options;
            var columns = options.columns;

            options.columns = _.union([{
                data:  null,
                title: ''
            }], columns);

            var columnDef = [{
                targets:        0,
                className:      'selection',
                width:          "1%",
                orderable:      false,
                searchable:     false,
                defaultContent: '<input type="checkbox" value="1"/>'
            }];

            // merge definitions
            options.columnDefs = options.hasOwnProperty('columnDefs') ? _.flatten(options.columnDefs, columnDef) : columnDef;
        },

        _addButtons: function(buttons) {
            var options = this.options;

            options.columns.push({
                data:  null,
                title: ''
            });

            var columnDef = [{
                targets:        -1,
                className:      'buttons',
                width:          "1%",
                orderable:      false,
                searchable:     false,
                defaultContent: $('<div>').append(this.genNavigation(options.buttons).clone()).html()
            }];

            // merge definitions
            options.columnDefs = options.hasOwnProperty('columnDefs') ? _.union(options.columnDefs, columnDef) : columnDef;
        },

        /**
         *
         * @param buttons
         * @return {*}
         */
        addBottomNavigation: function(buttons) {
            var widget = this;
            var el = $(widget.element);
            var options = widget.options;
            var navigation = widget.genNavigation(buttons).addClass('bottom-navigation');

            $('button', navigation).on('click', function(event) {
                var button = $(event.currentTarget);
                // find and run callback, if defined in configuration
                $.each(options.bottomNavigation, function(idx, config) {
                    if(button.hasClass(config.className) && config.hasOwnProperty('onClick')) {
                        config.onClick($.extend(event, {
                            widget:    widget,
                            dataTable: widget._dataTable,
                            table:     widget._table,
                            config:    config
                        }));
                    }
                });
            });

            el.append(navigation);

            return navigation;
        },

        getRowByData: function(data) {
            var widget = this;
            var r = null;
            $.each(widget.getVisibleRows(), function() {
                if(widget.getDataByRow(this) == data) {
                    r = $(this);
                    return false;
                }
            });
            return r;
        },

        getVisibleRows: function() {
            return $(">tbody>tr[role='row']", this._table);
        },

        getVisibleRowData: function() {
            var list = [];
            var widget = this;

            $.each(widget.getVisibleRows(), function() {
                list.push(widget.getDataByRow(this));
            });

            return list;
        },

        getDataByRow: function(tr) {
            return this._dataTable.row(tr).data();
        },

        selectVisibleRows: function() {
            var widget = this;
            var selectionManager = widget.getSelection();
            $.each(widget.getVisibleRows(), function() {
                selectionManager.add(widget.getDataByRow(this));
            });
        },

        // TODO: realize
        selectAll: function() {
            var widget = this;
            var selectionManager = widget.getSelection();
            $.each(widget._dataTable.data(), function() {
                selectionManager.add(this);
            });
        },

        deselectVisibleRows: function() {
            var widget = this;
            var selectionManager = widget.getSelection();
            $.each(widget.getVisibleRows(), function() {
                selectionManager.remove(widget.getDataByRow(this));
            });
        },

        // TODO: realize
        deselectAll: function() {
            var widget = this;
            var selectionManager = widget.getSelection();
            $.each(widget._dataTable.data(), function() {
                selectionManager.remove(this);
            });
        },

        hasUnselectedVisibleRows: function() {
            var r = false;
            $.each(this.getVisibleRows(),function(){
                if(!$(this).hasClass('warning')){
                    r = true;
                    return false;
                }
            });
            return r;
        },
        
        /**
         * 
         * @param {type} id
         * @param {type} key
         * @returns {@exp;selector|@exp;seed@pro;length|@exp;selector@call;slice|String|@exp;compiled@pro;selector|@exp;selector@call;replace|@exp;handleObjIn@pro;selector|until|seed.length|compiled.selector|handleObjIn.selector|@exp;type|@exp;type@call;slice|@exp;callback|@exp;props|@exp;params|@arr;@this;|@exp;data|@exp;speed|@exp;options|Array|@exp;props@call;split|@exp;jQuery@call;param|@exp;query@call;split|@exp;jQuery@call;makeArray|@exp;selectorundefined|@exp;options@pro;duration|@exp;_@call;extend|options|@exp;s@call;join@call;replace|selectorundefined|_@call;extend.duration|options.duration}Get data by id
         */
        getDataById: function(value, key){    
            var result;
            
            if(!key){
                key = 'id'
            }
            $.each(this.getApi().data(),function(i, data){
                if(value === data[key]){
                    result = data;
                    return false
                }
            });
            return result;
        },

        /**
         * Get DOM TR row by data object
         * @param {type} DOM object
         * @returns {undefined}
         */
        getDomRowByData: function(data) {
            var tableApi = this.getApi();
            var result = _.first(tableApi.rows(function(idx, _data, row) {
                return _data == data
            }).nodes());

            return result ? $(result) : result;
        },
        
        /**
         * Show by DOM row
         * @return int page number
         */
        showByRow: function(domRow){
            var tableApi =  this._dataTable;
            var rowsOnOnePage = tableApi.page.len();

            if(domRow.hasOwnProperty('length')){
                domRow = domRow[0]
            }
            
            var nodePosition = tableApi.rows({order: 'current'}).nodes().indexOf(domRow);
            var pageNumber = Math.floor(nodePosition / rowsOnOnePage);
            tableApi.page(pageNumber).draw( false );
            return pageNumber;
        },
        _eventDispatcher: {
            _listeners: {},

            on: function(name,callback){
                if(!this._listeners[name]){
                    this._listeners[name] = [];
                }
                this._listeners[name].push(callback);
                return this;
            },

            off: function(name,callback){
                if(!this._listeners[name]){
                    return;
                }
                if(callback){
                    var listeners = this._listeners[name];
                    for(var i in listeners){
                        if(callback == listeners[i]){
                            listeners.splice(i,1);
                            return;
                        }
                    }
                }else{
                    delete this._listeners[name];
                }

                return this;
            },

            dispatch: function(name,data){
                if(!this._listeners[name]){
                    return;
                }

                var listeners = this._listeners[name];
                for(var i in listeners){
                    listeners[i](data);
                }
                return this;
            }
        }
    });

})(jQuery);

(function($) {

    /**
     * Date selector based on $.ui.datepicker
     * Replacement for <input type="date"> for browsers without proper HTML5 supprt.
     * Hard-coded to German locale.
     * Accepts no options. Accepting any options would conflict with operation of native HTML5 inputs.
     *
     * Widget can't be extended:
     * http://bugs.jqueryui.com/ticket/6228
     *
     * @author Andriy Oblivantsev <eslider@gmail.com>
     */
    $.widget("vis-ui-js.dateSelector", {
        _init: function() {
            var $input = $('input', this.element);
            var datePicker = $input.datepicker({
                changeMonth:       true,
                changeYear:        true,
                gotoCurrent:       true,
                defaultDate:       null,
                firstDay:          1, //showWeek:          true,
                dayNamesMin:       ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
                monthNamesShort:   ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], //showButtonPanel: true,
                dateFormat:        'yy-mm-dd'
            }).data('datepicker');
            // legacy styling hacks
            // @todo: style via proper datepicker selectors in proper scope, do not add random classes that "seem to work"
            // @todo: better yet, use original jquery ui css to style original jquery ui widgets
            datePicker.dpDiv.addClass('dropdown-menu').addClass('modal-body');
        }
    });

})(jQuery);

(function($) {
    // fake dialogExtend check for ui-dialog
    if (!$.fn.orignalDialogFunc) {
        // sic!
        $.fn.orignalDialogFunc = $.fn.dialog;
    }
    var $doc = $(document);
    if (!$doc.data('visui-monkeypatch-uidialog')) {
        $.fn["dialog"] = function(arg1, arg2) {
            return this.hasClass('popup-dialog') ? this.popupDialog(arg1, arg2) :  this.orignalDialogFunc(arg1, arg2);
        };
        $doc.data('visui-monkeypatch-uidialog', true);
    }

    /**
     * jQueryui dialog with unholy mix of bootstrap and Mapbender custom styles
     *
     * @author Andriy Oblivantsev <eslider@gmail.com>
     * @copyright 05.11.2014 by WhereGroup GmbH & Co. KG
     * @todo: Get this over into a separate repository (WITH a working stylesheet) or into Mapbender (current location of required stylesheet)
     *        it makes no sense to have markup generation and css class modifiers here, separate from the stylesheets that make it work
     */
    $.widget("vis-ui-js.popupDialog", $.ui.dialog, {
        /**
         * @return {*}
         * @private
         */
        _create: function() {
            var element = this.element;
            // Unholy mix of jQuery UI and Bootstrap and Mapbender CSS
            element.addClass('popup-dialog');
            element.addClass('modal-body');

            // overrides default options
            $.extend(this.options, {
                show: {
                    effect:   "fadeIn",
                    duration: 300
                },
                hide: {
                    effect:   "fadeOut",
                    duration: 300
                }
            });

            //resize dialog height fix
            element.bind('popupdialogresize', function(e, ui) {
                var win = $(e.target).closest('.ui-dialog');
                var height = 0;
                $.each($('> .modal-header, > .modal-body, > .modal-footer', win), function(idx, el) {
                    height += $(el).outerHeight();
                });
                win.height(Math.round(height));
                element.width(element.closest('.ui-dialog').find('> .modal-header').width());
            });

            //resize dialog height fix
            element.bind('popupdialogresizestop', function(e, ui) {
                element.width(element.closest('.ui-dialog').find('> .modal-header').width());
            });

            // prevent key listening outside the dialog
            element.on('keydown', function(e) {
                e.stopPropagation();
            });

            this._super();
        },
        _createTitlebar: function() {
            this._super();
            if (this.element.dialogExtend) {
                // NOTE: no widget-level options defaults for these
                var extendableOptions = $.extend(true, {
                    closable:    true,
                    maximizable: true,
                    collapsable: true
                }, this.options);

                this.element.data("ui-dialog", true);
                if (extendableOptions.maximizable && (typeof this.options.dblclick === 'undefined')) {
                    extendableOptions.dblclick = 'maximize';
                }

                this.element.dialogExtend(extendableOptions);
            }
            // Unholy mix of jQuery UI and Bootstrap and Mapbender CSS
            this.uiDialogTitlebar.addClass('modal-header');
            // @todo Mapbender: resolve Mapbender css dependency on generally not advantageous bootstrap .close class
            //                  to generate consistent close button vs jquerydialogextend not-really-button visuals
            $('.ui-dialog-titlebar-close', this.uiDialogTitlebar).addClass('close');
        },
        open: function() {
            this._super();
            if (this.overlay) {
                this.overlay.addClass('mb-element-modal-dialog');
            }
        },
        _createWrapper: function() {
            this._super();
            // Unholy mix of jQuery UI and Bootstrap and Mapbender CSS
            this.uiDialog.addClass('modal-content mb-element-popup-dialog');
        },
        _createButtonPane: function() {
            // Unholy mix of jQuery UI and Bootstrap and Mapbender CSS
            this._super();
            this.uiDialogButtonPane.addClass('modal-footer');
        },
        _createButtons: function() {
            this._super();
            $('button', this.uiButtonSet).each(function() {
                var $b = $(this);
                // leave fully formed Bootstrap buttons alone; add Mapbender .button (for default color) plus
                // Bootstrap .btn (for margin) otherwise
                if (!$b.hasClass('btn')) {
                    $(this).addClass('button btn');
                }
            });
        }
    });

})(jQuery);

(function($) {

    /**
     * jQuery tabs with bootstrap styles and auto-generation of tab headers and content panels
     * Internally unreachable
     */
    $.widget("vis-ui-js.tabNavigator", $.ui.tabs, {
        options: {
        },
        _create: function() {
            var widget = this;
            var options = widget.options;
            var el = widget.element;
            if (!this._getList().length) {
                this.element.prepend('<ul/>');
            }
            this._getList().addClass('nav nav-tabs');

            el.addClass('mapbender-element-tab-navigator');

            if(options.hasOwnProperty('children')){
                // internally unreachable path
                $.each(options.children,function(){
                    var $tab = widget._add(this);
                    $tab.data('item', this);
                });
                el.on('tabnavigatoractivate',function(e,ui) {
                    var item = $(ui.newTab).data('item');
                    if(item.hasOwnProperty('active')){
                        item.active(e,ui);
                    }
                });
            }

            return this._super();
        },
        /**
         * Static (no this context)
         * @param {jQuery} $panel
         * @param {String} title
         * @return {jQuery}
         */
        _renderTab: function($panel, title) {
            var $anchor = $('<a>')
                .attr('href', '#' + $panel.attr('id'))
                .text(title)
            ;
            return $('<li>')
                .append($anchor)
            ;
        },
        /**
         * Static (no this context)
         * @param {(jQuery|String)} content
         * @private
         */
        _renderPanel: function(content) {
            return $("<div>")
                .uniqueId()
                .addClass('tab-content')
                .append(content)
            ;
        },
        _add: function (item){
            var $panel = this._renderPanel(item.html);
            var $tab = this._renderTab($panel, item.title);
            this._getList().append($tab);
            this.element.append($panel);
            return $tab;
        },

        add: function(title, htmlElement, activate) {
            var content = this._add({
                html:  htmlElement,
                title: title
            });
            if(activate) {
                this.option('active', this.size() - 1);
            }
            this.refresh();
            return content;
        },

        size: function() {
            return this.tabs.length;
        }
    });
})(jQuery);

/**
 *
 * @author Andriy Oblivantsev <eslider@gmail.com>
 * @copyright 08.04.2015 by WhereGroup GmbH & Co. KG
 */
(function($) {

    /**
     * Event list
     * @type {string[]}
     */
    var eventNameList = [
        'load',
        'focus', 'blur',
        'input', 'change', 'paste',
        'click', 'dblclick', 'contextmenu',
        'keydown', 'keypress', 'keyup',
        'dragstart','ondrag','dragover','drop',
        'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover', 'mouseup',
        'touchstart', 'touchmove', 'touchend','touchcancel',
        'filled'
    ];

    // extend jquery to fire event on "show" and "hide" calls
    // @todo: this is bad practice and should be removed ASAP. Figure out who even uses this.
    $.each(['show', 'hide'], function (i, ev) {
        var el = $.fn[ev];
        $.fn[ev] = function () {
            this.trigger(ev);
            return el.apply(this, arguments);
        };
    });

    function isNode(x) {
        // Minimum (DOM level 1) criteria for DOM Nodes or text nodes
        // see https://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html
        return x && x.nodeType && x.nodeName;
    }

    /**
     * @param {String} expr
     * @return {RegExp|null}
     */
    function expressionToRegex(expr) {
        // for valid flags see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Advanced_searching_with_flags
        var matches = expr.match(/^[/](.*?)[/]([gimsuy]*)$/);
        if (matches) {
            return new RegExp(matches[1], matches[2]);
        } else {
            return null;
        }
    }

    /**
     * Check if typeof object[key] !== 'undefined'
     *
     * @param obj
     * @param key
     * @returns {boolean}
     */
    function has(obj, key) {
        return typeof obj[key] !== 'undefined';
    }

    function genElement_(declarations, item) {
        if (isNode(item)) {
            return item;
        }
        // @todo: explicitly warn / err on undefined type (there will be an error on calling undefined as a function, but it won't be informative)
        // @todo: fallback to html should ONLY be allowed if the item is a plain string
        var type = has(declarations, item.type) ? item.type : 'html';
        // Use declarations object as this argument for handler function.
        // Do not "beautify" this into discrete assignment of callable to variable followed by invocation, because
        // THAT passes nothing of particular interest as the invoked method's this arg.
        // see https://ecma-international.org/ecma-262/5.1/#sec-4.3.27
        var element = (declarations[type])(item);

        if(has(item, 'cssClass')) {
            element.addClass(item.cssClass);
        }

        if(has(item, 'attr')) {
            $.each(item.attr, function(key, val) {
                element.attr(key,val);
            });
        }

        if(typeof item == "object") {
            addEvents(element, item);
        }

        if(has(item, 'css')) {

            element.css(item.css);
        }

        // @todo: remove excessive data bindings
        element.data('item', item);

        return element;
    }

    function genElements_(declarations, items) {
        var items_;
        if (!_.isArray(items)) {
            // @todo: warn, deprecate
            items_ = _.toArray(items);
        } else {
            items_ = items;
        }
        var elements = [];
        for (var i = 0; i < items_.length; ++i) {
            elements.push(genElement_(declarations, items_[i]));
        }
        return elements;
    }
    /**
     * Add jquery events to element y declration
     *
     * @param element
     * @param declaration
     */
    function addEvents(element, declaration) {
        $.each(declaration, function(k, value) {
            if(typeof value == 'function') {
                element.on(k, value);
            } else if(typeof value == "string" && _.contains(eventNameList, k)) {
                var elm = element;
                if(elm.hasClass("form-group")) {
                    elm = elm.find("input,.form-control");
                }
                if(k === 'load'){
                    setTimeout(function(){
                        $(elm).ready(function(e) {
                            var el = elm;
                            var result = false;
                            console.error("Using Javascript code in the configuration is deprecated",value);
                            eval(value);
                            result && e.preventDefault();
                            return result;
                        });
                    },1);
                }else{
                    elm.on(k, function(e) {
                        var el = $(this);
                        var result = false;
                        console.error("Using Javascript code in the configuration is deprecated",value);
                        eval(value);
                        result && e.preventDefault();
                        return result;
                    });
                }
            }
        });
    }

    // Copies a string to the clipboard. Must be called from within an
    // event handler such as click. May return false if it failed, but
    // this is not always possible. Browser support for Chrome 43+,
    // Firefox 42+, Safari 10+, Edge and IE 10+.
    // IE: The clipboard feature may be disabled by an administrator. By
    // default a prompt is shown the first time the clipboard is
    // used (per session).
    function copyToClipboard(text) {
        if (window.clipboardData && window.clipboardData.setData) {
            // IE specific code path to prevent textarea being shown while dialog is visible.
            return clipboardData.setData("Text", text);

        } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
            var textarea = document.createElement("textarea");
            textarea.textContent = text;
            textarea.style.position = "fixed";  // Prevent scrolling to bottom of page in MS Edge.
            document.body.appendChild(textarea);
            textarea.select();
            try {
                return document.execCommand("copy");  // Security exception may be thrown by some browsers.
            } catch (ex) {
                console.warn("Copy to clipboard failed.", ex);
                return false;
            } finally {
                document.body.removeChild(textarea);
            }
        }
    }
    var readOnlyDeclarations = {
        genElement_: genElement_,
        genElements_: genElements_
    };

    var browserSupportsHtml5Date = (function() {
        // detect support for HTML5 date input; see https://stackoverflow.com/a/10199306
        var dateInput = document.createElement('input');
        var invalidDate = 'not-a-date';
        dateInput.setAttribute('type', 'date');
        dateInput.setAttribute('value', invalidDate);
        return dateInput.value !== invalidDate;
    })();
    var isValidatingInput = function(item) {
        var attr = item.attr || {};
        return item.name && item.type !== 'radio' && (item.mandatory || attr.required || attr.pattern);
    };
    var isRequiredInput = function(item) {
        var attr = item.attr || {};
        return item.name && item.type !== 'radio' && (item.mandatory || attr.required);
    };
    var wrapGroup = function(contents, required) {
        var container = $('<div class="form-group"/>');
        if (required) {
            container.addClass('has-warning');
        }
        container.append(contents);
        return container;
    };
    var setBaseInputProps = function(input, item) {
        $(input).attr({
            type: $(input).attr('type') || (item.type !== 'input' && item.type) || 'text',
            name: item.name || null
        });
        $(input).prop({
            required: isRequiredInput(item),
            disabled: item.disabled
        });
    };
    var setTextInputProps = function(input, item) {
        var attr = item.attr || {};
        setBaseInputProps(input, item);
        input.attr({
            placeholder: attr.placeholder || item.placeholder || null
        });

        if (typeof(item.value) !== 'undefined') {
            input.val(item.value);
        }
    };

    // NOTE: bad indents deliberate to minimize diff
    var defaultDeclarations = $.extend({}, readOnlyDeclarations, {
            copyToClipboard: copyToClipboard,
            popup: function(item) {
                var popup = $("<div/>");
                popup.append(this.genElements_(this, item.children || []));
                window.setTimeout(function() {
                    popup.popupDialog(item)
                }, 1);

                return popup;
            },
            form: function(item) {
                var form = $('<form/>').attr(item.attr || {});
                form.append(this.genElements_(this, item.children || []));
                return form;
            },
            fluidContainer: function(item) {
                var container = $('<div/>').attr(item.attr || {}).addClass('container-fluid');
                var hbox = $('<div/>').attr(item.rowAttr || {}).addClass('row');
                hbox.append(this.genElements_(this, item.children || []));
                container.append(hbox);
                return container;
            },
            inline: function(item) {
                var container = $('<div/>').attr(item.attr || {}).addClass('form-inline');
                container.append(this.genElements_(this, item.children || []));
                return container;
            },
            html: function(item) {
                var container = $('<div/>').attr(item.attr || {}).addClass('html-element-container');
                if (typeof item === 'string'){
                    container.html(item);
                } else if (typeof item.html !== 'undefined') {
                    container.html(item.html);
                }else{
                    // WHAT?
                    container.html(JSON.stringify(item));
                }
                return container;
            },
            button: function(item) {
                var title = has(item, 'title') ? item.title : 'Submit';
                // @todo: use .text for escaping (unless it's HTML again :\)
                var button = $('<button>' + title + '</button>').attr(item.attr || {}).addClass('btn button');
                button.attr("title", (item.attr || {}).title || item.hover || title);
                return button;
            },
            submit: function(item) {
                var item_ = $.extend({}, item, {
                    attr: $.extend({}, (item. attr || {}), {
                        type: 'submit'
                    })
                });
                return this.button(item_);
            },
            /**
             * WRAPS the passed input into a form group
             *
             * @param {Object} item
             * @param {jQuery} [input] manufactures a new text-type input if omitted
             * @return {*|jQuery|HTMLElement}
             */
            input: function(item, input) {
                // @todo: fold very apparent copy & paste between this method and "checkbox" method
                var inputField = input;
                if (!input) {
                    var type = (item.type !== 'input' && item.type) || 'text';
                    inputField = $('<input class="form-control" type="' + type + '"/>');
                    inputField.attr(item.attr || {});
                }
                // @todo: remove excessive data bindings
                inputField.data('declaration',item);
                setTextInputProps(inputField, item);

                var label;
                if (item.title) {
                    label = this.label(item);
                }

                if (item.mandatory) {
                    var validationCallback;
                    if (item.mandatory === true) {
                        validationCallback = function(value) {
                            return $.trim(value).length;
                        };
                    } else if (typeof item.mandatory === 'string') {
                        // legacy fun fact: string runs through eval, but result of eval can only be used
                        // if it happens to have an method named .exec accepting a single parameter
                        // => this was never compatible with anything but regex literals
                        var rxp = expressionToRegex(item.mandatory);
                        if (rxp) {
                            validationCallback = function(value) {
                                return rxp.test(value);
                            }
                        }
                    }
                    if (!validationCallback) {
                        console.error("Invalid value in item.mandatory. Use boolean true or a regex literal.", item.mandatory, item);
                        throw new Error("Invalid value in item.mandatory. Use boolean true or a regex literal.");
                    }
                    // @todo: why in the world is this a data attribute? Validation belongs in a form submit handler.
                    //        HTML5 validation already does most of this without custom logic
                    inputField.data('warn', validationCallback);
                }
                if (item.mandatoryText) {
                    inputField.attr('data-visui-validation-message', item.mandatoryText);
                }

                if (label && item.copyClipboard) {
                    label.append('&nbsp;', $('<i/>')
                        .addClass('fa fa-clipboard far-clipboard -visui-copytoclipboard')
                        .attr('aria-hidden', 'true')
                    );
                }
                return wrapGroup([label, inputField], isValidatingInput(item));
            },
            label: function(item) {
                var label = $('<label/>');
                if(_.has(item, 'text')) {
                    label.html(item.text);
                }
                if(_.has(item, 'title')) {
                    label.html(item.title);
                }
                if(_.has(item, 'name')) {
                    label.attr('for', item.name);
                }
                if (item.infoText) {
                    var $icon = $('<i/>')
                        .addClass('fa fa-info-circle -visui-infotext')
                        .attr('title', item.infoText)
                    ;
                    label.append('&nbsp;', $icon);
                }

                return label;
            },
            checkbox: function(item) {
                var label = this.label(item);
                var input = $('<input type="checkbox"/>');
                label.prepend(input);

                setBaseInputProps(input, item);
                input.attr('value', item.value || null);
                input.prop('checked', !!item.checked);
                var container = wrapGroup([label], isRequiredInput(item));
                container.addClass('checkbox');
                return container;
            },
            radio: function(item) {
                var input = $('<input type="radio"/>');
                var $label = this.label(item);
                setBaseInputProps(input, item);
                input.prop('checked', !!item.checked);
                input.attr('value', item.value || null);
                $label.prepend(input);
                var container = wrapGroup([$label], false);
                container.addClass('radio');
                return container;
            },
            formGroup: function(item) {
                var container = $('<div class="form-group"/>');
                container.append(this.genElements_(this, item.children || []));
                return container;
            },
            textArea: function(item) {
                var inputField = $('<textarea class="form-control" rows="3"/>');
                var container = this.input(item, inputField);
                container.addClass('textarea-container');

                inputField.attr('rows', item.rows || 3);

                return container;
            },
            selectOption: function(item, option) {
                var label, value;
                var labelAttribNames = ['label', '__label', 'title'];
                var valueAttribNames = ['value', '___value', 'id'];
                var noLabel = true;
                var noValue = true;
                var i = 0;
                do {
                    label = option[labelAttribNames[i]];
                    noLabel = (typeof label === 'undefined');
                    ++i;
                } while (noLabel && i < labelAttribNames.length);
                i = 0;
                do {
                    value = option[valueAttribNames[i]];
                    noValue = (typeof value === 'undefined');
                    ++i;
                } while (noLabel && i < valueAttribNames.length);
                if (noLabel || noValue) {
                    var optionAsList = _.toArray(option);
                    if (optionAsList.length < 2) {
                        console.error("Invalid option input, need at least a label and a value", option);
                        return null;    // will be skipped by $.append
                    }
                    if (_.isArray(option) && optionAsList.length > 2) {
                        console.warn("List-style option with more than two entries, results unpredictable. Use an object with 'value' and 'label' instead", option);
                    }
                    if (noValue) {
                        value = optionAsList[0];
                    }
                    if (noLabel) {
                        label = optionAsList[1];
                    }
                }
                var attr = $.extend({}, option.attr, {value: value});
                var $option = $('<option/>')
                    .attr(attr)
                    // Label has historically been set through .html instead of .text ...
                    // @todo: html seems super unsafe to use. Figure out why / if we really want HTML here instead of text
                    .html(label)
                ;
                return $option;
            },
            selectOptionList: function(item) {
                var options = item.options || [];
                if (!_.isArray(options)) {
                    console.warn("Passing an option mapping is deprecated (order cannot be guaranteed). Use a list.", options);
                    // legacy fun time: keys are used as labels, mapped values used as submit values
                    options = _.map(options, function(x, key) {
                        return {value: x, label: key};
                    });
                }
                var optionElements = [];
                for (var i = 0; i < options.length; ++i) {
                    optionElements.push(this.selectOption(item, options[i]));
                }
                return optionElements;
            },
            select: function(item) {
                var select = $('<select class="form-control"/>');
                var container = this.input(item, select);
                var value = item.value;

                container.addClass('select-container');

                select.append(this.selectOptionList(item));
                if (item.multiple) {
                    select.prop('multiple', true);
                    var separator = item.separator || ',';
                    if (value && !$.isArray(value)) {
                        value = value.split(separator);
                    }
                    select.attr('data-visui-multiselect-separator', separator);
                    select.val(value || null);
                } else {
                    if (value || !isRequiredInput(item)) {
                        select.val(value || "");
                    }
                }
                if ((item.multiple || item.select2) && (typeof select.select2 === 'function')) {
                    select.select2(item);
                }

                return container;
            },
            image: function(item) {
                var image = $('<img src="' + (has(item, 'src') ? item.src : '') + '"/>');
                image.attr('data-preview-for', item.name || null);
                var subContainer = $("<div class='sub-container'/>");
                var label = item.title && this.label(item);
                var container = wrapGroup([label, image], false);

                container.append(subContainer.append(image.detach()));
                container.addClass("image-container");

                if(has(item, 'enlargeImage') && item.enlargeImage) {
                    image.attr('tabindex', 0);
                    image.css('cursor', 'pointer');
                    image.on('keypress click', function(e) {
                        if(e.type !== 'click' && e.which && e.which !== 13) {
                            return
                        }

                        var bigImage = new Image();
                        bigImage.src = item.src;
                        bigImage.onload = function() {
                            var dialog = $('<div>');
                            var bImage = $('<img src="' + image.attr('src') + '"/>');
                            var _popupConfig = {
                                title: image.title ? image.title : 'Image',
                                width: bigImage.width
                            };
                            var maxHeight = $(window).height() - 100;
                            if(bigImage.height > maxHeight) {
                                _popupConfig.height = maxHeight;
                            }
                            dialog.popupDialog(_popupConfig);
                            bImage.css({
                                height:      'auto',
                                width:       '100%',
                                'max-width': bigImage.width
                            });
                            dialog.append(bImage);
                        };
                    })
                }

                if(has(item, 'imageCss')) {
                    image.css(item['imageCss']);
                } else {
                    image.css({width: "100%"});
                }
                return container;
            },
            file: function(item) {
                var input = $('<input type="hidden"  />');
                var fileInput = $('<input type="file" />');
                var container = this.input(item, input);
                var defaultText = (has(item, 'text') ? item.text : "Select");
                var textSpan = '<span class="upload-button-text"><i class="fa fa-upload" aria-hidden="true"/> ' + defaultText + '</span>';
                var uploadButton = $('<span class="btn btn-success button fileinput-button">' + textSpan + '</span>');
                var buttonContainer = $("<div/>");
                var progressBar = $("<div class='progress-bar'/>");
                var eventHandlers = item.on ? item.on : {};

                if(has(item, 'accept')) {
                    fileInput.attr('accept', item.accept);
                }

                //input.detach();
                container.addClass("file-container");
                uploadButton.append(fileInput);
                buttonContainer.append(uploadButton);
                uploadButton.append(progressBar);
                container.append(buttonContainer);

                function truncate(n, len) {
                    var ext = n.substring(n.lastIndexOf(".") + 1, n.length).toLowerCase();
                    var filename = n.replace('.' + ext, '');
                    if(filename.length <= len) {
                        return n;
                    }
                    filename = filename.substr(0, len) + (n.length > len ? '[...]' : '');
                    return filename + '.' + ext;
                }

                fileInput.fileupload({
                    dataType:    'json',
                    url:         item.uploadHanderUrl,
                    formData:    item.formData,
                    //sequentialUploads: true,
                    add:         function(e, data) {
                        //console.log("added file", data, e);
                        data.submit();
                    },
                    progressall: function(e, data) {
                        var progress = parseInt(data.loaded / data.total * 100, 10);
                        progressBar.css({width: progress + "%"});
                        //progressBar.html(progress + "%");
                        if(eventHandlers.progressall){
                            console.error("Using Javascript code in the configuration is deprecated",eventHandlers.progressall);
                            eval(eventHandlers.progressall);
                        }
                    },
                    always:      function(e, data) {
                        if(eventHandlers.always) {
                            console.error("Using Javascript code in the configuration is deprecated",eventHandlers.always);
                            eval(eventHandlers.always);
                        }
                    },
                    done:        function(e, data) {
                        if(eventHandlers.done){
                            console.error("Using Javascript code in the configuration is deprecated",eventHandlers.done);
                            eval(eventHandlers.done);
                        }
                        progressBar.css({width: 0});
                    },
                    success:     function(result, textStatus, jqXHR) {
                        if(eventHandlers.success){
                            console.error("Using Javascript code in the configuration is deprecated",eventHandlers.success);
                            eval(eventHandlers.success);
                        }

                        if(result.files && result.files[0]) {
                            var fileInfo = result.files[0];
                            var img = container.closest('.vis-ui').find('img[data-preview-for="' + item.name + '"]');

                            if(fileInfo.error) {
                                $.notify(fileInfo.error, "error");
                                return;
                            }

                            if(fileInfo.name) {
                                buttonContainer.find('.upload-button-text').html('<i class="fa fa-check-circle-o far-check-circle" aria-hidden="true"/> ' + truncate(fileInfo.name, 10));
                                var newUploadFileInput = container.find('input[type="file"]')
                                    .attr('title', fileInfo.name)
                                    .attr('alt', fileInfo.name)
                                    .attr('label', fileInfo.name);
                            }

                            if(img.size()){
                                img.attr('src', fileInfo.thumbnailUrl);
                            }
                            input.val(fileInfo.url);
                        }
                    }
                });

                return container;
            },
            tabs: function(item) {
                var $tabList = $('<ul/>');
                var container = $('<div/>').append($tabList);
                var children = item.children || [];
                for (var i = 0; i < children.length; ++i) {
                    var subItem = children[i];
                    var panelContent = this.genElement_(this, subItem);
                    var $panel = $('<div>').uniqueId().append(panelContent);
                    var $tabHeader = $('<li>').append($('<a>').attr('href', '#' + $panel.attr('id')).text(subItem.title));
                    $tabList.append($tabHeader);
                    container.append($panel);
                }
                container.tabs({
                    classes: {
                        "ui-tabs": "ui-tabs mapbender-element-tab-navigator",
                        "ui-tabs-nav": "ui-tabs-nav nav nav-tabs",
                        "ui-tabs-panel": "ui-tabs-panel tab-content"
                    }
                });
                return container;
            },
            fieldSet: function(item) {
                var fieldSet = $("<fieldset class='form-group'/>");

                if (item.title) {
                    fieldSet.append(this.label(item));
                }
                if(has(item, 'legend')) {
                    fieldSet.append("<legend>"+item.legend+"</legend>");
                }
                fieldSet.append(this.genElements_(this, item.children || []));

                if (item.breakLine) {
                    fieldSet.append(this.breakLine(item));
                }

                return fieldSet;
            },
            date: function(item) {
                var value = item.value;
                if (item.dateFormat && item.dateFormat !== 'yy-mm-dd') {
                    console.warn("Ignoring invalid dateFormat setting. The only possible value is 'yy-mm-dd'. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date", item);
                }
                if (value === null || (typeof value === 'undefined')) {
                    value = '';
                }
                if (value !== '' && !(typeof value === 'string' && value.match(/^\d{4}-\d{2}-\d{2}$/))) {
                    if (!(typeof value === 'string' && value.match(/^\d{4}-\d{2}-\d{2}$/))) {
                        console.error("Invalid value for date input, ignoring", value);
                        value = '';
                    }
                }
                if (item.mandatory && !value) {
                    value = (new Date()).toISOString().slice(0, 10);
                }

                if (browserSupportsHtml5Date) {
                    return this.input($.extend({}, item, {
                        type: 'date',
                        value: value
                    }));
                } else {
                    var textInput = this.input($.extend({}, item, {
                        type: 'text',
                        value: value
                    }));
                    textInput.dateSelector();
                    return textInput;
                }
            },
            colorPicker: function(item) {
                var container = $('<div class="form-group"/>');
                var inputHolder = this.input(item);
                var label = inputHolder.find('> label');

                inputHolder.append('<span class="input-group-addon"><i></i></span>');
                inputHolder.addClass("input-group colorpicker-element colorpicker-component");
                container.prepend(label);
                container.append(inputHolder);
                inputHolder.find('> label').remove();

                if (item.value) {
                    item.color = item.value;
                }

                if(!item.hasOwnProperty("format")){
                    item.format = "hex";
                }

                inputHolder.colorpicker(item);

                var input = inputHolder.find("input");
                input.addClass("form-control");

                return container;
            },
            slider: function(item) {
                var container = $('<div class="form-group input-group slider-holder"/>');
                var inputHolder = this.input(item);
                var label = inputHolder.find('> label');
                var input = inputHolder.find('> input');
                var sliderRange = $('<div class="input-group"/>');

                label.append('<span/>')

                inputHolder.prepend(sliderRange);
                inputHolder.find('> label').remove();
                inputHolder.find('> input').attr('type', 'hidden');

                container.prepend(label);
                container.append(inputHolder);

                label.find('> span').text(' ' + item.value);

                sliderRange.slider($.extend({
                    range:  "max",
                    min:    1,
                    max:    10,
                    value:  1,
                    step:   1,
                    slide:  function(event, ui) {
                        input.val(ui.value);
                        label.find('> span').text(' ' + ui.value);
                    },
                    change: function(event, ui) {
                        var value = input.val();
                        label.find('> span').text(' ' + value);
                    }
                }, item));

                input.on('change', function() {
                    var value = input.val();
                    label.find('> span').text(' ' + value);
                    sliderRange.slider("value", value);
                });

                return container;
            },
            resultTable: function(item) {
                var container = $("<div/>").attr(item.attr || {});
                $.each(['name'], function(i, key) {
                    if(has(item, key)) {
                        container.attr(key, item[key]);
                    }
                });

                return container
                    // @todo: remove excessive data bindings
                    .data('declaration', item)
                    .resultTable($.extend({
                        lengthChange: false,
                        pageLength:   10,
                        searching:    false,
                        info:         true,
                        processing:   false,
                        ordering:     true,
                        paging:       true,
                        selectable:   false,
                        autoWidth:    false
                    }, item));
            },
            digitizingToolSet: function(item) {
                var $div = $("<div/>").attr(item.attr || {});
                // @todo: remove excessive data bindings
                $div.data('declaration',item);
                return $div.digitizingToolSet(item);
            },

            /**
             * Break line
             *
             * @param item
             * @return {*|HTMLElement}
             */
            breakLine: function(item) {
                return $("<hr/>").attr(item.attr || {}).addClass('break-line');
            },

            /**
             *
             * @param item
             */
            text: function(item) {
                var callback;
                if (!item.text) {
                    console.error('Missing value property .text for type "text" item', item);
                    throw new Error('Missing value property .text for type "text" item');
                }
                var text = $('<div/>').attr(item.attr || {}).addClass('text -visui-text-callback');
                if (typeof item.text === 'function') {
                    callback = function(values) {
                        return (item.text)(values);
                    };
                } else {
                    console.warn("Using eval'd JavaScript code for item type text is deprecated. Supply a function.", item);
                    callback = function(values) {
                        try {
                            var data = values;  // for eval scope
                            var declaration = item; // for eval scope
                            return eval(item.text);
                        } catch (e) {
                            console.error('Failed to evaluate text type item content', item.text, item, values);
                            throw new Error('Failed to evaluate text type item content');
                        }
                    };
                }
                text.data('visui-text-callback', callback);
                var container = this.input(item, text);
                container.addClass('text');
                return container;
            },

            /**
             * Simple container
             *
             * @param item
             * @todo v0.2.x: remove this
             */
            container: function(item) {
                console.warn("Generating a type: container via vis-ui.js is deprecated and will be removed in v0.2", item);
                var container = $('<div/>').attr(item.attr || {}).addClass('form-group');
                container.append(this.genElements_(this, item.children || []));
                return container;
            },

            /**
             * Simple accordion
             *
             * @param item
             * @todo v0.2.x: remove this
             */
            accordion: function(item) {
                console.warn("Generating a type: accordion via vis-ui.js is deprecated and will be removed in v0.2", item);
                var declarations = this;
                var container = $('<div class="accordion"/>');
                if(has(item, 'children')) {
                    _.each(item.children, function(child, k) {
                        var pageContainer = $("<div class='container' data-id='" + k + "'/>");
                        var pageHeader = $("<h3 class='header' data-id='" + k + "'/>");

                        if(has(child, 'head')) {
                            pageHeader.append(declarations.genElement_(declarations, child.head));
                        }

                        if(has(child, 'content')) {
                            pageContainer.append(this.genElement_(declarations, child.content));
                        }

                        container.append(pageHeader);
                        container.append(pageContainer);
                    })
                }
                // @todo: remove excessive data bindings
                container.data('declaration', item);
                container.accordion(item);
                return container;
            }
    });
    $.widget('vis-ui-js.generateElements', {
        options:      {},
        /**
         * Constructor
         *
         * @private
         */
        _create: function() {
            this.element.addClass('vis-ui');
            this.element.on('click touch press', '.-visui-infotext[title]', function(evt) {
                evt.stopPropagation();
                $.notify($(this).attr('title'), 'info');
            });
            this.element.on('click', '.-visui-copytoclipboard', function(evt) {
                evt.stopPropagation();
                var $input = $('input, select, textarea', $(this).closest('.form-group'));
                copyToClipboard($input.val());
            });
            this._setOptions(this.options);
        },

        /**
         * Generate element by declaration
         *
         * @param item declaration
         * @return jquery html object
         */
        genElement: function(item) {
            return genElement_(this.declarations, item);
        },

        /**
         * Generate elements
         *
         * @param element jQuery object
         * @param children declarations
         */
        genElements: function(element, children) {
            element.append(genElements_(this.declarations, children));
        },

        /**
         * Set options
         *
         * @param options
         * @private
         * @todo: this should be _create (minus options argument)
         */
        _setOptions: function(options) {
            // always deep-copy to prevent monkey-patches affecting other instances
            // Re-add readOnlyDeclarations on top to prevent overrides.
            this.declarations = $.extend({}, defaultDeclarations, options.declarations, readOnlyDeclarations);
            if (options.type && !options.children) {
                console.warn("Invocation of generateElements (plural!) with single item is deprecated. Put your item in a list and pass it in the children property.");
                this.genElements(this.element, [options]);
            } else if(has(options, 'children')) {
                this.genElements(this.element, options.children);
            }
            this._super(options);
            this.refresh();
        },

        /**
         * Refresh generated elements
         */
        refresh:     function() {
            this._trigger('refresh');
        }
    });

    /**
     * Update existing select element
     *
     * @param values
     * @param idKey
     * @param valueKey
     */
    $.fn.updateSelect = function(values, idKey, valueKey) {
        var select = this;
        var val = select.val();
        select.empty();

        if(idKey && valueKey){
            values = _.object(_.pluck(values, idKey), _.pluck(values, valueKey));
        }

        _.each(values, function(value, key) {
            select.append('<option value="'+key+'">'+value+'</option>');
        });

        select.val(val);
    };

    /**
     * Grabbed from here: http://jsfiddle.net/DkHyd/
     */
    $.fn.togglepanels = function(args) {
        return this.each(function() {
            $(this).addClass("ui-accordion ui-accordion-icons ui-widget ui-helper-reset")
                .find("h3")
                .addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom")
                .hover(function() {
                    $(this).toggleClass("ui-state-hover");
                })
                .prepend('<span class="ui-icon ui-icon-triangle-1-e"></span>')
                .click(function(e) {
                    $(this)
                        .toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom")
                        .find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end()
                        .next().slideToggle(0);

                    if(args.onChange) {
                        var title = $(e.currentTarget);
                        args.onChange(e, {
                            'title':   title,
                            'content': title.next()
                        });
                    }
                    return false;
                })
                .next()
                .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom")
                .hide();
        });
    };

})(jQuery);

});

define('jquery-context-menu', function (require, exports, module) {
/*!
 * jQuery UI Position v1.10.0
 * http://jqueryui.com
 *
 * Copyright 2013 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/position/
 */
(function( $, undefined ) {

$.ui = $.ui || {};

var cachedScrollbarWidth,
	max = Math.max,
	abs = Math.abs,
	round = Math.round,
	rhorizontal = /left|center|right/,
	rvertical = /top|center|bottom/,
	roffset = /[\+\-]\d+%?/,
	rposition = /^\w+/,
	rpercent = /%$/,
	_position = $.fn.position;

function getOffsets( offsets, width, height ) {
	return [
		parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
		parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
	];
}

function parseCss( element, property ) {
	return parseInt( $.css( element, property ), 10 ) || 0;
}

function getDimensions( elem ) {
	var raw = elem[0];
	if ( raw.nodeType === 9 ) {
		return {
			width: elem.width(),
			height: elem.height(),
			offset: { top: 0, left: 0 }
		};
	}
	if ( $.isWindow( raw ) ) {
		return {
			width: elem.width(),
			height: elem.height(),
			offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
		};
	}
	if ( raw.preventDefault ) {
		return {
			width: 0,
			height: 0,
			offset: { top: raw.pageY, left: raw.pageX }
		};
	}
	return {
		width: elem.outerWidth(),
		height: elem.outerHeight(),
		offset: elem.offset()
	};
}

$.position = {
	scrollbarWidth: function() {
		if ( cachedScrollbarWidth !== undefined ) {
			return cachedScrollbarWidth;
		}
		var w1, w2,
			div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
			innerDiv = div.children()[0];

		$( "body" ).append( div );
		w1 = innerDiv.offsetWidth;
		div.css( "overflow", "scroll" );

		w2 = innerDiv.offsetWidth;

		if ( w1 === w2 ) {
			w2 = div[0].clientWidth;
		}

		div.remove();

		return (cachedScrollbarWidth = w1 - w2);
	},
	getScrollInfo: function( within ) {
		var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
			overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
			hasOverflowX = overflowX === "scroll" ||
				( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
			hasOverflowY = overflowY === "scroll" ||
				( overflowY === "auto" && within.height < within.element[0].scrollHeight );
		return {
			width: hasOverflowX ? $.position.scrollbarWidth() : 0,
			height: hasOverflowY ? $.position.scrollbarWidth() : 0
		};
	},
	getWithinInfo: function( element ) {
		var withinElement = $( element || window ),
			isWindow = $.isWindow( withinElement[0] );
		return {
			element: withinElement,
			isWindow: isWindow,
			offset: withinElement.offset() || { left: 0, top: 0 },
			scrollLeft: withinElement.scrollLeft(),
			scrollTop: withinElement.scrollTop(),
			width: isWindow ? withinElement.width() : withinElement.outerWidth(),
			height: isWindow ? withinElement.height() : withinElement.outerHeight()
		};
	}
};

$.fn.position = function( options ) {
	if ( !options || !options.of ) {
		return _position.apply( this, arguments );
	}

	// make a copy, we don't want to modify arguments
	options = $.extend( {}, options );

	var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
		target = $( options.of ),
		within = $.position.getWithinInfo( options.within ),
		scrollInfo = $.position.getScrollInfo( within ),
		collision = ( options.collision || "flip" ).split( " " ),
		offsets = {};

	dimensions = getDimensions( target );
	if ( target[0].preventDefault ) {
		// force left top to allow flipping
		options.at = "left top";
	}
	targetWidth = dimensions.width;
	targetHeight = dimensions.height;
	targetOffset = dimensions.offset;
	// clone to reuse original targetOffset later
	basePosition = $.extend( {}, targetOffset );

	// force my and at to have valid horizontal and vertical positions
	// if a value is missing or invalid, it will be converted to center
	$.each( [ "my", "at" ], function() {
		var pos = ( options[ this ] || "" ).split( " " ),
			horizontalOffset,
			verticalOffset;

		if ( pos.length === 1) {
			pos = rhorizontal.test( pos[ 0 ] ) ?
				pos.concat( [ "center" ] ) :
				rvertical.test( pos[ 0 ] ) ?
					[ "center" ].concat( pos ) :
					[ "center", "center" ];
		}
		pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
		pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";

		// calculate offsets
		horizontalOffset = roffset.exec( pos[ 0 ] );
		verticalOffset = roffset.exec( pos[ 1 ] );
		offsets[ this ] = [
			horizontalOffset ? horizontalOffset[ 0 ] : 0,
			verticalOffset ? verticalOffset[ 0 ] : 0
		];

		// reduce to just the positions without the offsets
		options[ this ] = [
			rposition.exec( pos[ 0 ] )[ 0 ],
			rposition.exec( pos[ 1 ] )[ 0 ]
		];
	});

	// normalize collision option
	if ( collision.length === 1 ) {
		collision[ 1 ] = collision[ 0 ];
	}

	if ( options.at[ 0 ] === "right" ) {
		basePosition.left += targetWidth;
	} else if ( options.at[ 0 ] === "center" ) {
		basePosition.left += targetWidth / 2;
	}

	if ( options.at[ 1 ] === "bottom" ) {
		basePosition.top += targetHeight;
	} else if ( options.at[ 1 ] === "center" ) {
		basePosition.top += targetHeight / 2;
	}

	atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
	basePosition.left += atOffset[ 0 ];
	basePosition.top += atOffset[ 1 ];

	return this.each(function() {
		var collisionPosition, using,
			elem = $( this ),
			elemWidth = elem.outerWidth(),
			elemHeight = elem.outerHeight(),
			marginLeft = parseCss( this, "marginLeft" ),
			marginTop = parseCss( this, "marginTop" ),
			collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
			collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
			position = $.extend( {}, basePosition ),
			myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );

		if ( options.my[ 0 ] === "right" ) {
			position.left -= elemWidth;
		} else if ( options.my[ 0 ] === "center" ) {
			position.left -= elemWidth / 2;
		}

		if ( options.my[ 1 ] === "bottom" ) {
			position.top -= elemHeight;
		} else if ( options.my[ 1 ] === "center" ) {
			position.top -= elemHeight / 2;
		}

		position.left += myOffset[ 0 ];
		position.top += myOffset[ 1 ];

		// if the browser doesn't support fractions, then round for consistent results
		if ( !$.support.offsetFractions ) {
			position.left = round( position.left );
			position.top = round( position.top );
		}

		collisionPosition = {
			marginLeft: marginLeft,
			marginTop: marginTop
		};

		$.each( [ "left", "top" ], function( i, dir ) {
			if ( $.ui.position[ collision[ i ] ] ) {
				$.ui.position[ collision[ i ] ][ dir ]( position, {
					targetWidth: targetWidth,
					targetHeight: targetHeight,
					elemWidth: elemWidth,
					elemHeight: elemHeight,
					collisionPosition: collisionPosition,
					collisionWidth: collisionWidth,
					collisionHeight: collisionHeight,
					offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
					my: options.my,
					at: options.at,
					within: within,
					elem : elem
				});
			}
		});

		if ( options.using ) {
			// adds feedback as second argument to using callback, if present
			using = function( props ) {
				var left = targetOffset.left - position.left,
					right = left + targetWidth - elemWidth,
					top = targetOffset.top - position.top,
					bottom = top + targetHeight - elemHeight,
					feedback = {
						target: {
							element: target,
							left: targetOffset.left,
							top: targetOffset.top,
							width: targetWidth,
							height: targetHeight
						},
						element: {
							element: elem,
							left: position.left,
							top: position.top,
							width: elemWidth,
							height: elemHeight
						},
						horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
						vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
					};
				if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
					feedback.horizontal = "center";
				}
				if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
					feedback.vertical = "middle";
				}
				if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
					feedback.important = "horizontal";
				} else {
					feedback.important = "vertical";
				}
				options.using.call( this, props, feedback );
			};
		}

		elem.offset( $.extend( position, { using: using } ) );
	});
};

$.ui.position = {
	fit: {
		left: function( position, data ) {
			var within = data.within,
				withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
				outerWidth = within.width,
				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
				overLeft = withinOffset - collisionPosLeft,
				overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
				newOverRight;

			// element is wider than within
			if ( data.collisionWidth > outerWidth ) {
				// element is initially over the left side of within
				if ( overLeft > 0 && overRight <= 0 ) {
					newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
					position.left += overLeft - newOverRight;
				// element is initially over right side of within
				} else if ( overRight > 0 && overLeft <= 0 ) {
					position.left = withinOffset;
				// element is initially over both left and right sides of within
				} else {
					if ( overLeft > overRight ) {
						position.left = withinOffset + outerWidth - data.collisionWidth;
					} else {
						position.left = withinOffset;
					}
				}
			// too far left -> align with left edge
			} else if ( overLeft > 0 ) {
				position.left += overLeft;
			// too far right -> align with right edge
			} else if ( overRight > 0 ) {
				position.left -= overRight;
			// adjust based on position and margin
			} else {
				position.left = max( position.left - collisionPosLeft, position.left );
			}
		},
		top: function( position, data ) {
			var within = data.within,
				withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
				outerHeight = data.within.height,
				collisionPosTop = position.top - data.collisionPosition.marginTop,
				overTop = withinOffset - collisionPosTop,
				overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
				newOverBottom;

			// element is taller than within
			if ( data.collisionHeight > outerHeight ) {
				// element is initially over the top of within
				if ( overTop > 0 && overBottom <= 0 ) {
					newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
					position.top += overTop - newOverBottom;
				// element is initially over bottom of within
				} else if ( overBottom > 0 && overTop <= 0 ) {
					position.top = withinOffset;
				// element is initially over both top and bottom of within
				} else {
					if ( overTop > overBottom ) {
						position.top = withinOffset + outerHeight - data.collisionHeight;
					} else {
						position.top = withinOffset;
					}
				}
			// too far up -> align with top
			} else if ( overTop > 0 ) {
				position.top += overTop;
			// too far down -> align with bottom edge
			} else if ( overBottom > 0 ) {
				position.top -= overBottom;
			// adjust based on position and margin
			} else {
				position.top = max( position.top - collisionPosTop, position.top );
			}
		}
	},
	flip: {
		left: function( position, data ) {
			var within = data.within,
				withinOffset = within.offset.left + within.scrollLeft,
				outerWidth = within.width,
				offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
				overLeft = collisionPosLeft - offsetLeft,
				overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
				myOffset = data.my[ 0 ] === "left" ?
					-data.elemWidth :
					data.my[ 0 ] === "right" ?
						data.elemWidth :
						0,
				atOffset = data.at[ 0 ] === "left" ?
					data.targetWidth :
					data.at[ 0 ] === "right" ?
						-data.targetWidth :
						0,
				offset = -2 * data.offset[ 0 ],
				newOverRight,
				newOverLeft;

			if ( overLeft < 0 ) {
				newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
				if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
					position.left += myOffset + atOffset + offset;
				}
			}
			else if ( overRight > 0 ) {
				newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
				if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
					position.left += myOffset + atOffset + offset;
				}
			}
		},
		top: function( position, data ) {
			var within = data.within,
				withinOffset = within.offset.top + within.scrollTop,
				outerHeight = within.height,
				offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
				collisionPosTop = position.top - data.collisionPosition.marginTop,
				overTop = collisionPosTop - offsetTop,
				overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
				top = data.my[ 1 ] === "top",
				myOffset = top ?
					-data.elemHeight :
					data.my[ 1 ] === "bottom" ?
						data.elemHeight :
						0,
				atOffset = data.at[ 1 ] === "top" ?
					data.targetHeight :
					data.at[ 1 ] === "bottom" ?
						-data.targetHeight :
						0,
				offset = -2 * data.offset[ 1 ],
				newOverTop,
				newOverBottom;
			if ( overTop < 0 ) {
				newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
				if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
					position.top += myOffset + atOffset + offset;
				}
			}
			else if ( overBottom > 0 ) {
				newOverTop = position.top -  data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
				if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
					position.top += myOffset + atOffset + offset;
				}
			}
		}
	},
	flipfit: {
		left: function() {
			$.ui.position.flip.left.apply( this, arguments );
			$.ui.position.fit.left.apply( this, arguments );
		},
		top: function() {
			$.ui.position.flip.top.apply( this, arguments );
			$.ui.position.fit.top.apply( this, arguments );
		}
	}
};

// fraction support test
(function () {
	var testElement, testElementParent, testElementStyle, offsetLeft, i,
		body = document.getElementsByTagName( "body" )[ 0 ],
		div = document.createElement( "div" );

	//Create a "fake body" for testing based on method used in jQuery.support
	testElement = document.createElement( body ? "div" : "body" );
	testElementStyle = {
		visibility: "hidden",
		width: 0,
		height: 0,
		border: 0,
		margin: 0,
		background: "none"
	};
	if ( body ) {
		$.extend( testElementStyle, {
			position: "absolute",
			left: "-1000px",
			top: "-1000px"
		});
	}
	for ( i in testElementStyle ) {
		testElement.style[ i ] = testElementStyle[ i ];
	}
	testElement.appendChild( div );
	testElementParent = body || document.documentElement;
	testElementParent.insertBefore( testElement, testElementParent.firstChild );

	div.style.cssText = "position: absolute; left: 10.7432222px;";

	offsetLeft = $( div ).offset().left;
	$.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;

	testElement.innerHTML = "";
	testElementParent.removeChild( testElement );
})();

}( jQuery ) );

/*!
 * jQuery contextMenu - Plugin for simple contextMenu handling
 *
 * Version: git-master
 *
 * Authors: Rodney Rehm, Addy Osmani (patches for FF)
 * Web: http://medialize.github.com/jQuery-contextMenu/
 *
 * Licensed under
 *   MIT License http://www.opensource.org/licenses/mit-license
 *   GPL v3 http://opensource.org/licenses/GPL-3.0
 *
 */

(function($, undefined){
    
    // TODO: -
        // ARIA stuff: menuitem, menuitemcheckbox und menuitemradio
        // create <menu> structure if $.support[htmlCommand || htmlMenuitem] and !opt.disableNative

// determine html5 compatibility
$.support.htmlMenuitem = ('HTMLMenuItemElement' in window);
$.support.htmlCommand = ('HTMLCommandElement' in window);
$.support.eventSelectstart = ("onselectstart" in document.documentElement);
/* // should the need arise, test for css user-select
$.support.cssUserSelect = (function(){
    var t = false,
        e = document.createElement('div');
    
    $.each('Moz|Webkit|Khtml|O|ms|Icab|'.split('|'), function(i, prefix) {
        var propCC = prefix + (prefix ? 'U' : 'u') + 'serSelect',
            prop = (prefix ? ('-' + prefix.toLowerCase() + '-') : '') + 'user-select';
            
        e.style.cssText = prop + ': text;';
        if (e.style[propCC] == 'text') {
            t = true;
            return false;
        }
        
        return true;
    });
    
    return t;
})();
*/

if (!$.ui || !$.ui.widget) {
    // duck punch $.cleanData like jQueryUI does to get that remove event
    // https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.widget.js#L16-24
    var _cleanData = $.cleanData;
    $.cleanData = function( elems ) {
        for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
            try {
                $( elem ).triggerHandler( "remove" );
                // http://bugs.jquery.com/ticket/8235
            } catch( e ) {}
        }
        _cleanData( elems );
    };
}

var // currently active contextMenu trigger
    $currentTrigger = null,
    // is contextMenu initialized with at least one menu?
    initialized = false,
    // window handle
    $win = $(window),
    // number of registered menus
    counter = 0,
    // mapping selector to namespace
    namespaces = {},
    // mapping namespace to options
    menus = {},
    // custom command type handlers
    types = {},
    // default values
    defaults = {
        // selector of contextMenu trigger
        selector: null,
        // where to append the menu to
        appendTo: null,
        // method to trigger context menu ["right", "left", "hover"]
        trigger: "right",
        // hide menu when mouse leaves trigger / menu elements
        autoHide: false,
        // ms to wait before showing a hover-triggered context menu
        delay: 200,
        // flag denoting if a second trigger should simply move (true) or rebuild (false) an open menu
        // as long as the trigger happened on one of the trigger-element's child nodes
        reposition: true,
        // determine position to show menu at
        determinePosition: function($menu) {
            // position to the lower middle of the trigger element
            if ($.ui && $.ui.position) {
                // .position() is provided as a jQuery UI utility
                // (...and it won't work on hidden elements)
                $menu.css('display', 'block').position({
                    my: "center top",
                    at: "center bottom",
                    of: this,
                    offset: "0 5",
                    collision: "fit"
                }).css('display', 'none');
            } else {
                // determine contextMenu position
                var offset = this.offset();
                offset.top += this.outerHeight();
                offset.left += this.outerWidth() / 2 - $menu.outerWidth() / 2;
                $menu.css(offset);
            }
        },
        // position menu
        position: function(opt, x, y) {
            var $this = this,
                offset;
            // determine contextMenu position
            if (!x && !y) {
                opt.determinePosition.call(this, opt.$menu);
                return;
            } else if (x === "maintain" && y === "maintain") {
                // x and y must not be changed (after re-show on command click)
                offset = opt.$menu.position();
            } else {
                // x and y are given (by mouse event)
                offset = {top: y, left: x};
            }
            
            // correct offset if viewport demands it
            var bottom = $win.scrollTop() + $win.height(),
                right = $win.scrollLeft() + $win.width(),
                height = opt.$menu.height(),
                width = opt.$menu.width();
            
            if (offset.top + height > bottom) {
                offset.top -= height;
            }

            if (offset.top<0) {
                offset.top = 0;
            }
            
            if (offset.left + width > right) {
                offset.left -= width;
            }
            
            opt.$menu.css(offset);
        },
        // position the sub-menu
        positionSubmenu: function($menu) {
            if ($.ui && $.ui.position) {
                // .position() is provided as a jQuery UI utility
                // (...and it won't work on hidden elements)
                $menu.css('display', 'block').position({
                    my: "left top",
                    at: "right top",
                    of: this,
                    collision: "flipfit fit"
                }).css('display', '');
            } else {
                // determine contextMenu position
                var offset = {
                    top: 0,
                    left: this.outerWidth()
                };
                $menu.css(offset);
            }
        },
        // offset to add to zIndex
        zIndex: 1,
        // show hide animation settings
        animation: {
            duration: 50,
            show: 'slideDown',
            hide: 'slideUp'
        },
        // events
        events: {
            show: $.noop,
            hide: $.noop
        },
        // default callback
        callback: null,
        // list of contextMenu items
        items: {}
    },
    // mouse position for hover activation
    hoveract = {
        timer: null,
        pageX: null,
        pageY: null
    },
    // determine zIndex
    zindex = function($t) {
        var zin = 0,
            $tt = $t;

        while (true) {
            zin = Math.max(zin, parseInt($tt.css('z-index'), 10) || 0);
            $tt = $tt.parent();
            if (!$tt || !$tt.length || "html body".indexOf($tt.prop('nodeName').toLowerCase()) > -1 ) {
                break;
            }
        }
        
        return zin;
    },
    // event handlers
    handle = {
        // abort anything
        abortevent: function(e){
            e.preventDefault();
            e.stopImmediatePropagation();
        },
        
        // contextmenu show dispatcher
        contextmenu: function(e) {
            var $this = $(this);
            
            // disable actual context-menu if we are using the right mouse button as the trigger
            if (e.data.trigger == 'right') {
                e.preventDefault();
                e.stopImmediatePropagation();
            }
            
            // abort native-triggered events unless we're triggering on right click
            if (e.data.trigger != 'right' && e.originalEvent) {
                return;
            }
            
            // abort event if menu is visible for this trigger
            if ($this.hasClass('context-menu-active')) {
                return;
            }
            
            if (!$this.hasClass('context-menu-disabled')) {
                // theoretically need to fire a show event at <menu>
                // http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#context-menus
                // var evt = jQuery.Event("show", { data: data, pageX: e.pageX, pageY: e.pageY, relatedTarget: this });
                // e.data.$menu.trigger(evt);
                
                $currentTrigger = $this;
                if (e.data.build) {
                    var built = e.data.build($currentTrigger, e);
                    // abort if build() returned false
                    if (built === false) {
                        return;
                    }
                    
                    // dynamically build menu on invocation
                    e.data = $.extend(true, {}, defaults, e.data, built || {});

                    // abort if there are no items to display
                    if (!e.data.items || $.isEmptyObject(e.data.items)) {
                        // Note: jQuery captures and ignores errors from event handlers
                        if (window.console) {
                            (console.error || console.log).call(console, "No items specified to show in contextMenu");
                        }
                        
                        throw new Error('No Items specified');
                    }
                    
                    // backreference for custom command type creation
                    e.data.$trigger = $currentTrigger;
                    
                    op.create(e.data);
                }
                // show menu
                op.show.call($this, e.data, e.pageX, e.pageY);
            }
        },
        // contextMenu left-click trigger
        click: function(e) {
            e.preventDefault();
            e.stopImmediatePropagation();
            $(this).trigger($.Event("contextmenu", { data: e.data, pageX: e.pageX, pageY: e.pageY }));
        },
        // contextMenu right-click trigger
        mousedown: function(e) {
            // register mouse down
            var $this = $(this);
            
            // hide any previous menus
            if ($currentTrigger && $currentTrigger.length && !$currentTrigger.is($this)) {
                $currentTrigger.data('contextMenu').$menu.trigger('contextmenu:hide');
            }
            
            // activate on right click
            if (e.button == 2) {
                $currentTrigger = $this.data('contextMenuActive', true);
            }
        },
        // contextMenu right-click trigger
        mouseup: function(e) {
            // show menu
            var $this = $(this);
            if ($this.data('contextMenuActive') && $currentTrigger && $currentTrigger.length && $currentTrigger.is($this) && !$this.hasClass('context-menu-disabled')) {
                e.preventDefault();
                e.stopImmediatePropagation();
                $currentTrigger = $this;
                $this.trigger($.Event("contextmenu", { data: e.data, pageX: e.pageX, pageY: e.pageY }));
            }
            
            $this.removeData('contextMenuActive');
        },
        // contextMenu hover trigger
        mouseenter: function(e) {
            var $this = $(this),
                $related = $(e.relatedTarget),
                $document = $(document);
            
            // abort if we're coming from a menu
            if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {
                return;
            }
            
            // abort if a menu is shown
            if ($currentTrigger && $currentTrigger.length) {
                return;
            }
            
            hoveract.pageX = e.pageX;
            hoveract.pageY = e.pageY;
            hoveract.data = e.data;
            $document.on('mousemove.contextMenuShow', handle.mousemove);
            hoveract.timer = setTimeout(function() {
                hoveract.timer = null;
                $document.off('mousemove.contextMenuShow');
                $currentTrigger = $this;
                $this.trigger($.Event("contextmenu", { data: hoveract.data, pageX: hoveract.pageX, pageY: hoveract.pageY }));
            }, e.data.delay );
        },
        // contextMenu hover trigger
        mousemove: function(e) {
            hoveract.pageX = e.pageX;
            hoveract.pageY = e.pageY;
        },
        // contextMenu hover trigger
        mouseleave: function(e) {
            // abort if we're leaving for a menu
            var $related = $(e.relatedTarget);
            if ($related.is('.context-menu-list') || $related.closest('.context-menu-list').length) {
                return;
            }
            
            try {
                clearTimeout(hoveract.timer);
            } catch(e) {}
            
            hoveract.timer = null;
        },
        
        // click on layer to hide contextMenu
        layerClick: function(e) {
            var $this = $(this),
                root = $this.data('contextMenuRoot'),
                button = e.button,
                x = e.pageX,
                y = e.pageY,
                target, 
                offset;
                
            e.preventDefault();
            e.stopImmediatePropagation();
            
            setTimeout(function() {
                var $window;
                var triggerAction = ((root.trigger == 'left' && button === 0) || (root.trigger == 'right' && button === 2));
                
                // find the element that would've been clicked, wasn't the layer in the way
                if (document.elementFromPoint) {
                    root.$layer.hide();
                    target = document.elementFromPoint(x - $win.scrollLeft(), y - $win.scrollTop());
                    root.$layer.show();
                }
                
                if (root.reposition && triggerAction) {
                    if (document.elementFromPoint) {
                        if (root.$trigger.is(target) || root.$trigger.has(target).length) {
                            root.position.call(root.$trigger, root, x, y);
                            return;
                        }
                    } else {
                        offset = root.$trigger.offset();
                        $window = $(window);
                        // while this looks kinda awful, it's the best way to avoid
                        // unnecessarily calculating any positions
                        offset.top += $window.scrollTop();
                        if (offset.top <= e.pageY) {
                            offset.left += $window.scrollLeft();
                            if (offset.left <= e.pageX) {
                                offset.bottom = offset.top + root.$trigger.outerHeight();
                                if (offset.bottom >= e.pageY) {
                                    offset.right = offset.left + root.$trigger.outerWidth();
                                    if (offset.right >= e.pageX) {
                                        // reposition
                                        root.position.call(root.$trigger, root, x, y);
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
                
                if (target && triggerAction) {
                    root.$trigger.one('contextmenu:hidden', function() {
                        $(target).contextMenu({x: x, y: y});
                    });
                }

                root.$menu.trigger('contextmenu:hide');
            }, 50);
        },
        // key handled :hover
        keyStop: function(e, opt) {
            if (!opt.isInput) {
                e.preventDefault();
            }
            
            e.stopPropagation();
        },
        key: function(e) {

            var opt = {};

            // Only get the data from $currentTrigger if it exists
            if ($currentTrigger) {
                opt = $currentTrigger.data('contextMenu') || {};
            }

            switch (e.keyCode) {
                case 9:
                case 38: // up
                    handle.keyStop(e, opt);
                    // if keyCode is [38 (up)] or [9 (tab) with shift]
                    if (opt.isInput) {
                        if (e.keyCode == 9 && e.shiftKey) {
                            e.preventDefault();
                            opt.$selected && opt.$selected.find('input, textarea, select').blur();
                            opt.$menu.trigger('prevcommand');
                            return;
                        } else if (e.keyCode == 38 && opt.$selected.find('input, textarea, select').prop('type') == 'checkbox') {
                            // checkboxes don't capture this key
                            e.preventDefault();
                            return;
                        }
                    } else if (e.keyCode != 9 || e.shiftKey) {
                        opt.$menu.trigger('prevcommand');
                        return;
                    }
                    // omitting break;
                    
                // case 9: // tab - reached through omitted break;
                case 40: // down
                    handle.keyStop(e, opt);
                    if (opt.isInput) {
                        if (e.keyCode == 9) {
                            e.preventDefault();
                            opt.$selected && opt.$selected.find('input, textarea, select').blur();
                            opt.$menu.trigger('nextcommand');
                            return;
                        } else if (e.keyCode == 40 && opt.$selected.find('input, textarea, select').prop('type') == 'checkbox') {
                            // checkboxes don't capture this key
                            e.preventDefault();
                            return;
                        }
                    } else {
                        opt.$menu.trigger('nextcommand');
                        return;
                    }
                    break;
                
                case 37: // left
                    handle.keyStop(e, opt);
                    if (opt.isInput || !opt.$selected || !opt.$selected.length) {
                        break;
                    }
                
                    if (!opt.$selected.parent().hasClass('context-menu-root')) {
                        var $parent = opt.$selected.parent().parent();
                        opt.$selected.trigger('contextmenu:blur');
                        opt.$selected = $parent;
                        return;
                    }
                    break;
                    
                case 39: // right
                    handle.keyStop(e, opt);
                    if (opt.isInput || !opt.$selected || !opt.$selected.length) {
                        break;
                    }
                    
                    var itemdata = opt.$selected.data('contextMenu') || {};
                    if (itemdata.$menu && opt.$selected.hasClass('context-menu-submenu')) {
                        opt.$selected = null;
                        itemdata.$selected = null;
                        itemdata.$menu.trigger('nextcommand');
                        return;
                    }
                    break;
                
                case 35: // end
                case 36: // home
                    if (opt.$selected && opt.$selected.find('input, textarea, select').length) {
                        return;
                    } else {
                        (opt.$selected && opt.$selected.parent() || opt.$menu)
                            .children(':not(.disabled, .not-selectable)')[e.keyCode == 36 ? 'first' : 'last']()
                            .trigger('contextmenu:focus');
                        e.preventDefault();
                        return;
                    }
                    break;
                    
                case 13: // enter
                    handle.keyStop(e, opt);
                    if (opt.isInput) {
                        if (opt.$selected && !opt.$selected.is('textarea, select')) {
                            e.preventDefault();
                            return;
                        }
                        break;
                    }
                    opt.$selected && opt.$selected.trigger('mouseup');
                    return;
                    
                case 32: // space
                case 33: // page up
                case 34: // page down
                    // prevent browser from scrolling down while menu is visible
                    handle.keyStop(e, opt);
                    return;
                    
                case 27: // esc
                    handle.keyStop(e, opt);
                    opt.$menu.trigger('contextmenu:hide');
                    return;
                    
                default: // 0-9, a-z
                    var k = (String.fromCharCode(e.keyCode)).toUpperCase();
                    if (opt.accesskeys && opt.accesskeys[k]) {
                        // according to the specs accesskeys must be invoked immediately
                        opt.accesskeys[k].$node.trigger(opt.accesskeys[k].$menu
                            ? 'contextmenu:focus'
                            : 'mouseup'
                        );
                        return;
                    }
                    break;
            }
            // pass event to selected item, 
            // stop propagation to avoid endless recursion
            e.stopPropagation();
            opt.$selected && opt.$selected.trigger(e);
        },

        // select previous possible command in menu
        prevItem: function(e) {
            e.stopPropagation();
            var opt = $(this).data('contextMenu') || {};

            // obtain currently selected menu
            if (opt.$selected) {
                var $s = opt.$selected;
                opt = opt.$selected.parent().data('contextMenu') || {};
                opt.$selected = $s;
            }
            
            var $children = opt.$menu.children(),
                $prev = !opt.$selected || !opt.$selected.prev().length ? $children.last() : opt.$selected.prev(),
                $round = $prev;
            
            // skip disabled
            while ($prev.hasClass('disabled') || $prev.hasClass('not-selectable')) {
                if ($prev.prev().length) {
                    $prev = $prev.prev();
                } else {
                    $prev = $children.last();
                }
                if ($prev.is($round)) {
                    // break endless loop
                    return;
                }
            }
            
            // leave current
            if (opt.$selected) {
                handle.itemMouseleave.call(opt.$selected.get(0), e);
            }
            
            // activate next
            handle.itemMouseenter.call($prev.get(0), e);
            
            // focus input
            var $input = $prev.find('input, textarea, select');
            if ($input.length) {
                $input.focus();
            }
        },
        // select next possible command in menu
        nextItem: function(e) {
            e.stopPropagation();
            var opt = $(this).data('contextMenu') || {};

            // obtain currently selected menu
            if (opt.$selected) {
                var $s = opt.$selected;
                opt = opt.$selected.parent().data('contextMenu') || {};
                opt.$selected = $s;
            }

            var $children = opt.$menu.children(),
                $next = !opt.$selected || !opt.$selected.next().length ? $children.first() : opt.$selected.next(),
                $round = $next;

            // skip disabled
            while ($next.hasClass('disabled') || $next.hasClass('not-selectable')) {
                if ($next.next().length) {
                    $next = $next.next();
                } else {
                    $next = $children.first();
                }
                if ($next.is($round)) {
                    // break endless loop
                    return;
                }
            }
            
            // leave current
            if (opt.$selected) {
                handle.itemMouseleave.call(opt.$selected.get(0), e);
            }
            
            // activate next
            handle.itemMouseenter.call($next.get(0), e);
            
            // focus input
            var $input = $next.find('input, textarea, select');
            if ($input.length) {
                $input.focus();
            }
        },
        
        // flag that we're inside an input so the key handler can act accordingly
        focusInput: function(e) {
            var $this = $(this).closest('.context-menu-item'),
                data = $this.data(),
                opt = data.contextMenu,
                root = data.contextMenuRoot;

            root.$selected = opt.$selected = $this;
            root.isInput = opt.isInput = true;
        },
        // flag that we're inside an input so the key handler can act accordingly
        blurInput: function(e) {
            var $this = $(this).closest('.context-menu-item'),
                data = $this.data(),
                opt = data.contextMenu,
                root = data.contextMenuRoot;

            root.isInput = opt.isInput = false;
        },
        
        // :hover on menu
        menuMouseenter: function(e) {
            var root = $(this).data().contextMenuRoot;
            root.hovering = true;
        },
        // :hover on menu
        menuMouseleave: function(e) {
            var root = $(this).data().contextMenuRoot;
            if (root.$layer && root.$layer.is(e.relatedTarget)) {
                root.hovering = false;
            }
        },
        
        // :hover done manually so key handling is possible
        itemMouseenter: function(e) {
            var $this = $(this),
                data = $this.data(),
                opt = data.contextMenu,
                root = data.contextMenuRoot;
            
            root.hovering = true;

            // abort if we're re-entering
            if (e && root.$layer && root.$layer.is(e.relatedTarget)) {
                e.preventDefault();
                e.stopImmediatePropagation();
            }

            // make sure only one item is selected
            (opt.$menu ? opt : root).$menu
                .children('.hover').trigger('contextmenu:blur');

            if ($this.hasClass('disabled') || $this.hasClass('not-selectable')) {
                opt.$selected = null;
                return;
            }
            
            $this.trigger('contextmenu:focus');
        },
        // :hover done manually so key handling is possible
        itemMouseleave: function(e) {
            var $this = $(this),
                data = $this.data(),
                opt = data.contextMenu,
                root = data.contextMenuRoot;

            if (root !== opt && root.$layer && root.$layer.is(e.relatedTarget)) {
                root.$selected && root.$selected.trigger('contextmenu:blur');
                e.preventDefault();
                e.stopImmediatePropagation();
                root.$selected = opt.$selected = opt.$node;
                return;
            }
            
            $this.trigger('contextmenu:blur');
        },
        // contextMenu item click
        itemClick: function(e) {
            var $this = $(this),
                data = $this.data(),
                opt = data.contextMenu,
                root = data.contextMenuRoot,
                key = data.contextMenuKey,
                callback;

            // abort if the key is unknown or disabled or is a menu
            if (!opt.items[key] || $this.is('.disabled, .context-menu-submenu, .context-menu-separator, .not-selectable')) {
                return;
            }

            e.preventDefault();
            e.stopImmediatePropagation();

            if ($.isFunction(root.callbacks[key]) && Object.prototype.hasOwnProperty.call(root.callbacks, key)) {
                // item-specific callback
                callback = root.callbacks[key];
            } else if ($.isFunction(root.callback)) {
                // default callback
                callback = root.callback;                
            } else {
                // no callback, no action
                return;
            }

            // hide menu if callback doesn't stop that
            if (callback.call(root.$trigger, key, root) !== false) {
                root.$menu.trigger('contextmenu:hide');
            } else if (root.$menu.parent().length) {
                op.update.call(root.$trigger, root);
            }
        },
        // ignore click events on input elements
        inputClick: function(e) {
            e.stopImmediatePropagation();
        },
        
        // hide <menu>
        hideMenu: function(e, data) {
            var root = $(this).data('contextMenuRoot');
            op.hide.call(root.$trigger, root, data && data.force);
        },
        // focus <command>
        focusItem: function(e) {
            e.stopPropagation();
            var $this = $(this),
                data = $this.data(),
                opt = data.contextMenu,
                root = data.contextMenuRoot;

            $this.addClass('hover')
                .siblings('.hover').trigger('contextmenu:blur');
            
            // remember selected
            opt.$selected = root.$selected = $this;
            
            // position sub-menu - do after show so dumb $.ui.position can keep up
            if (opt.$node) {
                root.positionSubmenu.call(opt.$node, opt.$menu);
            }
        },
        // blur <command>
        blurItem: function(e) {
            e.stopPropagation();
            var $this = $(this),
                data = $this.data(),
                opt = data.contextMenu;
            
            $this.removeClass('hover');
            opt.$selected = null;
        }
    },
    // operations
    op = {
        show: function(opt, x, y) {
            var $trigger = $(this),
                css = {};

            // hide any open menus
            $('#context-menu-layer').trigger('mousedown');

            // backreference for callbacks
            opt.$trigger = $trigger;

            // show event
            if (opt.events.show.call($trigger, opt) === false) {
                $currentTrigger = null;
                return;
            }

            // create or update context menu
            op.update.call($trigger, opt);
            
            // position menu
            opt.position.call($trigger, opt, x, y);

            // make sure we're in front
            if (opt.zIndex) {
                css.zIndex = zindex($trigger) + opt.zIndex;
            }
            
            // add layer
            op.layer.call(opt.$menu, opt, css.zIndex);
            
            // adjust sub-menu zIndexes
            opt.$menu.find('ul').css('zIndex', css.zIndex + 1);
            
            // position and show context menu
            opt.$menu.css( css )[opt.animation.show](opt.animation.duration, function() {
                $trigger.trigger('contextmenu:visible');
            });
            // make options available and set state
            $trigger
                .data('contextMenu', opt)
                .addClass("context-menu-active");
            
            // register key handler
            $(document).off('keydown.contextMenu').on('keydown.contextMenu', handle.key);
            // register autoHide handler
            if (opt.autoHide) {
                // mouse position handler
                $(document).on('mousemove.contextMenuAutoHide', function(e) {
                    // need to capture the offset on mousemove,
                    // since the page might've been scrolled since activation
                    var pos = $trigger.offset();
                    pos.right = pos.left + $trigger.outerWidth();
                    pos.bottom = pos.top + $trigger.outerHeight();
                    
                    if (opt.$layer && !opt.hovering && (!(e.pageX >= pos.left && e.pageX <= pos.right) || !(e.pageY >= pos.top && e.pageY <= pos.bottom))) {
                        // if mouse in menu...
                        opt.$menu.trigger('contextmenu:hide');
                    }
                });
            }
        },
        hide: function(opt, force) {
            var $trigger = $(this);
            if (!opt) {
                opt = $trigger.data('contextMenu') || {};
            }
            
            // hide event
            if (!force && opt.events && opt.events.hide.call($trigger, opt) === false) {
                return;
            }
            
            // remove options and revert state
            $trigger
                .removeData('contextMenu')
                .removeClass("context-menu-active");
            
            if (opt.$layer) {
                // keep layer for a bit so the contextmenu event can be aborted properly by opera
                setTimeout((function($layer) {
                    return function(){
                        $layer.remove();
                    };
                })(opt.$layer), 10);
                
                try {
                    delete opt.$layer;
                } catch(e) {
                    opt.$layer = null;
                }
            }
            
            // remove handle
            $currentTrigger = null;
            // remove selected
            opt.$menu.find('.hover').trigger('contextmenu:blur');
            opt.$selected = null;
            // unregister key and mouse handlers
            //$(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705
            $(document).off('.contextMenuAutoHide').off('keydown.contextMenu');
            // hide menu
            opt.$menu && opt.$menu[opt.animation.hide](opt.animation.duration, function (){
                // tear down dynamically built menu after animation is completed.
                if (opt.build) {
                    opt.$menu.remove();
                    $.each(opt, function(key, value) {
                        switch (key) {
                            case 'ns':
                            case 'selector':
                            case 'build':
                            case 'trigger':
                                return true;

                            default:
                                opt[key] = undefined;
                                try {
                                    delete opt[key];
                                } catch (e) {}
                                return true;
                        }
                    });
                }
                
                setTimeout(function() {
                    $trigger.trigger('contextmenu:hidden');
                }, 10);
            });
        },
        create: function(opt, root) {
            if (root === undefined) {
                root = opt;
            }
            // create contextMenu
            opt.$menu = $('<ul class="context-menu-list"></ul>').addClass(opt.className || "").data({
                'contextMenu': opt,
                'contextMenuRoot': root
            });
            
            $.each(['callbacks', 'commands', 'inputs'], function(i,k){
                opt[k] = {};
                if (!root[k]) {
                    root[k] = {};
                }
            });
            
            root.accesskeys || (root.accesskeys = {});
            
            // create contextMenu items
            $.each(opt.items, function(key, item){
                var $t = $('<li class="context-menu-item"></li>').addClass(item.className || ""),
                    $label = null,
                    $input = null;
                
                // iOS needs to see a click-event bound to an element to actually
                // have the TouchEvents infrastructure trigger the click event
                $t.on('click', $.noop);
                
                item.$node = $t.data({
                    'contextMenu': opt,
                    'contextMenuRoot': root,
                    'contextMenuKey': key
                });
                
                // register accesskey
                // NOTE: the accesskey attribute should be applicable to any element, but Safari5 and Chrome13 still can't do that
                if (item.accesskey) {
                    var aks = splitAccesskey(item.accesskey);
                    for (var i=0, ak; ak = aks[i]; i++) {
                        if (!root.accesskeys[ak]) {
                            root.accesskeys[ak] = item;
                            item._name = item.name.replace(new RegExp('(' + ak + ')', 'i'), '<span class="context-menu-accesskey">$1</span>');
                            break;
                        }
                    }
                }
                
                if (typeof item == "string") {
                    $t.addClass('context-menu-separator not-selectable');
                } else if (item.type && types[item.type]) {
                    // run custom type handler
                    types[item.type].call($t, item, opt, root);
                    // register commands
                    $.each([opt, root], function(i,k){
                        k.commands[key] = item;
                        if ($.isFunction(item.callback)) {
                            k.callbacks[key] = item.callback;
                        }
                    });
                } else {
                    // add label for input
                    if (item.type == 'html') {
                        $t.addClass('context-menu-html not-selectable');
                    } else if (item.type) {
                        $label = $('<label></label>').appendTo($t);
                        $('<span></span>').text(item._name || item.name).appendTo($label);
                        $t.addClass('context-menu-input');
                        opt.hasTypes = true;
                        $.each([opt, root], function(i,k){
                            k.commands[key] = item;
                            k.inputs[key] = item;
                        });
                    } else if (item.items) {
                        item.type = 'sub';
                    }
                
                    switch (item.type) {
                        case 'text':
                            $input = $('<input type="text" value="1" name="" value="">')
                                .attr('name', 'context-menu-input-' + key)
                                .val(item.value || "")
                                .appendTo($label);
                            break;
                    
                        case 'textarea':
                            $input = $('<textarea name=""></textarea>')
                                .attr('name', 'context-menu-input-' + key)
                                .val(item.value || "")
                                .appendTo($label);

                            if (item.height) {
                                $input.height(item.height);
                            }
                            break;

                        case 'checkbox':
                            $input = $('<input type="checkbox" value="1" name="" value="">')
                                .attr('name', 'context-menu-input-' + key)
                                .val(item.value || "")
                                .prop("checked", !!item.selected)
                                .prependTo($label);
                            break;

                        case 'radio':
                            $input = $('<input type="radio" value="1" name="" value="">')
                                .attr('name', 'context-menu-input-' + item.radio)
                                .val(item.value || "")
                                .prop("checked", !!item.selected)
                                .prependTo($label);
                            break;
                    
                        case 'select':
                            $input = $('<select name="">')
                                .attr('name', 'context-menu-input-' + key)
                                .appendTo($label);
                            if (item.options) {
                                $.each(item.options, function(value, text) {
                                    $('<option></option>').val(value).text(text).appendTo($input);
                                });
                                $input.val(item.selected);
                            }
                            break;
                        
                        case 'sub':
                            $('<span></span>').text(item._name || item.name).appendTo($t);
                            item.appendTo = item.$node;
                            op.create(item, root);
                            $t.data('contextMenu', item).addClass('context-menu-submenu');
                            item.callback = null;
                            break;
                        
                        case 'html':
                            $(item.html).appendTo($t);
                            break;
                        
                        default:
                            $.each([opt, root], function(i,k){
                                k.commands[key] = item;
                                if ($.isFunction(item.callback)) {
                                    k.callbacks[key] = item.callback;
                                }
                            });
                            $('<span></span>').text(item._name || item.name || "").appendTo($t);
                            break;
                    }
                    
                    // disable key listener in <input>
                    if (item.type && item.type != 'sub' && item.type != 'html') {
                        $input
                            .on('focus', handle.focusInput)
                            .on('blur', handle.blurInput);
                        
                        if (item.events) {
                            $input.on(item.events, opt);
                        }
                    }
                
                    // add icons
                    if (item.icon) {
                        $t.addClass("icon icon-" + item.icon);
                    }
                }
                
                // cache contained elements
                item.$input = $input;
                item.$label = $label;

                // attach item to menu
                $t.appendTo(opt.$menu);
                
                // Disable text selection
                if (!opt.hasTypes && $.support.eventSelectstart) {
                    // browsers support user-select: none, 
                    // IE has a special event for text-selection
                    // browsers supporting neither will not be preventing text-selection
                    $t.on('selectstart.disableTextSelect', handle.abortevent);
                }
            });
            // attach contextMenu to <body> (to bypass any possible overflow:hidden issues on parents of the trigger element)
            if (!opt.$node) {
                opt.$menu.css('display', 'none').addClass('context-menu-root');
            }
            opt.$menu.appendTo(opt.appendTo || document.body);
        },
        resize: function($menu, nested) {
            // determine widths of submenus, as CSS won't grow them automatically
            // position:absolute within position:absolute; min-width:100; max-width:200; results in width: 100;
            // kinda sucks hard...

            // determine width of absolutely positioned element
            $menu.css({position: 'absolute', display: 'block'});
            // don't apply yet, because that would break nested elements' widths
            // add a pixel to circumvent word-break issue in IE9 - #80
            $menu.data('width', Math.ceil($menu.width()) + 1);
            // reset styles so they allow nested elements to grow/shrink naturally
            $menu.css({
                position: 'static',
                minWidth: '0px',
                maxWidth: '100000px'
            });
            // identify width of nested menus
            $menu.find('> li > ul').each(function() {
                op.resize($(this), true);
            });
            // reset and apply changes in the end because nested
            // elements' widths wouldn't be calculatable otherwise
            if (!nested) {
                $menu.find('ul').addBack().css({
                    position: '', 
                    display: '',
                    minWidth: '',
                    maxWidth: ''
                }).width(function() {
                    return $(this).data('width');
                });
            }
        },
        update: function(opt, root) {
            var $trigger = this;
            if (root === undefined) {
                root = opt;
                op.resize(opt.$menu);
            }
            // re-check disabled for each item
            opt.$menu.children().each(function(){
                var $item = $(this),
                    key = $item.data('contextMenuKey'),
                    item = opt.items[key],
                    disabled = ($.isFunction(item.disabled) && item.disabled.call($trigger, key, root)) || item.disabled === true;

                // dis- / enable item
                $item[disabled ? 'addClass' : 'removeClass']('disabled');
                
                if (item.type) {
                    // dis- / enable input elements
                    $item.find('input, select, textarea').prop('disabled', disabled);
                    
                    // update input states
                    switch (item.type) {
                        case 'text':
                        case 'textarea':
                            item.$input.val(item.value || "");
                            break;
                            
                        case 'checkbox':
                        case 'radio':
                            item.$input.val(item.value || "").prop('checked', !!item.selected);
                            break;
                            
                        case 'select':
                            item.$input.val(item.selected || "");
                            break;
                    }
                }
                
                if (item.$menu) {
                    // update sub-menu
                    op.update.call($trigger, item, root);
                }
            });
        },
        layer: function(opt, zIndex) {
            // add transparent layer for click area
            // filter and background for Internet Explorer, Issue #23
            var $layer = opt.$layer = $('<div id="context-menu-layer" style="position:fixed; z-index:' + zIndex + '; top:0; left:0; opacity: 0; filter: alpha(opacity=0); background-color: #000;"></div>')
                .css({height: $win.height(), width: $win.width(), display: 'block'})
                .data('contextMenuRoot', opt)
                .insertBefore(this)
                .on('contextmenu', handle.abortevent)
                .on('mousedown', handle.layerClick);
            
            // IE6 doesn't know position:fixed;
            if (document.body.style.maxWidth === undefined) {//IE6 doesn't support maxWidth
                $layer.css({
                    'position' : 'absolute',
                    'height' : $(document).height()
                });
            }
            
            return $layer;
        }
    };

// split accesskey according to http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#assigned-access-key
function splitAccesskey(val) {
    var t = val.split(/\s+/),
        keys = [];
        
    for (var i=0, k; k = t[i]; i++) {
        k = k.charAt(0).toUpperCase(); // first character only
        // theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw it.
        // a map to look up already used access keys would be nice
        keys.push(k);
    }
    
    return keys;
}

// handle contextMenu triggers
$.fn.contextMenu = function(operation) {
    if (operation === undefined) {
        this.first().trigger('contextmenu');
    } else if (operation.x && operation.y) {
        this.first().trigger($.Event("contextmenu", {pageX: operation.x, pageY: operation.y}));
    } else if (operation === "hide") {
        var $menu = this.first().data('contextMenu') ? this.first().data('contextMenu').$menu : null;
        $menu && $menu.trigger('contextmenu:hide');
    } else if (operation === "destroy") {
        $.contextMenu("destroy", {context: this});
    } else if ($.isPlainObject(operation)) {
        operation.context = this;
        $.contextMenu("create", operation);
    } else if (operation) {
        this.removeClass('context-menu-disabled');
    } else if (!operation) {
        this.addClass('context-menu-disabled');
    }
    
    return this;
};

// manage contextMenu instances
$.contextMenu = function(operation, options) {
    if (typeof operation != 'string') {
        options = operation;
        operation = 'create';
    }
    
    if (typeof options == 'string') {
        options = {selector: options};
    } else if (options === undefined) {
        options = {};
    }
    
    // merge with default options
    var o = $.extend(true, {}, defaults, options || {});
    var $document = $(document);
    var $context = $document;
    var _hasContext = false;
    
    if (!o.context || !o.context.length) {
        o.context = document;
    } else {
        // you never know what they throw at you...
        $context = $(o.context).first();
        o.context = $context.get(0);
        _hasContext = o.context !== document;
    }
    
    switch (operation) {
        case 'create':
            // no selector no joy
            if (!o.selector) {
                throw new Error('No selector specified');
            }
            // make sure internal classes are not bound to
            if (o.selector.match(/.context-menu-(list|item|input)($|\s)/)) {
                throw new Error('Cannot bind to selector "' + o.selector + '" as it contains a reserved className');
            }
            if (!o.build && (!o.items || $.isEmptyObject(o.items))) {
                throw new Error('No Items specified');
            }
            counter ++;
            o.ns = '.contextMenu' + counter;
            if (!_hasContext) {
                namespaces[o.selector] = o.ns;
            }
            menus[o.ns] = o;
            
            // default to right click
            if (!o.trigger) {
                o.trigger = 'right';
            }
            
            if (!initialized) {
                // make sure item click is registered first
                $document
                    .on({
                        'contextmenu:hide.contextMenu': handle.hideMenu,
                        'prevcommand.contextMenu': handle.prevItem,
                        'nextcommand.contextMenu': handle.nextItem,
                        'contextmenu.contextMenu': handle.abortevent,
                        'mouseenter.contextMenu': handle.menuMouseenter,
                        'mouseleave.contextMenu': handle.menuMouseleave
                    }, '.context-menu-list')
                    .on('mouseup.contextMenu', '.context-menu-input', handle.inputClick)
                    .on({
                        'mouseup.contextMenu': handle.itemClick,
                        'contextmenu:focus.contextMenu': handle.focusItem,
                        'contextmenu:blur.contextMenu': handle.blurItem,
                        'contextmenu.contextMenu': handle.abortevent,
                        'mouseenter.contextMenu': handle.itemMouseenter,
                        'mouseleave.contextMenu': handle.itemMouseleave
                    }, '.context-menu-item');

                initialized = true;
            }
            
            // engage native contextmenu event
            $context
                .on('contextmenu' + o.ns, o.selector, o, handle.contextmenu);
            
            if (_hasContext) {
                // add remove hook, just in case
                $context.on('remove' + o.ns, function() {
                    $(this).contextMenu("destroy");
                });
            }
            
            switch (o.trigger) {
                case 'hover':
                        $context
                            .on('mouseenter' + o.ns, o.selector, o, handle.mouseenter)
                            .on('mouseleave' + o.ns, o.selector, o, handle.mouseleave);                    
                    break;
                    
                case 'left':
                        $context.on('click' + o.ns, o.selector, o, handle.click);
                    break;
                /*
                default:
                    // http://www.quirksmode.org/dom/events/contextmenu.html
                    $document
                        .on('mousedown' + o.ns, o.selector, o, handle.mousedown)
                        .on('mouseup' + o.ns, o.selector, o, handle.mouseup);
                    break;
                */
            }
            
            // create menu
            if (!o.build) {
                op.create(o);
            }
            break;
        
        case 'destroy':
            var $visibleMenu;
            if (_hasContext) {
                // get proper options 
                var context = o.context;
                $.each(menus, function(ns, o) {
                    if (o.context !== context) {
                        return true;
                    }
                    
                    $visibleMenu = $('.context-menu-list').filter(':visible');
                    if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is($(o.context).find(o.selector))) {
                        $visibleMenu.trigger('contextmenu:hide', {force: true});
                    }

                    try {
                        if (menus[o.ns].$menu) {
                            menus[o.ns].$menu.remove();
                        }

                        delete menus[o.ns];
                    } catch(e) {
                        menus[o.ns] = null;
                    }

                    $(o.context).off(o.ns);
                    
                    return true;
                });
            } else if (!o.selector) {
                $document.off('.contextMenu .contextMenuAutoHide');
                $.each(menus, function(ns, o) {
                    $(o.context).off(o.ns);
                });
                
                namespaces = {};
                menus = {};
                counter = 0;
                initialized = false;
                
                $('#context-menu-layer, .context-menu-list').remove();
            } else if (namespaces[o.selector]) {
                $visibleMenu = $('.context-menu-list').filter(':visible');
                if ($visibleMenu.length && $visibleMenu.data().contextMenuRoot.$trigger.is(o.selector)) {
                    $visibleMenu.trigger('contextmenu:hide', {force: true});
                }
                
                try {
                    if (menus[namespaces[o.selector]].$menu) {
                        menus[namespaces[o.selector]].$menu.remove();
                    }
                    
                    delete menus[namespaces[o.selector]];
                } catch(e) {
                    menus[namespaces[o.selector]] = null;
                }
                
                $document.off(namespaces[o.selector]);
            }
            break;
        
        case 'html5':
            // if <command> or <menuitem> are not handled by the browser,
            // or options was a bool true,
            // initialize $.contextMenu for them
            if ((!$.support.htmlCommand && !$.support.htmlMenuitem) || (typeof options == "boolean" && options)) {
                $('menu[type="context"]').each(function() {
                    if (this.id) {
                        $.contextMenu({
                            selector: '[contextmenu=' + this.id +']',
                            items: $.contextMenu.fromMenu(this)
                        });
                    }
                }).css('display', 'none');
            }
            break;
        
        default:
            throw new Error('Unknown operation "' + operation + '"');
    }
    
    return this;
};

// import values into <input> commands
$.contextMenu.setInputValues = function(opt, data) {
    if (data === undefined) {
        data = {};
    }
    
    $.each(opt.inputs, function(key, item) {
        switch (item.type) {
            case 'text':
            case 'textarea':
                item.value = data[key] || "";
                break;

            case 'checkbox':
                item.selected = data[key] ? true : false;
                break;
                
            case 'radio':
                item.selected = (data[item.radio] || "") == item.value ? true : false;
                break;
            
            case 'select':
                item.selected = data[key] || "";
                break;
        }
    });
};

// export values from <input> commands
$.contextMenu.getInputValues = function(opt, data) {
    if (data === undefined) {
        data = {};
    }
    
    $.each(opt.inputs, function(key, item) {
        switch (item.type) {
            case 'text':
            case 'textarea':
            case 'select':
                data[key] = item.$input.val();
                break;

            case 'checkbox':
                data[key] = item.$input.prop('checked');
                break;
                
            case 'radio':
                if (item.$input.prop('checked')) {
                    data[item.radio] = item.value;
                }
                break;
        }
    });
    
    return data;
};

// find <label for="xyz">
function inputLabel(node) {
    return (node.id && $('label[for="'+ node.id +'"]').val()) || node.name;
}

// convert <menu> to items object
function menuChildren(items, $children, counter) {
    if (!counter) {
        counter = 0;
    }
    
    $children.each(function() {
        var $node = $(this),
            node = this,
            nodeName = this.nodeName.toLowerCase(),
            label,
            item;
        
        // extract <label><input>
        if (nodeName == 'label' && $node.find('input, textarea, select').length) {
            label = $node.text();
            $node = $node.children().first();
            node = $node.get(0);
            nodeName = node.nodeName.toLowerCase();
        }
        
        /*
         * <menu> accepts flow-content as children. that means <embed>, <canvas> and such are valid menu items.
         * Not being the sadistic kind, $.contextMenu only accepts:
         * <command>, <menuitem>, <hr>, <span>, <p> <input [text, radio, checkbox]>, <textarea>, <select> and of course <menu>.
         * Everything else will be imported as an html node, which is not interfaced with contextMenu.
         */
        
        // http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#concept-command
        switch (nodeName) {
            // http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#the-menu-element
            case 'menu':
                item = {name: $node.attr('label'), items: {}};
                counter = menuChildren(item.items, $node.children(), counter);
                break;
            
            // http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-a-element-to-define-a-command
            case 'a':
            // http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-button-element-to-define-a-command
            case 'button':
                item = {
                    name: $node.text(),
                    disabled: !!$node.attr('disabled'),
                    callback: (function(){ return function(){ $node.click(); }; })()
                };
                break;
            
            // http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#using-the-command-element-to-define-a-command

            case 'menuitem':
            case 'command':
                switch ($node.attr('type')) {
                    case undefined:
                    case 'command':
                    case 'menuitem':
                        item = {
                            name: $node.attr('label'),
                            disabled: !!$node.attr('disabled'),
                            callback: (function(){ return function(){ $node.click(); }; })()
                        };
                        break;
                        
                    case 'checkbox':
                        item = {
                            type: 'checkbox',
                            disabled: !!$node.attr('disabled'),
                            name: $node.attr('label'),
                            selected: !!$node.attr('checked')
                        };
                        break;
                        
                    case 'radio':
                        item = {
                            type: 'radio',
                            disabled: !!$node.attr('disabled'),
                            name: $node.attr('label'),
                            radio: $node.attr('radiogroup'),
                            value: $node.attr('id'),
                            selected: !!$node.attr('checked')
                        };
                        break;
                        
                    default:
                        item = undefined;
                }
                break;
 
            case 'hr':
                item = '-------';
                break;
                
            case 'input':
                switch ($node.attr('type')) {
                    case 'text':
                        item = {
                            type: 'text',
                            name: label || inputLabel(node),
                            disabled: !!$node.attr('disabled'),
                            value: $node.val()
                        };
                        break;
                        
                    case 'checkbox':
                        item = {
                            type: 'checkbox',
                            name: label || inputLabel(node),
                            disabled: !!$node.attr('disabled'),
                            selected: !!$node.attr('checked')
                        };
                        break;
                        
                    case 'radio':
                        item = {
                            type: 'radio',
                            name: label || inputLabel(node),
                            disabled: !!$node.attr('disabled'),
                            radio: !!$node.attr('name'),
                            value: $node.val(),
                            selected: !!$node.attr('checked')
                        };
                        break;
                    
                    default:
                        item = undefined;
                        break;
                }
                break;
                
            case 'select':
                item = {
                    type: 'select',
                    name: label || inputLabel(node),
                    disabled: !!$node.attr('disabled'),
                    selected: $node.val(),
                    options: {}
                };
                $node.children().each(function(){
                    item.options[this.value] = $(this).text();
                });
                break;
                
            case 'textarea':
                item = {
                    type: 'textarea',
                    name: label || inputLabel(node),
                    disabled: !!$node.attr('disabled'),
                    value: $node.val()
                };
                break;
            
            case 'label':
                break;
            
            default:
                item = {type: 'html', html: $node.clone(true)};
                break;
        }
        
        if (item) {
            counter++;
            items['key' + counter] = item;
        }
    });
    
    return counter;
}

// convert html5 menu
$.contextMenu.fromMenu = function(element) {
    var $this = $(element),
        items = {};
        
    menuChildren(items, $this.children());
    
    return items;
};

// make defaults accessible
$.contextMenu.defaults = defaults;
$.contextMenu.types = types;
// export internal functions - undocumented, for hacking only!
$.contextMenu.handle = handle;
$.contextMenu.op = op;
$.contextMenu.menus = menus;

})(jQuery);

});

define('select2', function (require, exports, module) {
/*!
 * Select2 4.0.13
 * https://select2.github.io
 *
 * Released under the MIT license
 * https://github.com/select2/select2/blob/master/LICENSE.md
 */
;(function (factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['jquery'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // Node/CommonJS
    module.exports = function (root, jQuery) {
      if (jQuery === undefined) {
        // require('jQuery') returns a factory that requires window to
        // build a jQuery instance, we normalize how we use modules
        // that require this pattern but the window provided is a noop
        // if it's defined (how jquery works)
        if (typeof window !== 'undefined') {
          jQuery = require('jquery');
        }
        else {
          jQuery = require('jquery')(root);
        }
      }
      factory(jQuery);
      return jQuery;
    };
  } else {
    // Browser globals
    factory(jQuery);
  }
} (function (jQuery) {
  // This is needed so we can catch the AMD loader configuration and use it
  // The inner file should be wrapped (by `banner.start.js`) in a function that
  // returns the AMD loader references.
  var S2 =(function () {
  // Restore the Select2 AMD loader so it can be used
  // Needed mostly in the language files, where the loader is not inserted
  if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
    var S2 = jQuery.fn.select2.amd;
  }
var S2;(function () { if (!S2 || !S2.requirejs) {
if (!S2) { S2 = {}; } else { require = S2; }
/**
 * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
 * Released under MIT license, http://github.com/requirejs/almond/LICENSE
 */
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
/*global setTimeout: false */

var requirejs, require, define;
(function (undef) {
    var main, req, makeMap, handlers,
        defined = {},
        waiting = {},
        config = {},
        defining = {},
        hasOwn = Object.prototype.hasOwnProperty,
        aps = [].slice,
        jsSuffixRegExp = /\.js$/;

    function hasProp(obj, prop) {
        return hasOwn.call(obj, prop);
    }

    /**
     * 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.
     * @returns {String} normalized name
     */
    function normalize(name, baseName) {
        var nameParts, nameSegment, mapValue, foundMap, lastIndex,
            foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
            baseParts = baseName && baseName.split("/"),
            map = config.map,
            starMap = (map && map['*']) || {};

        //Adjust any relative paths.
        if (name) {
            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);
            }

            //start trimDots
            for (i = 0; i < name.length; i++) {
                part = name[i];
                if (part === '.') {
                    name.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 && name[2] === '..') || name[i - 1] === '..') {
                        continue;
                    } else if (i > 0) {
                        name.splice(i - 1, 2);
                        i -= 2;
                    }
                }
            }
            //end trimDots

            name = name.join('/');
        }

        //Apply map config if available.
        if ((baseParts || starMap) && map) {
            nameParts = name.split('/');

            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 = map[baseParts.slice(0, j).join('/')];

                        //baseName segment has  config, find if it has one for
                        //this name.
                        if (mapValue) {
                            mapValue = mapValue[nameSegment];
                            if (mapValue) {
                                //Match, update name to the new value.
                                foundMap = mapValue;
                                foundI = i;
                                break;
                            }
                        }
                    }
                }

                if (foundMap) {
                    break;
                }

                //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 && starMap[nameSegment]) {
                    foundStarMap = starMap[nameSegment];
                    starI = i;
                }
            }

            if (!foundMap && foundStarMap) {
                foundMap = foundStarMap;
                foundI = starI;
            }

            if (foundMap) {
                nameParts.splice(0, foundI, foundMap);
                name = nameParts.join('/');
            }
        }

        return name;
    }

    function makeRequire(relName, forceSync) {
        return function () {
            //A version of a require function that passes a moduleName
            //value for items that may need to
            //look up paths relative to the moduleName
            var args = aps.call(arguments, 0);

            //If first arg is not require('string'), and there is only
            //one arg, it is the array form without a callback. Insert
            //a null so that the following concat is correct.
            if (typeof args[0] !== 'string' && args.length === 1) {
                args.push(null);
            }
            return req.apply(undef, args.concat([relName, forceSync]));
        };
    }

    function makeNormalize(relName) {
        return function (name) {
            return normalize(name, relName);
        };
    }

    function makeLoad(depName) {
        return function (value) {
            defined[depName] = value;
        };
    }

    function callDep(name) {
        if (hasProp(waiting, name)) {
            var args = waiting[name];
            delete waiting[name];
            defining[name] = true;
            main.apply(undef, args);
        }

        if (!hasProp(defined, name) && !hasProp(defining, name)) {
            throw new Error('No ' + name);
        }
        return defined[name];
    }

    //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 parts array for a relName where first part is plugin ID,
    //second part is resource ID. Assumes relName has already been normalized.
    function makeRelParts(relName) {
        return relName ? splitPrefix(relName) : [];
    }

    /**
     * Makes a name map, normalizing the name, and using a plugin
     * for normalization if necessary. Grabs a ref to plugin
     * too, as an optimization.
     */
    makeMap = function (name, relParts) {
        var plugin,
            parts = splitPrefix(name),
            prefix = parts[0],
            relResourceName = relParts[1];

        name = parts[1];

        if (prefix) {
            prefix = normalize(prefix, relResourceName);
            plugin = callDep(prefix);
        }

        //Normalize according
        if (prefix) {
            if (plugin && plugin.normalize) {
                name = plugin.normalize(name, makeNormalize(relResourceName));
            } else {
                name = normalize(name, relResourceName);
            }
        } else {
            name = normalize(name, relResourceName);
            parts = splitPrefix(name);
            prefix = parts[0];
            name = parts[1];
            if (prefix) {
                plugin = callDep(prefix);
            }
        }

        //Using ridiculous property names for space reasons
        return {
            f: prefix ? prefix + '!' + name : name, //fullName
            n: name,
            pr: prefix,
            p: plugin
        };
    };

    function makeConfig(name) {
        return function () {
            return (config && config.config && config.config[name]) || {};
        };
    }

    handlers = {
        require: function (name) {
            return makeRequire(name);
        },
        exports: function (name) {
            var e = defined[name];
            if (typeof e !== 'undefined') {
                return e;
            } else {
                return (defined[name] = {});
            }
        },
        module: function (name) {
            return {
                id: name,
                uri: '',
                exports: defined[name],
                config: makeConfig(name)
            };
        }
    };

    main = function (name, deps, callback, relName) {
        var cjsModule, depName, ret, map, i, relParts,
            args = [],
            callbackType = typeof callback,
            usingExports;

        //Use name if no relName
        relName = relName || name;
        relParts = makeRelParts(relName);

        //Call the callback to define the module, if necessary.
        if (callbackType === 'undefined' || callbackType === 'function') {
            //Pull out the defined dependencies and pass the ordered
            //values to the callback.
            //Default to [require, exports, module] if no deps
            deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
            for (i = 0; i < deps.length; i += 1) {
                map = makeMap(deps[i], relParts);
                depName = map.f;

                //Fast path CommonJS standard dependencies.
                if (depName === "require") {
                    args[i] = handlers.require(name);
                } else if (depName === "exports") {
                    //CommonJS module spec 1.1
                    args[i] = handlers.exports(name);
                    usingExports = true;
                } else if (depName === "module") {
                    //CommonJS module spec 1.1
                    cjsModule = args[i] = handlers.module(name);
                } else if (hasProp(defined, depName) ||
                           hasProp(waiting, depName) ||
                           hasProp(defining, depName)) {
                    args[i] = callDep(depName);
                } else if (map.p) {
                    map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
                    args[i] = defined[depName];
                } else {
                    throw new Error(name + ' missing ' + depName);
                }
            }

            ret = callback ? callback.apply(defined[name], args) : undefined;

            if (name) {
                //If setting exports via "module" is in play,
                //favor that over return value and exports. After that,
                //favor a non-undefined return value over exports use.
                if (cjsModule && cjsModule.exports !== undef &&
                        cjsModule.exports !== defined[name]) {
                    defined[name] = cjsModule.exports;
                } else if (ret !== undef || !usingExports) {
                    //Use the return value from the function.
                    defined[name] = ret;
                }
            }
        } else if (name) {
            //May just be an object definition for the module. Only
            //worry about defining if have a module name.
            defined[name] = callback;
        }
    };

    requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
        if (typeof deps === "string") {
            if (handlers[deps]) {
                //callback in this case is really relName
                return handlers[deps](callback);
            }
            //Just return the module wanted. In this scenario, the
            //deps arg is the module name, and second arg (if passed)
            //is just the relName.
            //Normalize module name, if it contains . or ..
            return callDep(makeMap(deps, makeRelParts(callback)).f);
        } else if (!deps.splice) {
            //deps is a config object, not an array.
            config = deps;
            if (config.deps) {
                req(config.deps, config.callback);
            }
            if (!callback) {
                return;
            }

            if (callback.splice) {
                //callback is an array, which means it is a dependency list.
                //Adjust args if there are dependencies
                deps = callback;
                callback = relName;
                relName = null;
            } else {
                deps = undef;
            }
        }

        //Support require(['a'])
        callback = callback || function () {};

        //If relName is a function, it is an errback handler,
        //so remove it.
        if (typeof relName === 'function') {
            relName = forceSync;
            forceSync = alt;
        }

        //Simulate async callback;
        if (forceSync) {
            main(undef, deps, callback, relName);
        } else {
            //Using a non-zero value because of concern for what old browsers
            //do, and latest browsers "upgrade" to 4 if lower value is used:
            //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
            //If want a value immediately, use require('id') instead -- something
            //that works in almond on the global level, but not guaranteed and
            //unlikely to work in other AMD implementations.
            setTimeout(function () {
                main(undef, deps, callback, relName);
            }, 4);
        }

        return req;
    };

    /**
     * Just drops the config on the floor, but returns req in case
     * the config return value is used.
     */
    req.config = function (cfg) {
        return req(cfg);
    };

    /**
     * Expose module registry for debugging and tooling
     */
    requirejs._defined = defined;

    define = function (name, deps, callback) {
        if (typeof name !== 'string') {
            throw new Error('See almond README: incorrect module build, no module name');
        }

        //This module may not have dependencies
        if (!deps.splice) {
            //deps is not an array, so probably means
            //an object literal or factory function for
            //the value. Adjust args.
            callback = deps;
            deps = [];
        }

        if (!hasProp(defined, name) && !hasProp(waiting, name)) {
            waiting[name] = [name, deps, callback];
        }
    };

    define.amd = {
        jQuery: true
    };
}());

S2.requirejs = requirejs;S2.require = require;S2.define = define;
}
}());
S2.define("almond", function(){});

/* global jQuery:false, $:false */
S2.define('jquery',[],function () {
  var _$ = jQuery || $;

  if (_$ == null && console && console.error) {
    console.error(
      'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
      'found. Make sure that you are including jQuery before Select2 on your ' +
      'web page.'
    );
  }

  return _$;
});

S2.define('select2/utils',[
  'jquery'
], function ($) {
  var Utils = {};

  Utils.Extend = function (ChildClass, SuperClass) {
    var __hasProp = {}.hasOwnProperty;

    function BaseConstructor () {
      this.constructor = ChildClass;
    }

    for (var key in SuperClass) {
      if (__hasProp.call(SuperClass, key)) {
        ChildClass[key] = SuperClass[key];
      }
    }

    BaseConstructor.prototype = SuperClass.prototype;
    ChildClass.prototype = new BaseConstructor();
    ChildClass.__super__ = SuperClass.prototype;

    return ChildClass;
  };

  function getMethods (theClass) {
    var proto = theClass.prototype;

    var methods = [];

    for (var methodName in proto) {
      var m = proto[methodName];

      if (typeof m !== 'function') {
        continue;
      }

      if (methodName === 'constructor') {
        continue;
      }

      methods.push(methodName);
    }

    return methods;
  }

  Utils.Decorate = function (SuperClass, DecoratorClass) {
    var decoratedMethods = getMethods(DecoratorClass);
    var superMethods = getMethods(SuperClass);

    function DecoratedClass () {
      var unshift = Array.prototype.unshift;

      var argCount = DecoratorClass.prototype.constructor.length;

      var calledConstructor = SuperClass.prototype.constructor;

      if (argCount > 0) {
        unshift.call(arguments, SuperClass.prototype.constructor);

        calledConstructor = DecoratorClass.prototype.constructor;
      }

      calledConstructor.apply(this, arguments);
    }

    DecoratorClass.displayName = SuperClass.displayName;

    function ctr () {
      this.constructor = DecoratedClass;
    }

    DecoratedClass.prototype = new ctr();

    for (var m = 0; m < superMethods.length; m++) {
      var superMethod = superMethods[m];

      DecoratedClass.prototype[superMethod] =
        SuperClass.prototype[superMethod];
    }

    var calledMethod = function (methodName) {
      // Stub out the original method if it's not decorating an actual method
      var originalMethod = function () {};

      if (methodName in DecoratedClass.prototype) {
        originalMethod = DecoratedClass.prototype[methodName];
      }

      var decoratedMethod = DecoratorClass.prototype[methodName];

      return function () {
        var unshift = Array.prototype.unshift;

        unshift.call(arguments, originalMethod);

        return decoratedMethod.apply(this, arguments);
      };
    };

    for (var d = 0; d < decoratedMethods.length; d++) {
      var decoratedMethod = decoratedMethods[d];

      DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
    }

    return DecoratedClass;
  };

  var Observable = function () {
    this.listeners = {};
  };

  Observable.prototype.on = function (event, callback) {
    this.listeners = this.listeners || {};

    if (event in this.listeners) {
      this.listeners[event].push(callback);
    } else {
      this.listeners[event] = [callback];
    }
  };

  Observable.prototype.trigger = function (event) {
    var slice = Array.prototype.slice;
    var params = slice.call(arguments, 1);

    this.listeners = this.listeners || {};

    // Params should always come in as an array
    if (params == null) {
      params = [];
    }

    // If there are no arguments to the event, use a temporary object
    if (params.length === 0) {
      params.push({});
    }

    // Set the `_type` of the first object to the event
    params[0]._type = event;

    if (event in this.listeners) {
      this.invoke(this.listeners[event], slice.call(arguments, 1));
    }

    if ('*' in this.listeners) {
      this.invoke(this.listeners['*'], arguments);
    }
  };

  Observable.prototype.invoke = function (listeners, params) {
    for (var i = 0, len = listeners.length; i < len; i++) {
      listeners[i].apply(this, params);
    }
  };

  Utils.Observable = Observable;

  Utils.generateChars = function (length) {
    var chars = '';

    for (var i = 0; i < length; i++) {
      var randomChar = Math.floor(Math.random() * 36);
      chars += randomChar.toString(36);
    }

    return chars;
  };

  Utils.bind = function (func, context) {
    return function () {
      func.apply(context, arguments);
    };
  };

  Utils._convertData = function (data) {
    for (var originalKey in data) {
      var keys = originalKey.split('-');

      var dataLevel = data;

      if (keys.length === 1) {
        continue;
      }

      for (var k = 0; k < keys.length; k++) {
        var key = keys[k];

        // Lowercase the first letter
        // By default, dash-separated becomes camelCase
        key = key.substring(0, 1).toLowerCase() + key.substring(1);

        if (!(key in dataLevel)) {
          dataLevel[key] = {};
        }

        if (k == keys.length - 1) {
          dataLevel[key] = data[originalKey];
        }

        dataLevel = dataLevel[key];
      }

      delete data[originalKey];
    }

    return data;
  };

  Utils.hasScroll = function (index, el) {
    // Adapted from the function created by @ShadowScripter
    // and adapted by @BillBarry on the Stack Exchange Code Review website.
    // The original code can be found at
    // http://codereview.stackexchange.com/q/13338
    // and was designed to be used with the Sizzle selector engine.

    var $el = $(el);
    var overflowX = el.style.overflowX;
    var overflowY = el.style.overflowY;

    //Check both x and y declarations
    if (overflowX === overflowY &&
        (overflowY === 'hidden' || overflowY === 'visible')) {
      return false;
    }

    if (overflowX === 'scroll' || overflowY === 'scroll') {
      return true;
    }

    return ($el.innerHeight() < el.scrollHeight ||
      $el.innerWidth() < el.scrollWidth);
  };

  Utils.escapeMarkup = function (markup) {
    var replaceMap = {
      '\\': '&#92;',
      '&': '&amp;',
      '<': '&lt;',
      '>': '&gt;',
      '"': '&quot;',
      '\'': '&#39;',
      '/': '&#47;'
    };

    // Do not try to escape the markup if it's not a string
    if (typeof markup !== 'string') {
      return markup;
    }

    return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
      return replaceMap[match];
    });
  };

  // Append an array of jQuery nodes to a given element.
  Utils.appendMany = function ($element, $nodes) {
    // jQuery 1.7.x does not support $.fn.append() with an array
    // Fall back to a jQuery object collection using $.fn.add()
    if ($.fn.jquery.substr(0, 3) === '1.7') {
      var $jqNodes = $();

      $.map($nodes, function (node) {
        $jqNodes = $jqNodes.add(node);
      });

      $nodes = $jqNodes;
    }

    $element.append($nodes);
  };

  // Cache objects in Utils.__cache instead of $.data (see #4346)
  Utils.__cache = {};

  var id = 0;
  Utils.GetUniqueElementId = function (element) {
    // Get a unique element Id. If element has no id,
    // creates a new unique number, stores it in the id
    // attribute and returns the new id.
    // If an id already exists, it simply returns it.

    var select2Id = element.getAttribute('data-select2-id');
    if (select2Id == null) {
      // If element has id, use it.
      if (element.id) {
        select2Id = element.id;
        element.setAttribute('data-select2-id', select2Id);
      } else {
        element.setAttribute('data-select2-id', ++id);
        select2Id = id.toString();
      }
    }
    return select2Id;
  };

  Utils.StoreData = function (element, name, value) {
    // Stores an item in the cache for a specified element.
    // name is the cache key.
    var id = Utils.GetUniqueElementId(element);
    if (!Utils.__cache[id]) {
      Utils.__cache[id] = {};
    }

    Utils.__cache[id][name] = value;
  };

  Utils.GetData = function (element, name) {
    // Retrieves a value from the cache by its key (name)
    // name is optional. If no name specified, return
    // all cache items for the specified element.
    // and for a specified element.
    var id = Utils.GetUniqueElementId(element);
    if (name) {
      if (Utils.__cache[id]) {
        if (Utils.__cache[id][name] != null) {
          return Utils.__cache[id][name];
        }
        return $(element).data(name); // Fallback to HTML5 data attribs.
      }
      return $(element).data(name); // Fallback to HTML5 data attribs.
    } else {
      return Utils.__cache[id];
    }
  };

  Utils.RemoveData = function (element) {
    // Removes all cached items for a specified element.
    var id = Utils.GetUniqueElementId(element);
    if (Utils.__cache[id] != null) {
      delete Utils.__cache[id];
    }

    element.removeAttribute('data-select2-id');
  };

  return Utils;
});

S2.define('select2/results',[
  'jquery',
  './utils'
], function ($, Utils) {
  function Results ($element, options, dataAdapter) {
    this.$element = $element;
    this.data = dataAdapter;
    this.options = options;

    Results.__super__.constructor.call(this);
  }

  Utils.Extend(Results, Utils.Observable);

  Results.prototype.render = function () {
    var $results = $(
      '<ul class="select2-results__options" role="listbox"></ul>'
    );

    if (this.options.get('multiple')) {
      $results.attr('aria-multiselectable', 'true');
    }

    this.$results = $results;

    return $results;
  };

  Results.prototype.clear = function () {
    this.$results.empty();
  };

  Results.prototype.displayMessage = function (params) {
    var escapeMarkup = this.options.get('escapeMarkup');

    this.clear();
    this.hideLoading();

    var $message = $(
      '<li role="alert" aria-live="assertive"' +
      ' class="select2-results__option"></li>'
    );

    var message = this.options.get('translations').get(params.message);

    $message.append(
      escapeMarkup(
        message(params.args)
      )
    );

    $message[0].className += ' select2-results__message';

    this.$results.append($message);
  };

  Results.prototype.hideMessages = function () {
    this.$results.find('.select2-results__message').remove();
  };

  Results.prototype.append = function (data) {
    this.hideLoading();

    var $options = [];

    if (data.results == null || data.results.length === 0) {
      if (this.$results.children().length === 0) {
        this.trigger('results:message', {
          message: 'noResults'
        });
      }

      return;
    }

    data.results = this.sort(data.results);

    for (var d = 0; d < data.results.length; d++) {
      var item = data.results[d];

      var $option = this.option(item);

      $options.push($option);
    }

    this.$results.append($options);
  };

  Results.prototype.position = function ($results, $dropdown) {
    var $resultsContainer = $dropdown.find('.select2-results');
    $resultsContainer.append($results);
  };

  Results.prototype.sort = function (data) {
    var sorter = this.options.get('sorter');

    return sorter(data);
  };

  Results.prototype.highlightFirstItem = function () {
    var $options = this.$results
      .find('.select2-results__option[aria-selected]');

    var $selected = $options.filter('[aria-selected=true]');

    // Check if there are any selected options
    if ($selected.length > 0) {
      // If there are selected options, highlight the first
      $selected.first().trigger('mouseenter');
    } else {
      // If there are no selected options, highlight the first option
      // in the dropdown
      $options.first().trigger('mouseenter');
    }

    this.ensureHighlightVisible();
  };

  Results.prototype.setClasses = function () {
    var self = this;

    this.data.current(function (selected) {
      var selectedIds = $.map(selected, function (s) {
        return s.id.toString();
      });

      var $options = self.$results
        .find('.select2-results__option[aria-selected]');

      $options.each(function () {
        var $option = $(this);

        var item = Utils.GetData(this, 'data');

        // id needs to be converted to a string when comparing
        var id = '' + item.id;

        if ((item.element != null && item.element.selected) ||
            (item.element == null && $.inArray(id, selectedIds) > -1)) {
          $option.attr('aria-selected', 'true');
        } else {
          $option.attr('aria-selected', 'false');
        }
      });

    });
  };

  Results.prototype.showLoading = function (params) {
    this.hideLoading();

    var loadingMore = this.options.get('translations').get('searching');

    var loading = {
      disabled: true,
      loading: true,
      text: loadingMore(params)
    };
    var $loading = this.option(loading);
    $loading.className += ' loading-results';

    this.$results.prepend($loading);
  };

  Results.prototype.hideLoading = function () {
    this.$results.find('.loading-results').remove();
  };

  Results.prototype.option = function (data) {
    var option = document.createElement('li');
    option.className = 'select2-results__option';

    var attrs = {
      'role': 'option',
      'aria-selected': 'false'
    };

    var matches = window.Element.prototype.matches ||
      window.Element.prototype.msMatchesSelector ||
      window.Element.prototype.webkitMatchesSelector;

    if ((data.element != null && matches.call(data.element, ':disabled')) ||
        (data.element == null && data.disabled)) {
      delete attrs['aria-selected'];
      attrs['aria-disabled'] = 'true';
    }

    if (data.id == null) {
      delete attrs['aria-selected'];
    }

    if (data._resultId != null) {
      option.id = data._resultId;
    }

    if (data.title) {
      option.title = data.title;
    }

    if (data.children) {
      attrs.role = 'group';
      attrs['aria-label'] = data.text;
      delete attrs['aria-selected'];
    }

    for (var attr in attrs) {
      var val = attrs[attr];

      option.setAttribute(attr, val);
    }

    if (data.children) {
      var $option = $(option);

      var label = document.createElement('strong');
      label.className = 'select2-results__group';

      var $label = $(label);
      this.template(data, label);

      var $children = [];

      for (var c = 0; c < data.children.length; c++) {
        var child = data.children[c];

        var $child = this.option(child);

        $children.push($child);
      }

      var $childrenContainer = $('<ul></ul>', {
        'class': 'select2-results__options select2-results__options--nested'
      });

      $childrenContainer.append($children);

      $option.append(label);
      $option.append($childrenContainer);
    } else {
      this.template(data, option);
    }

    Utils.StoreData(option, 'data', data);

    return option;
  };

  Results.prototype.bind = function (container, $container) {
    var self = this;

    var id = container.id + '-results';

    this.$results.attr('id', id);

    container.on('results:all', function (params) {
      self.clear();
      self.append(params.data);

      if (container.isOpen()) {
        self.setClasses();
        self.highlightFirstItem();
      }
    });

    container.on('results:append', function (params) {
      self.append(params.data);

      if (container.isOpen()) {
        self.setClasses();
      }
    });

    container.on('query', function (params) {
      self.hideMessages();
      self.showLoading(params);
    });

    container.on('select', function () {
      if (!container.isOpen()) {
        return;
      }

      self.setClasses();

      if (self.options.get('scrollAfterSelect')) {
        self.highlightFirstItem();
      }
    });

    container.on('unselect', function () {
      if (!container.isOpen()) {
        return;
      }

      self.setClasses();

      if (self.options.get('scrollAfterSelect')) {
        self.highlightFirstItem();
      }
    });

    container.on('open', function () {
      // When the dropdown is open, aria-expended="true"
      self.$results.attr('aria-expanded', 'true');
      self.$results.attr('aria-hidden', 'false');

      self.setClasses();
      self.ensureHighlightVisible();
    });

    container.on('close', function () {
      // When the dropdown is closed, aria-expended="false"
      self.$results.attr('aria-expanded', 'false');
      self.$results.attr('aria-hidden', 'true');
      self.$results.removeAttr('aria-activedescendant');
    });

    container.on('results:toggle', function () {
      var $highlighted = self.getHighlightedResults();

      if ($highlighted.length === 0) {
        return;
      }

      $highlighted.trigger('mouseup');
    });

    container.on('results:select', function () {
      var $highlighted = self.getHighlightedResults();

      if ($highlighted.length === 0) {
        return;
      }

      var data = Utils.GetData($highlighted[0], 'data');

      if ($highlighted.attr('aria-selected') == 'true') {
        self.trigger('close', {});
      } else {
        self.trigger('select', {
          data: data
        });
      }
    });

    container.on('results:previous', function () {
      var $highlighted = self.getHighlightedResults();

      var $options = self.$results.find('[aria-selected]');

      var currentIndex = $options.index($highlighted);

      // If we are already at the top, don't move further
      // If no options, currentIndex will be -1
      if (currentIndex <= 0) {
        return;
      }

      var nextIndex = currentIndex - 1;

      // If none are highlighted, highlight the first
      if ($highlighted.length === 0) {
        nextIndex = 0;
      }

      var $next = $options.eq(nextIndex);

      $next.trigger('mouseenter');

      var currentOffset = self.$results.offset().top;
      var nextTop = $next.offset().top;
      var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);

      if (nextIndex === 0) {
        self.$results.scrollTop(0);
      } else if (nextTop - currentOffset < 0) {
        self.$results.scrollTop(nextOffset);
      }
    });

    container.on('results:next', function () {
      var $highlighted = self.getHighlightedResults();

      var $options = self.$results.find('[aria-selected]');

      var currentIndex = $options.index($highlighted);

      var nextIndex = currentIndex + 1;

      // If we are at the last option, stay there
      if (nextIndex >= $options.length) {
        return;
      }

      var $next = $options.eq(nextIndex);

      $next.trigger('mouseenter');

      var currentOffset = self.$results.offset().top +
        self.$results.outerHeight(false);
      var nextBottom = $next.offset().top + $next.outerHeight(false);
      var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;

      if (nextIndex === 0) {
        self.$results.scrollTop(0);
      } else if (nextBottom > currentOffset) {
        self.$results.scrollTop(nextOffset);
      }
    });

    container.on('results:focus', function (params) {
      params.element.addClass('select2-results__option--highlighted');
    });

    container.on('results:message', function (params) {
      self.displayMessage(params);
    });

    if ($.fn.mousewheel) {
      this.$results.on('mousewheel', function (e) {
        var top = self.$results.scrollTop();

        var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;

        var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
        var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();

        if (isAtTop) {
          self.$results.scrollTop(0);

          e.preventDefault();
          e.stopPropagation();
        } else if (isAtBottom) {
          self.$results.scrollTop(
            self.$results.get(0).scrollHeight - self.$results.height()
          );

          e.preventDefault();
          e.stopPropagation();
        }
      });
    }

    this.$results.on('mouseup', '.select2-results__option[aria-selected]',
      function (evt) {
      var $this = $(this);

      var data = Utils.GetData(this, 'data');

      if ($this.attr('aria-selected') === 'true') {
        if (self.options.get('multiple')) {
          self.trigger('unselect', {
            originalEvent: evt,
            data: data
          });
        } else {
          self.trigger('close', {});
        }

        return;
      }

      self.trigger('select', {
        originalEvent: evt,
        data: data
      });
    });

    this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
      function (evt) {
      var data = Utils.GetData(this, 'data');

      self.getHighlightedResults()
          .removeClass('select2-results__option--highlighted');

      self.trigger('results:focus', {
        data: data,
        element: $(this)
      });
    });
  };

  Results.prototype.getHighlightedResults = function () {
    var $highlighted = this.$results
    .find('.select2-results__option--highlighted');

    return $highlighted;
  };

  Results.prototype.destroy = function () {
    this.$results.remove();
  };

  Results.prototype.ensureHighlightVisible = function () {
    var $highlighted = this.getHighlightedResults();

    if ($highlighted.length === 0) {
      return;
    }

    var $options = this.$results.find('[aria-selected]');

    var currentIndex = $options.index($highlighted);

    var currentOffset = this.$results.offset().top;
    var nextTop = $highlighted.offset().top;
    var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);

    var offsetDelta = nextTop - currentOffset;
    nextOffset -= $highlighted.outerHeight(false) * 2;

    if (currentIndex <= 2) {
      this.$results.scrollTop(0);
    } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
      this.$results.scrollTop(nextOffset);
    }
  };

  Results.prototype.template = function (result, container) {
    var template = this.options.get('templateResult');
    var escapeMarkup = this.options.get('escapeMarkup');

    var content = template(result, container);

    if (content == null) {
      container.style.display = 'none';
    } else if (typeof content === 'string') {
      container.innerHTML = escapeMarkup(content);
    } else {
      $(container).append(content);
    }
  };

  return Results;
});

S2.define('select2/keys',[

], function () {
  var KEYS = {
    BACKSPACE: 8,
    TAB: 9,
    ENTER: 13,
    SHIFT: 16,
    CTRL: 17,
    ALT: 18,
    ESC: 27,
    SPACE: 32,
    PAGE_UP: 33,
    PAGE_DOWN: 34,
    END: 35,
    HOME: 36,
    LEFT: 37,
    UP: 38,
    RIGHT: 39,
    DOWN: 40,
    DELETE: 46
  };

  return KEYS;
});

S2.define('select2/selection/base',[
  'jquery',
  '../utils',
  '../keys'
], function ($, Utils, KEYS) {
  function BaseSelection ($element, options) {
    this.$element = $element;
    this.options = options;

    BaseSelection.__super__.constructor.call(this);
  }

  Utils.Extend(BaseSelection, Utils.Observable);

  BaseSelection.prototype.render = function () {
    var $selection = $(
      '<span class="select2-selection" role="combobox" ' +
      ' aria-haspopup="true" aria-expanded="false">' +
      '</span>'
    );

    this._tabindex = 0;

    if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {
      this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');
    } else if (this.$element.attr('tabindex') != null) {
      this._tabindex = this.$element.attr('tabindex');
    }

    $selection.attr('title', this.$element.attr('title'));
    $selection.attr('tabindex', this._tabindex);
    $selection.attr('aria-disabled', 'false');

    this.$selection = $selection;

    return $selection;
  };

  BaseSelection.prototype.bind = function (container, $container) {
    var self = this;

    var resultsId = container.id + '-results';

    this.container = container;

    this.$selection.on('focus', function (evt) {
      self.trigger('focus', evt);
    });

    this.$selection.on('blur', function (evt) {
      self._handleBlur(evt);
    });

    this.$selection.on('keydown', function (evt) {
      self.trigger('keypress', evt);

      if (evt.which === KEYS.SPACE) {
        evt.preventDefault();
      }
    });

    container.on('results:focus', function (params) {
      self.$selection.attr('aria-activedescendant', params.data._resultId);
    });

    container.on('selection:update', function (params) {
      self.update(params.data);
    });

    container.on('open', function () {
      // When the dropdown is open, aria-expanded="true"
      self.$selection.attr('aria-expanded', 'true');
      self.$selection.attr('aria-owns', resultsId);

      self._attachCloseHandler(container);
    });

    container.on('close', function () {
      // When the dropdown is closed, aria-expanded="false"
      self.$selection.attr('aria-expanded', 'false');
      self.$selection.removeAttr('aria-activedescendant');
      self.$selection.removeAttr('aria-owns');

      self.$selection.trigger('focus');

      self._detachCloseHandler(container);
    });

    container.on('enable', function () {
      self.$selection.attr('tabindex', self._tabindex);
      self.$selection.attr('aria-disabled', 'false');
    });

    container.on('disable', function () {
      self.$selection.attr('tabindex', '-1');
      self.$selection.attr('aria-disabled', 'true');
    });
  };

  BaseSelection.prototype._handleBlur = function (evt) {
    var self = this;

    // This needs to be delayed as the active element is the body when the tab
    // key is pressed, possibly along with others.
    window.setTimeout(function () {
      // Don't trigger `blur` if the focus is still in the selection
      if (
        (document.activeElement == self.$selection[0]) ||
        ($.contains(self.$selection[0], document.activeElement))
      ) {
        return;
      }

      self.trigger('blur', evt);
    }, 1);
  };

  BaseSelection.prototype._attachCloseHandler = function (container) {

    $(document.body).on('mousedown.select2.' + container.id, function (e) {
      var $target = $(e.target);

      var $select = $target.closest('.select2');

      var $all = $('.select2.select2-container--open');

      $all.each(function () {
        if (this == $select[0]) {
          return;
        }

        var $element = Utils.GetData(this, 'element');

        $element.select2('close');
      });
    });
  };

  BaseSelection.prototype._detachCloseHandler = function (container) {
    $(document.body).off('mousedown.select2.' + container.id);
  };

  BaseSelection.prototype.position = function ($selection, $container) {
    var $selectionContainer = $container.find('.selection');
    $selectionContainer.append($selection);
  };

  BaseSelection.prototype.destroy = function () {
    this._detachCloseHandler(this.container);
  };

  BaseSelection.prototype.update = function (data) {
    throw new Error('The `update` method must be defined in child classes.');
  };

  /**
   * Helper method to abstract the "enabled" (not "disabled") state of this
   * object.
   *
   * @return {true} if the instance is not disabled.
   * @return {false} if the instance is disabled.
   */
  BaseSelection.prototype.isEnabled = function () {
    return !this.isDisabled();
  };

  /**
   * Helper method to abstract the "disabled" state of this object.
   *
   * @return {true} if the disabled option is true.
   * @return {false} if the disabled option is false.
   */
  BaseSelection.prototype.isDisabled = function () {
    return this.options.get('disabled');
  };

  return BaseSelection;
});

S2.define('select2/selection/single',[
  'jquery',
  './base',
  '../utils',
  '../keys'
], function ($, BaseSelection, Utils, KEYS) {
  function SingleSelection () {
    SingleSelection.__super__.constructor.apply(this, arguments);
  }

  Utils.Extend(SingleSelection, BaseSelection);

  SingleSelection.prototype.render = function () {
    var $selection = SingleSelection.__super__.render.call(this);

    $selection.addClass('select2-selection--single');

    $selection.html(
      '<span class="select2-selection__rendered"></span>' +
      '<span class="select2-selection__arrow" role="presentation">' +
        '<b role="presentation"></b>' +
      '</span>'
    );

    return $selection;
  };

  SingleSelection.prototype.bind = function (container, $container) {
    var self = this;

    SingleSelection.__super__.bind.apply(this, arguments);

    var id = container.id + '-container';

    this.$selection.find('.select2-selection__rendered')
      .attr('id', id)
      .attr('role', 'textbox')
      .attr('aria-readonly', 'true');
    this.$selection.attr('aria-labelledby', id);

    this.$selection.on('mousedown', function (evt) {
      // Only respond to left clicks
      if (evt.which !== 1) {
        return;
      }

      self.trigger('toggle', {
        originalEvent: evt
      });
    });

    this.$selection.on('focus', function (evt) {
      // User focuses on the container
    });

    this.$selection.on('blur', function (evt) {
      // User exits the container
    });

    container.on('focus', function (evt) {
      if (!container.isOpen()) {
        self.$selection.trigger('focus');
      }
    });
  };

  SingleSelection.prototype.clear = function () {
    var $rendered = this.$selection.find('.select2-selection__rendered');
    $rendered.empty();
    $rendered.removeAttr('title'); // clear tooltip on empty
  };

  SingleSelection.prototype.display = function (data, container) {
    var template = this.options.get('templateSelection');
    var escapeMarkup = this.options.get('escapeMarkup');

    return escapeMarkup(template(data, container));
  };

  SingleSelection.prototype.selectionContainer = function () {
    return $('<span></span>');
  };

  SingleSelection.prototype.update = function (data) {
    if (data.length === 0) {
      this.clear();
      return;
    }

    var selection = data[0];

    var $rendered = this.$selection.find('.select2-selection__rendered');
    var formatted = this.display(selection, $rendered);

    $rendered.empty().append(formatted);

    var title = selection.title || selection.text;

    if (title) {
      $rendered.attr('title', title);
    } else {
      $rendered.removeAttr('title');
    }
  };

  return SingleSelection;
});

S2.define('select2/selection/multiple',[
  'jquery',
  './base',
  '../utils'
], function ($, BaseSelection, Utils) {
  function MultipleSelection ($element, options) {
    MultipleSelection.__super__.constructor.apply(this, arguments);
  }

  Utils.Extend(MultipleSelection, BaseSelection);

  MultipleSelection.prototype.render = function () {
    var $selection = MultipleSelection.__super__.render.call(this);

    $selection.addClass('select2-selection--multiple');

    $selection.html(
      '<ul class="select2-selection__rendered"></ul>'
    );

    return $selection;
  };

  MultipleSelection.prototype.bind = function (container, $container) {
    var self = this;

    MultipleSelection.__super__.bind.apply(this, arguments);

    this.$selection.on('click', function (evt) {
      self.trigger('toggle', {
        originalEvent: evt
      });
    });

    this.$selection.on(
      'click',
      '.select2-selection__choice__remove',
      function (evt) {
        // Ignore the event if it is disabled
        if (self.isDisabled()) {
          return;
        }

        var $remove = $(this);
        var $selection = $remove.parent();

        var data = Utils.GetData($selection[0], 'data');

        self.trigger('unselect', {
          originalEvent: evt,
          data: data
        });
      }
    );
  };

  MultipleSelection.prototype.clear = function () {
    var $rendered = this.$selection.find('.select2-selection__rendered');
    $rendered.empty();
    $rendered.removeAttr('title');
  };

  MultipleSelection.prototype.display = function (data, container) {
    var template = this.options.get('templateSelection');
    var escapeMarkup = this.options.get('escapeMarkup');

    return escapeMarkup(template(data, container));
  };

  MultipleSelection.prototype.selectionContainer = function () {
    var $container = $(
      '<li class="select2-selection__choice">' +
        '<span class="select2-selection__choice__remove" role="presentation">' +
          '&times;' +
        '</span>' +
      '</li>'
    );

    return $container;
  };

  MultipleSelection.prototype.update = function (data) {
    this.clear();

    if (data.length === 0) {
      return;
    }

    var $selections = [];

    for (var d = 0; d < data.length; d++) {
      var selection = data[d];

      var $selection = this.selectionContainer();
      var formatted = this.display(selection, $selection);

      $selection.append(formatted);

      var title = selection.title || selection.text;

      if (title) {
        $selection.attr('title', title);
      }

      Utils.StoreData($selection[0], 'data', selection);

      $selections.push($selection);
    }

    var $rendered = this.$selection.find('.select2-selection__rendered');

    Utils.appendMany($rendered, $selections);
  };

  return MultipleSelection;
});

S2.define('select2/selection/placeholder',[
  '../utils'
], function (Utils) {
  function Placeholder (decorated, $element, options) {
    this.placeholder = this.normalizePlaceholder(options.get('placeholder'));

    decorated.call(this, $element, options);
  }

  Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
    if (typeof placeholder === 'string') {
      placeholder = {
        id: '',
        text: placeholder
      };
    }

    return placeholder;
  };

  Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
    var $placeholder = this.selectionContainer();

    $placeholder.html(this.display(placeholder));
    $placeholder.addClass('select2-selection__placeholder')
                .removeClass('select2-selection__choice');

    return $placeholder;
  };

  Placeholder.prototype.update = function (decorated, data) {
    var singlePlaceholder = (
      data.length == 1 && data[0].id != this.placeholder.id
    );
    var multipleSelections = data.length > 1;

    if (multipleSelections || singlePlaceholder) {
      return decorated.call(this, data);
    }

    this.clear();

    var $placeholder = this.createPlaceholder(this.placeholder);

    this.$selection.find('.select2-selection__rendered').append($placeholder);
  };

  return Placeholder;
});

S2.define('select2/selection/allowClear',[
  'jquery',
  '../keys',
  '../utils'
], function ($, KEYS, Utils) {
  function AllowClear () { }

  AllowClear.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    if (this.placeholder == null) {
      if (this.options.get('debug') && window.console && console.error) {
        console.error(
          'Select2: The `allowClear` option should be used in combination ' +
          'with the `placeholder` option.'
        );
      }
    }

    this.$selection.on('mousedown', '.select2-selection__clear',
      function (evt) {
        self._handleClear(evt);
    });

    container.on('keypress', function (evt) {
      self._handleKeyboardClear(evt, container);
    });
  };

  AllowClear.prototype._handleClear = function (_, evt) {
    // Ignore the event if it is disabled
    if (this.isDisabled()) {
      return;
    }

    var $clear = this.$selection.find('.select2-selection__clear');

    // Ignore the event if nothing has been selected
    if ($clear.length === 0) {
      return;
    }

    evt.stopPropagation();

    var data = Utils.GetData($clear[0], 'data');

    var previousVal = this.$element.val();
    this.$element.val(this.placeholder.id);

    var unselectData = {
      data: data
    };
    this.trigger('clear', unselectData);
    if (unselectData.prevented) {
      this.$element.val(previousVal);
      return;
    }

    for (var d = 0; d < data.length; d++) {
      unselectData = {
        data: data[d]
      };

      // Trigger the `unselect` event, so people can prevent it from being
      // cleared.
      this.trigger('unselect', unselectData);

      // If the event was prevented, don't clear it out.
      if (unselectData.prevented) {
        this.$element.val(previousVal);
        return;
      }
    }

    this.$element.trigger('input').trigger('change');

    this.trigger('toggle', {});
  };

  AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
    if (container.isOpen()) {
      return;
    }

    if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
      this._handleClear(evt);
    }
  };

  AllowClear.prototype.update = function (decorated, data) {
    decorated.call(this, data);

    if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
        data.length === 0) {
      return;
    }

    var removeAll = this.options.get('translations').get('removeAllItems');

    var $remove = $(
      '<span class="select2-selection__clear" title="' + removeAll() +'">' +
        '&times;' +
      '</span>'
    );
    Utils.StoreData($remove[0], 'data', data);

    this.$selection.find('.select2-selection__rendered').prepend($remove);
  };

  return AllowClear;
});

S2.define('select2/selection/search',[
  'jquery',
  '../utils',
  '../keys'
], function ($, Utils, KEYS) {
  function Search (decorated, $element, options) {
    decorated.call(this, $element, options);
  }

  Search.prototype.render = function (decorated) {
    var $search = $(
      '<li class="select2-search select2-search--inline">' +
        '<input class="select2-search__field" type="search" tabindex="-1"' +
        ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
        ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
      '</li>'
    );

    this.$searchContainer = $search;
    this.$search = $search.find('input');

    var $rendered = decorated.call(this);

    this._transferTabIndex();

    return $rendered;
  };

  Search.prototype.bind = function (decorated, container, $container) {
    var self = this;

    var resultsId = container.id + '-results';

    decorated.call(this, container, $container);

    container.on('open', function () {
      self.$search.attr('aria-controls', resultsId);
      self.$search.trigger('focus');
    });

    container.on('close', function () {
      self.$search.val('');
      self.$search.removeAttr('aria-controls');
      self.$search.removeAttr('aria-activedescendant');
      self.$search.trigger('focus');
    });

    container.on('enable', function () {
      self.$search.prop('disabled', false);

      self._transferTabIndex();
    });

    container.on('disable', function () {
      self.$search.prop('disabled', true);
    });

    container.on('focus', function (evt) {
      self.$search.trigger('focus');
    });

    container.on('results:focus', function (params) {
      if (params.data._resultId) {
        self.$search.attr('aria-activedescendant', params.data._resultId);
      } else {
        self.$search.removeAttr('aria-activedescendant');
      }
    });

    this.$selection.on('focusin', '.select2-search--inline', function (evt) {
      self.trigger('focus', evt);
    });

    this.$selection.on('focusout', '.select2-search--inline', function (evt) {
      self._handleBlur(evt);
    });

    this.$selection.on('keydown', '.select2-search--inline', function (evt) {
      evt.stopPropagation();

      self.trigger('keypress', evt);

      self._keyUpPrevented = evt.isDefaultPrevented();

      var key = evt.which;

      if (key === KEYS.BACKSPACE && self.$search.val() === '') {
        var $previousChoice = self.$searchContainer
          .prev('.select2-selection__choice');

        if ($previousChoice.length > 0) {
          var item = Utils.GetData($previousChoice[0], 'data');

          self.searchRemoveChoice(item);

          evt.preventDefault();
        }
      }
    });

    this.$selection.on('click', '.select2-search--inline', function (evt) {
      if (self.$search.val()) {
        evt.stopPropagation();
      }
    });

    // Try to detect the IE version should the `documentMode` property that
    // is stored on the document. This is only implemented in IE and is
    // slightly cleaner than doing a user agent check.
    // This property is not available in Edge, but Edge also doesn't have
    // this bug.
    var msie = document.documentMode;
    var disableInputEvents = msie && msie <= 11;

    // Workaround for browsers which do not support the `input` event
    // This will prevent double-triggering of events for browsers which support
    // both the `keyup` and `input` events.
    this.$selection.on(
      'input.searchcheck',
      '.select2-search--inline',
      function (evt) {
        // IE will trigger the `input` event when a placeholder is used on a
        // search box. To get around this issue, we are forced to ignore all
        // `input` events in IE and keep using `keyup`.
        if (disableInputEvents) {
          self.$selection.off('input.search input.searchcheck');
          return;
        }

        // Unbind the duplicated `keyup` event
        self.$selection.off('keyup.search');
      }
    );

    this.$selection.on(
      'keyup.search input.search',
      '.select2-search--inline',
      function (evt) {
        // IE will trigger the `input` event when a placeholder is used on a
        // search box. To get around this issue, we are forced to ignore all
        // `input` events in IE and keep using `keyup`.
        if (disableInputEvents && evt.type === 'input') {
          self.$selection.off('input.search input.searchcheck');
          return;
        }

        var key = evt.which;

        // We can freely ignore events from modifier keys
        if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
          return;
        }

        // Tabbing will be handled during the `keydown` phase
        if (key == KEYS.TAB) {
          return;
        }

        self.handleSearch(evt);
      }
    );
  };

  /**
   * This method will transfer the tabindex attribute from the rendered
   * selection to the search box. This allows for the search box to be used as
   * the primary focus instead of the selection container.
   *
   * @private
   */
  Search.prototype._transferTabIndex = function (decorated) {
    this.$search.attr('tabindex', this.$selection.attr('tabindex'));
    this.$selection.attr('tabindex', '-1');
  };

  Search.prototype.createPlaceholder = function (decorated, placeholder) {
    this.$search.attr('placeholder', placeholder.text);
  };

  Search.prototype.update = function (decorated, data) {
    var searchHadFocus = this.$search[0] == document.activeElement;

    this.$search.attr('placeholder', '');

    decorated.call(this, data);

    this.$selection.find('.select2-selection__rendered')
                   .append(this.$searchContainer);

    this.resizeSearch();
    if (searchHadFocus) {
      this.$search.trigger('focus');
    }
  };

  Search.prototype.handleSearch = function () {
    this.resizeSearch();

    if (!this._keyUpPrevented) {
      var input = this.$search.val();

      this.trigger('query', {
        term: input
      });
    }

    this._keyUpPrevented = false;
  };

  Search.prototype.searchRemoveChoice = function (decorated, item) {
    this.trigger('unselect', {
      data: item
    });

    this.$search.val(item.text);
    this.handleSearch();
  };

  Search.prototype.resizeSearch = function () {
    this.$search.css('width', '25px');

    var width = '';

    if (this.$search.attr('placeholder') !== '') {
      width = this.$selection.find('.select2-selection__rendered').width();
    } else {
      var minimumWidth = this.$search.val().length + 1;

      width = (minimumWidth * 0.75) + 'em';
    }

    this.$search.css('width', width);
  };

  return Search;
});

S2.define('select2/selection/eventRelay',[
  'jquery'
], function ($) {
  function EventRelay () { }

  EventRelay.prototype.bind = function (decorated, container, $container) {
    var self = this;
    var relayEvents = [
      'open', 'opening',
      'close', 'closing',
      'select', 'selecting',
      'unselect', 'unselecting',
      'clear', 'clearing'
    ];

    var preventableEvents = [
      'opening', 'closing', 'selecting', 'unselecting', 'clearing'
    ];

    decorated.call(this, container, $container);

    container.on('*', function (name, params) {
      // Ignore events that should not be relayed
      if ($.inArray(name, relayEvents) === -1) {
        return;
      }

      // The parameters should always be an object
      params = params || {};

      // Generate the jQuery event for the Select2 event
      var evt = $.Event('select2:' + name, {
        params: params
      });

      self.$element.trigger(evt);

      // Only handle preventable events if it was one
      if ($.inArray(name, preventableEvents) === -1) {
        return;
      }

      params.prevented = evt.isDefaultPrevented();
    });
  };

  return EventRelay;
});

S2.define('select2/translation',[
  'jquery',
  'require'
], function ($, require) {
  function Translation (dict) {
    this.dict = dict || {};
  }

  Translation.prototype.all = function () {
    return this.dict;
  };

  Translation.prototype.get = function (key) {
    return this.dict[key];
  };

  Translation.prototype.extend = function (translation) {
    this.dict = $.extend({}, translation.all(), this.dict);
  };

  // Static functions

  Translation._cache = {};

  Translation.loadPath = function (path) {
    if (!(path in Translation._cache)) {
      var translations = require(path);

      Translation._cache[path] = translations;
    }

    return new Translation(Translation._cache[path]);
  };

  return Translation;
});

S2.define('select2/diacritics',[

], function () {
  var diacritics = {
    '\u24B6': 'A',
    '\uFF21': 'A',
    '\u00C0': 'A',
    '\u00C1': 'A',
    '\u00C2': 'A',
    '\u1EA6': 'A',
    '\u1EA4': 'A',
    '\u1EAA': 'A',
    '\u1EA8': 'A',
    '\u00C3': 'A',
    '\u0100': 'A',
    '\u0102': 'A',
    '\u1EB0': 'A',
    '\u1EAE': 'A',
    '\u1EB4': 'A',
    '\u1EB2': 'A',
    '\u0226': 'A',
    '\u01E0': 'A',
    '\u00C4': 'A',
    '\u01DE': 'A',
    '\u1EA2': 'A',
    '\u00C5': 'A',
    '\u01FA': 'A',
    '\u01CD': 'A',
    '\u0200': 'A',
    '\u0202': 'A',
    '\u1EA0': 'A',
    '\u1EAC': 'A',
    '\u1EB6': 'A',
    '\u1E00': 'A',
    '\u0104': 'A',
    '\u023A': 'A',
    '\u2C6F': 'A',
    '\uA732': 'AA',
    '\u00C6': 'AE',
    '\u01FC': 'AE',
    '\u01E2': 'AE',
    '\uA734': 'AO',
    '\uA736': 'AU',
    '\uA738': 'AV',
    '\uA73A': 'AV',
    '\uA73C': 'AY',
    '\u24B7': 'B',
    '\uFF22': 'B',
    '\u1E02': 'B',
    '\u1E04': 'B',
    '\u1E06': 'B',
    '\u0243': 'B',
    '\u0182': 'B',
    '\u0181': 'B',
    '\u24B8': 'C',
    '\uFF23': 'C',
    '\u0106': 'C',
    '\u0108': 'C',
    '\u010A': 'C',
    '\u010C': 'C',
    '\u00C7': 'C',
    '\u1E08': 'C',
    '\u0187': 'C',
    '\u023B': 'C',
    '\uA73E': 'C',
    '\u24B9': 'D',
    '\uFF24': 'D',
    '\u1E0A': 'D',
    '\u010E': 'D',
    '\u1E0C': 'D',
    '\u1E10': 'D',
    '\u1E12': 'D',
    '\u1E0E': 'D',
    '\u0110': 'D',
    '\u018B': 'D',
    '\u018A': 'D',
    '\u0189': 'D',
    '\uA779': 'D',
    '\u01F1': 'DZ',
    '\u01C4': 'DZ',
    '\u01F2': 'Dz',
    '\u01C5': 'Dz',
    '\u24BA': 'E',
    '\uFF25': 'E',
    '\u00C8': 'E',
    '\u00C9': 'E',
    '\u00CA': 'E',
    '\u1EC0': 'E',
    '\u1EBE': 'E',
    '\u1EC4': 'E',
    '\u1EC2': 'E',
    '\u1EBC': 'E',
    '\u0112': 'E',
    '\u1E14': 'E',
    '\u1E16': 'E',
    '\u0114': 'E',
    '\u0116': 'E',
    '\u00CB': 'E',
    '\u1EBA': 'E',
    '\u011A': 'E',
    '\u0204': 'E',
    '\u0206': 'E',
    '\u1EB8': 'E',
    '\u1EC6': 'E',
    '\u0228': 'E',
    '\u1E1C': 'E',
    '\u0118': 'E',
    '\u1E18': 'E',
    '\u1E1A': 'E',
    '\u0190': 'E',
    '\u018E': 'E',
    '\u24BB': 'F',
    '\uFF26': 'F',
    '\u1E1E': 'F',
    '\u0191': 'F',
    '\uA77B': 'F',
    '\u24BC': 'G',
    '\uFF27': 'G',
    '\u01F4': 'G',
    '\u011C': 'G',
    '\u1E20': 'G',
    '\u011E': 'G',
    '\u0120': 'G',
    '\u01E6': 'G',
    '\u0122': 'G',
    '\u01E4': 'G',
    '\u0193': 'G',
    '\uA7A0': 'G',
    '\uA77D': 'G',
    '\uA77E': 'G',
    '\u24BD': 'H',
    '\uFF28': 'H',
    '\u0124': 'H',
    '\u1E22': 'H',
    '\u1E26': 'H',
    '\u021E': 'H',
    '\u1E24': 'H',
    '\u1E28': 'H',
    '\u1E2A': 'H',
    '\u0126': 'H',
    '\u2C67': 'H',
    '\u2C75': 'H',
    '\uA78D': 'H',
    '\u24BE': 'I',
    '\uFF29': 'I',
    '\u00CC': 'I',
    '\u00CD': 'I',
    '\u00CE': 'I',
    '\u0128': 'I',
    '\u012A': 'I',
    '\u012C': 'I',
    '\u0130': 'I',
    '\u00CF': 'I',
    '\u1E2E': 'I',
    '\u1EC8': 'I',
    '\u01CF': 'I',
    '\u0208': 'I',
    '\u020A': 'I',
    '\u1ECA': 'I',
    '\u012E': 'I',
    '\u1E2C': 'I',
    '\u0197': 'I',
    '\u24BF': 'J',
    '\uFF2A': 'J',
    '\u0134': 'J',
    '\u0248': 'J',
    '\u24C0': 'K',
    '\uFF2B': 'K',
    '\u1E30': 'K',
    '\u01E8': 'K',
    '\u1E32': 'K',
    '\u0136': 'K',
    '\u1E34': 'K',
    '\u0198': 'K',
    '\u2C69': 'K',
    '\uA740': 'K',
    '\uA742': 'K',
    '\uA744': 'K',
    '\uA7A2': 'K',
    '\u24C1': 'L',
    '\uFF2C': 'L',
    '\u013F': 'L',
    '\u0139': 'L',
    '\u013D': 'L',
    '\u1E36': 'L',
    '\u1E38': 'L',
    '\u013B': 'L',
    '\u1E3C': 'L',
    '\u1E3A': 'L',
    '\u0141': 'L',
    '\u023D': 'L',
    '\u2C62': 'L',
    '\u2C60': 'L',
    '\uA748': 'L',
    '\uA746': 'L',
    '\uA780': 'L',
    '\u01C7': 'LJ',
    '\u01C8': 'Lj',
    '\u24C2': 'M',
    '\uFF2D': 'M',
    '\u1E3E': 'M',
    '\u1E40': 'M',
    '\u1E42': 'M',
    '\u2C6E': 'M',
    '\u019C': 'M',
    '\u24C3': 'N',
    '\uFF2E': 'N',
    '\u01F8': 'N',
    '\u0143': 'N',
    '\u00D1': 'N',
    '\u1E44': 'N',
    '\u0147': 'N',
    '\u1E46': 'N',
    '\u0145': 'N',
    '\u1E4A': 'N',
    '\u1E48': 'N',
    '\u0220': 'N',
    '\u019D': 'N',
    '\uA790': 'N',
    '\uA7A4': 'N',
    '\u01CA': 'NJ',
    '\u01CB': 'Nj',
    '\u24C4': 'O',
    '\uFF2F': 'O',
    '\u00D2': 'O',
    '\u00D3': 'O',
    '\u00D4': 'O',
    '\u1ED2': 'O',
    '\u1ED0': 'O',
    '\u1ED6': 'O',
    '\u1ED4': 'O',
    '\u00D5': 'O',
    '\u1E4C': 'O',
    '\u022C': 'O',
    '\u1E4E': 'O',
    '\u014C': 'O',
    '\u1E50': 'O',
    '\u1E52': 'O',
    '\u014E': 'O',
    '\u022E': 'O',
    '\u0230': 'O',
    '\u00D6': 'O',
    '\u022A': 'O',
    '\u1ECE': 'O',
    '\u0150': 'O',
    '\u01D1': 'O',
    '\u020C': 'O',
    '\u020E': 'O',
    '\u01A0': 'O',
    '\u1EDC': 'O',
    '\u1EDA': 'O',
    '\u1EE0': 'O',
    '\u1EDE': 'O',
    '\u1EE2': 'O',
    '\u1ECC': 'O',
    '\u1ED8': 'O',
    '\u01EA': 'O',
    '\u01EC': 'O',
    '\u00D8': 'O',
    '\u01FE': 'O',
    '\u0186': 'O',
    '\u019F': 'O',
    '\uA74A': 'O',
    '\uA74C': 'O',
    '\u0152': 'OE',
    '\u01A2': 'OI',
    '\uA74E': 'OO',
    '\u0222': 'OU',
    '\u24C5': 'P',
    '\uFF30': 'P',
    '\u1E54': 'P',
    '\u1E56': 'P',
    '\u01A4': 'P',
    '\u2C63': 'P',
    '\uA750': 'P',
    '\uA752': 'P',
    '\uA754': 'P',
    '\u24C6': 'Q',
    '\uFF31': 'Q',
    '\uA756': 'Q',
    '\uA758': 'Q',
    '\u024A': 'Q',
    '\u24C7': 'R',
    '\uFF32': 'R',
    '\u0154': 'R',
    '\u1E58': 'R',
    '\u0158': 'R',
    '\u0210': 'R',
    '\u0212': 'R',
    '\u1E5A': 'R',
    '\u1E5C': 'R',
    '\u0156': 'R',
    '\u1E5E': 'R',
    '\u024C': 'R',
    '\u2C64': 'R',
    '\uA75A': 'R',
    '\uA7A6': 'R',
    '\uA782': 'R',
    '\u24C8': 'S',
    '\uFF33': 'S',
    '\u1E9E': 'S',
    '\u015A': 'S',
    '\u1E64': 'S',
    '\u015C': 'S',
    '\u1E60': 'S',
    '\u0160': 'S',
    '\u1E66': 'S',
    '\u1E62': 'S',
    '\u1E68': 'S',
    '\u0218': 'S',
    '\u015E': 'S',
    '\u2C7E': 'S',
    '\uA7A8': 'S',
    '\uA784': 'S',
    '\u24C9': 'T',
    '\uFF34': 'T',
    '\u1E6A': 'T',
    '\u0164': 'T',
    '\u1E6C': 'T',
    '\u021A': 'T',
    '\u0162': 'T',
    '\u1E70': 'T',
    '\u1E6E': 'T',
    '\u0166': 'T',
    '\u01AC': 'T',
    '\u01AE': 'T',
    '\u023E': 'T',
    '\uA786': 'T',
    '\uA728': 'TZ',
    '\u24CA': 'U',
    '\uFF35': 'U',
    '\u00D9': 'U',
    '\u00DA': 'U',
    '\u00DB': 'U',
    '\u0168': 'U',
    '\u1E78': 'U',
    '\u016A': 'U',
    '\u1E7A': 'U',
    '\u016C': 'U',
    '\u00DC': 'U',
    '\u01DB': 'U',
    '\u01D7': 'U',
    '\u01D5': 'U',
    '\u01D9': 'U',
    '\u1EE6': 'U',
    '\u016E': 'U',
    '\u0170': 'U',
    '\u01D3': 'U',
    '\u0214': 'U',
    '\u0216': 'U',
    '\u01AF': 'U',
    '\u1EEA': 'U',
    '\u1EE8': 'U',
    '\u1EEE': 'U',
    '\u1EEC': 'U',
    '\u1EF0': 'U',
    '\u1EE4': 'U',
    '\u1E72': 'U',
    '\u0172': 'U',
    '\u1E76': 'U',
    '\u1E74': 'U',
    '\u0244': 'U',
    '\u24CB': 'V',
    '\uFF36': 'V',
    '\u1E7C': 'V',
    '\u1E7E': 'V',
    '\u01B2': 'V',
    '\uA75E': 'V',
    '\u0245': 'V',
    '\uA760': 'VY',
    '\u24CC': 'W',
    '\uFF37': 'W',
    '\u1E80': 'W',
    '\u1E82': 'W',
    '\u0174': 'W',
    '\u1E86': 'W',
    '\u1E84': 'W',
    '\u1E88': 'W',
    '\u2C72': 'W',
    '\u24CD': 'X',
    '\uFF38': 'X',
    '\u1E8A': 'X',
    '\u1E8C': 'X',
    '\u24CE': 'Y',
    '\uFF39': 'Y',
    '\u1EF2': 'Y',
    '\u00DD': 'Y',
    '\u0176': 'Y',
    '\u1EF8': 'Y',
    '\u0232': 'Y',
    '\u1E8E': 'Y',
    '\u0178': 'Y',
    '\u1EF6': 'Y',
    '\u1EF4': 'Y',
    '\u01B3': 'Y',
    '\u024E': 'Y',
    '\u1EFE': 'Y',
    '\u24CF': 'Z',
    '\uFF3A': 'Z',
    '\u0179': 'Z',
    '\u1E90': 'Z',
    '\u017B': 'Z',
    '\u017D': 'Z',
    '\u1E92': 'Z',
    '\u1E94': 'Z',
    '\u01B5': 'Z',
    '\u0224': 'Z',
    '\u2C7F': 'Z',
    '\u2C6B': 'Z',
    '\uA762': 'Z',
    '\u24D0': 'a',
    '\uFF41': 'a',
    '\u1E9A': 'a',
    '\u00E0': 'a',
    '\u00E1': 'a',
    '\u00E2': 'a',
    '\u1EA7': 'a',
    '\u1EA5': 'a',
    '\u1EAB': 'a',
    '\u1EA9': 'a',
    '\u00E3': 'a',
    '\u0101': 'a',
    '\u0103': 'a',
    '\u1EB1': 'a',
    '\u1EAF': 'a',
    '\u1EB5': 'a',
    '\u1EB3': 'a',
    '\u0227': 'a',
    '\u01E1': 'a',
    '\u00E4': 'a',
    '\u01DF': 'a',
    '\u1EA3': 'a',
    '\u00E5': 'a',
    '\u01FB': 'a',
    '\u01CE': 'a',
    '\u0201': 'a',
    '\u0203': 'a',
    '\u1EA1': 'a',
    '\u1EAD': 'a',
    '\u1EB7': 'a',
    '\u1E01': 'a',
    '\u0105': 'a',
    '\u2C65': 'a',
    '\u0250': 'a',
    '\uA733': 'aa',
    '\u00E6': 'ae',
    '\u01FD': 'ae',
    '\u01E3': 'ae',
    '\uA735': 'ao',
    '\uA737': 'au',
    '\uA739': 'av',
    '\uA73B': 'av',
    '\uA73D': 'ay',
    '\u24D1': 'b',
    '\uFF42': 'b',
    '\u1E03': 'b',
    '\u1E05': 'b',
    '\u1E07': 'b',
    '\u0180': 'b',
    '\u0183': 'b',
    '\u0253': 'b',
    '\u24D2': 'c',
    '\uFF43': 'c',
    '\u0107': 'c',
    '\u0109': 'c',
    '\u010B': 'c',
    '\u010D': 'c',
    '\u00E7': 'c',
    '\u1E09': 'c',
    '\u0188': 'c',
    '\u023C': 'c',
    '\uA73F': 'c',
    '\u2184': 'c',
    '\u24D3': 'd',
    '\uFF44': 'd',
    '\u1E0B': 'd',
    '\u010F': 'd',
    '\u1E0D': 'd',
    '\u1E11': 'd',
    '\u1E13': 'd',
    '\u1E0F': 'd',
    '\u0111': 'd',
    '\u018C': 'd',
    '\u0256': 'd',
    '\u0257': 'd',
    '\uA77A': 'd',
    '\u01F3': 'dz',
    '\u01C6': 'dz',
    '\u24D4': 'e',
    '\uFF45': 'e',
    '\u00E8': 'e',
    '\u00E9': 'e',
    '\u00EA': 'e',
    '\u1EC1': 'e',
    '\u1EBF': 'e',
    '\u1EC5': 'e',
    '\u1EC3': 'e',
    '\u1EBD': 'e',
    '\u0113': 'e',
    '\u1E15': 'e',
    '\u1E17': 'e',
    '\u0115': 'e',
    '\u0117': 'e',
    '\u00EB': 'e',
    '\u1EBB': 'e',
    '\u011B': 'e',
    '\u0205': 'e',
    '\u0207': 'e',
    '\u1EB9': 'e',
    '\u1EC7': 'e',
    '\u0229': 'e',
    '\u1E1D': 'e',
    '\u0119': 'e',
    '\u1E19': 'e',
    '\u1E1B': 'e',
    '\u0247': 'e',
    '\u025B': 'e',
    '\u01DD': 'e',
    '\u24D5': 'f',
    '\uFF46': 'f',
    '\u1E1F': 'f',
    '\u0192': 'f',
    '\uA77C': 'f',
    '\u24D6': 'g',
    '\uFF47': 'g',
    '\u01F5': 'g',
    '\u011D': 'g',
    '\u1E21': 'g',
    '\u011F': 'g',
    '\u0121': 'g',
    '\u01E7': 'g',
    '\u0123': 'g',
    '\u01E5': 'g',
    '\u0260': 'g',
    '\uA7A1': 'g',
    '\u1D79': 'g',
    '\uA77F': 'g',
    '\u24D7': 'h',
    '\uFF48': 'h',
    '\u0125': 'h',
    '\u1E23': 'h',
    '\u1E27': 'h',
    '\u021F': 'h',
    '\u1E25': 'h',
    '\u1E29': 'h',
    '\u1E2B': 'h',
    '\u1E96': 'h',
    '\u0127': 'h',
    '\u2C68': 'h',
    '\u2C76': 'h',
    '\u0265': 'h',
    '\u0195': 'hv',
    '\u24D8': 'i',
    '\uFF49': 'i',
    '\u00EC': 'i',
    '\u00ED': 'i',
    '\u00EE': 'i',
    '\u0129': 'i',
    '\u012B': 'i',
    '\u012D': 'i',
    '\u00EF': 'i',
    '\u1E2F': 'i',
    '\u1EC9': 'i',
    '\u01D0': 'i',
    '\u0209': 'i',
    '\u020B': 'i',
    '\u1ECB': 'i',
    '\u012F': 'i',
    '\u1E2D': 'i',
    '\u0268': 'i',
    '\u0131': 'i',
    '\u24D9': 'j',
    '\uFF4A': 'j',
    '\u0135': 'j',
    '\u01F0': 'j',
    '\u0249': 'j',
    '\u24DA': 'k',
    '\uFF4B': 'k',
    '\u1E31': 'k',
    '\u01E9': 'k',
    '\u1E33': 'k',
    '\u0137': 'k',
    '\u1E35': 'k',
    '\u0199': 'k',
    '\u2C6A': 'k',
    '\uA741': 'k',
    '\uA743': 'k',
    '\uA745': 'k',
    '\uA7A3': 'k',
    '\u24DB': 'l',
    '\uFF4C': 'l',
    '\u0140': 'l',
    '\u013A': 'l',
    '\u013E': 'l',
    '\u1E37': 'l',
    '\u1E39': 'l',
    '\u013C': 'l',
    '\u1E3D': 'l',
    '\u1E3B': 'l',
    '\u017F': 'l',
    '\u0142': 'l',
    '\u019A': 'l',
    '\u026B': 'l',
    '\u2C61': 'l',
    '\uA749': 'l',
    '\uA781': 'l',
    '\uA747': 'l',
    '\u01C9': 'lj',
    '\u24DC': 'm',
    '\uFF4D': 'm',
    '\u1E3F': 'm',
    '\u1E41': 'm',
    '\u1E43': 'm',
    '\u0271': 'm',
    '\u026F': 'm',
    '\u24DD': 'n',
    '\uFF4E': 'n',
    '\u01F9': 'n',
    '\u0144': 'n',
    '\u00F1': 'n',
    '\u1E45': 'n',
    '\u0148': 'n',
    '\u1E47': 'n',
    '\u0146': 'n',
    '\u1E4B': 'n',
    '\u1E49': 'n',
    '\u019E': 'n',
    '\u0272': 'n',
    '\u0149': 'n',
    '\uA791': 'n',
    '\uA7A5': 'n',
    '\u01CC': 'nj',
    '\u24DE': 'o',
    '\uFF4F': 'o',
    '\u00F2': 'o',
    '\u00F3': 'o',
    '\u00F4': 'o',
    '\u1ED3': 'o',
    '\u1ED1': 'o',
    '\u1ED7': 'o',
    '\u1ED5': 'o',
    '\u00F5': 'o',
    '\u1E4D': 'o',
    '\u022D': 'o',
    '\u1E4F': 'o',
    '\u014D': 'o',
    '\u1E51': 'o',
    '\u1E53': 'o',
    '\u014F': 'o',
    '\u022F': 'o',
    '\u0231': 'o',
    '\u00F6': 'o',
    '\u022B': 'o',
    '\u1ECF': 'o',
    '\u0151': 'o',
    '\u01D2': 'o',
    '\u020D': 'o',
    '\u020F': 'o',
    '\u01A1': 'o',
    '\u1EDD': 'o',
    '\u1EDB': 'o',
    '\u1EE1': 'o',
    '\u1EDF': 'o',
    '\u1EE3': 'o',
    '\u1ECD': 'o',
    '\u1ED9': 'o',
    '\u01EB': 'o',
    '\u01ED': 'o',
    '\u00F8': 'o',
    '\u01FF': 'o',
    '\u0254': 'o',
    '\uA74B': 'o',
    '\uA74D': 'o',
    '\u0275': 'o',
    '\u0153': 'oe',
    '\u01A3': 'oi',
    '\u0223': 'ou',
    '\uA74F': 'oo',
    '\u24DF': 'p',
    '\uFF50': 'p',
    '\u1E55': 'p',
    '\u1E57': 'p',
    '\u01A5': 'p',
    '\u1D7D': 'p',
    '\uA751': 'p',
    '\uA753': 'p',
    '\uA755': 'p',
    '\u24E0': 'q',
    '\uFF51': 'q',
    '\u024B': 'q',
    '\uA757': 'q',
    '\uA759': 'q',
    '\u24E1': 'r',
    '\uFF52': 'r',
    '\u0155': 'r',
    '\u1E59': 'r',
    '\u0159': 'r',
    '\u0211': 'r',
    '\u0213': 'r',
    '\u1E5B': 'r',
    '\u1E5D': 'r',
    '\u0157': 'r',
    '\u1E5F': 'r',
    '\u024D': 'r',
    '\u027D': 'r',
    '\uA75B': 'r',
    '\uA7A7': 'r',
    '\uA783': 'r',
    '\u24E2': 's',
    '\uFF53': 's',
    '\u00DF': 's',
    '\u015B': 's',
    '\u1E65': 's',
    '\u015D': 's',
    '\u1E61': 's',
    '\u0161': 's',
    '\u1E67': 's',
    '\u1E63': 's',
    '\u1E69': 's',
    '\u0219': 's',
    '\u015F': 's',
    '\u023F': 's',
    '\uA7A9': 's',
    '\uA785': 's',
    '\u1E9B': 's',
    '\u24E3': 't',
    '\uFF54': 't',
    '\u1E6B': 't',
    '\u1E97': 't',
    '\u0165': 't',
    '\u1E6D': 't',
    '\u021B': 't',
    '\u0163': 't',
    '\u1E71': 't',
    '\u1E6F': 't',
    '\u0167': 't',
    '\u01AD': 't',
    '\u0288': 't',
    '\u2C66': 't',
    '\uA787': 't',
    '\uA729': 'tz',
    '\u24E4': 'u',
    '\uFF55': 'u',
    '\u00F9': 'u',
    '\u00FA': 'u',
    '\u00FB': 'u',
    '\u0169': 'u',
    '\u1E79': 'u',
    '\u016B': 'u',
    '\u1E7B': 'u',
    '\u016D': 'u',
    '\u00FC': 'u',
    '\u01DC': 'u',
    '\u01D8': 'u',
    '\u01D6': 'u',
    '\u01DA': 'u',
    '\u1EE7': 'u',
    '\u016F': 'u',
    '\u0171': 'u',
    '\u01D4': 'u',
    '\u0215': 'u',
    '\u0217': 'u',
    '\u01B0': 'u',
    '\u1EEB': 'u',
    '\u1EE9': 'u',
    '\u1EEF': 'u',
    '\u1EED': 'u',
    '\u1EF1': 'u',
    '\u1EE5': 'u',
    '\u1E73': 'u',
    '\u0173': 'u',
    '\u1E77': 'u',
    '\u1E75': 'u',
    '\u0289': 'u',
    '\u24E5': 'v',
    '\uFF56': 'v',
    '\u1E7D': 'v',
    '\u1E7F': 'v',
    '\u028B': 'v',
    '\uA75F': 'v',
    '\u028C': 'v',
    '\uA761': 'vy',
    '\u24E6': 'w',
    '\uFF57': 'w',
    '\u1E81': 'w',
    '\u1E83': 'w',
    '\u0175': 'w',
    '\u1E87': 'w',
    '\u1E85': 'w',
    '\u1E98': 'w',
    '\u1E89': 'w',
    '\u2C73': 'w',
    '\u24E7': 'x',
    '\uFF58': 'x',
    '\u1E8B': 'x',
    '\u1E8D': 'x',
    '\u24E8': 'y',
    '\uFF59': 'y',
    '\u1EF3': 'y',
    '\u00FD': 'y',
    '\u0177': 'y',
    '\u1EF9': 'y',
    '\u0233': 'y',
    '\u1E8F': 'y',
    '\u00FF': 'y',
    '\u1EF7': 'y',
    '\u1E99': 'y',
    '\u1EF5': 'y',
    '\u01B4': 'y',
    '\u024F': 'y',
    '\u1EFF': 'y',
    '\u24E9': 'z',
    '\uFF5A': 'z',
    '\u017A': 'z',
    '\u1E91': 'z',
    '\u017C': 'z',
    '\u017E': 'z',
    '\u1E93': 'z',
    '\u1E95': 'z',
    '\u01B6': 'z',
    '\u0225': 'z',
    '\u0240': 'z',
    '\u2C6C': 'z',
    '\uA763': 'z',
    '\u0386': '\u0391',
    '\u0388': '\u0395',
    '\u0389': '\u0397',
    '\u038A': '\u0399',
    '\u03AA': '\u0399',
    '\u038C': '\u039F',
    '\u038E': '\u03A5',
    '\u03AB': '\u03A5',
    '\u038F': '\u03A9',
    '\u03AC': '\u03B1',
    '\u03AD': '\u03B5',
    '\u03AE': '\u03B7',
    '\u03AF': '\u03B9',
    '\u03CA': '\u03B9',
    '\u0390': '\u03B9',
    '\u03CC': '\u03BF',
    '\u03CD': '\u03C5',
    '\u03CB': '\u03C5',
    '\u03B0': '\u03C5',
    '\u03CE': '\u03C9',
    '\u03C2': '\u03C3',
    '\u2019': '\''
  };

  return diacritics;
});

S2.define('select2/data/base',[
  '../utils'
], function (Utils) {
  function BaseAdapter ($element, options) {
    BaseAdapter.__super__.constructor.call(this);
  }

  Utils.Extend(BaseAdapter, Utils.Observable);

  BaseAdapter.prototype.current = function (callback) {
    throw new Error('The `current` method must be defined in child classes.');
  };

  BaseAdapter.prototype.query = function (params, callback) {
    throw new Error('The `query` method must be defined in child classes.');
  };

  BaseAdapter.prototype.bind = function (container, $container) {
    // Can be implemented in subclasses
  };

  BaseAdapter.prototype.destroy = function () {
    // Can be implemented in subclasses
  };

  BaseAdapter.prototype.generateResultId = function (container, data) {
    var id = container.id + '-result-';

    id += Utils.generateChars(4);

    if (data.id != null) {
      id += '-' + data.id.toString();
    } else {
      id += '-' + Utils.generateChars(4);
    }
    return id;
  };

  return BaseAdapter;
});

S2.define('select2/data/select',[
  './base',
  '../utils',
  'jquery'
], function (BaseAdapter, Utils, $) {
  function SelectAdapter ($element, options) {
    this.$element = $element;
    this.options = options;

    SelectAdapter.__super__.constructor.call(this);
  }

  Utils.Extend(SelectAdapter, BaseAdapter);

  SelectAdapter.prototype.current = function (callback) {
    var data = [];
    var self = this;

    this.$element.find(':selected').each(function () {
      var $option = $(this);

      var option = self.item($option);

      data.push(option);
    });

    callback(data);
  };

  SelectAdapter.prototype.select = function (data) {
    var self = this;

    data.selected = true;

    // If data.element is a DOM node, use it instead
    if ($(data.element).is('option')) {
      data.element.selected = true;

      this.$element.trigger('input').trigger('change');

      return;
    }

    if (this.$element.prop('multiple')) {
      this.current(function (currentData) {
        var val = [];

        data = [data];
        data.push.apply(data, currentData);

        for (var d = 0; d < data.length; d++) {
          var id = data[d].id;

          if ($.inArray(id, val) === -1) {
            val.push(id);
          }
        }

        self.$element.val(val);
        self.$element.trigger('input').trigger('change');
      });
    } else {
      var val = data.id;

      this.$element.val(val);
      this.$element.trigger('input').trigger('change');
    }
  };

  SelectAdapter.prototype.unselect = function (data) {
    var self = this;

    if (!this.$element.prop('multiple')) {
      return;
    }

    data.selected = false;

    if ($(data.element).is('option')) {
      data.element.selected = false;

      this.$element.trigger('input').trigger('change');

      return;
    }

    this.current(function (currentData) {
      var val = [];

      for (var d = 0; d < currentData.length; d++) {
        var id = currentData[d].id;

        if (id !== data.id && $.inArray(id, val) === -1) {
          val.push(id);
        }
      }

      self.$element.val(val);

      self.$element.trigger('input').trigger('change');
    });
  };

  SelectAdapter.prototype.bind = function (container, $container) {
    var self = this;

    this.container = container;

    container.on('select', function (params) {
      self.select(params.data);
    });

    container.on('unselect', function (params) {
      self.unselect(params.data);
    });
  };

  SelectAdapter.prototype.destroy = function () {
    // Remove anything added to child elements
    this.$element.find('*').each(function () {
      // Remove any custom data set by Select2
      Utils.RemoveData(this);
    });
  };

  SelectAdapter.prototype.query = function (params, callback) {
    var data = [];
    var self = this;

    var $options = this.$element.children();

    $options.each(function () {
      var $option = $(this);

      if (!$option.is('option') && !$option.is('optgroup')) {
        return;
      }

      var option = self.item($option);

      var matches = self.matches(params, option);

      if (matches !== null) {
        data.push(matches);
      }
    });

    callback({
      results: data
    });
  };

  SelectAdapter.prototype.addOptions = function ($options) {
    Utils.appendMany(this.$element, $options);
  };

  SelectAdapter.prototype.option = function (data) {
    var option;

    if (data.children) {
      option = document.createElement('optgroup');
      option.label = data.text;
    } else {
      option = document.createElement('option');

      if (option.textContent !== undefined) {
        option.textContent = data.text;
      } else {
        option.innerText = data.text;
      }
    }

    if (data.id !== undefined) {
      option.value = data.id;
    }

    if (data.disabled) {
      option.disabled = true;
    }

    if (data.selected) {
      option.selected = true;
    }

    if (data.title) {
      option.title = data.title;
    }

    var $option = $(option);

    var normalizedData = this._normalizeItem(data);
    normalizedData.element = option;

    // Override the option's data with the combined data
    Utils.StoreData(option, 'data', normalizedData);

    return $option;
  };

  SelectAdapter.prototype.item = function ($option) {
    var data = {};

    data = Utils.GetData($option[0], 'data');

    if (data != null) {
      return data;
    }

    if ($option.is('option')) {
      data = {
        id: $option.val(),
        text: $option.text(),
        disabled: $option.prop('disabled'),
        selected: $option.prop('selected'),
        title: $option.prop('title')
      };
    } else if ($option.is('optgroup')) {
      data = {
        text: $option.prop('label'),
        children: [],
        title: $option.prop('title')
      };

      var $children = $option.children('option');
      var children = [];

      for (var c = 0; c < $children.length; c++) {
        var $child = $($children[c]);

        var child = this.item($child);

        children.push(child);
      }

      data.children = children;
    }

    data = this._normalizeItem(data);
    data.element = $option[0];

    Utils.StoreData($option[0], 'data', data);

    return data;
  };

  SelectAdapter.prototype._normalizeItem = function (item) {
    if (item !== Object(item)) {
      item = {
        id: item,
        text: item
      };
    }

    item = $.extend({}, {
      text: ''
    }, item);

    var defaults = {
      selected: false,
      disabled: false
    };

    if (item.id != null) {
      item.id = item.id.toString();
    }

    if (item.text != null) {
      item.text = item.text.toString();
    }

    if (item._resultId == null && item.id && this.container != null) {
      item._resultId = this.generateResultId(this.container, item);
    }

    return $.extend({}, defaults, item);
  };

  SelectAdapter.prototype.matches = function (params, data) {
    var matcher = this.options.get('matcher');

    return matcher(params, data);
  };

  return SelectAdapter;
});

S2.define('select2/data/array',[
  './select',
  '../utils',
  'jquery'
], function (SelectAdapter, Utils, $) {
  function ArrayAdapter ($element, options) {
    this._dataToConvert = options.get('data') || [];

    ArrayAdapter.__super__.constructor.call(this, $element, options);
  }

  Utils.Extend(ArrayAdapter, SelectAdapter);

  ArrayAdapter.prototype.bind = function (container, $container) {
    ArrayAdapter.__super__.bind.call(this, container, $container);

    this.addOptions(this.convertToOptions(this._dataToConvert));
  };

  ArrayAdapter.prototype.select = function (data) {
    var $option = this.$element.find('option').filter(function (i, elm) {
      return elm.value == data.id.toString();
    });

    if ($option.length === 0) {
      $option = this.option(data);

      this.addOptions($option);
    }

    ArrayAdapter.__super__.select.call(this, data);
  };

  ArrayAdapter.prototype.convertToOptions = function (data) {
    var self = this;

    var $existing = this.$element.find('option');
    var existingIds = $existing.map(function () {
      return self.item($(this)).id;
    }).get();

    var $options = [];

    // Filter out all items except for the one passed in the argument
    function onlyItem (item) {
      return function () {
        return $(this).val() == item.id;
      };
    }

    for (var d = 0; d < data.length; d++) {
      var item = this._normalizeItem(data[d]);

      // Skip items which were pre-loaded, only merge the data
      if ($.inArray(item.id, existingIds) >= 0) {
        var $existingOption = $existing.filter(onlyItem(item));

        var existingData = this.item($existingOption);
        var newData = $.extend(true, {}, item, existingData);

        var $newOption = this.option(newData);

        $existingOption.replaceWith($newOption);

        continue;
      }

      var $option = this.option(item);

      if (item.children) {
        var $children = this.convertToOptions(item.children);

        Utils.appendMany($option, $children);
      }

      $options.push($option);
    }

    return $options;
  };

  return ArrayAdapter;
});

S2.define('select2/data/ajax',[
  './array',
  '../utils',
  'jquery'
], function (ArrayAdapter, Utils, $) {
  function AjaxAdapter ($element, options) {
    this.ajaxOptions = this._applyDefaults(options.get('ajax'));

    if (this.ajaxOptions.processResults != null) {
      this.processResults = this.ajaxOptions.processResults;
    }

    AjaxAdapter.__super__.constructor.call(this, $element, options);
  }

  Utils.Extend(AjaxAdapter, ArrayAdapter);

  AjaxAdapter.prototype._applyDefaults = function (options) {
    var defaults = {
      data: function (params) {
        return $.extend({}, params, {
          q: params.term
        });
      },
      transport: function (params, success, failure) {
        var $request = $.ajax(params);

        $request.then(success);
        $request.fail(failure);

        return $request;
      }
    };

    return $.extend({}, defaults, options, true);
  };

  AjaxAdapter.prototype.processResults = function (results) {
    return results;
  };

  AjaxAdapter.prototype.query = function (params, callback) {
    var matches = [];
    var self = this;

    if (this._request != null) {
      // JSONP requests cannot always be aborted
      if ($.isFunction(this._request.abort)) {
        this._request.abort();
      }

      this._request = null;
    }

    var options = $.extend({
      type: 'GET'
    }, this.ajaxOptions);

    if (typeof options.url === 'function') {
      options.url = options.url.call(this.$element, params);
    }

    if (typeof options.data === 'function') {
      options.data = options.data.call(this.$element, params);
    }

    function request () {
      var $request = options.transport(options, function (data) {
        var results = self.processResults(data, params);

        if (self.options.get('debug') && window.console && console.error) {
          // Check to make sure that the response included a `results` key.
          if (!results || !results.results || !$.isArray(results.results)) {
            console.error(
              'Select2: The AJAX results did not return an array in the ' +
              '`results` key of the response.'
            );
          }
        }

        callback(results);
      }, function () {
        // Attempt to detect if a request was aborted
        // Only works if the transport exposes a status property
        if ('status' in $request &&
            ($request.status === 0 || $request.status === '0')) {
          return;
        }

        self.trigger('results:message', {
          message: 'errorLoading'
        });
      });

      self._request = $request;
    }

    if (this.ajaxOptions.delay && params.term != null) {
      if (this._queryTimeout) {
        window.clearTimeout(this._queryTimeout);
      }

      this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
    } else {
      request();
    }
  };

  return AjaxAdapter;
});

S2.define('select2/data/tags',[
  'jquery'
], function ($) {
  function Tags (decorated, $element, options) {
    var tags = options.get('tags');

    var createTag = options.get('createTag');

    if (createTag !== undefined) {
      this.createTag = createTag;
    }

    var insertTag = options.get('insertTag');

    if (insertTag !== undefined) {
        this.insertTag = insertTag;
    }

    decorated.call(this, $element, options);

    if ($.isArray(tags)) {
      for (var t = 0; t < tags.length; t++) {
        var tag = tags[t];
        var item = this._normalizeItem(tag);

        var $option = this.option(item);

        this.$element.append($option);
      }
    }
  }

  Tags.prototype.query = function (decorated, params, callback) {
    var self = this;

    this._removeOldTags();

    if (params.term == null || params.page != null) {
      decorated.call(this, params, callback);
      return;
    }

    function wrapper (obj, child) {
      var data = obj.results;

      for (var i = 0; i < data.length; i++) {
        var option = data[i];

        var checkChildren = (
          option.children != null &&
          !wrapper({
            results: option.children
          }, true)
        );

        var optionText = (option.text || '').toUpperCase();
        var paramsTerm = (params.term || '').toUpperCase();

        var checkText = optionText === paramsTerm;

        if (checkText || checkChildren) {
          if (child) {
            return false;
          }

          obj.data = data;
          callback(obj);

          return;
        }
      }

      if (child) {
        return true;
      }

      var tag = self.createTag(params);

      if (tag != null) {
        var $option = self.option(tag);
        $option.attr('data-select2-tag', true);

        self.addOptions([$option]);

        self.insertTag(data, tag);
      }

      obj.results = data;

      callback(obj);
    }

    decorated.call(this, params, wrapper);
  };

  Tags.prototype.createTag = function (decorated, params) {
    var term = $.trim(params.term);

    if (term === '') {
      return null;
    }

    return {
      id: term,
      text: term
    };
  };

  Tags.prototype.insertTag = function (_, data, tag) {
    data.unshift(tag);
  };

  Tags.prototype._removeOldTags = function (_) {
    var $options = this.$element.find('option[data-select2-tag]');

    $options.each(function () {
      if (this.selected) {
        return;
      }

      $(this).remove();
    });
  };

  return Tags;
});

S2.define('select2/data/tokenizer',[
  'jquery'
], function ($) {
  function Tokenizer (decorated, $element, options) {
    var tokenizer = options.get('tokenizer');

    if (tokenizer !== undefined) {
      this.tokenizer = tokenizer;
    }

    decorated.call(this, $element, options);
  }

  Tokenizer.prototype.bind = function (decorated, container, $container) {
    decorated.call(this, container, $container);

    this.$search =  container.dropdown.$search || container.selection.$search ||
      $container.find('.select2-search__field');
  };

  Tokenizer.prototype.query = function (decorated, params, callback) {
    var self = this;

    function createAndSelect (data) {
      // Normalize the data object so we can use it for checks
      var item = self._normalizeItem(data);

      // Check if the data object already exists as a tag
      // Select it if it doesn't
      var $existingOptions = self.$element.find('option').filter(function () {
        return $(this).val() === item.id;
      });

      // If an existing option wasn't found for it, create the option
      if (!$existingOptions.length) {
        var $option = self.option(item);
        $option.attr('data-select2-tag', true);

        self._removeOldTags();
        self.addOptions([$option]);
      }

      // Select the item, now that we know there is an option for it
      select(item);
    }

    function select (data) {
      self.trigger('select', {
        data: data
      });
    }

    params.term = params.term || '';

    var tokenData = this.tokenizer(params, this.options, createAndSelect);

    if (tokenData.term !== params.term) {
      // Replace the search term if we have the search box
      if (this.$search.length) {
        this.$search.val(tokenData.term);
        this.$search.trigger('focus');
      }

      params.term = tokenData.term;
    }

    decorated.call(this, params, callback);
  };

  Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
    var separators = options.get('tokenSeparators') || [];
    var term = params.term;
    var i = 0;

    var createTag = this.createTag || function (params) {
      return {
        id: params.term,
        text: params.term
      };
    };

    while (i < term.length) {
      var termChar = term[i];

      if ($.inArray(termChar, separators) === -1) {
        i++;

        continue;
      }

      var part = term.substr(0, i);
      var partParams = $.extend({}, params, {
        term: part
      });

      var data = createTag(partParams);

      if (data == null) {
        i++;
        continue;
      }

      callback(data);

      // Reset the term to not include the tokenized portion
      term = term.substr(i + 1) || '';
      i = 0;
    }

    return {
      term: term
    };
  };

  return Tokenizer;
});

S2.define('select2/data/minimumInputLength',[

], function () {
  function MinimumInputLength (decorated, $e, options) {
    this.minimumInputLength = options.get('minimumInputLength');

    decorated.call(this, $e, options);
  }

  MinimumInputLength.prototype.query = function (decorated, params, callback) {
    params.term = params.term || '';

    if (params.term.length < this.minimumInputLength) {
      this.trigger('results:message', {
        message: 'inputTooShort',
        args: {
          minimum: this.minimumInputLength,
          input: params.term,
          params: params
        }
      });

      return;
    }

    decorated.call(this, params, callback);
  };

  return MinimumInputLength;
});

S2.define('select2/data/maximumInputLength',[

], function () {
  function MaximumInputLength (decorated, $e, options) {
    this.maximumInputLength = options.get('maximumInputLength');

    decorated.call(this, $e, options);
  }

  MaximumInputLength.prototype.query = function (decorated, params, callback) {
    params.term = params.term || '';

    if (this.maximumInputLength > 0 &&
        params.term.length > this.maximumInputLength) {
      this.trigger('results:message', {
        message: 'inputTooLong',
        args: {
          maximum: this.maximumInputLength,
          input: params.term,
          params: params
        }
      });

      return;
    }

    decorated.call(this, params, callback);
  };

  return MaximumInputLength;
});

S2.define('select2/data/maximumSelectionLength',[

], function (){
  function MaximumSelectionLength (decorated, $e, options) {
    this.maximumSelectionLength = options.get('maximumSelectionLength');

    decorated.call(this, $e, options);
  }

  MaximumSelectionLength.prototype.bind =
    function (decorated, container, $container) {
      var self = this;

      decorated.call(this, container, $container);

      container.on('select', function () {
        self._checkIfMaximumSelected();
      });
  };

  MaximumSelectionLength.prototype.query =
    function (decorated, params, callback) {
      var self = this;

      this._checkIfMaximumSelected(function () {
        decorated.call(self, params, callback);
      });
  };

  MaximumSelectionLength.prototype._checkIfMaximumSelected =
    function (_, successCallback) {
      var self = this;

      this.current(function (currentData) {
        var count = currentData != null ? currentData.length : 0;
        if (self.maximumSelectionLength > 0 &&
          count >= self.maximumSelectionLength) {
          self.trigger('results:message', {
            message: 'maximumSelected',
            args: {
              maximum: self.maximumSelectionLength
            }
          });
          return;
        }

        if (successCallback) {
          successCallback();
        }
      });
  };

  return MaximumSelectionLength;
});

S2.define('select2/dropdown',[
  'jquery',
  './utils'
], function ($, Utils) {
  function Dropdown ($element, options) {
    this.$element = $element;
    this.options = options;

    Dropdown.__super__.constructor.call(this);
  }

  Utils.Extend(Dropdown, Utils.Observable);

  Dropdown.prototype.render = function () {
    var $dropdown = $(
      '<span class="select2-dropdown">' +
        '<span class="select2-results"></span>' +
      '</span>'
    );

    $dropdown.attr('dir', this.options.get('dir'));

    this.$dropdown = $dropdown;

    return $dropdown;
  };

  Dropdown.prototype.bind = function () {
    // Should be implemented in subclasses
  };

  Dropdown.prototype.position = function ($dropdown, $container) {
    // Should be implemented in subclasses
  };

  Dropdown.prototype.destroy = function () {
    // Remove the dropdown from the DOM
    this.$dropdown.remove();
  };

  return Dropdown;
});

S2.define('select2/dropdown/search',[
  'jquery',
  '../utils'
], function ($, Utils) {
  function Search () { }

  Search.prototype.render = function (decorated) {
    var $rendered = decorated.call(this);

    var $search = $(
      '<span class="select2-search select2-search--dropdown">' +
        '<input class="select2-search__field" type="search" tabindex="-1"' +
        ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
        ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
      '</span>'
    );

    this.$searchContainer = $search;
    this.$search = $search.find('input');

    $rendered.prepend($search);

    return $rendered;
  };

  Search.prototype.bind = function (decorated, container, $container) {
    var self = this;

    var resultsId = container.id + '-results';

    decorated.call(this, container, $container);

    this.$search.on('keydown', function (evt) {
      self.trigger('keypress', evt);

      self._keyUpPrevented = evt.isDefaultPrevented();
    });

    // Workaround for browsers which do not support the `input` event
    // This will prevent double-triggering of events for browsers which support
    // both the `keyup` and `input` events.
    this.$search.on('input', function (evt) {
      // Unbind the duplicated `keyup` event
      $(this).off('keyup');
    });

    this.$search.on('keyup input', function (evt) {
      self.handleSearch(evt);
    });

    container.on('open', function () {
      self.$search.attr('tabindex', 0);
      self.$search.attr('aria-controls', resultsId);

      self.$search.trigger('focus');

      window.setTimeout(function () {
        self.$search.trigger('focus');
      }, 0);
    });

    container.on('close', function () {
      self.$search.attr('tabindex', -1);
      self.$search.removeAttr('aria-controls');
      self.$search.removeAttr('aria-activedescendant');

      self.$search.val('');
      self.$search.trigger('blur');
    });

    container.on('focus', function () {
      if (!container.isOpen()) {
        self.$search.trigger('focus');
      }
    });

    container.on('results:all', function (params) {
      if (params.query.term == null || params.query.term === '') {
        var showSearch = self.showSearch(params);

        if (showSearch) {
          self.$searchContainer.removeClass('select2-search--hide');
        } else {
          self.$searchContainer.addClass('select2-search--hide');
        }
      }
    });

    container.on('results:focus', function (params) {
      if (params.data._resultId) {
        self.$search.attr('aria-activedescendant', params.data._resultId);
      } else {
        self.$search.removeAttr('aria-activedescendant');
      }
    });
  };

  Search.prototype.handleSearch = function (evt) {
    if (!this._keyUpPrevented) {
      var input = this.$search.val();

      this.trigger('query', {
        term: input
      });
    }

    this._keyUpPrevented = false;
  };

  Search.prototype.showSearch = function (_, params) {
    return true;
  };

  return Search;
});

S2.define('select2/dropdown/hidePlaceholder',[

], function () {
  function HidePlaceholder (decorated, $element, options, dataAdapter) {
    this.placeholder = this.normalizePlaceholder(options.get('placeholder'));

    decorated.call(this, $element, options, dataAdapter);
  }

  HidePlaceholder.prototype.append = function (decorated, data) {
    data.results = this.removePlaceholder(data.results);

    decorated.call(this, data);
  };

  HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
    if (typeof placeholder === 'string') {
      placeholder = {
        id: '',
        text: placeholder
      };
    }

    return placeholder;
  };

  HidePlaceholder.prototype.removePlaceholder = function (_, data) {
    var modifiedData = data.slice(0);

    for (var d = data.length - 1; d >= 0; d--) {
      var item = data[d];

      if (this.placeholder.id === item.id) {
        modifiedData.splice(d, 1);
      }
    }

    return modifiedData;
  };

  return HidePlaceholder;
});

S2.define('select2/dropdown/infiniteScroll',[
  'jquery'
], function ($) {
  function InfiniteScroll (decorated, $element, options, dataAdapter) {
    this.lastParams = {};

    decorated.call(this, $element, options, dataAdapter);

    this.$loadingMore = this.createLoadingMore();
    this.loading = false;
  }

  InfiniteScroll.prototype.append = function (decorated, data) {
    this.$loadingMore.remove();
    this.loading = false;

    decorated.call(this, data);

    if (this.showLoadingMore(data)) {
      this.$results.append(this.$loadingMore);
      this.loadMoreIfNeeded();
    }
  };

  InfiniteScroll.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    container.on('query', function (params) {
      self.lastParams = params;
      self.loading = true;
    });

    container.on('query:append', function (params) {
      self.lastParams = params;
      self.loading = true;
    });

    this.$results.on('scroll', this.loadMoreIfNeeded.bind(this));
  };

  InfiniteScroll.prototype.loadMoreIfNeeded = function () {
    var isLoadMoreVisible = $.contains(
      document.documentElement,
      this.$loadingMore[0]
    );

    if (this.loading || !isLoadMoreVisible) {
      return;
    }

    var currentOffset = this.$results.offset().top +
      this.$results.outerHeight(false);
    var loadingMoreOffset = this.$loadingMore.offset().top +
      this.$loadingMore.outerHeight(false);

    if (currentOffset + 50 >= loadingMoreOffset) {
      this.loadMore();
    }
  };

  InfiniteScroll.prototype.loadMore = function () {
    this.loading = true;

    var params = $.extend({}, {page: 1}, this.lastParams);

    params.page++;

    this.trigger('query:append', params);
  };

  InfiniteScroll.prototype.showLoadingMore = function (_, data) {
    return data.pagination && data.pagination.more;
  };

  InfiniteScroll.prototype.createLoadingMore = function () {
    var $option = $(
      '<li ' +
      'class="select2-results__option select2-results__option--load-more"' +
      'role="option" aria-disabled="true"></li>'
    );

    var message = this.options.get('translations').get('loadingMore');

    $option.html(message(this.lastParams));

    return $option;
  };

  return InfiniteScroll;
});

S2.define('select2/dropdown/attachBody',[
  'jquery',
  '../utils'
], function ($, Utils) {
  function AttachBody (decorated, $element, options) {
    this.$dropdownParent = $(options.get('dropdownParent') || document.body);

    decorated.call(this, $element, options);
  }

  AttachBody.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    container.on('open', function () {
      self._showDropdown();
      self._attachPositioningHandler(container);

      // Must bind after the results handlers to ensure correct sizing
      self._bindContainerResultHandlers(container);
    });

    container.on('close', function () {
      self._hideDropdown();
      self._detachPositioningHandler(container);
    });

    this.$dropdownContainer.on('mousedown', function (evt) {
      evt.stopPropagation();
    });
  };

  AttachBody.prototype.destroy = function (decorated) {
    decorated.call(this);

    this.$dropdownContainer.remove();
  };

  AttachBody.prototype.position = function (decorated, $dropdown, $container) {
    // Clone all of the container classes
    $dropdown.attr('class', $container.attr('class'));

    $dropdown.removeClass('select2');
    $dropdown.addClass('select2-container--open');

    $dropdown.css({
      position: 'absolute',
      top: -999999
    });

    this.$container = $container;
  };

  AttachBody.prototype.render = function (decorated) {
    var $container = $('<span></span>');

    var $dropdown = decorated.call(this);
    $container.append($dropdown);

    this.$dropdownContainer = $container;

    return $container;
  };

  AttachBody.prototype._hideDropdown = function (decorated) {
    this.$dropdownContainer.detach();
  };

  AttachBody.prototype._bindContainerResultHandlers =
      function (decorated, container) {

    // These should only be bound once
    if (this._containerResultsHandlersBound) {
      return;
    }

    var self = this;

    container.on('results:all', function () {
      self._positionDropdown();
      self._resizeDropdown();
    });

    container.on('results:append', function () {
      self._positionDropdown();
      self._resizeDropdown();
    });

    container.on('results:message', function () {
      self._positionDropdown();
      self._resizeDropdown();
    });

    container.on('select', function () {
      self._positionDropdown();
      self._resizeDropdown();
    });

    container.on('unselect', function () {
      self._positionDropdown();
      self._resizeDropdown();
    });

    this._containerResultsHandlersBound = true;
  };

  AttachBody.prototype._attachPositioningHandler =
      function (decorated, container) {
    var self = this;

    var scrollEvent = 'scroll.select2.' + container.id;
    var resizeEvent = 'resize.select2.' + container.id;
    var orientationEvent = 'orientationchange.select2.' + container.id;

    var $watchers = this.$container.parents().filter(Utils.hasScroll);
    $watchers.each(function () {
      Utils.StoreData(this, 'select2-scroll-position', {
        x: $(this).scrollLeft(),
        y: $(this).scrollTop()
      });
    });

    $watchers.on(scrollEvent, function (ev) {
      var position = Utils.GetData(this, 'select2-scroll-position');
      $(this).scrollTop(position.y);
    });

    $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
      function (e) {
      self._positionDropdown();
      self._resizeDropdown();
    });
  };

  AttachBody.prototype._detachPositioningHandler =
      function (decorated, container) {
    var scrollEvent = 'scroll.select2.' + container.id;
    var resizeEvent = 'resize.select2.' + container.id;
    var orientationEvent = 'orientationchange.select2.' + container.id;

    var $watchers = this.$container.parents().filter(Utils.hasScroll);
    $watchers.off(scrollEvent);

    $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
  };

  AttachBody.prototype._positionDropdown = function () {
    var $window = $(window);

    var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
    var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');

    var newDirection = null;

    var offset = this.$container.offset();

    offset.bottom = offset.top + this.$container.outerHeight(false);

    var container = {
      height: this.$container.outerHeight(false)
    };

    container.top = offset.top;
    container.bottom = offset.top + container.height;

    var dropdown = {
      height: this.$dropdown.outerHeight(false)
    };

    var viewport = {
      top: $window.scrollTop(),
      bottom: $window.scrollTop() + $window.height()
    };

    var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
    var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);

    var css = {
      left: offset.left,
      top: container.bottom
    };

    // Determine what the parent element is to use for calculating the offset
    var $offsetParent = this.$dropdownParent;

    // For statically positioned elements, we need to get the element
    // that is determining the offset
    if ($offsetParent.css('position') === 'static') {
      $offsetParent = $offsetParent.offsetParent();
    }

    var parentOffset = {
      top: 0,
      left: 0
    };

    if (
      $.contains(document.body, $offsetParent[0]) ||
      $offsetParent[0].isConnected
      ) {
      parentOffset = $offsetParent.offset();
    }

    css.top -= parentOffset.top;
    css.left -= parentOffset.left;

    if (!isCurrentlyAbove && !isCurrentlyBelow) {
      newDirection = 'below';
    }

    if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
      newDirection = 'above';
    } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
      newDirection = 'below';
    }

    if (newDirection == 'above' ||
      (isCurrentlyAbove && newDirection !== 'below')) {
      css.top = container.top - parentOffset.top - dropdown.height;
    }

    if (newDirection != null) {
      this.$dropdown
        .removeClass('select2-dropdown--below select2-dropdown--above')
        .addClass('select2-dropdown--' + newDirection);
      this.$container
        .removeClass('select2-container--below select2-container--above')
        .addClass('select2-container--' + newDirection);
    }

    this.$dropdownContainer.css(css);
  };

  AttachBody.prototype._resizeDropdown = function () {
    var css = {
      width: this.$container.outerWidth(false) + 'px'
    };

    if (this.options.get('dropdownAutoWidth')) {
      css.minWidth = css.width;
      css.position = 'relative';
      css.width = 'auto';
    }

    this.$dropdown.css(css);
  };

  AttachBody.prototype._showDropdown = function (decorated) {
    this.$dropdownContainer.appendTo(this.$dropdownParent);

    this._positionDropdown();
    this._resizeDropdown();
  };

  return AttachBody;
});

S2.define('select2/dropdown/minimumResultsForSearch',[

], function () {
  function countResults (data) {
    var count = 0;

    for (var d = 0; d < data.length; d++) {
      var item = data[d];

      if (item.children) {
        count += countResults(item.children);
      } else {
        count++;
      }
    }

    return count;
  }

  function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
    this.minimumResultsForSearch = options.get('minimumResultsForSearch');

    if (this.minimumResultsForSearch < 0) {
      this.minimumResultsForSearch = Infinity;
    }

    decorated.call(this, $element, options, dataAdapter);
  }

  MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
    if (countResults(params.data.results) < this.minimumResultsForSearch) {
      return false;
    }

    return decorated.call(this, params);
  };

  return MinimumResultsForSearch;
});

S2.define('select2/dropdown/selectOnClose',[
  '../utils'
], function (Utils) {
  function SelectOnClose () { }

  SelectOnClose.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    container.on('close', function (params) {
      self._handleSelectOnClose(params);
    });
  };

  SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
    if (params && params.originalSelect2Event != null) {
      var event = params.originalSelect2Event;

      // Don't select an item if the close event was triggered from a select or
      // unselect event
      if (event._type === 'select' || event._type === 'unselect') {
        return;
      }
    }

    var $highlightedResults = this.getHighlightedResults();

    // Only select highlighted results
    if ($highlightedResults.length < 1) {
      return;
    }

    var data = Utils.GetData($highlightedResults[0], 'data');

    // Don't re-select already selected resulte
    if (
      (data.element != null && data.element.selected) ||
      (data.element == null && data.selected)
    ) {
      return;
    }

    this.trigger('select', {
        data: data
    });
  };

  return SelectOnClose;
});

S2.define('select2/dropdown/closeOnSelect',[

], function () {
  function CloseOnSelect () { }

  CloseOnSelect.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    container.on('select', function (evt) {
      self._selectTriggered(evt);
    });

    container.on('unselect', function (evt) {
      self._selectTriggered(evt);
    });
  };

  CloseOnSelect.prototype._selectTriggered = function (_, evt) {
    var originalEvent = evt.originalEvent;

    // Don't close if the control key is being held
    if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {
      return;
    }

    this.trigger('close', {
      originalEvent: originalEvent,
      originalSelect2Event: evt
    });
  };

  return CloseOnSelect;
});

S2.define('select2/i18n/en',[],function () {
  // English
  return {
    errorLoading: function () {
      return 'The results could not be loaded.';
    },
    inputTooLong: function (args) {
      var overChars = args.input.length - args.maximum;

      var message = 'Please delete ' + overChars + ' character';

      if (overChars != 1) {
        message += 's';
      }

      return message;
    },
    inputTooShort: function (args) {
      var remainingChars = args.minimum - args.input.length;

      var message = 'Please enter ' + remainingChars + ' or more characters';

      return message;
    },
    loadingMore: function () {
      return 'Loading more results…';
    },
    maximumSelected: function (args) {
      var message = 'You can only select ' + args.maximum + ' item';

      if (args.maximum != 1) {
        message += 's';
      }

      return message;
    },
    noResults: function () {
      return 'No results found';
    },
    searching: function () {
      return 'Searching…';
    },
    removeAllItems: function () {
      return 'Remove all items';
    }
  };
});

S2.define('select2/defaults',[
  'jquery',
  'require',

  './results',

  './selection/single',
  './selection/multiple',
  './selection/placeholder',
  './selection/allowClear',
  './selection/search',
  './selection/eventRelay',

  './utils',
  './translation',
  './diacritics',

  './data/select',
  './data/array',
  './data/ajax',
  './data/tags',
  './data/tokenizer',
  './data/minimumInputLength',
  './data/maximumInputLength',
  './data/maximumSelectionLength',

  './dropdown',
  './dropdown/search',
  './dropdown/hidePlaceholder',
  './dropdown/infiniteScroll',
  './dropdown/attachBody',
  './dropdown/minimumResultsForSearch',
  './dropdown/selectOnClose',
  './dropdown/closeOnSelect',

  './i18n/en'
], function ($, require,

             ResultsList,

             SingleSelection, MultipleSelection, Placeholder, AllowClear,
             SelectionSearch, EventRelay,

             Utils, Translation, DIACRITICS,

             SelectData, ArrayData, AjaxData, Tags, Tokenizer,
             MinimumInputLength, MaximumInputLength, MaximumSelectionLength,

             Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
             AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,

             EnglishTranslation) {
  function Defaults () {
    this.reset();
  }

  Defaults.prototype.apply = function (options) {
    options = $.extend(true, {}, this.defaults, options);

    if (options.dataAdapter == null) {
      if (options.ajax != null) {
        options.dataAdapter = AjaxData;
      } else if (options.data != null) {
        options.dataAdapter = ArrayData;
      } else {
        options.dataAdapter = SelectData;
      }

      if (options.minimumInputLength > 0) {
        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          MinimumInputLength
        );
      }

      if (options.maximumInputLength > 0) {
        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          MaximumInputLength
        );
      }

      if (options.maximumSelectionLength > 0) {
        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          MaximumSelectionLength
        );
      }

      if (options.tags) {
        options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
      }

      if (options.tokenSeparators != null || options.tokenizer != null) {
        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          Tokenizer
        );
      }

      if (options.query != null) {
        var Query = require(options.amdBase + 'compat/query');

        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          Query
        );
      }

      if (options.initSelection != null) {
        var InitSelection = require(options.amdBase + 'compat/initSelection');

        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          InitSelection
        );
      }
    }

    if (options.resultsAdapter == null) {
      options.resultsAdapter = ResultsList;

      if (options.ajax != null) {
        options.resultsAdapter = Utils.Decorate(
          options.resultsAdapter,
          InfiniteScroll
        );
      }

      if (options.placeholder != null) {
        options.resultsAdapter = Utils.Decorate(
          options.resultsAdapter,
          HidePlaceholder
        );
      }

      if (options.selectOnClose) {
        options.resultsAdapter = Utils.Decorate(
          options.resultsAdapter,
          SelectOnClose
        );
      }
    }

    if (options.dropdownAdapter == null) {
      if (options.multiple) {
        options.dropdownAdapter = Dropdown;
      } else {
        var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);

        options.dropdownAdapter = SearchableDropdown;
      }

      if (options.minimumResultsForSearch !== 0) {
        options.dropdownAdapter = Utils.Decorate(
          options.dropdownAdapter,
          MinimumResultsForSearch
        );
      }

      if (options.closeOnSelect) {
        options.dropdownAdapter = Utils.Decorate(
          options.dropdownAdapter,
          CloseOnSelect
        );
      }

      if (
        options.dropdownCssClass != null ||
        options.dropdownCss != null ||
        options.adaptDropdownCssClass != null
      ) {
        var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');

        options.dropdownAdapter = Utils.Decorate(
          options.dropdownAdapter,
          DropdownCSS
        );
      }

      options.dropdownAdapter = Utils.Decorate(
        options.dropdownAdapter,
        AttachBody
      );
    }

    if (options.selectionAdapter == null) {
      if (options.multiple) {
        options.selectionAdapter = MultipleSelection;
      } else {
        options.selectionAdapter = SingleSelection;
      }

      // Add the placeholder mixin if a placeholder was specified
      if (options.placeholder != null) {
        options.selectionAdapter = Utils.Decorate(
          options.selectionAdapter,
          Placeholder
        );
      }

      if (options.allowClear) {
        options.selectionAdapter = Utils.Decorate(
          options.selectionAdapter,
          AllowClear
        );
      }

      if (options.multiple) {
        options.selectionAdapter = Utils.Decorate(
          options.selectionAdapter,
          SelectionSearch
        );
      }

      if (
        options.containerCssClass != null ||
        options.containerCss != null ||
        options.adaptContainerCssClass != null
      ) {
        var ContainerCSS = require(options.amdBase + 'compat/containerCss');

        options.selectionAdapter = Utils.Decorate(
          options.selectionAdapter,
          ContainerCSS
        );
      }

      options.selectionAdapter = Utils.Decorate(
        options.selectionAdapter,
        EventRelay
      );
    }

    // If the defaults were not previously applied from an element, it is
    // possible for the language option to have not been resolved
    options.language = this._resolveLanguage(options.language);

    // Always fall back to English since it will always be complete
    options.language.push('en');

    var uniqueLanguages = [];

    for (var l = 0; l < options.language.length; l++) {
      var language = options.language[l];

      if (uniqueLanguages.indexOf(language) === -1) {
        uniqueLanguages.push(language);
      }
    }

    options.language = uniqueLanguages;

    options.translations = this._processTranslations(
      options.language,
      options.debug
    );

    return options;
  };

  Defaults.prototype.reset = function () {
    function stripDiacritics (text) {
      // Used 'uni range + named function' from http://jsperf.com/diacritics/18
      function match(a) {
        return DIACRITICS[a] || a;
      }

      return text.replace(/[^\u0000-\u007E]/g, match);
    }

    function matcher (params, data) {
      // Always return the object if there is nothing to compare
      if ($.trim(params.term) === '') {
        return data;
      }

      // Do a recursive check for options with children
      if (data.children && data.children.length > 0) {
        // Clone the data object if there are children
        // This is required as we modify the object to remove any non-matches
        var match = $.extend(true, {}, data);

        // Check each child of the option
        for (var c = data.children.length - 1; c >= 0; c--) {
          var child = data.children[c];

          var matches = matcher(params, child);

          // If there wasn't a match, remove the object in the array
          if (matches == null) {
            match.children.splice(c, 1);
          }
        }

        // If any children matched, return the new object
        if (match.children.length > 0) {
          return match;
        }

        // If there were no matching children, check just the plain object
        return matcher(params, match);
      }

      var original = stripDiacritics(data.text).toUpperCase();
      var term = stripDiacritics(params.term).toUpperCase();

      // Check if the text contains the term
      if (original.indexOf(term) > -1) {
        return data;
      }

      // If it doesn't contain the term, don't return anything
      return null;
    }

    this.defaults = {
      amdBase: './',
      amdLanguageBase: './i18n/',
      closeOnSelect: true,
      debug: false,
      dropdownAutoWidth: false,
      escapeMarkup: Utils.escapeMarkup,
      language: {},
      matcher: matcher,
      minimumInputLength: 0,
      maximumInputLength: 0,
      maximumSelectionLength: 0,
      minimumResultsForSearch: 0,
      selectOnClose: false,
      scrollAfterSelect: false,
      sorter: function (data) {
        return data;
      },
      templateResult: function (result) {
        return result.text;
      },
      templateSelection: function (selection) {
        return selection.text;
      },
      theme: 'default',
      width: 'resolve'
    };
  };

  Defaults.prototype.applyFromElement = function (options, $element) {
    var optionLanguage = options.language;
    var defaultLanguage = this.defaults.language;
    var elementLanguage = $element.prop('lang');
    var parentLanguage = $element.closest('[lang]').prop('lang');

    var languages = Array.prototype.concat.call(
      this._resolveLanguage(elementLanguage),
      this._resolveLanguage(optionLanguage),
      this._resolveLanguage(defaultLanguage),
      this._resolveLanguage(parentLanguage)
    );

    options.language = languages;

    return options;
  };

  Defaults.prototype._resolveLanguage = function (language) {
    if (!language) {
      return [];
    }

    if ($.isEmptyObject(language)) {
      return [];
    }

    if ($.isPlainObject(language)) {
      return [language];
    }

    var languages;

    if (!$.isArray(language)) {
      languages = [language];
    } else {
      languages = language;
    }

    var resolvedLanguages = [];

    for (var l = 0; l < languages.length; l++) {
      resolvedLanguages.push(languages[l]);

      if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) {
        // Extract the region information if it is included
        var languageParts = languages[l].split('-');
        var baseLanguage = languageParts[0];

        resolvedLanguages.push(baseLanguage);
      }
    }

    return resolvedLanguages;
  };

  Defaults.prototype._processTranslations = function (languages, debug) {
    var translations = new Translation();

    for (var l = 0; l < languages.length; l++) {
      var languageData = new Translation();

      var language = languages[l];

      if (typeof language === 'string') {
        try {
          // Try to load it with the original name
          languageData = Translation.loadPath(language);
        } catch (e) {
          try {
            // If we couldn't load it, check if it wasn't the full path
            language = this.defaults.amdLanguageBase + language;
            languageData = Translation.loadPath(language);
          } catch (ex) {
            // The translation could not be loaded at all. Sometimes this is
            // because of a configuration problem, other times this can be
            // because of how Select2 helps load all possible translation files
            if (debug && window.console && console.warn) {
              console.warn(
                'Select2: The language file for "' + language + '" could ' +
                'not be automatically loaded. A fallback will be used instead.'
              );
            }
          }
        }
      } else if ($.isPlainObject(language)) {
        languageData = new Translation(language);
      } else {
        languageData = language;
      }

      translations.extend(languageData);
    }

    return translations;
  };

  Defaults.prototype.set = function (key, value) {
    var camelKey = $.camelCase(key);

    var data = {};
    data[camelKey] = value;

    var convertedData = Utils._convertData(data);

    $.extend(true, this.defaults, convertedData);
  };

  var defaults = new Defaults();

  return defaults;
});

S2.define('select2/options',[
  'require',
  'jquery',
  './defaults',
  './utils'
], function (require, $, Defaults, Utils) {
  function Options (options, $element) {
    this.options = options;

    if ($element != null) {
      this.fromElement($element);
    }

    if ($element != null) {
      this.options = Defaults.applyFromElement(this.options, $element);
    }

    this.options = Defaults.apply(this.options);

    if ($element && $element.is('input')) {
      var InputCompat = require(this.get('amdBase') + 'compat/inputData');

      this.options.dataAdapter = Utils.Decorate(
        this.options.dataAdapter,
        InputCompat
      );
    }
  }

  Options.prototype.fromElement = function ($e) {
    var excludedData = ['select2'];

    if (this.options.multiple == null) {
      this.options.multiple = $e.prop('multiple');
    }

    if (this.options.disabled == null) {
      this.options.disabled = $e.prop('disabled');
    }

    if (this.options.dir == null) {
      if ($e.prop('dir')) {
        this.options.dir = $e.prop('dir');
      } else if ($e.closest('[dir]').prop('dir')) {
        this.options.dir = $e.closest('[dir]').prop('dir');
      } else {
        this.options.dir = 'ltr';
      }
    }

    $e.prop('disabled', this.options.disabled);
    $e.prop('multiple', this.options.multiple);

    if (Utils.GetData($e[0], 'select2Tags')) {
      if (this.options.debug && window.console && console.warn) {
        console.warn(
          'Select2: The `data-select2-tags` attribute has been changed to ' +
          'use the `data-data` and `data-tags="true"` attributes and will be ' +
          'removed in future versions of Select2.'
        );
      }

      Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));
      Utils.StoreData($e[0], 'tags', true);
    }

    if (Utils.GetData($e[0], 'ajaxUrl')) {
      if (this.options.debug && window.console && console.warn) {
        console.warn(
          'Select2: The `data-ajax-url` attribute has been changed to ' +
          '`data-ajax--url` and support for the old attribute will be removed' +
          ' in future versions of Select2.'
        );
      }

      $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));
      Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));
    }

    var dataset = {};

    function upperCaseLetter(_, letter) {
      return letter.toUpperCase();
    }

    // Pre-load all of the attributes which are prefixed with `data-`
    for (var attr = 0; attr < $e[0].attributes.length; attr++) {
      var attributeName = $e[0].attributes[attr].name;
      var prefix = 'data-';

      if (attributeName.substr(0, prefix.length) == prefix) {
        // Get the contents of the attribute after `data-`
        var dataName = attributeName.substring(prefix.length);

        // Get the data contents from the consistent source
        // This is more than likely the jQuery data helper
        var dataValue = Utils.GetData($e[0], dataName);

        // camelCase the attribute name to match the spec
        var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);

        // Store the data attribute contents into the dataset since
        dataset[camelDataName] = dataValue;
      }
    }

    // Prefer the element's `dataset` attribute if it exists
    // jQuery 1.x does not correctly handle data attributes with multiple dashes
    if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
      dataset = $.extend(true, {}, $e[0].dataset, dataset);
    }

    // Prefer our internal data cache if it exists
    var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);

    data = Utils._convertData(data);

    for (var key in data) {
      if ($.inArray(key, excludedData) > -1) {
        continue;
      }

      if ($.isPlainObject(this.options[key])) {
        $.extend(this.options[key], data[key]);
      } else {
        this.options[key] = data[key];
      }
    }

    return this;
  };

  Options.prototype.get = function (key) {
    return this.options[key];
  };

  Options.prototype.set = function (key, val) {
    this.options[key] = val;
  };

  return Options;
});

S2.define('select2/core',[
  'jquery',
  './options',
  './utils',
  './keys'
], function ($, Options, Utils, KEYS) {
  var Select2 = function ($element, options) {
    if (Utils.GetData($element[0], 'select2') != null) {
      Utils.GetData($element[0], 'select2').destroy();
    }

    this.$element = $element;

    this.id = this._generateId($element);

    options = options || {};

    this.options = new Options(options, $element);

    Select2.__super__.constructor.call(this);

    // Set up the tabindex

    var tabindex = $element.attr('tabindex') || 0;
    Utils.StoreData($element[0], 'old-tabindex', tabindex);
    $element.attr('tabindex', '-1');

    // Set up containers and adapters

    var DataAdapter = this.options.get('dataAdapter');
    this.dataAdapter = new DataAdapter($element, this.options);

    var $container = this.render();

    this._placeContainer($container);

    var SelectionAdapter = this.options.get('selectionAdapter');
    this.selection = new SelectionAdapter($element, this.options);
    this.$selection = this.selection.render();

    this.selection.position(this.$selection, $container);

    var DropdownAdapter = this.options.get('dropdownAdapter');
    this.dropdown = new DropdownAdapter($element, this.options);
    this.$dropdown = this.dropdown.render();

    this.dropdown.position(this.$dropdown, $container);

    var ResultsAdapter = this.options.get('resultsAdapter');
    this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
    this.$results = this.results.render();

    this.results.position(this.$results, this.$dropdown);

    // Bind events

    var self = this;

    // Bind the container to all of the adapters
    this._bindAdapters();

    // Register any DOM event handlers
    this._registerDomEvents();

    // Register any internal event handlers
    this._registerDataEvents();
    this._registerSelectionEvents();
    this._registerDropdownEvents();
    this._registerResultsEvents();
    this._registerEvents();

    // Set the initial state
    this.dataAdapter.current(function (initialData) {
      self.trigger('selection:update', {
        data: initialData
      });
    });

    // Hide the original select
    $element.addClass('select2-hidden-accessible');
    $element.attr('aria-hidden', 'true');

    // Synchronize any monitored attributes
    this._syncAttributes();

    Utils.StoreData($element[0], 'select2', this);

    // Ensure backwards compatibility with $element.data('select2').
    $element.data('select2', this);
  };

  Utils.Extend(Select2, Utils.Observable);

  Select2.prototype._generateId = function ($element) {
    var id = '';

    if ($element.attr('id') != null) {
      id = $element.attr('id');
    } else if ($element.attr('name') != null) {
      id = $element.attr('name') + '-' + Utils.generateChars(2);
    } else {
      id = Utils.generateChars(4);
    }

    id = id.replace(/(:|\.|\[|\]|,)/g, '');
    id = 'select2-' + id;

    return id;
  };

  Select2.prototype._placeContainer = function ($container) {
    $container.insertAfter(this.$element);

    var width = this._resolveWidth(this.$element, this.options.get('width'));

    if (width != null) {
      $container.css('width', width);
    }
  };

  Select2.prototype._resolveWidth = function ($element, method) {
    var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;

    if (method == 'resolve') {
      var styleWidth = this._resolveWidth($element, 'style');

      if (styleWidth != null) {
        return styleWidth;
      }

      return this._resolveWidth($element, 'element');
    }

    if (method == 'element') {
      var elementWidth = $element.outerWidth(false);

      if (elementWidth <= 0) {
        return 'auto';
      }

      return elementWidth + 'px';
    }

    if (method == 'style') {
      var style = $element.attr('style');

      if (typeof(style) !== 'string') {
        return null;
      }

      var attrs = style.split(';');

      for (var i = 0, l = attrs.length; i < l; i = i + 1) {
        var attr = attrs[i].replace(/\s/g, '');
        var matches = attr.match(WIDTH);

        if (matches !== null && matches.length >= 1) {
          return matches[1];
        }
      }

      return null;
    }

    if (method == 'computedstyle') {
      var computedStyle = window.getComputedStyle($element[0]);

      return computedStyle.width;
    }

    return method;
  };

  Select2.prototype._bindAdapters = function () {
    this.dataAdapter.bind(this, this.$container);
    this.selection.bind(this, this.$container);

    this.dropdown.bind(this, this.$container);
    this.results.bind(this, this.$container);
  };

  Select2.prototype._registerDomEvents = function () {
    var self = this;

    this.$element.on('change.select2', function () {
      self.dataAdapter.current(function (data) {
        self.trigger('selection:update', {
          data: data
        });
      });
    });

    this.$element.on('focus.select2', function (evt) {
      self.trigger('focus', evt);
    });

    this._syncA = Utils.bind(this._syncAttributes, this);
    this._syncS = Utils.bind(this._syncSubtree, this);

    if (this.$element[0].attachEvent) {
      this.$element[0].attachEvent('onpropertychange', this._syncA);
    }

    var observer = window.MutationObserver ||
      window.WebKitMutationObserver ||
      window.MozMutationObserver
    ;

    if (observer != null) {
      this._observer = new observer(function (mutations) {
        self._syncA();
        self._syncS(null, mutations);
      });
      this._observer.observe(this.$element[0], {
        attributes: true,
        childList: true,
        subtree: false
      });
    } else if (this.$element[0].addEventListener) {
      this.$element[0].addEventListener(
        'DOMAttrModified',
        self._syncA,
        false
      );
      this.$element[0].addEventListener(
        'DOMNodeInserted',
        self._syncS,
        false
      );
      this.$element[0].addEventListener(
        'DOMNodeRemoved',
        self._syncS,
        false
      );
    }
  };

  Select2.prototype._registerDataEvents = function () {
    var self = this;

    this.dataAdapter.on('*', function (name, params) {
      self.trigger(name, params);
    });
  };

  Select2.prototype._registerSelectionEvents = function () {
    var self = this;
    var nonRelayEvents = ['toggle', 'focus'];

    this.selection.on('toggle', function () {
      self.toggleDropdown();
    });

    this.selection.on('focus', function (params) {
      self.focus(params);
    });

    this.selection.on('*', function (name, params) {
      if ($.inArray(name, nonRelayEvents) !== -1) {
        return;
      }

      self.trigger(name, params);
    });
  };

  Select2.prototype._registerDropdownEvents = function () {
    var self = this;

    this.dropdown.on('*', function (name, params) {
      self.trigger(name, params);
    });
  };

  Select2.prototype._registerResultsEvents = function () {
    var self = this;

    this.results.on('*', function (name, params) {
      self.trigger(name, params);
    });
  };

  Select2.prototype._registerEvents = function () {
    var self = this;

    this.on('open', function () {
      self.$container.addClass('select2-container--open');
    });

    this.on('close', function () {
      self.$container.removeClass('select2-container--open');
    });

    this.on('enable', function () {
      self.$container.removeClass('select2-container--disabled');
    });

    this.on('disable', function () {
      self.$container.addClass('select2-container--disabled');
    });

    this.on('blur', function () {
      self.$container.removeClass('select2-container--focus');
    });

    this.on('query', function (params) {
      if (!self.isOpen()) {
        self.trigger('open', {});
      }

      this.dataAdapter.query(params, function (data) {
        self.trigger('results:all', {
          data: data,
          query: params
        });
      });
    });

    this.on('query:append', function (params) {
      this.dataAdapter.query(params, function (data) {
        self.trigger('results:append', {
          data: data,
          query: params
        });
      });
    });

    this.on('keypress', function (evt) {
      var key = evt.which;

      if (self.isOpen()) {
        if (key === KEYS.ESC || key === KEYS.TAB ||
            (key === KEYS.UP && evt.altKey)) {
          self.close(evt);

          evt.preventDefault();
        } else if (key === KEYS.ENTER) {
          self.trigger('results:select', {});

          evt.preventDefault();
        } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
          self.trigger('results:toggle', {});

          evt.preventDefault();
        } else if (key === KEYS.UP) {
          self.trigger('results:previous', {});

          evt.preventDefault();
        } else if (key === KEYS.DOWN) {
          self.trigger('results:next', {});

          evt.preventDefault();
        }
      } else {
        if (key === KEYS.ENTER || key === KEYS.SPACE ||
            (key === KEYS.DOWN && evt.altKey)) {
          self.open();

          evt.preventDefault();
        }
      }
    });
  };

  Select2.prototype._syncAttributes = function () {
    this.options.set('disabled', this.$element.prop('disabled'));

    if (this.isDisabled()) {
      if (this.isOpen()) {
        this.close();
      }

      this.trigger('disable', {});
    } else {
      this.trigger('enable', {});
    }
  };

  Select2.prototype._isChangeMutation = function (evt, mutations) {
    var changed = false;
    var self = this;

    // Ignore any mutation events raised for elements that aren't options or
    // optgroups. This handles the case when the select element is destroyed
    if (
      evt && evt.target && (
        evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
      )
    ) {
      return;
    }

    if (!mutations) {
      // If mutation events aren't supported, then we can only assume that the
      // change affected the selections
      changed = true;
    } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
      for (var n = 0; n < mutations.addedNodes.length; n++) {
        var node = mutations.addedNodes[n];

        if (node.selected) {
          changed = true;
        }
      }
    } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
      changed = true;
    } else if ($.isArray(mutations)) {
      $.each(mutations, function(evt, mutation) {
        if (self._isChangeMutation(evt, mutation)) {
          // We've found a change mutation.
          // Let's escape from the loop and continue
          changed = true;
          return false;
        }
      });
    }
    return changed;
  };

  Select2.prototype._syncSubtree = function (evt, mutations) {
    var changed = this._isChangeMutation(evt, mutations);
    var self = this;

    // Only re-pull the data if we think there is a change
    if (changed) {
      this.dataAdapter.current(function (currentData) {
        self.trigger('selection:update', {
          data: currentData
        });
      });
    }
  };

  /**
   * Override the trigger method to automatically trigger pre-events when
   * there are events that can be prevented.
   */
  Select2.prototype.trigger = function (name, args) {
    var actualTrigger = Select2.__super__.trigger;
    var preTriggerMap = {
      'open': 'opening',
      'close': 'closing',
      'select': 'selecting',
      'unselect': 'unselecting',
      'clear': 'clearing'
    };

    if (args === undefined) {
      args = {};
    }

    if (name in preTriggerMap) {
      var preTriggerName = preTriggerMap[name];
      var preTriggerArgs = {
        prevented: false,
        name: name,
        args: args
      };

      actualTrigger.call(this, preTriggerName, preTriggerArgs);

      if (preTriggerArgs.prevented) {
        args.prevented = true;

        return;
      }
    }

    actualTrigger.call(this, name, args);
  };

  Select2.prototype.toggleDropdown = function () {
    if (this.isDisabled()) {
      return;
    }

    if (this.isOpen()) {
      this.close();
    } else {
      this.open();
    }
  };

  Select2.prototype.open = function () {
    if (this.isOpen()) {
      return;
    }

    if (this.isDisabled()) {
      return;
    }

    this.trigger('query', {});
  };

  Select2.prototype.close = function (evt) {
    if (!this.isOpen()) {
      return;
    }

    this.trigger('close', { originalEvent : evt });
  };

  /**
   * Helper method to abstract the "enabled" (not "disabled") state of this
   * object.
   *
   * @return {true} if the instance is not disabled.
   * @return {false} if the instance is disabled.
   */
  Select2.prototype.isEnabled = function () {
    return !this.isDisabled();
  };

  /**
   * Helper method to abstract the "disabled" state of this object.
   *
   * @return {true} if the disabled option is true.
   * @return {false} if the disabled option is false.
   */
  Select2.prototype.isDisabled = function () {
    return this.options.get('disabled');
  };

  Select2.prototype.isOpen = function () {
    return this.$container.hasClass('select2-container--open');
  };

  Select2.prototype.hasFocus = function () {
    return this.$container.hasClass('select2-container--focus');
  };

  Select2.prototype.focus = function (data) {
    // No need to re-trigger focus events if we are already focused
    if (this.hasFocus()) {
      return;
    }

    this.$container.addClass('select2-container--focus');
    this.trigger('focus', {});
  };

  Select2.prototype.enable = function (args) {
    if (this.options.get('debug') && window.console && console.warn) {
      console.warn(
        'Select2: The `select2("enable")` method has been deprecated and will' +
        ' be removed in later Select2 versions. Use $element.prop("disabled")' +
        ' instead.'
      );
    }

    if (args == null || args.length === 0) {
      args = [true];
    }

    var disabled = !args[0];

    this.$element.prop('disabled', disabled);
  };

  Select2.prototype.data = function () {
    if (this.options.get('debug') &&
        arguments.length > 0 && window.console && console.warn) {
      console.warn(
        'Select2: Data can no longer be set using `select2("data")`. You ' +
        'should consider setting the value instead using `$element.val()`.'
      );
    }

    var data = [];

    this.dataAdapter.current(function (currentData) {
      data = currentData;
    });

    return data;
  };

  Select2.prototype.val = function (args) {
    if (this.options.get('debug') && window.console && console.warn) {
      console.warn(
        'Select2: The `select2("val")` method has been deprecated and will be' +
        ' removed in later Select2 versions. Use $element.val() instead.'
      );
    }

    if (args == null || args.length === 0) {
      return this.$element.val();
    }

    var newVal = args[0];

    if ($.isArray(newVal)) {
      newVal = $.map(newVal, function (obj) {
        return obj.toString();
      });
    }

    this.$element.val(newVal).trigger('input').trigger('change');
  };

  Select2.prototype.destroy = function () {
    this.$container.remove();

    if (this.$element[0].detachEvent) {
      this.$element[0].detachEvent('onpropertychange', this._syncA);
    }

    if (this._observer != null) {
      this._observer.disconnect();
      this._observer = null;
    } else if (this.$element[0].removeEventListener) {
      this.$element[0]
        .removeEventListener('DOMAttrModified', this._syncA, false);
      this.$element[0]
        .removeEventListener('DOMNodeInserted', this._syncS, false);
      this.$element[0]
        .removeEventListener('DOMNodeRemoved', this._syncS, false);
    }

    this._syncA = null;
    this._syncS = null;

    this.$element.off('.select2');
    this.$element.attr('tabindex',
    Utils.GetData(this.$element[0], 'old-tabindex'));

    this.$element.removeClass('select2-hidden-accessible');
    this.$element.attr('aria-hidden', 'false');
    Utils.RemoveData(this.$element[0]);
    this.$element.removeData('select2');

    this.dataAdapter.destroy();
    this.selection.destroy();
    this.dropdown.destroy();
    this.results.destroy();

    this.dataAdapter = null;
    this.selection = null;
    this.dropdown = null;
    this.results = null;
  };

  Select2.prototype.render = function () {
    var $container = $(
      '<span class="select2 select2-container">' +
        '<span class="selection"></span>' +
        '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
      '</span>'
    );

    $container.attr('dir', this.options.get('dir'));

    this.$container = $container;

    this.$container.addClass('select2-container--' + this.options.get('theme'));

    Utils.StoreData($container[0], 'element', this.$element);

    return $container;
  };

  return Select2;
});

S2.define('jquery-mousewheel',[
  'jquery'
], function ($) {
  // Used to shim jQuery.mousewheel for non-full builds.
  return $;
});

S2.define('jquery.select2',[
  'jquery',
  'jquery-mousewheel',

  './select2/core',
  './select2/defaults',
  './select2/utils'
], function ($, _, Select2, Defaults, Utils) {
  if ($.fn.select2 == null) {
    // All methods that should return the element
    var thisMethods = ['open', 'close', 'destroy'];

    $.fn.select2 = function (options) {
      options = options || {};

      if (typeof options === 'object') {
        this.each(function () {
          var instanceOptions = $.extend(true, {}, options);

          var instance = new Select2($(this), instanceOptions);
        });

        return this;
      } else if (typeof options === 'string') {
        var ret;
        var args = Array.prototype.slice.call(arguments, 1);

        this.each(function () {
          var instance = Utils.GetData(this, 'select2');

          if (instance == null && window.console && console.error) {
            console.error(
              'The select2(\'' + options + '\') method was called on an ' +
              'element that is not using Select2.'
            );
          }

          ret = instance[options].apply(instance, args);
        });

        // Check if we should be returning `this`
        if ($.inArray(options, thisMethods) > -1) {
          return this;
        }

        return ret;
      } else {
        throw new Error('Invalid arguments for Select2: ' + options);
      }
    };
  }

  if ($.fn.select2.defaults == null) {
    $.fn.select2.defaults = Defaults;
  }

  return Select2;
});

  // Return the AMD loader configuration so it can be used outside of this file
  return {
    define: S2.define,
    require: S2.require
  };
}());

  // Autoload the jQuery bindings
  // We know that all of the modules exist above this, so we're safe
  var select2 = S2.require('jquery.select2');

  // Hold the AMD module references on the jQuery function that was just loaded
  // This allows Select2 to use the internal loader outside of this file, such
  // as in the language files.
  jQuery.fn.select2.amd = S2;

  // Return the Select2 instance for anyone who is importing it.
  return select2;
}));

});

define('jquerydialogextendjs', function (require, exports, module) {
!function(){var i;i=jQuery,i.widget("ui.dialogExtend",{version:"2.0.4",options:{closable:!0,maximizable:!1,minimizable:!1,collapsable:!1,dblclick:!1,icons:{close:"ui-icon-closethick",restore:"ui-icon-newwin",maximize:"ui-icon-extlink",minimize:"ui-icon-minus",collapse:"ui-icon-triangle-1-s"},minimizeLocation:"left",beforeMaximize:null,beforeMinimize:null,beforeRestore:null,beforeCollapse:null,load:null,maximize:null,minimize:null,collapse:null,restore:null},_create:function(){this._state="normal",i(this.element[0]).data("ui-dialog")||i.error("jQuery.dialogExtend Error : Only jQuery UI Dialog element is accepted"),this._verifyOptions(),this._initStyles(),this._initButtons(),this._toggleButtons(),this._initTitleBar(),this._setState("normal");var t=this;return this.element.on("dialogclose popupdialogclose",function(){t._restore()}),this.element.on("dialogopen popupdialogopen",function(){var e=t._getDialogElement(),o=i(".ui-dialog-titlebar-buttonpane",e);!o.length||"none"===o.css("float")&&"absolute"===o.css("position")||o.css({position:"absolute",right:".3em",top:"50%","margin-top":"-10px","margin-bottom":"0","margin-left":"0","margin-right":"0",padding:"1px",float:"none"});var n=i(".ui-dialog-titlebar-close",e);if(n.length&&n.hasClass("ui-button-icon-only")&&!(n.css("text-indent")||"").match(/^-999/)){var a=n.get(0).childNodes;a&&3===a.length&&3===a[2].nodeType&&(a[2].textContent="")}"-2px"===n.css("margin-top")&&n.css({margin:"1px",float:"none"})}),this._trigger("load")},_getDialogElement:function(){return this.element.first().dialog("widget")},_setState:function(t){i(this.element[0]).removeClass("ui-dialog-"+this._state).addClass("ui-dialog-"+t),this._getDialogElement().removeClass("jqdx-state-"+this._state).addClass("jqdx-state-"+t),this._state=t},_verifyOptions:function(){var t=["collapse","minimize","maximize"];this.options.dblclick&&-1===t.indexOf(this.options.dblclick)&&(i.error("jQuery.dialogExtend Error : Invalid <dblclick> value '"+this.options.dblclick+"'"),this.options.dblclick=!1),"left"!==this.options.minimizeLocation&&"right"!==this.options.minimizeLocation&&(i.error("jQuery.dialogExtend Error : Invalid <minimizeLocation> value '"+this.options.minimizeLocation+"'"),this.options.minimizeLocation="left")},_initStyles:function(){var t;i(".dialog-extend-css").length||(t=['<style class="dialog-extend-css" type="text/css">',".ui-dialog .jqdx-button { width: 19px; margin: 1px; display-inline-block; }",".ui-dialog.jqdx-state-collapsed >*:not(.ui-dialog-titlebar) { display: none !important; }",".ui-dialog.jqdx-state-collapsed { height: auto !important; }",".ui-dialog.jqdx-state-collapsed >.ui-dialog-titlebar { white-space: nowrap; }",".ui-dialog.jqdx-state-maximized { position: fixed !important; left: 0 !important; top: 0 !important; width: auto !important; height: 100% !important; right: 0; }",".ui-dialog.jqdx-state-maximized .ui-resizable-handle { display: none; }",".ui-dialog.jqdx-state-maximized .ui-draggable-handle { cursor: auto; }","#dialog-extend-fixed-container { position: fixed; bottom: 1px; left: 1px; right: 1px; z-index: 9999; }","#dialog-extend-fixed-container > .ui-dialog { margin: 1rem; }","#dialog-extend-fixed-container > .ui-dialog { position: static !important; width: auto !important; height: auto !important;}","#dialog-extend-fixed-container > .ui-dialog .ui-dialog-titlebar { padding-right: 7em; }","#dialog-extend-fixed-container > .ui-dialog >*:not(.ui-dialog-titlebar) { display:none !important; }","</style>",""].join(""),i(t).appendTo("body"))},_initButtons:function(){var t,e;e=this._getDialogElement().find(".ui-dialog-titlebar");var o=e.find("button.ui-dialog-titlebar-close");t=i('<div class="ui-dialog-titlebar-buttonpane"></div>').appendTo(e),o.find(".ui-icon").removeClass("ui-icon-closethick").addClass(this.options.icons.close);var n=[];"left"===this.options.minimizeLocation?(n.push("minimize"),n.push("maximize")):(n.push("maximize"),n.push("minimize")),n.push("collapse"),n.push("restore");for(var a=0;a<n.length;++a){var s=this._initModuleButton(n[a]);s.addClass("ui-button jqdx-button"),o.hasClass("ui-button-icon-only")&&(s.addClass("ui-button-icon-only"),i(".ui-icon",s).text("")),s.attr("role","button").mouseover(function(){return i(this).addClass("ui-state-hover")}).mouseout(function(){return i(this).removeClass("ui-state-hover")}).focus(function(){return i(this).addClass("ui-state-focus")}).blur(function(){return i(this).removeClass("ui-state-focus")}),t.append(s)}o.appendTo(t),o.toggle(this.options.closable)},_initModuleButton:function(t){var e=this,o=i('<a href="#">');return o.attr({title:[t.toUpperCase().slice(0,1),t.slice(1)].join(""),class:"ui-dialog-titlebar-"+t+" ui-corner-all ui-state-default"}),o.append(i("<span>").text(t).attr({class:"ui-icon "+this.options.icons[t]})),o.click(function(i){return i.preventDefault(),e[t]()}),o},_initTitleBar:function(){var t=this;i(".ui-dialog-titlebar",this._getDialogElement()).dblclick(function(){if(t.options.dblclick)return"normal"!==t._state?t.restore():t[t.options.dblclick]()}).select(function(){return!1})},state:function(){return this._state},restore:function(){return this._trigger("beforeRestore"),this._restore(),this._toggleButtons(),this._trigger("restore")},_restore:function(){"normal"!==this._state&&(this["_restore_"+this._state](),this._setState("normal"),this._getDialogElement().focus())},_toggleButtons:function(t){var e=t||this._state,o=i(".ui-dialog-titlebar",this.element[0]);i(".ui-dialog-titlebar-collapse",o[0]).toggle("collapsed"!==e&&this.options.collapsable),i(".ui-dialog-titlebar-minimize",o[0]).toggle("minimized"!==e&&this.options.minimizable),i(".ui-dialog-titlebar-maximize",o[0]).toggle("maximized"!==e&&this.options.maximizable),i(".ui-dialog-titlebar-restore",o[0]).toggle("normal"!==e)},collapse:function(){return this._trigger("beforeCollapse"),this._restore(),this._setState("collapsed"),this._toggleButtons(),this._trigger("collapse")},_restore_collapsed:function(){},_disableDragAndResize:function(){var t=this._getDialogElement();this.options.draggable&&"function"==typeof i.fn.draggable&&t.draggable("disable"),this.options.resizable&&"function"==typeof i.fn.resizable&&t.resizable("disable")},_restoreDragAndResize:function(){var t=this._getDialogElement();this.options.draggable&&"function"==typeof i.fn.draggable&&t.draggable("enable"),this.options.resizable&&"function"==typeof i.fn.resizable&&t.resizable("enable")},maximize:function(){return this._trigger("beforeMaximize"),"normal"!==this._state&&this._restore(),this._disableDragAndResize(),this._setState("maximized"),this._toggleButtons(),this._trigger("maximize")},_restore_maximized:function(){this._restoreDragAndResize()},minimize:function(){var t,e=this._getDialogElement();return this._trigger("beforeMinimize"),this._restore(),t=i("#dialog-extend-fixed-container"),t.length||(t=i('<div id="dialog-extend-fixed-container"></div>').appendTo("body")),this._toggleButtons("minimized"),e.data("parent-before-minimize",e.parent().get(0)),this._disableDragAndResize(),e.detach(),e.css({float:this.options.minimizeLocation}),this._setState("minimized"),e.appendTo(t),this._trigger("minimize")},_restore_minimized:function(){var i=this._getDialogElement();i.css({float:""});var t=i.data("parent-before-minimize");i.detach().appendTo(t),this._restoreDragAndResize()}})}();
//# sourceMappingURL=jquery.dialogextend.min.js.map

});
